@agentprojectcontext/apx 1.78.0 → 1.80.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 (97) hide show
  1. package/package.json +1 -1
  2. package/src/core/agent/run-agent.js +46 -6
  3. package/src/core/agent/super-agent.js +3 -0
  4. package/src/core/agent/tool-summary.js +65 -0
  5. package/src/core/agent/tools/handlers/list-commitments.js +80 -0
  6. package/src/core/agent/tools/handlers/list-tasks.js +66 -27
  7. package/src/core/agent/tools/handlers/record-commitment.js +68 -0
  8. package/src/core/agent/tools/handlers/send-telegram.js +68 -2
  9. package/src/core/agent/tools/names.js +6 -0
  10. package/src/core/agent/tools/registry.js +9 -0
  11. package/src/core/agent/tools/tool-call-parser.js +123 -6
  12. package/src/core/channels/telegram/ask-callbacks.js +121 -6
  13. package/src/core/channels/telegram/dispatch.js +21 -4
  14. package/src/core/channels/telegram/inbound/file.js +108 -0
  15. package/src/core/channels/telegram/inbound/photo.js +42 -11
  16. package/src/core/channels/telegram/media.js +31 -3
  17. package/src/core/channels/telegram/reply.js +32 -5
  18. package/src/core/config/paths.js +3 -0
  19. package/src/core/config/redact.js +22 -0
  20. package/src/core/daemon/service.js +238 -0
  21. package/src/core/engines/gemini.js +343 -63
  22. package/src/core/engines/openai-compatible.js +21 -2
  23. package/src/core/memory/consolidate.js +225 -0
  24. package/src/core/nudge/index.js +192 -0
  25. package/src/core/nudge/policy.js +143 -0
  26. package/src/core/nudge/store.js +141 -0
  27. package/src/core/profiles/bundled/secretary/PROFILE.md +8 -9
  28. package/src/core/profiles/bundled/secretary/config.schema.json +33 -3
  29. package/src/core/profiles/bundled/secretary/routines/day-close.json +7 -3
  30. package/src/core/profiles/bundled/secretary/routines/day-open.json +7 -3
  31. package/src/core/profiles/bundled/secretary/routines/watch.json +13 -0
  32. package/src/core/routines/runner.js +102 -3
  33. package/src/core/routines/signals.js +270 -0
  34. package/src/core/stores/commitments.js +331 -0
  35. package/src/core/stores/messages.js +10 -1
  36. package/src/core/stores/routines.js +17 -3
  37. package/src/core/util/thinking.js +51 -0
  38. package/src/host/daemon/api/commitments.js +135 -0
  39. package/src/host/daemon/api/nudges.js +112 -0
  40. package/src/host/daemon/api/routines.js +24 -0
  41. package/src/host/daemon/api/self-memory.js +50 -0
  42. package/src/host/daemon/api/telegram.js +42 -4
  43. package/src/host/daemon/api/voice.js +3 -1
  44. package/src/host/daemon/api.js +6 -0
  45. package/src/host/daemon/callback-reconciler.js +16 -0
  46. package/src/host/daemon/plugins/desktop/index.js +7 -1
  47. package/src/host/daemon/plugins/telegram/index.js +7 -2
  48. package/src/host/daemon/wakeup.js +17 -3
  49. package/src/interfaces/cli/commands/commitment.js +154 -0
  50. package/src/interfaces/cli/commands/daemon.js +57 -0
  51. package/src/interfaces/cli/commands/memory.js +73 -0
  52. package/src/interfaces/cli/commands/nudge.js +130 -0
  53. package/src/interfaces/cli/help/index.js +2 -2
  54. package/src/interfaces/cli/routes/commitment.js +19 -0
  55. package/src/interfaces/cli/routes/daemon.js +7 -1
  56. package/src/interfaces/cli/routes/index.js +4 -0
  57. package/src/interfaces/cli/routes/memory.js +10 -2
  58. package/src/interfaces/cli/routes/nudge.js +17 -0
  59. package/src/interfaces/web/dist/assets/index-CvEoGtTf.js +849 -0
  60. package/src/interfaces/web/dist/assets/index-CvEoGtTf.js.map +1 -0
  61. package/src/interfaces/web/dist/assets/index-DzBBXFaO.css +1 -0
  62. package/src/interfaces/web/dist/index.html +2 -2
  63. package/src/interfaces/web/package-lock.json +11 -10
  64. package/src/interfaces/web/src/components/Section.tsx +18 -3
  65. package/src/interfaces/web/src/components/chat/MessageBubble.tsx +13 -0
  66. package/src/interfaces/web/src/components/cron/CronPicker.tsx +196 -0
  67. package/src/interfaces/web/src/components/inbox/InboxList.tsx +145 -0
  68. package/src/interfaces/web/src/components/memory/MemoryBrowser.tsx +34 -4
  69. package/src/interfaces/web/src/components/routines/RoutineDetail.tsx +16 -4
  70. package/src/interfaces/web/src/components/routines/RoutineEditor.tsx +12 -2
  71. package/src/interfaces/web/src/components/routines/shared.ts +14 -5
  72. package/src/interfaces/web/src/components/settings/NudgePanel.tsx +183 -0
  73. package/src/interfaces/web/src/components/settings/ProfilePanel.tsx +36 -12
  74. package/src/interfaces/web/src/components/ui/filter-chips.tsx +47 -0
  75. package/src/interfaces/web/src/components/ui.tsx +1 -0
  76. package/src/interfaces/web/src/constants/index.ts +1 -0
  77. package/src/interfaces/web/src/hooks/useChat.ts +5 -1
  78. package/src/interfaces/web/src/hooks/useNudges.ts +38 -0
  79. package/src/interfaces/web/src/i18n/en.ts +127 -0
  80. package/src/interfaces/web/src/i18n/es.ts +127 -0
  81. package/src/interfaces/web/src/lib/api/commitments.ts +57 -0
  82. package/src/interfaces/web/src/lib/api/notebook.ts +23 -0
  83. package/src/interfaces/web/src/lib/api/nudges.ts +53 -0
  84. package/src/interfaces/web/src/lib/cron.ts +196 -0
  85. package/src/interfaces/web/src/lib/when.ts +32 -0
  86. package/src/interfaces/web/src/screens/InboxScreen.tsx +107 -77
  87. package/src/interfaces/web/src/screens/ProjectScreen.tsx +5 -2
  88. package/src/interfaces/web/src/screens/SettingsScreen.tsx +17 -3
  89. package/src/interfaces/web/src/screens/base/CommitmentsTab.tsx +239 -0
  90. package/src/interfaces/web/src/screens/base/GlobalTasksTab.tsx +102 -19
  91. package/src/interfaces/web/src/screens/base/LogsTab.tsx +15 -0
  92. package/src/interfaces/web/src/screens/project/ChatTab.tsx +21 -3
  93. package/src/interfaces/web/src/screens/project/RoutinesTab.tsx +13 -11
  94. package/src/interfaces/web/src/types/daemon.ts +10 -1
  95. package/src/interfaces/web/dist/assets/index-CBR_-QyA.js +0 -824
  96. package/src/interfaces/web/dist/assets/index-CBR_-QyA.js.map +0 -1
  97. package/src/interfaces/web/dist/assets/index-D_EJEA1n.css +0 -1
@@ -1,824 +0,0 @@
1
- function S5(e,t){for(var a=0;a<t.length;a++){const o=t[a];if(typeof o!="string"&&!Array.isArray(o)){for(const i in o)if(i!=="default"&&!(i in e)){const c=Object.getOwnPropertyDescriptor(o,i);c&&Object.defineProperty(e,i,c.get?c:{enumerable:!0,get:()=>o[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))o(i);new MutationObserver(i=>{for(const c of i)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function a(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(i){if(i.ep)return;i.ep=!0;const c=a(i);fetch(i.href,c)}})();function nb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Lg={exports:{}},oc={};/**
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 nj;function C5(){if(nj)return oc;nj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(o,i,c){var d=null;if(c!==void 0&&(d=""+c),i.key!==void 0&&(d=""+i.key),"key"in i){c={};for(var f in i)f!=="key"&&(c[f]=i[f])}else c=i;return i=c.ref,{$$typeof:e,type:o,key:d,ref:i!==void 0?i:null,props:c}}return oc.Fragment=t,oc.jsx=a,oc.jsxs=a,oc}var sj;function N5(){return sj||(sj=1,Lg.exports=C5()),Lg.exports}var n=N5(),Ig={exports:{}},dt={};/**
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 aj;function E5(){if(aj)return dt;aj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=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 j(B){return B===null||typeof B!="object"?null:(B=_&&B[_]||B["@@iterator"],typeof B=="function"?B:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,k={};function N(B,K,ee){this.props=B,this.context=K,this.refs=k,this.updater=ee||E}N.prototype.isReactComponent={},N.prototype.setState=function(B,K){if(typeof B!="object"&&typeof B!="function"&&B!=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,B,K,"setState")},N.prototype.forceUpdate=function(B){this.updater.enqueueForceUpdate(this,B,"forceUpdate")};function w(){}w.prototype=N.prototype;function S(B,K,ee){this.props=B,this.context=K,this.refs=k,this.updater=ee||E}var R=S.prototype=new w;R.constructor=S,y(R,N.prototype),R.isPureReactComponent=!0;var A=Array.isArray;function T(){}var z={H:null,A:null,T:null,S:null},M=Object.prototype.hasOwnProperty;function P(B,K,ee){var F=ee.ref;return{$$typeof:e,type:B,key:K,ref:F!==void 0?F:null,props:ee}}function L(B,K){return P(B.type,K,B.props)}function I(B){return typeof B=="object"&&B!==null&&B.$$typeof===e}function D(B){var K={"=":"=0",":":"=2"};return"$"+B.replace(/[=:]/g,function(ee){return K[ee]})}var $=/\/+/g;function q(B,K){return typeof B=="object"&&B!==null&&B.key!=null?D(""+B.key):K.toString(36)}function G(B){switch(B.status){case"fulfilled":return B.value;case"rejected":throw B.reason;default:switch(typeof B.status=="string"?B.then(T,T):(B.status="pending",B.then(function(K){B.status==="pending"&&(B.status="fulfilled",B.value=K)},function(K){B.status==="pending"&&(B.status="rejected",B.reason=K)})),B.status){case"fulfilled":return B.value;case"rejected":throw B.reason}}throw B}function U(B,K,ee,F,ne){var Z=typeof B;(Z==="undefined"||Z==="boolean")&&(B=null);var fe=!1;if(B===null)fe=!0;else switch(Z){case"bigint":case"string":case"number":fe=!0;break;case"object":switch(B.$$typeof){case e:case t:fe=!0;break;case h:return fe=B._init,U(fe(B._payload),K,ee,F,ne)}}if(fe)return ne=ne(B),fe=F===""?"."+q(B,0):F,A(ne)?(ee="",fe!=null&&(ee=fe.replace($,"$&/")+"/"),U(ne,K,ee,"",function(ve){return ve})):ne!=null&&(I(ne)&&(ne=L(ne,ee+(ne.key==null||B&&B.key===ne.key?"":(""+ne.key).replace($,"$&/")+"/")+fe)),K.push(ne)),1;fe=0;var Y=F===""?".":F+":";if(A(B))for(var oe=0;oe<B.length;oe++)F=B[oe],Z=Y+q(F,oe),fe+=U(F,K,ee,Z,ne);else if(oe=j(B),typeof oe=="function")for(B=oe.call(B),oe=0;!(F=B.next()).done;)F=F.value,Z=Y+q(F,oe++),fe+=U(F,K,ee,Z,ne);else if(Z==="object"){if(typeof B.then=="function")return U(G(B),K,ee,F,ne);throw K=String(B),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(B).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return fe}function V(B,K,ee){if(B==null)return B;var F=[],ne=0;return U(B,F,"","",function(Z){return K.call(ee,Z,ne++)}),F}function X(B){if(B._status===-1){var K=B._result;K=K(),K.then(function(ee){(B._status===0||B._status===-1)&&(B._status=1,B._result=ee)},function(ee){(B._status===0||B._status===-1)&&(B._status=2,B._result=ee)}),B._status===-1&&(B._status=0,B._result=K)}if(B._status===1)return B._result.default;throw B._result}var Q=typeof reportError=="function"?reportError:function(B){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof B=="object"&&B!==null&&typeof B.message=="string"?String(B.message):String(B),error:B});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",B);return}console.error(B)},W={map:V,forEach:function(B,K,ee){V(B,function(){K.apply(this,arguments)},ee)},count:function(B){var K=0;return V(B,function(){K++}),K},toArray:function(B){return V(B,function(K){return K})||[]},only:function(B){if(!I(B))throw Error("React.Children.only expected to receive a single React element child.");return B}};return dt.Activity=b,dt.Children=W,dt.Component=N,dt.Fragment=a,dt.Profiler=i,dt.PureComponent=S,dt.StrictMode=o,dt.Suspense=m,dt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,dt.__COMPILER_RUNTIME={__proto__:null,c:function(B){return z.H.useMemoCache(B)}},dt.cache=function(B){return function(){return B.apply(null,arguments)}},dt.cacheSignal=function(){return null},dt.cloneElement=function(B,K,ee){if(B==null)throw Error("The argument must be a React element, but you passed "+B+".");var F=y({},B.props),ne=B.key;if(K!=null)for(Z in K.key!==void 0&&(ne=""+K.key),K)!M.call(K,Z)||Z==="key"||Z==="__self"||Z==="__source"||Z==="ref"&&K.ref===void 0||(F[Z]=K[Z]);var Z=arguments.length-2;if(Z===1)F.children=ee;else if(1<Z){for(var fe=Array(Z),Y=0;Y<Z;Y++)fe[Y]=arguments[Y+2];F.children=fe}return P(B.type,ne,F)},dt.createContext=function(B){return B={$$typeof:d,_currentValue:B,_currentValue2:B,_threadCount:0,Provider:null,Consumer:null},B.Provider=B,B.Consumer={$$typeof:c,_context:B},B},dt.createElement=function(B,K,ee){var F,ne={},Z=null;if(K!=null)for(F in K.key!==void 0&&(Z=""+K.key),K)M.call(K,F)&&F!=="key"&&F!=="__self"&&F!=="__source"&&(ne[F]=K[F]);var fe=arguments.length-2;if(fe===1)ne.children=ee;else if(1<fe){for(var Y=Array(fe),oe=0;oe<fe;oe++)Y[oe]=arguments[oe+2];ne.children=Y}if(B&&B.defaultProps)for(F in fe=B.defaultProps,fe)ne[F]===void 0&&(ne[F]=fe[F]);return P(B,Z,ne)},dt.createRef=function(){return{current:null}},dt.forwardRef=function(B){return{$$typeof:f,render:B}},dt.isValidElement=I,dt.lazy=function(B){return{$$typeof:h,_payload:{_status:-1,_result:B},_init:X}},dt.memo=function(B,K){return{$$typeof:g,type:B,compare:K===void 0?null:K}},dt.startTransition=function(B){var K=z.T,ee={};z.T=ee;try{var F=B(),ne=z.S;ne!==null&&ne(ee,F),typeof F=="object"&&F!==null&&typeof F.then=="function"&&F.then(T,Q)}catch(Z){Q(Z)}finally{K!==null&&ee.types!==null&&(K.types=ee.types),z.T=K}},dt.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},dt.use=function(B){return z.H.use(B)},dt.useActionState=function(B,K,ee){return z.H.useActionState(B,K,ee)},dt.useCallback=function(B,K){return z.H.useCallback(B,K)},dt.useContext=function(B){return z.H.useContext(B)},dt.useDebugValue=function(){},dt.useDeferredValue=function(B,K){return z.H.useDeferredValue(B,K)},dt.useEffect=function(B,K){return z.H.useEffect(B,K)},dt.useEffectEvent=function(B){return z.H.useEffectEvent(B)},dt.useId=function(){return z.H.useId()},dt.useImperativeHandle=function(B,K,ee){return z.H.useImperativeHandle(B,K,ee)},dt.useInsertionEffect=function(B,K){return z.H.useInsertionEffect(B,K)},dt.useLayoutEffect=function(B,K){return z.H.useLayoutEffect(B,K)},dt.useMemo=function(B,K){return z.H.useMemo(B,K)},dt.useOptimistic=function(B,K){return z.H.useOptimistic(B,K)},dt.useReducer=function(B,K,ee){return z.H.useReducer(B,K,ee)},dt.useRef=function(B){return z.H.useRef(B)},dt.useState=function(B){return z.H.useState(B)},dt.useSyncExternalStore=function(B,K,ee){return z.H.useSyncExternalStore(B,K,ee)},dt.useTransition=function(){return z.H.useTransition()},dt.version="19.2.8",dt}var rj;function Yc(){return rj||(rj=1,Ig.exports=E5()),Ig.exports}var x=Yc();const Kc=nb(x),R5=S5({__proto__:null,default:Kc},[x]);var Bg={exports:{}},ic={},$g={exports:{}},Ug={};/**
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 oj;function T5(){return oj||(oj=1,(function(e){function t(U,V){var X=U.length;U.push(V);e:for(;0<X;){var Q=X-1>>>1,W=U[Q];if(0<i(W,V))U[Q]=V,U[X]=W,X=Q;else break e}}function a(U){return U.length===0?null:U[0]}function o(U){if(U.length===0)return null;var V=U[0],X=U.pop();if(X!==V){U[0]=X;e:for(var Q=0,W=U.length,B=W>>>1;Q<B;){var K=2*(Q+1)-1,ee=U[K],F=K+1,ne=U[F];if(0>i(ee,X))F<W&&0>i(ne,ee)?(U[Q]=ne,U[F]=X,Q=F):(U[Q]=ee,U[K]=X,Q=K);else if(F<W&&0>i(ne,X))U[Q]=ne,U[F]=X,Q=F;else break e}}return V}function i(U,V){var X=U.sortIndex-V.sortIndex;return X!==0?X:U.id-V.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 d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var m=[],g=[],h=1,b=null,_=3,j=!1,E=!1,y=!1,k=!1,N=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,S=typeof setImmediate<"u"?setImmediate:null;function R(U){for(var V=a(g);V!==null;){if(V.callback===null)o(g);else if(V.startTime<=U)o(g),V.sortIndex=V.expirationTime,t(m,V);else break;V=a(g)}}function A(U){if(y=!1,R(U),!E)if(a(m)!==null)E=!0,T||(T=!0,D());else{var V=a(g);V!==null&&G(A,V.startTime-U)}}var T=!1,z=-1,M=5,P=-1;function L(){return k?!0:!(e.unstable_now()-P<M)}function I(){if(k=!1,T){var U=e.unstable_now();P=U;var V=!0;try{e:{E=!1,y&&(y=!1,w(z),z=-1),j=!0;var X=_;try{t:{for(R(U),b=a(m);b!==null&&!(b.expirationTime>U&&L());){var Q=b.callback;if(typeof Q=="function"){b.callback=null,_=b.priorityLevel;var W=Q(b.expirationTime<=U);if(U=e.unstable_now(),typeof W=="function"){b.callback=W,R(U),V=!0;break t}b===a(m)&&o(m),R(U)}else o(m);b=a(m)}if(b!==null)V=!0;else{var B=a(g);B!==null&&G(A,B.startTime-U),V=!1}}break e}finally{b=null,_=X,j=!1}V=void 0}}finally{V?D():T=!1}}}var D;if(typeof S=="function")D=function(){S(I)};else if(typeof MessageChannel<"u"){var $=new MessageChannel,q=$.port2;$.port1.onmessage=I,D=function(){q.postMessage(null)}}else D=function(){N(I,0)};function G(U,V){z=N(function(){U(e.unstable_now())},V)}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(U){U.callback=null},e.unstable_forceFrameRate=function(U){0>U||125<U?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):M=0<U?Math.floor(1e3/U):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function(U){switch(_){case 1:case 2:case 3:var V=3;break;default:V=_}var X=_;_=V;try{return U()}finally{_=X}},e.unstable_requestPaint=function(){k=!0},e.unstable_runWithPriority=function(U,V){switch(U){case 1:case 2:case 3:case 4:case 5:break;default:U=3}var X=_;_=U;try{return V()}finally{_=X}},e.unstable_scheduleCallback=function(U,V,X){var Q=e.unstable_now();switch(typeof X=="object"&&X!==null?(X=X.delay,X=typeof X=="number"&&0<X?Q+X:Q):X=Q,U){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=X+W,U={id:h++,callback:V,priorityLevel:U,startTime:X,expirationTime:W,sortIndex:-1},X>Q?(U.sortIndex=X,t(g,U),a(m)===null&&U===a(g)&&(y?(w(z),z=-1):y=!0,G(A,X-Q))):(U.sortIndex=W,t(m,U),E||j||(E=!0,T||(T=!0,D()))),U},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(U){var V=_;return function(){var X=_;_=V;try{return U.apply(this,arguments)}finally{_=X}}}})(Ug)),Ug}var ij;function A5(){return ij||(ij=1,$g.exports=T5()),$g.exports}var qg={exports:{}},Gn={};/**
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 lj;function M5(){if(lj)return Gn;lj=1;var e=Yc();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 a(){}var o={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},i=Symbol.for("react.portal");function c(m,g,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:b==null?null:""+b,children:m,containerInfo:g,implementation:h}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(m,g){if(m==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Gn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Gn.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)},Gn.flushSync=function(m){var g=d.T,h=o.p;try{if(d.T=null,o.p=2,m)return m()}finally{d.T=g,o.p=h,o.d.f()}},Gn.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))},Gn.prefetchDNS=function(m){typeof m=="string"&&o.d.D(m)},Gn.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var h=g.as,b=f(h,g.crossOrigin),_=typeof g.integrity=="string"?g.integrity:void 0,j=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:j}):h==="script"&&o.d.X(m,{crossOrigin:b,integrity:_,fetchPriority:j,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Gn.preinitModule=function(m,g){if(typeof m=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var h=f(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)},Gn.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var h=g.as,b=f(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})}},Gn.preloadModule=function(m,g){if(typeof m=="string")if(g){var h=f(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)},Gn.requestFormReset=function(m){o.d.r(m)},Gn.unstable_batchedUpdates=function(m,g){return m(g)},Gn.useFormState=function(m,g,h){return d.H.useFormState(m,g,h)},Gn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Gn.version="19.2.8",Gn}var cj;function v2(){if(cj)return qg.exports;cj=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(),qg.exports=M5(),qg.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 uj;function z5(){if(uj)return ic;uj=1;var e=A5(),t=Yc(),a=v2();function o(s){var r="https://react.dev/errors/"+s;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+s+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function c(s){var r=s,l=s;if(s.alternate)for(;r.return;)r=r.return;else{s=r;do r=s,(r.flags&4098)!==0&&(l=r.return),s=r.return;while(s)}return r.tag===3?l:null}function d(s){if(s.tag===13){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function f(s){if(s.tag===31){var r=s.memoizedState;if(r===null&&(s=s.alternate,s!==null&&(r=s.memoizedState)),r!==null)return r.dehydrated}return null}function m(s){if(c(s)!==s)throw Error(o(188))}function g(s){var r=s.alternate;if(!r){if(r=c(s),r===null)throw Error(o(188));return r!==s?null:s}for(var l=s,p=r;;){var v=l.return;if(v===null)break;var C=v.alternate;if(C===null){if(p=v.return,p!==null){l=p;continue}break}if(v.child===C.child){for(C=v.child;C;){if(C===l)return m(v),s;if(C===p)return m(v),r;C=C.sibling}throw Error(o(188))}if(l.return!==p.return)l=v,p=C;else{for(var O=!1,H=v.child;H;){if(H===l){O=!0,l=v,p=C;break}if(H===p){O=!0,p=v,l=C;break}H=H.sibling}if(!O){for(H=C.child;H;){if(H===l){O=!0,l=C,p=v;break}if(H===p){O=!0,p=C,l=v;break}H=H.sibling}if(!O)throw Error(o(189))}}if(l.alternate!==p)throw Error(o(190))}if(l.tag!==3)throw Error(o(188));return l.stateNode.current===l?s:r}function h(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s;for(s=s.child;s!==null;){if(r=h(s),r!==null)return r;s=s.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),N=Symbol.for("react.profiler"),w=Symbol.for("react.consumer"),S=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),I=Symbol.iterator;function D(s){return s===null||typeof s!="object"?null:(s=I&&s[I]||s["@@iterator"],typeof s=="function"?s:null)}var $=Symbol.for("react.client.reference");function q(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===$?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case y:return"Fragment";case N:return"Profiler";case k:return"StrictMode";case A:return"Suspense";case T:return"SuspenseList";case P:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case E:return"Portal";case S:return s.displayName||"Context";case w:return(s._context.displayName||"Context")+".Consumer";case R:var r=s.render;return s=s.displayName,s||(s=r.displayName||r.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case z:return r=s.displayName||null,r!==null?r:q(s.type)||"Memo";case M:r=s._payload,s=s._init;try{return q(s(r))}catch{}}return null}var G=Array.isArray,U=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,V=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X={pending:!1,data:null,method:null,action:null},Q=[],W=-1;function B(s){return{current:s}}function K(s){0>W||(s.current=Q[W],Q[W]=null,W--)}function ee(s,r){W++,Q[W]=s.current,s.current=r}var F=B(null),ne=B(null),Z=B(null),fe=B(null);function Y(s,r){switch(ee(Z,r),ee(ne,s),ee(F,null),r.nodeType){case 9:case 11:s=(s=r.documentElement)&&(s=s.namespaceURI)?S1(s):0;break;default:if(s=r.tagName,r=r.namespaceURI)r=S1(r),s=C1(r,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}K(F),ee(F,s)}function oe(){K(F),K(ne),K(Z)}function ve(s){s.memoizedState!==null&&ee(fe,s);var r=F.current,l=C1(r,s.type);r!==l&&(ee(ne,s),ee(F,l))}function ie(s){ne.current===s&&(K(F),K(ne)),fe.current===s&&(K(fe),nc._currentValue=X)}var xe,ke;function Re(s){if(xe===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);xe=r&&r[1]||"",ke=-1<l.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+xe+s+ke}var Ae=!1;function Ie(s,r){if(!s||Ae)return"";Ae=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var p={DetermineComponentFrameRoot:function(){try{if(r){var Se=function(){throw Error()};if(Object.defineProperty(Se.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Se,[])}catch(he){var pe=he}Reflect.construct(s,[],Se)}else{try{Se.call()}catch(he){pe=he}s.call(Se.prototype)}}else{try{throw Error()}catch(he){pe=he}(Se=s())&&typeof Se.catch=="function"&&Se.catch(function(){})}}catch(he){if(he&&pe&&typeof he.stack=="string")return[he.stack,pe.stack]}return[null,null]}};p.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(p.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(p.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=p.DetermineComponentFrameRoot(),O=C[0],H=C[1];if(O&&H){var J=O.split(`
44
- `),ue=H.split(`
45
- `);for(v=p=0;p<J.length&&!J[p].includes("DetermineComponentFrameRoot");)p++;for(;v<ue.length&&!ue[v].includes("DetermineComponentFrameRoot");)v++;if(p===J.length||v===ue.length)for(p=J.length-1,v=ue.length-1;1<=p&&0<=v&&J[p]!==ue[v];)v--;for(;1<=p&&0<=v;p--,v--)if(J[p]!==ue[v]){if(p!==1||v!==1)do if(p--,v--,0>v||J[p]!==ue[v]){var _e=`
46
- `+J[p].replace(" at new "," at ");return s.displayName&&_e.includes("<anonymous>")&&(_e=_e.replace("<anonymous>",s.displayName)),_e}while(1<=p&&0<=v);break}}}finally{Ae=!1,Error.prepareStackTrace=l}return(l=s?s.displayName||s.name:"")?Re(l):""}function Oe(s,r){switch(s.tag){case 26:case 27:case 5:return Re(s.type);case 16:return Re("Lazy");case 13:return s.child!==r&&r!==null?Re("Suspense Fallback"):Re("Suspense");case 19:return Re("SuspenseList");case 0:case 15:return Ie(s.type,!1);case 11:return Ie(s.type.render,!1);case 1:return Ie(s.type,!0);case 31:return Re("Activity");default:return""}}function Te(s){try{var r="",l=null;do r+=Oe(s,l),l=s,s=s.return;while(s);return r}catch(p){return`
47
- Error generating stack: `+p.message+`
48
- `+p.stack}}var Ne=Object.prototype.hasOwnProperty,Me=e.unstable_scheduleCallback,De=e.unstable_cancelCallback,qe=e.unstable_shouldYield,Xe=e.unstable_requestPaint,me=e.unstable_now,de=e.unstable_getCurrentPriorityLevel,Le=e.unstable_ImmediatePriority,ye=e.unstable_UserBlockingPriority,Ce=e.unstable_NormalPriority,Qe=e.unstable_LowPriority,Ge=e.unstable_IdlePriority,it=e.log,Tt=e.unstable_setDisableYieldValue,_t=null,Ct=null;function je(s){if(typeof it=="function"&&Tt(s),Ct&&typeof Ct.setStrictMode=="function")try{Ct.setStrictMode(_t,s)}catch{}}var ze=Math.clz32?Math.clz32:ft,Ye=Math.log,We=Math.LN2;function ft(s){return s>>>=0,s===0?32:31-(Ye(s)/We|0)|0}var Rt=256,Qt=262144,ot=4194304;function Pt(s){var r=s&42;if(r!==0)return r;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function on(s,r,l){var p=s.pendingLanes;if(p===0)return 0;var v=0,C=s.suspendedLanes,O=s.pingedLanes;s=s.warmLanes;var H=p&134217727;return H!==0?(p=H&~C,p!==0?v=Pt(p):(O&=H,O!==0?v=Pt(O):l||(l=H&~s,l!==0&&(v=Pt(l))))):(H=p&~C,H!==0?v=Pt(H):O!==0?v=Pt(O):l||(l=p&~s,l!==0&&(v=Pt(l)))),v===0?0:r!==0&&r!==v&&(r&C)===0&&(C=v&-v,l=r&-r,C>=l||C===32&&(l&4194048)!==0)?r:v}function Yt(s,r){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&r)===0}function Fn(s,r){switch(s){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 An(){var s=ot;return ot<<=1,(ot&62914560)===0&&(ot=4194304),s}function as(s){for(var r=[],l=0;31>l;l++)r.push(s);return r}function dn(s,r){s.pendingLanes|=r,r!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function hs(s,r,l,p,v,C){var O=s.pendingLanes;s.pendingLanes=l,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=l,s.entangledLanes&=l,s.errorRecoveryDisabledLanes&=l,s.shellSuspendCounter=0;var H=s.entanglements,J=s.expirationTimes,ue=s.hiddenUpdates;for(l=O&~l;0<l;){var _e=31-ze(l),Se=1<<_e;H[_e]=0,J[_e]=-1;var pe=ue[_e];if(pe!==null)for(ue[_e]=null,_e=0;_e<pe.length;_e++){var he=pe[_e];he!==null&&(he.lane&=-536870913)}l&=~Se}p!==0&&Rs(s,p,0),C!==0&&v===0&&s.tag!==0&&(s.suspendedLanes|=C&~(O&~r))}function Rs(s,r,l){s.pendingLanes|=r,s.suspendedLanes&=~r;var p=31-ze(r);s.entangledLanes|=r,s.entanglements[p]=s.entanglements[p]|1073741824|l&261930}function oa(s,r){var l=s.entangledLanes|=r;for(s=s.entanglements;l;){var p=31-ze(l),v=1<<p;v&r|s[p]&r&&(s[p]|=r),l&=~v}}function ht(s,r){var l=r&-r;return l=(l&42)!==0?1:$t(l),(l&(s.suspendedLanes|r))!==0?0:l}function $t(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Ln(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function rs(){var s=V.p;return s!==0?s:(s=window.event,s===void 0?32:X1(s.type))}function xs(s,r){var l=V.p;try{return V.p=s,r()}finally{V.p=l}}var Mn=Math.random().toString(36).slice(2),Wt="__reactFiber$"+Mn,vn="__reactProps$"+Mn,ia="__reactContainer$"+Mn,dr="__reactEvents$"+Mn,mR="__reactListeners$"+Mn,gR="__reactHandles$"+Mn,fv="__reactResources$"+Mn,xl="__reactMarker$"+Mn;function Rp(s){delete s[Wt],delete s[vn],delete s[dr],delete s[mR],delete s[gR]}function Qo(s){var r=s[Wt];if(r)return r;for(var l=s.parentNode;l;){if(r=l[ia]||l[Wt]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(s=z1(s);s!==null;){if(l=s[Wt])return l;s=z1(s)}return r}s=l,l=s.parentNode}return null}function Wo(s){if(s=s[Wt]||s[ia]){var r=s.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return s}return null}function bl(s){var r=s.tag;if(r===5||r===26||r===27||r===6)return s.stateNode;throw Error(o(33))}function Zo(s){var r=s[fv];return r||(r=s[fv]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function zn(s){s[xl]=!0}var pv=new Set,mv={};function ao(s,r){Jo(s,r),Jo(s+"Capture",r)}function Jo(s,r){for(mv[s]=r,s=0;s<r.length;s++)pv.add(r[s])}var hR=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]*$"),gv={},hv={};function xR(s){return Ne.call(hv,s)?!0:Ne.call(gv,s)?!1:hR.test(s)?hv[s]=!0:(gv[s]=!0,!1)}function pu(s,r,l){if(xR(r))if(l===null)s.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":s.removeAttribute(r);return;case"boolean":var p=r.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){s.removeAttribute(r);return}}s.setAttribute(r,""+l)}}function mu(s,r,l){if(l===null)s.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(r);return}s.setAttribute(r,""+l)}}function Ea(s,r,l,p){if(p===null)s.removeAttribute(l);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttributeNS(r,l,""+p)}}function Ts(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function xv(s){var r=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function bR(s,r,l){var p=Object.getOwnPropertyDescriptor(s.constructor.prototype,r);if(!s.hasOwnProperty(r)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var v=p.get,C=p.set;return Object.defineProperty(s,r,{configurable:!0,get:function(){return v.call(this)},set:function(O){l=""+O,C.call(this,O)}}),Object.defineProperty(s,r,{enumerable:p.enumerable}),{getValue:function(){return l},setValue:function(O){l=""+O},stopTracking:function(){s._valueTracker=null,delete s[r]}}}}function Tp(s){if(!s._valueTracker){var r=xv(s)?"checked":"value";s._valueTracker=bR(s,r,""+s[r])}}function bv(s){if(!s)return!1;var r=s._valueTracker;if(!r)return!0;var l=r.getValue(),p="";return s&&(p=xv(s)?s.checked?"true":"false":s.value),s=p,s!==l?(r.setValue(s),!0):!1}function gu(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var _R=/[\n"\\]/g;function As(s){return s.replace(_R,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Ap(s,r,l,p,v,C,O,H){s.name="",O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?s.type=O:s.removeAttribute("type"),r!=null?O==="number"?(r===0&&s.value===""||s.value!=r)&&(s.value=""+Ts(r)):s.value!==""+Ts(r)&&(s.value=""+Ts(r)):O!=="submit"&&O!=="reset"||s.removeAttribute("value"),r!=null?Mp(s,O,Ts(r)):l!=null?Mp(s,O,Ts(l)):p!=null&&s.removeAttribute("value"),v==null&&C!=null&&(s.defaultChecked=!!C),v!=null&&(s.checked=v&&typeof v!="function"&&typeof v!="symbol"),H!=null&&typeof H!="function"&&typeof H!="symbol"&&typeof H!="boolean"?s.name=""+Ts(H):s.removeAttribute("name")}function _v(s,r,l,p,v,C,O,H){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(s.type=C),r!=null||l!=null){if(!(C!=="submit"&&C!=="reset"||r!=null)){Tp(s);return}l=l!=null?""+Ts(l):"",r=r!=null?""+Ts(r):l,H||r===s.value||(s.value=r),s.defaultValue=r}p=p??v,p=typeof p!="function"&&typeof p!="symbol"&&!!p,s.checked=H?s.checked:!!p,s.defaultChecked=!!p,O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"&&(s.name=O),Tp(s)}function Mp(s,r,l){r==="number"&&gu(s.ownerDocument)===s||s.defaultValue===""+l||(s.defaultValue=""+l)}function ei(s,r,l,p){if(s=s.options,r){r={};for(var v=0;v<l.length;v++)r["$"+l[v]]=!0;for(l=0;l<s.length;l++)v=r.hasOwnProperty("$"+s[l].value),s[l].selected!==v&&(s[l].selected=v),v&&p&&(s[l].defaultSelected=!0)}else{for(l=""+Ts(l),r=null,v=0;v<s.length;v++){if(s[v].value===l){s[v].selected=!0,p&&(s[v].defaultSelected=!0);return}r!==null||s[v].disabled||(r=s[v])}r!==null&&(r.selected=!0)}}function vv(s,r,l){if(r!=null&&(r=""+Ts(r),r!==s.value&&(s.value=r),l==null)){s.defaultValue!==r&&(s.defaultValue=r);return}s.defaultValue=l!=null?""+Ts(l):""}function yv(s,r,l,p){if(r==null){if(p!=null){if(l!=null)throw Error(o(92));if(G(p)){if(1<p.length)throw Error(o(93));p=p[0]}l=p}l==null&&(l=""),r=l}l=Ts(r),s.defaultValue=l,p=s.textContent,p===l&&p!==""&&p!==null&&(s.value=p),Tp(s)}function ti(s,r){if(r){var l=s.firstChild;if(l&&l===s.lastChild&&l.nodeType===3){l.nodeValue=r;return}}s.textContent=r}var vR=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 jv(s,r,l){var p=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?p?s.setProperty(r,""):r==="float"?s.cssFloat="":s[r]="":p?s.setProperty(r,l):typeof l!="number"||l===0||vR.has(r)?r==="float"?s.cssFloat=l:s[r]=(""+l).trim():s[r]=l+"px"}function kv(s,r,l){if(r!=null&&typeof r!="object")throw Error(o(62));if(s=s.style,l!=null){for(var p in l)!l.hasOwnProperty(p)||r!=null&&r.hasOwnProperty(p)||(p.indexOf("--")===0?s.setProperty(p,""):p==="float"?s.cssFloat="":s[p]="");for(var v in r)p=r[v],r.hasOwnProperty(v)&&l[v]!==p&&jv(s,v,p)}else for(var C in r)r.hasOwnProperty(C)&&jv(s,C,r[C])}function zp(s){if(s.indexOf("-")===-1)return!1;switch(s){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 yR=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"]]),jR=/^[\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 hu(s){return jR.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Ra(){}var Op=null;function Dp(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var ni=null,si=null;function wv(s){var r=Wo(s);if(r&&(s=r.stateNode)){var l=s[vn]||null;e:switch(s=r.stateNode,r.type){case"input":if(Ap(s,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=s;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+As(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var p=l[r];if(p!==s&&p.form===s.form){var v=p[vn]||null;if(!v)throw Error(o(90));Ap(p,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(r=0;r<l.length;r++)p=l[r],p.form===s.form&&bv(p)}break e;case"textarea":vv(s,l.value,l.defaultValue);break e;case"select":r=l.value,r!=null&&ei(s,!!l.multiple,r,!1)}}}var Pp=!1;function Sv(s,r,l){if(Pp)return s(r,l);Pp=!0;try{var p=s(r);return p}finally{if(Pp=!1,(ni!==null||si!==null)&&(sd(),ni&&(r=ni,s=si,si=ni=null,wv(r),s)))for(r=0;r<s.length;r++)wv(s[r])}}function _l(s,r){var l=s.stateNode;if(l===null)return null;var p=l[vn]||null;if(p===null)return null;l=p[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(s=s.type,p=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!p;break e;default:s=!1}if(s)return null;if(l&&typeof l!="function")throw Error(o(231,r,typeof l));return l}var Ta=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Lp=!1;if(Ta)try{var vl={};Object.defineProperty(vl,"passive",{get:function(){Lp=!0}}),window.addEventListener("test",vl,vl),window.removeEventListener("test",vl,vl)}catch{Lp=!1}var fr=null,Ip=null,xu=null;function Cv(){if(xu)return xu;var s,r=Ip,l=r.length,p,v="value"in fr?fr.value:fr.textContent,C=v.length;for(s=0;s<l&&r[s]===v[s];s++);var O=l-s;for(p=1;p<=O&&r[l-p]===v[C-p];p++);return xu=v.slice(s,1<p?1-p:void 0)}function bu(s){var r=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&r===13&&(s=13)):s=r,s===10&&(s=13),32<=s||s===13?s:0}function _u(){return!0}function Nv(){return!1}function os(s){function r(l,p,v,C,O){this._reactName=l,this._targetInst=v,this.type=p,this.nativeEvent=C,this.target=O,this.currentTarget=null;for(var H in s)s.hasOwnProperty(H)&&(l=s[H],this[H]=l?l(C):C[H]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?_u:Nv,this.isPropagationStopped=Nv,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=_u)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=_u)},persist:function(){},isPersistent:_u}),r}var ro={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},vu=os(ro),yl=b({},ro,{view:0,detail:0}),kR=os(yl),Bp,$p,jl,yu=b({},yl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qp,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==jl&&(jl&&s.type==="mousemove"?(Bp=s.screenX-jl.screenX,$p=s.screenY-jl.screenY):$p=Bp=0,jl=s),Bp)},movementY:function(s){return"movementY"in s?s.movementY:$p}}),Ev=os(yu),wR=b({},yu,{dataTransfer:0}),SR=os(wR),CR=b({},yl,{relatedTarget:0}),Up=os(CR),NR=b({},ro,{animationName:0,elapsedTime:0,pseudoElement:0}),ER=os(NR),RR=b({},ro,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),TR=os(RR),AR=b({},ro,{data:0}),Rv=os(AR),MR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},zR={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"},OR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function DR(s){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(s):(s=OR[s])?!!r[s]:!1}function qp(){return DR}var PR=b({},yl,{key:function(s){if(s.key){var r=MR[s.key]||s.key;if(r!=="Unidentified")return r}return s.type==="keypress"?(s=bu(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?zR[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qp,charCode:function(s){return s.type==="keypress"?bu(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?bu(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),LR=os(PR),IR=b({},yu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Tv=os(IR),BR=b({},yl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qp}),$R=os(BR),UR=b({},ro,{propertyName:0,elapsedTime:0,pseudoElement:0}),qR=os(UR),HR=b({},yu,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),VR=os(HR),FR=b({},ro,{newState:0,oldState:0}),GR=os(FR),YR=[9,13,27,32],Hp=Ta&&"CompositionEvent"in window,kl=null;Ta&&"documentMode"in document&&(kl=document.documentMode);var KR=Ta&&"TextEvent"in window&&!kl,Av=Ta&&(!Hp||kl&&8<kl&&11>=kl),Mv=" ",zv=!1;function Ov(s,r){switch(s){case"keyup":return YR.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Dv(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var ai=!1;function XR(s,r){switch(s){case"compositionend":return Dv(r);case"keypress":return r.which!==32?null:(zv=!0,Mv);case"textInput":return s=r.data,s===Mv&&zv?null:s;default:return null}}function QR(s,r){if(ai)return s==="compositionend"||!Hp&&Ov(s,r)?(s=Cv(),xu=Ip=fr=null,ai=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Av&&r.locale!=="ko"?null:r.data;default:return null}}var WR={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 Pv(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r==="input"?!!WR[s.type]:r==="textarea"}function Lv(s,r,l,p){ni?si?si.push(p):si=[p]:ni=p,r=ud(r,"onChange"),0<r.length&&(l=new vu("onChange","change",null,l,p),s.push({event:l,listeners:r}))}var wl=null,Sl=null;function ZR(s){_1(s,0)}function ju(s){var r=bl(s);if(bv(r))return s}function Iv(s,r){if(s==="change")return r}var Bv=!1;if(Ta){var Vp;if(Ta){var Fp="oninput"in document;if(!Fp){var $v=document.createElement("div");$v.setAttribute("oninput","return;"),Fp=typeof $v.oninput=="function"}Vp=Fp}else Vp=!1;Bv=Vp&&(!document.documentMode||9<document.documentMode)}function Uv(){wl&&(wl.detachEvent("onpropertychange",qv),Sl=wl=null)}function qv(s){if(s.propertyName==="value"&&ju(Sl)){var r=[];Lv(r,Sl,s,Dp(s)),Sv(ZR,r)}}function JR(s,r,l){s==="focusin"?(Uv(),wl=r,Sl=l,wl.attachEvent("onpropertychange",qv)):s==="focusout"&&Uv()}function eT(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return ju(Sl)}function tT(s,r){if(s==="click")return ju(r)}function nT(s,r){if(s==="input"||s==="change")return ju(r)}function sT(s,r){return s===r&&(s!==0||1/s===1/r)||s!==s&&r!==r}var bs=typeof Object.is=="function"?Object.is:sT;function Cl(s,r){if(bs(s,r))return!0;if(typeof s!="object"||s===null||typeof r!="object"||r===null)return!1;var l=Object.keys(s),p=Object.keys(r);if(l.length!==p.length)return!1;for(p=0;p<l.length;p++){var v=l[p];if(!Ne.call(r,v)||!bs(s[v],r[v]))return!1}return!0}function Hv(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Vv(s,r){var l=Hv(s);s=0;for(var p;l;){if(l.nodeType===3){if(p=s+l.textContent.length,s<=r&&p>=r)return{node:l,offset:r-s};s=p}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=Hv(l)}}function Fv(s,r){return s&&r?s===r?!0:s&&s.nodeType===3?!1:r&&r.nodeType===3?Fv(s,r.parentNode):"contains"in s?s.contains(r):s.compareDocumentPosition?!!(s.compareDocumentPosition(r)&16):!1:!1}function Gv(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var r=gu(s.document);r instanceof s.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)s=r.contentWindow;else break;r=gu(s.document)}return r}function Gp(s){var r=s&&s.nodeName&&s.nodeName.toLowerCase();return r&&(r==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||r==="textarea"||s.contentEditable==="true")}var aT=Ta&&"documentMode"in document&&11>=document.documentMode,ri=null,Yp=null,Nl=null,Kp=!1;function Yv(s,r,l){var p=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;Kp||ri==null||ri!==gu(p)||(p=ri,"selectionStart"in p&&Gp(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),Nl&&Cl(Nl,p)||(Nl=p,p=ud(Yp,"onSelect"),0<p.length&&(r=new vu("onSelect","select",null,r,l),s.push({event:r,listeners:p}),r.target=ri)))}function oo(s,r){var l={};return l[s.toLowerCase()]=r.toLowerCase(),l["Webkit"+s]="webkit"+r,l["Moz"+s]="moz"+r,l}var oi={animationend:oo("Animation","AnimationEnd"),animationiteration:oo("Animation","AnimationIteration"),animationstart:oo("Animation","AnimationStart"),transitionrun:oo("Transition","TransitionRun"),transitionstart:oo("Transition","TransitionStart"),transitioncancel:oo("Transition","TransitionCancel"),transitionend:oo("Transition","TransitionEnd")},Xp={},Kv={};Ta&&(Kv=document.createElement("div").style,"AnimationEvent"in window||(delete oi.animationend.animation,delete oi.animationiteration.animation,delete oi.animationstart.animation),"TransitionEvent"in window||delete oi.transitionend.transition);function io(s){if(Xp[s])return Xp[s];if(!oi[s])return s;var r=oi[s],l;for(l in r)if(r.hasOwnProperty(l)&&l in Kv)return Xp[s]=r[l];return s}var Xv=io("animationend"),Qv=io("animationiteration"),Wv=io("animationstart"),rT=io("transitionrun"),oT=io("transitionstart"),iT=io("transitioncancel"),Zv=io("transitionend"),Jv=new Map,Qp="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(" ");Qp.push("scrollEnd");function Ys(s,r){Jv.set(s,r),ao(r,[s])}var ku=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Ms=[],ii=0,Wp=0;function wu(){for(var s=ii,r=Wp=ii=0;r<s;){var l=Ms[r];Ms[r++]=null;var p=Ms[r];Ms[r++]=null;var v=Ms[r];Ms[r++]=null;var C=Ms[r];if(Ms[r++]=null,p!==null&&v!==null){var O=p.pending;O===null?v.next=v:(v.next=O.next,O.next=v),p.pending=v}C!==0&&ey(l,v,C)}}function Su(s,r,l,p){Ms[ii++]=s,Ms[ii++]=r,Ms[ii++]=l,Ms[ii++]=p,Wp|=p,s.lanes|=p,s=s.alternate,s!==null&&(s.lanes|=p)}function Zp(s,r,l,p){return Su(s,r,l,p),Cu(s)}function lo(s,r){return Su(s,null,null,r),Cu(s)}function ey(s,r,l){s.lanes|=l;var p=s.alternate;p!==null&&(p.lanes|=l);for(var v=!1,C=s.return;C!==null;)C.childLanes|=l,p=C.alternate,p!==null&&(p.childLanes|=l),C.tag===22&&(s=C.stateNode,s===null||s._visibility&1||(v=!0)),s=C,C=C.return;return s.tag===3?(C=s.stateNode,v&&r!==null&&(v=31-ze(l),s=C.hiddenUpdates,p=s[v],p===null?s[v]=[r]:p.push(r),r.lane=l|536870912),C):null}function Cu(s){if(50<Xl)throw Xl=0,ig=null,Error(o(185));for(var r=s.return;r!==null;)s=r,r=s.return;return s.tag===3?s.stateNode:null}var li={};function lT(s,r,l,p){this.tag=s,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _s(s,r,l,p){return new lT(s,r,l,p)}function Jp(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Aa(s,r){var l=s.alternate;return l===null?(l=_s(s.tag,r,s.key,s.mode),l.elementType=s.elementType,l.type=s.type,l.stateNode=s.stateNode,l.alternate=s,s.alternate=l):(l.pendingProps=r,l.type=s.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=s.flags&65011712,l.childLanes=s.childLanes,l.lanes=s.lanes,l.child=s.child,l.memoizedProps=s.memoizedProps,l.memoizedState=s.memoizedState,l.updateQueue=s.updateQueue,r=s.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=s.sibling,l.index=s.index,l.ref=s.ref,l.refCleanup=s.refCleanup,l}function ty(s,r){s.flags&=65011714;var l=s.alternate;return l===null?(s.childLanes=0,s.lanes=r,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=l.childLanes,s.lanes=l.lanes,s.child=l.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=l.memoizedProps,s.memoizedState=l.memoizedState,s.updateQueue=l.updateQueue,s.type=l.type,r=l.dependencies,s.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),s}function Nu(s,r,l,p,v,C){var O=0;if(p=s,typeof s=="function")Jp(s)&&(O=1);else if(typeof s=="string")O=p5(s,l,F.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case P:return s=_s(31,l,r,v),s.elementType=P,s.lanes=C,s;case y:return co(l.children,v,C,r);case k:O=8,v|=24;break;case N:return s=_s(12,l,r,v|2),s.elementType=N,s.lanes=C,s;case A:return s=_s(13,l,r,v),s.elementType=A,s.lanes=C,s;case T:return s=_s(19,l,r,v),s.elementType=T,s.lanes=C,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case S:O=10;break e;case w:O=9;break e;case R:O=11;break e;case z:O=14;break e;case M:O=16,p=null;break e}O=29,l=Error(o(130,s===null?"null":typeof s,"")),p=null}return r=_s(O,l,r,v),r.elementType=s,r.type=p,r.lanes=C,r}function co(s,r,l,p){return s=_s(7,s,p,r),s.lanes=l,s}function em(s,r,l){return s=_s(6,s,null,r),s.lanes=l,s}function ny(s){var r=_s(18,null,null,0);return r.stateNode=s,r}function tm(s,r,l){return r=_s(4,s.children!==null?s.children:[],s.key,r),r.lanes=l,r.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},r}var sy=new WeakMap;function zs(s,r){if(typeof s=="object"&&s!==null){var l=sy.get(s);return l!==void 0?l:(r={value:s,source:r,stack:Te(r)},sy.set(s,r),r)}return{value:s,source:r,stack:Te(r)}}var ci=[],ui=0,Eu=null,El=0,Os=[],Ds=0,pr=null,la=1,ca="";function Ma(s,r){ci[ui++]=El,ci[ui++]=Eu,Eu=s,El=r}function ay(s,r,l){Os[Ds++]=la,Os[Ds++]=ca,Os[Ds++]=pr,pr=s;var p=la;s=ca;var v=32-ze(p)-1;p&=~(1<<v),l+=1;var C=32-ze(r)+v;if(30<C){var O=v-v%5;C=(p&(1<<O)-1).toString(32),p>>=O,v-=O,la=1<<32-ze(r)+v|l<<v|p,ca=C+s}else la=1<<C|l<<v|p,ca=s}function nm(s){s.return!==null&&(Ma(s,1),ay(s,1,0))}function sm(s){for(;s===Eu;)Eu=ci[--ui],ci[ui]=null,El=ci[--ui],ci[ui]=null;for(;s===pr;)pr=Os[--Ds],Os[Ds]=null,ca=Os[--Ds],Os[Ds]=null,la=Os[--Ds],Os[Ds]=null}function ry(s,r){Os[Ds++]=la,Os[Ds++]=ca,Os[Ds++]=pr,la=r.id,ca=r.overflow,pr=s}var In=null,en=null,Nt=!1,mr=null,Ps=!1,am=Error(o(519));function gr(s){var r=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Rl(zs(r,s)),am}function oy(s){var r=s.stateNode,l=s.type,p=s.memoizedProps;switch(r[Wt]=s,r[vn]=p,l){case"dialog":jt("cancel",r),jt("close",r);break;case"iframe":case"object":case"embed":jt("load",r);break;case"video":case"audio":for(l=0;l<Wl.length;l++)jt(Wl[l],r);break;case"source":jt("error",r);break;case"img":case"image":case"link":jt("error",r),jt("load",r);break;case"details":jt("toggle",r);break;case"input":jt("invalid",r),_v(r,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":jt("invalid",r);break;case"textarea":jt("invalid",r),yv(r,p.value,p.defaultValue,p.children)}l=p.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||p.suppressHydrationWarning===!0||k1(r.textContent,l)?(p.popover!=null&&(jt("beforetoggle",r),jt("toggle",r)),p.onScroll!=null&&jt("scroll",r),p.onScrollEnd!=null&&jt("scrollend",r),p.onClick!=null&&(r.onclick=Ra),r=!0):r=!1,r||gr(s,!0)}function iy(s){for(In=s.return;In;)switch(In.tag){case 5:case 31:case 13:Ps=!1;return;case 27:case 3:Ps=!0;return;default:In=In.return}}function di(s){if(s!==In)return!1;if(!Nt)return iy(s),Nt=!0,!1;var r=s.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=s.type,l=!(l!=="form"&&l!=="button")||jg(s.type,s.memoizedProps)),l=!l),l&&en&&gr(s),iy(s),r===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(317));en=M1(s)}else if(r===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(317));en=M1(s)}else r===27?(r=en,Rr(s.type)?(s=Ng,Ng=null,en=s):en=r):en=In?Is(s.stateNode.nextSibling):null;return!0}function uo(){en=In=null,Nt=!1}function rm(){var s=mr;return s!==null&&(us===null?us=s:us.push.apply(us,s),mr=null),s}function Rl(s){mr===null?mr=[s]:mr.push(s)}var om=B(null),fo=null,za=null;function hr(s,r,l){ee(om,r._currentValue),r._currentValue=l}function Oa(s){s._currentValue=om.current,K(om)}function im(s,r,l){for(;s!==null;){var p=s.alternate;if((s.childLanes&r)!==r?(s.childLanes|=r,p!==null&&(p.childLanes|=r)):p!==null&&(p.childLanes&r)!==r&&(p.childLanes|=r),s===l)break;s=s.return}}function lm(s,r,l,p){var v=s.child;for(v!==null&&(v.return=s);v!==null;){var C=v.dependencies;if(C!==null){var O=v.child;C=C.firstContext;e:for(;C!==null;){var H=C;C=v;for(var J=0;J<r.length;J++)if(H.context===r[J]){C.lanes|=l,H=C.alternate,H!==null&&(H.lanes|=l),im(C.return,l,s),p||(O=null);break e}C=H.next}}else if(v.tag===18){if(O=v.return,O===null)throw Error(o(341));O.lanes|=l,C=O.alternate,C!==null&&(C.lanes|=l),im(O,l,s),O=null}else O=v.child;if(O!==null)O.return=v;else for(O=v;O!==null;){if(O===s){O=null;break}if(v=O.sibling,v!==null){v.return=O.return,O=v;break}O=O.return}v=O}}function fi(s,r,l,p){s=null;for(var v=r,C=!1;v!==null;){if(!C){if((v.flags&524288)!==0)C=!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 H=v.type;bs(v.pendingProps.value,O.value)||(s!==null?s.push(H):s=[H])}}else if(v===fe.current){if(O=v.alternate,O===null)throw Error(o(387));O.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(s!==null?s.push(nc):s=[nc])}v=v.return}s!==null&&lm(r,s,l,p),r.flags|=262144}function Ru(s){for(s=s.firstContext;s!==null;){if(!bs(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function po(s){fo=s,za=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Bn(s){return ly(fo,s)}function Tu(s,r){return fo===null&&po(s),ly(s,r)}function ly(s,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},za===null){if(s===null)throw Error(o(308));za=r,s.dependencies={lanes:0,firstContext:r},s.flags|=524288}else za=za.next=r;return l}var cT=typeof AbortController<"u"?AbortController:function(){var s=[],r=this.signal={aborted:!1,addEventListener:function(l,p){s.push(p)}};this.abort=function(){r.aborted=!0,s.forEach(function(l){return l()})}},uT=e.unstable_scheduleCallback,dT=e.unstable_NormalPriority,yn={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function cm(){return{controller:new cT,data:new Map,refCount:0}}function Tl(s){s.refCount--,s.refCount===0&&uT(dT,function(){s.controller.abort()})}var Al=null,um=0,pi=0,mi=null;function fT(s,r){if(Al===null){var l=Al=[];um=0,pi=pg(),mi={status:"pending",value:void 0,then:function(p){l.push(p)}}}return um++,r.then(cy,cy),r}function cy(){if(--um===0&&Al!==null){mi!==null&&(mi.status="fulfilled");var s=Al;Al=null,pi=0,mi=null;for(var r=0;r<s.length;r++)(0,s[r])()}}function pT(s,r){var l=[],p={status:"pending",value:null,reason:null,then:function(v){l.push(v)}};return s.then(function(){p.status="fulfilled",p.value=r;for(var v=0;v<l.length;v++)(0,l[v])(r)},function(v){for(p.status="rejected",p.reason=v,v=0;v<l.length;v++)(0,l[v])(void 0)}),p}var uy=U.S;U.S=function(s,r){Y0=me(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&fT(s,r),uy!==null&&uy(s,r)};var mo=B(null);function dm(){var s=mo.current;return s!==null?s:Kt.pooledCache}function Au(s,r){r===null?ee(mo,mo.current):ee(mo,r.pool)}function dy(){var s=dm();return s===null?null:{parent:yn._currentValue,pool:s}}var gi=Error(o(460)),fm=Error(o(474)),Mu=Error(o(542)),zu={then:function(){}};function fy(s){return s=s.status,s==="fulfilled"||s==="rejected"}function py(s,r,l){switch(l=s[l],l===void 0?s.push(r):l!==r&&(r.then(Ra,Ra),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,gy(s),s;default:if(typeof r.status=="string")r.then(Ra,Ra);else{if(s=Kt,s!==null&&100<s.shellSuspendCounter)throw Error(o(482));s=r,s.status="pending",s.then(function(p){if(r.status==="pending"){var v=r;v.status="fulfilled",v.value=p}},function(p){if(r.status==="pending"){var v=r;v.status="rejected",v.reason=p}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw s=r.reason,gy(s),s}throw ho=r,gi}}function go(s){try{var r=s._init;return r(s._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(ho=l,gi):l}}var ho=null;function my(){if(ho===null)throw Error(o(459));var s=ho;return ho=null,s}function gy(s){if(s===gi||s===Mu)throw Error(o(483))}var hi=null,Ml=0;function Ou(s){var r=Ml;return Ml+=1,hi===null&&(hi=[]),py(hi,s,r)}function zl(s,r){r=r.props.ref,s.ref=r!==void 0?r:null}function Du(s,r){throw r.$$typeof===_?Error(o(525)):(s=Object.prototype.toString.call(r),Error(o(31,s==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":s)))}function hy(s){function r(ae,te){if(s){var ce=ae.deletions;ce===null?(ae.deletions=[te],ae.flags|=16):ce.push(te)}}function l(ae,te){if(!s)return null;for(;te!==null;)r(ae,te),te=te.sibling;return null}function p(ae){for(var te=new Map;ae!==null;)ae.key!==null?te.set(ae.key,ae):te.set(ae.index,ae),ae=ae.sibling;return te}function v(ae,te){return ae=Aa(ae,te),ae.index=0,ae.sibling=null,ae}function C(ae,te,ce){return ae.index=ce,s?(ce=ae.alternate,ce!==null?(ce=ce.index,ce<te?(ae.flags|=67108866,te):ce):(ae.flags|=67108866,te)):(ae.flags|=1048576,te)}function O(ae){return s&&ae.alternate===null&&(ae.flags|=67108866),ae}function H(ae,te,ce,we){return te===null||te.tag!==6?(te=em(ce,ae.mode,we),te.return=ae,te):(te=v(te,ce),te.return=ae,te)}function J(ae,te,ce,we){var et=ce.type;return et===y?_e(ae,te,ce.props.children,we,ce.key):te!==null&&(te.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===M&&go(et)===te.type)?(te=v(te,ce.props),zl(te,ce),te.return=ae,te):(te=Nu(ce.type,ce.key,ce.props,null,ae.mode,we),zl(te,ce),te.return=ae,te)}function ue(ae,te,ce,we){return te===null||te.tag!==4||te.stateNode.containerInfo!==ce.containerInfo||te.stateNode.implementation!==ce.implementation?(te=tm(ce,ae.mode,we),te.return=ae,te):(te=v(te,ce.children||[]),te.return=ae,te)}function _e(ae,te,ce,we,et){return te===null||te.tag!==7?(te=co(ce,ae.mode,we,et),te.return=ae,te):(te=v(te,ce),te.return=ae,te)}function Se(ae,te,ce){if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return te=em(""+te,ae.mode,ce),te.return=ae,te;if(typeof te=="object"&&te!==null){switch(te.$$typeof){case j:return ce=Nu(te.type,te.key,te.props,null,ae.mode,ce),zl(ce,te),ce.return=ae,ce;case E:return te=tm(te,ae.mode,ce),te.return=ae,te;case M:return te=go(te),Se(ae,te,ce)}if(G(te)||D(te))return te=co(te,ae.mode,ce,null),te.return=ae,te;if(typeof te.then=="function")return Se(ae,Ou(te),ce);if(te.$$typeof===S)return Se(ae,Tu(ae,te),ce);Du(ae,te)}return null}function pe(ae,te,ce,we){var et=te!==null?te.key:null;if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return et!==null?null:H(ae,te,""+ce,we);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case j:return ce.key===et?J(ae,te,ce,we):null;case E:return ce.key===et?ue(ae,te,ce,we):null;case M:return ce=go(ce),pe(ae,te,ce,we)}if(G(ce)||D(ce))return et!==null?null:_e(ae,te,ce,we,null);if(typeof ce.then=="function")return pe(ae,te,Ou(ce),we);if(ce.$$typeof===S)return pe(ae,te,Tu(ae,ce),we);Du(ae,ce)}return null}function he(ae,te,ce,we,et){if(typeof we=="string"&&we!==""||typeof we=="number"||typeof we=="bigint")return ae=ae.get(ce)||null,H(te,ae,""+we,et);if(typeof we=="object"&&we!==null){switch(we.$$typeof){case j:return ae=ae.get(we.key===null?ce:we.key)||null,J(te,ae,we,et);case E:return ae=ae.get(we.key===null?ce:we.key)||null,ue(te,ae,we,et);case M:return we=go(we),he(ae,te,ce,we,et)}if(G(we)||D(we))return ae=ae.get(ce)||null,_e(te,ae,we,et,null);if(typeof we.then=="function")return he(ae,te,ce,Ou(we),et);if(we.$$typeof===S)return he(ae,te,ce,Tu(te,we),et);Du(te,we)}return null}function Fe(ae,te,ce,we){for(var et=null,At=null,Ke=te,mt=te=0,wt=null;Ke!==null&&mt<ce.length;mt++){Ke.index>mt?(wt=Ke,Ke=null):wt=Ke.sibling;var Mt=pe(ae,Ke,ce[mt],we);if(Mt===null){Ke===null&&(Ke=wt);break}s&&Ke&&Mt.alternate===null&&r(ae,Ke),te=C(Mt,te,mt),At===null?et=Mt:At.sibling=Mt,At=Mt,Ke=wt}if(mt===ce.length)return l(ae,Ke),Nt&&Ma(ae,mt),et;if(Ke===null){for(;mt<ce.length;mt++)Ke=Se(ae,ce[mt],we),Ke!==null&&(te=C(Ke,te,mt),At===null?et=Ke:At.sibling=Ke,At=Ke);return Nt&&Ma(ae,mt),et}for(Ke=p(Ke);mt<ce.length;mt++)wt=he(Ke,ae,mt,ce[mt],we),wt!==null&&(s&&wt.alternate!==null&&Ke.delete(wt.key===null?mt:wt.key),te=C(wt,te,mt),At===null?et=wt:At.sibling=wt,At=wt);return s&&Ke.forEach(function(Or){return r(ae,Or)}),Nt&&Ma(ae,mt),et}function at(ae,te,ce,we){if(ce==null)throw Error(o(151));for(var et=null,At=null,Ke=te,mt=te=0,wt=null,Mt=ce.next();Ke!==null&&!Mt.done;mt++,Mt=ce.next()){Ke.index>mt?(wt=Ke,Ke=null):wt=Ke.sibling;var Or=pe(ae,Ke,Mt.value,we);if(Or===null){Ke===null&&(Ke=wt);break}s&&Ke&&Or.alternate===null&&r(ae,Ke),te=C(Or,te,mt),At===null?et=Or:At.sibling=Or,At=Or,Ke=wt}if(Mt.done)return l(ae,Ke),Nt&&Ma(ae,mt),et;if(Ke===null){for(;!Mt.done;mt++,Mt=ce.next())Mt=Se(ae,Mt.value,we),Mt!==null&&(te=C(Mt,te,mt),At===null?et=Mt:At.sibling=Mt,At=Mt);return Nt&&Ma(ae,mt),et}for(Ke=p(Ke);!Mt.done;mt++,Mt=ce.next())Mt=he(Ke,ae,mt,Mt.value,we),Mt!==null&&(s&&Mt.alternate!==null&&Ke.delete(Mt.key===null?mt:Mt.key),te=C(Mt,te,mt),At===null?et=Mt:At.sibling=Mt,At=Mt);return s&&Ke.forEach(function(w5){return r(ae,w5)}),Nt&&Ma(ae,mt),et}function Ht(ae,te,ce,we){if(typeof ce=="object"&&ce!==null&&ce.type===y&&ce.key===null&&(ce=ce.props.children),typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case j:e:{for(var et=ce.key;te!==null;){if(te.key===et){if(et=ce.type,et===y){if(te.tag===7){l(ae,te.sibling),we=v(te,ce.props.children),we.return=ae,ae=we;break e}}else if(te.elementType===et||typeof et=="object"&&et!==null&&et.$$typeof===M&&go(et)===te.type){l(ae,te.sibling),we=v(te,ce.props),zl(we,ce),we.return=ae,ae=we;break e}l(ae,te);break}else r(ae,te);te=te.sibling}ce.type===y?(we=co(ce.props.children,ae.mode,we,ce.key),we.return=ae,ae=we):(we=Nu(ce.type,ce.key,ce.props,null,ae.mode,we),zl(we,ce),we.return=ae,ae=we)}return O(ae);case E:e:{for(et=ce.key;te!==null;){if(te.key===et)if(te.tag===4&&te.stateNode.containerInfo===ce.containerInfo&&te.stateNode.implementation===ce.implementation){l(ae,te.sibling),we=v(te,ce.children||[]),we.return=ae,ae=we;break e}else{l(ae,te);break}else r(ae,te);te=te.sibling}we=tm(ce,ae.mode,we),we.return=ae,ae=we}return O(ae);case M:return ce=go(ce),Ht(ae,te,ce,we)}if(G(ce))return Fe(ae,te,ce,we);if(D(ce)){if(et=D(ce),typeof et!="function")throw Error(o(150));return ce=et.call(ce),at(ae,te,ce,we)}if(typeof ce.then=="function")return Ht(ae,te,Ou(ce),we);if(ce.$$typeof===S)return Ht(ae,te,Tu(ae,ce),we);Du(ae,ce)}return typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint"?(ce=""+ce,te!==null&&te.tag===6?(l(ae,te.sibling),we=v(te,ce),we.return=ae,ae=we):(l(ae,te),we=em(ce,ae.mode,we),we.return=ae,ae=we),O(ae)):l(ae,te)}return function(ae,te,ce,we){try{Ml=0;var et=Ht(ae,te,ce,we);return hi=null,et}catch(Ke){if(Ke===gi||Ke===Mu)throw Ke;var At=_s(29,Ke,null,ae.mode);return At.lanes=we,At.return=ae,At}finally{}}}var xo=hy(!0),xy=hy(!1),xr=!1;function pm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function mm(s,r){s=s.updateQueue,r.updateQueue===s&&(r.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function br(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function _r(s,r,l){var p=s.updateQueue;if(p===null)return null;if(p=p.shared,(Ot&2)!==0){var v=p.pending;return v===null?r.next=r:(r.next=v.next,v.next=r),p.pending=r,r=Cu(s),ey(s,null,l),r}return Su(s,p,r,l),Cu(s)}function Ol(s,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var p=r.lanes;p&=s.pendingLanes,l|=p,r.lanes=l,oa(s,l)}}function gm(s,r){var l=s.updateQueue,p=s.alternate;if(p!==null&&(p=p.updateQueue,l===p)){var v=null,C=null;if(l=l.firstBaseUpdate,l!==null){do{var O={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};C===null?v=C=O:C=C.next=O,l=l.next}while(l!==null);C===null?v=C=r:C=C.next=r}else v=C=r;l={baseState:p.baseState,firstBaseUpdate:v,lastBaseUpdate:C,shared:p.shared,callbacks:p.callbacks},s.updateQueue=l;return}s=l.lastBaseUpdate,s===null?l.firstBaseUpdate=r:s.next=r,l.lastBaseUpdate=r}var hm=!1;function Dl(){if(hm){var s=mi;if(s!==null)throw s}}function Pl(s,r,l,p){hm=!1;var v=s.updateQueue;xr=!1;var C=v.firstBaseUpdate,O=v.lastBaseUpdate,H=v.shared.pending;if(H!==null){v.shared.pending=null;var J=H,ue=J.next;J.next=null,O===null?C=ue:O.next=ue,O=J;var _e=s.alternate;_e!==null&&(_e=_e.updateQueue,H=_e.lastBaseUpdate,H!==O&&(H===null?_e.firstBaseUpdate=ue:H.next=ue,_e.lastBaseUpdate=J))}if(C!==null){var Se=v.baseState;O=0,_e=ue=J=null,H=C;do{var pe=H.lane&-536870913,he=pe!==H.lane;if(he?(kt&pe)===pe:(p&pe)===pe){pe!==0&&pe===pi&&(hm=!0),_e!==null&&(_e=_e.next={lane:0,tag:H.tag,payload:H.payload,callback:null,next:null});e:{var Fe=s,at=H;pe=r;var Ht=l;switch(at.tag){case 1:if(Fe=at.payload,typeof Fe=="function"){Se=Fe.call(Ht,Se,pe);break e}Se=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=at.payload,pe=typeof Fe=="function"?Fe.call(Ht,Se,pe):Fe,pe==null)break e;Se=b({},Se,pe);break e;case 2:xr=!0}}pe=H.callback,pe!==null&&(s.flags|=64,he&&(s.flags|=8192),he=v.callbacks,he===null?v.callbacks=[pe]:he.push(pe))}else he={lane:pe,tag:H.tag,payload:H.payload,callback:H.callback,next:null},_e===null?(ue=_e=he,J=Se):_e=_e.next=he,O|=pe;if(H=H.next,H===null){if(H=v.shared.pending,H===null)break;he=H,H=he.next,he.next=null,v.lastBaseUpdate=he,v.shared.pending=null}}while(!0);_e===null&&(J=Se),v.baseState=J,v.firstBaseUpdate=ue,v.lastBaseUpdate=_e,C===null&&(v.shared.lanes=0),wr|=O,s.lanes=O,s.memoizedState=Se}}function by(s,r){if(typeof s!="function")throw Error(o(191,s));s.call(r)}function _y(s,r){var l=s.callbacks;if(l!==null)for(s.callbacks=null,s=0;s<l.length;s++)by(l[s],r)}var xi=B(null),Pu=B(0);function vy(s,r){s=Ha,ee(Pu,s),ee(xi,r),Ha=s|r.baseLanes}function xm(){ee(Pu,Ha),ee(xi,xi.current)}function bm(){Ha=Pu.current,K(xi),K(Pu)}var vs=B(null),Ls=null;function vr(s){var r=s.alternate;ee(hn,hn.current&1),ee(vs,s),Ls===null&&(r===null||xi.current!==null||r.memoizedState!==null)&&(Ls=s)}function _m(s){ee(hn,hn.current),ee(vs,s),Ls===null&&(Ls=s)}function yy(s){s.tag===22?(ee(hn,hn.current),ee(vs,s),Ls===null&&(Ls=s)):yr()}function yr(){ee(hn,hn.current),ee(vs,vs.current)}function ys(s){K(vs),Ls===s&&(Ls=null),K(hn)}var hn=B(0);function Lu(s){for(var r=s;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Sg(l)||Cg(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Da=0,pt=null,Ut=null,jn=null,Iu=!1,bi=!1,bo=!1,Bu=0,Ll=0,_i=null,mT=0;function fn(){throw Error(o(321))}function vm(s,r){if(r===null)return!1;for(var l=0;l<r.length&&l<s.length;l++)if(!bs(s[l],r[l]))return!1;return!0}function ym(s,r,l,p,v,C){return Da=C,pt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,U.H=s===null||s.memoizedState===null?a0:Pm,bo=!1,C=l(p,v),bo=!1,bi&&(C=ky(r,l,p,v)),jy(s),C}function jy(s){U.H=$l;var r=Ut!==null&&Ut.next!==null;if(Da=0,jn=Ut=pt=null,Iu=!1,Ll=0,_i=null,r)throw Error(o(300));s===null||kn||(s=s.dependencies,s!==null&&Ru(s)&&(kn=!0))}function ky(s,r,l,p){pt=s;var v=0;do{if(bi&&(_i=null),Ll=0,bi=!1,25<=v)throw Error(o(301));if(v+=1,jn=Ut=null,s.updateQueue!=null){var C=s.updateQueue;C.lastEffect=null,C.events=null,C.stores=null,C.memoCache!=null&&(C.memoCache.index=0)}U.H=r0,C=r(l,p)}while(bi);return C}function gT(){var s=U.H,r=s.useState()[0];return r=typeof r.then=="function"?Il(r):r,s=s.useState()[0],(Ut!==null?Ut.memoizedState:null)!==s&&(pt.flags|=1024),r}function jm(){var s=Bu!==0;return Bu=0,s}function km(s,r,l){r.updateQueue=s.updateQueue,r.flags&=-2053,s.lanes&=~l}function wm(s){if(Iu){for(s=s.memoizedState;s!==null;){var r=s.queue;r!==null&&(r.pending=null),s=s.next}Iu=!1}Da=0,jn=Ut=pt=null,bi=!1,Ll=Bu=0,_i=null}function Wn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jn===null?pt.memoizedState=jn=s:jn=jn.next=s,jn}function xn(){if(Ut===null){var s=pt.alternate;s=s!==null?s.memoizedState:null}else s=Ut.next;var r=jn===null?pt.memoizedState:jn.next;if(r!==null)jn=r,Ut=s;else{if(s===null)throw pt.alternate===null?Error(o(467)):Error(o(310));Ut=s,s={memoizedState:Ut.memoizedState,baseState:Ut.baseState,baseQueue:Ut.baseQueue,queue:Ut.queue,next:null},jn===null?pt.memoizedState=jn=s:jn=jn.next=s}return jn}function $u(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Il(s){var r=Ll;return Ll+=1,_i===null&&(_i=[]),s=py(_i,s,r),r=pt,(jn===null?r.memoizedState:jn.next)===null&&(r=r.alternate,U.H=r===null||r.memoizedState===null?a0:Pm),s}function Uu(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Il(s);if(s.$$typeof===S)return Bn(s)}throw Error(o(438,String(s)))}function Sm(s){var r=null,l=pt.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var p=pt.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(r={data:p.data.map(function(v){return v.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=$u(),pt.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(s),p=0;p<s;p++)l[p]=L;return r.index++,l}function Pa(s,r){return typeof r=="function"?r(s):r}function qu(s){var r=xn();return Cm(r,Ut,s)}function Cm(s,r,l){var p=s.queue;if(p===null)throw Error(o(311));p.lastRenderedReducer=l;var v=s.baseQueue,C=p.pending;if(C!==null){if(v!==null){var O=v.next;v.next=C.next,C.next=O}r.baseQueue=v=C,p.pending=null}if(C=s.baseState,v===null)s.memoizedState=C;else{r=v.next;var H=O=null,J=null,ue=r,_e=!1;do{var Se=ue.lane&-536870913;if(Se!==ue.lane?(kt&Se)===Se:(Da&Se)===Se){var pe=ue.revertLane;if(pe===0)J!==null&&(J=J.next={lane:0,revertLane:0,gesture:null,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null}),Se===pi&&(_e=!0);else if((Da&pe)===pe){ue=ue.next,pe===pi&&(_e=!0);continue}else Se={lane:0,revertLane:ue.revertLane,gesture:null,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null},J===null?(H=J=Se,O=C):J=J.next=Se,pt.lanes|=pe,wr|=pe;Se=ue.action,bo&&l(C,Se),C=ue.hasEagerState?ue.eagerState:l(C,Se)}else pe={lane:Se,revertLane:ue.revertLane,gesture:ue.gesture,action:ue.action,hasEagerState:ue.hasEagerState,eagerState:ue.eagerState,next:null},J===null?(H=J=pe,O=C):J=J.next=pe,pt.lanes|=Se,wr|=Se;ue=ue.next}while(ue!==null&&ue!==r);if(J===null?O=C:J.next=H,!bs(C,s.memoizedState)&&(kn=!0,_e&&(l=mi,l!==null)))throw l;s.memoizedState=C,s.baseState=O,s.baseQueue=J,p.lastRenderedState=C}return v===null&&(p.lanes=0),[s.memoizedState,p.dispatch]}function Nm(s){var r=xn(),l=r.queue;if(l===null)throw Error(o(311));l.lastRenderedReducer=s;var p=l.dispatch,v=l.pending,C=r.memoizedState;if(v!==null){l.pending=null;var O=v=v.next;do C=s(C,O.action),O=O.next;while(O!==v);bs(C,r.memoizedState)||(kn=!0),r.memoizedState=C,r.baseQueue===null&&(r.baseState=C),l.lastRenderedState=C}return[C,p]}function wy(s,r,l){var p=pt,v=xn(),C=Nt;if(C){if(l===void 0)throw Error(o(407));l=l()}else l=r();var O=!bs((Ut||v).memoizedState,l);if(O&&(v.memoizedState=l,kn=!0),v=v.queue,Tm(Ny.bind(null,p,v,s),[s]),v.getSnapshot!==r||O||jn!==null&&jn.memoizedState.tag&1){if(p.flags|=2048,vi(9,{destroy:void 0},Cy.bind(null,p,v,l,r),null),Kt===null)throw Error(o(349));C||(Da&127)!==0||Sy(p,r,l)}return l}function Sy(s,r,l){s.flags|=16384,s={getSnapshot:r,value:l},r=pt.updateQueue,r===null?(r=$u(),pt.updateQueue=r,r.stores=[s]):(l=r.stores,l===null?r.stores=[s]:l.push(s))}function Cy(s,r,l,p){r.value=l,r.getSnapshot=p,Ey(r)&&Ry(s)}function Ny(s,r,l){return l(function(){Ey(r)&&Ry(s)})}function Ey(s){var r=s.getSnapshot;s=s.value;try{var l=r();return!bs(s,l)}catch{return!0}}function Ry(s){var r=lo(s,2);r!==null&&ds(r,s,2)}function Em(s){var r=Wn();if(typeof s=="function"){var l=s;if(s=l(),bo){je(!0);try{l()}finally{je(!1)}}}return r.memoizedState=r.baseState=s,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pa,lastRenderedState:s},r}function Ty(s,r,l,p){return s.baseState=l,Cm(s,Ut,typeof p=="function"?p:Pa)}function hT(s,r,l,p,v){if(Fu(s))throw Error(o(485));if(s=r.action,s!==null){var C={payload:v,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(O){C.listeners.push(O)}};U.T!==null?l(!0):C.isTransition=!1,p(C),l=r.pending,l===null?(C.next=r.pending=C,Ay(r,C)):(C.next=l.next,r.pending=l.next=C)}}function Ay(s,r){var l=r.action,p=r.payload,v=s.state;if(r.isTransition){var C=U.T,O={};U.T=O;try{var H=l(v,p),J=U.S;J!==null&&J(O,H),My(s,r,H)}catch(ue){Rm(s,r,ue)}finally{C!==null&&O.types!==null&&(C.types=O.types),U.T=C}}else try{C=l(v,p),My(s,r,C)}catch(ue){Rm(s,r,ue)}}function My(s,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(p){zy(s,r,p)},function(p){return Rm(s,r,p)}):zy(s,r,l)}function zy(s,r,l){r.status="fulfilled",r.value=l,Oy(r),s.state=l,r=s.pending,r!==null&&(l=r.next,l===r?s.pending=null:(l=l.next,r.next=l,Ay(s,l)))}function Rm(s,r,l){var p=s.pending;if(s.pending=null,p!==null){p=p.next;do r.status="rejected",r.reason=l,Oy(r),r=r.next;while(r!==p)}s.action=null}function Oy(s){s=s.listeners;for(var r=0;r<s.length;r++)(0,s[r])()}function Dy(s,r){return r}function Py(s,r){if(Nt){var l=Kt.formState;if(l!==null){e:{var p=pt;if(Nt){if(en){t:{for(var v=en,C=Ps;v.nodeType!==8;){if(!C){v=null;break t}if(v=Is(v.nextSibling),v===null){v=null;break t}}C=v.data,v=C==="F!"||C==="F"?v:null}if(v){en=Is(v.nextSibling),p=v.data==="F!";break e}}gr(p)}p=!1}p&&(r=l[0])}}return l=Wn(),l.memoizedState=l.baseState=r,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Dy,lastRenderedState:r},l.queue=p,l=t0.bind(null,pt,p),p.dispatch=l,p=Em(!1),C=Dm.bind(null,pt,!1,p.queue),p=Wn(),v={state:r,dispatch:null,action:s,pending:null},p.queue=v,l=hT.bind(null,pt,v,C,l),v.dispatch=l,p.memoizedState=s,[r,l,!1]}function Ly(s){var r=xn();return Iy(r,Ut,s)}function Iy(s,r,l){if(r=Cm(s,r,Dy)[0],s=qu(Pa)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var p=Il(r)}catch(O){throw O===gi?Mu:O}else p=r;r=xn();var v=r.queue,C=v.dispatch;return l!==r.memoizedState&&(pt.flags|=2048,vi(9,{destroy:void 0},xT.bind(null,v,l),null)),[p,C,s]}function xT(s,r){s.action=r}function By(s){var r=xn(),l=Ut;if(l!==null)return Iy(r,l,s);xn(),r=r.memoizedState,l=xn();var p=l.queue.dispatch;return l.memoizedState=s,[r,p,!1]}function vi(s,r,l,p){return s={tag:s,create:l,deps:p,inst:r,next:null},r=pt.updateQueue,r===null&&(r=$u(),pt.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=s.next=s:(p=l.next,l.next=s,s.next=p,r.lastEffect=s),s}function $y(){return xn().memoizedState}function Hu(s,r,l,p){var v=Wn();pt.flags|=s,v.memoizedState=vi(1|r,{destroy:void 0},l,p===void 0?null:p)}function Vu(s,r,l,p){var v=xn();p=p===void 0?null:p;var C=v.memoizedState.inst;Ut!==null&&p!==null&&vm(p,Ut.memoizedState.deps)?v.memoizedState=vi(r,C,l,p):(pt.flags|=s,v.memoizedState=vi(1|r,C,l,p))}function Uy(s,r){Hu(8390656,8,s,r)}function Tm(s,r){Vu(2048,8,s,r)}function bT(s){pt.flags|=4;var r=pt.updateQueue;if(r===null)r=$u(),pt.updateQueue=r,r.events=[s];else{var l=r.events;l===null?r.events=[s]:l.push(s)}}function qy(s){var r=xn().memoizedState;return bT({ref:r,nextImpl:s}),function(){if((Ot&2)!==0)throw Error(o(440));return r.impl.apply(void 0,arguments)}}function Hy(s,r){return Vu(4,2,s,r)}function Vy(s,r){return Vu(4,4,s,r)}function Fy(s,r){if(typeof r=="function"){s=s();var l=r(s);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return s=s(),r.current=s,function(){r.current=null}}function Gy(s,r,l){l=l!=null?l.concat([s]):null,Vu(4,4,Fy.bind(null,r,s),l)}function Am(){}function Yy(s,r){var l=xn();r=r===void 0?null:r;var p=l.memoizedState;return r!==null&&vm(r,p[1])?p[0]:(l.memoizedState=[s,r],s)}function Ky(s,r){var l=xn();r=r===void 0?null:r;var p=l.memoizedState;if(r!==null&&vm(r,p[1]))return p[0];if(p=s(),bo){je(!0);try{s()}finally{je(!1)}}return l.memoizedState=[p,r],p}function Mm(s,r,l){return l===void 0||(Da&1073741824)!==0&&(kt&261930)===0?s.memoizedState=r:(s.memoizedState=l,s=X0(),pt.lanes|=s,wr|=s,l)}function Xy(s,r,l,p){return bs(l,r)?l:xi.current!==null?(s=Mm(s,l,p),bs(s,r)||(kn=!0),s):(Da&42)===0||(Da&1073741824)!==0&&(kt&261930)===0?(kn=!0,s.memoizedState=l):(s=X0(),pt.lanes|=s,wr|=s,r)}function Qy(s,r,l,p,v){var C=V.p;V.p=C!==0&&8>C?C:8;var O=U.T,H={};U.T=H,Dm(s,!1,r,l);try{var J=v(),ue=U.S;if(ue!==null&&ue(H,J),J!==null&&typeof J=="object"&&typeof J.then=="function"){var _e=pT(J,p);Bl(s,r,_e,ws(s))}else Bl(s,r,p,ws(s))}catch(Se){Bl(s,r,{then:function(){},status:"rejected",reason:Se},ws())}finally{V.p=C,O!==null&&H.types!==null&&(O.types=H.types),U.T=O}}function _T(){}function zm(s,r,l,p){if(s.tag!==5)throw Error(o(476));var v=Wy(s).queue;Qy(s,v,r,X,l===null?_T:function(){return Zy(s),l(p)})}function Wy(s){var r=s.memoizedState;if(r!==null)return r;r={memoizedState:X,baseState:X,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pa,lastRenderedState:X},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pa,lastRenderedState:l},next:null},s.memoizedState=r,s=s.alternate,s!==null&&(s.memoizedState=r),r}function Zy(s){var r=Wy(s);r.next===null&&(r=s.alternate.memoizedState),Bl(s,r.next.queue,{},ws())}function Om(){return Bn(nc)}function Jy(){return xn().memoizedState}function e0(){return xn().memoizedState}function vT(s){for(var r=s.return;r!==null;){switch(r.tag){case 24:case 3:var l=ws();s=br(l);var p=_r(r,s,l);p!==null&&(ds(p,r,l),Ol(p,r,l)),r={cache:cm()},s.payload=r;return}r=r.return}}function yT(s,r,l){var p=ws();l={lane:p,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Fu(s)?n0(r,l):(l=Zp(s,r,l,p),l!==null&&(ds(l,s,p),s0(l,r,p)))}function t0(s,r,l){var p=ws();Bl(s,r,l,p)}function Bl(s,r,l,p){var v={lane:p,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Fu(s))n0(r,v);else{var C=s.alternate;if(s.lanes===0&&(C===null||C.lanes===0)&&(C=r.lastRenderedReducer,C!==null))try{var O=r.lastRenderedState,H=C(O,l);if(v.hasEagerState=!0,v.eagerState=H,bs(H,O))return Su(s,r,v,0),Kt===null&&wu(),!1}catch{}finally{}if(l=Zp(s,r,v,p),l!==null)return ds(l,s,p),s0(l,r,p),!0}return!1}function Dm(s,r,l,p){if(p={lane:2,revertLane:pg(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},Fu(s)){if(r)throw Error(o(479))}else r=Zp(s,l,p,2),r!==null&&ds(r,s,2)}function Fu(s){var r=s.alternate;return s===pt||r!==null&&r===pt}function n0(s,r){bi=Iu=!0;var l=s.pending;l===null?r.next=r:(r.next=l.next,l.next=r),s.pending=r}function s0(s,r,l){if((l&4194048)!==0){var p=r.lanes;p&=s.pendingLanes,l|=p,r.lanes=l,oa(s,l)}}var $l={readContext:Bn,use:Uu,useCallback:fn,useContext:fn,useEffect:fn,useImperativeHandle:fn,useLayoutEffect:fn,useInsertionEffect:fn,useMemo:fn,useReducer:fn,useRef:fn,useState:fn,useDebugValue:fn,useDeferredValue:fn,useTransition:fn,useSyncExternalStore:fn,useId:fn,useHostTransitionStatus:fn,useFormState:fn,useActionState:fn,useOptimistic:fn,useMemoCache:fn,useCacheRefresh:fn};$l.useEffectEvent=fn;var a0={readContext:Bn,use:Uu,useCallback:function(s,r){return Wn().memoizedState=[s,r===void 0?null:r],s},useContext:Bn,useEffect:Uy,useImperativeHandle:function(s,r,l){l=l!=null?l.concat([s]):null,Hu(4194308,4,Fy.bind(null,r,s),l)},useLayoutEffect:function(s,r){return Hu(4194308,4,s,r)},useInsertionEffect:function(s,r){Hu(4,2,s,r)},useMemo:function(s,r){var l=Wn();r=r===void 0?null:r;var p=s();if(bo){je(!0);try{s()}finally{je(!1)}}return l.memoizedState=[p,r],p},useReducer:function(s,r,l){var p=Wn();if(l!==void 0){var v=l(r);if(bo){je(!0);try{l(r)}finally{je(!1)}}}else v=r;return p.memoizedState=p.baseState=v,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:v},p.queue=s,s=s.dispatch=yT.bind(null,pt,s),[p.memoizedState,s]},useRef:function(s){var r=Wn();return s={current:s},r.memoizedState=s},useState:function(s){s=Em(s);var r=s.queue,l=t0.bind(null,pt,r);return r.dispatch=l,[s.memoizedState,l]},useDebugValue:Am,useDeferredValue:function(s,r){var l=Wn();return Mm(l,s,r)},useTransition:function(){var s=Em(!1);return s=Qy.bind(null,pt,s.queue,!0,!1),Wn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,r,l){var p=pt,v=Wn();if(Nt){if(l===void 0)throw Error(o(407));l=l()}else{if(l=r(),Kt===null)throw Error(o(349));(kt&127)!==0||Sy(p,r,l)}v.memoizedState=l;var C={value:l,getSnapshot:r};return v.queue=C,Uy(Ny.bind(null,p,C,s),[s]),p.flags|=2048,vi(9,{destroy:void 0},Cy.bind(null,p,C,l,r),null),l},useId:function(){var s=Wn(),r=Kt.identifierPrefix;if(Nt){var l=ca,p=la;l=(p&~(1<<32-ze(p)-1)).toString(32)+l,r="_"+r+"R_"+l,l=Bu++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=mT++,r="_"+r+"r_"+l.toString(32)+"_";return s.memoizedState=r},useHostTransitionStatus:Om,useFormState:Py,useActionState:Py,useOptimistic:function(s){var r=Wn();r.memoizedState=r.baseState=s;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Dm.bind(null,pt,!0,l),l.dispatch=r,[s,r]},useMemoCache:Sm,useCacheRefresh:function(){return Wn().memoizedState=vT.bind(null,pt)},useEffectEvent:function(s){var r=Wn(),l={impl:s};return r.memoizedState=l,function(){if((Ot&2)!==0)throw Error(o(440));return l.impl.apply(void 0,arguments)}}},Pm={readContext:Bn,use:Uu,useCallback:Yy,useContext:Bn,useEffect:Tm,useImperativeHandle:Gy,useInsertionEffect:Hy,useLayoutEffect:Vy,useMemo:Ky,useReducer:qu,useRef:$y,useState:function(){return qu(Pa)},useDebugValue:Am,useDeferredValue:function(s,r){var l=xn();return Xy(l,Ut.memoizedState,s,r)},useTransition:function(){var s=qu(Pa)[0],r=xn().memoizedState;return[typeof s=="boolean"?s:Il(s),r]},useSyncExternalStore:wy,useId:Jy,useHostTransitionStatus:Om,useFormState:Ly,useActionState:Ly,useOptimistic:function(s,r){var l=xn();return Ty(l,Ut,s,r)},useMemoCache:Sm,useCacheRefresh:e0};Pm.useEffectEvent=qy;var r0={readContext:Bn,use:Uu,useCallback:Yy,useContext:Bn,useEffect:Tm,useImperativeHandle:Gy,useInsertionEffect:Hy,useLayoutEffect:Vy,useMemo:Ky,useReducer:Nm,useRef:$y,useState:function(){return Nm(Pa)},useDebugValue:Am,useDeferredValue:function(s,r){var l=xn();return Ut===null?Mm(l,s,r):Xy(l,Ut.memoizedState,s,r)},useTransition:function(){var s=Nm(Pa)[0],r=xn().memoizedState;return[typeof s=="boolean"?s:Il(s),r]},useSyncExternalStore:wy,useId:Jy,useHostTransitionStatus:Om,useFormState:By,useActionState:By,useOptimistic:function(s,r){var l=xn();return Ut!==null?Ty(l,Ut,s,r):(l.baseState=s,[s,l.queue.dispatch])},useMemoCache:Sm,useCacheRefresh:e0};r0.useEffectEvent=qy;function Lm(s,r,l,p){r=s.memoizedState,l=l(p,r),l=l==null?r:b({},r,l),s.memoizedState=l,s.lanes===0&&(s.updateQueue.baseState=l)}var Im={enqueueSetState:function(s,r,l){s=s._reactInternals;var p=ws(),v=br(p);v.payload=r,l!=null&&(v.callback=l),r=_r(s,v,p),r!==null&&(ds(r,s,p),Ol(r,s,p))},enqueueReplaceState:function(s,r,l){s=s._reactInternals;var p=ws(),v=br(p);v.tag=1,v.payload=r,l!=null&&(v.callback=l),r=_r(s,v,p),r!==null&&(ds(r,s,p),Ol(r,s,p))},enqueueForceUpdate:function(s,r){s=s._reactInternals;var l=ws(),p=br(l);p.tag=2,r!=null&&(p.callback=r),r=_r(s,p,l),r!==null&&(ds(r,s,l),Ol(r,s,l))}};function o0(s,r,l,p,v,C,O){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(p,C,O):r.prototype&&r.prototype.isPureReactComponent?!Cl(l,p)||!Cl(v,C):!0}function i0(s,r,l,p){s=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,p),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,p),r.state!==s&&Im.enqueueReplaceState(r,r.state,null)}function _o(s,r){var l=r;if("ref"in r){l={};for(var p in r)p!=="ref"&&(l[p]=r[p])}if(s=s.defaultProps){l===r&&(l=b({},l));for(var v in s)l[v]===void 0&&(l[v]=s[v])}return l}function l0(s){ku(s)}function c0(s){console.error(s)}function u0(s){ku(s)}function Gu(s,r){try{var l=s.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(p){setTimeout(function(){throw p})}}function d0(s,r,l){try{var p=s.onCaughtError;p(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function Bm(s,r,l){return l=br(l),l.tag=3,l.payload={element:null},l.callback=function(){Gu(s,r)},l}function f0(s){return s=br(s),s.tag=3,s}function p0(s,r,l,p){var v=l.type.getDerivedStateFromError;if(typeof v=="function"){var C=p.value;s.payload=function(){return v(C)},s.callback=function(){d0(r,l,p)}}var O=l.stateNode;O!==null&&typeof O.componentDidCatch=="function"&&(s.callback=function(){d0(r,l,p),typeof v!="function"&&(Sr===null?Sr=new Set([this]):Sr.add(this));var H=p.stack;this.componentDidCatch(p.value,{componentStack:H!==null?H:""})})}function jT(s,r,l,p,v){if(l.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(r=l.alternate,r!==null&&fi(r,l,v,!0),l=vs.current,l!==null){switch(l.tag){case 31:case 13:return Ls===null?ad():l.alternate===null&&pn===0&&(pn=3),l.flags&=-257,l.flags|=65536,l.lanes=v,p===zu?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([p]):r.add(p),ug(s,p,v)),!1;case 22:return l.flags|=65536,p===zu?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([p])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([p]):l.add(p)),ug(s,p,v)),!1}throw Error(o(435,l.tag))}return ug(s,p,v),ad(),!1}if(Nt)return r=vs.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=v,p!==am&&(s=Error(o(422),{cause:p}),Rl(zs(s,l)))):(p!==am&&(r=Error(o(423),{cause:p}),Rl(zs(r,l))),s=s.current.alternate,s.flags|=65536,v&=-v,s.lanes|=v,p=zs(p,l),v=Bm(s.stateNode,p,v),gm(s,v),pn!==4&&(pn=2)),!1;var C=Error(o(520),{cause:p});if(C=zs(C,l),Kl===null?Kl=[C]:Kl.push(C),pn!==4&&(pn=2),r===null)return!0;p=zs(p,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,s=v&-v,l.lanes|=s,s=Bm(l.stateNode,p,s),gm(l,s),!1;case 1:if(r=l.type,C=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||C!==null&&typeof C.componentDidCatch=="function"&&(Sr===null||!Sr.has(C))))return l.flags|=65536,v&=-v,l.lanes|=v,v=f0(v),p0(v,s,l,p),gm(l,v),!1}l=l.return}while(l!==null);return!1}var $m=Error(o(461)),kn=!1;function $n(s,r,l,p){r.child=s===null?xy(r,null,l,p):xo(r,s.child,l,p)}function m0(s,r,l,p,v){l=l.render;var C=r.ref;if("ref"in p){var O={};for(var H in p)H!=="ref"&&(O[H]=p[H])}else O=p;return po(r),p=ym(s,r,l,O,C,v),H=jm(),s!==null&&!kn?(km(s,r,v),La(s,r,v)):(Nt&&H&&nm(r),r.flags|=1,$n(s,r,p,v),r.child)}function g0(s,r,l,p,v){if(s===null){var C=l.type;return typeof C=="function"&&!Jp(C)&&C.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=C,h0(s,r,C,p,v)):(s=Nu(l.type,null,p,r,r.mode,v),s.ref=r.ref,s.return=r,r.child=s)}if(C=s.child,!Km(s,v)){var O=C.memoizedProps;if(l=l.compare,l=l!==null?l:Cl,l(O,p)&&s.ref===r.ref)return La(s,r,v)}return r.flags|=1,s=Aa(C,p),s.ref=r.ref,s.return=r,r.child=s}function h0(s,r,l,p,v){if(s!==null){var C=s.memoizedProps;if(Cl(C,p)&&s.ref===r.ref)if(kn=!1,r.pendingProps=p=C,Km(s,v))(s.flags&131072)!==0&&(kn=!0);else return r.lanes=s.lanes,La(s,r,v)}return Um(s,r,l,p,v)}function x0(s,r,l,p){var v=p.children,C=s!==null?s.memoizedState:null;if(s===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((r.flags&128)!==0){if(C=C!==null?C.baseLanes|l:l,s!==null){for(p=r.child=s.child,v=0;p!==null;)v=v|p.lanes|p.childLanes,p=p.sibling;p=v&~C}else p=0,r.child=null;return b0(s,r,C,l,p)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},s!==null&&Au(r,C!==null?C.cachePool:null),C!==null?vy(r,C):xm(),yy(r);else return p=r.lanes=536870912,b0(s,r,C!==null?C.baseLanes|l:l,l,p)}else C!==null?(Au(r,C.cachePool),vy(r,C),yr(),r.memoizedState=null):(s!==null&&Au(r,null),xm(),yr());return $n(s,r,v,l),r.child}function Ul(s,r){return s!==null&&s.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function b0(s,r,l,p,v){var C=dm();return C=C===null?null:{parent:yn._currentValue,pool:C},r.memoizedState={baseLanes:l,cachePool:C},s!==null&&Au(r,null),xm(),yy(r),s!==null&&fi(s,r,p,!0),r.childLanes=v,null}function Yu(s,r){return r=Xu({mode:r.mode,children:r.children},s.mode),r.ref=s.ref,s.child=r,r.return=s,r}function _0(s,r,l){return xo(r,s.child,null,l),s=Yu(r,r.pendingProps),s.flags|=2,ys(r),r.memoizedState=null,s}function kT(s,r,l){var p=r.pendingProps,v=(r.flags&128)!==0;if(r.flags&=-129,s===null){if(Nt){if(p.mode==="hidden")return s=Yu(r,p),r.lanes=536870912,Ul(null,s);if(_m(r),(s=en)?(s=A1(s,Ps),s=s!==null&&s.data==="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:pr!==null?{id:la,overflow:ca}:null,retryLane:536870912,hydrationErrors:null},l=ny(s),l.return=r,r.child=l,In=r,en=null)):s=null,s===null)throw gr(r);return r.lanes=536870912,null}return Yu(r,p)}var C=s.memoizedState;if(C!==null){var O=C.dehydrated;if(_m(r),v)if(r.flags&256)r.flags&=-257,r=_0(s,r,l);else if(r.memoizedState!==null)r.child=s.child,r.flags|=128,r=null;else throw Error(o(558));else if(kn||fi(s,r,l,!1),v=(l&s.childLanes)!==0,kn||v){if(p=Kt,p!==null&&(O=ht(p,l),O!==0&&O!==C.retryLane))throw C.retryLane=O,lo(s,O),ds(p,s,O),$m;ad(),r=_0(s,r,l)}else s=C.treeContext,en=Is(O.nextSibling),In=r,Nt=!0,mr=null,Ps=!1,s!==null&&ry(r,s),r=Yu(r,p),r.flags|=4096;return r}return s=Aa(s.child,{mode:p.mode,children:p.children}),s.ref=r.ref,r.child=s,s.return=r,s}function Ku(s,r){var l=r.ref;if(l===null)s!==null&&s.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(o(284));(s===null||s.ref!==l)&&(r.flags|=4194816)}}function Um(s,r,l,p,v){return po(r),l=ym(s,r,l,p,void 0,v),p=jm(),s!==null&&!kn?(km(s,r,v),La(s,r,v)):(Nt&&p&&nm(r),r.flags|=1,$n(s,r,l,v),r.child)}function v0(s,r,l,p,v,C){return po(r),r.updateQueue=null,l=ky(r,p,l,v),jy(s),p=jm(),s!==null&&!kn?(km(s,r,C),La(s,r,C)):(Nt&&p&&nm(r),r.flags|=1,$n(s,r,l,C),r.child)}function y0(s,r,l,p,v){if(po(r),r.stateNode===null){var C=li,O=l.contextType;typeof O=="object"&&O!==null&&(C=Bn(O)),C=new l(p,C),r.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,C.updater=Im,r.stateNode=C,C._reactInternals=r,C=r.stateNode,C.props=p,C.state=r.memoizedState,C.refs={},pm(r),O=l.contextType,C.context=typeof O=="object"&&O!==null?Bn(O):li,C.state=r.memoizedState,O=l.getDerivedStateFromProps,typeof O=="function"&&(Lm(r,l,O,p),C.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof C.getSnapshotBeforeUpdate=="function"||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(O=C.state,typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount(),O!==C.state&&Im.enqueueReplaceState(C,C.state,null),Pl(r,p,C,v),Dl(),C.state=r.memoizedState),typeof C.componentDidMount=="function"&&(r.flags|=4194308),p=!0}else if(s===null){C=r.stateNode;var H=r.memoizedProps,J=_o(l,H);C.props=J;var ue=C.context,_e=l.contextType;O=li,typeof _e=="object"&&_e!==null&&(O=Bn(_e));var Se=l.getDerivedStateFromProps;_e=typeof Se=="function"||typeof C.getSnapshotBeforeUpdate=="function",H=r.pendingProps!==H,_e||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(H||ue!==O)&&i0(r,C,p,O),xr=!1;var pe=r.memoizedState;C.state=pe,Pl(r,p,C,v),Dl(),ue=r.memoizedState,H||pe!==ue||xr?(typeof Se=="function"&&(Lm(r,l,Se,p),ue=r.memoizedState),(J=xr||o0(r,l,J,p,pe,ue,O))?(_e||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(r.flags|=4194308)):(typeof C.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=p,r.memoizedState=ue),C.props=p,C.state=ue,C.context=O,p=J):(typeof C.componentDidMount=="function"&&(r.flags|=4194308),p=!1)}else{C=r.stateNode,mm(s,r),O=r.memoizedProps,_e=_o(l,O),C.props=_e,Se=r.pendingProps,pe=C.context,ue=l.contextType,J=li,typeof ue=="object"&&ue!==null&&(J=Bn(ue)),H=l.getDerivedStateFromProps,(ue=typeof H=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(O!==Se||pe!==J)&&i0(r,C,p,J),xr=!1,pe=r.memoizedState,C.state=pe,Pl(r,p,C,v),Dl();var he=r.memoizedState;O!==Se||pe!==he||xr||s!==null&&s.dependencies!==null&&Ru(s.dependencies)?(typeof H=="function"&&(Lm(r,l,H,p),he=r.memoizedState),(_e=xr||o0(r,l,_e,p,pe,he,J)||s!==null&&s.dependencies!==null&&Ru(s.dependencies))?(ue||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(p,he,J),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(p,he,J)),typeof C.componentDidUpdate=="function"&&(r.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof C.componentDidUpdate!="function"||O===s.memoizedProps&&pe===s.memoizedState||(r.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||O===s.memoizedProps&&pe===s.memoizedState||(r.flags|=1024),r.memoizedProps=p,r.memoizedState=he),C.props=p,C.state=he,C.context=J,p=_e):(typeof C.componentDidUpdate!="function"||O===s.memoizedProps&&pe===s.memoizedState||(r.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||O===s.memoizedProps&&pe===s.memoizedState||(r.flags|=1024),p=!1)}return C=p,Ku(s,r),p=(r.flags&128)!==0,C||p?(C=r.stateNode,l=p&&typeof l.getDerivedStateFromError!="function"?null:C.render(),r.flags|=1,s!==null&&p?(r.child=xo(r,s.child,null,v),r.child=xo(r,null,l,v)):$n(s,r,l,v),r.memoizedState=C.state,s=r.child):s=La(s,r,v),s}function j0(s,r,l,p){return uo(),r.flags|=256,$n(s,r,l,p),r.child}var qm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hm(s){return{baseLanes:s,cachePool:dy()}}function Vm(s,r,l){return s=s!==null?s.childLanes&~l:0,r&&(s|=ks),s}function k0(s,r,l){var p=r.pendingProps,v=!1,C=(r.flags&128)!==0,O;if((O=C)||(O=s!==null&&s.memoizedState===null?!1:(hn.current&2)!==0),O&&(v=!0,r.flags&=-129),O=(r.flags&32)!==0,r.flags&=-33,s===null){if(Nt){if(v?vr(r):yr(),(s=en)?(s=A1(s,Ps),s=s!==null&&s.data!=="&"?s:null,s!==null&&(r.memoizedState={dehydrated:s,treeContext:pr!==null?{id:la,overflow:ca}:null,retryLane:536870912,hydrationErrors:null},l=ny(s),l.return=r,r.child=l,In=r,en=null)):s=null,s===null)throw gr(r);return Cg(s)?r.lanes=32:r.lanes=536870912,null}var H=p.children;return p=p.fallback,v?(yr(),v=r.mode,H=Xu({mode:"hidden",children:H},v),p=co(p,v,l,null),H.return=r,p.return=r,H.sibling=p,r.child=H,p=r.child,p.memoizedState=Hm(l),p.childLanes=Vm(s,O,l),r.memoizedState=qm,Ul(null,p)):(vr(r),Fm(r,H))}var J=s.memoizedState;if(J!==null&&(H=J.dehydrated,H!==null)){if(C)r.flags&256?(vr(r),r.flags&=-257,r=Gm(s,r,l)):r.memoizedState!==null?(yr(),r.child=s.child,r.flags|=128,r=null):(yr(),H=p.fallback,v=r.mode,p=Xu({mode:"visible",children:p.children},v),H=co(H,v,l,null),H.flags|=2,p.return=r,H.return=r,p.sibling=H,r.child=p,xo(r,s.child,null,l),p=r.child,p.memoizedState=Hm(l),p.childLanes=Vm(s,O,l),r.memoizedState=qm,r=Ul(null,p));else if(vr(r),Cg(H)){if(O=H.nextSibling&&H.nextSibling.dataset,O)var ue=O.dgst;O=ue,p=Error(o(419)),p.stack="",p.digest=O,Rl({value:p,source:null,stack:null}),r=Gm(s,r,l)}else if(kn||fi(s,r,l,!1),O=(l&s.childLanes)!==0,kn||O){if(O=Kt,O!==null&&(p=ht(O,l),p!==0&&p!==J.retryLane))throw J.retryLane=p,lo(s,p),ds(O,s,p),$m;Sg(H)||ad(),r=Gm(s,r,l)}else Sg(H)?(r.flags|=192,r.child=s.child,r=null):(s=J.treeContext,en=Is(H.nextSibling),In=r,Nt=!0,mr=null,Ps=!1,s!==null&&ry(r,s),r=Fm(r,p.children),r.flags|=4096);return r}return v?(yr(),H=p.fallback,v=r.mode,J=s.child,ue=J.sibling,p=Aa(J,{mode:"hidden",children:p.children}),p.subtreeFlags=J.subtreeFlags&65011712,ue!==null?H=Aa(ue,H):(H=co(H,v,l,null),H.flags|=2),H.return=r,p.return=r,p.sibling=H,r.child=p,Ul(null,p),p=r.child,H=s.child.memoizedState,H===null?H=Hm(l):(v=H.cachePool,v!==null?(J=yn._currentValue,v=v.parent!==J?{parent:J,pool:J}:v):v=dy(),H={baseLanes:H.baseLanes|l,cachePool:v}),p.memoizedState=H,p.childLanes=Vm(s,O,l),r.memoizedState=qm,Ul(s.child,p)):(vr(r),l=s.child,s=l.sibling,l=Aa(l,{mode:"visible",children:p.children}),l.return=r,l.sibling=null,s!==null&&(O=r.deletions,O===null?(r.deletions=[s],r.flags|=16):O.push(s)),r.child=l,r.memoizedState=null,l)}function Fm(s,r){return r=Xu({mode:"visible",children:r},s.mode),r.return=s,s.child=r}function Xu(s,r){return s=_s(22,s,null,r),s.lanes=0,s}function Gm(s,r,l){return xo(r,s.child,null,l),s=Fm(r,r.pendingProps.children),s.flags|=2,r.memoizedState=null,s}function w0(s,r,l){s.lanes|=r;var p=s.alternate;p!==null&&(p.lanes|=r),im(s.return,r,l)}function Ym(s,r,l,p,v,C){var O=s.memoizedState;O===null?s.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:p,tail:l,tailMode:v,treeForkCount:C}:(O.isBackwards=r,O.rendering=null,O.renderingStartTime=0,O.last=p,O.tail=l,O.tailMode=v,O.treeForkCount=C)}function S0(s,r,l){var p=r.pendingProps,v=p.revealOrder,C=p.tail;p=p.children;var O=hn.current,H=(O&2)!==0;if(H?(O=O&1|2,r.flags|=128):O&=1,ee(hn,O),$n(s,r,p,l),p=Nt?El:0,!H&&s!==null&&(s.flags&128)!==0)e:for(s=r.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&w0(s,l,r);else if(s.tag===19)w0(s,l,r);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===r)break e;for(;s.sibling===null;){if(s.return===null||s.return===r)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(v){case"forwards":for(l=r.child,v=null;l!==null;)s=l.alternate,s!==null&&Lu(s)===null&&(v=l),l=l.sibling;l=v,l===null?(v=r.child,r.child=null):(v=l.sibling,l.sibling=null),Ym(r,!1,v,l,C,p);break;case"backwards":case"unstable_legacy-backwards":for(l=null,v=r.child,r.child=null;v!==null;){if(s=v.alternate,s!==null&&Lu(s)===null){r.child=v;break}s=v.sibling,v.sibling=l,l=v,v=s}Ym(r,!0,l,null,C,p);break;case"together":Ym(r,!1,null,null,void 0,p);break;default:r.memoizedState=null}return r.child}function La(s,r,l){if(s!==null&&(r.dependencies=s.dependencies),wr|=r.lanes,(l&r.childLanes)===0)if(s!==null){if(fi(s,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(s!==null&&r.child!==s.child)throw Error(o(153));if(r.child!==null){for(s=r.child,l=Aa(s,s.pendingProps),r.child=l,l.return=r;s.sibling!==null;)s=s.sibling,l=l.sibling=Aa(s,s.pendingProps),l.return=r;l.sibling=null}return r.child}function Km(s,r){return(s.lanes&r)!==0?!0:(s=s.dependencies,!!(s!==null&&Ru(s)))}function wT(s,r,l){switch(r.tag){case 3:Y(r,r.stateNode.containerInfo),hr(r,yn,s.memoizedState.cache),uo();break;case 27:case 5:ve(r);break;case 4:Y(r,r.stateNode.containerInfo);break;case 10:hr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,_m(r),null;break;case 13:var p=r.memoizedState;if(p!==null)return p.dehydrated!==null?(vr(r),r.flags|=128,null):(l&r.child.childLanes)!==0?k0(s,r,l):(vr(r),s=La(s,r,l),s!==null?s.sibling:null);vr(r);break;case 19:var v=(s.flags&128)!==0;if(p=(l&r.childLanes)!==0,p||(fi(s,r,l,!1),p=(l&r.childLanes)!==0),v){if(p)return S0(s,r,l);r.flags|=128}if(v=r.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),ee(hn,hn.current),p)break;return null;case 22:return r.lanes=0,x0(s,r,l,r.pendingProps);case 24:hr(r,yn,s.memoizedState.cache)}return La(s,r,l)}function C0(s,r,l){if(s!==null)if(s.memoizedProps!==r.pendingProps)kn=!0;else{if(!Km(s,l)&&(r.flags&128)===0)return kn=!1,wT(s,r,l);kn=(s.flags&131072)!==0}else kn=!1,Nt&&(r.flags&1048576)!==0&&ay(r,El,r.index);switch(r.lanes=0,r.tag){case 16:e:{var p=r.pendingProps;if(s=go(r.elementType),r.type=s,typeof s=="function")Jp(s)?(p=_o(s,p),r.tag=1,r=y0(null,r,s,p,l)):(r.tag=0,r=Um(null,r,s,p,l));else{if(s!=null){var v=s.$$typeof;if(v===R){r.tag=11,r=m0(null,r,s,p,l);break e}else if(v===z){r.tag=14,r=g0(null,r,s,p,l);break e}}throw r=q(s)||s,Error(o(306,r,""))}}return r;case 0:return Um(s,r,r.type,r.pendingProps,l);case 1:return p=r.type,v=_o(p,r.pendingProps),y0(s,r,p,v,l);case 3:e:{if(Y(r,r.stateNode.containerInfo),s===null)throw Error(o(387));p=r.pendingProps;var C=r.memoizedState;v=C.element,mm(s,r),Pl(r,p,null,l);var O=r.memoizedState;if(p=O.cache,hr(r,yn,p),p!==C.cache&&lm(r,[yn],l,!0),Dl(),p=O.element,C.isDehydrated)if(C={element:p,isDehydrated:!1,cache:O.cache},r.updateQueue.baseState=C,r.memoizedState=C,r.flags&256){r=j0(s,r,p,l);break e}else if(p!==v){v=zs(Error(o(424)),r),Rl(v),r=j0(s,r,p,l);break e}else{switch(s=r.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(en=Is(s.firstChild),In=r,Nt=!0,mr=null,Ps=!0,l=xy(r,null,p,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(uo(),p===v){r=La(s,r,l);break e}$n(s,r,p,l)}r=r.child}return r;case 26:return Ku(s,r),s===null?(l=L1(r.type,null,r.pendingProps,null))?r.memoizedState=l:Nt||(l=r.type,s=r.pendingProps,p=dd(Z.current).createElement(l),p[Wt]=r,p[vn]=s,Un(p,l,s),zn(p),r.stateNode=p):r.memoizedState=L1(r.type,s.memoizedProps,r.pendingProps,s.memoizedState),null;case 27:return ve(r),s===null&&Nt&&(p=r.stateNode=O1(r.type,r.pendingProps,Z.current),In=r,Ps=!0,v=en,Rr(r.type)?(Ng=v,en=Is(p.firstChild)):en=v),$n(s,r,r.pendingProps.children,l),Ku(s,r),s===null&&(r.flags|=4194304),r.child;case 5:return s===null&&Nt&&((v=p=en)&&(p=e5(p,r.type,r.pendingProps,Ps),p!==null?(r.stateNode=p,In=r,en=Is(p.firstChild),Ps=!1,v=!0):v=!1),v||gr(r)),ve(r),v=r.type,C=r.pendingProps,O=s!==null?s.memoizedProps:null,p=C.children,jg(v,C)?p=null:O!==null&&jg(v,O)&&(r.flags|=32),r.memoizedState!==null&&(v=ym(s,r,gT,null,null,l),nc._currentValue=v),Ku(s,r),$n(s,r,p,l),r.child;case 6:return s===null&&Nt&&((s=l=en)&&(l=t5(l,r.pendingProps,Ps),l!==null?(r.stateNode=l,In=r,en=null,s=!0):s=!1),s||gr(r)),null;case 13:return k0(s,r,l);case 4:return Y(r,r.stateNode.containerInfo),p=r.pendingProps,s===null?r.child=xo(r,null,p,l):$n(s,r,p,l),r.child;case 11:return m0(s,r,r.type,r.pendingProps,l);case 7:return $n(s,r,r.pendingProps,l),r.child;case 8:return $n(s,r,r.pendingProps.children,l),r.child;case 12:return $n(s,r,r.pendingProps.children,l),r.child;case 10:return p=r.pendingProps,hr(r,r.type,p.value),$n(s,r,p.children,l),r.child;case 9:return v=r.type._context,p=r.pendingProps.children,po(r),v=Bn(v),p=p(v),r.flags|=1,$n(s,r,p,l),r.child;case 14:return g0(s,r,r.type,r.pendingProps,l);case 15:return h0(s,r,r.type,r.pendingProps,l);case 19:return S0(s,r,l);case 31:return kT(s,r,l);case 22:return x0(s,r,l,r.pendingProps);case 24:return po(r),p=Bn(yn),s===null?(v=dm(),v===null&&(v=Kt,C=cm(),v.pooledCache=C,C.refCount++,C!==null&&(v.pooledCacheLanes|=l),v=C),r.memoizedState={parent:p,cache:v},pm(r),hr(r,yn,v)):((s.lanes&l)!==0&&(mm(s,r),Pl(r,null,null,l),Dl()),v=s.memoizedState,C=r.memoizedState,v.parent!==p?(v={parent:p,cache:p},r.memoizedState=v,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=v),hr(r,yn,p)):(p=C.cache,hr(r,yn,p),p!==v.cache&&lm(r,[yn],l,!0))),$n(s,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(o(156,r.tag))}function Ia(s){s.flags|=4}function Xm(s,r,l,p,v){if((r=(s.mode&32)!==0)&&(r=!1),r){if(s.flags|=16777216,(v&335544128)===v)if(s.stateNode.complete)s.flags|=8192;else if(J0())s.flags|=8192;else throw ho=zu,fm}else s.flags&=-16777217}function N0(s,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!q1(r))if(J0())s.flags|=8192;else throw ho=zu,fm}function Qu(s,r){r!==null&&(s.flags|=4),s.flags&16384&&(r=s.tag!==22?An():536870912,s.lanes|=r,wi|=r)}function ql(s,r){if(!Nt)switch(s.tailMode){case"hidden":r=s.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?s.tail=null:l.sibling=null;break;case"collapsed":l=s.tail;for(var p=null;l!==null;)l.alternate!==null&&(p=l),l=l.sibling;p===null?r||s.tail===null?s.tail=null:s.tail.sibling=null:p.sibling=null}}function tn(s){var r=s.alternate!==null&&s.alternate.child===s.child,l=0,p=0;if(r)for(var v=s.child;v!==null;)l|=v.lanes|v.childLanes,p|=v.subtreeFlags&65011712,p|=v.flags&65011712,v.return=s,v=v.sibling;else for(v=s.child;v!==null;)l|=v.lanes|v.childLanes,p|=v.subtreeFlags,p|=v.flags,v.return=s,v=v.sibling;return s.subtreeFlags|=p,s.childLanes=l,r}function ST(s,r,l){var p=r.pendingProps;switch(sm(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tn(r),null;case 1:return tn(r),null;case 3:return l=r.stateNode,p=null,s!==null&&(p=s.memoizedState.cache),r.memoizedState.cache!==p&&(r.flags|=2048),Oa(yn),oe(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(s===null||s.child===null)&&(di(r)?Ia(r):s===null||s.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,rm())),tn(r),null;case 26:var v=r.type,C=r.memoizedState;return s===null?(Ia(r),C!==null?(tn(r),N0(r,C)):(tn(r),Xm(r,v,null,p,l))):C?C!==s.memoizedState?(Ia(r),tn(r),N0(r,C)):(tn(r),r.flags&=-16777217):(s=s.memoizedProps,s!==p&&Ia(r),tn(r),Xm(r,v,s,p,l)),null;case 27:if(ie(r),l=Z.current,v=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==p&&Ia(r);else{if(!p){if(r.stateNode===null)throw Error(o(166));return tn(r),null}s=F.current,di(r)?oy(r):(s=O1(v,p,l),r.stateNode=s,Ia(r))}return tn(r),null;case 5:if(ie(r),v=r.type,s!==null&&r.stateNode!=null)s.memoizedProps!==p&&Ia(r);else{if(!p){if(r.stateNode===null)throw Error(o(166));return tn(r),null}if(C=F.current,di(r))oy(r);else{var O=dd(Z.current);switch(C){case 1:C=O.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:C=O.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":C=O.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":C=O.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":C=O.createElement("div"),C.innerHTML="<script><\/script>",C=C.removeChild(C.firstChild);break;case"select":C=typeof p.is=="string"?O.createElement("select",{is:p.is}):O.createElement("select"),p.multiple?C.multiple=!0:p.size&&(C.size=p.size);break;default:C=typeof p.is=="string"?O.createElement(v,{is:p.is}):O.createElement(v)}}C[Wt]=r,C[vn]=p;e:for(O=r.child;O!==null;){if(O.tag===5||O.tag===6)C.appendChild(O.stateNode);else if(O.tag!==4&&O.tag!==27&&O.child!==null){O.child.return=O,O=O.child;continue}if(O===r)break e;for(;O.sibling===null;){if(O.return===null||O.return===r)break e;O=O.return}O.sibling.return=O.return,O=O.sibling}r.stateNode=C;e:switch(Un(C,v,p),v){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&Ia(r)}}return tn(r),Xm(r,r.type,s===null?null:s.memoizedProps,r.pendingProps,l),null;case 6:if(s&&r.stateNode!=null)s.memoizedProps!==p&&Ia(r);else{if(typeof p!="string"&&r.stateNode===null)throw Error(o(166));if(s=Z.current,di(r)){if(s=r.stateNode,l=r.memoizedProps,p=null,v=In,v!==null)switch(v.tag){case 27:case 5:p=v.memoizedProps}s[Wt]=r,s=!!(s.nodeValue===l||p!==null&&p.suppressHydrationWarning===!0||k1(s.nodeValue,l)),s||gr(r,!0)}else s=dd(s).createTextNode(p),s[Wt]=r,r.stateNode=s}return tn(r),null;case 31:if(l=r.memoizedState,s===null||s.memoizedState!==null){if(p=di(r),l!==null){if(s===null){if(!p)throw Error(o(318));if(s=r.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(o(557));s[Wt]=r}else uo(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tn(r),s=!1}else l=rm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=l),s=!0;if(!s)return r.flags&256?(ys(r),r):(ys(r),null);if((r.flags&128)!==0)throw Error(o(558))}return tn(r),null;case 13:if(p=r.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(v=di(r),p!==null&&p.dehydrated!==null){if(s===null){if(!v)throw Error(o(318));if(v=r.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(o(317));v[Wt]=r}else uo(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tn(r),v=!1}else v=rm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=v),v=!0;if(!v)return r.flags&256?(ys(r),r):(ys(r),null)}return ys(r),(r.flags&128)!==0?(r.lanes=l,r):(l=p!==null,s=s!==null&&s.memoizedState!==null,l&&(p=r.child,v=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(v=p.alternate.memoizedState.cachePool.pool),C=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(C=p.memoizedState.cachePool.pool),C!==v&&(p.flags|=2048)),l!==s&&l&&(r.child.flags|=8192),Qu(r,r.updateQueue),tn(r),null);case 4:return oe(),s===null&&xg(r.stateNode.containerInfo),tn(r),null;case 10:return Oa(r.type),tn(r),null;case 19:if(K(hn),p=r.memoizedState,p===null)return tn(r),null;if(v=(r.flags&128)!==0,C=p.rendering,C===null)if(v)ql(p,!1);else{if(pn!==0||s!==null&&(s.flags&128)!==0)for(s=r.child;s!==null;){if(C=Lu(s),C!==null){for(r.flags|=128,ql(p,!1),s=C.updateQueue,r.updateQueue=s,Qu(r,s),r.subtreeFlags=0,s=l,l=r.child;l!==null;)ty(l,s),l=l.sibling;return ee(hn,hn.current&1|2),Nt&&Ma(r,p.treeForkCount),r.child}s=s.sibling}p.tail!==null&&me()>td&&(r.flags|=128,v=!0,ql(p,!1),r.lanes=4194304)}else{if(!v)if(s=Lu(C),s!==null){if(r.flags|=128,v=!0,s=s.updateQueue,r.updateQueue=s,Qu(r,s),ql(p,!0),p.tail===null&&p.tailMode==="hidden"&&!C.alternate&&!Nt)return tn(r),null}else 2*me()-p.renderingStartTime>td&&l!==536870912&&(r.flags|=128,v=!0,ql(p,!1),r.lanes=4194304);p.isBackwards?(C.sibling=r.child,r.child=C):(s=p.last,s!==null?s.sibling=C:r.child=C,p.last=C)}return p.tail!==null?(s=p.tail,p.rendering=s,p.tail=s.sibling,p.renderingStartTime=me(),s.sibling=null,l=hn.current,ee(hn,v?l&1|2:l&1),Nt&&Ma(r,p.treeForkCount),s):(tn(r),null);case 22:case 23:return ys(r),bm(),p=r.memoizedState!==null,s!==null?s.memoizedState!==null!==p&&(r.flags|=8192):p&&(r.flags|=8192),p?(l&536870912)!==0&&(r.flags&128)===0&&(tn(r),r.subtreeFlags&6&&(r.flags|=8192)):tn(r),l=r.updateQueue,l!==null&&Qu(r,l.retryQueue),l=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),p=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(p=r.memoizedState.cachePool.pool),p!==l&&(r.flags|=2048),s!==null&&K(mo),null;case 24:return l=null,s!==null&&(l=s.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),Oa(yn),tn(r),null;case 25:return null;case 30:return null}throw Error(o(156,r.tag))}function CT(s,r){switch(sm(r),r.tag){case 1:return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 3:return Oa(yn),oe(),s=r.flags,(s&65536)!==0&&(s&128)===0?(r.flags=s&-65537|128,r):null;case 26:case 27:case 5:return ie(r),null;case 31:if(r.memoizedState!==null){if(ys(r),r.alternate===null)throw Error(o(340));uo()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 13:if(ys(r),s=r.memoizedState,s!==null&&s.dehydrated!==null){if(r.alternate===null)throw Error(o(340));uo()}return s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 19:return K(hn),null;case 4:return oe(),null;case 10:return Oa(r.type),null;case 22:case 23:return ys(r),bm(),s!==null&&K(mo),s=r.flags,s&65536?(r.flags=s&-65537|128,r):null;case 24:return Oa(yn),null;case 25:return null;default:return null}}function E0(s,r){switch(sm(r),r.tag){case 3:Oa(yn),oe();break;case 26:case 27:case 5:ie(r);break;case 4:oe();break;case 31:r.memoizedState!==null&&ys(r);break;case 13:ys(r);break;case 19:K(hn);break;case 10:Oa(r.type);break;case 22:case 23:ys(r),bm(),s!==null&&K(mo);break;case 24:Oa(yn)}}function Hl(s,r){try{var l=r.updateQueue,p=l!==null?l.lastEffect:null;if(p!==null){var v=p.next;l=v;do{if((l.tag&s)===s){p=void 0;var C=l.create,O=l.inst;p=C(),O.destroy=p}l=l.next}while(l!==v)}}catch(H){It(r,r.return,H)}}function jr(s,r,l){try{var p=r.updateQueue,v=p!==null?p.lastEffect:null;if(v!==null){var C=v.next;p=C;do{if((p.tag&s)===s){var O=p.inst,H=O.destroy;if(H!==void 0){O.destroy=void 0,v=r;var J=l,ue=H;try{ue()}catch(_e){It(v,J,_e)}}}p=p.next}while(p!==C)}}catch(_e){It(r,r.return,_e)}}function R0(s){var r=s.updateQueue;if(r!==null){var l=s.stateNode;try{_y(r,l)}catch(p){It(s,s.return,p)}}}function T0(s,r,l){l.props=_o(s.type,s.memoizedProps),l.state=s.memoizedState;try{l.componentWillUnmount()}catch(p){It(s,r,p)}}function Vl(s,r){try{var l=s.ref;if(l!==null){switch(s.tag){case 26:case 27:case 5:var p=s.stateNode;break;case 30:p=s.stateNode;break;default:p=s.stateNode}typeof l=="function"?s.refCleanup=l(p):l.current=p}}catch(v){It(s,r,v)}}function ua(s,r){var l=s.ref,p=s.refCleanup;if(l!==null)if(typeof p=="function")try{p()}catch(v){It(s,r,v)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(v){It(s,r,v)}else l.current=null}function A0(s){var r=s.type,l=s.memoizedProps,p=s.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":l.autoFocus&&p.focus();break e;case"img":l.src?p.src=l.src:l.srcSet&&(p.srcset=l.srcSet)}}catch(v){It(s,s.return,v)}}function Qm(s,r,l){try{var p=s.stateNode;KT(p,s.type,l,r),p[vn]=r}catch(v){It(s,s.return,v)}}function M0(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Rr(s.type)||s.tag===4}function Wm(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||M0(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Rr(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Zm(s,r,l){var p=s.tag;if(p===5||p===6)s=s.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(s,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(s),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=Ra));else if(p!==4&&(p===27&&Rr(s.type)&&(l=s.stateNode,r=null),s=s.child,s!==null))for(Zm(s,r,l),s=s.sibling;s!==null;)Zm(s,r,l),s=s.sibling}function Wu(s,r,l){var p=s.tag;if(p===5||p===6)s=s.stateNode,r?l.insertBefore(s,r):l.appendChild(s);else if(p!==4&&(p===27&&Rr(s.type)&&(l=s.stateNode),s=s.child,s!==null))for(Wu(s,r,l),s=s.sibling;s!==null;)Wu(s,r,l),s=s.sibling}function z0(s){var r=s.stateNode,l=s.memoizedProps;try{for(var p=s.type,v=r.attributes;v.length;)r.removeAttributeNode(v[0]);Un(r,p,l),r[Wt]=s,r[vn]=l}catch(C){It(s,s.return,C)}}var Ba=!1,wn=!1,Jm=!1,O0=typeof WeakSet=="function"?WeakSet:Set,On=null;function NT(s,r){if(s=s.containerInfo,vg=bd,s=Gv(s),Gp(s)){if("selectionStart"in s)var l={start:s.selectionStart,end:s.selectionEnd};else e:{l=(l=s.ownerDocument)&&l.defaultView||window;var p=l.getSelection&&l.getSelection();if(p&&p.rangeCount!==0){l=p.anchorNode;var v=p.anchorOffset,C=p.focusNode;p=p.focusOffset;try{l.nodeType,C.nodeType}catch{l=null;break e}var O=0,H=-1,J=-1,ue=0,_e=0,Se=s,pe=null;t:for(;;){for(var he;Se!==l||v!==0&&Se.nodeType!==3||(H=O+v),Se!==C||p!==0&&Se.nodeType!==3||(J=O+p),Se.nodeType===3&&(O+=Se.nodeValue.length),(he=Se.firstChild)!==null;)pe=Se,Se=he;for(;;){if(Se===s)break t;if(pe===l&&++ue===v&&(H=O),pe===C&&++_e===p&&(J=O),(he=Se.nextSibling)!==null)break;Se=pe,pe=Se.parentNode}Se=he}l=H===-1||J===-1?null:{start:H,end:J}}else l=null}l=l||{start:0,end:0}}else l=null;for(yg={focusedElem:s,selectionRange:l},bd=!1,On=r;On!==null;)if(r=On,s=r.child,(r.subtreeFlags&1028)!==0&&s!==null)s.return=r,On=s;else for(;On!==null;){switch(r=On,C=r.alternate,s=r.flags,r.tag){case 0:if((s&4)!==0&&(s=r.updateQueue,s=s!==null?s.events:null,s!==null))for(l=0;l<s.length;l++)v=s[l],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&C!==null){s=void 0,l=r,v=C.memoizedProps,C=C.memoizedState,p=l.stateNode;try{var Fe=_o(l.type,v);s=p.getSnapshotBeforeUpdate(Fe,C),p.__reactInternalSnapshotBeforeUpdate=s}catch(at){It(l,l.return,at)}}break;case 3:if((s&1024)!==0){if(s=r.stateNode.containerInfo,l=s.nodeType,l===9)wg(s);else if(l===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":wg(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(o(163))}if(s=r.sibling,s!==null){s.return=r.return,On=s;break}On=r.return}}function D0(s,r,l){var p=l.flags;switch(l.tag){case 0:case 11:case 15:Ua(s,l),p&4&&Hl(5,l);break;case 1:if(Ua(s,l),p&4)if(s=l.stateNode,r===null)try{s.componentDidMount()}catch(O){It(l,l.return,O)}else{var v=_o(l.type,r.memoizedProps);r=r.memoizedState;try{s.componentDidUpdate(v,r,s.__reactInternalSnapshotBeforeUpdate)}catch(O){It(l,l.return,O)}}p&64&&R0(l),p&512&&Vl(l,l.return);break;case 3:if(Ua(s,l),p&64&&(s=l.updateQueue,s!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{_y(s,r)}catch(O){It(l,l.return,O)}}break;case 27:r===null&&p&4&&z0(l);case 26:case 5:Ua(s,l),r===null&&p&4&&A0(l),p&512&&Vl(l,l.return);break;case 12:Ua(s,l);break;case 31:Ua(s,l),p&4&&I0(s,l);break;case 13:Ua(s,l),p&4&&B0(s,l),p&64&&(s=l.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(l=PT.bind(null,l),n5(s,l))));break;case 22:if(p=l.memoizedState!==null||Ba,!p){r=r!==null&&r.memoizedState!==null||wn,v=Ba;var C=wn;Ba=p,(wn=r)&&!C?qa(s,l,(l.subtreeFlags&8772)!==0):Ua(s,l),Ba=v,wn=C}break;case 30:break;default:Ua(s,l)}}function P0(s){var r=s.alternate;r!==null&&(s.alternate=null,P0(r)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(r=s.stateNode,r!==null&&Rp(r)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var ln=null,is=!1;function $a(s,r,l){for(l=l.child;l!==null;)L0(s,r,l),l=l.sibling}function L0(s,r,l){if(Ct&&typeof Ct.onCommitFiberUnmount=="function")try{Ct.onCommitFiberUnmount(_t,l)}catch{}switch(l.tag){case 26:wn||ua(l,r),$a(s,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:wn||ua(l,r);var p=ln,v=is;Rr(l.type)&&(ln=l.stateNode,is=!1),$a(s,r,l),Jl(l.stateNode),ln=p,is=v;break;case 5:wn||ua(l,r);case 6:if(p=ln,v=is,ln=null,$a(s,r,l),ln=p,is=v,ln!==null)if(is)try{(ln.nodeType===9?ln.body:ln.nodeName==="HTML"?ln.ownerDocument.body:ln).removeChild(l.stateNode)}catch(C){It(l,r,C)}else try{ln.removeChild(l.stateNode)}catch(C){It(l,r,C)}break;case 18:ln!==null&&(is?(s=ln,R1(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,l.stateNode),Mi(s)):R1(ln,l.stateNode));break;case 4:p=ln,v=is,ln=l.stateNode.containerInfo,is=!0,$a(s,r,l),ln=p,is=v;break;case 0:case 11:case 14:case 15:jr(2,l,r),wn||jr(4,l,r),$a(s,r,l);break;case 1:wn||(ua(l,r),p=l.stateNode,typeof p.componentWillUnmount=="function"&&T0(l,r,p)),$a(s,r,l);break;case 21:$a(s,r,l);break;case 22:wn=(p=wn)||l.memoizedState!==null,$a(s,r,l),wn=p;break;default:$a(s,r,l)}}function I0(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Mi(s)}catch(l){It(r,r.return,l)}}}function B0(s,r){if(r.memoizedState===null&&(s=r.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Mi(s)}catch(l){It(r,r.return,l)}}function ET(s){switch(s.tag){case 31:case 13:case 19:var r=s.stateNode;return r===null&&(r=s.stateNode=new O0),r;case 22:return s=s.stateNode,r=s._retryCache,r===null&&(r=s._retryCache=new O0),r;default:throw Error(o(435,s.tag))}}function Zu(s,r){var l=ET(s);r.forEach(function(p){if(!l.has(p)){l.add(p);var v=LT.bind(null,s,p);p.then(v,v)}})}function ls(s,r){var l=r.deletions;if(l!==null)for(var p=0;p<l.length;p++){var v=l[p],C=s,O=r,H=O;e:for(;H!==null;){switch(H.tag){case 27:if(Rr(H.type)){ln=H.stateNode,is=!1;break e}break;case 5:ln=H.stateNode,is=!1;break e;case 3:case 4:ln=H.stateNode.containerInfo,is=!0;break e}H=H.return}if(ln===null)throw Error(o(160));L0(C,O,v),ln=null,is=!1,C=v.alternate,C!==null&&(C.return=null),v.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)$0(r,s),r=r.sibling}var Ks=null;function $0(s,r){var l=s.alternate,p=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:ls(r,s),cs(s),p&4&&(jr(3,s,s.return),Hl(3,s),jr(5,s,s.return));break;case 1:ls(r,s),cs(s),p&512&&(wn||l===null||ua(l,l.return)),p&64&&Ba&&(s=s.updateQueue,s!==null&&(p=s.callbacks,p!==null&&(l=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=l===null?p:l.concat(p))));break;case 26:var v=Ks;if(ls(r,s),cs(s),p&512&&(wn||l===null||ua(l,l.return)),p&4){var C=l!==null?l.memoizedState:null;if(p=s.memoizedState,l===null)if(p===null)if(s.stateNode===null){e:{p=s.type,l=s.memoizedProps,v=v.ownerDocument||v;t:switch(p){case"title":C=v.getElementsByTagName("title")[0],(!C||C[xl]||C[Wt]||C.namespaceURI==="http://www.w3.org/2000/svg"||C.hasAttribute("itemprop"))&&(C=v.createElement(p),v.head.insertBefore(C,v.querySelector("head > title"))),Un(C,p,l),C[Wt]=s,zn(C),p=C;break e;case"link":var O=$1("link","href",v).get(p+(l.href||""));if(O){for(var H=0;H<O.length;H++)if(C=O[H],C.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&C.getAttribute("rel")===(l.rel==null?null:l.rel)&&C.getAttribute("title")===(l.title==null?null:l.title)&&C.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){O.splice(H,1);break t}}C=v.createElement(p),Un(C,p,l),v.head.appendChild(C);break;case"meta":if(O=$1("meta","content",v).get(p+(l.content||""))){for(H=0;H<O.length;H++)if(C=O[H],C.getAttribute("content")===(l.content==null?null:""+l.content)&&C.getAttribute("name")===(l.name==null?null:l.name)&&C.getAttribute("property")===(l.property==null?null:l.property)&&C.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&C.getAttribute("charset")===(l.charSet==null?null:l.charSet)){O.splice(H,1);break t}}C=v.createElement(p),Un(C,p,l),v.head.appendChild(C);break;default:throw Error(o(468,p))}C[Wt]=s,zn(C),p=C}s.stateNode=p}else U1(v,s.type,s.stateNode);else s.stateNode=B1(v,p,s.memoizedProps);else C!==p?(C===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):C.count--,p===null?U1(v,s.type,s.stateNode):B1(v,p,s.memoizedProps)):p===null&&s.stateNode!==null&&Qm(s,s.memoizedProps,l.memoizedProps)}break;case 27:ls(r,s),cs(s),p&512&&(wn||l===null||ua(l,l.return)),l!==null&&p&4&&Qm(s,s.memoizedProps,l.memoizedProps);break;case 5:if(ls(r,s),cs(s),p&512&&(wn||l===null||ua(l,l.return)),s.flags&32){v=s.stateNode;try{ti(v,"")}catch(Fe){It(s,s.return,Fe)}}p&4&&s.stateNode!=null&&(v=s.memoizedProps,Qm(s,v,l!==null?l.memoizedProps:v)),p&1024&&(Jm=!0);break;case 6:if(ls(r,s),cs(s),p&4){if(s.stateNode===null)throw Error(o(162));p=s.memoizedProps,l=s.stateNode;try{l.nodeValue=p}catch(Fe){It(s,s.return,Fe)}}break;case 3:if(md=null,v=Ks,Ks=fd(r.containerInfo),ls(r,s),Ks=v,cs(s),p&4&&l!==null&&l.memoizedState.isDehydrated)try{Mi(r.containerInfo)}catch(Fe){It(s,s.return,Fe)}Jm&&(Jm=!1,U0(s));break;case 4:p=Ks,Ks=fd(s.stateNode.containerInfo),ls(r,s),cs(s),Ks=p;break;case 12:ls(r,s),cs(s);break;case 31:ls(r,s),cs(s),p&4&&(p=s.updateQueue,p!==null&&(s.updateQueue=null,Zu(s,p)));break;case 13:ls(r,s),cs(s),s.child.flags&8192&&s.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(ed=me()),p&4&&(p=s.updateQueue,p!==null&&(s.updateQueue=null,Zu(s,p)));break;case 22:v=s.memoizedState!==null;var J=l!==null&&l.memoizedState!==null,ue=Ba,_e=wn;if(Ba=ue||v,wn=_e||J,ls(r,s),wn=_e,Ba=ue,cs(s),p&8192)e:for(r=s.stateNode,r._visibility=v?r._visibility&-2:r._visibility|1,v&&(l===null||J||Ba||wn||vo(s)),l=null,r=s;;){if(r.tag===5||r.tag===26){if(l===null){J=l=r;try{if(C=J.stateNode,v)O=C.style,typeof O.setProperty=="function"?O.setProperty("display","none","important"):O.display="none";else{H=J.stateNode;var Se=J.memoizedProps.style,pe=Se!=null&&Se.hasOwnProperty("display")?Se.display:null;H.style.display=pe==null||typeof pe=="boolean"?"":(""+pe).trim()}}catch(Fe){It(J,J.return,Fe)}}}else if(r.tag===6){if(l===null){J=r;try{J.stateNode.nodeValue=v?"":J.memoizedProps}catch(Fe){It(J,J.return,Fe)}}}else if(r.tag===18){if(l===null){J=r;try{var he=J.stateNode;v?T1(he,!0):T1(J.stateNode,!1)}catch(Fe){It(J,J.return,Fe)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===s)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===s)break e;for(;r.sibling===null;){if(r.return===null||r.return===s)break e;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}p&4&&(p=s.updateQueue,p!==null&&(l=p.retryQueue,l!==null&&(p.retryQueue=null,Zu(s,l))));break;case 19:ls(r,s),cs(s),p&4&&(p=s.updateQueue,p!==null&&(s.updateQueue=null,Zu(s,p)));break;case 30:break;case 21:break;default:ls(r,s),cs(s)}}function cs(s){var r=s.flags;if(r&2){try{for(var l,p=s.return;p!==null;){if(M0(p)){l=p;break}p=p.return}if(l==null)throw Error(o(160));switch(l.tag){case 27:var v=l.stateNode,C=Wm(s);Wu(s,C,v);break;case 5:var O=l.stateNode;l.flags&32&&(ti(O,""),l.flags&=-33);var H=Wm(s);Wu(s,H,O);break;case 3:case 4:var J=l.stateNode.containerInfo,ue=Wm(s);Zm(s,ue,J);break;default:throw Error(o(161))}}catch(_e){It(s,s.return,_e)}s.flags&=-3}r&4096&&(s.flags&=-4097)}function U0(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var r=s;U0(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),s=s.sibling}}function Ua(s,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)D0(s,r.alternate,r),r=r.sibling}function vo(s){for(s=s.child;s!==null;){var r=s;switch(r.tag){case 0:case 11:case 14:case 15:jr(4,r,r.return),vo(r);break;case 1:ua(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&T0(r,r.return,l),vo(r);break;case 27:Jl(r.stateNode);case 26:case 5:ua(r,r.return),vo(r);break;case 22:r.memoizedState===null&&vo(r);break;case 30:vo(r);break;default:vo(r)}s=s.sibling}}function qa(s,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var p=r.alternate,v=s,C=r,O=C.flags;switch(C.tag){case 0:case 11:case 15:qa(v,C,l),Hl(4,C);break;case 1:if(qa(v,C,l),p=C,v=p.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ue){It(p,p.return,ue)}if(p=C,v=p.updateQueue,v!==null){var H=p.stateNode;try{var J=v.shared.hiddenCallbacks;if(J!==null)for(v.shared.hiddenCallbacks=null,v=0;v<J.length;v++)by(J[v],H)}catch(ue){It(p,p.return,ue)}}l&&O&64&&R0(C),Vl(C,C.return);break;case 27:z0(C);case 26:case 5:qa(v,C,l),l&&p===null&&O&4&&A0(C),Vl(C,C.return);break;case 12:qa(v,C,l);break;case 31:qa(v,C,l),l&&O&4&&I0(v,C);break;case 13:qa(v,C,l),l&&O&4&&B0(v,C);break;case 22:C.memoizedState===null&&qa(v,C,l),Vl(C,C.return);break;case 30:break;default:qa(v,C,l)}r=r.sibling}}function eg(s,r){var l=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),s=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(s=r.memoizedState.cachePool.pool),s!==l&&(s!=null&&s.refCount++,l!=null&&Tl(l))}function tg(s,r){s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Tl(s))}function Xs(s,r,l,p){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)q0(s,r,l,p),r=r.sibling}function q0(s,r,l,p){var v=r.flags;switch(r.tag){case 0:case 11:case 15:Xs(s,r,l,p),v&2048&&Hl(9,r);break;case 1:Xs(s,r,l,p);break;case 3:Xs(s,r,l,p),v&2048&&(s=null,r.alternate!==null&&(s=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==s&&(r.refCount++,s!=null&&Tl(s)));break;case 12:if(v&2048){Xs(s,r,l,p),s=r.stateNode;try{var C=r.memoizedProps,O=C.id,H=C.onPostCommit;typeof H=="function"&&H(O,r.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(J){It(r,r.return,J)}}else Xs(s,r,l,p);break;case 31:Xs(s,r,l,p);break;case 13:Xs(s,r,l,p);break;case 23:break;case 22:C=r.stateNode,O=r.alternate,r.memoizedState!==null?C._visibility&2?Xs(s,r,l,p):Fl(s,r):C._visibility&2?Xs(s,r,l,p):(C._visibility|=2,yi(s,r,l,p,(r.subtreeFlags&10256)!==0||!1)),v&2048&&eg(O,r);break;case 24:Xs(s,r,l,p),v&2048&&tg(r.alternate,r);break;default:Xs(s,r,l,p)}}function yi(s,r,l,p,v){for(v=v&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var C=s,O=r,H=l,J=p,ue=O.flags;switch(O.tag){case 0:case 11:case 15:yi(C,O,H,J,v),Hl(8,O);break;case 23:break;case 22:var _e=O.stateNode;O.memoizedState!==null?_e._visibility&2?yi(C,O,H,J,v):Fl(C,O):(_e._visibility|=2,yi(C,O,H,J,v)),v&&ue&2048&&eg(O.alternate,O);break;case 24:yi(C,O,H,J,v),v&&ue&2048&&tg(O.alternate,O);break;default:yi(C,O,H,J,v)}r=r.sibling}}function Fl(s,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=s,p=r,v=p.flags;switch(p.tag){case 22:Fl(l,p),v&2048&&eg(p.alternate,p);break;case 24:Fl(l,p),v&2048&&tg(p.alternate,p);break;default:Fl(l,p)}r=r.sibling}}var Gl=8192;function ji(s,r,l){if(s.subtreeFlags&Gl)for(s=s.child;s!==null;)H0(s,r,l),s=s.sibling}function H0(s,r,l){switch(s.tag){case 26:ji(s,r,l),s.flags&Gl&&s.memoizedState!==null&&m5(l,Ks,s.memoizedState,s.memoizedProps);break;case 5:ji(s,r,l);break;case 3:case 4:var p=Ks;Ks=fd(s.stateNode.containerInfo),ji(s,r,l),Ks=p;break;case 22:s.memoizedState===null&&(p=s.alternate,p!==null&&p.memoizedState!==null?(p=Gl,Gl=16777216,ji(s,r,l),Gl=p):ji(s,r,l));break;default:ji(s,r,l)}}function V0(s){var r=s.alternate;if(r!==null&&(s=r.child,s!==null)){r.child=null;do r=s.sibling,s.sibling=null,s=r;while(s!==null)}}function Yl(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var p=r[l];On=p,G0(p,s)}V0(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)F0(s),s=s.sibling}function F0(s){switch(s.tag){case 0:case 11:case 15:Yl(s),s.flags&2048&&jr(9,s,s.return);break;case 3:Yl(s);break;case 12:Yl(s);break;case 22:var r=s.stateNode;s.memoizedState!==null&&r._visibility&2&&(s.return===null||s.return.tag!==13)?(r._visibility&=-3,Ju(s)):Yl(s);break;default:Yl(s)}}function Ju(s){var r=s.deletions;if((s.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var p=r[l];On=p,G0(p,s)}V0(s)}for(s=s.child;s!==null;){switch(r=s,r.tag){case 0:case 11:case 15:jr(8,r,r.return),Ju(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,Ju(r));break;default:Ju(r)}s=s.sibling}}function G0(s,r){for(;On!==null;){var l=On;switch(l.tag){case 0:case 11:case 15:jr(8,l,r);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var p=l.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:Tl(l.memoizedState.cache)}if(p=l.child,p!==null)p.return=l,On=p;else e:for(l=s;On!==null;){p=On;var v=p.sibling,C=p.return;if(P0(p),p===l){On=null;break e}if(v!==null){v.return=C,On=v;break e}On=C}}}var RT={getCacheForType:function(s){var r=Bn(yn),l=r.data.get(s);return l===void 0&&(l=s(),r.data.set(s,l)),l},cacheSignal:function(){return Bn(yn).controller.signal}},TT=typeof WeakMap=="function"?WeakMap:Map,Ot=0,Kt=null,yt=null,kt=0,Lt=0,js=null,kr=!1,ki=!1,ng=!1,Ha=0,pn=0,wr=0,yo=0,sg=0,ks=0,wi=0,Kl=null,us=null,ag=!1,ed=0,Y0=0,td=1/0,nd=null,Sr=null,Sn=0,Cr=null,Si=null,Va=0,rg=0,og=null,K0=null,Xl=0,ig=null;function ws(){return(Ot&2)!==0&&kt!==0?kt&-kt:U.T!==null?pg():rs()}function X0(){if(ks===0)if((kt&536870912)===0||Nt){var s=Qt;Qt<<=1,(Qt&3932160)===0&&(Qt=262144),ks=s}else ks=536870912;return s=vs.current,s!==null&&(s.flags|=32),ks}function ds(s,r,l){(s===Kt&&(Lt===2||Lt===9)||s.cancelPendingCommit!==null)&&(Ci(s,0),Nr(s,kt,ks,!1)),dn(s,l),((Ot&2)===0||s!==Kt)&&(s===Kt&&((Ot&2)===0&&(yo|=l),pn===4&&Nr(s,kt,ks,!1)),da(s))}function Q0(s,r,l){if((Ot&6)!==0)throw Error(o(327));var p=!l&&(r&127)===0&&(r&s.expiredLanes)===0||Yt(s,r),v=p?zT(s,r):cg(s,r,!0),C=p;do{if(v===0){ki&&!p&&Nr(s,r,0,!1);break}else{if(l=s.current.alternate,C&&!AT(l)){v=cg(s,r,!1),C=!1;continue}if(v===2){if(C=r,s.errorRecoveryDisabledLanes&C)var O=0;else O=s.pendingLanes&-536870913,O=O!==0?O:O&536870912?536870912:0;if(O!==0){r=O;e:{var H=s;v=Kl;var J=H.current.memoizedState.isDehydrated;if(J&&(Ci(H,O).flags|=256),O=cg(H,O,!1),O!==2){if(ng&&!J){H.errorRecoveryDisabledLanes|=C,yo|=C,v=4;break e}C=us,us=v,C!==null&&(us===null?us=C:us.push.apply(us,C))}v=O}if(C=!1,v!==2)continue}}if(v===1){Ci(s,0),Nr(s,r,0,!0);break}e:{switch(p=s,C=v,C){case 0:case 1:throw Error(o(345));case 4:if((r&4194048)!==r)break;case 6:Nr(p,r,ks,!kr);break e;case 2:us=null;break;case 3:case 5:break;default:throw Error(o(329))}if((r&62914560)===r&&(v=ed+300-me(),10<v)){if(Nr(p,r,ks,!kr),on(p,0,!0)!==0)break e;Va=r,p.timeoutHandle=N1(W0.bind(null,p,l,us,nd,ag,r,ks,yo,wi,kr,C,"Throttled",-0,0),v);break e}W0(p,l,us,nd,ag,r,ks,yo,wi,kr,C,null,-0,0)}}break}while(!0);da(s)}function W0(s,r,l,p,v,C,O,H,J,ue,_e,Se,pe,he){if(s.timeoutHandle=-1,Se=r.subtreeFlags,Se&8192||(Se&16785408)===16785408){Se={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ra},H0(r,C,Se);var Fe=(C&62914560)===C?ed-me():(C&4194048)===C?Y0-me():0;if(Fe=g5(Se,Fe),Fe!==null){Va=C,s.cancelPendingCommit=Fe(r1.bind(null,s,r,C,l,p,v,O,H,J,_e,Se,null,pe,he)),Nr(s,C,O,!ue);return}}r1(s,r,C,l,p,v,O,H,J)}function AT(s){for(var r=s;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var p=0;p<l.length;p++){var v=l[p],C=v.getSnapshot;v=v.value;try{if(!bs(C(),v))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===s)break;for(;r.sibling===null;){if(r.return===null||r.return===s)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function Nr(s,r,l,p){r&=~sg,r&=~yo,s.suspendedLanes|=r,s.pingedLanes&=~r,p&&(s.warmLanes|=r),p=s.expirationTimes;for(var v=r;0<v;){var C=31-ze(v),O=1<<C;p[C]=-1,v&=~O}l!==0&&Rs(s,l,r)}function sd(){return(Ot&6)===0?(Ql(0),!1):!0}function lg(){if(yt!==null){if(Lt===0)var s=yt.return;else s=yt,za=fo=null,wm(s),hi=null,Ml=0,s=yt;for(;s!==null;)E0(s.alternate,s),s=s.return;yt=null}}function Ci(s,r){var l=s.timeoutHandle;l!==-1&&(s.timeoutHandle=-1,WT(l)),l=s.cancelPendingCommit,l!==null&&(s.cancelPendingCommit=null,l()),Va=0,lg(),Kt=s,yt=l=Aa(s.current,null),kt=r,Lt=0,js=null,kr=!1,ki=Yt(s,r),ng=!1,wi=ks=sg=yo=wr=pn=0,us=Kl=null,ag=!1,(r&8)!==0&&(r|=r&32);var p=s.entangledLanes;if(p!==0)for(s=s.entanglements,p&=r;0<p;){var v=31-ze(p),C=1<<v;r|=s[v],p&=~C}return Ha=r,wu(),l}function Z0(s,r){pt=null,U.H=$l,r===gi||r===Mu?(r=my(),Lt=3):r===fm?(r=my(),Lt=4):Lt=r===$m?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,js=r,yt===null&&(pn=1,Gu(s,zs(r,s.current)))}function J0(){var s=vs.current;return s===null?!0:(kt&4194048)===kt?Ls===null:(kt&62914560)===kt||(kt&536870912)!==0?s===Ls:!1}function e1(){var s=U.H;return U.H=$l,s===null?$l:s}function t1(){var s=U.A;return U.A=RT,s}function ad(){pn=4,kr||(kt&4194048)!==kt&&vs.current!==null||(ki=!0),(wr&134217727)===0&&(yo&134217727)===0||Kt===null||Nr(Kt,kt,ks,!1)}function cg(s,r,l){var p=Ot;Ot|=2;var v=e1(),C=t1();(Kt!==s||kt!==r)&&(nd=null,Ci(s,r)),r=!1;var O=pn;e:do try{if(Lt!==0&&yt!==null){var H=yt,J=js;switch(Lt){case 8:lg(),O=6;break e;case 3:case 2:case 9:case 6:vs.current===null&&(r=!0);var ue=Lt;if(Lt=0,js=null,Ni(s,H,J,ue),l&&ki){O=0;break e}break;default:ue=Lt,Lt=0,js=null,Ni(s,H,J,ue)}}MT(),O=pn;break}catch(_e){Z0(s,_e)}while(!0);return r&&s.shellSuspendCounter++,za=fo=null,Ot=p,U.H=v,U.A=C,yt===null&&(Kt=null,kt=0,wu()),O}function MT(){for(;yt!==null;)n1(yt)}function zT(s,r){var l=Ot;Ot|=2;var p=e1(),v=t1();Kt!==s||kt!==r?(nd=null,td=me()+500,Ci(s,r)):ki=Yt(s,r);e:do try{if(Lt!==0&&yt!==null){r=yt;var C=js;t:switch(Lt){case 1:Lt=0,js=null,Ni(s,r,C,1);break;case 2:case 9:if(fy(C)){Lt=0,js=null,s1(r);break}r=function(){Lt!==2&&Lt!==9||Kt!==s||(Lt=7),da(s)},C.then(r,r);break e;case 3:Lt=7;break e;case 4:Lt=5;break e;case 7:fy(C)?(Lt=0,js=null,s1(r)):(Lt=0,js=null,Ni(s,r,C,7));break;case 5:var O=null;switch(yt.tag){case 26:O=yt.memoizedState;case 5:case 27:var H=yt;if(O?q1(O):H.stateNode.complete){Lt=0,js=null;var J=H.sibling;if(J!==null)yt=J;else{var ue=H.return;ue!==null?(yt=ue,rd(ue)):yt=null}break t}}Lt=0,js=null,Ni(s,r,C,5);break;case 6:Lt=0,js=null,Ni(s,r,C,6);break;case 8:lg(),pn=6;break e;default:throw Error(o(462))}}OT();break}catch(_e){Z0(s,_e)}while(!0);return za=fo=null,U.H=p,U.A=v,Ot=l,yt!==null?0:(Kt=null,kt=0,wu(),pn)}function OT(){for(;yt!==null&&!qe();)n1(yt)}function n1(s){var r=C0(s.alternate,s,Ha);s.memoizedProps=s.pendingProps,r===null?rd(s):yt=r}function s1(s){var r=s,l=r.alternate;switch(r.tag){case 15:case 0:r=v0(l,r,r.pendingProps,r.type,void 0,kt);break;case 11:r=v0(l,r,r.pendingProps,r.type.render,r.ref,kt);break;case 5:wm(r);default:E0(l,r),r=yt=ty(r,Ha),r=C0(l,r,Ha)}s.memoizedProps=s.pendingProps,r===null?rd(s):yt=r}function Ni(s,r,l,p){za=fo=null,wm(r),hi=null,Ml=0;var v=r.return;try{if(jT(s,v,r,l,kt)){pn=1,Gu(s,zs(l,s.current)),yt=null;return}}catch(C){if(v!==null)throw yt=v,C;pn=1,Gu(s,zs(l,s.current)),yt=null;return}r.flags&32768?(Nt||p===1?s=!0:ki||(kt&536870912)!==0?s=!1:(kr=s=!0,(p===2||p===9||p===3||p===6)&&(p=vs.current,p!==null&&p.tag===13&&(p.flags|=16384))),a1(r,s)):rd(r)}function rd(s){var r=s;do{if((r.flags&32768)!==0){a1(r,kr);return}s=r.return;var l=ST(r.alternate,r,Ha);if(l!==null){yt=l;return}if(r=r.sibling,r!==null){yt=r;return}yt=r=s}while(r!==null);pn===0&&(pn=5)}function a1(s,r){do{var l=CT(s.alternate,s);if(l!==null){l.flags&=32767,yt=l;return}if(l=s.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(s=s.sibling,s!==null)){yt=s;return}yt=s=l}while(s!==null);pn=6,yt=null}function r1(s,r,l,p,v,C,O,H,J){s.cancelPendingCommit=null;do od();while(Sn!==0);if((Ot&6)!==0)throw Error(o(327));if(r!==null){if(r===s.current)throw Error(o(177));if(C=r.lanes|r.childLanes,C|=Wp,hs(s,l,C,O,H,J),s===Kt&&(yt=Kt=null,kt=0),Si=r,Cr=s,Va=l,rg=C,og=v,K0=p,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,IT(Ce,function(){return u1(),null})):(s.callbackNode=null,s.callbackPriority=0),p=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||p){p=U.T,U.T=null,v=V.p,V.p=2,O=Ot,Ot|=4;try{NT(s,r,l)}finally{Ot=O,V.p=v,U.T=p}}Sn=1,o1(),i1(),l1()}}function o1(){if(Sn===1){Sn=0;var s=Cr,r=Si,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=U.T,U.T=null;var p=V.p;V.p=2;var v=Ot;Ot|=4;try{$0(r,s);var C=yg,O=Gv(s.containerInfo),H=C.focusedElem,J=C.selectionRange;if(O!==H&&H&&H.ownerDocument&&Fv(H.ownerDocument.documentElement,H)){if(J!==null&&Gp(H)){var ue=J.start,_e=J.end;if(_e===void 0&&(_e=ue),"selectionStart"in H)H.selectionStart=ue,H.selectionEnd=Math.min(_e,H.value.length);else{var Se=H.ownerDocument||document,pe=Se&&Se.defaultView||window;if(pe.getSelection){var he=pe.getSelection(),Fe=H.textContent.length,at=Math.min(J.start,Fe),Ht=J.end===void 0?at:Math.min(J.end,Fe);!he.extend&&at>Ht&&(O=Ht,Ht=at,at=O);var ae=Vv(H,at),te=Vv(H,Ht);if(ae&&te&&(he.rangeCount!==1||he.anchorNode!==ae.node||he.anchorOffset!==ae.offset||he.focusNode!==te.node||he.focusOffset!==te.offset)){var ce=Se.createRange();ce.setStart(ae.node,ae.offset),he.removeAllRanges(),at>Ht?(he.addRange(ce),he.extend(te.node,te.offset)):(ce.setEnd(te.node,te.offset),he.addRange(ce))}}}}for(Se=[],he=H;he=he.parentNode;)he.nodeType===1&&Se.push({element:he,left:he.scrollLeft,top:he.scrollTop});for(typeof H.focus=="function"&&H.focus(),H=0;H<Se.length;H++){var we=Se[H];we.element.scrollLeft=we.left,we.element.scrollTop=we.top}}bd=!!vg,yg=vg=null}finally{Ot=v,V.p=p,U.T=l}}s.current=r,Sn=2}}function i1(){if(Sn===2){Sn=0;var s=Cr,r=Si,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=U.T,U.T=null;var p=V.p;V.p=2;var v=Ot;Ot|=4;try{D0(s,r.alternate,r)}finally{Ot=v,V.p=p,U.T=l}}Sn=3}}function l1(){if(Sn===4||Sn===3){Sn=0,Xe();var s=Cr,r=Si,l=Va,p=K0;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Sn=5:(Sn=0,Si=Cr=null,c1(s,s.pendingLanes));var v=s.pendingLanes;if(v===0&&(Sr=null),Ln(l),r=r.stateNode,Ct&&typeof Ct.onCommitFiberRoot=="function")try{Ct.onCommitFiberRoot(_t,r,void 0,(r.current.flags&128)===128)}catch{}if(p!==null){r=U.T,v=V.p,V.p=2,U.T=null;try{for(var C=s.onRecoverableError,O=0;O<p.length;O++){var H=p[O];C(H.value,{componentStack:H.stack})}}finally{U.T=r,V.p=v}}(Va&3)!==0&&od(),da(s),v=s.pendingLanes,(l&261930)!==0&&(v&42)!==0?s===ig?Xl++:(Xl=0,ig=s):Xl=0,Ql(0)}}function c1(s,r){(s.pooledCacheLanes&=r)===0&&(r=s.pooledCache,r!=null&&(s.pooledCache=null,Tl(r)))}function od(){return o1(),i1(),l1(),u1()}function u1(){if(Sn!==5)return!1;var s=Cr,r=rg;rg=0;var l=Ln(Va),p=U.T,v=V.p;try{V.p=32>l?32:l,U.T=null,l=og,og=null;var C=Cr,O=Va;if(Sn=0,Si=Cr=null,Va=0,(Ot&6)!==0)throw Error(o(331));var H=Ot;if(Ot|=4,F0(C.current),q0(C,C.current,O,l),Ot=H,Ql(0,!1),Ct&&typeof Ct.onPostCommitFiberRoot=="function")try{Ct.onPostCommitFiberRoot(_t,C)}catch{}return!0}finally{V.p=v,U.T=p,c1(s,r)}}function d1(s,r,l){r=zs(l,r),r=Bm(s.stateNode,r,2),s=_r(s,r,2),s!==null&&(dn(s,2),da(s))}function It(s,r,l){if(s.tag===3)d1(s,s,l);else for(;r!==null;){if(r.tag===3){d1(r,s,l);break}else if(r.tag===1){var p=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(Sr===null||!Sr.has(p))){s=zs(l,s),l=f0(2),p=_r(r,l,2),p!==null&&(p0(l,p,r,s),dn(p,2),da(p));break}}r=r.return}}function ug(s,r,l){var p=s.pingCache;if(p===null){p=s.pingCache=new TT;var v=new Set;p.set(r,v)}else v=p.get(r),v===void 0&&(v=new Set,p.set(r,v));v.has(l)||(ng=!0,v.add(l),s=DT.bind(null,s,r,l),r.then(s,s))}function DT(s,r,l){var p=s.pingCache;p!==null&&p.delete(r),s.pingedLanes|=s.suspendedLanes&l,s.warmLanes&=~l,Kt===s&&(kt&l)===l&&(pn===4||pn===3&&(kt&62914560)===kt&&300>me()-ed?(Ot&2)===0&&Ci(s,0):sg|=l,wi===kt&&(wi=0)),da(s)}function f1(s,r){r===0&&(r=An()),s=lo(s,r),s!==null&&(dn(s,r),da(s))}function PT(s){var r=s.memoizedState,l=0;r!==null&&(l=r.retryLane),f1(s,l)}function LT(s,r){var l=0;switch(s.tag){case 31:case 13:var p=s.stateNode,v=s.memoizedState;v!==null&&(l=v.retryLane);break;case 19:p=s.stateNode;break;case 22:p=s.stateNode._retryCache;break;default:throw Error(o(314))}p!==null&&p.delete(r),f1(s,l)}function IT(s,r){return Me(s,r)}var id=null,Ei=null,dg=!1,ld=!1,fg=!1,Er=0;function da(s){s!==Ei&&s.next===null&&(Ei===null?id=Ei=s:Ei=Ei.next=s),ld=!0,dg||(dg=!0,$T())}function Ql(s,r){if(!fg&&ld){fg=!0;do for(var l=!1,p=id;p!==null;){if(s!==0){var v=p.pendingLanes;if(v===0)var C=0;else{var O=p.suspendedLanes,H=p.pingedLanes;C=(1<<31-ze(42|s)+1)-1,C&=v&~(O&~H),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(l=!0,h1(p,C))}else C=kt,C=on(p,p===Kt?C:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(C&3)===0||Yt(p,C)||(l=!0,h1(p,C));p=p.next}while(l);fg=!1}}function BT(){p1()}function p1(){ld=dg=!1;var s=0;Er!==0&&QT()&&(s=Er);for(var r=me(),l=null,p=id;p!==null;){var v=p.next,C=m1(p,r);C===0?(p.next=null,l===null?id=v:l.next=v,v===null&&(Ei=l)):(l=p,(s!==0||(C&3)!==0)&&(ld=!0)),p=v}Sn!==0&&Sn!==5||Ql(s),Er!==0&&(Er=0)}function m1(s,r){for(var l=s.suspendedLanes,p=s.pingedLanes,v=s.expirationTimes,C=s.pendingLanes&-62914561;0<C;){var O=31-ze(C),H=1<<O,J=v[O];J===-1?((H&l)===0||(H&p)!==0)&&(v[O]=Fn(H,r)):J<=r&&(s.expiredLanes|=H),C&=~H}if(r=Kt,l=kt,l=on(s,s===r?l:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),p=s.callbackNode,l===0||s===r&&(Lt===2||Lt===9)||s.cancelPendingCommit!==null)return p!==null&&p!==null&&De(p),s.callbackNode=null,s.callbackPriority=0;if((l&3)===0||Yt(s,l)){if(r=l&-l,r===s.callbackPriority)return r;switch(p!==null&&De(p),Ln(l)){case 2:case 8:l=ye;break;case 32:l=Ce;break;case 268435456:l=Ge;break;default:l=Ce}return p=g1.bind(null,s),l=Me(l,p),s.callbackPriority=r,s.callbackNode=l,r}return p!==null&&p!==null&&De(p),s.callbackPriority=2,s.callbackNode=null,2}function g1(s,r){if(Sn!==0&&Sn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var l=s.callbackNode;if(od()&&s.callbackNode!==l)return null;var p=kt;return p=on(s,s===Kt?p:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),p===0?null:(Q0(s,p,r),m1(s,me()),s.callbackNode!=null&&s.callbackNode===l?g1.bind(null,s):null)}function h1(s,r){if(od())return null;Q0(s,r,!0)}function $T(){ZT(function(){(Ot&6)!==0?Me(Le,BT):p1()})}function pg(){if(Er===0){var s=pi;s===0&&(s=Rt,Rt<<=1,(Rt&261888)===0&&(Rt=256)),Er=s}return Er}function x1(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:hu(""+s)}function b1(s,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,s.id&&l.setAttribute("form",s.id),r.parentNode.insertBefore(l,r),s=new FormData(s),l.parentNode.removeChild(l),s}function UT(s,r,l,p,v){if(r==="submit"&&l&&l.stateNode===v){var C=x1((v[vn]||null).action),O=p.submitter;O&&(r=(r=O[vn]||null)?x1(r.formAction):O.getAttribute("formAction"),r!==null&&(C=r,O=null));var H=new vu("action","action",null,p,v);s.push({event:H,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(Er!==0){var J=O?b1(v,O):new FormData(v);zm(l,{pending:!0,data:J,method:v.method,action:C},null,J)}}else typeof C=="function"&&(H.preventDefault(),J=O?b1(v,O):new FormData(v),zm(l,{pending:!0,data:J,method:v.method,action:C},C,J))},currentTarget:v}]})}}for(var mg=0;mg<Qp.length;mg++){var gg=Qp[mg],qT=gg.toLowerCase(),HT=gg[0].toUpperCase()+gg.slice(1);Ys(qT,"on"+HT)}Ys(Xv,"onAnimationEnd"),Ys(Qv,"onAnimationIteration"),Ys(Wv,"onAnimationStart"),Ys("dblclick","onDoubleClick"),Ys("focusin","onFocus"),Ys("focusout","onBlur"),Ys(rT,"onTransitionRun"),Ys(oT,"onTransitionStart"),Ys(iT,"onTransitionCancel"),Ys(Zv,"onTransitionEnd"),Jo("onMouseEnter",["mouseout","mouseover"]),Jo("onMouseLeave",["mouseout","mouseover"]),Jo("onPointerEnter",["pointerout","pointerover"]),Jo("onPointerLeave",["pointerout","pointerover"]),ao("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ao("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ao("onBeforeInput",["compositionend","keypress","textInput","paste"]),ao("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ao("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ao("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Wl="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(" "),VT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Wl));function _1(s,r){r=(r&4)!==0;for(var l=0;l<s.length;l++){var p=s[l],v=p.event;p=p.listeners;e:{var C=void 0;if(r)for(var O=p.length-1;0<=O;O--){var H=p[O],J=H.instance,ue=H.currentTarget;if(H=H.listener,J!==C&&v.isPropagationStopped())break e;C=H,v.currentTarget=ue;try{C(v)}catch(_e){ku(_e)}v.currentTarget=null,C=J}else for(O=0;O<p.length;O++){if(H=p[O],J=H.instance,ue=H.currentTarget,H=H.listener,J!==C&&v.isPropagationStopped())break e;C=H,v.currentTarget=ue;try{C(v)}catch(_e){ku(_e)}v.currentTarget=null,C=J}}}}function jt(s,r){var l=r[dr];l===void 0&&(l=r[dr]=new Set);var p=s+"__bubble";l.has(p)||(v1(r,s,2,!1),l.add(p))}function hg(s,r,l){var p=0;r&&(p|=4),v1(l,s,p,r)}var cd="_reactListening"+Math.random().toString(36).slice(2);function xg(s){if(!s[cd]){s[cd]=!0,pv.forEach(function(l){l!=="selectionchange"&&(VT.has(l)||hg(l,!1,s),hg(l,!0,s))});var r=s.nodeType===9?s:s.ownerDocument;r===null||r[cd]||(r[cd]=!0,hg("selectionchange",!1,r))}}function v1(s,r,l,p){switch(X1(r)){case 2:var v=b5;break;case 8:v=_5;break;default:v=Mg}l=v.bind(null,r,l,s),v=void 0,!Lp||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(v=!0),p?v!==void 0?s.addEventListener(r,l,{capture:!0,passive:v}):s.addEventListener(r,l,!0):v!==void 0?s.addEventListener(r,l,{passive:v}):s.addEventListener(r,l,!1)}function bg(s,r,l,p,v){var C=p;if((r&1)===0&&(r&2)===0&&p!==null)e:for(;;){if(p===null)return;var O=p.tag;if(O===3||O===4){var H=p.stateNode.containerInfo;if(H===v)break;if(O===4)for(O=p.return;O!==null;){var J=O.tag;if((J===3||J===4)&&O.stateNode.containerInfo===v)return;O=O.return}for(;H!==null;){if(O=Qo(H),O===null)return;if(J=O.tag,J===5||J===6||J===26||J===27){p=C=O;continue e}H=H.parentNode}}p=p.return}Sv(function(){var ue=C,_e=Dp(l),Se=[];e:{var pe=Jv.get(s);if(pe!==void 0){var he=vu,Fe=s;switch(s){case"keypress":if(bu(l)===0)break e;case"keydown":case"keyup":he=LR;break;case"focusin":Fe="focus",he=Up;break;case"focusout":Fe="blur",he=Up;break;case"beforeblur":case"afterblur":he=Up;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":he=Ev;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":he=SR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":he=$R;break;case Xv:case Qv:case Wv:he=ER;break;case Zv:he=qR;break;case"scroll":case"scrollend":he=kR;break;case"wheel":he=VR;break;case"copy":case"cut":case"paste":he=TR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":he=Tv;break;case"toggle":case"beforetoggle":he=GR}var at=(r&4)!==0,Ht=!at&&(s==="scroll"||s==="scrollend"),ae=at?pe!==null?pe+"Capture":null:pe;at=[];for(var te=ue,ce;te!==null;){var we=te;if(ce=we.stateNode,we=we.tag,we!==5&&we!==26&&we!==27||ce===null||ae===null||(we=_l(te,ae),we!=null&&at.push(Zl(te,we,ce))),Ht)break;te=te.return}0<at.length&&(pe=new he(pe,Fe,null,l,_e),Se.push({event:pe,listeners:at}))}}if((r&7)===0){e:{if(pe=s==="mouseover"||s==="pointerover",he=s==="mouseout"||s==="pointerout",pe&&l!==Op&&(Fe=l.relatedTarget||l.fromElement)&&(Qo(Fe)||Fe[ia]))break e;if((he||pe)&&(pe=_e.window===_e?_e:(pe=_e.ownerDocument)?pe.defaultView||pe.parentWindow:window,he?(Fe=l.relatedTarget||l.toElement,he=ue,Fe=Fe?Qo(Fe):null,Fe!==null&&(Ht=c(Fe),at=Fe.tag,Fe!==Ht||at!==5&&at!==27&&at!==6)&&(Fe=null)):(he=null,Fe=ue),he!==Fe)){if(at=Ev,we="onMouseLeave",ae="onMouseEnter",te="mouse",(s==="pointerout"||s==="pointerover")&&(at=Tv,we="onPointerLeave",ae="onPointerEnter",te="pointer"),Ht=he==null?pe:bl(he),ce=Fe==null?pe:bl(Fe),pe=new at(we,te+"leave",he,l,_e),pe.target=Ht,pe.relatedTarget=ce,we=null,Qo(_e)===ue&&(at=new at(ae,te+"enter",Fe,l,_e),at.target=ce,at.relatedTarget=Ht,we=at),Ht=we,he&&Fe)t:{for(at=FT,ae=he,te=Fe,ce=0,we=ae;we;we=at(we))ce++;we=0;for(var et=te;et;et=at(et))we++;for(;0<ce-we;)ae=at(ae),ce--;for(;0<we-ce;)te=at(te),we--;for(;ce--;){if(ae===te||te!==null&&ae===te.alternate){at=ae;break t}ae=at(ae),te=at(te)}at=null}else at=null;he!==null&&y1(Se,pe,he,at,!1),Fe!==null&&Ht!==null&&y1(Se,Ht,Fe,at,!0)}}e:{if(pe=ue?bl(ue):window,he=pe.nodeName&&pe.nodeName.toLowerCase(),he==="select"||he==="input"&&pe.type==="file")var At=Iv;else if(Pv(pe))if(Bv)At=nT;else{At=eT;var Ke=JR}else he=pe.nodeName,!he||he.toLowerCase()!=="input"||pe.type!=="checkbox"&&pe.type!=="radio"?ue&&zp(ue.elementType)&&(At=Iv):At=tT;if(At&&(At=At(s,ue))){Lv(Se,At,l,_e);break e}Ke&&Ke(s,pe,ue),s==="focusout"&&ue&&pe.type==="number"&&ue.memoizedProps.value!=null&&Mp(pe,"number",pe.value)}switch(Ke=ue?bl(ue):window,s){case"focusin":(Pv(Ke)||Ke.contentEditable==="true")&&(ri=Ke,Yp=ue,Nl=null);break;case"focusout":Nl=Yp=ri=null;break;case"mousedown":Kp=!0;break;case"contextmenu":case"mouseup":case"dragend":Kp=!1,Yv(Se,l,_e);break;case"selectionchange":if(aT)break;case"keydown":case"keyup":Yv(Se,l,_e)}var mt;if(Hp)e:{switch(s){case"compositionstart":var wt="onCompositionStart";break e;case"compositionend":wt="onCompositionEnd";break e;case"compositionupdate":wt="onCompositionUpdate";break e}wt=void 0}else ai?Ov(s,l)&&(wt="onCompositionEnd"):s==="keydown"&&l.keyCode===229&&(wt="onCompositionStart");wt&&(Av&&l.locale!=="ko"&&(ai||wt!=="onCompositionStart"?wt==="onCompositionEnd"&&ai&&(mt=Cv()):(fr=_e,Ip="value"in fr?fr.value:fr.textContent,ai=!0)),Ke=ud(ue,wt),0<Ke.length&&(wt=new Rv(wt,s,null,l,_e),Se.push({event:wt,listeners:Ke}),mt?wt.data=mt:(mt=Dv(l),mt!==null&&(wt.data=mt)))),(mt=KR?XR(s,l):QR(s,l))&&(wt=ud(ue,"onBeforeInput"),0<wt.length&&(Ke=new Rv("onBeforeInput","beforeinput",null,l,_e),Se.push({event:Ke,listeners:wt}),Ke.data=mt)),UT(Se,s,ue,l,_e)}_1(Se,r)})}function Zl(s,r,l){return{instance:s,listener:r,currentTarget:l}}function ud(s,r){for(var l=r+"Capture",p=[];s!==null;){var v=s,C=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||C===null||(v=_l(s,l),v!=null&&p.unshift(Zl(s,v,C)),v=_l(s,r),v!=null&&p.push(Zl(s,v,C))),s.tag===3)return p;s=s.return}return[]}function FT(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function y1(s,r,l,p,v){for(var C=r._reactName,O=[];l!==null&&l!==p;){var H=l,J=H.alternate,ue=H.stateNode;if(H=H.tag,J!==null&&J===p)break;H!==5&&H!==26&&H!==27||ue===null||(J=ue,v?(ue=_l(l,C),ue!=null&&O.unshift(Zl(l,ue,J))):v||(ue=_l(l,C),ue!=null&&O.push(Zl(l,ue,J)))),l=l.return}O.length!==0&&s.push({event:r,listeners:O})}var GT=/\r\n?/g,YT=/\u0000|\uFFFD/g;function j1(s){return(typeof s=="string"?s:""+s).replace(GT,`
49
- `).replace(YT,"")}function k1(s,r){return r=j1(r),j1(s)===r}function qt(s,r,l,p,v,C){switch(l){case"children":typeof p=="string"?r==="body"||r==="textarea"&&p===""||ti(s,p):(typeof p=="number"||typeof p=="bigint")&&r!=="body"&&ti(s,""+p);break;case"className":mu(s,"class",p);break;case"tabIndex":mu(s,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":mu(s,l,p);break;case"style":kv(s,p,C);break;case"data":if(r!=="object"){mu(s,"data",p);break}case"src":case"href":if(p===""&&(r!=="a"||l!=="href")){s.removeAttribute(l);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){s.removeAttribute(l);break}p=hu(""+p),s.setAttribute(l,p);break;case"action":case"formAction":if(typeof p=="function"){s.setAttribute(l,"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 C=="function"&&(l==="formAction"?(r!=="input"&&qt(s,r,"name",v.name,v,null),qt(s,r,"formEncType",v.formEncType,v,null),qt(s,r,"formMethod",v.formMethod,v,null),qt(s,r,"formTarget",v.formTarget,v,null)):(qt(s,r,"encType",v.encType,v,null),qt(s,r,"method",v.method,v,null),qt(s,r,"target",v.target,v,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){s.removeAttribute(l);break}p=hu(""+p),s.setAttribute(l,p);break;case"onClick":p!=null&&(s.onclick=Ra);break;case"onScroll":p!=null&&jt("scroll",s);break;case"onScrollEnd":p!=null&&jt("scrollend",s);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(o(61));if(l=p.__html,l!=null){if(v.children!=null)throw Error(o(60));s.innerHTML=l}}break;case"multiple":s.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":s.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){s.removeAttribute("xlink:href");break}l=hu(""+p),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?s.setAttribute(l,""+p):s.removeAttribute(l);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":p&&typeof p!="function"&&typeof p!="symbol"?s.setAttribute(l,""):s.removeAttribute(l);break;case"capture":case"download":p===!0?s.setAttribute(l,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?s.setAttribute(l,p):s.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?s.setAttribute(l,p):s.removeAttribute(l);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?s.removeAttribute(l):s.setAttribute(l,p);break;case"popover":jt("beforetoggle",s),jt("toggle",s),pu(s,"popover",p);break;case"xlinkActuate":Ea(s,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":Ea(s,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":Ea(s,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":Ea(s,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":Ea(s,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":Ea(s,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":Ea(s,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":Ea(s,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":Ea(s,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":pu(s,"is",p);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=yR.get(l)||l,pu(s,l,p))}}function _g(s,r,l,p,v,C){switch(l){case"style":kv(s,p,C);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(o(61));if(l=p.__html,l!=null){if(v.children!=null)throw Error(o(60));s.innerHTML=l}}break;case"children":typeof p=="string"?ti(s,p):(typeof p=="number"||typeof p=="bigint")&&ti(s,""+p);break;case"onScroll":p!=null&&jt("scroll",s);break;case"onScrollEnd":p!=null&&jt("scrollend",s);break;case"onClick":p!=null&&(s.onclick=Ra);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!mv.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(v=l.endsWith("Capture"),r=l.slice(2,v?l.length-7:void 0),C=s[vn]||null,C=C!=null?C[l]:null,typeof C=="function"&&s.removeEventListener(r,C,v),typeof p=="function")){typeof C!="function"&&C!==null&&(l in s?s[l]=null:s.hasAttribute(l)&&s.removeAttribute(l)),s.addEventListener(r,p,v);break e}l in s?s[l]=p:p===!0?s.setAttribute(l,""):pu(s,l,p)}}}function Un(s,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":jt("error",s),jt("load",s);var p=!1,v=!1,C;for(C in l)if(l.hasOwnProperty(C)){var O=l[C];if(O!=null)switch(C){case"src":p=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,r));default:qt(s,r,C,O,l,null)}}v&&qt(s,r,"srcSet",l.srcSet,l,null),p&&qt(s,r,"src",l.src,l,null);return;case"input":jt("invalid",s);var H=C=O=v=null,J=null,ue=null;for(p in l)if(l.hasOwnProperty(p)){var _e=l[p];if(_e!=null)switch(p){case"name":v=_e;break;case"type":O=_e;break;case"checked":J=_e;break;case"defaultChecked":ue=_e;break;case"value":C=_e;break;case"defaultValue":H=_e;break;case"children":case"dangerouslySetInnerHTML":if(_e!=null)throw Error(o(137,r));break;default:qt(s,r,p,_e,l,null)}}_v(s,C,H,J,ue,O,v,!1);return;case"select":jt("invalid",s),p=O=C=null;for(v in l)if(l.hasOwnProperty(v)&&(H=l[v],H!=null))switch(v){case"value":C=H;break;case"defaultValue":O=H;break;case"multiple":p=H;default:qt(s,r,v,H,l,null)}r=C,l=O,s.multiple=!!p,r!=null?ei(s,!!p,r,!1):l!=null&&ei(s,!!p,l,!0);return;case"textarea":jt("invalid",s),C=v=p=null;for(O in l)if(l.hasOwnProperty(O)&&(H=l[O],H!=null))switch(O){case"value":p=H;break;case"defaultValue":v=H;break;case"children":C=H;break;case"dangerouslySetInnerHTML":if(H!=null)throw Error(o(91));break;default:qt(s,r,O,H,l,null)}yv(s,p,v,C);return;case"option":for(J in l)if(l.hasOwnProperty(J)&&(p=l[J],p!=null))switch(J){case"selected":s.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:qt(s,r,J,p,l,null)}return;case"dialog":jt("beforetoggle",s),jt("toggle",s),jt("cancel",s),jt("close",s);break;case"iframe":case"object":jt("load",s);break;case"video":case"audio":for(p=0;p<Wl.length;p++)jt(Wl[p],s);break;case"image":jt("error",s),jt("load",s);break;case"details":jt("toggle",s);break;case"embed":case"source":case"link":jt("error",s),jt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ue in l)if(l.hasOwnProperty(ue)&&(p=l[ue],p!=null))switch(ue){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,r));default:qt(s,r,ue,p,l,null)}return;default:if(zp(r)){for(_e in l)l.hasOwnProperty(_e)&&(p=l[_e],p!==void 0&&_g(s,r,_e,p,l,void 0));return}}for(H in l)l.hasOwnProperty(H)&&(p=l[H],p!=null&&qt(s,r,H,p,l,null))}function KT(s,r,l,p){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,C=null,O=null,H=null,J=null,ue=null,_e=null;for(he in l){var Se=l[he];if(l.hasOwnProperty(he)&&Se!=null)switch(he){case"checked":break;case"value":break;case"defaultValue":J=Se;default:p.hasOwnProperty(he)||qt(s,r,he,null,p,Se)}}for(var pe in p){var he=p[pe];if(Se=l[pe],p.hasOwnProperty(pe)&&(he!=null||Se!=null))switch(pe){case"type":C=he;break;case"name":v=he;break;case"checked":ue=he;break;case"defaultChecked":_e=he;break;case"value":O=he;break;case"defaultValue":H=he;break;case"children":case"dangerouslySetInnerHTML":if(he!=null)throw Error(o(137,r));break;default:he!==Se&&qt(s,r,pe,he,p,Se)}}Ap(s,O,H,J,ue,_e,C,v);return;case"select":he=O=H=pe=null;for(C in l)if(J=l[C],l.hasOwnProperty(C)&&J!=null)switch(C){case"value":break;case"multiple":he=J;default:p.hasOwnProperty(C)||qt(s,r,C,null,p,J)}for(v in p)if(C=p[v],J=l[v],p.hasOwnProperty(v)&&(C!=null||J!=null))switch(v){case"value":pe=C;break;case"defaultValue":H=C;break;case"multiple":O=C;default:C!==J&&qt(s,r,v,C,p,J)}r=H,l=O,p=he,pe!=null?ei(s,!!l,pe,!1):!!p!=!!l&&(r!=null?ei(s,!!l,r,!0):ei(s,!!l,l?[]:"",!1));return;case"textarea":he=pe=null;for(H in l)if(v=l[H],l.hasOwnProperty(H)&&v!=null&&!p.hasOwnProperty(H))switch(H){case"value":break;case"children":break;default:qt(s,r,H,null,p,v)}for(O in p)if(v=p[O],C=l[O],p.hasOwnProperty(O)&&(v!=null||C!=null))switch(O){case"value":pe=v;break;case"defaultValue":he=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(o(91));break;default:v!==C&&qt(s,r,O,v,p,C)}vv(s,pe,he);return;case"option":for(var Fe in l)if(pe=l[Fe],l.hasOwnProperty(Fe)&&pe!=null&&!p.hasOwnProperty(Fe))switch(Fe){case"selected":s.selected=!1;break;default:qt(s,r,Fe,null,p,pe)}for(J in p)if(pe=p[J],he=l[J],p.hasOwnProperty(J)&&pe!==he&&(pe!=null||he!=null))switch(J){case"selected":s.selected=pe&&typeof pe!="function"&&typeof pe!="symbol";break;default:qt(s,r,J,pe,p,he)}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 at in l)pe=l[at],l.hasOwnProperty(at)&&pe!=null&&!p.hasOwnProperty(at)&&qt(s,r,at,null,p,pe);for(ue in p)if(pe=p[ue],he=l[ue],p.hasOwnProperty(ue)&&pe!==he&&(pe!=null||he!=null))switch(ue){case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(o(137,r));break;default:qt(s,r,ue,pe,p,he)}return;default:if(zp(r)){for(var Ht in l)pe=l[Ht],l.hasOwnProperty(Ht)&&pe!==void 0&&!p.hasOwnProperty(Ht)&&_g(s,r,Ht,void 0,p,pe);for(_e in p)pe=p[_e],he=l[_e],!p.hasOwnProperty(_e)||pe===he||pe===void 0&&he===void 0||_g(s,r,_e,pe,p,he);return}}for(var ae in l)pe=l[ae],l.hasOwnProperty(ae)&&pe!=null&&!p.hasOwnProperty(ae)&&qt(s,r,ae,null,p,pe);for(Se in p)pe=p[Se],he=l[Se],!p.hasOwnProperty(Se)||pe===he||pe==null&&he==null||qt(s,r,Se,pe,p,he)}function w1(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function XT(){if(typeof performance.getEntriesByType=="function"){for(var s=0,r=0,l=performance.getEntriesByType("resource"),p=0;p<l.length;p++){var v=l[p],C=v.transferSize,O=v.initiatorType,H=v.duration;if(C&&H&&w1(O)){for(O=0,H=v.responseEnd,p+=1;p<l.length;p++){var J=l[p],ue=J.startTime;if(ue>H)break;var _e=J.transferSize,Se=J.initiatorType;_e&&w1(Se)&&(J=J.responseEnd,O+=_e*(J<H?1:(H-ue)/(J-ue)))}if(--p,r+=8*(C+O)/(v.duration/1e3),s++,10<s)break}}if(0<s)return r/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var vg=null,yg=null;function dd(s){return s.nodeType===9?s:s.ownerDocument}function S1(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function C1(s,r){if(s===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&r==="foreignObject"?0:s}function jg(s,r){return s==="textarea"||s==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var kg=null;function QT(){var s=window.event;return s&&s.type==="popstate"?s===kg?!1:(kg=s,!0):(kg=null,!1)}var N1=typeof setTimeout=="function"?setTimeout:void 0,WT=typeof clearTimeout=="function"?clearTimeout:void 0,E1=typeof Promise=="function"?Promise:void 0,ZT=typeof queueMicrotask=="function"?queueMicrotask:typeof E1<"u"?function(s){return E1.resolve(null).then(s).catch(JT)}:N1;function JT(s){setTimeout(function(){throw s})}function Rr(s){return s==="head"}function R1(s,r){var l=r,p=0;do{var v=l.nextSibling;if(s.removeChild(l),v&&v.nodeType===8)if(l=v.data,l==="/$"||l==="/&"){if(p===0){s.removeChild(v),Mi(r);return}p--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")p++;else if(l==="html")Jl(s.ownerDocument.documentElement);else if(l==="head"){l=s.ownerDocument.head,Jl(l);for(var C=l.firstChild;C;){var O=C.nextSibling,H=C.nodeName;C[xl]||H==="SCRIPT"||H==="STYLE"||H==="LINK"&&C.rel.toLowerCase()==="stylesheet"||l.removeChild(C),C=O}}else l==="body"&&Jl(s.ownerDocument.body);l=v}while(l);Mi(r)}function T1(s,r){var l=s;s=0;do{var p=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),p&&p.nodeType===8)if(l=p.data,l==="/$"){if(s===0)break;s--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||s++;l=p}while(l)}function wg(s){var r=s.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":wg(l),Rp(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}s.removeChild(l)}}function e5(s,r,l,p){for(;s.nodeType===1;){var v=l;if(s.nodeName.toLowerCase()!==r.toLowerCase()){if(!p&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(p){if(!s[xl])switch(r){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(C=s.getAttribute("rel"),C==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(C!==v.rel||s.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||s.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||s.getAttribute("title")!==(v.title==null?null:v.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(C=s.getAttribute("src"),(C!==(v.src==null?null:v.src)||s.getAttribute("type")!==(v.type==null?null:v.type)||s.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&C&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(r==="input"&&s.type==="hidden"){var C=v.name==null?null:""+v.name;if(v.type==="hidden"&&s.getAttribute("name")===C)return s}else return s;if(s=Is(s.nextSibling),s===null)break}return null}function t5(s,r,l){if(r==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=Is(s.nextSibling),s===null))return null;return s}function A1(s,r){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!r||(s=Is(s.nextSibling),s===null))return null;return s}function Sg(s){return s.data==="$?"||s.data==="$~"}function Cg(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function n5(s,r){var l=s.ownerDocument;if(s.data==="$~")s._reactRetry=r;else if(s.data!=="$?"||l.readyState!=="loading")r();else{var p=function(){r(),l.removeEventListener("DOMContentLoaded",p)};l.addEventListener("DOMContentLoaded",p),s._reactRetry=p}}function Is(s){for(;s!=null;s=s.nextSibling){var r=s.nodeType;if(r===1||r===3)break;if(r===8){if(r=s.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return s}var Ng=null;function M1(s){s=s.nextSibling;for(var r=0;s;){if(s.nodeType===8){var l=s.data;if(l==="/$"||l==="/&"){if(r===0)return Is(s.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}s=s.nextSibling}return null}function z1(s){s=s.previousSibling;for(var r=0;s;){if(s.nodeType===8){var l=s.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return s;r--}else l!=="/$"&&l!=="/&"||r++}s=s.previousSibling}return null}function O1(s,r,l){switch(r=dd(l),s){case"html":if(s=r.documentElement,!s)throw Error(o(452));return s;case"head":if(s=r.head,!s)throw Error(o(453));return s;case"body":if(s=r.body,!s)throw Error(o(454));return s;default:throw Error(o(451))}}function Jl(s){for(var r=s.attributes;r.length;)s.removeAttributeNode(r[0]);Rp(s)}var Bs=new Map,D1=new Set;function fd(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Fa=V.d;V.d={f:s5,r:a5,D:r5,C:o5,L:i5,m:l5,X:u5,S:c5,M:d5};function s5(){var s=Fa.f(),r=sd();return s||r}function a5(s){var r=Wo(s);r!==null&&r.tag===5&&r.type==="form"?Zy(r):Fa.r(s)}var Ri=typeof document>"u"?null:document;function P1(s,r,l){var p=Ri;if(p&&typeof r=="string"&&r){var v=As(r);v='link[rel="'+s+'"][href="'+v+'"]',typeof l=="string"&&(v+='[crossorigin="'+l+'"]'),D1.has(v)||(D1.add(v),s={rel:s,crossOrigin:l,href:r},p.querySelector(v)===null&&(r=p.createElement("link"),Un(r,"link",s),zn(r),p.head.appendChild(r)))}}function r5(s){Fa.D(s),P1("dns-prefetch",s,null)}function o5(s,r){Fa.C(s,r),P1("preconnect",s,r)}function i5(s,r,l){Fa.L(s,r,l);var p=Ri;if(p&&s&&r){var v='link[rel="preload"][as="'+As(r)+'"]';r==="image"&&l&&l.imageSrcSet?(v+='[imagesrcset="'+As(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(v+='[imagesizes="'+As(l.imageSizes)+'"]')):v+='[href="'+As(s)+'"]';var C=v;switch(r){case"style":C=Ti(s);break;case"script":C=Ai(s)}Bs.has(C)||(s=b({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:s,as:r},l),Bs.set(C,s),p.querySelector(v)!==null||r==="style"&&p.querySelector(ec(C))||r==="script"&&p.querySelector(tc(C))||(r=p.createElement("link"),Un(r,"link",s),zn(r),p.head.appendChild(r)))}}function l5(s,r){Fa.m(s,r);var l=Ri;if(l&&s){var p=r&&typeof r.as=="string"?r.as:"script",v='link[rel="modulepreload"][as="'+As(p)+'"][href="'+As(s)+'"]',C=v;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=Ai(s)}if(!Bs.has(C)&&(s=b({rel:"modulepreload",href:s},r),Bs.set(C,s),l.querySelector(v)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(tc(C)))return}p=l.createElement("link"),Un(p,"link",s),zn(p),l.head.appendChild(p)}}}function c5(s,r,l){Fa.S(s,r,l);var p=Ri;if(p&&s){var v=Zo(p).hoistableStyles,C=Ti(s);r=r||"default";var O=v.get(C);if(!O){var H={loading:0,preload:null};if(O=p.querySelector(ec(C)))H.loading=5;else{s=b({rel:"stylesheet",href:s,"data-precedence":r},l),(l=Bs.get(C))&&Eg(s,l);var J=O=p.createElement("link");zn(J),Un(J,"link",s),J._p=new Promise(function(ue,_e){J.onload=ue,J.onerror=_e}),J.addEventListener("load",function(){H.loading|=1}),J.addEventListener("error",function(){H.loading|=2}),H.loading|=4,pd(O,r,p)}O={type:"stylesheet",instance:O,count:1,state:H},v.set(C,O)}}}function u5(s,r){Fa.X(s,r);var l=Ri;if(l&&s){var p=Zo(l).hoistableScripts,v=Ai(s),C=p.get(v);C||(C=l.querySelector(tc(v)),C||(s=b({src:s,async:!0},r),(r=Bs.get(v))&&Rg(s,r),C=l.createElement("script"),zn(C),Un(C,"link",s),l.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},p.set(v,C))}}function d5(s,r){Fa.M(s,r);var l=Ri;if(l&&s){var p=Zo(l).hoistableScripts,v=Ai(s),C=p.get(v);C||(C=l.querySelector(tc(v)),C||(s=b({src:s,async:!0,type:"module"},r),(r=Bs.get(v))&&Rg(s,r),C=l.createElement("script"),zn(C),Un(C,"link",s),l.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},p.set(v,C))}}function L1(s,r,l,p){var v=(v=Z.current)?fd(v):null;if(!v)throw Error(o(446));switch(s){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=Ti(l.href),l=Zo(v).hoistableStyles,p=l.get(r),p||(p={type:"style",instance:null,count:0,state:null},l.set(r,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){s=Ti(l.href);var C=Zo(v).hoistableStyles,O=C.get(s);if(O||(v=v.ownerDocument||v,O={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(s,O),(C=v.querySelector(ec(s)))&&!C._p&&(O.instance=C,O.state.loading=5),Bs.has(s)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Bs.set(s,l),C||f5(v,s,l,O.state))),r&&p===null)throw Error(o(528,""));return O}if(r&&p!==null)throw Error(o(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Ai(l),l=Zo(v).hoistableScripts,p=l.get(r),p||(p={type:"script",instance:null,count:0,state:null},l.set(r,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,s))}}function Ti(s){return'href="'+As(s)+'"'}function ec(s){return'link[rel="stylesheet"]['+s+"]"}function I1(s){return b({},s,{"data-precedence":s.precedence,precedence:null})}function f5(s,r,l,p){s.querySelector('link[rel="preload"][as="style"]['+r+"]")?p.loading=1:(r=s.createElement("link"),p.preload=r,r.addEventListener("load",function(){return p.loading|=1}),r.addEventListener("error",function(){return p.loading|=2}),Un(r,"link",l),zn(r),s.head.appendChild(r))}function Ai(s){return'[src="'+As(s)+'"]'}function tc(s){return"script[async]"+s}function B1(s,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var p=s.querySelector('style[data-href~="'+As(l.href)+'"]');if(p)return r.instance=p,zn(p),p;var v=b({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return p=(s.ownerDocument||s).createElement("style"),zn(p),Un(p,"style",v),pd(p,l.precedence,s),r.instance=p;case"stylesheet":v=Ti(l.href);var C=s.querySelector(ec(v));if(C)return r.state.loading|=4,r.instance=C,zn(C),C;p=I1(l),(v=Bs.get(v))&&Eg(p,v),C=(s.ownerDocument||s).createElement("link"),zn(C);var O=C;return O._p=new Promise(function(H,J){O.onload=H,O.onerror=J}),Un(C,"link",p),r.state.loading|=4,pd(C,l.precedence,s),r.instance=C;case"script":return C=Ai(l.src),(v=s.querySelector(tc(C)))?(r.instance=v,zn(v),v):(p=l,(v=Bs.get(C))&&(p=b({},l),Rg(p,v)),s=s.ownerDocument||s,v=s.createElement("script"),zn(v),Un(v,"link",p),s.head.appendChild(v),r.instance=v);case"void":return null;default:throw Error(o(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(p=r.instance,r.state.loading|=4,pd(p,l.precedence,s));return r.instance}function pd(s,r,l){for(var p=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=p.length?p[p.length-1]:null,C=v,O=0;O<p.length;O++){var H=p[O];if(H.dataset.precedence===r)C=H;else if(C!==v)break}C?C.parentNode.insertBefore(s,C.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(s,r.firstChild))}function Eg(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.title==null&&(s.title=r.title)}function Rg(s,r){s.crossOrigin==null&&(s.crossOrigin=r.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=r.referrerPolicy),s.integrity==null&&(s.integrity=r.integrity)}var md=null;function $1(s,r,l){if(md===null){var p=new Map,v=md=new Map;v.set(l,p)}else v=md,p=v.get(l),p||(p=new Map,v.set(l,p));if(p.has(s))return p;for(p.set(s,null),l=l.getElementsByTagName(s),v=0;v<l.length;v++){var C=l[v];if(!(C[xl]||C[Wt]||s==="link"&&C.getAttribute("rel")==="stylesheet")&&C.namespaceURI!=="http://www.w3.org/2000/svg"){var O=C.getAttribute(r)||"";O=s+O;var H=p.get(O);H?H.push(C):p.set(O,[C])}}return p}function U1(s,r,l){s=s.ownerDocument||s,s.head.insertBefore(l,r==="title"?s.querySelector("head > title"):null)}function p5(s,r,l){if(l===1||r.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return s=r.disabled,typeof r.precedence=="string"&&s==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function q1(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function m5(s,r,l,p){if(l.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var v=Ti(p.href),C=r.querySelector(ec(v));if(C){r=C._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(s.count++,s=gd.bind(s),r.then(s,s)),l.state.loading|=4,l.instance=C,zn(C);return}C=r.ownerDocument||r,p=I1(p),(v=Bs.get(v))&&Eg(p,v),C=C.createElement("link"),zn(C);var O=C;O._p=new Promise(function(H,J){O.onload=H,O.onerror=J}),Un(C,"link",p),l.instance=C}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(s.count++,l=gd.bind(s),r.addEventListener("load",l),r.addEventListener("error",l))}}var Tg=0;function g5(s,r){return s.stylesheets&&s.count===0&&xd(s,s.stylesheets),0<s.count||0<s.imgCount?function(l){var p=setTimeout(function(){if(s.stylesheets&&xd(s,s.stylesheets),s.unsuspend){var C=s.unsuspend;s.unsuspend=null,C()}},6e4+r);0<s.imgBytes&&Tg===0&&(Tg=62500*XT());var v=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&xd(s,s.stylesheets),s.unsuspend)){var C=s.unsuspend;s.unsuspend=null,C()}},(s.imgBytes>Tg?50:800)+r);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(p),clearTimeout(v)}}:null}function gd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)xd(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var hd=null;function xd(s,r){s.stylesheets=null,s.unsuspend!==null&&(s.count++,hd=new Map,r.forEach(h5,s),hd=null,gd.call(s))}function h5(s,r){if(!(r.state.loading&4)){var l=hd.get(s);if(l)var p=l.get(null);else{l=new Map,hd.set(s,l);for(var v=s.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C<v.length;C++){var O=v[C];(O.nodeName==="LINK"||O.getAttribute("media")!=="not all")&&(l.set(O.dataset.precedence,O),p=O)}p&&l.set(null,p)}v=r.instance,O=v.getAttribute("data-precedence"),C=l.get(O)||p,C===p&&l.set(null,v),l.set(O,v),this.count++,p=gd.bind(this),v.addEventListener("load",p),v.addEventListener("error",p),C?C.parentNode.insertBefore(v,C.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(v,s.firstChild)),r.state.loading|=4}}var nc={$$typeof:S,Provider:null,Consumer:null,_currentValue:X,_currentValue2:X,_threadCount:0};function x5(s,r,l,p,v,C,O,H,J){this.tag=1,this.containerInfo=s,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=as(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=as(0),this.hiddenUpdates=as(null),this.identifierPrefix=p,this.onUncaughtError=v,this.onCaughtError=C,this.onRecoverableError=O,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=J,this.incompleteTransitions=new Map}function H1(s,r,l,p,v,C,O,H,J,ue,_e,Se){return s=new x5(s,r,l,O,J,ue,_e,Se,H),r=1,C===!0&&(r|=24),C=_s(3,null,null,r),s.current=C,C.stateNode=s,r=cm(),r.refCount++,s.pooledCache=r,r.refCount++,C.memoizedState={element:p,isDehydrated:l,cache:r},pm(C),s}function V1(s){return s?(s=li,s):li}function F1(s,r,l,p,v,C){v=V1(v),p.context===null?p.context=v:p.pendingContext=v,p=br(r),p.payload={element:l},C=C===void 0?null:C,C!==null&&(p.callback=C),l=_r(s,p,r),l!==null&&(ds(l,s,r),Ol(l,s,r))}function G1(s,r){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var l=s.retryLane;s.retryLane=l!==0&&l<r?l:r}}function Ag(s,r){G1(s,r),(s=s.alternate)&&G1(s,r)}function Y1(s){if(s.tag===13||s.tag===31){var r=lo(s,67108864);r!==null&&ds(r,s,67108864),Ag(s,67108864)}}function K1(s){if(s.tag===13||s.tag===31){var r=ws();r=$t(r);var l=lo(s,r);l!==null&&ds(l,s,r),Ag(s,r)}}var bd=!0;function b5(s,r,l,p){var v=U.T;U.T=null;var C=V.p;try{V.p=2,Mg(s,r,l,p)}finally{V.p=C,U.T=v}}function _5(s,r,l,p){var v=U.T;U.T=null;var C=V.p;try{V.p=8,Mg(s,r,l,p)}finally{V.p=C,U.T=v}}function Mg(s,r,l,p){if(bd){var v=zg(p);if(v===null)bg(s,r,p,_d,l),Q1(s,p);else if(y5(v,s,r,l,p))p.stopPropagation();else if(Q1(s,p),r&4&&-1<v5.indexOf(s)){for(;v!==null;){var C=Wo(v);if(C!==null)switch(C.tag){case 3:if(C=C.stateNode,C.current.memoizedState.isDehydrated){var O=Pt(C.pendingLanes);if(O!==0){var H=C;for(H.pendingLanes|=2,H.entangledLanes|=2;O;){var J=1<<31-ze(O);H.entanglements[1]|=J,O&=~J}da(C),(Ot&6)===0&&(td=me()+500,Ql(0))}}break;case 31:case 13:H=lo(C,2),H!==null&&ds(H,C,2),sd(),Ag(C,2)}if(C=zg(p),C===null&&bg(s,r,p,_d,l),C===v)break;v=C}v!==null&&p.stopPropagation()}else bg(s,r,p,null,l)}}function zg(s){return s=Dp(s),Og(s)}var _d=null;function Og(s){if(_d=null,s=Qo(s),s!==null){var r=c(s);if(r===null)s=null;else{var l=r.tag;if(l===13){if(s=d(r),s!==null)return s;s=null}else if(l===31){if(s=f(r),s!==null)return s;s=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;s=null}else r!==s&&(s=null)}}return _d=s,null}function X1(s){switch(s){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(de()){case Le:return 2;case ye:return 8;case Ce:case Qe:return 32;case Ge:return 268435456;default:return 32}default:return 32}}var Dg=!1,Tr=null,Ar=null,Mr=null,sc=new Map,ac=new Map,zr=[],v5="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 Q1(s,r){switch(s){case"focusin":case"focusout":Tr=null;break;case"dragenter":case"dragleave":Ar=null;break;case"mouseover":case"mouseout":Mr=null;break;case"pointerover":case"pointerout":sc.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":ac.delete(r.pointerId)}}function rc(s,r,l,p,v,C){return s===null||s.nativeEvent!==C?(s={blockedOn:r,domEventName:l,eventSystemFlags:p,nativeEvent:C,targetContainers:[v]},r!==null&&(r=Wo(r),r!==null&&Y1(r)),s):(s.eventSystemFlags|=p,r=s.targetContainers,v!==null&&r.indexOf(v)===-1&&r.push(v),s)}function y5(s,r,l,p,v){switch(r){case"focusin":return Tr=rc(Tr,s,r,l,p,v),!0;case"dragenter":return Ar=rc(Ar,s,r,l,p,v),!0;case"mouseover":return Mr=rc(Mr,s,r,l,p,v),!0;case"pointerover":var C=v.pointerId;return sc.set(C,rc(sc.get(C)||null,s,r,l,p,v)),!0;case"gotpointercapture":return C=v.pointerId,ac.set(C,rc(ac.get(C)||null,s,r,l,p,v)),!0}return!1}function W1(s){var r=Qo(s.target);if(r!==null){var l=c(r);if(l!==null){if(r=l.tag,r===13){if(r=d(l),r!==null){s.blockedOn=r,xs(s.priority,function(){K1(l)});return}}else if(r===31){if(r=f(l),r!==null){s.blockedOn=r,xs(s.priority,function(){K1(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){s.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}s.blockedOn=null}function vd(s){if(s.blockedOn!==null)return!1;for(var r=s.targetContainers;0<r.length;){var l=zg(s.nativeEvent);if(l===null){l=s.nativeEvent;var p=new l.constructor(l.type,l);Op=p,l.target.dispatchEvent(p),Op=null}else return r=Wo(l),r!==null&&Y1(r),s.blockedOn=l,!1;r.shift()}return!0}function Z1(s,r,l){vd(s)&&l.delete(r)}function j5(){Dg=!1,Tr!==null&&vd(Tr)&&(Tr=null),Ar!==null&&vd(Ar)&&(Ar=null),Mr!==null&&vd(Mr)&&(Mr=null),sc.forEach(Z1),ac.forEach(Z1)}function yd(s,r){s.blockedOn===r&&(s.blockedOn=null,Dg||(Dg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,j5)))}var jd=null;function J1(s){jd!==s&&(jd=s,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){jd===s&&(jd=null);for(var r=0;r<s.length;r+=3){var l=s[r],p=s[r+1],v=s[r+2];if(typeof p!="function"){if(Og(p||l)===null)continue;break}var C=Wo(l);C!==null&&(s.splice(r,3),r-=3,zm(C,{pending:!0,data:v,method:l.method,action:p},p,v))}}))}function Mi(s){function r(J){return yd(J,s)}Tr!==null&&yd(Tr,s),Ar!==null&&yd(Ar,s),Mr!==null&&yd(Mr,s),sc.forEach(r),ac.forEach(r);for(var l=0;l<zr.length;l++){var p=zr[l];p.blockedOn===s&&(p.blockedOn=null)}for(;0<zr.length&&(l=zr[0],l.blockedOn===null);)W1(l),l.blockedOn===null&&zr.shift();if(l=(s.ownerDocument||s).$$reactFormReplay,l!=null)for(p=0;p<l.length;p+=3){var v=l[p],C=l[p+1],O=v[vn]||null;if(typeof C=="function")O||J1(l);else if(O){var H=null;if(C&&C.hasAttribute("formAction")){if(v=C,O=C[vn]||null)H=O.formAction;else if(Og(v)!==null)continue}else H=O.action;typeof H=="function"?l[p+1]=H:(l.splice(p,3),p-=3),J1(l)}}}function ej(){function s(C){C.canIntercept&&C.info==="react-transition"&&C.intercept({handler:function(){return new Promise(function(O){return v=O})},focusReset:"manual",scroll:"manual"})}function r(){v!==null&&(v(),v=null),p||setTimeout(l,20)}function l(){if(!p&&!navigation.transition){var C=navigation.currentEntry;C&&C.url!=null&&navigation.navigate(C.url,{state:C.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,v=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){p=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),v!==null&&(v(),v=null)}}}function Pg(s){this._internalRoot=s}kd.prototype.render=Pg.prototype.render=function(s){var r=this._internalRoot;if(r===null)throw Error(o(409));var l=r.current,p=ws();F1(l,p,s,r,null,null)},kd.prototype.unmount=Pg.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var r=s.containerInfo;F1(s.current,2,null,s,null,null),sd(),r[ia]=null}};function kd(s){this._internalRoot=s}kd.prototype.unstable_scheduleHydration=function(s){if(s){var r=rs();s={blockedOn:null,target:s,priority:r};for(var l=0;l<zr.length&&r!==0&&r<zr[l].priority;l++);zr.splice(l,0,s),l===0&&W1(s)}};var tj=t.version;if(tj!=="19.2.8")throw Error(o(527,tj,"19.2.8"));V.findDOMNode=function(s){var r=s._reactInternals;if(r===void 0)throw typeof s.render=="function"?Error(o(188)):(s=Object.keys(s).join(","),Error(o(268,s)));return s=g(r),s=s!==null?h(s):null,s=s===null?null:s.stateNode,s};var k5={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:U,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var wd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!wd.isDisabled&&wd.supportsFiber)try{_t=wd.inject(k5),Ct=wd}catch{}}return ic.createRoot=function(s,r){if(!i(s))throw Error(o(299));var l=!1,p="",v=l0,C=c0,O=u0;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(p=r.identifierPrefix),r.onUncaughtError!==void 0&&(v=r.onUncaughtError),r.onCaughtError!==void 0&&(C=r.onCaughtError),r.onRecoverableError!==void 0&&(O=r.onRecoverableError)),r=H1(s,1,!1,null,null,l,p,null,v,C,O,ej),s[ia]=r.current,xg(s),new Pg(r)},ic.hydrateRoot=function(s,r,l){if(!i(s))throw Error(o(299));var p=!1,v="",C=l0,O=c0,H=u0,J=null;return l!=null&&(l.unstable_strictMode===!0&&(p=!0),l.identifierPrefix!==void 0&&(v=l.identifierPrefix),l.onUncaughtError!==void 0&&(C=l.onUncaughtError),l.onCaughtError!==void 0&&(O=l.onCaughtError),l.onRecoverableError!==void 0&&(H=l.onRecoverableError),l.formState!==void 0&&(J=l.formState)),r=H1(s,1,!0,r,l??null,p,v,J,C,O,H,ej),r.context=V1(null),l=r.current,p=ws(),p=$t(p),v=br(p),v.callback=null,_r(l,v,p),l=p,r.current.lanes=l,dn(r,l),da(r),s[ia]=r.current,xg(s),new kd(r)},ic.version="19.2.8",ic}var dj;function O5(){if(dj)return Bg.exports;dj=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(),Bg.exports=z5(),Bg.exports}var D5=O5();const P5=nb(D5);/**
50
- * react-router v7.18.2
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */var sb=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,y2=/^[\\/]{2}/;function L5(e,t){return t+e.replace(/\\/g,"/")}var fj="popstate";function pj(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function I5(e={}){function t(o,i){let c=i.state?.masked,{pathname:d,search:f,hash:m}=c||o.location;return rx("",{pathname:d,search:f,hash:m},i.state&&i.state.usr||null,i.state&&i.state.key||"default",c?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function a(o,i){return typeof i=="string"?i:Oc(i)}return $5(t,a,null,e)}function cn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Fs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function B5(){return Math.random().toString(36).substring(2,10)}function mj(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 rx(e,t,a=null,o,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?cl(t):t,state:a,key:t&&t.key||o||B5(),mask:i}}function Oc({pathname:e="/",search:t="",hash:a=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function cl(e){let t={};if(e){let a=e.indexOf("#");a>=0&&(t.hash=e.substring(a),e=e.substring(0,a));let o=e.indexOf("?");o>=0&&(t.search=e.substring(o),e=e.substring(0,o)),e&&(t.pathname=e)}return t}function $5(e,t,a,o={}){let{window:i=document.defaultView,v5Compat:c=!1}=o,d=i.history,f="POP",m=null,g=h();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function h(){return(d.state||{idx:null}).idx}function b(){f="POP";let k=h(),N=k==null?null:k-g;g=k,m&&m({action:f,location:y.location,delta:N})}function _(k,N){f="PUSH";let w=pj(k)?k:rx(y.location,k,N);g=h()+1;let S=mj(w,g),R=y.createHref(w.mask||w);try{d.pushState(S,"",R)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;i.location.assign(R)}c&&m&&m({action:f,location:y.location,delta:1})}function j(k,N){f="REPLACE";let w=pj(k)?k:rx(y.location,k,N);g=h();let S=mj(w,g),R=y.createHref(w.mask||w);d.replaceState(S,"",R),c&&m&&m({action:f,location:y.location,delta:0})}function E(k){return U5(i,k)}let y={get action(){return f},get location(){return e(i,d)},listen(k){if(m)throw new Error("A history only accepts one active listener");return i.addEventListener(fj,b),m=k,()=>{i.removeEventListener(fj,b),m=null}},createHref(k){return t(i,k)},createURL:E,encodeLocation(k){let N=E(k);return{pathname:N.pathname,search:N.search,hash:N.hash}},push:_,replace:j,go(k){return d.go(k)}};return y}function U5(e,t,a=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),cn(o,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:Oc(t);return i=i.replace(/ $/,"%20"),!a&&y2.test(i)&&(i=o+i),new URL(i,o)}function j2(e,t,a="/"){return q5(e,t,a,!1)}function q5(e,t,a,o,i){let c=typeof t=="string"?cl(t):t,d=sr(c.pathname||"/",a);if(d==null)return null;let f=H5(e),m=null,g=e3(d);for(let h=0;m==null&&h<f.length;++h)m=J5(f[h],g,o);return m}function H5(e){let t=k2(e);return V5(t),t}function k2(e,t=[],a=[],o="",i=!1){let c=(d,f,m=i,g)=>{let h={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(o)&&m)return;cn(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=ea([o,h.relativePath]),_=a.concat(h);d.children&&d.children.length>0&&(cn(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),k2(d.children,t,_,b,m)),!(d.path==null&&!d.index)&&t.push({path:b,score:W5(b,d.index),routesMeta:_.map((j,E)=>{let[y,k]=C2(j.relativePath,j.caseSensitive,E===_.length-1);return{...j,matcher:y,compiledParams:k}})})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let m of w2(d.path))c(d,f,!0,m)}),t}function w2(e){let t=e.split("/");if(t.length===0)return[];let[a,...o]=t,i=a.endsWith("?"),c=a.replace(/\?$/,"");if(o.length===0)return i?[c,""]:[c];let d=w2(o.join("/")),f=[];return f.push(...d.map(m=>m===""?c:[c,m].join("/"))),i&&f.push(...d),f.map(m=>e.startsWith("/")&&m===""?"/":m)}function V5(e){e.sort((t,a)=>t.score!==a.score?a.score-t.score:Z5(t.routesMeta.map(o=>o.childrenIndex),a.routesMeta.map(o=>o.childrenIndex)))}var F5=/^:[\w-]+$/,G5=3,Y5=2,K5=1,X5=10,Q5=-2,gj=e=>e==="*";function W5(e,t){let a=e.split("/"),o=a.length;return a.some(gj)&&(o+=Q5),t&&(o+=Y5),a.filter(i=>!gj(i)).reduce((i,c)=>i+(F5.test(c)?G5:c===""?K5:X5),o)}function Z5(e,t){return e.length===t.length&&e.slice(0,-1).every((o,i)=>o===t[i])?e[e.length-1]-t[t.length-1]:0}function J5(e,t,a=!1){let{routesMeta:o}=e,i={},c="/",d=[];for(let f=0;f<o.length;++f){let m=o[f],g=f===o.length-1,h=c==="/"?t:t.slice(c.length)||"/",b={path:m.relativePath,caseSensitive:m.caseSensitive,end:g},_=m.matcher&&m.compiledParams?S2(b,h,m.matcher,m.compiledParams):uf(b,h),j=m.route;if(!_&&g&&a&&!o[o.length-1].route.index&&(_=uf({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},h)),!_)return null;Object.assign(i,_.params),d.push({params:i,pathname:ea([c,_.pathname]),pathnameBase:s3(ea([c,_.pathnameBase])),route:j}),_.pathnameBase!=="/"&&(c=ea([c,_.pathnameBase]))}return d}function uf(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,o]=C2(e.path,e.caseSensitive,e.end);return S2(e,t,a,o)}function S2(e,t,a,o){let i=t.match(a);if(!i)return null;let c=i[0],d=c.replace(/(.)\/+$/,"$1"),f=i.slice(1);return{params:o.reduce((g,{paramName:h,isOptional:b},_)=>{if(h==="*"){let E=f[_]||"";d=c.slice(0,c.length-E.length).replace(/(.)\/+$/,"$1")}const j=f[_];return b&&!j?g[h]=void 0:g[h]=(j||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:d,pattern:e}}function C2(e,t=!1,a=!0){Fs(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=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,m,g,h)=>{if(o.push({paramName:f,isOptional:m!=null}),m){let b=h.charAt(g+d.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),o]}function e3(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Fs(!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 sr(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let a=t.endsWith("/")?t.length-1:t.length,o=e.charAt(a);return o&&o!=="/"?null:e.slice(a)||"/"}function t3(e,t="/"){let{pathname:a,search:o="",hash:i=""}=typeof e=="string"?cl(e):e,c;return a?(a=N2(a),a.startsWith("/")?c=hj(a.substring(1),"/"):c=hj(a,t)):c=t,{pathname:c,search:a3(o),hash:r3(i)}}function hj(e,t){let a=df(t).split("/");return e.split("/").forEach(i=>{i===".."?a.length>1&&a.pop():i!=="."&&a.push(i)}),a.length>1?a.join("/"):"/"}function Hg(e,t,a,o){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function n3(e){return e.filter((t,a)=>a===0||t.route.path&&t.route.path.length>0)}function ab(e){let t=n3(e);return t.map((a,o)=>o===t.length-1?a.pathname:a.pathnameBase)}function If(e,t,a,o=!1){let i;typeof e=="string"?i=cl(e):(i={...e},cn(!i.pathname||!i.pathname.includes("?"),Hg("?","pathname","search",i)),cn(!i.pathname||!i.pathname.includes("#"),Hg("#","pathname","hash",i)),cn(!i.search||!i.search.includes("#"),Hg("#","search","hash",i)));let c=e===""||i.pathname==="",d=c?"/":i.pathname,f;if(d==null)f=a;else{let b=t.length-1;if(!o&&d.startsWith("..")){let _=d.split("/");for(;_[0]==="..";)_.shift(),b-=1;i.pathname=_.join("/")}f=b>=0?t[b]:"/"}let m=t3(i,f),g=d&&d!=="/"&&d.endsWith("/"),h=(c||d===".")&&a.endsWith("/");return!m.pathname.endsWith("/")&&(g||h)&&(m.pathname+="/"),m}var N2=e=>e.replace(/[\\/]{2,}/g,"/"),ea=e=>N2(e.join("/")),df=e=>e.replace(/\/+$/,""),s3=e=>df(e).replace(/^\/*/,"/"),a3=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,r3=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,o3=class{constructor(e,t,a,o=!1){this.status=e,this.statusText=t||"",this.internal=o,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function i3(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function l3(e){let t=e.map(a=>a.route.path).filter(Boolean);return ea(t)||"/"}var E2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function R2(e,t){let a=e;if(typeof a!="string"||!sb.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,i=!1;if(E2)try{let c=new URL(window.location.href),d=y2.test(a)?new URL(L5(a,c.protocol)):new URL(a),f=sr(d.pathname,t);d.origin===c.origin&&f!=null?a=f+d.search+d.hash:i=!0}catch{Fs(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:i,to:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var T2=["POST","PUT","PATCH","DELETE"];new Set(T2);var c3=["GET",...T2];new Set(c3);var u3=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function d3(e){try{return u3.includes(new URL(e).protocol)}catch{return!1}}var ul=x.createContext(null);ul.displayName="DataRouter";var Bf=x.createContext(null);Bf.displayName="DataRouterState";var A2=x.createContext(!1);function f3(){return x.useContext(A2)}var M2=x.createContext({isTransitioning:!1});M2.displayName="ViewTransition";var p3=x.createContext(new Map);p3.displayName="Fetchers";var m3=x.createContext(null);m3.displayName="Await";var Es=x.createContext(null);Es.displayName="Navigation";var Xc=x.createContext(null);Xc.displayName="Location";var na=x.createContext({outlet:null,matches:[],isDataRoute:!1});na.displayName="Route";var rb=x.createContext(null);rb.displayName="RouteError";var z2="REACT_ROUTER_ERROR",g3="REDIRECT",h3="ROUTE_ERROR_RESPONSE";function x3(e){if(e.startsWith(`${z2}:${g3}:{`))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 b3(e){if(e.startsWith(`${z2}:${h3}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new o3(t.status,t.statusText,t.data)}catch{}}function _3(e,{relative:t}={}){cn(dl(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:o}=x.useContext(Es),{hash:i,pathname:c,search:d}=Qc(e,{relative:t}),f=c;return a!=="/"&&(f=c==="/"?a:ea([a,c])),o.createHref({pathname:f,search:d,hash:i})}function dl(){return x.useContext(Xc)!=null}function ns(){return cn(dl(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Xc).location}var O2="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function D2(e){x.useContext(Es).static||x.useLayoutEffect(e)}function Tn(){let{isDataRoute:e}=x.useContext(na);return e?M3():v3()}function v3(){cn(dl(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(ul),{basename:t,navigator:a}=x.useContext(Es),{matches:o}=x.useContext(na),{pathname:i}=ns(),c=JSON.stringify(ab(o)),d=x.useRef(!1);return D2(()=>{d.current=!0}),x.useCallback((m,g={})=>{if(Fs(d.current,O2),!d.current)return;if(typeof m=="number"){a.go(m);return}let h=If(m,JSON.parse(c),i,g.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:ea([t,h.pathname])),(g.replace?a.replace:a.push)(h,g.state,g)},[t,a,c,i,e])}x.createContext(null);function P2(){let{matches:e}=x.useContext(na);return e[e.length-1]?.params??{}}function Qc(e,{relative:t}={}){let{matches:a}=x.useContext(na),{pathname:o}=ns(),i=JSON.stringify(ab(a));return x.useMemo(()=>If(e,JSON.parse(i),o,t==="path"),[e,i,o,t])}function y3(e,t){return L2(e,t)}function L2(e,t,a){cn(dl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(Es),{matches:i}=x.useContext(na),c=i[i.length-1],d=c?c.params:{},f=c?c.pathname:"/",m=c?c.pathnameBase:"/",g=c&&c.route;{let k=g&&g.path||"";B2(f,!g||k.endsWith("*")||k.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${k}">) 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="${k}"> to <Route path="${k==="/"?"*":`${k}/*`}">.`)}let h=ns(),b;if(t){let k=typeof t=="string"?cl(t):t;cn(m==="/"||k.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 "${k.pathname}" was given in the \`location\` prop.`),b=k}else b=h;let _=b.pathname||"/",j=_;if(m!=="/"){let k=m.replace(/^\//,"").split("/");j="/"+_.replace(/^\//,"").split("/").slice(k.length).join("/")}let E=a&&a.state.matches.length?a.state.matches.map(k=>Object.assign(k,{route:a.manifest[k.route.id]||k.route})):j2(e,{pathname:j});Fs(g||E!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Fs(E==null||E[E.length-1].route.element!==void 0||E[E.length-1].route.Component!==void 0||E[E.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=C3(E&&E.map(k=>Object.assign({},k,{params:Object.assign({},d,k.params),pathname:ea([m,o.encodeLocation?o.encodeLocation(k.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?m:ea([m,o.encodeLocation?o.encodeLocation(k.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:k.pathnameBase])})),i,a);return t&&y?x.createElement(Xc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},y):y}function j3(){let e=A3(),t=i3(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:o},c={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=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),a?x.createElement("pre",{style:i},a):null,d)}var k3=x.createElement(j3,null),I2=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 a=b3(e.digest);a&&(e=a)}let t=e!==void 0?x.createElement(na.Provider,{value:this.props.routeContext},x.createElement(rb.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(w3,{error:e},t):t}};I2.contextType=A2;var Vg=new WeakMap;function w3({children:e,error:t}){let{basename:a}=x.useContext(Es);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=x3(t.digest);if(o){let i=Vg.get(t);if(i)throw i;let c=R2(o.location,a),d=c.absoluteURL||c.to;if(d3(d))throw new Error("Invalid redirect location");if(E2&&!Vg.get(t))if(c.isExternal||o.reloadDocument)window.location.href=d;else{const f=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:o.replace}));throw Vg.set(t,f),f}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function S3({routeContext:e,match:t,children:a}){let o=x.useContext(ul);return o&&o.static&&o.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(na.Provider,{value:e},a)}function C3(e,t=[],a){let o=a?.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 i=e,c=o?.errors;if(c!=null){let h=i.findIndex(b=>b.route.id&&c?.[b.route.id]!==void 0);cn(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),i=i.slice(0,Math.min(i.length,h+1))}let d=!1,f=-1;if(a&&o){d=o.renderFallback;for(let h=0;h<i.length;h++){let b=i[h];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(f=h),b.route.id){let{loaderData:_,errors:j}=o,E=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!j||j[b.route.id]===void 0);if(b.route.lazy||E){a.isStatic&&(d=!0),f>=0?i=i.slice(0,f+1):i=[i[0]];break}}}}let m=a?.onError,g=o&&m?(h,b)=>{m(h,{location:o.location,params:o.matches?.[0]?.params??{},pattern:l3(o.matches),errorInfo:b})}:void 0;return i.reduceRight((h,b,_)=>{let j,E=!1,y=null,k=null;o&&(j=c&&b.route.id?c[b.route.id]:void 0,y=b.route.errorElement||k3,d&&(f<0&&_===0?(B2("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,k=null):f===_&&(E=!0,k=b.route.hydrateFallbackElement||null)));let N=t.concat(i.slice(0,_+1)),w=()=>{let S;return j?S=y:E?S=k:b.route.Component?S=x.createElement(b.route.Component,null):b.route.element?S=b.route.element:S=h,x.createElement(S3,{match:b,routeContext:{outlet:h,matches:N,isDataRoute:o!=null},children:S})};return o&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?x.createElement(I2,{location:o.location,revalidation:o.revalidation,component:y,error:j,children:w(),routeContext:{outlet:null,matches:N,isDataRoute:!0},onError:g}):w()},null)}function ob(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function N3(e){let t=x.useContext(ul);return cn(t,ob(e)),t}function E3(e){let t=x.useContext(Bf);return cn(t,ob(e)),t}function R3(e){let t=x.useContext(na);return cn(t,ob(e)),t}function ib(e){let t=R3(e),a=t.matches[t.matches.length-1];return cn(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function T3(){return ib("useRouteId")}function A3(){let e=x.useContext(rb),t=E3("useRouteError"),a=ib("useRouteError");return e!==void 0?e:t.errors?.[a]}function M3(){let{router:e}=N3("useNavigate"),t=ib("useNavigate"),a=x.useRef(!1);return D2(()=>{a.current=!0}),x.useCallback(async(i,c={})=>{Fs(a.current,O2),a.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:t,...c}))},[e,t])}var xj={};function B2(e,t,a){!t&&!xj[e]&&(xj[e]=!0,Fs(!1,a))}x.memo(z3);function z3({routes:e,manifest:t,future:a,state:o,isStatic:i,onError:c}){return L2(e,void 0,{manifest:t,state:o,isStatic:i,onError:c})}function O3({to:e,replace:t,state:a,relative:o}){cn(dl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:i}=x.useContext(Es);Fs(!i,"<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(na),{pathname:d}=ns(),f=Tn(),m=If(e,ab(c),d,o==="path"),g=JSON.stringify(m);return x.useEffect(()=>{f(JSON.parse(g),{replace:t,state:a,relative:o})},[f,g,o,t,a]),null}function zt(e){cn(!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 D3({basename:e="/",children:t=null,location:a,navigationType:o="POP",navigator:i,static:c=!1,useTransitions:d}){cn(!dl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),m=x.useMemo(()=>({basename:f,navigator:i,static:c,useTransitions:d,future:{}}),[f,i,c,d]);typeof a=="string"&&(a=cl(a));let{pathname:g="/",search:h="",hash:b="",state:_=null,key:j="default",mask:E}=a,y=x.useMemo(()=>{let k=sr(g,f);return k==null?null:{location:{pathname:k,search:h,hash:b,state:_,key:j,mask:E},navigationType:o}},[f,g,h,b,_,j,o,E]);return Fs(y!=null,`<Router basename="${f}"> 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(Es.Provider,{value:m},x.createElement(Xc.Provider,{children:t,value:y}))}function $2({children:e,location:t}){return y3(ox(e),t)}function ox(e,t=[]){let a=[];return x.Children.forEach(e,(o,i)=>{if(!x.isValidElement(o))return;let c=[...t,i];if(o.type===x.Fragment){a.push.apply(a,ox(o.props.children,c));return}cn(o.type===zt,`[${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>`),cn(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={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&&(d.children=ox(o.props.children,c)),a.push(d)}),a}var Jd="get",ef="application/x-www-form-urlencoded";function $f(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function P3(e){return $f(e)&&e.tagName.toLowerCase()==="button"}function L3(e){return $f(e)&&e.tagName.toLowerCase()==="form"}function I3(e){return $f(e)&&e.tagName.toLowerCase()==="input"}function B3(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function $3(e,t){return e.button===0&&(!t||t==="_self")&&!B3(e)}function ix(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,a)=>{let o=e[a];return t.concat(Array.isArray(o)?o.map(i=>[a,i]):[[a,o]])},[]))}function U3(e,t){let a=ix(e);return t&&t.forEach((o,i)=>{a.has(i)||t.getAll(i).forEach(c=>{a.append(i,c)})}),a}var Sd=null;function q3(){if(Sd===null)try{new FormData(document.createElement("form"),0),Sd=!1}catch{Sd=!0}return Sd}var H3=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Fg(e){return e!=null&&!H3.has(e)?(Fs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ef}"`),null):e}function V3(e,t){let a,o,i,c,d;if(L3(e)){let f=e.getAttribute("action");o=f?sr(f,t):null,a=e.getAttribute("method")||Jd,i=Fg(e.getAttribute("enctype"))||ef,c=new FormData(e)}else if(P3(e)||I3(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||f.getAttribute("action");if(o=m?sr(m,t):null,a=e.getAttribute("formmethod")||f.getAttribute("method")||Jd,i=Fg(e.getAttribute("formenctype"))||Fg(f.getAttribute("enctype"))||ef,c=new FormData(f,e),!q3()){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($f(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=Jd,o=null,i=ef,d=e}return c&&i==="text/plain"&&(d=c,c=void 0),{action:o,method:a.toLowerCase(),encType:i,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function lb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function U2(e,t,a,o){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return a?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${o}`:i.pathname=`${i.pathname}.${o}`:i.pathname==="/"?i.pathname=`_root.${o}`:t&&sr(i.pathname,t)==="/"?i.pathname=`${df(t)}/_root.${o}`:i.pathname=`${df(i.pathname)}.${o}`,i}async function F3(e,t){if(e.id in t)return t[e.id];try{let a=await import(e.module);return t[e.id]=a,a}catch(a){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function G3(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 Y3(e,t,a){let o=await Promise.all(e.map(async i=>{let c=t.routes[i.route.id];if(c){let d=await F3(c,a);return d.links?d.links():[]}return[]}));return W3(o.flat(1).filter(G3).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function bj(e,t,a,o,i,c){let d=(m,g)=>a[g]?m.route.id!==a[g].route.id:!0,f=(m,g)=>a[g].pathname!==m.pathname||a[g].route.path?.endsWith("*")&&a[g].params["*"]!==m.params["*"];return c==="assets"?t.filter((m,g)=>d(m,g)||f(m,g)):c==="data"?t.filter((m,g)=>{let h=o.routes[m.route.id];if(!h||!h.hasLoader)return!1;if(d(m,g)||f(m,g))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:a[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function K3(e,t,{includeHydrateFallback:a}={}){return X3(e.map(o=>{let i=t.routes[o.route.id];if(!i)return[];let c=[i.module];return i.clientActionModule&&(c=c.concat(i.clientActionModule)),i.clientLoaderModule&&(c=c.concat(i.clientLoaderModule)),a&&i.hydrateFallbackModule&&(c=c.concat(i.hydrateFallbackModule)),i.imports&&(c=c.concat(i.imports)),c}).flat(1))}function X3(e){return[...new Set(e)]}function Q3(e){let t={},a=Object.keys(e).sort();for(let o of a)t[o]=e[o];return t}function W3(e,t){let a=new Set;return new Set(t),e.reduce((o,i)=>{let c=JSON.stringify(Q3(i));return a.has(c)||(a.add(c),o.push({key:c,link:i})),o},[])}function cb(){let e=x.useContext(ul);return lb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function Z3(){let e=x.useContext(Bf);return lb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ub=x.createContext(void 0);ub.displayName="FrameworkContext";function Uf(){let e=x.useContext(ub);return lb(e,"You must render this element inside a <HydratedRouter> element"),e}function J3(e,t){let a=x.useContext(ub),[o,i]=x.useState(!1),[c,d]=x.useState(!1),{onFocus:f,onBlur:m,onMouseEnter:g,onMouseLeave:h,onTouchStart:b}=t,_=x.useRef(null);x.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let y=N=>{N.forEach(w=>{d(w.isIntersecting)})},k=new IntersectionObserver(y,{threshold:.5});return _.current&&k.observe(_.current),()=>{k.disconnect()}}},[e]),x.useEffect(()=>{if(o){let y=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(y)}}},[o]);let j=()=>{i(!0)},E=()=>{i(!1),d(!1)};return a?e!=="intent"?[c,_,{}]:[c,_,{onFocus:lc(f,j),onBlur:lc(m,E),onMouseEnter:lc(g,j),onMouseLeave:lc(h,E),onTouchStart:lc(b,j)}]:[!1,_,{}]}function lc(e,t){return a=>{e&&e(a),a.defaultPrevented||t(a)}}function eA({page:e,...t}){let a=f3(),{nonce:o}=Uf(),{router:i}=cb(),c=x.useMemo(()=>j2(i.routes,e,i.basename),[i.routes,e,i.basename]);return c?(t.nonce==null&&o&&(t={...t,nonce:o}),a?x.createElement(nA,{page:e,matches:c,...t}):x.createElement(sA,{page:e,matches:c,...t})):null}function tA(e){let{manifest:t,routeModules:a}=Uf(),[o,i]=x.useState([]);return x.useEffect(()=>{let c=!1;return Y3(e,t,a).then(d=>{c||i(d)}),()=>{c=!0}},[e,t,a]),o}function nA({page:e,matches:t,...a}){let o=ns(),{future:i}=Uf(),{basename:c}=cb(),d=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let f=U2(e,c,i.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&&f.searchParams.set("_routes",g.join(",")),[f.pathname+f.search]},[c,i.v8_trailingSlashAwareDataRequests,e,o,t]);return x.createElement(x.Fragment,null,d.map(f=>x.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...a})))}function sA({page:e,matches:t,...a}){let o=ns(),{future:i,manifest:c,routeModules:d}=Uf(),{basename:f}=cb(),{loaderData:m,matches:g}=Z3(),h=x.useMemo(()=>bj(e,t,g,c,o,"data"),[e,t,g,c,o]),b=x.useMemo(()=>bj(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,k=!1;if(t.forEach(w=>{let S=c.routes[w.route.id];!S||!S.hasLoader||(!h.some(R=>R.route.id===w.route.id)&&w.route.id in m&&d[w.route.id]?.shouldRevalidate||S.hasClientLoader?k=!0:y.add(w.route.id))}),y.size===0)return[];let N=U2(e,f,i.v8_trailingSlashAwareDataRequests,"data");return k&&y.size>0&&N.searchParams.set("_routes",t.filter(w=>y.has(w.route.id)).map(w=>w.route.id).join(",")),[N.pathname+N.search]},[f,i.v8_trailingSlashAwareDataRequests,m,o,c,h,t,e,d]),j=x.useMemo(()=>K3(b,c),[b,c]),E=tA(b);return x.createElement(x.Fragment,null,_.map(y=>x.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...a})),j.map(y=>x.createElement("link",{key:y,rel:"modulepreload",href:y,...a})),E.map(({key:y,link:k})=>x.createElement("link",{key:y,nonce:a.nonce,...k,crossOrigin:k.crossOrigin??a.crossOrigin})))}function aA(...e){return t=>{e.forEach(a=>{typeof a=="function"?a(t):a!=null&&(a.current=t)})}}var rA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{rA&&(window.__reactRouterVersion="7.18.2")}catch{}function oA({basename:e,children:t,useTransitions:a,window:o}){let i=x.useRef();i.current==null&&(i.current=I5({window:o,v5Compat:!0}));let c=i.current,[d,f]=x.useState({action:c.action,location:c.location}),m=x.useCallback(g=>{a===!1?f(g):x.startTransition(()=>f(g))},[a]);return x.useLayoutEffect(()=>c.listen(m),[c,m]),x.createElement(D3,{basename:e,children:t,location:d.location,navigationType:d.action,navigator:c,useTransitions:a})}var qf=x.forwardRef(function({onClick:t,discover:a="render",prefetch:o="none",relative:i,reloadDocument:c,replace:d,mask:f,state:m,target:g,to:h,preventScrollReset:b,viewTransition:_,defaultShouldRevalidate:j,...E},y){let{basename:k,navigator:N,useTransitions:w}=x.useContext(Es),S=typeof h=="string"&&sb.test(h),R=R2(h,k);h=R.to;let A=_3(h,{relative:i}),T=ns(),z=null;if(f){let G=If(f,[],T.mask?T.mask.pathname:"/",!0);k!=="/"&&(G.pathname=G.pathname==="/"?k:ea([k,G.pathname])),z=N.createHref(G)}let[M,P,L]=J3(o,E),I=cA(h,{replace:d,mask:f,state:m,target:g,preventScrollReset:b,relative:i,viewTransition:_,defaultShouldRevalidate:j,useTransitions:w});function D(G){t&&t(G),G.defaultPrevented||I(G)}let $=!(R.isExternal||c),q=x.createElement("a",{...E,...L,href:($?z:void 0)||R.absoluteURL||A,onClick:$?D:t,ref:aA(y,P),target:g,"data-discover":!S&&a==="render"?"true":void 0});return M&&!S?x.createElement(x.Fragment,null,q,x.createElement(eA,{page:A})):q});qf.displayName="Link";var ff=x.forwardRef(function({"aria-current":t="page",caseSensitive:a=!1,className:o="",end:i=!1,style:c,to:d,viewTransition:f,children:m,...g},h){let b=Qc(d,{relative:g.relative}),_=ns(),j=x.useContext(Bf),{navigator:E,basename:y}=x.useContext(Es),k=j!=null&&mA(b)&&f===!0,N=E.encodeLocation?E.encodeLocation(b).pathname:b.pathname,w=_.pathname,S=j&&j.navigation&&j.navigation.location?j.navigation.location.pathname:null;a||(w=w.toLowerCase(),S=S?S.toLowerCase():null,N=N.toLowerCase()),S&&y&&(S=sr(S,y)||S);const R=N!=="/"&&N.endsWith("/")?N.length-1:N.length;let A=w===N||!i&&w.startsWith(N)&&w.charAt(R)==="/",T=S!=null&&(S===N||!i&&S.startsWith(N)&&S.charAt(N.length)==="/"),z={isActive:A,isPending:T,isTransitioning:k},M=A?t:void 0,P;typeof o=="function"?P=o(z):P=[o,A?"active":null,T?"pending":null,k?"transitioning":null].filter(Boolean).join(" ");let L=typeof c=="function"?c(z):c;return x.createElement(qf,{...g,"aria-current":M,className:P,ref:h,style:L,to:d,viewTransition:f},typeof m=="function"?m(z):m)});ff.displayName="NavLink";var iA=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:a,reloadDocument:o,replace:i,state:c,method:d=Jd,action:f,onSubmit:m,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:_,...j},E)=>{let{useTransitions:y}=x.useContext(Es),k=fA(),N=pA(f,{relative:g}),w=d.toLowerCase()==="get"?"get":"post",S=typeof f=="string"&&sb.test(f),R=A=>{if(m&&m(A),A.defaultPrevented)return;A.preventDefault();let T=A.nativeEvent.submitter,z=T?.getAttribute("formmethod")||d,M=()=>k(T||A.currentTarget,{fetcherKey:t,method:z,navigate:a,replace:i,state:c,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:_});y&&a!==!1?x.startTransition(()=>M()):M()};return x.createElement("form",{ref:E,method:w,action:N,onSubmit:o?m:R,...j,"data-discover":!S&&e==="render"?"true":void 0})});iA.displayName="Form";function lA(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function q2(e){let t=x.useContext(ul);return cn(t,lA(e)),t}function cA(e,{target:t,replace:a,mask:o,state:i,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m,useTransitions:g}={}){let h=Tn(),b=ns(),_=Qc(e,{relative:d});return x.useCallback(j=>{if($3(j,t)){j.preventDefault();let E=a!==void 0?a:Oc(b)===Oc(_),y=()=>h(e,{replace:E,mask:o,state:i,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:m});g?x.startTransition(()=>y()):y()}},[b,h,_,a,o,i,t,e,c,d,f,m,g])}function qo(e){Fs(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(ix(e)),a=x.useRef(!1),o=ns(),i=x.useMemo(()=>U3(o.search,a.current?null:t.current),[o.search]),c=Tn(),d=x.useCallback((f,m)=>{const g=ix(typeof f=="function"?f(new URLSearchParams(i)):f);a.current=!0,c("?"+g,m)},[c,i]);return[i,d]}var uA=0,dA=()=>`__${String(++uA)}__`;function fA(){let{router:e}=q2("useSubmit"),{basename:t}=x.useContext(Es),a=T3(),o=e.fetch,i=e.navigate;return x.useCallback(async(c,d={})=>{let{action:f,method:m,encType:g,formData:h,body:b}=V3(c,t);if(d.navigate===!1){let _=d.fetcherKey||dA();await o(_,a,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:b,formMethod:d.method||m,formEncType:d.encType||g,flushSync:d.flushSync})}else await i(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:b,formMethod:d.method||m,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:a,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,i,t,a])}function pA(e,{relative:t}={}){let{basename:a}=x.useContext(Es),o=x.useContext(na);cn(o,"useFormAction must be used inside a RouteContext");let[i]=o.matches.slice(-1),c={...Qc(e||".",{relative:t})},d=ns();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),m=f.getAll("index");if(m.some(h=>h==="")){f.delete("index"),m.filter(b=>b).forEach(b=>f.append("index",b));let h=f.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(c.pathname=c.pathname==="/"?a:ea([a,c.pathname])),Oc(c)}function mA(e,{relative:t}={}){let a=x.useContext(M2);cn(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=q2("useViewTransitionState"),i=Qc(e,{relative:t});if(!a.isTransitioning)return!1;let c=sr(a.currentLocation.pathname,o)||a.currentLocation.pathname,d=sr(a.nextLocation.pathname,o)||a.nextLocation.pathname;return uf(i.pathname,d)!=null||uf(i.pathname,c)!=null}var Gs=v2();/**
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 gA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H2=(...e)=>e.filter((t,a,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===a).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 hA={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 xA=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:o,className:i="",children:c,iconNode:d,...f},m)=>x.createElement("svg",{ref:m,...hA,width:t,height:t,stroke:e,strokeWidth:o?Number(a)*24/Number(t):a,className:H2("lucide",i),...f},[...d.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 be=(e,t)=>{const a=x.forwardRef(({className:o,...i},c)=>x.createElement(xA,{ref:c,iconNode:t,className:H2(`lucide-${gA(e)}`,o),...i}));return a.displayName=`${e}`,a};/**
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 Hf=be("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 V2=be("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 bA=be("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 F2=be("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 G2=be("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 _A=be("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 vA=be("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 yA=be("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 rn=be("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 jA=be("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 kA=be("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 Dc=be("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 db=be("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
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 wA=be("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
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 SA=be("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/**
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 Yr=be("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
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 ms=be("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
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 CA=be("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
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 Zr=be("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
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 fb=be("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
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 NA=be("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
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 EA=be("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
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 Vf=be("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
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 RA=be("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
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=be("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["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"}]]);/**
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 Y2=be("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"}]]);/**
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 AA=be("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"}]]);/**
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 K2=be("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
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 MA=be("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
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 zA=be("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
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 OA=be("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
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 DA=be("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/**
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 Mo=be("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"}]]);/**
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 PA=be("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
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 LA=be("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
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 pb=be("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"}]]);/**
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 va=be("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"}]]);/**
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 X2=be("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"}]]);/**
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 IA=be("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
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 BA=be("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"}]]);/**
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 mb=be("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
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 Q2=be("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"}]]);/**
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 Wc=be("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"}]]);/**
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 gb=be("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"}]]);/**
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 $A=be("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
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 pf=be("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"}]]);/**
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 lx=be("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"}]]);/**
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 UA=be("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"}]]);/**
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 qA=be("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/**
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 Ff=be("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"}]]);/**
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=be("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"}]]);/**
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 W2=be("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"}]]);/**
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 cx=be("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"}]]);/**
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 VA=be("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"}]]);/**
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 Z2=be("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"}]]);/**
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 Ho=be("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"}]]);/**
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 hb=be("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"}]]);/**
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 J2=be("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"}]]);/**
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 FA=be("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"}]]);/**
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 GA=be("Frame",[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]);/**
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 Gf=be("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
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 YA=be("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"}]]);/**
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 Zc=be("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"}]]);/**
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 KA=be("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"}]]);/**
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 eS=be("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
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 tS=be("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
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 XA=be("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"}]]);/**
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 QA=be("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
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 zo=be("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"}]]);/**
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 WA=be("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"}]]);/**
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 nS=be("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"}]]);/**
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 ZA=be("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/**
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 ux=be("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
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 xb=be("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
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 sS=be("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"}]]);/**
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 JA=be("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"}]]);/**
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 eM=be("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"}]]);/**
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 tM=be("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"}]]);/**
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 nM=be("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"}]]);/**
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 sM=be("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"}]]);/**
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 Js=be("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 aS=be("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
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 aM=be("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
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 rS=be("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"}]]);/**
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 bb=be("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"}]]);/**
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 Jc=be("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"}]]);/**
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 _b=be("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"}]]);/**
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 rM=be("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
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 oM=be("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
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 vb=be("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"}]]);/**
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 iM=be("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
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 lM=be("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
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 cM=be("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"}]]);/**
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 oS=be("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
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 uM=be("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
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 dM=be("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/**
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 wa=be("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"}]]);/**
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 yb=be("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 fM=be("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"}]]);/**
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 Dt=be("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 Yf=be("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"}]]);/**
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 pM=be("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"}]]);/**
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 mM=be("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
596
- * @license lucide-react v0.469.0 - ISC
597
- *
598
- * This source code is licensed under the ISC license.
599
- * See the LICENSE file in the root directory of this source tree.
600
- */const Cs=be("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"}]]);/**
601
- * @license lucide-react v0.469.0 - ISC
602
- *
603
- * This source code is licensed under the ISC license.
604
- * See the LICENSE file in the root directory of this source tree.
605
- */const fl=be("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"}]]);/**
606
- * @license lucide-react v0.469.0 - ISC
607
- *
608
- * This source code is licensed under the ISC license.
609
- * See the LICENSE file in the root directory of this source tree.
610
- */const Gg=be("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/**
611
- * @license lucide-react v0.469.0 - ISC
612
- *
613
- * This source code is licensed under the ISC license.
614
- * See the LICENSE file in the root directory of this source tree.
615
- */const Yg=be("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/**
616
- * @license lucide-react v0.469.0 - ISC
617
- *
618
- * This source code is licensed under the ISC license.
619
- * See the LICENSE file in the root directory of this source tree.
620
- */const Kf=be("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"}]]);/**
621
- * @license lucide-react v0.469.0 - ISC
622
- *
623
- * This source code is licensed under the ISC license.
624
- * See the LICENSE file in the root directory of this source tree.
625
- */const jb=be("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"}]]);/**
626
- * @license lucide-react v0.469.0 - ISC
627
- *
628
- * This source code is licensed under the ISC license.
629
- * See the LICENSE file in the root directory of this source tree.
630
- */const qi=be("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
631
- * @license lucide-react v0.469.0 - ISC
632
- *
633
- * This source code is licensed under the ISC license.
634
- * See the LICENSE file in the root directory of this source tree.
635
- */const Sa=be("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"}]]);/**
636
- * @license lucide-react v0.469.0 - ISC
637
- *
638
- * This source code is licensed under the ISC license.
639
- * See the LICENSE file in the root directory of this source tree.
640
- */const iS=be("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"}]]);/**
641
- * @license lucide-react v0.469.0 - ISC
642
- *
643
- * This source code is licensed under the ISC license.
644
- * See the LICENSE file in the root directory of this source tree.
645
- */const gM=be("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"}]]);/**
646
- * @license lucide-react v0.469.0 - ISC
647
- *
648
- * This source code is licensed under the ISC license.
649
- * See the LICENSE file in the root directory of this source tree.
650
- */const Xf=be("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"}]]);/**
651
- * @license lucide-react v0.469.0 - ISC
652
- *
653
- * This source code is licensed under the ISC license.
654
- * See the LICENSE file in the root directory of this source tree.
655
- */const hM=be("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
656
- * @license lucide-react v0.469.0 - ISC
657
- *
658
- * This source code is licensed under the ISC license.
659
- * See the LICENSE file in the root directory of this source tree.
660
- */const xM=be("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
661
- * @license lucide-react v0.469.0 - ISC
662
- *
663
- * This source code is licensed under the ISC license.
664
- * See the LICENSE file in the root directory of this source tree.
665
- */const bM=be("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
666
- * @license lucide-react v0.469.0 - ISC
667
- *
668
- * This source code is licensed under the ISC license.
669
- * See the LICENSE file in the root directory of this source tree.
670
- */const sa=be("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"}]]);/**
671
- * @license lucide-react v0.469.0 - ISC
672
- *
673
- * This source code is licensed under the ISC license.
674
- * See the LICENSE file in the root directory of this source tree.
675
- */const _M=be("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"}]]);/**
676
- * @license lucide-react v0.469.0 - ISC
677
- *
678
- * This source code is licensed under the ISC license.
679
- * See the LICENSE file in the root directory of this source tree.
680
- */const kb=be("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
681
- * @license lucide-react v0.469.0 - ISC
682
- *
683
- * This source code is licensed under the ISC license.
684
- * See the LICENSE file in the root directory of this source tree.
685
- */const vM=be("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"}]]);/**
686
- * @license lucide-react v0.469.0 - ISC
687
- *
688
- * This source code is licensed under the ISC license.
689
- * See the LICENSE file in the root directory of this source tree.
690
- */const ya=be("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
691
- * @license lucide-react v0.469.0 - ISC
692
- *
693
- * This source code is licensed under the ISC license.
694
- * See the LICENSE file in the root directory of this source tree.
695
- */const yM=be("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"}]]);/**
696
- * @license lucide-react v0.469.0 - ISC
697
- *
698
- * This source code is licensed under the ISC license.
699
- * See the LICENSE file in the root directory of this source tree.
700
- */const _n=be("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"}]]);/**
701
- * @license lucide-react v0.469.0 - ISC
702
- *
703
- * This source code is licensed under the ISC license.
704
- * See the LICENSE file in the root directory of this source tree.
705
- */const wb=be("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"}]]);/**
706
- * @license lucide-react v0.469.0 - ISC
707
- *
708
- * This source code is licensed under the ISC license.
709
- * See the LICENSE file in the root directory of this source tree.
710
- */const lS=be("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"}]]);/**
711
- * @license lucide-react v0.469.0 - ISC
712
- *
713
- * This source code is licensed under the ISC license.
714
- * See the LICENSE file in the root directory of this source tree.
715
- */const Sb=be("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"}]]);/**
716
- * @license lucide-react v0.469.0 - ISC
717
- *
718
- * This source code is licensed under the ISC license.
719
- * See the LICENSE file in the root directory of this source tree.
720
- */const jM=be("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"}]]);/**
721
- * @license lucide-react v0.469.0 - ISC
722
- *
723
- * This source code is licensed under the ISC license.
724
- * See the LICENSE file in the root directory of this source tree.
725
- */const kM=be("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"}]]);/**
726
- * @license lucide-react v0.469.0 - ISC
727
- *
728
- * This source code is licensed under the ISC license.
729
- * See the LICENSE file in the root directory of this source tree.
730
- */const wM=be("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
731
- * @license lucide-react v0.469.0 - ISC
732
- *
733
- * This source code is licensed under the ISC license.
734
- * See the LICENSE file in the root directory of this source tree.
735
- */const aa=be("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"}]]);/**
736
- * @license lucide-react v0.469.0 - ISC
737
- *
738
- * This source code is licensed under the ISC license.
739
- * See the LICENSE file in the root directory of this source tree.
740
- */const gs=be("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
741
- * @license lucide-react v0.469.0 - ISC
742
- *
743
- * This source code is licensed under the ISC license.
744
- * See the LICENSE file in the root directory of this source tree.
745
- */const pl=be("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"}]]),Qf={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},Dn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},Cb=["total","automatico","permiso"],_j=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],SM={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 CM(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches}function Kg(e){return e==="system"?CM()?"dark":"light":e}function vj(){if(typeof window>"u")return"dark";const e=localStorage.getItem(Dn.theme);return e==="light"||e==="dark"||e==="system"?e:"dark"}const cS=x.createContext(null);function NM({children:e}){const[t,a]=x.useState(vj),[o,i]=x.useState(()=>Kg(vj()));x.useEffect(()=>{const f=()=>{const m=Kg(t);i(m),document.documentElement.classList.toggle("dark",m==="dark")};f();try{localStorage.setItem(Dn.theme,t)}catch{}if(t==="system"&&typeof window.matchMedia=="function"){const m=window.matchMedia("(prefers-color-scheme: dark)");return m.addEventListener("change",f),()=>m.removeEventListener("change",f)}},[t]);const c=x.useCallback(()=>{a(f=>Kg(f)==="dark"?"light":"dark")},[]),d=x.useMemo(()=>({theme:o,preference:t,toggle:c,set:a}),[o,t,c]);return n.jsx(cS.Provider,{value:d,children:e})}function Nb(){const e=x.useContext(cS);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const EM=1367/458,RM=735/1016;function TM({size:e=32,title:t="APX",variant:a="icon"}){const{theme:o}=Nb(),i=SM[a][o];if(a==="full"){const c=e,d=Math.round(e*EM);return n.jsx("img",{src:i,alt:t,width:d,height:c,className:"block object-contain",draggable:!1})}if(a==="vertical"){const c=e,d=Math.round(e/RM);return n.jsx("img",{src:i,alt:t,width:c,height:d,className:"block object-contain",draggable:!1})}return n.jsx("img",{src:i,alt:t,width:e,height:e,className:"block object-contain",draggable:!1})}function uS(e){var t,a,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(a=uS(e[t]))&&(o&&(o+=" "),o+=a)}else for(a in e)e[a]&&(o&&(o+=" "),o+=a);return o}function Pc(){for(var e,t,a=0,o="",i=arguments.length;a<i;a++)(e=arguments[a])&&(t=uS(e))&&(o&&(o+=" "),o+=t);return o}const Eb="-",AM=e=>{const t=zM(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:d=>{const f=d.split(Eb);return f[0]===""&&f.length!==1&&f.shift(),dS(f,t)||MM(d)},getConflictingClassGroupIds:(d,f)=>{const m=a[d]||[];return f&&o[d]?[...m,...o[d]]:m}}},dS=(e,t)=>{if(e.length===0)return t.classGroupId;const a=e[0],o=t.nextPart.get(a),i=o?dS(e.slice(1),o):void 0;if(i)return i;if(t.validators.length===0)return;const c=e.join(Eb);return t.validators.find(({validator:d})=>d(c))?.classGroupId},yj=/^\[(.+)\]$/,MM=e=>{if(yj.test(e)){const t=yj.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},zM=e=>{const{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return DM(Object.entries(e.classGroups),a).forEach(([c,d])=>{dx(d,o,c,t)}),o},dx=(e,t,a,o)=>{e.forEach(i=>{if(typeof i=="string"){const c=i===""?t:jj(t,i);c.classGroupId=a;return}if(typeof i=="function"){if(OM(i)){dx(i(o),t,a,o);return}t.validators.push({validator:i,classGroupId:a});return}Object.entries(i).forEach(([c,d])=>{dx(d,jj(t,c),a,o)})})},jj=(e,t)=>{let a=e;return t.split(Eb).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},OM=e=>e.isThemeGetter,DM=(e,t)=>t?e.map(([a,o])=>{const i=o.map(c=>typeof c=="string"?t+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([d,f])=>[t+d,f])):c);return[a,i]}):e,PM=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map;const i=(c,d)=>{a.set(c,d),t++,t>e&&(t=0,o=a,a=new Map)};return{get(c){let d=a.get(c);if(d!==void 0)return d;if((d=o.get(c))!==void 0)return i(c,d),d},set(c,d){a.has(c)?a.set(c,d):i(c,d)}}},fS="!",LM=e=>{const{separator:t,experimentalParseClassName:a}=e,o=t.length===1,i=t[0],c=t.length,d=f=>{const m=[];let g=0,h=0,b;for(let k=0;k<f.length;k++){let N=f[k];if(g===0){if(N===i&&(o||f.slice(k,k+c)===t)){m.push(f.slice(h,k)),h=k+c;continue}if(N==="/"){b=k;continue}}N==="["?g++:N==="]"&&g--}const _=m.length===0?f:f.substring(h),j=_.startsWith(fS),E=j?_.substring(1):_,y=b&&b>h?b-h:void 0;return{modifiers:m,hasImportantModifier:j,baseClassName:E,maybePostfixModifierPosition:y}};return a?f=>a({className:f,parseClassName:d}):d},IM=e=>{if(e.length<=1)return e;const t=[];let a=[];return e.forEach(o=>{o[0]==="["?(t.push(...a.sort(),o),a=[]):a.push(o)}),t.push(...a.sort()),t},BM=e=>({cache:PM(e.cacheSize),parseClassName:LM(e),...AM(e)}),$M=/\s+/,UM=(e,t)=>{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:i}=t,c=[],d=e.trim().split($M);let f="";for(let m=d.length-1;m>=0;m-=1){const g=d[m],{modifiers:h,hasImportantModifier:b,baseClassName:_,maybePostfixModifierPosition:j}=a(g);let E=!!j,y=o(E?_.substring(0,j):_);if(!y){if(!E){f=g+(f.length>0?" "+f:f);continue}if(y=o(_),!y){f=g+(f.length>0?" "+f:f);continue}E=!1}const k=IM(h).join(":"),N=b?k+fS:k,w=N+y;if(c.includes(w))continue;c.push(w);const S=i(y,E);for(let R=0;R<S.length;++R){const A=S[R];c.push(N+A)}f=g+(f.length>0?" "+f:f)}return f};function qM(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=pS(t))&&(o&&(o+=" "),o+=a);return o}const pS=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=pS(e[o]))&&(a&&(a+=" "),a+=t);return a};function HM(e,...t){let a,o,i,c=d;function d(m){const g=t.reduce((h,b)=>b(h),e());return a=BM(g),o=a.cache.get,i=a.cache.set,c=f,f(m)}function f(m){const g=o(m);if(g)return g;const h=UM(m,a);return i(m,h),h}return function(){return c(qM.apply(null,arguments))}}const nn=e=>{const t=a=>a[e]||[];return t.isThemeGetter=!0,t},mS=/^\[(?:([a-z-]+):)?(.+)\]$/i,VM=/^\d+\/\d+$/,FM=new Set(["px","full","screen"]),GM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,YM=/\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$/,KM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,XM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,QM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ga=e=>Hi(e)||FM.has(e)||VM.test(e),Dr=e=>ml(e,"length",a4),Hi=e=>!!e&&!Number.isNaN(Number(e)),Xg=e=>ml(e,"number",Hi),cc=e=>!!e&&Number.isInteger(Number(e)),WM=e=>e.endsWith("%")&&Hi(e.slice(0,-1)),gt=e=>mS.test(e),Pr=e=>GM.test(e),ZM=new Set(["length","size","percentage"]),JM=e=>ml(e,ZM,gS),e4=e=>ml(e,"position",gS),t4=new Set(["image","url"]),n4=e=>ml(e,t4,o4),s4=e=>ml(e,"",r4),uc=()=>!0,ml=(e,t,a)=>{const o=mS.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},a4=e=>YM.test(e)&&!KM.test(e),gS=()=>!1,r4=e=>XM.test(e),o4=e=>QM.test(e),i4=()=>{const e=nn("colors"),t=nn("spacing"),a=nn("blur"),o=nn("brightness"),i=nn("borderColor"),c=nn("borderRadius"),d=nn("borderSpacing"),f=nn("borderWidth"),m=nn("contrast"),g=nn("grayscale"),h=nn("hueRotate"),b=nn("invert"),_=nn("gap"),j=nn("gradientColorStops"),E=nn("gradientColorStopPositions"),y=nn("inset"),k=nn("margin"),N=nn("opacity"),w=nn("padding"),S=nn("saturate"),R=nn("scale"),A=nn("sepia"),T=nn("skew"),z=nn("space"),M=nn("translate"),P=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",gt,t],D=()=>[gt,t],$=()=>["",Ga,Dr],q=()=>["auto",Hi,gt],G=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],U=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],X=()=>["start","end","center","between","around","evenly","stretch"],Q=()=>["","0",gt],W=()=>["auto","avoid","all","avoid-page","page","left","right","column"],B=()=>[Hi,gt];return{cacheSize:500,separator:":",theme:{colors:[uc],spacing:[Ga,Dr],blur:["none","",Pr,gt],brightness:B(),borderColor:[e],borderRadius:["none","","full",Pr,gt],borderSpacing:D(),borderWidth:$(),contrast:B(),grayscale:Q(),hueRotate:B(),invert:Q(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[WM,Dr],inset:I(),margin:I(),opacity:B(),padding:D(),saturate:B(),scale:B(),sepia:Q(),skew:B(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",gt]}],container:["container"],columns:[{columns:[Pr]}],"break-after":[{"break-after":W()}],"break-before":[{"break-before":W()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],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:[...G(),gt]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:P()}],"overscroll-x":[{"overscroll-x":P()}],"overscroll-y":[{"overscroll-y":P()}],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",cc,gt]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",gt]}],grow:[{grow:Q()}],shrink:[{shrink:Q()}],order:[{order:["first","last","none",cc,gt]}],"grid-cols":[{"grid-cols":[uc]}],"col-start-end":[{col:["auto",{span:["full",cc,gt]},gt]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[uc]}],"row-start-end":[{row:["auto",{span:[cc,gt]},gt]}],"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",gt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",gt]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"justify-content":[{justify:["normal",...X()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...X(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...X(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[k]}],mx:[{mx:[k]}],my:[{my:[k]}],ms:[{ms:[k]}],me:[{me:[k]}],mt:[{mt:[k]}],mr:[{mr:[k]}],mb:[{mb:[k]}],ml:[{ml:[k]}],"space-x":[{"space-x":[z]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[z]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",gt,t]}],"min-w":[{"min-w":[gt,t,"min","max","fit"]}],"max-w":[{"max-w":[gt,t,"none","full","min","max","fit","prose",{screen:[Pr]},Pr]}],h:[{h:[gt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[gt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[gt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[gt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Pr,Dr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Xg]}],"font-family":[{font:[uc]}],"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",gt]}],"line-clamp":[{"line-clamp":["none",Hi,Xg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ga,gt]}],"list-image":[{"list-image":["none",gt]}],"list-style-type":[{list:["none","disc","decimal",gt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[N]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[N]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...U(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ga,Dr]}],"underline-offset":[{"underline-offset":["auto",Ga,gt]}],"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:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",gt]}],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",gt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[N]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...G(),e4]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",JM]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},n4]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[E]}],"gradient-via-pos":[{via:[E]}],"gradient-to-pos":[{to:[E]}],"gradient-from":[{from:[j]}],"gradient-via":[{via:[j]}],"gradient-to":[{to:[j]}],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:[f]}],"border-w-x":[{"border-x":[f]}],"border-w-y":[{"border-y":[f]}],"border-w-s":[{"border-s":[f]}],"border-w-e":[{"border-e":[f]}],"border-w-t":[{"border-t":[f]}],"border-w-r":[{"border-r":[f]}],"border-w-b":[{"border-b":[f]}],"border-w-l":[{"border-l":[f]}],"border-opacity":[{"border-opacity":[N]}],"border-style":[{border:[...U(),"hidden"]}],"divide-x":[{"divide-x":[f]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[f]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[N]}],"divide-style":[{divide:U()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...U()]}],"outline-offset":[{"outline-offset":[Ga,gt]}],"outline-w":[{outline:[Ga,Dr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[N]}],"ring-offset-w":[{"ring-offset":[Ga,Dr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Pr,s4]}],"shadow-color":[{shadow:[uc]}],opacity:[{opacity:[N]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",Pr,gt]}],grayscale:[{grayscale:[g]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[b]}],saturate:[{saturate:[S]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"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":[N]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[d]}],"border-spacing-x":[{"border-spacing-x":[d]}],"border-spacing-y":[{"border-spacing-y":[d]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",gt]}],duration:[{duration:B()}],ease:[{ease:["linear","in","out","in-out",gt]}],delay:[{delay:B()}],animate:[{animate:["none","spin","ping","pulse","bounce",gt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[cc,gt]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"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",gt]}],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",gt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"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",gt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ga,Dr,Xg]}],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"]}}},hS=HM(i4);function ge(...e){return hS(Pc(e))}const kj={};function Hn(e,t){const a=x.useRef(kj);return a.current===kj&&(a.current=e(t)),a}const fx=[];let px;function l4(){return px}function c4(e){fx.push(e)}function Rb(e){const t=(a,o)=>{const i=Hn(u4).current;let c;try{px=i;for(const d of fx)d.before(i);c=e(a,o);for(const d of fx)d.after(i);i.didInitialize=!0}finally{px=void 0}return c};return t.displayName=e.displayName||e.name,t}function xS(e){return x.forwardRef(Rb(e))}function u4(){return{didInitialize:!1}}function Nn(){}const ja=Object.freeze([]),sn=Object.freeze({}),d4=()=>{},Pe=typeof document<"u"?x.useLayoutEffect:d4;function f4(e,t){return function(o,...i){const c=new URL(e);return c.searchParams.set("code",o.toString()),i.forEach(d=>c.searchParams.append("args[]",d)),`${t} error #${o}; visit ${c} for the full message.`}}const gn=f4("https://base-ui.com/production-error","Base UI"),bS=x.createContext(void 0);function eu(e){const t=x.useContext(bS);if(t===void 0&&!e)throw new Error(gn(72));return t}function Tb(e){x.useEffect(e,ja)}const dc=0;class ta{static create(){return new ta}currentId=dc;start(t,a){this.clear(),this.currentId=setTimeout(()=>{this.currentId=dc,a()},t)}isStarted(){return this.currentId!==dc}clear=()=>{this.currentId!==dc&&(clearTimeout(this.currentId),this.currentId=dc)};disposeEffect=()=>this.clear}function Rn(){const e=Hn(ta.create).current;return Tb(e.disposeEffect),e}function p4(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:m4,platform:g4,maxTouchPoints:h4}=p4(),Wf=m4.toLowerCase(),Lc=g4.toLowerCase(),Zf=/^i(os$|p)/.test(Lc)||Lc==="macintel"&&h4>1,wj="android",mx=Lc===wj||Wf.includes(wj),Ab=!Zf&&Lc.startsWith("mac");Lc.startsWith("win");const x4=Ab||Zf,lr=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!lr&&Wf.includes("firefox");!lr&&Wf.includes("chrom");const b4=x4,Mb=/jsdom|happydom/.test(Wf);function pa(e){e.preventDefault(),e.stopPropagation()}function _4(e){return"nativeEvent"in e}function zb(e){return e.pointerType===""&&e.isTrusted?!0:mx&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Ob(e){return Mb?!1:!mx&&e.width===0&&e.height===0||mx&&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 Hr(e,t){const a=["mouse","pen"];return t||a.push("",void 0),a.includes(e)}function v4(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Jf(){return typeof window<"u"}function Vn(e){return Db(e)?(e.nodeName||"").toLowerCase():"#document"}function Jt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cr(e){var t;return(t=(Db(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Db(e){return Jf()?e instanceof Node||e instanceof Jt(e).Node:!1}function bt(e){return Jf()?e instanceof Element||e instanceof Jt(e).Element:!1}function Gt(e){return Jf()?e instanceof HTMLElement||e instanceof Jt(e).HTMLElement:!1}function Zi(e){return!Jf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Jt(e).ShadowRoot}function tu(e){const{overflow:t,overflowX:a,overflowY:o,display:i}=Ns(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+a)&&i!=="inline"&&i!=="contents"}function y4(e){return/^(table|td|th)$/.test(Vn(e))}function ep(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const j4=/transform|translate|scale|rotate|perspective|filter/,k4=/paint|layout|strict|content/,jo=e=>!!e&&e!=="none";let Qg;function Pb(e){const t=bt(e)?Ns(e):e;return jo(t.transform)||jo(t.translate)||jo(t.scale)||jo(t.rotate)||jo(t.perspective)||!Lb()&&(jo(t.backdropFilter)||jo(t.filter))||j4.test(t.willChange||"")||k4.test(t.contain||"")}function w4(e){let t=ar(e);for(;Gt(t)&&!Ja(t);){if(Pb(t))return t;if(ep(t))return null;t=ar(t)}return null}function Lb(){return Qg==null&&(Qg=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Qg}function Ja(e){return/^(html|body|#document)$/.test(Vn(e))}function Ns(e){return Jt(e).getComputedStyle(e)}function tp(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ar(e){if(Vn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Zi(e)&&e.host||cr(e);return Zi(t)?t.host:t}function _S(e){const t=ar(e);return Ja(t)?(e.ownerDocument||e).body:Gt(t)&&tu(t)?t:_S(t)}function Ic(e,t,a){var o;t===void 0&&(t=[]),a===void 0&&(a=!0);const i=_S(e),c=i===((o=e.ownerDocument)==null?void 0:o.body),d=Jt(i);if(c){const f=gx(d);return t.concat(d,d.visualViewport||[],tu(i)?i:[],f&&a?Ic(f):[])}else return t.concat(i,Ic(i,[],a))}function gx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const hx="data-base-ui-focusable",vS="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",np="ArrowLeft",sp="ArrowRight",yS="ArrowUp",Ib="ArrowDown";function Kn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Ze(e,t){if(!e||!t)return!1;const a=t.getRootNode?.();if(e.contains(t))return!0;if(a&&Zi(a)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function qn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function mf(e,t){if(!bt(e))return!1;const a=e;if(t.hasElement(a))return!a.hasAttribute("data-trigger-disabled");for(const[,o]of t.entries())if(Ze(o,a))return!o.hasAttribute("data-trigger-disabled");return!1}function Wg(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const a=e;return a.target!=null&&t.contains(a.target)}function S4(e){return e.matches("html,body")}function ap(e){return Gt(e)&&e.matches(vS)}function C4(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${vS}`)!=null}function xx(e){return e?e.getAttribute("role")==="combobox"&&ap(e):!1}function N4(e){if(!e||Mb)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function gf(e){return e?e.hasAttribute(hx)?e:e.querySelector(`[${hx}]`)||e:null}function E4(e,t){return t!=null&&!Hr(t)?0:typeof e=="function"?e():e}function Kr(e,t,a){const o=E4(e,a);return typeof o=="number"?o:o?.[t]}function Sj(e){return typeof e=="function"?e():e}function jS(e,t){return t||e==="click"||e==="mousedown"}function R4(e){return e?.includes("mouse")&&e!=="mousedown"}const ka="none",gl="trigger-press",En="trigger-hover",Vi="trigger-focus",rp="outside-press",Fi="item-press",T4="close-press",Oo="focus-out",op="escape-key",bx="list-navigation",kS="cancel-open",yc="sibling-open",wS="disabled",Cj="missing",Nj="initial",Bb="imperative-action",A4="window-resize";function rt(e,t,a,o){let i=!1,c=!1;const d=o??sn;return{reason:e,event:t??new Event("base-ui"),cancel(){i=!0},allowPropagation(){c=!0},get isCanceled(){return i},get isPropagationAllowed(){return c},trigger:a,...d}}const SS=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ta,currentIdRef:{current:null},currentContextRef:{current:null}});function M4(e,t){e.current=t.current}function z4(e){const{children:t,delay:a,timeoutMs:o=0}=e,i=x.useRef(a),c=x.useRef(a),d=x.useRef(null),f=x.useRef(null),m=Rn();return Pe(()=>{if(c.current=a,!d.current){i.current=a;return}i.current={open:Kr(i.current,"open"),close:Kr(a,"close")}},[a,d,i,c]),n.jsx(SS.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:c,currentIdRef:d,timeoutMs:o,currentContextRef:f,timeout:m}),[o,m]),children:t})}function O4(e,t={open:!1}){const{open:a}=t,o="rootStore"in e?e.rootStore:e,i=o.useState("floatingId"),c=x.useContext(SS),{currentIdRef:d,delayRef:f,timeoutMs:m,initialDelayRef:g,currentContextRef:h,hasProvider:b,timeout:_}=c,[j,E]=x.useState(!1),y=x.useRef(a);return Pe(()=>{y.current=a},[a]),Pe(()=>{function k(){h.current?.setIsInstantPhase(!1),d.current=null,h.current=null,f.current=g.current,_.clear()}if(d.current&&!a&&d.current===i){if(E(!1),m){const N=i;return _.start(m,()=>{o.select("open")||d.current&&d.current!==N||k()}),()=>{(y.current||d.current!==N)&&_.clear()}}k()}},[a,i,d,f,m,g,h,_,o]),Pe(()=>{if(!a)return;const k=h.current,N=d.current;_.clear(),h.current={onOpenChange:o.setOpen,setIsInstantPhase:E},d.current=i,f.current={open:0,close:Kr(g.current,"close")},N!==null&&N!==i?(E(!0),k?.setIsInstantPhase(!0),k?.onOpenChange(!1,rt(ka))):(E(!1),k?.setIsInstantPhase(!1))},[a,i,o,d,f,g,h,_]),Pe(()=>()=>{if(d.current===i){if(h.current=null,!y.current)return;d.current=null,M4(f,g),_.clear()}},[h,d,f,i,g,_]),x.useMemo(()=>({hasProvider:b,delayRef:f,isInstantPhase:j}),[b,f,j])}function xt(e,t,a,o){return e.addEventListener(t,a,o),()=>{e.removeEventListener(t,a,o)}}function _a(...e){return()=>{for(let t=0;t<e.length;t+=1){const a=e[t];a&&a()}}}function rr(e,t,a,o){const i=Hn(CS).current;return P4(i,e,t,a,o)&&NS(i,[e,t,a,o]),i.callback}function D4(e){const t=Hn(CS).current;return L4(t,e)&&NS(t,e),t.callback}function CS(){return{callback:null,cleanup:null,refs:[]}}function P4(e,t,a,o,i){return e.refs[0]!==t||e.refs[1]!==a||e.refs[2]!==o||e.refs[3]!==i}function L4(e,t){return e.refs.length!==t.length||e.refs.some((a,o)=>a!==t[o])}function NS(e,t){if(e.refs=t,t.every(a=>a==null)){e.callback=null;return}e.callback=a=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),a!=null){const o=Array(t.length).fill(null);for(let i=0;i<t.length;i+=1){const c=t[i];if(c!=null)switch(typeof c){case"function":{const d=c(a);typeof d=="function"&&(o[i]=d);break}case"object":{c.current=a;break}}}e.cleanup=()=>{for(let i=0;i<t.length;i+=1){const c=t[i];if(c!=null)switch(typeof c){case"function":{const d=o[i];typeof d=="function"?d():c(null);break}case"object":{c.current=null;break}}}}}}}function mn(e){const t=Hn(I4,e).current;return t.next=e,Pe(t.effect),t}function I4(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const $b={...R5},Zg=$b.useInsertionEffect,B4=Zg&&Zg!==$b.useLayoutEffect?Zg:e=>e();function He(e){const t=Hn($4).current;return t.next=e,B4(t.effect),t.trampoline}function $4(){const e={next:void 0,callback:U4,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function U4(){}const Cd=null;class q4{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const a=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let i=0;i<a.length;i+=1)a[i]?.(t)};request(t){const a=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),a}cancel(t){const a=t-this.startId;a<0||a>=this.callbacks.length||(this.callbacks[a]=null,this.callbacksCount-=1)}}let Nd=new q4;class ga{static create(){return new ga}static request(t){return Nd.request(t)}static cancel(t){return Nd.cancel(t)}currentId=Cd;request(t){this.cancel(),this.currentId=Nd.request(()=>{this.currentId=Cd,t()})}cancel=()=>{this.currentId!==Cd&&(Nd.cancel(this.currentId),this.currentId=Cd)};disposeEffect=()=>this.cancel}function Ji(){const e=Hn(ga.create).current;return Tb(e.disposeEffect),e}function vt(e){return e?.ownerDocument||document}const ES={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ub={...ES,position:"fixed",top:0,left:0},RS={...ES,position:"absolute"},el=x.forwardRef(function(t,a){const[o,i]=x.useState();Pe(()=>{b4&&lr&&i("button")},[]);const c={tabIndex:0,role:o};return n.jsx("span",{...t,ref:a,style:Ub,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),tl=Math.min,er=Math.max,hf=Math.round,Ed=Math.floor,tr=e=>({x:e,y:e}),H4={left:"right",right:"left",bottom:"top",top:"bottom"};function TS(e,t,a){return er(e,tl(t,a))}function Xr(e,t){return typeof e=="function"?e(t):e}function Vs(e){return e.split("-")[0]}function Jr(e){return e.split("-")[1]}function qb(e){return e==="x"?"y":"x"}function Hb(e){return e==="y"?"height":"width"}function Hs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Vb(e){return qb(Hs(e))}function V4(e,t,a){a===void 0&&(a=!1);const o=Jr(e),i=Vb(e),c=Hb(i);let d=i==="x"?o===(a?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(d=xf(d)),[d,xf(d)]}function F4(e){const t=xf(e);return[_x(e),t,_x(t)]}function _x(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ej=["left","right"],Rj=["right","left"],G4=["top","bottom"],Y4=["bottom","top"];function K4(e,t,a){switch(e){case"top":case"bottom":return a?t?Rj:Ej:t?Ej:Rj;case"left":case"right":return t?G4:Y4;default:return[]}}function X4(e,t,a,o){const i=Jr(e);let c=K4(Vs(e),a==="start",o);return i&&(c=c.map(d=>d+"-"+i),t&&(c=c.concat(c.map(_x)))),c}function xf(e){const t=Vs(e);return H4[t]+e.slice(t.length)}function Q4(e){var t,a,o,i;return{top:(t=e.top)!=null?t:0,right:(a=e.right)!=null?a:0,bottom:(o=e.bottom)!=null?o:0,left:(i=e.left)!=null?i:0}}function AS(e){return typeof e!="number"?Q4(e):{top:e,right:e,bottom:e,left:e}}function Bc(e){const{x:t,y:a,width:o,height:i}=e;return{width:o,height:i,top:a,left:t,right:t+o,bottom:a+i,x:t,y:a}}function Rc(e,t){return t<0||t>=e.length}function tf(e,t){return Qa(e.current,{disabledIndices:t})}function vx(e,t){return Qa(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Qa(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:o,amount:i=1}={}){let c=t;do c+=a?-i:i;while(c>=0&&c<=e.length-1&&bf(e,c,o));return c}function bf(e,t,a){if(typeof a=="function"?a(t):a?.includes(t)??!1)return!0;const i=e[t];return i?!ip(i)||i.matches(":disabled")?!0:!a&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!1}function W4(e){return e.visibility==="hidden"||e.visibility==="collapse"}function ip(e,t=e?Ns(e):null){return!e||!e.isConnected||!t||W4(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const Z4='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function J4(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const a=e.getRootNode();return Zi(a)?a.host:null}function yx(e){for(const t of Array.from(e.children))if(Vn(t)==="summary")return t;return null}function ez(e,t){const a=yx(t);return!!a&&(e===a||Ze(a,e))}function MS(e){const t=e?Vn(e):"";return e!=null&&e.matches(Z4)&&(t!=="summary"||e.parentElement!=null&&Vn(e.parentElement)==="details"&&yx(e.parentElement)===e)&&(t!=="details"||yx(e)==null)&&(t!=="input"||e.type!=="hidden")}function zS(e){if(!MS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=J4(t)){const a=t!==e,o=Vn(t)==="slot";if(t.hasAttribute("inert")||a&&Vn(t)==="details"&&!t.open&&!ez(e,t)||t.hasAttribute("hidden")||!o&&!tz(t,a))return!1}return!0}function tz(e,t){const a=Ns(e);return t?a.display!=="none":ip(e,a)}function OS(e){const t=e.tabIndex;if(t<0){const a=Vn(e);if(a==="details"||a==="audio"||a==="video"||Gt(e)&&e.isContentEditable)return 0}return t}function Jg(e){if(Vn(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function nz(e,t){const a=Jg(e);if(!a)return!0;const o=t.find(i=>{const c=Jg(i);return c?.name===a.name&&c.form===a.form&&c.checked});return o?o===a:t.find(i=>{const c=Jg(i);return c?.name===a.name&&c.form===a.form})===a}function DS(e){if(Gt(e)&&Vn(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Gt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function PS(e,t){DS(e).forEach(a=>{MS(a)&&t.push(a),PS(a,t)})}function LS(e,t,a){DS(e).forEach(o=>{Gt(o)&&o.matches(t)&&a.push(o),LS(o,t,a)})}function Fb(e){return zS(e)&&OS(e)>=0}function IS(e){const t=[];return PS(e,t),t.filter(zS)}function nu(e){const t=IS(e);return t.filter(a=>OS(a)>=0&&nz(a,t))}function BS(e,t){const a=nu(e),o=a.length;if(o===0)return;const i=Kn(vt(e)),c=a.indexOf(i),d=c===-1?t===1?0:o-1:c+t;return a[d]}function Gb(e){return BS(vt(e).body,1)||e}function $S(e){return BS(vt(e).body,-1)||e}function US(e,t){if(!e)return null;const a=nu(vt(e).body),o=a.length;if(o===0)return null;const i=a.indexOf(e);if(i===-1)return null;const c=(i+t+o)%o;return a[c]}function sz(e){return US(e,1)}function az(e){return US(e,-1)}function Gi(e,t){const a=t||e.currentTarget,o=e.relatedTarget;return!o||!Ze(a,o)}function rz(e){nu(e).forEach(a=>{a.dataset.tabindex=a.getAttribute("tabindex")||"",a.setAttribute("tabindex","-1")})}function Tj(e){const t=[];LS(e,"[data-tabindex]",t),t.forEach(a=>{const o=a.dataset.tabindex;delete a.dataset.tabindex,o?a.setAttribute("tabindex",o):a.removeAttribute("tabindex")})}function Qr(e,t,a=!0){return e.filter(i=>i.parentId===t).flatMap(i=>[...!a||i.context?.open?[i]:[],...Qr(e,i.id,a)])}function Aj(e,t){let a=[],o=e.find(i=>i.id===t)?.parentId;for(;o;){const i=e.find(c=>c.id===o);o=i?.parentId,i&&(a=a.concat(i))}return a}function $c(e){return`data-base-ui-${e}`}let Rd=0;function nf(e,t={}){const{preventScroll:a=!1,sync:o=!1,shouldFocus:i}=t;cancelAnimationFrame(Rd);function c(){i&&!i()||e?.focus({preventScroll:a})}if(o)return c(),Nn;const d=requestAnimationFrame(c);return Rd=d,()=>{Rd===d&&(cancelAnimationFrame(d),Rd=0)}}const eh={inert:new WeakMap,"aria-hidden":new WeakMap},Mj="data-base-ui-inert",jx={inert:new WeakSet,"aria-hidden":new WeakSet};let fc=new WeakMap,th=0;function oz(e){return jx[e]}function qS(e){return e?Zi(e)?e.host:qS(e.parentNode):null}const zj=(e,t)=>t.map(a=>{if(e.contains(a))return a;const o=qS(a);return e.contains(o)?o:null}).filter(a=>a!=null),Oj=e=>{const t=new Set;return e.forEach(a=>{let o=a;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},Dj=(e,t,a)=>{const o=[],i=c=>{!c||a.has(c)||Array.from(c.children).forEach(d=>{Vn(d)!=="script"&&(t.has(d)?i(d):o.push(d))})};return i(e),o};function iz(e,t,a,o,{mark:i=!0}){let c=null;o?c="inert":a&&(c="aria-hidden");let d=null,f=null;const m=zj(t,e),g=i?Dj(t,Oj(m),new Set(m)):[],h=[],b=[];if(c){const _=eh[c],j=oz(c);f=j,d=_;const E=zj(t,Array.from(t.querySelectorAll("[aria-live]"))),y=m.concat(E);Dj(t,Oj(y),new Set(y)).forEach(N=>{const w=N.getAttribute(c),S=w!==null&&w!=="false",R=(_.get(N)||0)+1;_.set(N,R),h.push(N),R===1&&S&&j.add(N),S||N.setAttribute(c,c==="inert"?"":"true")})}return i&&g.forEach(_=>{const j=(fc.get(_)||0)+1;fc.set(_,j),b.push(_),j===1&&_.setAttribute(Mj,"")}),th+=1,()=>{d&&h.forEach(_=>{const E=(d.get(_)||0)-1;d.set(_,E),E||(!f?.has(_)&&c&&_.removeAttribute(c),f?.delete(_))}),i&&b.forEach(_=>{const j=(fc.get(_)||0)-1;fc.set(_,j),j||_.removeAttribute(Mj)}),th-=1,th||(eh.inert=new WeakMap,eh["aria-hidden"]=new WeakMap,jx.inert=new WeakSet,jx["aria-hidden"]=new WeakSet,fc=new WeakMap)}}function Pj(e,t={}){const{ariaHidden:a=!1,inert:o=!1,mark:i=!0}=t,c=vt(e[0]).body;return iz(e,c,a,o,{mark:i})}let Lj=0;function lz(e,t="mui"){const[a,o]=x.useState(e),i=e||a;return x.useEffect(()=>{a==null&&(Lj+=1,o(`${t}-${Lj}`))},[a,t]),i}const Ij=$b.useId;function Do(e,t){if(Ij!==void 0){const a=Ij();return e??(t?`${t}-${a}`:a)}return lz(e,t)}const cz=parseInt(x.version,10);function Yb(e){return cz>=e}function Bj(e){if(!x.isValidElement(e))return null;const t=e,a=t.props;return(Yb(19)?a?.ref:t.ref)??null}function kx(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function uz(e,t){const a={};for(const o in e){const i=e[o];if(t?.hasOwnProperty(o)){const c=t[o](i);c!=null&&Object.assign(a,c);continue}i===!0?a[`data-${o.toLowerCase()}`]="":i&&(a[`data-${o.toLowerCase()}`]=i.toString())}return a}function dz(e,t){return typeof e=="function"?e(t):e}function fz(e,t){return typeof e=="function"?e(t):e}const Kb={};function Ss(e,t,a,o,i){if(!a&&!o&&!i&&!e)return _f(t);let c=_f(e);return t&&(c=jc(c,t)),a&&(c=jc(c,a)),o&&(c=jc(c,o)),i&&(c=jc(c,i)),c}function pz(e){if(e.length===0)return Kb;if(e.length===1)return _f(e[0]);let t=_f(e[0]);for(let a=1;a<e.length;a+=1)t=jc(t,e[a]);return t}function _f(e){return Xb(e)?{...VS(e,Kb)}:mz(e)}function jc(e,t){return Xb(t)?VS(t,e):gz(e,t)}function mz(e){const t={...e};for(const a in t){const o=t[a];HS(a,o)&&(t[a]=FS(o))}return t}function gz(e,t){if(!t)return e;for(const a in t){const o=t[a];switch(a){case"style":{e[a]=kx(e.style,o);break}case"className":{e[a]=GS(e.className,o);break}default:HS(a,o)?e[a]=hz(e[a],o):e[a]=o}}return e}function HS(e,t){const a=e.charCodeAt(0),o=e.charCodeAt(1),i=e.charCodeAt(2);return a===111&&o===110&&i>=65&&i<=90&&(typeof t=="function"||typeof t>"u")}function Xb(e){return typeof e=="function"}function VS(e,t){return Xb(e)?e(t):e??Kb}function hz(e,t){return t?e?(...a)=>{const o=a[0];if(YS(o)){const c=o;vf(c);const d=t(...a);return c.baseUIHandlerPrevented||e?.(...a),d}const i=t(...a);return e?.(...a),i}:FS(t):e}function FS(e){return e&&((...t)=>{const a=t[0];return YS(a)&&vf(a),e(...t)})}function vf(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function GS(e,t){return t?e?t+" "+e:t:e}function YS(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Et(e,t,a={}){const o=t.render,i=xz(t,a);if(a.enabled===!1)return null;const c=a.state??sn;return vz(e,o,i,c)}function xz(e,t={}){const{className:a,style:o,render:i}=e,{state:c=sn,ref:d,props:f,stateAttributesMapping:m,enabled:g=!0}=t,h=g?dz(a,c):void 0,b=g?fz(o,c):void 0,_=g?uz(c,m):sn,j=g&&f?bz(f):void 0,E=g?kx(_,j)??{}:sn;return typeof document<"u"&&(g?Array.isArray(d)?E.ref=D4([E.ref,Bj(i),...d]):E.ref=rr(E.ref,Bj(i),d):rr(null,null)),g?(h!==void 0&&(E.className=GS(E.className,h)),b!==void 0&&(E.style=kx(E.style,b)),E):sn}function bz(e){return Array.isArray(e)?pz(e):Ss(void 0,e)}const _z=Symbol.for("react.lazy");function vz(e,t,a,o){if(t){if(typeof t=="function")return t(a,o);const i=Ss(a,t.props);i.ref=a.ref;let c=t;return c?.$$typeof===_z&&(c=x.Children.toArray(t)[0]),x.cloneElement(c,i)}if(e&&typeof e=="string")return yz(e,a);throw new Error(gn(8))}function yz(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 jz=500,kz=500,wz={style:{transition:"none"}},Sz="data-base-ui-click-trigger",KS={fallbackAxisSide:"none"},XS={fallbackAxisSide:"end"},Cz={clipPath:"inset(50%)",position:"fixed",top:0,left:0},QS=x.createContext(null),WS=()=>x.useContext(QS),Nz=$c("portal");function ZS(e={}){const{ref:t,container:a,componentProps:o=sn,elementProps:i}=e,c=Do(),f=WS()?.portalNode,[m,g]=x.useState(null),[h,b]=x.useState(null),_=He(k=>{k!==null&&b(k)}),j=x.useRef(null);Pe(()=>{if(a===null){j.current&&(j.current=null,b(null),g(null));return}const k=(a&&(Db(a)?a:a.current))??f??document.body;if(k==null){j.current&&(j.current=null,b(null),g(null));return}j.current!==k&&(j.current=k,b(null),g(k))},[a,f]);const E=Et("div",o,{ref:[t,_],props:[{id:c,[Nz]:""},i]}),y=m&&E?Gs.createPortal(E,m):null;return{node:h,nodeId:x.isValidElement(E)?E.props.id:void 0,subtree:y}}const Qb=x.forwardRef(function(t,a){const{render:o,className:i,style:c,children:d,container:f,...m}=t,{node:g,nodeId:h,subtree:b}=ZS({container:f,ref:a,componentProps:t,elementProps:m}),_=x.useRef(null),j=x.useRef(null),E=x.useRef(null),y=x.useRef(null),[k,N]=x.useState(null),w=x.useRef(!1),S=k?.modal,R=k?.open,A=!!k&&!k.modal&&k.open&&!!g;x.useEffect(()=>{if(!g||S)return;function z(M){g&&M.relatedTarget&&Gi(M)&&(M.type==="focusin"?w.current&&(Tj(g),w.current=!1):(rz(g),w.current=!0))}return _a(xt(g,"focusin",z,!0),xt(g,"focusout",z,!0))},[g,S]),Pe(()=>{!g||R!==!0||!w.current||(Tj(g),w.current=!1)},[R,g]);const T=x.useMemo(()=>({beforeOutsideRef:_,afterOutsideRef:j,beforeInsideRef:E,afterInsideRef:y,portalNode:g,setFocusManagerState:N}),[g]);return n.jsxs(x.Fragment,{children:[b,n.jsxs(QS.Provider,{value:T,children:[A&&g&&n.jsx(el,{"data-type":"outside",ref:_,onFocus:z=>{if(Gi(z,g))E.current?.focus();else{const M=k?k.domReference:null;$S(M)?.focus()}}}),A&&g&&n.jsx("span",{"aria-owns":h,style:Cz}),g&&Gs.createPortal(d,g),A&&g&&n.jsx(el,{"data-type":"outside",ref:j,onFocus:z=>{if(Gi(z,g))y.current?.focus();else{const M=k?k.domReference:null;Gb(M)?.focus(),k?.closeOnFocusOut&&k?.onOpenChange(!1,rt(Oo,z.nativeEvent))}}})]})]})});function JS(){const e=new Map;return{emit(t,a){e.get(t)?.forEach(o=>o(a))},on(t,a){e.has(t)||e.set(t,new Set),e.get(t).add(a)},off(t,a){e.get(t)?.delete(a)}}}class Wb{nodesRef={current:[]};events=JS();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const a=this.nodesRef.current.findIndex(o=>o===t);a!==-1&&this.nodesRef.current.splice(a,1)}}const eC=x.createContext(null),tC=x.createContext(null),eo=()=>x.useContext(eC)?.id||null,to=e=>{const t=x.useContext(tC);return e??t};function nC(e){const t=Do(),a=to(e),o=eo();return Pe(()=>{if(!t)return;const i={id:t,parentId:o};return a?.addNode(i),()=>{a?.removeNode(i)}},[a,t,o]),t}function Ez(e){const{children:t,id:a}=e,o=eo();return n.jsx(eC.Provider,{value:x.useMemo(()=>({id:a,parentId:o}),[a,o]),children:t})}function Rz(e){const{children:t,externalTree:a}=e,o=Hn(()=>a??new Wb).current;return n.jsx(tC.Provider,{value:o,children:t})}function Xa(e){return e==null?e:"current"in e?e.current:e}function Tz(e,t){const a=Jt(qn(e));return e instanceof a.KeyboardEvent?"keyboard":e instanceof a.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof a.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const $j=20;let Ur=[];function Zb(){Ur=Ur.filter(e=>e.deref()?.isConnected)}function Uj(e){Zb(),e&&Vn(e)!=="body"&&(Ur.push(new WeakRef(e)),Ur.length>$j&&(Ur=Ur.slice(-$j)))}function qj(){return Zb(),Ur[Ur.length-1]?.deref()}function Az(e){return e?Fb(e)?e:nu(e)[0]||e:null}function Hj(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const a=IS(e).filter(i=>{const c=i.getAttribute("data-tabindex")||"";return Fb(i)||i.hasAttribute("data-tabindex")&&!c.startsWith("-")}),o=e.getAttribute("tabindex");a.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Jb(e){const{context:t,children:a,disabled:o=!1,initialFocus:i=!0,returnFocus:c=!0,restoreFocus:d=!1,modal:f=!0,closeOnFocusOut:m=!0,openInteractionType:g="",nextFocusableElement:h,previousFocusableElement:b,beforeContentFocusGuardRef:_,externalTree:j,getInsideElements:E}=e,y="rootStore"in t?t.rootStore:t,k=y.useState("open"),N=y.useState("domReferenceElement"),w=y.useState("floatingElement"),{events:S,dataRef:R}=y.context,A=He(()=>R.current.floatingContext?.nodeId),T=i===!1,z=xx(N)&&T,M=mn(i),P=mn(c),L=mn(g),I=mn(k),D=to(j),$=WS(),q=x.useRef(!1),G=x.useRef(!1),U=x.useRef(!1),V=x.useRef(null),X=x.useRef(""),Q=x.useRef(""),W=x.useRef(null),B=x.useRef(null),K=rr(W,_,$?.beforeInsideRef),ee=rr(B,$?.afterInsideRef),F=Rn(),ne=Rn(),Z=Ji(),fe=$!=null,Y=gf(w),oe=He((xe=Y)=>xe?nu(xe):[]),ve=He(()=>E?.().filter(xe=>xe!=null)??[]);x.useEffect(()=>{if(o||!f)return;function xe(Re){Re.key==="Tab"&&Ze(Y,Kn(vt(Y)))&&oe().length===0&&!z&&pa(Re)}const ke=vt(Y);return xt(ke,"keydown",xe)},[o,Y,f,z,oe]),x.useEffect(()=>{if(o||!k)return;const xe=vt(Y);function ke(){U.current=!1}function Re(Ie){const Oe=qn(Ie),Te=ve(),Ne=Ze(w,Oe)||Ze(N,Oe)||Ze($?.portalNode,Oe)||Te.some(Me=>Me===Oe||Ze(Me,Oe));U.current=!Ne,Q.current=Ie.pointerType||"keyboard",Oe?.closest(`[${Sz}]`)&&(G.current=!0,ne.start(0,()=>{G.current=!1}))}function Ae(){Q.current="keyboard"}return _a(xt(xe,"pointerdown",Re,!0),xt(xe,"pointerup",ke,!0),xt(xe,"pointercancel",ke,!0),xt(xe,"keydown",Ae,!0),ke)},[o,w,N,Y,k,$,ne,ve]),x.useEffect(()=>{if(o||!m)return;const xe=vt(Y);function ke(){G.current=!0,ne.start(0,()=>{G.current=!1})}function Re(Te){const Ne=qn(Te);Fb(Ne)&&(V.current=Ne)}function Ae(Te){const Ne=Te.relatedTarget,Me=Te.currentTarget,De=qn(Te);f&&Ne==null&&De!=null&&Ze(w,De)&&Uj(De),queueMicrotask(()=>{const qe=A(),Xe=y.context.triggerElements,me=ve(),de=Ne?.hasAttribute($c("focus-guard"))&&[W.current,B.current,$?.beforeInsideRef.current,$?.afterInsideRef.current,$?.beforeOutsideRef.current,$?.afterOutsideRef.current,Xa(b),Xa(h)].includes(Ne),Le=!(Ze(N,Ne)||Ze(w,Ne)||Ze(Ne,w)||Ze($?.portalNode,Ne)||me.some(ye=>ye===Ne||Ze(ye,Ne))||Xe.hasMatchingElement(ye=>Ze(ye,Ne))||de||D&&(Qr(D.nodesRef.current,qe).find(ye=>Ze(ye.context?.elements.floating,Ne)||Ze(ye.context?.elements.domReference,Ne))||Aj(D.nodesRef.current,qe).find(ye=>[ye.context?.elements.floating,gf(ye.context?.elements.floating)].includes(Ne)||ye.context?.elements.domReference===Ne)));if(Me===N&&Y&&Hj(Y),d&&Me!==N&&!ip(De)&&Kn(xe)===xe.body){if(Gt(Y)&&(Y.focus(),d==="popup")){Z.request(()=>{Y.focus()});return}const ye=oe(),Ce=V.current,Qe=(Ce&&ye.includes(Ce)?Ce:null)||ye[ye.length-1]||Y;Gt(Qe)&&Qe.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(z||!f)&&Ne&&Le&&!G.current&&(z||Ne!==qj())&&(q.current=!0,y.setOpen(!1,rt(Oo,Te)))})}function Ie(){U.current||(R.current.insideReactTree=!0,F.start(0,()=>{R.current.insideReactTree=!1}))}const Oe=Gt(N)?N:null;if(!(!w&&!Oe))return _a(Oe&&xt(Oe,"focusout",Ae),Oe&&xt(Oe,"pointerdown",ke),w&&xt(w,"focusin",Re),w&&xt(w,"focusout",Ae),w&&$&&xt(w,"focusout",Ie,!0))},[o,N,w,Y,f,D,$,y,m,d,oe,z,A,R,F,ne,Z,h,b,ve]),x.useEffect(()=>{if(o||!w||!k)return;const xe=Array.from($?.portalNode?.querySelectorAll(`[${$c("portal")}]`)||[]),Re=(D?Aj(D.nodesRef.current,A()):[]).find(Me=>xx(Me.context?.elements.domReference||null))?.context?.elements.domReference,Ie=[...[w,...xe,W.current,B.current,$?.beforeOutsideRef.current,$?.afterOutsideRef.current,...ve()],Re,Xa(b),Xa(h),z?N:null].filter(Me=>Me!=null),Oe=Pj(Ie,{ariaHidden:f||z,mark:!1}),Te=[w,...xe].filter(Me=>Me!=null),Ne=Pj(Te);return()=>{Ne(),Oe()}},[k,o,N,w,f,$,z,D,A,h,b,ve]),Pe(()=>{if(!k||o||!Gt(Y))return;X.current="",Q.current="";const xe=vt(Y),ke=Kn(xe);queueMicrotask(()=>{const Re=M.current,Ae=typeof Re=="function"?Re(L.current||""):Re;if(Ae===void 0||Ae===!1||Ze(Y,ke))return;let Oe=null;const Te=()=>(Oe==null&&(Oe=oe(Y)),Oe[0]||Y);let Ne;Ae===!0||Ae===null?Ne=Te():Ne=Xa(Ae),Ne=Ne||Te();const Me=Ze(Y,Kn(xe));nf(Ne,{preventScroll:Ne===Y,shouldFocus(){if(!I.current)return!1;if(Me)return!0;const De=Kn(xe);return!(De!==Ne&&Ze(Y,De))}})})},[o,k,Y,oe,M,L,I]),Pe(()=>{if(o||!Y)return;const xe=vt(Y),ke=Kn(xe),Re=L.current==null;Uj(ke);function Ae(Oe){if(Oe.open||(X.current=Tz(Oe.nativeEvent,Q.current)),Oe.reason===En&&Oe.nativeEvent.type==="mouseleave"&&(q.current=!0),Oe.reason===rp)if(Oe.nested)q.current=!1;else if(zb(Oe.nativeEvent)||Ob(Oe.nativeEvent))q.current=!1;else{let Te=!1;vt(Y).createElement("div").focus({get preventScroll(){return Te=!0,!1}}),Te?q.current=!1:q.current=!0}}S.on("openchange",Ae);function Ie(Oe){const Te=P.current;let Ne=typeof Te=="function"?Te(Oe):Te;if(Ne===void 0||Ne===!1)return null;Ne===null&&(Ne=!0);const Me=N?.isConnected?N:null,De=ke?.isConnected&&Vn(ke)!=="body"?ke:null;let qe=Re?De||Me:Me||De;return qe||(qe=qj()||null),typeof Ne=="boolean"?qe:Xa(Ne)||qe||null}return()=>{S.off("openchange",Ae);const Oe=Kn(xe),Te=ve(),Ne=Ze(w,Oe)||Te.some(Xe=>Xe===Oe||Ze(Xe,Oe))||D&&Qr(D.nodesRef.current,A(),!1).some(Xe=>Ze(Xe.context?.elements.floating,Oe)),Me=P.current,De=X.current,qe=Ie(De);queueMicrotask(()=>{const Xe=Az(qe),me=typeof Me!="boolean";if(Me&&!q.current&&Gt(Xe)&&(!(!me&&Xe!==Oe&&Oe!==xe.body)||Ne)){const de={preventScroll:!0};De==="keyboard"&&(de.focusVisible=!0),Xe.focus(de)}q.current=!1})}},[o,w,Y,P,L,S,D,N,A,ve]),Pe(()=>{if(!lr||k||!w)return;const xe=Kn(vt(w));!Gt(xe)||!ap(xe)||Ze(w,xe)&&xe.blur()},[k,w]),Pe(()=>{if(!(o||!$))return $.setFocusManagerState({modal:f,closeOnFocusOut:m,open:k,onOpenChange:y.setOpen,domReference:N}),()=>{$.setFocusManagerState(null)}},[o,$,f,k,y,m,N]),Pe(()=>{if(!(o||!Y))return Hj(Y),()=>{queueMicrotask(Zb)}},[o,Y]);const ie=!o&&(f?!z:!0)&&(fe||f);return n.jsxs(x.Fragment,{children:[ie&&n.jsx(el,{"data-type":"inside",ref:K,onFocus:xe=>{if(f){const ke=oe();nf(ke[ke.length-1])}else $?.portalNode&&(q.current=!1,Gi(xe,$.portalNode)?Gb(N)?.focus():Xa(b??$.beforeOutsideRef)?.focus())}}),a,ie&&n.jsx(el,{"data-type":"inside",ref:ee,onFocus:xe=>{f?nf(oe()[0]):$?.portalNode&&(m&&(q.current=!0),Gi(xe,$.portalNode)?$S(N)?.focus():Xa(h??$.afterOutsideRef)?.focus())}})]})}function sC(e,t={}){const{enabled:a=!0,event:o="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:f=0,reason:m=gl}=t,g="rootStore"in e?e.rootStore:e,h=g.context.dataRef,b=x.useRef(void 0),_=Ji(),j=Rn(),E=x.useMemo(()=>{function y(N,w,S,R){const A=rt(m,w,S);N&&R==="touch"&&f>0?j.start(f,()=>{g.setOpen(!0,A)}):g.setOpen(N,A)}function k(N,w,S){const R=h.current.openEvent,A=g.select("domReferenceElement")!==w;return N&&A||!N||!i?!0:R&&d?!S(R.type):!1}return{onPointerDown(N){b.current=Hr(N.pointerType,!0)&&Ob(N.nativeEvent)?"virtual":N.pointerType},onMouseDown(N){const w=b.current,S=N.nativeEvent,R=g.select("open");if(N.button!==0||o==="click"||Hr(w,!0)&&c)return;const A=k(R,N.currentTarget,M=>M==="click"||M==="mousedown"),T=qn(S);if(ap(T)){y(A,S,T,w);return}const z=N.currentTarget;_.request(()=>{y(A,S,z,w)})},onClick(N){if(o==="mousedown-only")return;const w=b.current;if(o==="mousedown"&&w){b.current=void 0;return}if(Hr(w,!0)&&c)return;const S=g.select("open"),R=k(S,N.currentTarget,A=>A==="click"||A==="mousedown"||A==="keydown"||A==="keyup");y(R,N.nativeEvent,N.currentTarget,w)},onKeyDown(){b.current=void 0}}},[h,o,c,m,g,d,i,_,j,f]);return x.useMemo(()=>a?{reference:E}:sn,[a,E])}function Mz(e,t){let a=null,o=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){const c=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=t.axis==="x"||t.axis==="both",f=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 a==null&&t.x&&d&&(a=c.x-t.x),o==null&&t.y&&f&&(o=c.y-t.y),b-=a||0,_-=o||0,g=0,h=0,!i||m?(g=t.axis==="y"?c.width:0,h=t.axis==="x"?c.height:0,b=d&&t.x!=null?t.x:b,_=f&&t.y!=null?t.y:_):i&&!m&&(h=t.axis==="x"?c.height:h,g=t.axis==="y"?c.width:g),i=!0,{width:g,height:h,x:b,y:_,top:_,right:b+g,bottom:_+h,left:b}}}}function Vj(e){return e!=null&&e.clientX!=null}function zz(e,t={}){const{enabled:a=!0,axis:o="both"}=t,i="rootStore"in e?e.rootStore:e,c=i.useState("open"),d=i.useState("floatingElement"),f=i.useState("domReferenceElement"),m=i.context.dataRef,g=x.useRef(!1),h=x.useRef(null),[b,_]=x.useState(),[j,E]=x.useState([]),y=He(R=>{i.set("positionReference",R)}),k=He((R,A,T)=>{g.current||m.current.openEvent&&!Vj(m.current.openEvent)||i.set("positionReference",Mz(T??f,{x:R,y:A,axis:o,dataRef:m,pointerType:b}))}),N=He(R=>{c?h.current||(k(R.clientX,R.clientY,R.currentTarget),E([])):k(R.clientX,R.clientY,R.currentTarget)}),w=Hr(b)?d:c;x.useEffect(()=>{if(!a){y(f);return}if(!w)return;function R(){h.current?.(),h.current=null}const A=Jt(d);function T(z){const M=qn(z);Ze(d,M)?R():k(z.clientX,z.clientY)}return!m.current.openEvent||Vj(m.current.openEvent)?h.current=xt(A,"mousemove",T):y(f),R},[w,a,d,m,f,i,k,y,j]),x.useEffect(()=>()=>{i.set("positionReference",null)},[i]),x.useEffect(()=>{a&&!d&&(g.current=!1)},[a,d]),x.useEffect(()=>{!a&&c&&(g.current=!0)},[a,c]);const S=x.useMemo(()=>{function R(A){_(A.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:N,onMouseEnter:N}},[N]);return x.useMemo(()=>a?{reference:S,trigger:S}:{},[a,S])}function Oz(){return!1}function Dz(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function lp(e,t={}){const{enabled:a=!0,escapeKey:o=!0,outsidePress:i=!0,outsidePressEvent:c="sloppy",referencePress:d=Oz,bubbles:f,externalTree:m}=t,g="rootStore"in e?e.rootStore:e,h=g.useState("open"),b=g.useState("floatingElement"),{dataRef:_}=g.context,j=to(m),E=He(typeof i=="function"?i:()=>!1),y=typeof i=="function"?E:i,k=y!==!1,N=He(()=>c),{escapeKey:w,outsidePress:S}=Dz(f),R=x.useRef(!1),A=x.useRef(!1),T=x.useRef(!1),z=x.useRef(!1),M=x.useRef(""),P=x.useRef(null),L=Rn(),I=Rn(),D=He(()=>{I.clear(),_.current.insideReactTree=!1}),$=He(K=>{const ee=_.current.floatingContext?.nodeId;return(j?Qr(j.nodesRef.current,ee):[]).some(ne=>ne.context?.open&&!ne.context.dataRef.current[K])}),q=He(K=>Wg(K,g.select("floatingElement"))||Wg(K,g.select("domReferenceElement"))),G=He(K=>{d()&&g.setOpen(!1,rt(gl,K.nativeEvent))}),U=He(K=>{if(!h||!a||!o||K.key!=="Escape"||z.current||!w&&$("__escapeKeyBubbles"))return;const ee=_4(K)?K.nativeEvent:K,F=rt(op,ee);g.setOpen(!1,F),F.isCanceled||K.preventDefault(),!w&&!F.isPropagationAllowed&&K.stopPropagation()}),V=He(()=>{_.current.insideReactTree=!0,I.start(0,D)}),X=He(K=>{if(!h||!a||K.button!==0)return;const ee=qn(K.nativeEvent);Ze(g.select("floatingElement"),ee)&&(R.current||(R.current=!0,A.current=!1))}),Q=He(K=>{!h||!a||(K.defaultPrevented||K.nativeEvent.defaultPrevented)&&R.current&&(A.current=!0)});x.useEffect(()=>{if(!h||!a)return D;_.current.__escapeKeyBubbles=w,_.current.__outsidePressBubbles=S;const K=new ta,ee=new ta;function F(){K.clear(),z.current=!0}function ne(){K.start(lr?5:0,()=>{z.current=!1})}function Z(){T.current=!0,ee.start(0,()=>{T.current=!1})}function fe(){R.current=!1,A.current=!1}function Y(){const me=M.current,de=me==="pen"||!me?"mouse":me,Le=N(),ye=typeof Le=="function"?Le():Le;return typeof ye=="string"?ye:ye[de]}function oe(me){const de=Y();return de==="intentional"&&me.type!=="click"||de==="sloppy"&&me.type==="click"}function ve(me){const de=_.current.floatingContext?.nodeId,Le=j&&Qr(j.nodesRef.current,de).some(ye=>Wg(me,ye.context?.elements.floating));return q(me)||Le}function ie(me){if(oe(me)){me.type!=="click"&&!q(me)&&(ee.clear(),T.current=!1),D();return}if(_.current.insideReactTree){D();return}const de=qn(me),Le=`[${$c("inert")}]`,ye=bt(de)?de.getRootNode():null,Ce=Array.from((Zi(ye)?ye:vt(g.select("floatingElement"))).querySelectorAll(Le)),Qe=g.context.triggerElements;if(de&&(Qe.hasElement(de)||Qe.hasMatchingElement(it=>Ze(it,de))))return;let Ge=bt(de)?de:null;for(;Ge&&!Ja(Ge);){const it=ar(Ge);if(Ja(it)||!bt(it))break;Ge=it}if(!(Ce.length&&bt(de)&&!S4(de)&&!Ze(de,g.select("floatingElement"))&&Ce.every(it=>!Ze(Ge,it)))){if(Gt(de)&&!("touches"in me)){const it=Ja(de),Tt=Ns(de),_t=/auto|scroll/,Ct=it||_t.test(Tt.overflowX),je=it||_t.test(Tt.overflowY),ze=Ct&&de.clientWidth>0&&de.scrollWidth>de.clientWidth,Ye=je&&de.clientHeight>0&&de.scrollHeight>de.clientHeight,We=Tt.direction==="rtl",ft=Ye&&(We?me.offsetX<=de.offsetWidth-de.clientWidth:me.offsetX>de.clientWidth),Rt=ze&&me.offsetY>de.clientHeight;if(ft||Rt)return}if(!ve(me)){if(Y()==="intentional"&&T.current){ee.clear(),T.current=!1;return}typeof y=="function"&&!y(me)||$("__outsidePressBubbles")||(g.setOpen(!1,rt(rp,me)),D())}}}function xe(me){Y()!=="sloppy"||me.pointerType==="touch"||!g.select("open")||!a||q(me)||ie(me)}function ke(me){if(Y()!=="sloppy"||!g.select("open")||!a||q(me))return;const de=me.touches[0];de&&(P.current={startTime:Date.now(),startX:de.clientX,startY:de.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},L.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function Re(me,de){const Le=qn(me);if(!Le)return;const ye=xt(Le,me.type,()=>{de(me),ye()})}function Ae(me){M.current="touch",Re(me,ke)}function Ie(me){L.clear(),me.type==="pointerdown"&&(M.current=me.pointerType),!(me.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&Re(me,de=>{de.type==="pointerdown"?xe(de):ie(de)})}function Oe(me){if(!R.current)return;const de=A.current;if(fe(),Y()==="intentional"){if(me.type==="pointercancel"){de&&Z();return}if(!ve(me)){if(de){Z();return}typeof y=="function"&&!y(me)||(ee.clear(),T.current=!0,D())}}}function Te(me){if(Y()!=="sloppy"||!P.current||q(me))return;const de=me.touches[0];if(!de)return;const Le=Math.abs(de.clientX-P.current.startX),ye=Math.abs(de.clientY-P.current.startY),Ce=Math.sqrt(Le*Le+ye*ye);Ce>5&&(P.current.dismissOnTouchEnd=!0),Ce>10&&(ie(me),L.clear(),P.current=null)}function Ne(me){Re(me,Te)}function Me(me){Y()!=="sloppy"||!P.current||q(me)||(P.current.dismissOnTouchEnd&&ie(me),L.clear(),P.current=null)}function De(me){Re(me,Me)}const qe=vt(b),Xe=_a(o&&_a(xt(qe,"keydown",U),xt(qe,"compositionstart",F),xt(qe,"compositionend",ne)),k&&_a(xt(qe,"click",Ie,!0),xt(qe,"pointerdown",Ie,!0),xt(qe,"pointerup",Oe,!0),xt(qe,"pointercancel",Oe,!0),xt(qe,"mousedown",Ie,!0),xt(qe,"mouseup",Oe,!0),xt(qe,"touchstart",Ae,!0),xt(qe,"touchmove",Ne,!0),xt(qe,"touchend",De,!0)));return()=>{Xe(),K.clear(),ee.clear(),fe(),T.current=!1,D()}},[_,b,o,k,y,h,a,w,S,U,D,N,$,q,j,g,L]);const W=x.useMemo(()=>({onKeyDown:U,onPointerDown:G,onClick:G}),[U,G]),B=x.useMemo(()=>({onKeyDown:U,onPointerDown:Q,onMouseDown:Q,onClickCapture:V,onMouseDownCapture(K){V(),X(K)},onPointerDownCapture(K){V(),X(K)},onMouseUpCapture:V,onTouchEndCapture:V,onTouchMoveCapture:V}),[U,V,X,Q]);return x.useMemo(()=>a?{reference:W,floating:B,trigger:W}:{},[a,W,B])}function Fj(e,t,a){let{reference:o,floating:i}=e;const c=Hs(t),d=Vb(t),f=Hb(d),m=Vs(t),g=c==="y",h=o.x+o.width/2-i.width/2,b=o.y+o.height/2-i.height/2,_=o[f]/2-i[f]/2;let j;switch(m){case"top":j={x:h,y:o.y-i.height};break;case"bottom":j={x:h,y:o.y+o.height};break;case"right":j={x:o.x+o.width,y:b};break;case"left":j={x:o.x-i.width,y:b};break;default:j={x:o.x,y:o.y}}const E=Jr(t);return E&&(j[d]+=_*(E==="end"?1:-1)*(a&&g?-1:1)),j}async function Pz(e,t){var a;t===void 0&&(t={});const{x:o,y:i,platform:c,rects:d,elements:f,strategy:m}=e,{boundary:g="clippingAncestors",rootBoundary:h="viewport",elementContext:b="floating",altBoundary:_=!1,padding:j=0}=Xr(t,e),E=AS(j),k=f[_?b==="floating"?"reference":"floating":b],N=Bc(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(k)))==null||a?k:k.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:g,rootBoundary:h,strategy:m})),w=b==="floating"?{x:o,y:i,width:d.floating.width,height:d.floating.height}:d.reference,S=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),R=await(c.isElement==null?void 0:c.isElement(S))&&await(c.getScale==null?void 0:c.getScale(S))||{x:1,y:1},A=Bc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:w,offsetParent:S,strategy:m}):w);return{top:(N.top-A.top+E.top)/R.y,bottom:(A.bottom-N.bottom+E.bottom)/R.y,left:(N.left-A.left+E.left)/R.x,right:(A.right-N.right+E.right)/R.x}}const Lz=50,Iz=async(e,t,a)=>{const{placement:o="bottom",strategy:i="absolute",middleware:c=[],platform:d}=a,f=d.detectOverflow?d:{...d,detectOverflow:Pz},m=await(d.isRTL==null?void 0:d.isRTL(t));let g=await d.getElementRects({reference:e,floating:t,strategy:i}),{x:h,y:b}=Fj(g,o,m),_=o,j=0;const E={};for(let y=0;y<c.length;y++){const k=c[y];if(!k)continue;const{name:N,fn:w}=k,{x:S,y:R,data:A,reset:T}=await w({x:h,y:b,initialPlacement:o,placement:_,strategy:i,middlewareData:E,rects:g,platform:f,elements:{reference:e,floating:t}});h=S??h,b=R??b,E[N]={...E[N],...A},T&&j<Lz&&(j++,typeof T=="object"&&(T.placement&&(_=T.placement),T.rects&&(g=T.rects===!0?await d.getElementRects({reference:e,floating:t,strategy:i}):T.rects),{x:h,y:b}=Fj(g,_,m)),y=-1)}return{x:h,y:b,placement:_,strategy:i,middlewareData:E}},Bz=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var a,o;const{placement:i,middlewareData:c,rects:d,initialPlacement:f,platform:m,elements:g}=t,{mainAxis:h=!0,crossAxis:b=!0,fallbackPlacements:_,fallbackStrategy:j="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:y=!0,...k}=Xr(e,t);if((a=c.arrow)!=null&&a.alignmentOffset)return{};const N=Vs(i),w=Hs(f),S=Vs(f)===f,R=await(m.isRTL==null?void 0:m.isRTL(g.floating)),A=_||(S||!y?[xf(f)]:F4(f)),T=E!=="none";!_&&T&&A.push(...X4(f,y,E,R));const z=[f,...A],M=await m.detectOverflow(t,k),P=[];let L=((o=c.flip)==null?void 0:o.overflows)||[];if(h&&P.push(M[N]),b){const q=V4(i,d,R);P.push(M[q[0]],M[q[1]])}if(L=[...L,{placement:i,overflows:P}],!P.every(q=>q<=0)){var I,D;const q=(((I=c.flip)==null?void 0:I.index)||0)+1,G=z[q];if(G&&(!(b==="alignment"?w!==Hs(G):!1)||L.every(X=>Hs(X.placement)===w?X.overflows[0]>0:!0)))return{data:{index:q,overflows:L},reset:{placement:G}};let U=(D=L.filter(V=>V.overflows[0]<=0).sort((V,X)=>V.overflows[1]-X.overflows[1])[0])==null?void 0:D.placement;if(!U)switch(j){case"bestFit":{var $;const V=($=L.filter(X=>{if(T){const Q=Hs(X.placement);return Q===w||Q==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(Q=>Q>0).reduce((Q,W)=>Q+W,0)]).sort((X,Q)=>X[1]-Q[1])[0])==null?void 0:$[0];V&&(U=V);break}case"initialPlacement":U=f;break}if(i!==U)return{reset:{placement:U}}}return{}}}},aC=new Set(["left","top"]);async function $z(e,t){const{placement:a,platform:o,elements:i}=e,c=await(o.isRTL==null?void 0:o.isRTL(i.floating)),d=Vs(a),f=Jr(a),m=Hs(a)==="y",g=aC.has(d)?-1:1,h=c&&m?-1:1,b=Xr(t,e);let{mainAxis:_,crossAxis:j,alignmentAxis:E}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return f&&typeof E=="number"&&(j=f==="end"?E*-1:E),m?{x:j*h,y:_*g}:{x:_*g,y:j*h}}const Uz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,o;const{x:i,y:c,placement:d,middlewareData:f}=t,m=await $z(t,e);return d===((a=f.offset)==null?void 0:a.placement)&&(o=f.arrow)!=null&&o.alignmentOffset?{}:{x:i+m.x,y:c+m.y,data:{...m,placement:d}}}}},qz=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:a,y:o,placement:i,platform:c}=t,{mainAxis:d=!0,crossAxis:f=!1,limiter:m={fn:w=>{let{x:S,y:R}=w;return{x:S,y:R}}},...g}=Xr(e,t),h={x:a,y:o},b=await c.detectOverflow(t,g),_=Hs(i),j=qb(_);let E=h[j],y=h[_];const k=(w,S)=>TS(S+b[w==="y"?"top":"left"],S,S-b[w==="y"?"bottom":"right"]);d&&(E=k(j,E)),f&&(y=k(_,y));const N=m.fn({...t,[j]:E,[_]:y});return{...N,data:{x:N.x-a,y:N.y-o,enabled:{[j]:d,[_]:f}}}}}},Hz=function(e){return e===void 0&&(e={}),{options:e,fn(t){var a,o;const{x:i,y:c,placement:d,rects:f,middlewareData:m}=t,{offset:g=0,mainAxis:h=!0,crossAxis:b=!0}=Xr(e,t),_={x:i,y:c},j=Hs(d),E=qb(j);let y=_[E],k=_[j];const N=Xr(g,t),w=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:(a=N.mainAxis)!=null?a:0,crossAxis:(o=N.crossAxis)!=null?o:0};if(h){const A=E==="y"?"height":"width",T=f.reference[E]-f.floating[A]+w.mainAxis,z=f.reference[E]+f.reference[A]-w.mainAxis;y<T?y=T:y>z&&(y=z)}if(b){var S,R;const A=E==="y"?"width":"height",T=aC.has(Vs(d)),z=f.reference[j]-f.floating[A]+(T&&((S=m.offset)==null?void 0:S[j])||0)+(T?0:w.crossAxis),M=f.reference[j]+f.reference[A]+(T?0:((R=m.offset)==null?void 0:R[j])||0)-(T?w.crossAxis:0);k<z?k=z:k>M&&(k=M)}return{[E]:y,[j]:k}}}},Vz=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:a,rects:o,platform:i,elements:c}=t,{apply:d=()=>{},...f}=Xr(e,t),m=await i.detectOverflow(t,f),g=Vs(a),h=Jr(a),b=Hs(a)==="y",{width:_,height:j}=o.floating;let E,y;g==="top"||g==="bottom"?(E=g,y=h===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(y=g,E=h==="end"?"top":"bottom");const k=j-m.top-m.bottom,N=_-m.left-m.right,w=tl(j-m[E],k),S=tl(_-m[y],N),R=t.middlewareData.shift,A=!R;let T=w,z=S;R!=null&&R.enabled.x&&(z=N),R!=null&&R.enabled.y&&(T=k),A&&!h&&(b?z=_-2*er(m.left,m.right):T=j-2*er(m.top,m.bottom)),await d({...t,availableWidth:z,availableHeight:T});const M=await i.getDimensions(c.floating);return _!==M.width||j!==M.height?{reset:{rects:!0}}:{}}}};function rC(e){const t=Ns(e);let a=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=Gt(e),c=i?e.offsetWidth:a,d=i?e.offsetHeight:o,f=hf(a)!==c||hf(o)!==d;return f&&(a=c,o=d),{width:a,height:o,$:f}}function e_(e){return bt(e)?e:e.contextElement}function Yi(e){const t=e_(e);if(!Gt(t))return tr(1);const a=t.getBoundingClientRect(),{width:o,height:i,$:c}=rC(t);let d=(c?hf(a.width):a.width)/o,f=(c?hf(a.height):a.height)/i;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const Fz=tr(0);function oC(e){const t=Jt(e);return!Lb()||!t.visualViewport?Fz:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Gz(e,t,a){return t===void 0&&(t=!1),!!a&&t&&a===Jt(e)}function Po(e,t,a,o){t===void 0&&(t=!1),a===void 0&&(a=!1);const i=e.getBoundingClientRect(),c=e_(e);let d=tr(1);t&&(o?bt(o)&&(d=Yi(o)):d=Yi(e));const f=Gz(c,a,o)?oC(c):tr(0);let m=(i.left+f.x)/d.x,g=(i.top+f.y)/d.y,h=i.width/d.x,b=i.height/d.y;if(c&&o){const _=Jt(c),j=bt(o)?Jt(o):o;let E=_,y=gx(E);for(;y&&j!==E;){const k=Yi(y),N=y.getBoundingClientRect(),w=Ns(y),S=N.left+(y.clientLeft+parseFloat(w.paddingLeft))*k.x,R=N.top+(y.clientTop+parseFloat(w.paddingTop))*k.y;m*=k.x,g*=k.y,h*=k.x,b*=k.y,m+=S,g+=R,E=Jt(y),y=gx(E)}}return Bc({width:h,height:b,x:m,y:g})}function cp(e,t){const a=tp(e).scrollLeft;return t?t.left+a:Po(cr(e)).left+a}function iC(e,t){const a=e.getBoundingClientRect(),o=a.left+t.scrollLeft-cp(e,a),i=a.top+t.scrollTop;return{x:o,y:i}}function Yz(e){let{elements:t,rect:a,offsetParent:o,strategy:i}=e;const c=i==="fixed",d=cr(o),f=t?ep(t.floating):!1;if(o===d||f&&c)return a;let m={scrollLeft:0,scrollTop:0},g=tr(1);const h=tr(0),b=Gt(o);if((b||!c)&&((Vn(o)!=="body"||tu(d))&&(m=tp(o)),b)){const j=Po(o);g=Yi(o),h.x=j.x+o.clientLeft,h.y=j.y+o.clientTop}const _=d&&!b&&!c?iC(d,m):tr(0);return{width:a.width*g.x,height:a.height*g.y,x:a.x*g.x-m.scrollLeft*g.x+h.x+_.x,y:a.y*g.y-m.scrollTop*g.y+h.y+_.y}}function Kz(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Xz(e){const t=tp(e),a=e.ownerDocument.body,o=er(e.scrollWidth,e.clientWidth,a.scrollWidth,a.clientWidth),i=er(e.scrollHeight,e.clientHeight,a.scrollHeight,a.clientHeight);let c=-t.scrollLeft+cp(e);const d=-t.scrollTop;return Ns(a).direction==="rtl"&&(c+=er(e.clientWidth,a.clientWidth)-o),{width:o,height:i,x:c,y:d}}const Qz=25;function Wz(e,t,a){a===void 0&&(a="viewport");const o=a==="layoutViewport",i=Jt(e),c=cr(e),d=i.visualViewport;let f=c.clientWidth,m=c.clientHeight,g=0,h=0;if(d){const _=!Lb()||t==="fixed";o?_||(g=-d.offsetLeft,h=-d.offsetTop):(f=d.width,m=d.height,_&&(g=d.offsetLeft,h=d.offsetTop))}if(cp(c)<=0){const _=c.ownerDocument,j=_.body,E=getComputedStyle(j),y=_.compatMode==="CSS1Compat"&&parseFloat(E.marginLeft)+parseFloat(E.marginRight)||0,k=Math.abs(c.clientWidth-j.clientWidth-y),N=getComputedStyle(c).scrollbarGutter==="stable both-edges"?k/2:k;N<=Qz&&(f-=N)}return{width:f,height:m,x:g,y:h}}function Zz(e,t){const a=Po(e,!0,t==="fixed"),o=a.top+e.clientTop,i=a.left+e.clientLeft,c=Yi(e),d=e.clientWidth*c.x,f=e.clientHeight*c.y,m=i*c.x,g=o*c.y;return{width:d,height:f,x:m,y:g}}function Gj(e,t,a){let o;if(t==="viewport"||t==="layoutViewport")o=Wz(e,a,t);else if(t==="document")o=Xz(cr(e));else if(bt(t))o=Zz(t,a);else{const i=oC(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return Bc(o)}function Jz(e,t){const a=t.get(e);if(a)return a;let o=Ic(e,[],!1).filter(f=>bt(f)&&Vn(f)!=="body"),i=null;const c=Ns(e).position==="fixed";let d=c?ar(e):e;for(;bt(d)&&!Ja(d);){const f=Ns(d),m=Pb(d),g=i?i.position:c?"fixed":"";!m&&(g==="fixed"||g==="absolute"&&f.position==="static")?o=o.filter(b=>b!==d):i=f,d=ar(d)}return t.set(e,o),o}function eO(e){let{element:t,boundary:a,rootBoundary:o,strategy:i}=e;const d=[...a==="clippingAncestors"?ep(t)?[]:Jz(t,this._c):[].concat(a),o],f=Gj(t,d[0],i);let m=f.top,g=f.right,h=f.bottom,b=f.left;for(let _=1;_<d.length;_++){const j=Gj(t,d[_],i);m=er(j.top,m),g=tl(j.right,g),h=tl(j.bottom,h),b=er(j.left,b)}return{width:g-b,height:h-m,x:b,y:m}}function tO(e){const{width:t,height:a}=rC(e);return{width:t,height:a}}function nO(e,t,a){const o=Gt(t),i=cr(t),c=a==="fixed",d=Po(e,!0,c,t);let f={scrollLeft:0,scrollTop:0};const m=tr(0);if((o||!c)&&((Vn(t)!=="body"||tu(i))&&(f=tp(t)),o)){const _=Po(t,!0,c,t);m.x=_.x+t.clientLeft,m.y=_.y+t.clientTop}!o&&i&&(m.x=cp(i));const g=i&&!o&&!c?iC(i,f):tr(0),h=d.left+f.scrollLeft-m.x-g.x,b=d.top+f.scrollTop-m.y-g.y;return{x:h,y:b,width:d.width,height:d.height}}function nh(e){return Ns(e).position==="static"}function Yj(e,t){if(!Gt(e)||Ns(e).position==="fixed")return null;if(t)return t(e);let a=e.offsetParent;return cr(e)===a&&(a=a.ownerDocument.body),a}function lC(e,t){const a=Jt(e);if(ep(e))return a;if(!Gt(e)){let i=ar(e);for(;i&&!Ja(i);){if(bt(i)&&!nh(i))return i;i=ar(i)}return a}let o=Yj(e,t);for(;o&&y4(o)&&nh(o);)o=Yj(o,t);return o&&Ja(o)&&nh(o)&&!Pb(o)?a:o||w4(e)||a}const sO=async function(e){const t=this.getOffsetParent||lC,a=this.getDimensions,o=await a(e.floating);return{reference:nO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function aO(e){return Ns(e).direction==="rtl"}const cC={convertOffsetParentRelativeRectToViewportRelativeRect:Yz,getDocumentElement:cr,getClippingRect:eO,getOffsetParent:lC,getElementRects:sO,getClientRects:Kz,getDimensions:tO,getScale:Yi,isElement:bt,isRTL:aO};function uC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rO(e,t,a){let o=null,i;const c=cr(e);function d(){var h;clearTimeout(i),(h=o)==null||h.disconnect(),o=null}function f(h,b){h===void 0&&(h=!1),b===void 0&&(b=1),d();const _=e.getBoundingClientRect(),{left:j,top:E,width:y,height:k}=_;if(h||t(),!y||!k)return;const N=Ed(E),w=Ed(c.clientWidth-(j+y)),S=Ed(c.clientHeight-(E+k)),R=Ed(j),T={rootMargin:-N+"px "+-w+"px "+-S+"px "+-R+"px",threshold:er(0,tl(1,b))||1};let z=!0;function M(P){const L=P[0].intersectionRatio;if(!uC(_,e.getBoundingClientRect()))return f();if(L!==b){if(!z)return f();L?f(!1,L):i=setTimeout(()=>{f(!1,1e-7)},1e3)}z=!1}try{o=new IntersectionObserver(M,{...T,root:c.ownerDocument})}catch{o=new IntersectionObserver(M,T)}o.observe(e)}const m=Jt(e),g=()=>f(a);return m.addEventListener("resize",g),f(!0),()=>{m.removeEventListener("resize",g),d()}}function Kj(e,t,a,o){o===void 0&&(o={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,g=e_(e),h=i||c?[...g?Ic(g):[],...t?Ic(t):[]]:[];h.forEach(N=>{i&&N.addEventListener("scroll",a),c&&N.addEventListener("resize",a)});const b=g&&f?rO(g,a,c):null;let _=-1,j=null;d&&(j=new ResizeObserver(N=>{let[w]=N;w&&w.target===g&&j&&t&&(j.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var S;(S=j)==null||S.observe(t)})),a()}),g&&!m&&j.observe(g),t&&j.observe(t));let E,y=m?Po(e):null;m&&k();function k(){const N=Po(e);y&&!uC(y,N)&&a(),y=N,E=requestAnimationFrame(k)}return a(),()=>{var N;h.forEach(w=>{i&&w.removeEventListener("scroll",a),c&&w.removeEventListener("resize",a)}),b?.(),(N=j)==null||N.disconnect(),j=null,m&&cancelAnimationFrame(E)}}const oO=Uz,iO=qz,lO=Bz,cO=Vz,uO=Hz,dO=(e,t,a)=>{const o=new Map,i=a??{},c={...cC,...i.platform,_c:o};return Iz(e,t,{...i,platform:c})};var fO=typeof document<"u",pO=function(){},sf=fO?x.useLayoutEffect:pO;function yf(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 a,o,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(o=a;o--!==0;)if(!yf(e[o],t[o]))return!1;return!0}if(i=Object.keys(e),a=i.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!{}.hasOwnProperty.call(t,i[o]))return!1;for(o=a;o--!==0;){const c=i[o];if(!(c==="_owner"&&e.$$typeof)&&!yf(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function dC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Xj(e,t){const a=dC(e);return Math.round(t*a)/a}function sh(e){const t=x.useRef(e);return sf(()=>{t.current=e}),t}function mO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:a="absolute",middleware:o=[],platform:i,elements:{reference:c,floating:d}={},transform:f=!0,whileElementsMounted:m,open:g}=e,[h,b]=x.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[_,j]=x.useState(o);yf(_,o)||j(o);const[E,y]=x.useState(null),[k,N]=x.useState(null),w=x.useCallback(X=>{X!==T.current&&(T.current=X,y(X))},[]),S=x.useCallback(X=>{X!==z.current&&(z.current=X,N(X))},[]),R=c||E,A=d||k,T=x.useRef(null),z=x.useRef(null),M=x.useRef(h),P=m!=null,L=sh(m),I=sh(i),D=sh(g),$=x.useCallback(()=>{if(!T.current||!z.current)return;const X={placement:t,strategy:a,middleware:_};I.current&&(X.platform=I.current),dO(T.current,z.current,X).then(Q=>{const W={...Q,isPositioned:D.current!==!1};q.current&&!yf(M.current,W)&&(M.current=W,Gs.flushSync(()=>{b(W)}))})},[_,t,a,I,D]);sf(()=>{g===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,b(X=>({...X,isPositioned:!1})))},[g]);const q=x.useRef(!1);sf(()=>(q.current=!0,()=>{q.current=!1}),[]),sf(()=>{if(R&&(T.current=R),A&&(z.current=A),R&&A){if(L.current)return L.current(R,A,$);$()}},[R,A,$,L,P]);const G=x.useMemo(()=>({reference:T,floating:z,setReference:w,setFloating:S}),[w,S]),U=x.useMemo(()=>({reference:R,floating:A}),[R,A]),V=x.useMemo(()=>{const X={position:a,left:0,top:0};if(!U.floating)return X;const Q=Xj(U.floating,h.x),W=Xj(U.floating,h.y);return f?{...X,transform:"translate("+Q+"px, "+W+"px)",...dC(U.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:Q,top:W}},[a,f,U.floating,h.x,h.y]);return x.useMemo(()=>({...h,update:$,refs:G,elements:U,floatingStyles:V}),[h,$,G,U,V])}const gO=(e,t)=>{const a=oO(e);return{name:a.name,fn:a.fn,options:[e,t]}},hO=(e,t)=>{const a=iO(e);return{name:a.name,fn:a.fn,options:[e,t]}},xO=(e,t)=>({fn:uO(e).fn,options:[e,t]}),bO=(e,t)=>{const a=lO(e);return{name:a.name,fn:a.fn,options:[e,t]}},_O=(e,t)=>{const a=cO(e);return{name:a.name,fn:a.fn,options:[e,t]}};var ah={exports:{}},rh={};/**
746
- * @license React
747
- * use-sync-external-store-shim.production.js
748
- *
749
- * Copyright (c) Meta Platforms, Inc. and affiliates.
750
- *
751
- * This source code is licensed under the MIT license found in the
752
- * LICENSE file in the root directory of this source tree.
753
- */var Qj;function vO(){if(Qj)return rh;Qj=1;var e=Yc();function t(b,_){return b===_&&(b!==0||1/b===1/_)||b!==b&&_!==_}var a=typeof Object.is=="function"?Object.is:t,o=e.useState,i=e.useEffect,c=e.useLayoutEffect,d=e.useDebugValue;function f(b,_){var j=_(),E=o({inst:{value:j,getSnapshot:_}}),y=E[0].inst,k=E[1];return c(function(){y.value=j,y.getSnapshot=_,m(y)&&k({inst:y})},[b,j,_]),i(function(){return m(y)&&k({inst:y}),b(function(){m(y)&&k({inst:y})})},[b]),d(j),j}function m(b){var _=b.getSnapshot;b=b.value;try{var j=_();return!a(b,j)}catch{return!0}}function g(b,_){return _()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:f;return rh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,rh}var Wj;function fC(){return Wj||(Wj=1,ah.exports=vO()),ah.exports}var Uc=fC(),oh={exports:{}},ih={};/**
754
- * @license React
755
- * use-sync-external-store-shim/with-selector.production.js
756
- *
757
- * Copyright (c) Meta Platforms, Inc. and affiliates.
758
- *
759
- * This source code is licensed under the MIT license found in the
760
- * LICENSE file in the root directory of this source tree.
761
- */var Zj;function yO(){if(Zj)return ih;Zj=1;var e=Yc(),t=fC();function a(g,h){return g===h&&(g!==0||1/g===1/h)||g!==g&&h!==h}var o=typeof Object.is=="function"?Object.is:a,i=t.useSyncExternalStore,c=e.useRef,d=e.useEffect,f=e.useMemo,m=e.useDebugValue;return ih.useSyncExternalStoreWithSelector=function(g,h,b,_,j){var E=c(null);if(E.current===null){var y={hasValue:!1,value:null};E.current=y}else y=E.current;E=f(function(){function N(T){if(!w){if(w=!0,S=T,T=_(T),j!==void 0&&y.hasValue){var z=y.value;if(j(z,T))return R=z}return R=T}if(z=R,o(S,T))return z;var M=_(T);return j!==void 0&&j(z,M)?(S=T,z):(S=T,R=M)}var w=!1,S,R,A=b===void 0?null:b;return[function(){return N(h())},A===null?void 0:function(){return N(A())}]},[h,b,_,j]);var k=i(g,E[0],E[1]);return d(function(){y.hasValue=!0,y.value=k},[k]),m(k),k},ih}var Jj;function jO(){return Jj||(Jj=1,oh.exports=yO()),oh.exports}var kO=jO();const wO=Yb(19),SO=wO?NO:EO;function nt(e,t,a,o,i){return SO(e,t,a,o,i)}function CO(e,t,a,o,i){const c=x.useCallback(()=>t(e.getSnapshot(),a,o,i),[e,t,a,o,i]);return Uc.useSyncExternalStore(e.subscribe,c,c)}c4({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let a=0;a<e.syncHooks.length;a+=1){const o=e.syncHooks[a],i=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,i)||(t=!0,o.value=i)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const a=new Set;for(const i of e.syncHooks)a.add(i.store);const o=[];for(const i of a)o.push(i.subscribe(t));return()=>{for(const i of o)i()}}),Uc.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function NO(e,t,a,o,i){const c=l4();if(!c)return CO(e,t,a,o,i);const d=c.syncIndex;c.syncIndex+=1;let f;return c.didInitialize?(f=c.syncHooks[d],(f.store!==e||f.selector!==t||!Object.is(f.a1,a)||!Object.is(f.a2,o)||!Object.is(f.a3,i))&&(f.store!==e&&(c.didChangeStore=!0),f.store=e,f.selector=t,f.a1=a,f.a2=o,f.a3=i,f.value=t(e.getSnapshot(),a,o,i))):(f={store:e,selector:t,a1:a,a2:o,a3:i,value:t(e.getSnapshot(),a,o,i)},c.syncHooks.push(f)),f.value}function EO(e,t,a,o,i){return kO.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,a,o,i))}class RO{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 a=this.updateTick;for(const o of this.listeners){if(a!==this.updateTick)return;o(t)}}update(t){for(const a in t)if(!Object.is(this.state[a],t[a])){this.setState({...this.state,...t});return}}set(t,a){Object.is(this.state[t],a)||this.setState({...this.state,[t]:a})}notifyAll(){const t={...this.state};this.setState(t)}use(t,a,o,i){return nt(this,t,a,o,i)}}class su extends RO{constructor(t,a={},o){super(t),this.context=a,this.selectors=o}useSyncedValue(t,a){x.useDebugValue(t);const o=this;Pe(()=>{o.state[t]!==a&&o.set(t,a)},[o,t,a])}useSyncedValueWithCleanup(t,a){const o=this;Pe(()=>(o.state[t]!==a&&o.set(t,a),()=>{o.set(t,void 0)}),[o,t,a])}useSyncedValues(t){const a=this,o=Object.values(t);Pe(()=>{a.update(t)},[a,...o])}useControlledProp(t,a){x.useDebugValue(t);const o=this,i=a!==void 0;Pe(()=>{i&&!Object.is(o.state[t],a)&&o.setState({...o.state,[t]:a})},[o,t,a,i])}select(t,a,o,i){const c=this.selectors[t];return c(this.state,a,o,i)}useState(t,a,o,i){return x.useDebugValue(t),nt(this,this.selectors[t],a,o,i)}useContextCallback(t,a){x.useDebugValue(t);const o=He(a??Nn);this.context[t]=o}useStateSetter(t){const a=x.useRef(void 0);return a.current===void 0&&(a.current=o=>{this.set(t,o)}),a.current}observe(t,a){let o;typeof t=="function"?o=t:o=this.selectors[t];let i=o(this.state);return a(i,i,this),this.subscribe(c=>{const d=o(c);if(!Object.is(i,d)){const f=i;i=d,a(d,f,this)}})}}const TO={open:e=>e.open,transitionStatus:e=>e.transitionStatus,domReferenceElement:e=>e.domReferenceElement,referenceElement:e=>e.positionReference??e.referenceElement,floatingElement:e=>e.floatingElement,floatingId:e=>e.floatingId};class up extends su{constructor(t){const{syncOnly:a,nested:o,onOpenChange:i,triggerElements:c,...d}=t;super({...d,positionReference:d.referenceElement,domReferenceElement:d.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:JS(),nested:o,triggerElements:c},TO),this.syncOnly=a}syncOpenEvent=(t,a)=>{(!t||!this.state.open||a!=null&&v4(a))&&(this.context.dataRef.current.openEvent=t?a:void 0)};dispatchOpenChange=(t,a)=>{this.syncOpenEvent(t,a.event);const o={open:t,reason:a.reason,nativeEvent:a.event,nested:this.context.nested,triggerElement:a.trigger};this.context.events.emit("openchange",o)};setOpen=(t,a)=>{if(this.syncOnly){this.context.onOpenChange?.(t,a);return}this.dispatchOpenChange(t,a),this.context.onOpenChange?.(t,a)}}function pC(e){const{popupStore:t,treatPopupAsFloatingElement:a=!1,floatingRootContext:o,floatingId:i,nested:c,onOpenChange:d}=e,f=t.useState("open"),m=t.useState("activeTriggerElement"),g=t.useState(a?"popupElement":"positionerElement"),h=t.context.triggerElements,b=d,_=x.useRef(null);o===void 0&&_.current===null&&(_.current=new up({open:f,transitionStatus:void 0,referenceElement:m,floatingElement:g,triggerElements:h,onOpenChange:b,floatingId:i,syncOnly:!0,nested:c}));const j=o??_.current;return t.useSyncedValue("floatingId",i),Pe(()=>{const E={open:f,floatingId:i,referenceElement:m,floatingElement:g};bt(m)&&(E.domReferenceElement=m),j.state.positionReference===j.state.referenceElement&&(E.positionReference=m),j.update(E)},[f,i,m,g,j]),j.context.onOpenChange=b,j.context.nested=c,j}function hl(e,t=!1,a=!1){const[o,i]=x.useState(e&&t?"idle":void 0),[c,d]=x.useState(e);return e&&!c&&(d(!0),i("starting")),!e&&c&&o!=="ending"&&!a&&i("ending"),!e&&!c&&o==="ending"&&i(void 0),Pe(()=>{if(!e&&c&&o!=="ending"&&a){const f=ga.request(()=>{i("ending")});return()=>{ga.cancel(f)}}},[e,c,o,a]),Pe(()=>{if(!e||t)return;const f=ga.request(()=>{i(void 0)});return()=>{ga.cancel(f)}},[t,e]),Pe(()=>{if(!e||!t)return;e&&c&&o!=="idle"&&i("starting");const f=ga.request(()=>{i("idle")});return()=>{ga.cancel(f)}},[t,e,c,o]),{mounted:c,setMounted:d,transitionStatus:o}}function mC(e,t=!1){const a=Ji();return He((o,i=null)=>{a.cancel();const c=Xa(e);if(c==null)return;const d=c,f=()=>{Gs.flushSync(o)};if(typeof d.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){o();return}function m(){Promise.all(d.getAnimations().map(g=>g.finished)).then(()=>{i?.aborted||f()},()=>{if(i?.aborted)return;if(d.getAnimations().some(h=>h.pending||h.playState!=="finished")){m();return}f()})}if(t){const g="data-starting-style";if(!d.hasAttribute(g)){a.request(m);return}const h=new MutationObserver(()=>{d.hasAttribute(g)||(h.disconnect(),m())});h.observe(d,{attributes:!0,attributeFilter:[g]}),i?.addEventListener("abort",()=>h.disconnect(),{once:!0});return}a.request(m)})}function Ca(e){const{enabled:t=!0,open:a,ref:o,onComplete:i}=e,c=He(i),d=mC(o,a);x.useEffect(()=>{if(!t)return;const f=new AbortController;return d(c,f.signal),()=>{f.abort()}},[t,a,c,d])}const dp={tabIndex:-1,[hx]:""};function AO(e){return t=>t==="touch"?e.current:!0}function gC(e,t=!1){const a=Do(),o=eo()!=null,i=Hn(()=>e(a,o)).current;return pC({popupStore:i,treatPopupAsFloatingElement:t,floatingRootContext:i.state.floatingRootContext,floatingId:a,nested:o,onOpenChange:i.setOpen}),i}function t_({handle:e,store:t}){return Pe(()=>e.attachStore(t),[e,t]),null}function MO(e,t){const a=x.useRef(null),o=x.useRef(null);return x.useCallback(i=>{if(e===void 0)return;let c=!1;if(a.current!==null){const d=a.current,f=o.current,m=t.context.triggerElements.getById(d);f&&m===f&&(t.context.triggerElements.delete(d),c=!0),a.current=null,o.current=null}if(i!==null&&(a.current=e,o.current=i,t.context.triggerElements.add(e,i),c=!0),c){const d=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==d&&t.set("triggerCount",d)}},[t,e])}function n_(e,t,a,o=!1){t?e.preventUnmountingOnClose=!1:o&&(e.preventUnmountingOnClose=!0);const i=a?.id??null;(i||t)&&(e.activeTriggerId=i,e.activeTriggerElement=a??null)}function hC(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function zO(e,t,a,o={}){const i=a.reason,c=i===En,d=t&&i===Vi,f=!t&&(i===gl||i===op),m=hC(a);if(e.context.onOpenChange?.(t,a),a.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,a);const g=()=>{const h={...o.extraState,open:t};d?h.instantType="focus":f?h.instantType="dismiss":c&&(h.instantType=void 0),n_(h,t,a.trigger,m()),e.update(h)};c?Gs.flushSync(g):g()}function xC(e,t,a,o){const i=a.useState("isMountedByTrigger",e),c=MO(e,a),d=He(m=>{const g=a.select("open"),h=a.select("activeTriggerId");if(h===e){a.update({activeTriggerElement:m,...g?o:null});return}h==null&&g&&a.update({activeTriggerId:e,activeTriggerElement:m,...o})}),f=x.useCallback(m=>{c(m),m&&d(m)},[c,d]);return Pe(()=>{i&&a.update({activeTriggerElement:t.current,...o})},[i,a,t,...Object.values(o)]),{registerTrigger:f,isMountedByThisTrigger:i}}function s_(e,t={}){const{closeOnActiveTriggerUnmount:a=!1}=t,o=x.useRef(null),i=e.useState("open"),c=e.useState("triggerCount"),d=e.useState("activeTriggerId"),f=e.useState("activeTriggerElement");Pe(()=>{if(!i){o.current=null,e.state.triggerCount!==0&&e.set("triggerCount",0);return}const m=e.context.triggerElements.size,g={};e.state.triggerCount!==m&&(g.triggerCount=m);const h=e.select("activeTriggerId");let b=null;if(h){const _=e.context.triggerElements.getById(h);if(_)o.current=h,_!==e.state.activeTriggerElement&&(g.activeTriggerElement=_);else{for(const[j,E]of e.context.triggerElements.entries())if(E===e.state.activeTriggerElement){g.activeTriggerId=j,g.activeTriggerElement=E,o.current=j;break}g.activeTriggerId===void 0&&(o.current===h?b=h:o.current=null)}}else o.current=null;if(!b&&!h&&m===1){const _=e.context.triggerElements.entries().next();if(!_.done){const[j,E]=_.value;g.activeTriggerId=j,g.activeTriggerElement=E,o.current=j}}(g.triggerCount!==void 0||g.activeTriggerId!==void 0||g.activeTriggerElement!==void 0)&&e.update(g),b&&a&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===b&&!e.context.triggerElements.getById(b)){const _=rt(ka);e.setOpen(!1,_),_.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[i,e,c,d,f,a])}function a_(e,t,a){const{mounted:o,setMounted:i,transitionStatus:c}=hl(e),d=t.useState("preventUnmountingOnClose"),f=e?!1:d;t.useSyncedValues({mounted:o,transitionStatus:c,preventUnmountingOnClose:f});const m=He(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),a?.(),t.context.onOpenChangeComplete?.(!1)});return Ca({enabled:o&&!e&&!f,open:e,ref:t.context.popupRef,onComplete(){e||m()}}),{forceUnmount:m,transitionStatus:c}}function r_(e,t){e.useSyncedValues(t),Pe(()=>()=>{e.update({activeTriggerProps:sn,inactiveTriggerProps:sn,popupProps:sn})},[e])}function OO(e,t){Pe(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),Pe(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class au{constructor(){this.idMap=new Map}add(t,a){this.idMap.set(t,a)}delete(t){this.idMap.delete(t)}hasElement(t){for(const a of this.idMap.values())if(a===t)return!0;return!1}hasMatchingElement(t){for(const a of this.idMap.values())if(t(a))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.idMap.values()}get size(){return this.idMap.size}}function DO(){return new up({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new au,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function o_(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:DO(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:sn,inactiveTriggerProps:sn,popupProps:sn}}function bC(e,t,a=!1){return new up({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:a,onOpenChange:void 0})}const Tc=e=>e.triggerIdProp??e.activeTriggerId,i_=e=>e.openProp??e.open,ek=e=>(e.popupElement?.id??e.floatingId)||void 0;function _C(e,t){return t!==void 0&&i_(e)&&Tc(e)===t}function PO(e,t){return _C(e,t)?!0:t!==void 0&&i_(e)&&Tc(e)==null&&e.triggerCount===1}const l_={open:i_,mounted:e=>e.mounted,transitionStatus:e=>e.transitionStatus,floatingRootContext:e=>e.floatingRootContext,triggerCount:e=>e.triggerCount,preventUnmountingOnClose:e=>e.preventUnmountingOnClose,payload:e=>e.payload,activeTriggerId:Tc,activeTriggerElement:e=>e.mounted?e.activeTriggerElement:null,popupId:ek,isTriggerActive:(e,t)=>t!==void 0&&Tc(e)===t,isOpenedByTrigger:(e,t)=>_C(e,t),isMountedByTrigger:(e,t)=>t!==void 0&&Tc(e)===t&&e.mounted,triggerProps:(e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps,triggerPopupId:(e,t)=>PO(e,t)?ek(e):void 0,popupProps:e=>e.popupProps,popupElement:e=>e.popupElement,positionerElement:e=>e.positionerElement};function vC(e){const t=x.useCallback(o=>e===void 0?Nn:e.subscribeStore(o),[e]),a=x.useCallback(()=>e===void 0?void 0:e.store,[e]);return Uc.useSyncExternalStore(t,a,()=>e?.serverStore)}function LO(e){const{open:t=!1,onOpenChange:a,elements:o={}}=e,i=Do(),c=eo()!=null,d=Hn(()=>new up({open:t,transitionStatus:void 0,onOpenChange:a,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new au,floatingId:i,syncOnly:!1,nested:c})).current;return Pe(()=>{const f={open:t,floatingId:i};o.reference!==void 0&&(f.referenceElement=o.reference,f.domReferenceElement=bt(o.reference)?o.reference:null),o.floating!==void 0&&(f.floatingElement=o.floating),d.update(f)},[t,i,o.reference,o.floating,d]),d.context.onOpenChange=a,d.context.nested=c,d}function IO(e){return BO(e,e.rootContext)}function BO(e,t){const{nodeId:a,externalTree:o}=e,i=t.useState("referenceElement"),c=t.useState("floatingElement"),d=t.useState("domReferenceElement"),f=t.useState("open"),m=t.useState("floatingId"),[g,h]=x.useState(null),[b,_]=x.useState(void 0),[j,E]=x.useState(void 0),y=x.useRef(null),k=to(o),N=x.useMemo(()=>({reference:i,floating:c,domReference:d}),[i,c,d]),w=mO({...e,elements:{...N,...g&&{reference:g}}}),S=bt(b)?b:null,R=j===void 0?t.state.floatingElement:j;t.useSyncedValue("referenceElement",b??null),t.useSyncedValue("domReferenceElement",b===void 0?d:S),t.useSyncedValue("floatingElement",R);const A=x.useCallback(I=>{const D=bt(I)?{getBoundingClientRect:()=>I.getBoundingClientRect(),getClientRects:()=>I.getClientRects(),contextElement:I}:I;h(D),w.refs.setReference(D)},[w.refs]),T=x.useCallback(I=>{(bt(I)||I===null)&&(y.current=I,_(I)),(bt(w.refs.reference.current)||w.refs.reference.current===null||I!==null&&!bt(I))&&w.refs.setReference(I)},[w.refs,_]),z=x.useCallback(I=>{E(I),w.refs.setFloating(I)},[w.refs]),M=x.useMemo(()=>({...w.refs,setReference:T,setFloating:z,setPositionReference:A,domReference:y}),[w.refs,T,z,A]),P=x.useMemo(()=>({...w.elements,domReference:d}),[w.elements,d]),L=x.useMemo(()=>({...w,dataRef:t.context.dataRef,open:f,onOpenChange:t.setOpen,events:t.context.events,floatingId:m,refs:M,elements:P,nodeId:a,rootStore:t}),[w,M,P,a,t,f,m]);return Pe(()=>{d&&(y.current=d)},[d]),Pe(()=>{t.context.dataRef.current.floatingContext=L;const I=k?.nodesRef.current.find(D=>D.id===a);I&&(I.context=L)}),x.useMemo(()=>({...w,context:L,refs:M,elements:P,rootStore:t}),[w,M,P,L,t])}const lh=Ab&&lr;function yC(e,t={}){const{enabled:a=!0,delay:o}=t,i="rootStore"in e?e.rootStore:e,{events:c,dataRef:d}=i.context,f=x.useRef(!1),m=x.useRef(null),g=x.useRef(!0),h=Rn();x.useEffect(()=>{const _=i.select("domReferenceElement");if(!a)return;const j=Jt(_);function E(){const N=i.select("domReferenceElement");!i.select("open")&&Gt(N)&&N===Kn(vt(N))&&(f.current=!0)}function y(){g.current=!0}function k(){g.current=!1}return _a(xt(j,"blur",E),lh&&xt(j,"keydown",y,!0),lh&&xt(j,"pointerdown",k,!0))},[i,a]),x.useEffect(()=>{if(!a)return;function _(j){if(j.reason===gl||j.reason===op){const E=i.select("domReferenceElement");bt(E)&&(m.current=E,f.current=!0)}}return c.on("openchange",_),()=>{c.off("openchange",_)}},[c,a,i]);const b=x.useMemo(()=>{function _(){f.current=!1,m.current=null}return{onMouseLeave(){_()},onFocus(j){const E=j.currentTarget;if(f.current){if(m.current===E)return;_()}const y=qn(j.nativeEvent);if(bt(y)){if(lh&&!j.relatedTarget){if(!g.current&&!ap(y))return}else if(!N4(y))return}const k=mf(j.relatedTarget,i.context.triggerElements),{nativeEvent:N,currentTarget:w}=j,S=typeof o=="function"?o():o;if(i.select("open")&&k||S===0||S===void 0){i.setOpen(!0,rt(Vi,N,w));return}h.start(S,()=>{f.current||i.setOpen(!0,rt(Vi,N,w))})},onBlur(j){_();const E=j.relatedTarget,y=j.nativeEvent,k=bt(E)&&E.hasAttribute($c("focus-guard"))&&E.getAttribute("data-type")==="outside";h.start(0,()=>{const N=i.select("domReferenceElement"),w=Kn(vt(N));!E&&w===N||Ze(d.current.floatingContext?.refs.floating.current,w)||Ze(N,w)||k||mf(E??w,i.context.triggerElements)||i.setOpen(!1,rt(Vi,y))})}}},[d,o,i,h]);return x.useMemo(()=>a?{reference:b,trigger:b}:{},[a,b])}class c_{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 ta,this.restTimeout=new ta,this.handleCloseOptions=void 0}static create(){return new c_}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const jf=new WeakMap;function kf(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&jf.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),jf.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function jC(e,t){const{scopeElement:a,referenceElement:o,floatingElement:i}=t,c=jf.get(a);c&&c!==e&&kf(c),kf(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=a,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=i,jf.set(a,e),a.style.pointerEvents="none",o.style.pointerEvents="auto",i.style.pointerEvents="auto"}function u_(e){const t=e.context.dataRef.current,a=Hn(()=>t.hoverInteractionState??c_.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=a),Tb(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function kC(e,t={}){const{enabled:a=!0,closeDelay:o=0,nodeId:i}=t,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),f=c.useState("floatingElement"),m=c.useState("domReferenceElement"),{dataRef:g}=c.context,h=to(),b=eo(),_=u_(c),j=Rn(),E=He(()=>jS(g.current.openEvent?.type,_.interactedInside)),y=He(()=>R4(g.current.openEvent?.type)),k=He(()=>{kf(_)});Pe(()=>{d||(_.pointerType=void 0,_.restTimeoutPending=!1,_.interactedInside=!1,k())},[d,_,k]),x.useEffect(()=>k,[k]),Pe(()=>{if(a&&d&&_.handleCloseOptions?.blockPointerEvents&&y()&&bt(m)&&f){const N=m,w=f,S=vt(f),R=h?.nodesRef.current.find(M=>M.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const A=_.pointerEventsScopeElement!==w?_.pointerEventsScopeElement:null,T=R!==w?R:null,z=_.handleCloseOptions?.getScope?.()??A??T??N.closest("[data-rootownerid]")??S.body;return jC(_,{scopeElement:z,referenceElement:N,floatingElement:w}),()=>{k()}}},[a,d,m,f,_,y,h,b,k]),x.useEffect(()=>{if(!a)return;function N(){return!!(h&&b&&Qr(h.nodesRef.current,b).length>0)}function w(M){const P=Kr(o,"close",_.pointerType),L=()=>{c.setOpen(!1,rt(En,M)),h?.events.emit("floating.closed",M)};P?_.openChangeTimeout.start(P,L):(_.openChangeTimeout.clear(),L())}function S(M){const P=qn(M);if(!C4(P)){_.interactedInside=!1;return}_.interactedInside=P?.closest("[aria-haspopup]")!=null}function R(){_.openChangeTimeout.clear(),j.clear(),h?.events.off("floating.closed",T),k()}function A(M){if(N()&&h){h.events.on("floating.closed",T);return}if(mf(M.relatedTarget,c.context.triggerElements))return;const P=g.current.floatingContext?.nodeId??i,L=M.relatedTarget;if(!(h&&P&&bt(L)&&Qr(h.nodesRef.current,P,!1).some(D=>Ze(D.context?.elements.floating,L)))){if(_.handler){_.handler(M);return}k(),y()&&!E()&&w(M)}}function T(M){!h||!b||N()||j.start(0,()=>{h.events.off("floating.closed",T),c.setOpen(!1,rt(En,M)),h.events.emit("floating.closed",M)})}const z=f;return _a(z&&xt(z,"mouseenter",R),z&&xt(z,"mouseleave",A),z&&xt(z,"pointerdown",S,!0),()=>{h?.events.off("floating.closed",T)})},[a,f,c,g,o,i,y,E,k,_,h,b,j])}const $O={current:null};function wC(e,t={}){const{enabled:a=!0,delay:o=0,handleClose:i=null,mouseOnly:c=!1,restMs:d=0,move:f=!0,triggerElementRef:m=$O,externalTree:g,isActiveTrigger:h=!0,getHandleCloseContext:b,isClosing:_,shouldOpen:j,guardStaleOpen:E=!1}=t,y="rootStore"in e?e.rootStore:e,{dataRef:k,events:N}=y.context,w=to(g),S=u_(y),R=x.useRef(!1),A=mn(i),T=mn(o),z=mn(d),M=mn(a),P=mn(j),L=mn(_),I=He(()=>jS(k.current.openEvent?.type,S.interactedInside)),D=He(()=>P.current?.()!==!1),$=He((U,V,X)=>{const Q=y.context.triggerElements;if(Q.hasElement(V))return!U||!Ze(U,V);if(!bt(X))return!1;const W=X;return Q.hasMatchingElement(B=>Ze(B,W))&&(!U||!Ze(U,W))}),q=He(()=>{if(!S.handler)return;vt(y.select("domReferenceElement")).removeEventListener("mousemove",S.handler),S.handler=void 0}),G=He(()=>{kf(S)});return h&&(S.handleCloseOptions=A.current?.__options),x.useEffect(()=>q,[q]),x.useEffect(()=>{if(!a)return;function U(V){V.open?R.current=!1:(R.current=V.reason===En,q(),S.openChangeTimeout.clear(),S.restTimeout.clear(),S.blockMouseMove=!0,S.restTimeoutPending=!1)}return N.on("openchange",U),()=>{N.off("openchange",U)}},[a,N,S,q]),x.useEffect(()=>{if(!a)return;function U(K,ee=!0){const F=Kr(T.current,"close",S.pointerType);F?S.openChangeTimeout.start(F,()=>{y.setOpen(!1,rt(En,K)),w?.events.emit("floating.closed",K)}):ee&&(S.openChangeTimeout.clear(),y.setOpen(!1,rt(En,K)),w?.events.emit("floating.closed",K))}const V=m.current??(h?y.select("domReferenceElement"):null);if(!bt(V))return;function X(K){if(S.openChangeTimeout.clear(),S.blockMouseMove=!1,c&&!Hr(S.pointerType))return;const ee=Sj(z.current),F=Kr(T.current,"open",S.pointerType),ne=qn(K),Z=K.currentTarget??null,fe=y.select("domReferenceElement");let Y=Z;if(bt(ne)&&!y.context.triggerElements.hasElement(ne)){for(const Oe of y.context.triggerElements.elements())if(Ze(Oe,ne)){Y=Oe;break}}bt(Z)&&bt(fe)&&!y.context.triggerElements.hasElement(Z)&&Ze(Z,fe)&&(Y=fe);const oe=Y==null?!1:$(fe,Y,ne),ve=y.select("open"),ie=L.current?.()??y.select("transitionStatus")==="ending",xe=!ve&&ie&&R.current,ke=!oe&&bt(Y)&&bt(fe)&&Ze(fe,Y)&&xe,Re=ee>0&&!F,Ae=oe&&(ve||xe)||ke,Ie=!ve||oe;if(Ae){D()&&y.setOpen(!0,rt(En,K,Y));return}Re||(F?S.openChangeTimeout.start(F,()=>{Ie&&D()&&y.setOpen(!0,rt(En,K,Y))}):Ie&&D()&&y.setOpen(!0,rt(En,K,Y)))}function Q(K){if(I()){G();return}q();const ee=y.select("domReferenceElement"),F=vt(ee);S.restTimeout.clear(),S.restTimeoutPending=!1;const ne=k.current.floatingContext??b?.();if(mf(K.relatedTarget,y.context.triggerElements))return;if(A.current&&ne){y.select("open")||S.openChangeTimeout.clear();const fe=m.current;S.handler=A.current({...ne,tree:w,x:K.clientX,y:K.clientY,onClose(){G(),q(),M.current&&!I()&&fe===y.select("domReferenceElement")&&U(K,!0)}}),F.addEventListener("mousemove",S.handler),S.handler(K);return}(S.pointerType==="touch"?!Ze(y.select("floatingElement"),K.relatedTarget):!0)&&U(K)}function W(K){Ze(V,K.relatedTarget)||(S.openChangeTimeout.clear(),S.restTimeout.clear(),S.restTimeoutPending=!1)}const B=E?xt(V,"mouseout",W):void 0;return f?_a(xt(V,"mousemove",X,{once:!0}),xt(V,"mouseenter",X),xt(V,"mouseleave",Q),B):_a(xt(V,"mouseenter",X),xt(V,"mouseleave",Q),B)},[q,G,k,T,y,a,A,S,h,$,I,c,f,z,m,w,M,b,L,D,E]),x.useMemo(()=>{if(!a)return;function U(V){S.pointerType=V.pointerType}return{onPointerDown:U,onPointerEnter:U,onMouseMove(V){const{nativeEvent:X}=V,Q=V.currentTarget,W=y.select("domReferenceElement"),B=y.select("open"),K=$(W,Q,V.target);if(c&&!Hr(S.pointerType))return;if(B&&K&&S.handleCloseOptions?.blockPointerEvents){const ne=y.select("floatingElement");if(ne){const Z=S.handleCloseOptions?.getScope?.()??Q.ownerDocument.body;jC(S,{scopeElement:Z,referenceElement:Q,floatingElement:ne})}}const ee=Sj(z.current);if(B&&!K||ee===0||!K&&S.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;S.restTimeout.clear();function F(){if(S.restTimeoutPending=!1,I())return;const ne=y.select("open");!S.blockMouseMove&&(!ne||K)&&D()&&y.setOpen(!0,rt(En,X,Q))}S.pointerType==="touch"?Gs.flushSync(()=>{F()}):K&&B?F():(S.restTimeoutPending=!0,S.restTimeout.start(ee,F))}}},[a,S,I,$,c,y,z,D])}const UO="Escape";function tk(e){return lr&&e.movementX===0&&e.movementY===0}function fp(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function Td(e,t){return fp(t,e===yS||e===Ib,e===np||e===sp)}function ch(e,t,a){return fp(t,e===Ib,a?e===np:e===sp)||e==="Enter"||e===" "||e===""}function qO(e,t,a){return fp(t,a?e===np:e===sp,e===Ib)}function HO(e,t,a,o){const i=a?e===sp:e===np,c=e===yS;return t==="both"||t==="horizontal"&&o?e===UO:fp(t,i,c)}function SC(e,t){const{listRef:a,activeIndex:o,onNavigate:i=()=>{},enabled:c=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:m=!1,nested:g=!1,rtl:h=!1,virtual:b=!1,focusItemOnOpen:_="auto",focusItemOnHover:j=!0,openOnArrowKeyDown:E=!0,disabledIndices:y=void 0,orientation:k="vertical",parentOrientation:N,id:w,resetOnPointerLeave:S=!0,externalTree:R,grid:A}=t,T=A!=null,z="rootStore"in e?e.rootStore:e,M=z.useState("open"),P=z.useState("floatingElement"),L=z.useState("domReferenceElement"),I=z.context.dataRef,D=gf(P),$=xx(L),q=mn(D),G=eo(),U=to(R),V=x.useRef(_),X=x.useRef(d??-1),Q=x.useRef(null),W=x.useRef(!0),B=He(me=>{i(X.current===-1?null:X.current,me)}),K=x.useRef(!!P),ee=x.useRef(M),F=x.useRef(!1),ne=x.useRef(!1),Z=x.useRef(null),fe=mn(y),Y=mn(M),oe=mn(d),ve=mn(S),ie=Ji(),xe=Ji(),ke=He(()=>{function me(Ce){b?U?.events.emit("virtualfocus",Ce):Z.current=nf(Ce,{sync:F.current,preventScroll:!0})}const de=a.current[X.current],Le=ne.current;de&&me(de),(F.current?Ce=>Ce():Ce=>ie.request(Ce))(()=>{const Ce=a.current[X.current]||de;if(!Ce)return;de||me(Ce),Ne&&(Le||!W.current)&&Ce.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Pe(()=>{I.current.orientation=k},[I,k]),Pe(()=>{c&&(M&&P?(X.current=d??-1,V.current&&d!=null&&(ne.current=!0,B())):K.current&&(X.current=-1,B()))},[c,M,P,d,B]),Pe(()=>{if(c){if(!M){F.current=!1;return}if(P)if(o==null){if(F.current=!1,oe.current!=null)return;if(K.current&&(X.current=-1,ke()),(!ee.current||!K.current)&&V.current&&(Q.current!=null||V.current===!0&&Q.current==null)){let me=0;const de=()=>{a.current[0]==null?(me<2&&(me?ye=>xe.request(ye):queueMicrotask)(de),me+=1):(X.current=Q.current==null||ch(Q.current,k,h)||g?tf(a):vx(a),Q.current=null,B())};de()}}else Rc(a.current,o)||(X.current=o,ke(),ne.current=!1)}},[c,M,P,o,oe,g,a,k,h,B,ke,xe]),Pe(()=>{if(!c||P||!U||b||!K.current)return;const me=U.nodesRef.current,de=me.find(Ce=>Ce.id===G)?.context?.elements.floating,Le=Kn(vt(L??de??null)),ye=me.some(Ce=>Ce.context&&Ze(Ce.context.elements.floating,Le));de&&!ye&&W.current&&de.focus({preventScroll:!0})},[c,P,L,U,G,b]),Pe(()=>{ee.current=M,K.current=!!P}),Pe(()=>{M||(Q.current=null,V.current=_)},[M,_]);const Re=o!=null,Ae=He(me=>{if(!Y.current)return;const de=a.current.indexOf(me.currentTarget);de!==-1&&(X.current!==de||o!==de)&&(X.current=de,B(me))}),Ie=He(()=>N??U?.nodesRef.current.find(me=>me.id===G)?.context?.dataRef?.current.orientation),Oe=He(()=>tf(a,fe.current)),Te=He(me=>{if(W.current=!1,F.current=!0,me.which===229||!Y.current&&me.currentTarget===q.current)return;if(g&&HO(me.key,k,h,T)){Td(me.key,Ie())||pa(me),z.setOpen(!1,rt(bx,me.nativeEvent)),Gt(L)&&(b?U?.events.emit("virtualfocus",L):L.focus());return}const de=X.current,Le=tf(a,y),ye=vx(a,y);if($||(me.key==="Home"&&(pa(me),X.current=Le,B(me)),me.key==="End"&&(pa(me),X.current=ye,B(me))),A!=null){const Ce=A(me,X.current,a,k,m,h,y,Le,ye);if(Ce!=null&&(X.current=Ce,B(me)),k==="both")return}if(Td(me.key,k)){if(pa(me),M&&!b&&Kn(me.currentTarget.ownerDocument)===me.currentTarget){X.current=ch(me.key,k,h)?Le:ye,B(me);return}ch(me.key,k,h)?m?de>=ye?f&&de!==a.current.length?X.current=-1:(F.current=!1,X.current=Le):X.current=Qa(a.current,{startingIndex:de,disabledIndices:y}):X.current=Math.min(ye,Qa(a.current,{startingIndex:de,disabledIndices:y})):m?de<=Le?f&&de!==-1?X.current=a.current.length:(F.current=!1,X.current=ye):X.current=Qa(a.current,{startingIndex:de,decrement:!0,disabledIndices:y}):X.current=Math.max(Le,Qa(a.current,{startingIndex:de,decrement:!0,disabledIndices:y})),Rc(a.current,X.current)&&(X.current=-1),B(me)}}),Ne=x.useMemo(()=>({onFocus(de){F.current=!0,Ae(de)},onClick:({currentTarget:de})=>de.focus({preventScroll:!0}),onMouseMove(de){tk(de)||(F.current=!0,ne.current=!1,j&&Ae(de))},onPointerLeave(de){if(!Y.current||!W.current||de.pointerType==="touch")return;F.current=!0;const Le=de.relatedTarget;if(!(!j||a.current.includes(Le))&&ve.current&&(Z.current?.(),Z.current=null,X.current=-1,B(de),!b)){const ye=q.current,Ce=Kn(vt(ye));ye&&Ze(ye,Ce)&&ye.focus({preventScroll:!0})}}}),[Ae,Y,q,j,a,B,ve,b]),Me=x.useMemo(()=>b&&M&&Re&&{"aria-activedescendant":`${w}-${o}`},[b,M,Re,w,o]),De=x.useMemo(()=>({"aria-orientation":k==="both"?void 0:k,...$?{}:Me,onKeyDown(me){if(me.key==="Tab"&&me.shiftKey&&M&&!b){const de=qn(me.nativeEvent);if(de&&!Ze(q.current,de))return;pa(me),z.setOpen(!1,rt(Oo,me.nativeEvent)),Gt(L)&&L.focus();return}Te(me)},onPointerMove(me){tk(me)||(W.current=!0)}}),[Me,Te,q,k,$,z,M,b,L]),qe=x.useMemo(()=>{function me(ye){z.setOpen(!0,rt(bx,ye.nativeEvent,ye.currentTarget))}function de(ye){_==="auto"&&zb(ye.nativeEvent)&&(V.current=!b)}function Le(ye){V.current=_,_==="auto"&&Ob(ye.nativeEvent)&&(V.current=!0)}return{onKeyDown(ye){const Ce=z.select("open");W.current=!1;const Qe=ye.key.startsWith("Arrow"),Ge=qO(ye.key,Ie(),h),it=Td(ye.key,k),Tt=(g?Ge:it)||ye.key==="Enter"||ye.key.trim()==="";if(b&&Ce)return Te(ye);if(!(!Ce&&!E&&Qe)){if(Tt){const _t=Td(ye.key,Ie());Q.current=g&&_t?null:ye.key}if(g){Ge&&(pa(ye),Ce?(X.current=Oe(),B(ye)):me(ye));return}it&&(oe.current!=null&&(X.current=oe.current),pa(ye),!Ce&&E?me(ye):Te(ye),Ce&&B(ye))}},onFocus(ye){z.select("open")&&!b&&(X.current=-1,B(ye))},onPointerDown:Le,onPointerEnter:Le,onMouseDown:de,onClick:de}},[Te,_,Oe,g,B,z,E,k,Ie,h,oe,b]),Xe=x.useMemo(()=>({...Me,...qe}),[Me,qe]);return x.useMemo(()=>c?{reference:Xe,floating:De,item:Ne,trigger:qe}:{},[c,Xe,De,qe,Ne])}function CC(e,t){const{listRef:a,elementsRef:o,activeIndex:i,onMatch:c,disabledIndices:d,onTyping:f,enabled:m=!0,resetMs:g=750,selectedIndex:h=null}=t,b="rootStore"in e?e.rootStore:e,_=b.useState("open"),j=Rn(),E=x.useRef(""),y=x.useRef(h??i??-1),k=x.useRef(null),N=He(R=>{function A(q){return o?.current[q]}function T(q){const G=A(q);return G&&!ip(G)||G?.matches(":disabled")?!1:d==null||!bf(ja,q,d)}function z(q,G,U=0){if(q.length===0)return-1;const V=(U%q.length+q.length)%q.length,X=G.toLowerCase();for(let Q=0;Q<q.length;Q+=1){const W=(V+Q)%q.length;if(!(!q[W]?.toLowerCase().startsWith(X)||!T(W)))return W}return-1}const M=a.current;if(E.current.length>0&&R.key===" "&&(pa(R),f?.(!0)),E.current.length>0&&E.current[0]!==" "&&z(M,E.current)===-1&&R.key!==" "&&f?.(!1),M==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;_&&R.key!==" "&&(pa(R),f?.(!0));const P=E.current==="";P&&(y.current=h??i??-1),M.every((q,G)=>q&&T(G)?q[0]?.toLowerCase()!==q[1]?.toLowerCase():!0)&&E.current===R.key&&(E.current="",y.current=k.current),E.current+=R.key,j.start(g,()=>{E.current="",y.current=k.current,f?.(!1)});const D=((P?h??i??-1:y.current)??0)+1,$=z(M,E.current,D);$!==-1?(c?.($),k.current=$):R.key!==" "&&(E.current="",f?.(!1))}),w=He(R=>{const A=R.relatedTarget,T=b.select("domReferenceElement"),z=b.select("floatingElement");Ze(T,A)||Ze(z,A)||(j.clear(),E.current="",y.current=k.current,f?.(!1))});Pe(()=>{!_&&h!==null||(j.clear(),k.current=null,E.current!==""&&(E.current=""))},[_,h,j]);const S=x.useMemo(()=>({onKeyDown:N,onBlur:w}),[N,w]);return x.useMemo(()=>m?{reference:S,floating:S}:{},[m,S])}const nk=.1,VO=nk*nk,Vt=.5;function Ad(e,t,a,o,i,c){return o>=t!=c>=t&&e<=(i-a)*(t-o)/(c-o)+a}function Md(e,t,a,o,i,c,d,f,m,g){let h=!1;return Ad(e,t,a,o,i,c)&&(h=!h),Ad(e,t,i,c,d,f)&&(h=!h),Ad(e,t,d,f,m,g)&&(h=!h),Ad(e,t,m,g,a,o)&&(h=!h),h}function FO(e,t,a){return e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height}function zd(e,t,a,o,i,c){const d=Math.min(a,i),f=Math.max(a,i),m=Math.min(o,c),g=Math.max(o,c);return e>=d&&e<=f&&t>=m&&t<=g}function NC(e={}){const{blockPointerEvents:t=!1}=e,a=new ta,o=({x:i,y:c,placement:d,elements:f,onClose:m,nodeId:g,tree:h})=>{const b=d?.split("-")[0];let _=!1,j=null,E=null,y=typeof performance<"u"?performance.now():0;function k(w,S){const R=performance.now(),A=R-y;if(j===null||E===null||A===0)return j=w,E=S,y=R,!1;const T=w-j,z=S-E,M=T*T+z*z,P=A*A*VO;return j=w,E=S,y=R,M<P}function N(){a.clear(),m()}return function(S){a.clear();const R=f.domReference,A=f.floating;if(!R||!A||b==null||i==null||c==null)return;const{clientX:T,clientY:z}=S,M=qn(S),P=S.type==="mouseleave",L=Ze(A,M),I=Ze(R,M);if(L&&(_=!0,!P))return;if(I&&(_=!1,!P)){_=!0;return}if(P&&bt(S.relatedTarget)&&Ze(A,S.relatedTarget))return;function D(){return!!(h&&Qr(h.nodesRef.current,g).length>0)}function $(){D()||N()}if(D())return;const q=R.getBoundingClientRect(),G=A.getBoundingClientRect(),U=i>G.right-G.width/2,V=c>G.bottom-G.height/2,X=G.width>q.width,Q=G.height>q.height,W=(X?q:G).left,B=(X?q:G).right,K=(Q?q:G).top,ee=(Q?q:G).bottom;if(b==="top"&&c>=q.bottom-1||b==="bottom"&&c<=q.top+1||b==="left"&&i>=q.right-1||b==="right"&&i<=q.left+1){$();return}let F=!1;switch(b){case"top":F=zd(T,z,W,q.top+1,B,G.bottom-1);break;case"bottom":F=zd(T,z,W,G.top+1,B,q.bottom-1);break;case"left":F=zd(T,z,G.right-1,ee,q.left+1,K);break;case"right":F=zd(T,z,q.right-1,ee,G.left+1,K);break}if(F)return;if(_&&!FO(T,z,q)){$();return}if(!P&&k(T,z)){$();return}let ne=!1;switch(b){case"top":{const Z=X?Vt/2:Vt*4,fe=X||U?i+Z:i-Z,Y=X?i-Z:U?i+Z:i-Z,oe=c+Vt+1,ve=U||X?G.bottom-Vt:G.top,ie=U?X?G.bottom-Vt:G.top:G.bottom-Vt;ne=Md(T,z,fe,oe,Y,oe,G.left,ve,G.right,ie);break}case"bottom":{const Z=X?Vt/2:Vt*4,fe=X||U?i+Z:i-Z,Y=X?i-Z:U?i+Z:i-Z,oe=c-Vt,ve=U||X?G.top+Vt:G.bottom,ie=U?X?G.top+Vt:G.bottom:G.top+Vt;ne=Md(T,z,fe,oe,Y,oe,G.left,ve,G.right,ie);break}case"left":{const Z=Q?Vt/2:Vt*4,fe=Q||V?c+Z:c-Z,Y=Q?c-Z:V?c+Z:c-Z,oe=i+Vt+1,ve=V||Q?G.right-Vt:G.left,ie=V?Q?G.right-Vt:G.left:G.right-Vt;ne=Md(T,z,ve,G.top,ie,G.bottom,oe,fe,oe,Y);break}case"right":{const Z=Q?Vt/2:Vt*4,fe=Q||V?c+Z:c-Z,Y=Q?c-Z:V?c+Z:c-Z,oe=i-Vt,ve=V||Q?G.left+Vt:G.right,ie=V?Q?G.left+Vt:G.right:G.left+Vt;ne=Md(T,z,oe,fe,oe,Y,ve,G.top,ie,G.bottom);break}}ne?_||a.start(40,$):$()}};return o.__options={...e,blockPointerEvents:t},o}const GO={...l_,disabled:e=>e.disabled,instantType:e=>e.instantType,isInstantPhase:e=>e.isInstantPhase,trackCursorAxis:e=>e.trackCursorAxis,disableHoverablePopup:e=>e.disableHoverablePopup,lastOpenChangeReason:e=>e.openChangeReason,closeOnClick:e=>e.closeOnClick,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin};class YO extends su{constructor(t,a,o){const i=new au;super(KO(t,i,a,o),XO(i),GO)}setOpen=(t,a)=>{zO(this,t,a,{extraState:{openChangeReason:a.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,rt(gl,t))}}function KO(e,t,a,o=!1){const i={...o_(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,adaptiveOrigin:void 0,...e};return i.floatingRootContext=bC(t,a,o),i}function XO(e){return{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:e}}const QO=Rb(function(t){const{disabled:a=!1,defaultOpen:o=!1,open:i,disableHoverablePopup:c=!1,trackCursorAxis:d="none",actionsRef:f,onOpenChange:m,onOpenChangeComplete:g,handle:h,triggerId:b,defaultTriggerId:_=null,children:j}=t,E=gC((I,D)=>new YO({open:o,openProp:i,activeTriggerId:_,triggerIdProp:b},I,D));E.useControlledProp("openProp",i),E.useControlledProp("triggerIdProp",b),E.useContextCallback("onOpenChange",m),E.useContextCallback("onOpenChangeComplete",g);const y=E.useState("open"),k=!a&&y,N=E.useState("activeTriggerId"),w=E.useState("mounted"),S=E.useState("payload");E.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:c,disabled:a}),s_(E,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:A}=a_(k,E),T=E.useState("isInstantPhase"),z=E.useState("instantType"),M=E.useState("lastOpenChangeReason"),P=x.useRef(null);Pe(()=>{y&&a&&E.setOpen(!1,rt(wS))},[y,a,E]),Pe(()=>{A==="ending"&&M===ka||A!=="ending"&&T?(z!=="delay"&&(P.current=z),E.set("instantType","delay")):P.current!==null&&(E.set("instantType",P.current),P.current=null)},[A,T,M,z,E]),Pe(()=>{k&&N==null&&E.set("payload",void 0)},[E,N,k]),x.useImperativeHandle(f,()=>({unmount:R,close:()=>E.setOpen(!1,rt(Bb))}),[R,E]);const L=k||w||!a&&d!=="none";return n.jsxs(bS.Provider,{value:E,children:[h&&n.jsx(t_,{handle:h,store:E}),L&&n.jsx(WO,{store:E,disabled:a,trackCursorAxis:d}),typeof j=="function"?j({payload:S}):j]})});function WO({store:e,disabled:t,trackCursorAxis:a}){const o=e.useState("floatingRootContext"),i=lp(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=zz(o,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),d=x.useMemo(()=>Ss(c.reference,i.reference),[c.reference,i.reference]);return r_(e,{activeTriggerProps:d,inactiveTriggerProps:d,popupProps:i.floating??sn}),null}let sk=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const ZO={"data-starting-style":""},JO={"data-ending-style":""},Vo={transitionStatus(e){return e==="starting"?ZO:e==="ending"?JO:null}};(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=sk.startingStyle]="startingStyle",e[e.endingStyle=sk.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({});const e6={"data-popup-open":""},t6={"data-popup-open":"","data-pressed":""},n6={"data-open":""},s6={"data-closed":""},a6={"data-anchor-hidden":""},EC={open(e){return e?e6:null}},wx={open(e){return e?t6:null}},ru={open(e){return e?n6:s6},anchorHidden(e){return e?a6:null}},d_={...ru,...Vo};function ra(e){return Do(e,"base-ui")}const RC=x.createContext(void 0);function r6(){return x.useContext(RC)}const ak=600,TC="data-base-ui-tooltip-trigger";function rk(e){if("composedPath"in e){const a=e.composedPath();for(let o=0;o<a.length;o+=1){const i=a[o];if(bt(i))return i}}const t=e.target;return bt(t)?t:null}function o6(e){let t=e;for(;t;){const a=t.closest(`[${TC}]`);if(a)return a;const o=t.getRootNode();t="host"in o&&bt(o.host)?o.host:null}return null}const i6=xS(function(t,a){const{render:o,className:i,style:c,handle:d,payload:f,disabled:m,delay:g,closeOnClick:h=!0,closeDelay:b,id:_,...j}=t,E=eu(!0),k=vC(d)??E;if(!k)throw new Error(gn(82));const N=ra(_),w=k.useState("isTriggerActive",N),S=k.useState("isOpenedByTrigger",N),R=k.useState("floatingRootContext"),A=x.useRef(null),T=g??ak,z=b??0,{registerTrigger:M,isMountedByThisTrigger:P}=xC(N,A,k,{payload:f,closeOnClick:h,closeDelay:z}),L=r6(),{delayRef:I,isInstantPhase:D,hasProvider:$}=O4(R,{open:S}),q=u_(R);k.useSyncedValue("isInstantPhase",D);const G=k.useState("disabled"),U=m??G,V=mn(U),X=k.useState("trackCursorAxis"),Q=k.useState("disableHoverablePopup"),W=x.useRef(!1),B=Rn(),K=x.useRef(void 0);function ee(){return $?Kr(I.current,"open")===0?0:g??L??ak:T}function F(ke){const Re=A.current;if(!Re||!ke)return!1;const Ae=o6(ke);return Ae!==null&&Ae!==Re&&Ze(Re,Ae)}function ne(ke){const Re=F(ke);return W.current=Re,Re&&(q.openChangeTimeout.clear(),q.restTimeout.clear(),q.restTimeoutPending=!1,B.clear()),Re}const Z=wC(R,{enabled:!U,mouseOnly:!0,move:!1,handleClose:!Q&&X!=="both"?NC():null,restMs:ee,delay(){return b==null&&$?{close:Kr(I.current,"close")}:{close:z}},triggerElementRef:A,isActiveTrigger:w,isClosing:()=>k.select("transitionStatus")==="ending",shouldOpen(){return!W.current}}),fe=yC(R,{enabled:!U}).reference,Y=ke=>{const Re=W.current,Ae=rk(ke),Ie=ne(Ae),Oe=A.current,Te=Oe&&Ae&&Ze(Oe,Ae);if(Ie&&k.select("open")&&k.select("lastOpenChangeReason")===En){k.setOpen(!1,rt(En,ke));return}if(Re&&!Ie&&Te&&!V.current&&!k.select("open")&&Oe&&Hr(K.current)){const Ne=()=>{!W.current&&!V.current&&!k.select("open")&&k.setOpen(!0,rt(En,ke,Oe))},Me=ee();Me===0?(B.clear(),Ne()):B.start(Me,Ne)}},oe=k.useState("triggerProps",P);return Et("button",t,{state:{open:S},ref:[a,M,A],props:[Z,fe,P||X!=="none"?oe:void 0,{onMouseOver(ke){Y(ke.nativeEvent)},onFocus(ke){F(rk(ke.nativeEvent))&&ke.preventBaseUIHandler()},onMouseLeave(){W.current=!1,B.clear(),K.current=void 0},onPointerEnter(ke){K.current=ke.pointerType},onPointerDown(ke){K.current=ke.pointerType,k.set("closeOnClick",h),h&&!k.select("open")&&k.cancelPendingOpen(ke.nativeEvent)},onClick(ke){h&&!k.select("open")&&k.cancelPendingOpen(ke.nativeEvent)},id:N,"data-trigger-disabled":U?"":void 0,[TC]:U?void 0:""},j],stateAttributesMapping:EC})}),AC=x.createContext(void 0);function l6(){const e=x.useContext(AC);if(e===void 0)throw new Error(gn(70));return e}const c6=x.forwardRef(function(t,a){const{children:o,container:i,className:c,render:d,style:f,...m}=t,{node:g,subtree:h}=ZS({container:i,ref:a,componentProps:t,elementProps:m});return!h&&!g?null:n.jsxs(x.Fragment,{children:[h,g&&Gs.createPortal(o,g)]})}),u6=x.forwardRef(function(t,a){const{keepMounted:o=!1,...i}=t;return eu().useState("mounted")||o?n.jsx(AC.Provider,{value:o,children:n.jsx(c6,{ref:a,...i})}):null}),MC=x.createContext(void 0);function zC(){const e=x.useContext(MC);if(e===void 0)throw new Error(gn(71));return e}const d6=x.createContext(void 0);function pp(){return x.useContext(d6)?.direction??"ltr"}const f6=e=>({name:"arrow",options:e,async fn(t){const{x:a,y:o,placement:i,rects:c,platform:d,elements:f,middlewareData:m}=t,{element:g,padding:h=0,offsetParent:b="real"}=Xr(e,t)||{};if(g==null)return{};const _=AS(h),j={x:a,y:o},E=Vb(i),y=Hb(E),k=await d.getDimensions(g),N=E==="y",w=N?"top":"left",S=N?"bottom":"right",R=N?"clientHeight":"clientWidth",A=c.reference[y]+c.reference[E]-j[E]-c.floating[y],T=j[E]-c.reference[E],z=b==="real"?await d.getOffsetParent?.(g):f.floating;let M=f.floating[R]||c.floating[y];(!M||!await d.isElement?.(z))&&(M=f.floating[R]||c.floating[y]);const P=A/2-T/2,L=M/2-k[y]/2-1,I=Math.min(_[w],L),D=Math.min(_[S],L),$=I,q=M-k[y]-D,G=M/2-k[y]/2+P,U=TS($,G,q),V=!m.arrow&&Jr(i)!=null&&G!==U&&c.reference[y]/2-(G<$?I:D)-k[y]/2<0,X=V?G<$?G-$:G-q:0;return{[E]:j[E]+X,data:{[E]:U,centerOffset:G-U-X,...V&&{alignmentOffset:X}},reset:V}}}),p6=(e,t)=>({...f6(e),options:[e,t]}),m6={name:"hide",async fn(e){const{width:t,height:a,x:o,y:i}=e.rects.reference,c=t===0&&a===0&&o===0&&i===0,d=await e.platform.detectOverflow(e,{elementContext:"reference"});return{data:{referenceHidden:d.top-a>=0||d.right-t>=0||d.bottom-a>=0||d.left-t>=0||c}}}},g6={sideX:"left",sideY:"top"},ok="--available-width",ik="--available-height";function OC(e,t,a){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?a?"inline-start":"inline-end":"right",bottom:"bottom",left:o?a?"inline-end":"inline-start":"left"}[t]}function lk(e,t,a){const{rects:o,placement:i}=e;return{side:OC(t,Vs(i),a),align:Jr(i)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function f_(e){return h6(e,IO)}function h6(e,t){const{anchor:a,positionMethod:o="absolute",side:i="bottom",sideOffset:c=0,align:d="center",alignOffset:f=0,collisionBoundary:m,collisionPadding:g=5,sticky:h=!1,arrowPadding:b=5,disableAnchorTracking:_=!1,inline:j,keepMounted:E=!1,floatingRootContext:y,mounted:k,collisionAvoidance:N,shift:w,nodeId:S,adaptiveOrigin:R,lazyFlip:A=!1,externalTree:T}=e,[z,M]=x.useState(null);!k&&z!==null&&M(null);const P=N.side||"flip",L=N.align||"flip",I=N.fallbackAxisSide||"end",D=w?.crossAxis??!1,$=w?.rootBoundary,q=typeof a=="function"?a:void 0,G=He(q),U=q?G:a,V=mn(a),X=mn(k),W=pp()==="rtl",B=z||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":W?"left":"right","inline-start":W?"right":"left"}[i],K=d==="center"?B:`${B}-${d}`;let ee=g;typeof ee=="number"?ee={top:ee,right:ee,bottom:ee,left:ee}:ee&&(ee={top:ee.top||0,right:ee.right||0,bottom:ee.bottom||0,left:ee.left||0});const F=1,ne=i==="bottom"?F:0,Z=i==="top"?F:0,fe=i==="right"?F:0,Y=i==="left"?F:0,oe={boundary:m==="clipping-ancestors"?"clippingAncestors":m,padding:ee},ve=x.useRef(null),ie=mn(c),xe=mn(f),ke=typeof c!="function"?c:0,Re=typeof f!="function"?f:0,Ae=[];j&&Ae.push(j),Ae.push(gO(ot=>{const Pt=lk(ot,i,W),on=typeof ie.current=="function"?ie.current(Pt):ie.current,Yt=typeof xe.current=="function"?xe.current(Pt):xe.current;return{mainAxis:on,crossAxis:Yt,alignmentAxis:Yt}},[ke,Re,W,i]));const Ie=L==="none"&&P!=="shift",Oe=!Ie&&(h||D||P==="shift"),Te=P==="none"?null:bO({...oe,padding:{top:ee.top+F+ne,right:ee.right+F+Y,bottom:ee.bottom+F+Z,left:ee.left+F+fe},mainAxis:!D&&P==="flip",crossAxis:L==="flip"?"alignment":!1,fallbackAxisSideDirection:I}),Ne=Ie?null:hO({...oe,rootBoundary:$,mainAxis:L!=="none",crossAxis:Oe,limiter:h||D?void 0:xO(ot=>{if(!ve.current)return{};const{width:Pt,height:on}=ve.current.getBoundingClientRect(),Yt=Hs(Vs(ot.placement)),Fn=Yt==="y"?Pt:on,An=Yt==="y"?ee.left+ee.right:ee.top+ee.bottom;return{offset:Fn/2+An/2}})},[oe,h,D,$,ee,L]);P==="shift"||L==="shift"||d==="center"?Ae.push(Ne,Te):Ae.push(Te,Ne),Ae.push(_O({...oe,apply({elements:{floating:ot},availableWidth:Pt,availableHeight:on,rects:Yt}){if(!X.current)return;const Fn=ot.style;Fn.setProperty(ok,`${Pt}px`),Fn.setProperty(ik,`${on}px`);const An=Jt(ot).devicePixelRatio||1,{x:as,y:dn,width:hs,height:Rs}=Yt.reference,oa=(Math.round((as+hs)*An)-Math.round(as*An))/An,ht=(Math.round((dn+Rs)*An)-Math.round(dn*An))/An;Fn.setProperty("--anchor-width",`${oa}px`),Fn.setProperty("--anchor-height",`${ht}px`)}}),p6(ot=>({element:ve.current||vt(ot.elements.floating).createElement("div"),padding:b,offsetParent:"floating"}),[b]),{name:"transformOrigin",fn(ot){const{elements:Pt,middlewareData:on,placement:Yt,rects:Fn,y:An}=ot,as=Vs(Yt),dn=Hs(as),hs=ve.current,Rs=on.arrow?.x||0,oa=on.arrow?.y||0,ht=hs?.clientWidth||0,$t=hs?.clientHeight||0,Ln=Rs+ht/2,rs=oa+$t/2,xs=Math.abs(on.shift?.y||0),Mn=Fn.reference.height/2,Wt=typeof c=="function"?c(lk(ot,i,W)):c,vn=xs>Wt,ia={top:`${Ln}px calc(100% + ${Wt}px)`,bottom:`${Ln}px ${-Wt}px`,left:`calc(100% + ${Wt}px) ${rs}px`,right:`${-Wt}px ${rs}px`}[as],dr=`${Ln}px ${Fn.reference.y+Mn-An}px`;return Pt.floating.style.setProperty("--transform-origin",Oe&&dn==="y"&&vn?dr:ia),{}}},m6,R),Pe(()=>{!k&&y&&y.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[k,y]);const Me=x.useMemo(()=>({elementResize:!_&&typeof ResizeObserver<"u",layoutShift:!_&&typeof IntersectionObserver<"u"}),[_]),{refs:De,elements:qe,x:Xe,y:me,middlewareData:de,update:Le,placement:ye,context:Ce,isPositioned:Qe,floatingStyles:Ge}=t({rootContext:y,open:E?k:void 0,placement:K,middleware:Ae,strategy:o,whileElementsMounted:E?void 0:(...ot)=>Kj(...ot,Me),nodeId:S,externalTree:T}),{sideX:it,sideY:Tt}=de.adaptiveOrigin||g6,_t=Qe?o:"fixed",Ct=x.useMemo(()=>{let ot;return Qe?R?ot={position:_t,[it]:Xe,[Tt]:me}:ot={...Ge,position:_t}:ot={position:_t,top:0,left:0},ot[ok]="100vw",ot[ik]="100vh",Qe||(ot.opacity=0),ot},[R,_t,it,Xe,Tt,me,Ge,Qe]),je=x.useRef(null);Pe(()=>{if(!k)return;const ot=V.current,Pt=typeof ot=="function"?ot():ot,Yt=(ck(Pt)?Pt.current:Pt)||null||null;Yt!==je.current&&(De.setPositionReference(Yt),je.current=Yt)},[k,De,U,V]),x.useEffect(()=>{if(!k)return;const ot=V.current;typeof ot!="function"&&ck(ot)&&ot.current!==je.current&&(De.setPositionReference(ot.current),je.current=ot.current)},[k,De,U,V]),x.useEffect(()=>{if(E&&k&&qe.reference&&qe.floating)return Kj(qe.reference,qe.floating,Le,Me)},[E,k,qe,Le,Me]);const ze=Vs(ye),Ye=OC(i,ze,W),We=Jr(ye)||"center",ft=!!de.hide?.referenceHidden;Pe(()=>{A&&k&&Qe&&ze!==B&&M(ze)},[A,k,Qe,ze,B]);const Rt=x.useMemo(()=>({position:"absolute",top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),Qt=de.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:Ct,arrowStyles:Rt,arrowRef:ve,arrowUncentered:Qt,side:Ye,align:We,physicalSide:ze,anchorHidden:ft,refs:De,context:Ce,isPositioned:Qe,update:Le}),[Ct,Rt,ve,Qt,Ye,We,ze,ft,De,Ce,Qe,Le])}function ck(e){return e!=null&&"current"in e}function mp(e){return e==="starting"?wz:sn}function p_(e,t,{styles:a,transitionStatus:o,props:i,refs:c,hidden:d,inert:f=!1}){const m={...a};return f&&(m.pointerEvents="none"),Et("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:d,style:m},mp(o),i],stateAttributesMapping:ru})}const x6=x.forwardRef(function(t,a){const{render:o,className:i,anchor:c,positionMethod:d="absolute",side:f="top",align:m="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_=5,arrowPadding:j=5,sticky:E=!1,disableAnchorTracking:y=!1,collisionAvoidance:k=XS,style:N,...w}=t,S=eu(),R=l6(),A=S.useState("open"),T=S.useState("mounted"),z=S.useState("trackCursorAxis"),M=S.useState("disableHoverablePopup"),P=S.useState("floatingRootContext"),L=S.useState("instantType"),I=S.useState("transitionStatus"),D=S.useState("adaptiveOrigin"),$=f_({anchor:c,positionMethod:d,floatingRootContext:P,mounted:T,side:f,sideOffset:g,align:m,alignOffset:h,collisionBoundary:b,collisionPadding:_,sticky:E,arrowPadding:j,disableAnchorTracking:y,keepMounted:R,collisionAvoidance:k,adaptiveOrigin:D}),q=x.useMemo(()=>({open:A,side:$.side,align:$.align,anchorHidden:$.anchorHidden,instant:z!=="none"?"tracking-cursor":L}),[A,$.side,$.align,$.anchorHidden,z,L]),G=p_(t,q,{styles:$.positionerStyles,transitionStatus:I,props:w,refs:[a,S.useStateSetter("positionerElement")],hidden:!T,inert:!A||z==="both"||M});return n.jsx(MC.Provider,{value:$,children:G})}),b6=x.forwardRef(function(t,a){const{render:o,className:i,style:c,...d}=t,f=eu(),{side:m,align:g}=zC(),h=f.useState("open"),b=f.useState("instantType"),_=f.useState("transitionStatus"),j=f.useState("popupProps"),E=f.useState("floatingRootContext"),y=f.useState("disabled"),k=f.useState("closeDelay");Ca({open:h,ref:f.context.popupRef,onComplete(){h&&f.context.onOpenChangeComplete?.(!0)}}),kC(E,{enabled:!y,closeDelay:k});const N=f.useStateSetter("popupElement");return Et("div",t,{state:{open:h,side:m,align:g,instant:b,transitionStatus:_},ref:[a,f.context.popupRef,N],props:[dp,j,mp(_),d],stateAttributesMapping:d_})}),_6=x.forwardRef(function(t,a){const{render:o,className:i,style:c,...d}=t,f=eu(),{arrowRef:m,side:g,align:h,arrowUncentered:b,arrowStyles:_}=zC(),j=f.useState("open"),E=f.useState("instantType");return Et("div",t,{state:{open:j,side:g,align:h,uncentered:b,instant:E},ref:[a,m],props:[{style:_,"aria-hidden":!0},d],stateAttributesMapping:ru})}),v6=function(t){const{delay:a,closeDelay:o,timeout:i=400}=t,c=x.useMemo(()=>({open:a,close:o}),[a,o]);return n.jsx(RC.Provider,{value:a,children:n.jsx(z4,{delay:c,timeoutMs:i,children:t.children})})};function gp(e){return Yb(19)?e:e?"true":void 0}function y6(e){const[t,a]=x.useState({current:e,previous:null});return Object.is(e,t.current)||a({current:e,previous:t.current}),t.previous}function St(...e){return hS(Pc(e))}function j6({delay:e=0,...t}){return n.jsx(v6,{"data-slot":"tooltip-provider",delay:e,...t})}function m_({...e}){return n.jsx(QO,{"data-slot":"tooltip",...e})}function g_({...e}){return n.jsx(i6,{"data-slot":"tooltip-trigger",...e})}function h_({className:e,side:t="top",sideOffset:a=4,align:o="center",alignOffset:i=0,children:c,...d}){return n.jsx(u6,{children:n.jsx(x6,{align:o,alignOffset:i,side:t,sideOffset:a,className:"isolate z-50",children:n.jsxs(b6,{"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),...d,children:[c,n.jsx(_6,{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 zi({label:e,active:t,onClick:a,isAdd:o,isSettings:i,isDefault:c,icon:d,title:f,testId:m}){const g=e.trim()||"·",{initials:h,subLabel:b}=DC(g),_=o||i?"indigo":PC(g),j=b&&!o&&!i&&!c;return n.jsxs(m_,{children:[n.jsx(g_,{render:n.jsxs("button",{type:"button",onClick:a,"data-testid":m,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[n.jsx("span",{className:ge("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",i&&"bg-muted text-muted-fg hover:bg-accent hover:text-foreground",c&&"overflow-hidden bg-muted",!o&&!i&&!c&&t&&C6(_),!o&&!i&&!c&&!t&&S6(_)),children:d??h}),j&&n.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:b})]})}),n.jsx(h_,{side:"right",children:f||e})]})}function DC(e){const t=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!t)return{initials:"·",subLabel:null};const a=t.split(" ");if(a.length>=2)return{initials:(a[0][0]+a[1][0]).toUpperCase(),subLabel:k6(t)};const o=a[0];return o.length<=4?{initials:o[0].toUpperCase(),subLabel:o}:{initials:o[0].toUpperCase(),subLabel:o.slice(0,4)+"…"}}function k6(e){return e.length>6?e.slice(0,5)+"…":e}function PC(e){let t=0;for(let a=0;a<e.length;a++)t=t*31+e.charCodeAt(a)|0;return _j[Math.abs(t)%_j.length]}const LC={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"},w6={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 S6(e){return LC[e]}function C6(e){return w6[e]}function N6(e){const{initials:t}=DC(e);return{initials:t,idleClass:LC[PC(e)]}}function Ue({content:e,side:t="top",children:a}){return e?n.jsxs(m_,{children:[n.jsx(g_,{render:a}),n.jsx(h_,{side:t,children:e})]}):a}const IC=x.createContext(void 0);function x_(e){const t=x.useContext(IC);if(t===void 0&&!e)throw new Error(gn(33));return t}const BC=x.createContext(void 0);function Fo(e){const t=x.useContext(BC);if(t===void 0&&!e)throw new Error(gn(36));return t}const E6=x.createContext(void 0);function b_(e=!0){const t=x.useContext(E6);if(t===void 0&&!e)throw new Error(gn(25));return t}function nl({controlled:e,default:t,name:a,state:o="value"}){const{current:i}=x.useRef(e!==void 0),[c,d]=x.useState(t),f=i?e:c,m=x.useCallback(g=>{i||d(g)},[]);return[f,m]}const $C=x.createContext(void 0);function hp(e=!1){const t=x.useContext($C);if(t===void 0&&!e)throw new Error(gn(16));return t}function R6(e){const{focusableWhenDisabled:t,disabled:a,composite:o=!1,tabIndex:i=0,isNativeButton:c}=e,d=o&&t!==!1,f=o&&t===!1;return{props:x.useMemo(()=>{const g={onKeyDown(h){a&&t&&h.key!=="Tab"&&h.preventDefault()}};return o||(g.tabIndex=i,!c&&a&&(g.tabIndex=t?i:-1)),(c&&(t||d)||!c&&a)&&(g["aria-disabled"]=a),c&&(!t||f)&&(g.disabled=a),g},[o,a,t,d,f,c,i])}}function Ac(e,t,{detail:a=0}={}){e.dispatchEvent(new(Jt(e)).PointerEvent("click",{bubbles:!0,cancelable:!0,composed:!0,detail:a,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey}))}function no(e={}){const{disabled:t=!1,focusableWhenDisabled:a,tabIndex:o=0,native:i=!0,composite:c}=e,d=x.useRef(null),f=hp(!0),m=c??f!==void 0,{props:g}=R6({focusableWhenDisabled:a,disabled:t,composite:m,tabIndex:o,isNativeButton:i}),h=x.useCallback(()=>{const j=d.current;uh(j)&&m&&t&&g.disabled===void 0&&j.disabled&&(j.disabled=!1)},[t,g.disabled,m]);Pe(h,[h]);const b=x.useCallback((j={})=>{const{onClick:E,onMouseDown:y,onKeyUp:k,onKeyDown:N,onPointerDown:w,...S}=j;return Ss({onClick(R){if(t){R.preventDefault();return}E?.(R)},onMouseDown(R){t||y?.(R)},onKeyDown(R){if(t||(vf(R),N?.(R),R.baseUIHandlerPrevented))return;const A=R.target===R.currentTarget,T=R.currentTarget,z=uh(T),M=!i&&T6(T),P=A&&(i?z:!M),L=R.key==="Enter",I=R.key===" ",D=T.getAttribute("role"),$=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(A&&m&&I){if(R.defaultPrevented&&$)return;R.preventDefault(),(!i||z)&&(R.preventBaseUIHandler(),Ac(T,R));return}if(!P||i||!I&&!L){A&&M&&I&&R.preventDefault();return}R.defaultPrevented||(R.preventDefault(),L&&(R.preventBaseUIHandler(),Ac(T,R)))},onKeyUp(R){if(!t){if(vf(R),k?.(R),R.target===R.currentTarget&&i&&m&&uh(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!i&&!m&&!R.defaultPrevented&&R.key===" "&&(R.preventBaseUIHandler(),Ac(R.currentTarget,R))}},onPointerDown(R){if(t){R.preventDefault();return}w?.(R)}},i?{type:"button"}:{role:"button"},g,S)},[t,g,m,i]),_=He(j=>{d.current=j,h()});return{getButtonProps:b,buttonRef:_}}function uh(e){return Gt(e)&&e.tagName==="BUTTON"}function T6(e){return Gt(e)&&e.tagName==="A"&&!!e.href}function A6(e){const{closeOnClick:t,highlighted:a,id:o,nodeId:i,store:c,typingRef:d,itemRef:f,itemMetadata:m}=e,{events:g}=c.useState("floatingTreeRoot"),h=c.useState("open"),b=b_(!0),_=b!==void 0;return x.useMemo(()=>({id:o,role:"menuitem",tabIndex:h&&a?0:-1,onKeyDown(j){j.key===" "&&d?.current&&j.preventDefault()},onMouseMove(j){i&&g.emit("itemhover",{nodeId:i,target:j.currentTarget})},onClick(j){t&&g.emit("close",{domEvent:j,reason:Fi})},onMouseUp(j){if(b){const E=b.initialCursorPointRef.current;if(b.initialCursorPointRef.current=null,_&&E&&Math.abs(j.clientX-E.x)<=1&&Math.abs(j.clientY-E.y)<=1||_&&!Ab&&j.button===2)return}f.current&&c.context.allowMouseUpTriggerRef.current&&(!_||j.button===2)&&m.type==="regular-item"&&Ac(f.current,j,{detail:1})}}),[t,a,o,g,i,h,c,d,f,b,_,m])}const UC={type:"regular-item"};function qC(e){const{closeOnClick:t,disabled:a,highlighted:o,id:i,store:c,typingRef:d=c.context.typingRef,nativeButton:f,itemMetadata:m,nodeId:g}=e,h=x.useRef(null),{getButtonProps:b,buttonRef:_}=no({disabled:a,focusableWhenDisabled:!0,native:f,composite:!0}),j=A6({closeOnClick:t,highlighted:o,id:i,nodeId:g,store:c,typingRef:d,itemRef:h,itemMetadata:m}),E=x.useCallback(k=>Ss(j,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},k,b),[j,b,m]),y=rr(h,_);return x.useMemo(()=>({getItemProps:E,itemRef:y}),[E,y])}const HC=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},nextIndexRef:{current:0}});function M6(){return x.useContext(HC)}function ou(e={}){const{guess:t,label:a,metadata:o,textRef:i,index:c}=e,{register:d,unregister:f,subscribeMapChange:m,nextIndexRef:g}=M6(),h=x.useRef(-1),[b,_]=x.useState(c==null&&t?()=>{if(h.current===-1){const k=g.current;g.current+=1,h.current=k}return h.current}:-1),j=c??b,E=x.useRef(null),y=x.useCallback(k=>{const N=E.current;N&&f(N),E.current=k,k&&d(k,{metadata:o??null,index:c??null,label:a,textRef:i})},[c,d,f,o,a,i]);return Pe(()=>{if(c==null)return m(k=>{const N=E.current?k.get(E.current)?.index:null;N!=null&&_(N)})},[c,m]),{ref:y,index:j}}let uk=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const VC={checked(e){return e?{[uk.checked]:""}:{[uk.unchecked]:""}},...Vo},z6=x.createContext(void 0),O6=x.forwardRef(function(t,a){const{render:o,className:i,id:c,label:d,nativeButton:f=!1,disabled:m=!1,closeOnClick:g=!0,style:h,...b}=t,_=ou({guess:!0,label:d}),j=x_(!0),E=ra(c),{store:y}=Fo(),k=y.useState("disabled"),N=m||k,w=y.useState("isActive",_.index),S=y.useState("itemProps"),{getItemProps:R,itemRef:A}=qC({closeOnClick:g,disabled:N,highlighted:w,id:E,store:y,nativeButton:f,nodeId:j?.context.nodeId,itemMetadata:UC});return Et("div",t,{state:{disabled:N,highlighted:w},props:[S,b,R],ref:[A,a,_.ref]})}),D6=x.createContext(void 0);function FC(e){return x.useContext(D6)}const Sx="ArrowUp",Cx="ArrowDown",Nx="ArrowLeft",Ex="ArrowRight",Rx="Home",Tx="End",xp=new Set([Sx,Cx,Nx,Ex,Rx,Tx]),P6="Shift",L6=[P6,"Control","Alt","Meta"];function I6(e){return Gt(e)&&e.tagName==="INPUT"}function dk(e){return!!(I6(e)&&e.selectionStart!=null||Gt(e)&&e.tagName==="TEXTAREA")}function fk(e,t,a,o){if(!e||!t||!t.scrollTo)return;let i=e.scrollLeft,c=e.scrollTop;const d=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(d&&o!=="vertical"){const m=pk(e,t,"left"),g=Od(e),h=Od(t);a==="ltr"&&(m+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight?i=m+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight:m-h.scrollMarginLeft<e.scrollLeft+g.scrollPaddingLeft&&(i=m-h.scrollMarginLeft-g.scrollPaddingLeft)),a==="rtl"&&(m-h.scrollMarginLeft<e.scrollLeft+g.scrollPaddingLeft?i=m-h.scrollMarginLeft-g.scrollPaddingLeft:m+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight&&(i=m+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight))}if(f&&o!=="horizontal"){const m=pk(e,t,"top"),g=Od(e),h=Od(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:i,top:c,behavior:"auto"})}function pk(e,t,a){const o=a==="left"?"offsetLeft":"offsetTop";let i=0;for(;t.offsetParent&&(i+=t[o],t.offsetParent!==e);)t=t.offsetParent;return i}function Od(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 B6=x.forwardRef(function(t,a){const{render:o,className:i,style:c,finalFocus:d,...f}=t,{store:m}=Fo(),{side:g,align:h}=x_(),b=FC()!=null,_=m.useState("open"),j=m.useState("transitionStatus"),E=m.useState("popupProps"),y=m.useState("mounted"),k=m.useState("instantType"),N=m.useState("activeTriggerElement"),w=m.useState("parent"),S=m.useState("lastOpenChangeReason"),R=m.useState("rootId"),A=m.useState("floatingRootContext"),T=m.useState("floatingTreeRoot"),z=m.useState("closeDelay"),M=m.useState("hoverEnabled"),P=m.useState("disabled"),L=m.useState("openMethod"),I=w.type==="context-menu";Ca({open:_,ref:m.context.popupRef,onComplete(){_&&m.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function U(V){m.setOpen(!1,rt(V.reason,V.domEvent))}return T.events.on("close",U),()=>{T.events.off("close",U)}},[T.events,m]),kC(A,{enabled:M&&!P&&!I&&w.type!=="menubar",closeDelay:z});const D=m.useStateSetter("popupElement"),$={transitionStatus:j,side:g,align:h,open:_,nested:w.type==="menu",instant:k},q=Et("div",t,{state:$,ref:[a,m.context.popupRef,D],stateAttributesMapping:d_,props:[E,{onKeyDown(U){b&&xp.has(U.key)&&U.stopPropagation()}},mp(j),f,{"data-rootownerid":R}]});let G=w.type===void 0||I;return(N||w.type==="menubar"&&S!==rp)&&(G=!0),n.jsx(Jb,{context:A,openInteractionType:L,modal:I,disabled:!y,returnFocus:d===void 0?G:d,initialFocus:w.type!=="menu",restoreFocus:!0,externalTree:w.type!=="menubar"?T:void 0,previousFocusableElement:N,nextFocusableElement:w.type===void 0?m.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:w.type===void 0?m.context.beforeContentFocusGuardRef:void 0,children:q})}),GC=x.createContext(void 0);function $6(){const e=x.useContext(GC);if(e===void 0)throw new Error(gn(32));return e}const U6=x.forwardRef(function(t,a){const{keepMounted:o=!1,...i}=t,{store:c}=Fo();return c.useState("mounted")||o?n.jsx(GC.Provider,{value:o,children:n.jsx(Qb,{ref:a,...i})}):null});function bp(e){const{children:t,elementsRef:a,labelsRef:o,onMapChange:i}=e,c=He(i),[,d]=x.useState(!1),f=Hn(H6).current,m=Hn(q6).current,g=x.useRef(0),h=x.useRef(!0),b=x.useRef([]),_=x.useRef(null),j=He(()=>{h.current||(h.current=!0,d(A=>!A))}),E=He((A,T)=>{m.set(A,T),j()}),y=He(A=>{m.delete(A),j()}),k=He(A=>{const T=new Map;return a.current.length=0,o&&(o.current.length=0),A.forEach(z=>{T.set(z.element,{...z.registration.metadata??{},index:z.index}),a.current[z.index]=z.element,o&&(o.current[z.index]=z.registration.label!==void 0?z.registration.label:z.registration.textRef?.current?.textContent??z.element.textContent)}),g.current=a.current.length,T});function N(A){if(_.current?.disconnect(),_.current=null,typeof MutationObserver!="function"||A.length<2)return;const T=new MutationObserver(M=>{if(!G6(M))return;let P=null;for(const L of A)if(L.isConnected){if(P&&YC(P,L)>0){T.disconnect(),j();return}P=L}});_.current=T;const z=new Set;for(let M=1;M<A.length;M+=1){const P=F6(A[M-1],A[M]);P&&z.add(P)}z.forEach(M=>T.observe(M,{childList:!0}))}const w=He(()=>{const[A,T]=V6(m),z=k(A);N(T),b.current=A,h.current=!1,f.forEach(M=>M(z)),c(z)});Pe(()=>(h.current||k(b.current),()=>{a.current=[],o&&(o.current=[])}),[a,o,k]),Pe(()=>{h.current&&w()}),Pe(()=>()=>{_.current?.disconnect(),h.current=!0},[]);const S=He(A=>(f.add(A),()=>{f.delete(A)})),R=x.useMemo(()=>({register:E,unregister:y,subscribeMapChange:S,nextIndexRef:g}),[E,y,S,g]);return n.jsx(HC.Provider,{value:R,children:t})}function q6(){return new Map}function H6(){return new Set}function V6(e){const t=new Set,a=[],o=[];e.forEach((c,d)=>{if(!d.isConnected)return;const f=c.index,m={index:f??-1,element:d,registration:c};f===null?o.push(m):f>=0&&(t.add(f),a.push(m))});let i=0;return o.sort((c,d)=>YC(c.element,d.element)),o.forEach(c=>{for(;t.has(i);)i+=1;c.index=i,a.push(c),i+=1}),t.size>0&&a.sort((c,d)=>c.index-d.index),[a,o.map(c=>c.element)]}function F6(e,t){let a=e.parentElement;for(;a&&!a.contains(t);)a=a.parentElement;return a}function G6(e){for(const t of e)for(let a=0;a<t.removedNodes.length;a+=1)if(t.removedNodes[a].isConnected)return!0;return!1}function YC(e,t){return e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}const __=x.forwardRef(function(t,a){const{cutout:o,...i}=t;let c;if(o){const d=o.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${d.left}px ${d.top}px,${d.left}px ${d.bottom}px,${d.right}px ${d.bottom}px,${d.right}px ${d.top}px,${d.left}px ${d.top}px)`}return n.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});let mk={},gk={},hk="";function _p(e,t){return tu(e)?e:t}function xk(e,t,a){return/hidden|clip/.test(e.getComputedStyle(_p(t,a)).overflowY)}function Y6(e){if(typeof document>"u")return!1;const t=vt(e);return Jt(t).innerWidth-t.documentElement.clientWidth>0}function K6(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=vt(e),o=a.documentElement,i=a.body,c=_p(o,i),d=c.style.overflowY,f=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=d,o.style.scrollbarGutter=f,m===g}function X6(e){const t=vt(e),a=t.documentElement,o=t.body,i=_p(a,o),c={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,c)}}function Q6(e){const t=vt(e),a=t.documentElement,o=t.body,i=Jt(a);let c=0,d=0,f=!1;const m=ga.create();if(lr&&(i.visualViewport?.scale??1)!==1)return()=>{};function g(){const j=i.getComputedStyle(a),E=i.getComputedStyle(o),N=(j.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=a.scrollTop,d=a.scrollLeft,mk={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},hk=a.style.scrollBehavior,gk={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 w=a.scrollHeight>a.clientHeight,S=a.scrollWidth>a.clientWidth,R=j.overflowY==="scroll"||E.overflowY==="scroll",A=j.overflowX==="scroll"||E.overflowX==="scroll",T=Math.max(0,i.innerWidth-o.clientWidth),z=Math.max(0,i.innerHeight-o.clientHeight),M=parseFloat(E.marginTop)+parseFloat(E.marginBottom),P=parseFloat(E.marginLeft)+parseFloat(E.marginRight),L=_p(a,o);if(f=K6(e),f){a.style.scrollbarGutter=N,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:N,overflowY:"hidden",overflowX:"hidden"}),(w||R)&&(a.style.overflowY="scroll"),(S||A)&&(a.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:M||z?`calc(100dvh - ${M+z}px)`:"100dvh",width:P||T?`calc(100vw - ${P+T}px)`:"100vw",boxSizing:"border-box",overflowY:"hidden",overflowX:"hidden",scrollBehavior:"unset"}),o.scrollTop=c,o.scrollLeft=d,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function h(){Object.assign(a.style,mk),Object.assign(o.style,gk),f||(a.scrollTop=c,a.scrollLeft=d,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=hk)}function b(){h(),m.request(g)}g();const _=xt(i,"resize",b);return()=>{m.cancel(),h(),typeof i.removeEventListener=="function"&&_()}}class W6{lockCount=0;restore=null;timeoutLock=ta.create();timeoutUnlock=ta.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 a=vt(t),o=a.documentElement,i=a.body,c=Jt(o);if(xk(c,o,i)){const f=new c.MutationObserver(()=>{xk(c,o,i)||(f.disconnect(),this.restore=null,this.lock(t))}),m={attributes:!0};f.observe(o,m),f.observe(i,m),this.restore=()=>f.disconnect();return}const d=Zf||!Y6(t);this.restore=d?X6(t):Q6(t)}}const Z6=new W6;function KC(e=!0,t=null){Pe(()=>{if(e)return Z6.acquire(t)},[e,t])}const J6=20;function XC(e,t,a,o){const[i,c]=x.useState(!1);Pe(()=>{if(!e||!t||a==null){c(!1);return}const d=vt(a).documentElement.clientWidth,f=a.offsetWidth;c(d>0&&f>0&&f>=d-J6)},[e,t,a]),KC(e&&(!t||i),o)}const eD=x.forwardRef(function(t,a){const{anchor:o,positionMethod:i="absolute",className:c,render:d,side:f,align:m,sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_=5,arrowPadding:j=5,sticky:E=!1,disableAnchorTracking:y=!1,collisionAvoidance:k=KS,style:N,...w}=t,{store:S}=Fo(),R=$6(),A=b_(!0),T=S.useState("parent"),z=S.useState("floatingRootContext"),M=S.useState("floatingTreeRoot"),P=S.useState("mounted"),L=S.useState("open"),I=S.useState("modal"),D=S.useState("openMethod"),$=S.useState("activeTriggerElement"),q=S.useState("transitionStatus"),G=S.useState("positionerElement"),U=S.useState("instantType"),V=S.useState("adaptiveOrigin"),X=S.useState("lastOpenChangeReason"),Q=S.useState("floatingNodeId"),W=S.useState("floatingParentNodeId"),B=z.useState("domReferenceElement"),K=x.useRef(null),ee=mC(G);let F=o,ne=g,Z=h,fe=m,Y=k;T.type==="context-menu"&&(F=o??T.context?.anchor,fe=fe??"start",!f&&fe!=="center"&&(Z=t.alignOffset??2,ne=t.sideOffset??-5));let oe=f,ve=fe;T.type==="menu"?(oe=oe??"inline-end",ve=ve??"start",Y=t.collisionAvoidance??XS):T.type==="menubar"&&(oe=oe??(T.context.orientation==="vertical"?"inline-end":"bottom"),ve=ve??"start");const ie=T.type==="context-menu",xe=f_({anchor:F,floatingRootContext:z,positionMethod:A?"fixed":i,mounted:P,side:oe,sideOffset:ne,align:ve,alignOffset:Z,arrowPadding:ie?0:j,collisionBoundary:b,collisionPadding:_,sticky:E,nodeId:Q,keepMounted:R,disableAnchorTracking:y,collisionAvoidance:Y,shift:ie?{crossAxis:!("side"in Y&&Y.side==="flip"),rootBoundary:"layoutViewport"}:void 0,externalTree:M,adaptiveOrigin:V});x.useEffect(()=>{function Me(De){De.open&&(De.parentNodeId===Q&&S.set("hoverEnabled",!1),De.nodeId!==Q&&De.parentNodeId===S.select("floatingParentNodeId")&&S.setOpen(!1,rt(yc)))}return M.events.on("menuopenchange",Me),()=>{M.events.off("menuopenchange",Me)}},[S,M.events,Q]),x.useEffect(()=>{if(S.select("floatingParentNodeId")==null)return;function Me(De){if(De.open||De.nodeId!==S.select("floatingParentNodeId"))return;const qe=De.reason??yc;S.setOpen(!1,rt(qe))}return M.events.on("menuopenchange",Me),()=>{M.events.off("menuopenchange",Me)}},[M.events,S]);const ke=Rn();x.useEffect(()=>{L||ke.clear()},[L,ke]),x.useEffect(()=>{function Me(De){if(!(!L||De.nodeId!==S.select("floatingParentNodeId")))if(De.target&&$&&$!==De.target){const qe=S.select("closeDelay");qe>0?ke.isStarted()||ke.start(qe,()=>{S.setOpen(!1,rt(yc))}):S.setOpen(!1,rt(yc))}else ke.clear()}return M.events.on("itemhover",Me),()=>{M.events.off("itemhover",Me)}},[M.events,L,$,S,ke]),x.useEffect(()=>{const Me={open:L,nodeId:Q,parentNodeId:W,reason:S.select("lastOpenChangeReason")};M.events.emit("menuopenchange",Me)},[M.events,L,S,Q,W]),Pe(()=>{const Me=B,De=K.current;if(Me&&(K.current=Me),De&&Me&&Me!==De){S.set("instantType",void 0);const qe=new AbortController;return ee(()=>{S.set("instantType","trigger-change")},qe.signal),()=>{qe.abort()}}},[B,ee,S]);const Re={open:L,side:xe.side,align:xe.align,anchorHidden:xe.anchorHidden,nested:T.type==="menu",instant:U},Ae=T.type==="menubar"&&T.context.modal;XC(L&&(Ae||I&&X!==En),D==="touch",G,$);const Oe=p_(t,Re,{styles:xe.positionerStyles,transitionStatus:q,props:w,refs:[a,S.useStateSetter("positionerElement")],hidden:!P,inert:!L}),Te=P&&T.type!=="menu"&&(T.type!=="menubar"&&I&&X!==En||T.type==="menubar"&&T.context.modal);let Ne=null;return T.type==="menubar"?Ne=T.context.contentElement:T.type===void 0&&(Ne=$),n.jsxs(IC.Provider,{value:xe,children:[Te&&n.jsx(__,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:gp(!L),cutout:Ne}),n.jsx(Ez,{id:Q,children:n.jsx(bp,{elementsRef:S.context.itemDomElements,labelsRef:S.context.itemLabels,children:Oe})})]})}),QC=x.createContext(void 0);function tD(){const e=x.useContext(QC);if(e===void 0)throw new Error(gn(34));return e}const nD=x.memo(x.forwardRef(function(t,a){const{render:o,className:i,value:c,defaultValue:d,onValueChange:f,disabled:m=!1,style:g,"aria-labelledby":h,...b}=t,[_,j]=x.useState(void 0),[E,y]=nl({controlled:c,default:d,name:"MenuRadioGroup"}),k=He((R,A)=>{f?.(R,A),!A.isCanceled&&y(R)}),w=Et("div",t,{state:{disabled:m},ref:a,props:{role:"group","aria-labelledby":h??_,"aria-disabled":m||void 0,...b}}),S=x.useMemo(()=>({value:E,setValue:k,disabled:m}),[E,k,m]);return n.jsx(z6.Provider,{value:j,children:n.jsx(QC.Provider,{value:S,children:w})})})),WC=x.createContext(void 0);function sD(){const e=x.useContext(WC);if(e===void 0)throw new Error(gn(35));return e}const aD=x.forwardRef(function(t,a){const{render:o,className:i,id:c,label:d,nativeButton:f=!1,disabled:m=!1,closeOnClick:g=!1,value:h,style:b,..._}=t,j=ou({guess:!0,label:d}),E=x_(!0),y=ra(c),{store:k}=Fo(),N=k.useState("isActive",j.index),w=k.useState("itemProps"),{value:S,setValue:R,disabled:A}=tD(),T=k.useState("disabled"),z=m||A||T,M=S===h,{getItemProps:P,itemRef:L}=qC({closeOnClick:g,disabled:z,highlighted:N,id:y,store:k,nativeButton:f,nodeId:E?.context.nodeId,itemMetadata:UC}),I=x.useMemo(()=>({disabled:z,highlighted:N,checked:M}),[z,N,M]);function D(q){const G=rt(Fi,q.nativeEvent,void 0,{preventUnmountOnClose:Nn});R(h,G)}const $=Et("div",t,{state:I,stateAttributesMapping:VC,props:[w,{role:"menuitemradio","aria-checked":M,onClick:D},_,P],ref:[L,a,j.ref]});return n.jsx(WC.Provider,{value:I,children:$})}),rD=x.forwardRef(function(t,a){const{render:o,className:i,style:c,keepMounted:d=!1,...f}=t,m=sD(),g=x.useRef(null),{transitionStatus:h,mounted:b,setMounted:_}=hl(m.checked);Ca({open:m.checked,ref:g,onComplete(){m.checked||_(!1)}});const j={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:h};return Et("span",t,{state:j,stateAttributesMapping:VC,ref:[a,g],props:{"aria-hidden":!0,...f},enabled:d||b})}),oD=x.createContext(null);function ZC(e){return x.useContext(oD)}function iD(e){const t=x.useRef(""),a=x.useCallback(i=>{i.defaultPrevented||(t.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:x.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,t.current),t.current=""},[e]),onPointerDown:a}}function v_(e,t){const a=x.useRef(e),o=He(t);Pe(()=>{a.current!==e&&o(a.current),a.current=e},[e,o])}function lD(e,t){const a=He((c,d)=>{(typeof e=="function"?e():e)||t(d||(Zf?"touch":""))}),{onClick:o,onPointerDown:i}=iD(a);return x.useMemo(()=>({onClick:o,onPointerDown:i}),[o,i])}function JC(e){const[t,a]=x.useState(null),o=lD(e,a);return v_(e,i=>{i&&!e&&a(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const cD={...l_,disabled:e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled,modal:e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0),openMethod:e=>e.openMethod,allowMouseEnter:e=>e.allowMouseEnter,highlightItemOnHover:e=>e.highlightItemOnHover,parent:e=>e.parent,rootId:e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId,activeIndex:e=>e.activeIndex,isActive:(e,t)=>e.activeIndex===t,hoverEnabled:e=>e.hoverEnabled,instantType:e=>e.instantType,lastOpenChangeReason:e=>e.openChangeReason,floatingTreeRoot:e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot,floatingNodeId:e=>e.floatingNodeId,floatingParentNodeId:e=>e.floatingParentNodeId,itemProps:e=>e.itemProps,closeDelay:e=>e.closeDelay,adaptiveOrigin:e=>e.adaptiveOrigin,keyboardEventRelay:e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")}};class uD extends su{constructor(t){super({...fD(),...t},dD(),cD),this.unsubscribeParentListener=this.observe("parent",a=>{if(this.unsubscribeParentListener?.(),a.type==="menu"){let o=a.store.select("rootId"),i=a.store.select("floatingTreeRoot"),c=a.store.select("keyboardEventRelay");this.unsubscribeParentListener=a.store.subscribe(()=>{const d=a.store.select("rootId"),f=a.store.select("floatingTreeRoot"),m=a.store.select("keyboardEventRelay");o===d&&i===f&&c===m||(o=d,i=f,c=m,this.notifyAll())}),this.context.allowMouseUpTriggerRef=a.store.context.allowMouseUpTriggerRef;return}a.type!==void 0&&(this.context.allowMouseUpTriggerRef=a.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,a){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:a})}unsubscribeParentListener=null}function dD(){return{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 au}}function fD(){return{...o_(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new Wb,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:sn,keyboardEventRelay:void 0,closeDelay:0,adaptiveOrigin:void 0}}const pD=x.createContext(void 0);function mD(){return x.useContext(pD)}const gD=Rb(function(t){const{children:a,open:o,onOpenChange:i,onOpenChangeComplete:c,defaultOpen:d=!1,disabled:f=!1,modal:m,loopFocus:g=!0,orientation:h="vertical",actionsRef:b,closeParentOnEsc:_=!1,handle:j,triggerId:E,defaultTriggerId:y=null,highlightItemOnHover:k=!0}=t,N=b_(!0),w=Fo(!0),S=ZC(!0),R=mD(),A=x.useMemo(()=>R&&w?{type:"menu",store:w.store}:S?{type:"menubar",context:S}:N&&!w?{type:"context-menu",context:N}:{type:void 0},[N,w,S,R]),T=hD({open:d,openProp:o,activeTriggerId:y,triggerIdProp:E,parent:A});T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",E),T.useContextCallback("onOpenChangeComplete",c);const z=Do(),M=Do(),P=T.useState("floatingTreeRoot"),L=nC(P),I=eo(),D=T.useState("open"),$=T.useState("activeTriggerElement"),q=T.useState("positionerElement"),G=T.useState("hoverEnabled"),U=T.useState("disabled"),V=T.useState("lastOpenChangeReason"),X=T.useState("parent"),Q=T.useState("activeIndex"),W=T.useState("payload"),B=T.useState("floatingParentNodeId"),K=x.useRef(null),ee=x.useRef(X.type!=="context-menu"),F=Rn(),ne=x.useRef(!0),Z=Rn(),fe=B!=null,{openMethod:Y,triggerProps:oe}=JC(D);T.useSyncedValues({disabled:f,highlightItemOnHover:k,modal:X.type===void 0?m:void 0,openMethod:Y,rootId:z}),s_(T);const{forceUnmount:ve}=a_(D,T,()=>{T.set("allowMouseEnter",!1)});Pe(()=>{N&&!w?T.update({parent:{type:"context-menu",context:N},floatingNodeId:L,floatingParentNodeId:I}):w&&T.update({floatingNodeId:L,floatingParentNodeId:I})},[N,w,L,I,T]),x.useEffect(()=>{if(D||(K.current=null),X.type==="context-menu"){if(!D){F.clear(),ee.current=!1;return}F.start(500,()=>{ee.current=!0})}},[F,D,X.type]),Pe(()=>{!D&&!G&&T.set("hoverEnabled",!0)},[D,G,T]);const ie=He((Ce,Qe)=>{const Ge=Qe.reason;if(!Ce&&!T.select("open")||D===Ce&&Qe.trigger===$&&V===Ge)return;const it=hC(Qe);if(!Ce&&Qe.trigger==null&&(Qe.trigger=$??void 0),i?.(Ce,Qe),Qe.isCanceled)return;T.state.floatingRootContext.dispatchOpenChange(Ce,Qe);const Tt=Qe.event;if(Ce===!1&&Tt?.type==="click"&&Tt.pointerType==="touch"&&!ne.current)return;Ce&&Ge===Vi?(ne.current=!1,Z.start(300,()=>{ne.current=!0})):(ne.current=!0,Z.clear());const _t=(Ge===gl||Ge===Fi)&&Tt.detail===0,Ct=!Ce&&(Ge===op||Ge==null),je={open:Ce,openChangeReason:Ge};K.current=Qe.event,n_(je,Ce,Qe.trigger,it()),T.update(je),X.type==="menubar"&&(Ge===Vi||Ge===Oo||Ge===En||Ge===bx||Ge===yc)?T.set("instantType","group"):_t||Ct?T.set("instantType",_t?"click":"dismiss"):T.set("instantType",void 0)}),xe=pC({popupStore:T,floatingId:M,nested:I!=null,onOpenChange:ie}),ke=xe.context.events;Pe(()=>{const Ce=({open:Qe,eventDetails:Ge})=>ie(Qe,Ge);return ke.on("setOpen",Ce),()=>{ke?.off("setOpen",Ce)}},[ke,ie]);const Re=x.useCallback(()=>{T.setOpen(!1,rt(Bb))},[T]);x.useImperativeHandle(b,()=>({unmount:ve,close:Re}),[ve,Re]);let Ae;X.type==="context-menu"&&(Ae=X.context),x.useImperativeHandle(Ae?.positionerRef,()=>q,[q]),x.useImperativeHandle(Ae?.actionsRef,()=>({setOpen:ie}),[ie]);const Ie=lp(xe,{enabled:!U,bubbles:{escapeKey:_&&X.type==="menu"},outsidePress(){return X.type!=="context-menu"||K.current?.type==="contextmenu"?!0:ee.current},externalTree:fe?P:void 0}),Oe=pp(),Te=x.useCallback(Ce=>{T.select("activeIndex")!==Ce&&T.set("activeIndex",Ce)},[T]),Ne=SC(xe,{enabled:!U,listRef:T.context.itemDomElements,activeIndex:Q,nested:X.type!==void 0,loopFocus:g,orientation:h,parentOrientation:X.type==="menubar"?X.context.orientation:void 0,rtl:Oe==="rtl",disabledIndices:ja,onNavigate:Te,openOnArrowKeyDown:X.type!=="context-menu",externalTree:fe?P:void 0,focusItemOnHover:k}),Me=x.useCallback(Ce=>{T.context.typingRef.current=Ce},[T]),De=CC(xe,{enabled:!U,listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:Q,resetMs:jz,onMatch:Ce=>{D&&Ce!==Q&&T.set("activeIndex",Ce)},onTyping:Me}),qe=x.useMemo(()=>{const Ce=Ss(De.reference,Ne.reference,Ie.reference,{onMouseMove(){T.set("allowMouseEnter",!0)}},oe);return Ce["aria-haspopup"]="menu",Ce["aria-expanded"]=D,Ce},[T,De.reference,Ne.reference,Ie.reference,oe,D]),Xe=x.useMemo(()=>{const Ce=Ss(Ne.trigger,Ie.trigger,oe);return Ce["aria-haspopup"]="menu",Ce["aria-expanded"]=!1,Ce},[Ne.trigger,Ie.trigger,oe]),me=x.useMemo(()=>Ss(dp,{id:M,role:"menu","aria-labelledby":$?.id,onMouseMove(){T.set("allowMouseEnter",!0),X.type==="menu"&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(Ce){const Qe=T.select("keyboardEventRelay");Qe&&!Ce.isPropagationStopped()&&Qe(Ce)}},De.floating,Ne.floating,Ie.floating),[$,M,X.type,T,De.floating,Ne.floating,Ie.floating]),de=Ne.item??sn;r_(T,{floatingRootContext:xe,activeTriggerProps:qe,inactiveTriggerProps:Xe,popupProps:me,itemProps:de});const Le=x.useMemo(()=>({store:T,parent:A}),[T,A]),ye=n.jsxs(BC.Provider,{value:Le,children:[j&&n.jsx(t_,{handle:j,store:T}),typeof a=="function"?a({payload:W}):a]});return X.type===void 0||X.type==="context-menu"?n.jsx(Rz,{externalTree:P,children:ye}):ye});function hD(e){return Hn(()=>new uD(e)).current}const Dd=5;function eN(e,t){const a=xD(t);return e.clientX>=a.left-Dd&&e.clientX<=a.right+Dd&&e.clientY>=a.top-Dd&&e.clientY<=a.bottom+Dd}function xD(e){const t=e.getBoundingClientRect(),a=Jt(e);if(Mb)return t;const o=a.getComputedStyle(e,"::before"),i=a.getComputedStyle(e,"::after");if(!(o.content!=="none"||i.content!=="none"))return t;const d=parseFloat(o.width)||0,f=parseFloat(o.height)||0,m=parseFloat(i.width)||0,g=parseFloat(i.height)||0,h=Math.max(t.width,d,m),b=Math.max(t.height,f,g),_=h-t.width,j=b-t.height;return{left:t.left-_/2,right:t.right+_/2,top:t.top-j/2,bottom:t.bottom+j/2}}function tN(e={}){const{highlightItemOnHover:t,highlightedIndex:a,onHighlightedIndexChange:o}=hp(),{ref:i,index:c}=ou(e),d=a===c,f=x.useRef(null),m=rr(i,f);return{compositeProps:{tabIndex:d?0:-1,onFocus(){o(c)},onMouseMove(){const h=f.current;if(!t||!h)return;const b=h.hasAttribute("disabled")||h.ariaDisabled==="true";!d&&!b&&h.focus()}},compositeRef:m,index:c}}function bD(e){const{render:t,className:a,style:o,state:i=sn,props:c=ja,refs:d=ja,metadata:f,stateAttributesMapping:m,tag:g="div",...h}=e,{compositeProps:b,compositeRef:_}=tN({metadata:f});return Et(g,e,{state:i,ref:[_,...d],props:[b,...c,h],stateAttributesMapping:m})}function nN(e){if(Gt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid");if(!Ja(e))return nN(ar(e))}function _D(e,t){const a=x.useRef(null);function o(c){Gs.flushSync(()=>{e.setOpen(!1,rt(Oo,c.nativeEvent,c.currentTarget))}),az(a.current)?.focus()}function i(c){const d=e.select("positionerElement");if(d&&Gi(c,d))e.context.beforeContentFocusGuardRef.current?.focus();else{Gs.flushSync(()=>{e.setOpen(!1,rt(Oo,c.nativeEvent,c.currentTarget))});let f=sz(e.context.triggerFocusTargetRef.current||t.current);for(;f!==null&&Ze(d,f);){const m=f;if(f=Gb(f),f===m)break}f?.focus()}}return{preFocusGuardRef:a,handlePreFocusGuardFocus:o,handleFocusTargetFocus:i}}function vD(e){const{enabled:t=!0,mouseDownAction:a,open:o}=e,i=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:c=>{(a==="open"&&!o||a==="close"&&o)&&(i.current=!0,vt(c.currentTarget).addEventListener("click",()=>{i.current=!1},{once:!0}))},onClick:c=>{i.current&&(i.current=!1,c.preventBaseUIHandler())}}:sn,[t,a,o])}const yD=xS(function(t,a){const{render:o,className:i,style:c,disabled:d=!1,nativeButton:f=!0,id:m,openOnHover:g,delay:h=100,closeDelay:b=0,handle:_,payload:j,...E}=t,y=Fo(!0),N=vC(_)??y?.store;if(!N)throw new Error(gn(85));const w=ra(m),S=N.useState("isTriggerActive",w),R=N.useState("floatingRootContext"),A=N.useState("isOpenedByTrigger",w),T=N.useState("triggerPopupId",w),z=x.useRef(null),M=kD(),P=hp(!0),L=to(),I=x.useMemo(()=>L??new Wb,[L]),D=nC(I),$=eo(),{registerTrigger:q,isMountedByThisTrigger:G}=xC(w,z,N,{payload:j,closeDelay:b,parent:M,floatingTreeRoot:I,floatingNodeId:D,floatingParentNodeId:$,keyboardEventRelay:P?.relayKeyboardEvent}),U=M.type==="menubar",V=N.useState("disabled"),X=d||V||U&&M.context.disabled,{getButtonProps:Q,buttonRef:W}=no({disabled:X,native:f});x.useEffect(()=>{!A&&M.type===void 0&&(N.context.allowMouseUpTriggerRef.current=!1)},[N,A,M.type]);const B=x.useRef(null),K=Rn(),ee=He(Me=>{if(!B.current)return;K.clear(),N.context.allowMouseUpTriggerRef.current=!1;const De=Me.target;Ze(B.current,De)||Ze(N.select("positionerElement"),De)||De===B.current||De!=null&&nN(De)===N.select("rootId")||eN(Me,B.current)||I.events.emit("close",{domEvent:Me,reason:kS})});x.useEffect(()=>{A&&N.select("lastOpenChangeReason")===En&&vt(B.current).addEventListener("mouseup",ee,{once:!0})},[A,ee,N]);const F=U&&M.context.hasSubmenuOpen,Z=wC(R,{enabled:(g??F)&&!X&&(!U||F&&!G),handleClose:NC({blockPointerEvents:!U}),mouseOnly:!0,move:!1,restMs:M.type===void 0?h:void 0,delay:{close:b},triggerElementRef:z,externalTree:I,isActiveTrigger:S,isClosing:()=>N.select("transitionStatus")==="ending"}),fe=jD(A,N.select("lastOpenChangeReason")),Y=sC(R,{enabled:!X,event:A&&U?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:M.type===void 0?fe:!1}),oe=yC(R,{enabled:!X&&F}),ve=vD({open:A,enabled:U,mouseDownAction:"open"}),ie=x.useMemo(()=>Ss(oe.reference,Y.reference),[oe.reference,Y.reference]),xe=N.useState("triggerProps",G),{preFocusGuardRef:ke,handlePreFocusGuardFocus:Re,handleFocusTargetFocus:Ae}=_D(N,z),Ie={disabled:X,open:A},Oe=[B,a,W,q,z],Te=[ie,Z??sn,xe,{"aria-haspopup":"menu","aria-controls":T,id:w,onMouseDown:Me=>{if(N.select("open"))return;K.start(200,()=>{N.context.allowMouseUpTriggerRef.current=!0}),vt(Me.currentTarget).addEventListener("mouseup",ee,{once:!0})}},U?{role:"menuitem"}:{},ve,E,Q],Ne=Et("button",t,{enabled:!U,stateAttributesMapping:wx,state:Ie,ref:Oe,props:Te});return U?n.jsx(bD,{tag:"button",render:o,className:i,style:c,state:Ie,refs:Oe,props:Te,stateAttributesMapping:wx}):A?n.jsxs(x.Fragment,{children:[n.jsx(el,{ref:ke,onFocus:Re},`${w}-pre-focus-guard`),n.jsx(x.Fragment,{children:Ne},w),n.jsx(el,{ref:N.context.triggerFocusTargetRef,onFocus:Ae},`${w}-post-focus-guard`)]}):n.jsx(x.Fragment,{children:Ne},w)});function jD(e,t){const a=Rn(),[o,i]=x.useState(!1);return Pe(()=>{e&&t===En?(i(!0),a.start(kz,()=>{i(!1)})):e||(a.clear(),i(!1))},[e,t,a]),o}function kD(){const e=ZC();return x.useMemo(()=>e?{type:"menubar",context:e}:{type:void 0},[e])}function sN(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function y_({...e}){return n.jsx(gD,{"data-slot":"dropdown-menu",...e})}function j_({...e}){return n.jsx(yD,{"data-slot":"dropdown-menu-trigger",...e})}function k_({align:e="start",alignOffset:t=0,side:a="bottom",sideOffset:o=4,className:i,...c}){return n.jsx(U6,{children:n.jsx(eD,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:a,sideOffset:o,children:n.jsx(B6,{"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",i),...c})})})}function af({className:e,inset:t,variant:a="default",...o}){return n.jsx(O6,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,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 wD({...e}){return n.jsx(nD,{"data-slot":"dropdown-menu-radio-group",...e})}function SD({className:e,children:t,inset:a,...o}){return n.jsxs(aD,{"data-slot":"dropdown-menu-radio-item","data-inset":a,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:[n.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:n.jsx(rD,{children:n.jsx(Yr,{})})}),t]})}const CD={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",refresh:"Refrescar",view_all:"Ver todo",saved:"Guardado.",deleted:"Eliminado.",pager_prev:"Anterior",pager_next:"Siguiente",pager_page:"Página {page} de {total}",pager_range:"{from}–{to} de {total}",pager_per_page:"Por página"},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",web:"Web"}},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."},inbox:{title:"Bandeja de agentes",subtitle:"Cada agente como una conversación, lo más reciente primero.",empty:"Todavía no hablaste con ningún agente.",pinned:"principal",show_quiet:"Ver los que no hablaron",no_reply_yet:"(sin respuestas todavía)"},settings:{title:"Settings",subtitle:"Preferencias del panel + diagnóstico del daemon local.",appearance:"Apariencia",light_mode:"Claro",dark_mode:"Oscuro",system_mode:"Sistema",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",modules_section:"Módulos",advanced_section:"Avanzado",tabs:{identity:"Identidad",super_agent:"Super-agente",profile:"Perfil del agente",engines:"Engines & modelos",telegram:"Telegram",devices:"Dispositivos",advanced:"Avanzado"},profile:{title:"Perfil del agente",subtitle:"Un oficio instalable para el super-agente: qué hace con su día y cuándo te habla. Distinto del nombre del agente (eso está en Identidad).",active_hint:"Hay un perfil activo: su bloque viaja en cada turno de cada canal. Desactivalo para volver a vanilla.",vanilla_hint:"No hay ningún perfil activo. APX se comporta exactamente como siempre — el prompt del super-agente es idéntico al de una instalación limpia.",none_available:"No hay perfiles disponibles todavía.",active:"activo",activate:"Activar",replace_active:"Reemplazar el activo",deactivate:"Desactivar",deactivate_title:"¿Desactivar el perfil?",deactivate_confirm:"APX vuelve a vanilla. Las rutinas del perfil se deshabilitan pero no se borran, y tu configuración, tareas y memoria quedan intactas: volver a activarlo restaura todo.",activated:"Perfil activo",deactivated:"Perfil desactivado — APX está en vanilla",token_cost:"Costo de prompt",over_budget:"excede su presupuesto declarado",settings_title:"Configuración del perfil",settings_subtitle:"Los valores en blanco toman el default del paquete. Cambiar un horario reprograma la rutina de verdad.",saved:"Configuración guardada",saved_with_routines:"Configuración guardada y rutinas reprogramadas",doctor_title:"Diagnóstico",doctor_clean:"Todo en orden.",preview_title:"Bloque de prompt",preview_subtitle:"Exactamente lo que recibe el modelo, con tus valores ya sustituidos.",preview_empty:"(vacío)",preview_inactive:"Esto es lo que recibiría el modelo si activaras este perfil.",no_settings:"Este perfil no tiene nada configurable.",settings_locked:"Activá el perfil para poder cambiar su configuración.",doctor_vanilla:"Sin perfil activo. APX se comporta como siempre."},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:"Detectado automáticamente — buscá para cambiar.",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",artifacts:"Artifacts",vars:"Variables",logs:"Logs",memories:"Memorias",structure:"Estructura",docs:"Docs",files:"Archivos"},sections:{workspace:"Workspace",content:"Contenido",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",routines_active:"Rutinas activas",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"abrir",roster:"Equipo",no_agents:"Todavía no hay agentes.",orchestrators:"Orquestadores",specialists:"Especialistas",recent_tasks:"Tasks recientes",no_activity:"No hay tasks abiertas.",brain_title:"Cerebro del equipo",brain_desc:"El mapa completo de agentes — los orquestadores en el núcleo y sus especialistas en racimo alrededor. Clic en un nodo para abrirlo.",brain_core:"Equipo"},artifacts:{title:"Artifacts",subtitle:"Scripts y archivos reutilizables guardados en el proyecto. Los crean los agentes; podés verlos, ejecutarlos, renombrarlos o eliminarlos."},chat:{title:"Chat con agente",subtitle:"Chat directo con el agente del proyecto.",live_title:"Chat con {agent}",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.",thread_subtitle:"Historial con {persona} en {channel}. Si respondés acá, la conversación sigue desde la web.",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",new_session:"Nueva sesión",delete:"Borrar",delete_confirm_title:"Borrar chat",delete_confirm_desc:"Esta acción no se puede deshacer. Se elimina para siempre el historial de este chat.",deleted:"Chat borrado.",meta_created:"Creado {date} · {channel}",meta_new:"Chat nuevo · {channel}",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",pick_agent:"Elegí un agente"}},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:{any_status:"cualquier estado",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}",conflict_detail:"{name} está definido en {winner} y {loser}. Se usa {winner}; {loser} queda ignorado.",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",source_runtime:"Runtime",source_apc:"APC / Shared",source_claude:"Claude",source_codex:"Codex",source_cursor:"Cursor",source_vscode:"VS Code",source_roo:"Roo",source_gemini:"Gemini",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",tools_count:"{n} tools",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.",tab_settings:"Settings",tab_project:"Project"},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:{sidebar_title:"Memorias",general_group:"General",general_item:"Memoria del proyecto",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
762
-
763
- 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_desc_scoped:"Sesiones en la carpeta de este proyecto ({path}), todos los engines, más nuevas primero.",sessions_all:"Todos los engines",sessions_empty:"Sin sesiones.",sessions_error:"No pude leer las sesiones: {msg}",sessions_search_ph:"Buscar sesiones…",sessions_deep:"Profundo",sessions_deep_tip:"También busca dentro de los transcripts (más lento)",sessions_clear:"Limpiar filtros",sessions_refresh:"Refrescar lista",sessions_no_match:"Ninguna sesión coincide con «{q}».",sessions_act_cmd:"Copiar comando apx",sessions_act_ask:"Pedir a {name} que continúe",sessions_act_folder:"Abrir carpeta",sessions_act_path:"Copiar ruta",sessions_cmd_copied:"Comando copiado — pegalo en tu terminal",sessions_path_copied:"Ruta copiada",sessions_copy_failed:"No se pudo copiar",sessions_no_folder:"Esta sesión no tiene carpeta",sessions_no_path:"Esta sesión no tiene ruta",sessions_folder_failed:"No se pudo abrir la carpeta: {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",artifacts_preview:"Previsualizar",artifacts_preview_hint:"Abrir una previsualización en vivo en una pestaña local",artifacts_share:"Compartir",artifacts_share_hint:"Crear una URL pública por túnel para compartir esta preview",artifacts_stop_preview:"Detener preview",artifacts_preview_local:"Preview local",artifacts_preview_public:"URL pública",artifacts_copy_url:"Copiar URL",artifacts_preview_started:"Preview activa en {url}",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",open_config:"Configuració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",preview_badge:"Vista previa",preview_title:"Deck — Próximamente",preview_body:"El módulo Deck todavía está en desarrollo y no fue lanzado aún. Lo volveremos a activar cuando Deck salga en una versión estable. Por ahora todo acá es de solo lectura y no se guardará ningún cambio."},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.'},routing_panel:{title:"Ruteo por contenido",description:"Elegí un modelo distinto por mensaje según su contenido (imagen, tamaño, canal, keywords). Aparte de la cadena de fallback de arriba.",signal_on:"Ruteo por contenido: ON ({n} reglas)",signal_on_empty:"Ruteo por contenido: ON (todavía sin reglas)",signal_off:"Ruteo por contenido: OFF",how_it_works:"¿Cómo funciona?",enable_label:"Activar ruteo por contenido",rules_title:"Reglas de ruteo",rules_desc:"Se evalúan de arriba hacia abajo; gana la primera regla que cumpla todas sus condiciones.",rules_empty:"Todavía sin reglas. Agregá algunas en el editor.",edit_rules:"Editar reglas (JSON)",hide_editor:"Ocultar editor",editor_label:"Reglas (array JSON)",json_hint:"Array de { model, when }. Claves de when: has_image, min_prompt_chars, max_prompt_chars, min_context_chars, channels[], keywords[]. when vacío = matchea todos los mensajes.",json_error:"JSON inválido: {msg}",json_not_array:"Las reglas tienen que ser un array JSON.",insert_example:"Insertar un ejemplo",when_any:"cualquier mensaje",when_image:"tiene imagen",when_no_image:"sin imagen",when_min_prompt:"prompt ≥ {n} chars",when_max_prompt:"prompt ≤ {n} chars",when_min_context:"contexto ≥ {n} chars",when_channels:"canales: {list}",when_keywords:"keywords: {list}",helper:"El ruteo elige un modelo por mensaje (imagen, tamaño, canal, keywords). Se compone con el failover: un modelo ruteado que esté caído cae por la cadena. Un override de modelo explícito por request siempre gana.",save:"Guardar ruteo",saved:"Guardado",saved_toast:"Ruteo por contenido guardado.",confirm_title:"¿Aplicar los cambios de ruteo?",confirm_body:"Esto cambia qué modelo atiende cada mensaje. El failover sigue aplicando si un modelo ruteado está caído.",confirm_on:"El ruteo por contenido va a quedar ON con {n} reglas.",confirm_off:"El ruteo por contenido va a quedar OFF (cada mensaje usa el router default).",confirm_apply:"Aplicar",cancel:"Cancelar"},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",ctx_files:"archivos",ctx_actors:"{n} agentes/modelos",ctx_turns:"{n} turnos"},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.",base_url_label:"Base URL (opcional)",base_url_hint:"Endpoint compatible con OpenAI. Vacío = OpenAI. Apuntalo a un servidor local (ej. un daemon QVox / Qwen3-TTS) para usar ese en su lugar.",openai_model_hint:"tts-1 / tts-1-hd para OpenAI. Dejalo vacío para que un servidor custom elija.",openai_voice_hint:"Preset de OpenAI (alloy…) o preset de tu servidor custom (ej. custom). Vacío = default del servidor.",openai_style_hint:"Voz base / instruct, usada por endpoints custom (la persona que se mantiene en todo el audio). El tts-1 de OpenAI la ignora.",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",temperature_label:"Temperatura (opcional)",temperature_hint:"Temperatura de sampleo para endpoints custom. Vacío = default del servidor.",emotions_short:"Emociones",emotions_label:"Tags de emoción inline",emotions_hint:"Cuando hable este motor, deja que el agente meta tags tipo [happy]/[whisper] en las respuestas de voz para darles color. Activalo solo si este motor entiende los tags (ej. un endpoint QVox/Qwen3-TTS) — si no, se quitan antes de sintetizar.",emotions_tags_label:"Tags permitidos",emotions_tags_hint:"Separados por coma. Vacío = el set por defecto.",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",badge_custom:"custom",set_as_default:"Usar como default",configure:"Configurar",remove:"Quitar",remove_confirm:"¿Quitar este proveedor custom?",add_provider:"Agregar proveedor",new_provider:"Nuevo proveedor",custom_note:"Endpoint custom compatible con OpenAI.",custom_desc:"Cualquier endpoint de voz compatible con OpenAI (ej. un servidor local QVox / Qwen3-TTS).",label_label:"Nombre",label_hint:"Nombre para mostrar de este proveedor.",base_url_req_label:"Base URL",base_url_req_hint:"Requerido. El endpoint compatible con OpenAI, ej. http://127.0.0.1:5111/v1",api_key_optional_hint:"Opcional — solo si tu servidor pide key.",advanced:"Avanzado",custom_model_hint:"Opcional. La mayoría de los servidores locales lo ignoran (ej. QVox).",custom_voice_hint:"Opcional. Un preset que entienda tu servidor (ej. custom). Vacío = default del servidor.",custom_optional_ph:"(opcional)",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 remoto)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",stt_provider_custom:"Custom — server OpenAI-compatible",stt_openai_model_label:"Modelo OpenAI",stt_openai_model_hint:"Por defecto whisper-1.",stt_custom_baseurl_label:"URL base (OpenAI-compatible)",stt_custom_baseurl_hint:"Ej: http://localhost:8000/v1 (mlx-audio en Metal) o http://192.168.1.50:9000/v1 (Radeon/NVIDIA en la red).",stt_custom_model_label:"Modelo",stt_custom_model_hint:"Ej: mlx-community/whisper-large-v3-turbo o large-v3.",stt_custom_key_hint:"Opcional — la mayoría de los servers locales no requieren key.",stt_hw_label:"Hardware detectado",stt_hw_recommended:"Recomendado",stt_hw_limited:"aceleración GPU limitada, se usa CPU",stt_backend_label:"Aceleración / Motor",stt_backend_hint:"Auto elige según tu hardware. Metal corre en la GPU (mlx); CPU usa faster-whisper.",stt_backend_auto:"Automático (recomendado)",stt_model_needs_download:"Falta descargar (~{size}). Hay que bajar el modelo para usar este motor.",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, en orden de fallback. El estado lo reporta el daemon en vivo. Agregá tus propios endpoints compatibles con OpenAI.",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_provider_removed:"Proveedor eliminado.",err_label_required:"Falta el nombre.",err_base_url_required:"Falta la base URL.",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_form:{emoji:"Emoji",area:"Área",role:"Rol",no_role:"— sin rol —",autonomy:"Autonomía",autonomy_hint:"Cuánto puede hacer el agente sin pedir confirmación.",auto_total:"Total",auto_automatico:"Auto",auto_permiso:"Permiso"},structure:{title:"Estructura",subtitle:"Áreas y roles de la empresa. Las áreas agrupan agentes; los roles definen su función.",info:"Las áreas son agrupaciones opcionales. Los roles definen la función de un agente y pueden pertenecer a un área.",empty:"Todavía no hay áreas ni roles. Creá el primero arriba.",new_area:"Nueva área",new_role:"Nuevo rol",edit_area:"Editar área",edit_role:"Editar rol",create_area:"Crear área",create_role:"Crear rol",name:"Nombre",slug:"Slug",goal:"Objetivo",goal_hint:"Para qué existe esta área (opcional).",area:"Área",description:"Descripción",no_area:"— sin área —",roles:"Roles",add_role:"rol",no_roles:"sin roles",general_roles:"Roles generales",delete_area:"Borrar área",delete_role:"Borrar rol",delete_area_desc:'¿Borrar el área "{name}"? Sus roles quedan sin área, no se eliminan.',delete_role_desc:'¿Borrar el rol "{name}"?'},files:{docs_label:"Docs",files_label:"Archivos",new_doc:"Nuevo documento",new_doc_hint:"Podés usar carpetas: cases/onboarding/spec.md",empty:"No hay archivos.",docs_empty:"Todavía no hay documentación. Creá el primer documento.",truncated:"Listado recortado (demasiados archivos).",select_prompt:"Elegí un archivo para verlo.",save:"Guardar",saved:"Guardado.",deleted:"Eliminado.",created:"Documento creado.",edit:"Editar",preview:"Preview",discard:"Descartar",no_preview:"No hay preview para este archivo.",too_large:"Archivo demasiado grande para mostrar.",path_label:"Ruta del archivo",path_example:"ej. cases/onboarding/spec.md",create:"Crear"},tasks:{state_open:"abiertas",state_done:"hechas",state_dropped:"descartadas",status_pending:"pendiente",status_running:"corriendo",status_in_review:"en revisión",status_blocked:"bloqueada",done_label:"hecha",dropped_label:"descartada",detail_title:"Detalle de task",field_title:"Título",field_prompt:"Prompt",field_status:"Estado",field_agent:"Agente",field_creator:"Creada por",field_source:"Origen",field_created:"Creada",field_updated:"Actualizada",field_done:"Completada",prompt_ph:"Descripción / prompt de la task…",toggle_prompt:"Prompt",view_thread:"Ver conversación",mark_done:"Completar"},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",uncategorized:"Sin categoría",brain_zoom_in:"Acercar",brain_zoom_out:"Alejar",brain_fit:"Ajustar a la vista",brain_fullscreen:"Pantalla completa",brain_exit_fs:"Salir de pantalla completa",brain_pan_hint:"scroll para zoom · arrastrá el fondo para mover",brain_expand:"Expandir cerebros",brain_collapse:"Colapsar",brain_open:"Abrir",brain_part_of:"Parte de",brain_branches:"Ramas",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_system:"Sistema",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_start:"Iniciar",desktop_stop:"Detener",desktop_restart:"Reiniciar",desktop_restart_hint:"Recarga la ventana abierta para aplicar ya los cambios de config (tema, posición).",desktop_restart_done:"Reiniciando la ventana — aplicando la última config.",desktop_restart_none:"No hay ninguna ventana de desktop conectada.",desktop_start_done:"Ventana de desktop iniciada.",desktop_start_already:"La ventana de desktop ya estaba corriendo.",desktop_stop_done:"Ventana de desktop detenida.",desktop_stop_none:"No había ninguna ventana de desktop corriendo.",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:"Hacé clic en el campo y apretá tu combinación de teclas. Reiniciá la ventana para aplicar.",desktop_shortcut_record:"Hacé clic para definir un atajo",desktop_shortcut_recording:"Apretá tu combinación…",desktop_shortcut_change:"clic para cambiar",desktop_shortcut_esc:"Esc para cancelar",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"},skills_page:{title:"Skills",desc:"Activá o desactivá qué skills carga cada agente. Elegí el scope: el super-agent (global) o un proyecto puntual.",list_title:"Skills instaladas",list_desc:"Las privadas de APX están siempre activas y no se pueden tocar.",scope_label:"Scope",scope_super_agent:"Super-agent (global)",scope_hint:"El super-agent usa el scope global. Cada proyecto puede sobrescribir skills de forma independiente.",count_label:"{n} skills · {on} activas",empty:"No hay skills. Creá una abajo o instalá con la CLI.",source_builtin:"APX",source_global:"Global",source_project:"Proyecto",private_badge:"Privada",private_hint:"Skill interna de APX — siempre activa, no se puede desactivar ni borrar.",overridden_badge:"Override",inherited_hint:"Heredada del global",reset_to_global:"Volver al global",on:"activa",off:"inactiva",toggle_failed:"No se pudo cambiar el estado: {msg}",add_title:"Agregar skill",add_desc:"Crea una skill de usuario en ~/.apx/skills/<slug>/SKILL.md. Queda disponible para todos los scopes.",add_slug_label:"Slug",add_slug_ph:"mi-skill",add_desc_label:"Descripción",add_desc_ph:"Una línea que explique cuándo usarla",add_body_label:"Cuerpo (Markdown)",add_body_ph:`# Mi skill
764
-
765
- Instrucciones para el agente…`,add_btn:"Crear skill",created_ok:'Skill "{slug}" creada.',create_failed:"No se pudo crear: {msg}",delete_btn:"Borrar",delete_confirm:'¿Borrar la skill "{slug}"? No se puede deshacer.',deleted_ok:'Skill "{slug}" borrada.',delete_failed:"No se pudo borrar: {msg}",inspector_section_title:"Skill Inspector (RAG por turno)",inspector_section_desc:"Config avanzada: RAG local que inyecta solo las skills que el mensaje necesita.",scope_ph:"— elegir scope —",select_a_skill:"Elegí una skill de la lista para ver su contenido.",added_by:"Agregado por",activator:"Activador",by_apx:"APX (built-in)",by_you:"Vos",activator_value:"Coincidencia semántica (RAG)",tab_preview:"Vista",tab_source:"Fuente",add_menu:"Agregar",add_online:"Crear con el editor",add_online_hint:"Escribí slug + descripción + contenido",add_zip:"Subir .zip",add_zip_hint:"Importar una skill empaquetada",add_repo:"Desde repo git",add_repo_hint:"Clonar desde una URL",create_dialog_title:"Crear skill",repo_dialog_title:"Importar desde repo git",repo_url_label:"URL del repo",repo_url_ph:"https://github.com/usuario/mi-skill.git",repo_url_hint:"El repo (o su subcarpeta) debe tener un SKILL.md.",import_btn:"Importar",imported_ok:'Skill "{slug}" importada.',import_failed:"No se pudo importar: {msg}",cancel:"Cancelar",manager_tab:"Skills",rag_tab:"Config (RAG)"},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."},integrations:{title:"Integrations",description:"Plugins y tools disponibles para este proyecto",tab_plugins:"Plugins",tab_tools:"Tools",scope_label:"Ámbito:",scope_project:"Este proyecto",scope_global:"Global (default)",plugins_hint:"Plugins de canal y servicio instalables por proyecto. Se guardan en el ámbito seleccionado arriba.",more_soon:"Más plugins próximamente…",tools_hint:"Tools que los plugins conectados exponen a los agentes de este proyecto.",tools_empty:"No hay tools de integraciones. Conectá un plugin para habilitarlas.",tool_active:"activo",tool_inactive:"inactivo",status_active:"Activo",status_error:"Error",status_unconfigured:"No configurado",connected:"Conectado",connect:"Conectar",deactivate:"Desactivar",saving:"Guardando...",validating:"Validando...",verifying:"Verificando token...",confirm:"Confirmar",select_placeholder:"Seleccionar...",reveal:"Ver",hide:"Ocultar",credentials:"Credenciales {name}",coming_soon:"Próximamente",coming_soon_body:"Este plugin está declarado en el catálogo pero todavía no está conectable en APX. Se va a portar de forma nativa en una próxima iteración.",tools_for_agents:"Tools para agentes",tools_available_note:"Disponibles para los agentes que las tengan permitidas, o vía discover_tools.",err_connect:"Error al conectar",err_generic:"Ocurrió un error",action_done:"Listo",asana:{select_label:"Seleccioná el workspace a usar",connected:{user_name:"Conectado como",user_email:"Email",workspace_name:"Workspace"},fields:{personal_access_token:{label:"Personal Access Token",help_label:"¿Cómo obtener el token?",help_steps:`Abrí app.asana.com/0/my-apps en el navegador.
766
- Bajá hasta la sección "Personal access tokens" (no tus apps OAuth).
767
- Hacé clic en "+ New access token".
768
- Dale un nombre y confirmá.
769
- Copiá el token completo — empieza con "1/..." y tiene un ":" en el medio.
770
- Pegalo en el campo de abajo.`}}},github:{connected:{user_login:"Conectado como",user_name:"Nombre"},fields:{token:{label:"Personal Access Token",help_label:"¿Cómo obtener el token?",help_steps:`Abrí github.com/settings/tokens.
771
- Generá un token (classic o fine-grained) con scope "repo".
772
- Copiá el token — empieza con ghp_ o github_pat_.
773
- Pegalo en el campo de abajo.`}}},obsidian:{connected:{vault_path:"Vault",vault_name:"Nombre",note_count:"Notas"},fields:{vault_path:{label:"Ruta del Vault"},auto_mcp:{label:"Registrar MCP de Obsidian",hint:"Agrega un MCP 'obsidian' apuntando a este vault, en este scope."},memory_sync:{label:"Sincronizar memoria de APX",hint:"Habilita el respaldo de la memoria de APX en el vault; luego usá el botón de abajo."}},actions:{sync_memory:"Sincronizar memoria",sync_memory_done:"Sincronizados {count} archivo(s) · {changed} cambiados"}}}},ND={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",refresh:"Refresh",view_all:"View all",saved:"Saved.",deleted:"Deleted.",pager_prev:"Previous",pager_next:"Next",pager_page:"Page {page} of {total}",pager_range:"{from}–{to} of {total}",pager_per_page:"Per page"},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",web:"Web"}},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."},inbox:{title:"Agent inbox",subtitle:"Every agent as a conversation, most recent first.",empty:"You have not talked to any agent yet.",pinned:"lead",show_quiet:"Show quiet agents",no_reply_yet:"(no replies yet)"},settings:{title:"Settings",subtitle:"Panel preferences + local daemon diagnostics.",appearance:"Appearance",light_mode:"Light",dark_mode:"Dark",system_mode:"System",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",modules_section:"Modules",advanced_section:"Advanced",tabs:{identity:"Identity",super_agent:"Super-agent",profile:"Agent profile",engines:"Engines & models",telegram:"Telegram",devices:"Devices",advanced:"Advanced"},profile:{title:"Agent profile",subtitle:"An installable line of work for the super-agent: what it does with its day and when it speaks to you. Distinct from the agent's name (that lives under Identity).",active_hint:"A profile is active: its block ships on every turn of every channel. Deactivate to go back to vanilla.",vanilla_hint:"No profile is active. APX behaves exactly as it always has — the super-agent prompt is identical to a clean install.",none_available:"No profiles available yet.",active:"active",activate:"Activate",replace_active:"Replace the active one",deactivate:"Deactivate",deactivate_title:"Deactivate the profile?",deactivate_confirm:"APX goes back to vanilla. The profile's routines are disabled but not deleted, and your settings, tasks and memory are untouched — activating it again restores everything.",activated:"Profile active",deactivated:"Profile off — APX is back to vanilla",token_cost:"Prompt cost",over_budget:"over its declared budget",settings_title:"Profile settings",settings_subtitle:"Blank fields fall back to the package default. Changing a time really reschedules the routine.",saved:"Settings saved",saved_with_routines:"Settings saved and routines rescheduled",doctor_title:"Doctor",doctor_clean:"All good.",preview_title:"Prompt block",preview_subtitle:"Exactly what reaches the model, with your values substituted.",preview_empty:"(empty)",preview_inactive:"This is what the model would receive if you activated this profile.",no_settings:"This profile has nothing to configure.",settings_locked:"Activate the profile to change its settings.",doctor_vanilla:"No profile active. APX behaves as it always has."},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:"Auto-detected — search to change.",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",artifacts:"Artifacts",vars:"Variables",logs:"Logs",memories:"Memories",structure:"Structure",docs:"Docs",files:"Files"},sections:{workspace:"Workspace",content:"Content",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",routines_active:"Active routines",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"open",roster:"Team",no_agents:"No agents yet.",orchestrators:"Orchestrators",specialists:"Specialists",recent_tasks:"Recent tasks",no_activity:"No open tasks.",brain_title:"Team brain",brain_desc:"The whole agent map — orchestrators at the core, their specialists clustered around them. Click a node to open it.",brain_core:"Team"},artifacts:{title:"Artifacts",subtitle:"Reusable scripts and files stored under the project. Agents create them; you can view, run, rename or delete them."},chat:{title:"Chat with agent",subtitle:"Direct conversations with project agents. The super-agent does not intervene.",live_title:"Chat with {agent}",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.",thread_subtitle:"History with {persona} on {channel}. Replying here continues the conversation from the web.",empty:"Send a message to start the conversation.",placeholder:"Type something and press enter to send (shift+enter = new line)",send:"Send",stop:"Stop",new_session:"New session",delete:"Delete",delete_confirm_title:"Delete chat",delete_confirm_desc:"This can't be undone. This chat's history will be permanently deleted.",deleted:"Chat deleted.",meta_created:"Created {date} · {channel}",meta_new:"New chat · {channel}",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",pick_agent:"Pick an agent"}},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:{any_status:"any status",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}",conflict_detail:"{name} is defined in {winner} and {loser}. APX uses {winner}; {loser} is ignored.",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",tools_count:"{n} tools",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",source_runtime:"Runtime",source_apc:"APC / Shared",source_claude:"Claude",source_codex:"Codex",source_cursor:"Cursor",source_vscode:"VS Code",source_roo:"Roo",source_gemini:"Gemini",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.",tab_settings:"Settings",tab_project:"Project"},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:{sidebar_title:"Memories",general_group:"General",general_item:"Project memory",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
774
-
775
- 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_desc_scoped:"Sessions in this project's folder ({path}), all engines, newest first.",sessions_all:"All engines",sessions_empty:"No sessions.",sessions_error:"Could not read sessions: {msg}",sessions_search_ph:"Search sessions…",sessions_deep:"Deep",sessions_deep_tip:"Also search inside transcripts (slower)",sessions_clear:"Clear filters",sessions_refresh:"Refresh list",sessions_no_match:"No sessions match “{q}”.",sessions_act_cmd:"Copy apx command",sessions_act_ask:"Ask {name} to continue",sessions_act_folder:"Open folder",sessions_act_path:"Copy path",sessions_cmd_copied:"Command copied — paste it in your terminal",sessions_path_copied:"Path copied",sessions_copy_failed:"Could not copy",sessions_no_folder:"This session has no folder",sessions_no_path:"This session has no path",sessions_folder_failed:"Could not open folder: {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",artifacts_preview:"Preview",artifacts_preview_hint:"Open a live preview in a local browser tab",artifacts_share:"Share",artifacts_share_hint:"Create a public tunnel URL to share this preview",artifacts_stop_preview:"Stop preview",artifacts_preview_local:"Local preview",artifacts_preview_public:"Public URL",artifacts_copy_url:"Copy URL",artifacts_preview_started:"Preview running at {url}",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",open_config:"Configuration"},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",preview_badge:"Preview",preview_title:"Deck — Coming soon",preview_body:"The Deck module is still in development and not released yet. We'll re-enable it once Deck ships in a stable release. For now everything here is read-only and no changes will be saved."},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.'},routing_panel:{title:"Content routing",description:"Prefer a different model per message based on its content (image, size, channel, keywords). Separate from the fallback chain above.",signal_on:"Content routing: ON ({n} rules)",signal_on_empty:"Content routing: ON (no rules yet)",signal_off:"Content routing: OFF",how_it_works:"How does it work?",enable_label:"Enable content routing",rules_title:"Routing rules",rules_desc:"Evaluated top to bottom; the first rule whose conditions all match wins.",rules_empty:"No rules yet. Add some in the editor.",edit_rules:"Edit rules (JSON)",hide_editor:"Hide editor",editor_label:"Rules (JSON array)",json_hint:"Array of { model, when }. when keys: has_image, min_prompt_chars, max_prompt_chars, min_context_chars, channels[], keywords[]. Empty when = matches every message.",json_error:"Invalid JSON: {msg}",json_not_array:"The rules must be a JSON array.",insert_example:"Insert an example",when_any:"any message",when_image:"has image",when_no_image:"no image",when_min_prompt:"prompt ≥ {n} chars",when_max_prompt:"prompt ≤ {n} chars",when_min_context:"context ≥ {n} chars",when_channels:"channels: {list}",when_keywords:"keywords: {list}",helper:"Routing picks a model per message (image, size, channel, keywords). It composes with failover: a routed model that is down falls back down the chain. An explicit per-request model override always wins.",save:"Save routing",saved:"Saved",saved_toast:"Content routing saved.",confirm_title:"Apply routing changes?",confirm_body:"This changes which model handles each message. Failover still applies if a routed model is down.",confirm_on:"Content routing will be ON with {n} rules.",confirm_off:"Content routing will be OFF (every message uses the default router).",confirm_apply:"Apply",cancel:"Cancel"},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",ctx_files:"files",ctx_actors:"{n} agents/models",ctx_turns:"{n} turns"},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.",base_url_label:"Base URL (optional)",base_url_hint:"OpenAI-compatible endpoint. Empty = OpenAI. Point it at a local server (e.g. a QVox / Qwen3-TTS daemon) to use that instead.",openai_model_hint:"tts-1 / tts-1-hd for OpenAI. Leave blank to let a custom server pick.",openai_voice_hint:"OpenAI preset (alloy…) or a custom server's preset (e.g. custom). Empty = server default.",openai_style_hint:"Base voice / instruct, used by custom endpoints (the persona kept across the audio). Ignored by stock OpenAI tts-1.",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",temperature_label:"Temperature (optional)",temperature_hint:"Sampling temperature for custom endpoints. Empty = server default.",emotions_short:"Emotions",emotions_label:"Inline emotion tags",emotions_hint:"When this engine speaks, let the agent drop [happy]/[whisper]-style tags into voice replies to color the delivery. Only enable it if this engine understands the tags (e.g. a QVox/Qwen3-TTS endpoint) — otherwise they're stripped before synthesis.",emotions_tags_label:"Allowed tags",emotions_tags_hint:"Comma-separated. Empty = the default set.",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",badge_custom:"custom",set_as_default:"Set as default",configure:"Configure",remove:"Remove",remove_confirm:"Remove this custom provider?",add_provider:"Add provider",new_provider:"New provider",custom_note:"Custom OpenAI-compatible endpoint.",custom_desc:"Any OpenAI-compatible speech endpoint (e.g. a local QVox / Qwen3-TTS server).",label_label:"Name",label_hint:"Display name for this provider.",base_url_req_label:"Base URL",base_url_req_hint:"Required. The OpenAI-compatible endpoint, e.g. http://127.0.0.1:5111/v1",api_key_optional_hint:"Optional — only if your server requires a key.",advanced:"Advanced",custom_model_hint:"Optional. Most local servers ignore it (e.g. QVox).",custom_voice_hint:"Optional. A preset your server understands (e.g. custom). Empty = server default.",custom_optional_ph:"(optional)",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 remote)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",stt_provider_custom:"Custom — OpenAI-compatible server",stt_openai_model_label:"OpenAI model",stt_openai_model_hint:"Defaults to whisper-1.",stt_custom_baseurl_label:"Base URL (OpenAI-compatible)",stt_custom_baseurl_hint:"e.g. http://localhost:8000/v1 (mlx-audio on Metal) or http://192.168.1.50:9000/v1 (Radeon/NVIDIA on the LAN).",stt_custom_model_label:"Model",stt_custom_model_hint:"e.g. mlx-community/whisper-large-v3-turbo or large-v3.",stt_custom_key_hint:"Optional — most local servers need no key.",stt_hw_label:"Detected hardware",stt_hw_recommended:"Recommended",stt_hw_limited:"limited GPU acceleration, using CPU",stt_backend_label:"Acceleration / Engine",stt_backend_hint:"Auto adapts to your hardware. Metal runs on the GPU (mlx); CPU uses faster-whisper.",stt_backend_auto:"Automatic (recommended)",stt_model_needs_download:"Not downloaded (~{size}). The model must be downloaded to use this engine.",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, in fallback order. Status is reported live by the daemon. Add your own OpenAI-compatible endpoints.",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_provider_removed:"Provider removed.",err_label_required:"A name is required.",err_base_url_required:"A base URL is required.",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_form:{emoji:"Emoji",area:"Area",role:"Role",no_role:"— no role —",autonomy:"Autonomy",autonomy_hint:"How much the agent can do without asking for confirmation.",auto_total:"Total",auto_automatico:"Auto",auto_permiso:"Permission"},structure:{title:"Structure",subtitle:"Company areas and roles. Areas group agents; roles define their function.",info:"Areas are optional groupings. Roles define an agent's function and may belong to an area.",empty:"No areas or roles yet. Create the first one above.",new_area:"New area",new_role:"New role",edit_area:"Edit area",edit_role:"Edit role",create_area:"Create area",create_role:"Create role",name:"Name",slug:"Slug",goal:"Goal",goal_hint:"What this area exists for (optional).",area:"Area",description:"Description",no_area:"— no area —",roles:"Roles",add_role:"role",no_roles:"no roles",general_roles:"General roles",delete_area:"Delete area",delete_role:"Delete role",delete_area_desc:'Delete area "{name}"? Its roles are detached, not deleted.',delete_role_desc:'Delete role "{name}"?'},files:{docs_label:"Docs",files_label:"Files",new_doc:"New document",new_doc_hint:"Folders allowed: cases/onboarding/spec.md",empty:"No files.",docs_empty:"No documentation yet. Create the first document.",truncated:"Listing truncated (too many files).",select_prompt:"Pick a file to view it.",save:"Save",saved:"Saved.",deleted:"Deleted.",created:"Document created.",edit:"Edit",preview:"Preview",discard:"Discard",no_preview:"No preview for this file.",too_large:"File too large to display.",path_label:"File path",path_example:"e.g. cases/onboarding/spec.md",create:"Create"},tasks:{state_open:"open",state_done:"done",state_dropped:"dropped",status_pending:"pending",status_running:"running",status_in_review:"in review",status_blocked:"blocked",done_label:"done",dropped_label:"dropped",detail_title:"Task detail",field_title:"Title",field_prompt:"Prompt",field_status:"Status",field_agent:"Agent",field_creator:"Created by",field_source:"Source",field_created:"Created",field_updated:"Updated",field_done:"Completed",prompt_ph:"Task description / prompt…",toggle_prompt:"Prompt",view_thread:"View thread",mark_done:"Complete"},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",uncategorized:"Uncategorized",brain_zoom_in:"Zoom in",brain_zoom_out:"Zoom out",brain_fit:"Fit to view",brain_fullscreen:"Fullscreen",brain_exit_fs:"Exit fullscreen",brain_pan_hint:"scroll to zoom · drag background to pan",brain_expand:"Expand brains",brain_collapse:"Collapse",brain_open:"Open",brain_part_of:"Part of",brain_branches:"Branches",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_system:"System",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_start:"Start",desktop_stop:"Stop",desktop_restart:"Restart",desktop_restart_hint:"Reload the open window so config changes (theme, position) apply now.",desktop_restart_done:"Restarting the window — applying the latest config.",desktop_restart_none:"No desktop window is connected.",desktop_start_done:"Desktop window launched.",desktop_start_already:"Desktop window is already running.",desktop_stop_done:"Desktop window stopped.",desktop_stop_none:"No desktop window was running.",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:"Click the field and press your key combo. Restart the window to apply.",desktop_shortcut_record:"Click to set a shortcut",desktop_shortcut_recording:"Press your combo…",desktop_shortcut_change:"click to change",desktop_shortcut_esc:"Esc to cancel",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"},skills_page:{title:"Skills",desc:"Turn skills on or off per agent. Pick a scope: the super-agent (global) or a specific project.",list_title:"Installed skills",list_desc:"APX's private skills are always active and can't be changed.",scope_label:"Scope",scope_super_agent:"Super-agent (global)",scope_hint:"The super-agent uses the global scope. Each project can override skills independently.",count_label:"{n} skills · {on} on",empty:"No skills yet. Create one below or install via the CLI.",source_builtin:"APX",source_global:"Global",source_project:"Project",private_badge:"Private",private_hint:"Built-in APX skill — always active, can't be disabled or deleted.",overridden_badge:"Override",inherited_hint:"Inherited from global",reset_to_global:"Reset to global",on:"on",off:"off",toggle_failed:"Could not change state: {msg}",add_title:"Add a skill",add_desc:"Creates a user skill at ~/.apx/skills/<slug>/SKILL.md. Available across all scopes.",add_slug_label:"Slug",add_slug_ph:"my-skill",add_desc_label:"Description",add_desc_ph:"One line describing when to use it",add_body_label:"Body (Markdown)",add_body_ph:`# My skill
776
-
777
- Instructions for the agent…`,add_btn:"Create skill",created_ok:'Skill "{slug}" created.',create_failed:"Could not create: {msg}",delete_btn:"Delete",delete_confirm:`Delete skill "{slug}"? This can't be undone.`,deleted_ok:'Skill "{slug}" deleted.',delete_failed:"Could not delete: {msg}",inspector_section_title:"Skill Inspector (per-turn RAG)",inspector_section_desc:"Advanced: local RAG that injects only the skills a message needs.",scope_ph:"— choose scope —",select_a_skill:"Pick a skill from the list to see its content.",added_by:"Added by",activator:"Activator",by_apx:"APX (built-in)",by_you:"You",activator_value:"Semantic match (RAG)",tab_preview:"Preview",tab_source:"Source",add_menu:"Add",add_online:"Create with editor",add_online_hint:"Write slug + description + content",add_zip:"Upload .zip",add_zip_hint:"Import a packaged skill",add_repo:"From git repo",add_repo_hint:"Clone from a URL",create_dialog_title:"Create skill",repo_dialog_title:"Import from git repo",repo_url_label:"Repo URL",repo_url_ph:"https://github.com/user/my-skill.git",repo_url_hint:"The repo (or its subfolder) must contain a SKILL.md.",import_btn:"Import",imported_ok:'Skill "{slug}" imported.',import_failed:"Could not import: {msg}",cancel:"Cancel",manager_tab:"Skills",rag_tab:"Config (RAG)"},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."},integrations:{title:"Integrations",description:"Plugins and tools available for this project",tab_plugins:"Plugins",tab_tools:"Tools",scope_label:"Scope:",scope_project:"This project",scope_global:"Global (default)",plugins_hint:"Channel & service plugins installable per project. Saved in the scope selected above.",more_soon:"More plugins coming soon…",tools_hint:"Tools that connected plugins expose to this project's agents.",tools_empty:"No integration tools yet. Connect a plugin to enable them.",tool_active:"active",tool_inactive:"inactive",status_active:"Active",status_error:"Error",status_unconfigured:"Not configured",connected:"Connected",connect:"Connect",deactivate:"Deactivate",saving:"Saving...",validating:"Validating...",verifying:"Verifying token...",confirm:"Confirm",select_placeholder:"Select...",reveal:"Show",hide:"Hide",credentials:"{name} credentials",coming_soon:"Coming soon",coming_soon_body:"This plugin is declared in the catalog but isn't connectable in APX yet. It will be ported natively in a future iteration.",tools_for_agents:"Agent tools",tools_available_note:"Available to agents that allow them, or via discover_tools.",err_connect:"Failed to connect",err_generic:"Something went wrong",action_done:"Done",asana:{select_label:"Select the workspace to use",connected:{user_name:"Connected as",user_email:"Email",workspace_name:"Workspace"},fields:{personal_access_token:{label:"Personal Access Token",help_label:"How to get the token?",help_steps:`Open app.asana.com/0/my-apps in your browser.
778
- Scroll to the "Personal access tokens" section (not your OAuth apps).
779
- Click "+ New access token".
780
- Give it a name and confirm.
781
- Copy the full token — it starts with "1/..." and has a ":" in the middle.
782
- Paste it in the field below.`}}},github:{connected:{user_login:"Connected as",user_name:"Name"},fields:{token:{label:"Personal Access Token",help_label:"How to get the token?",help_steps:`Open github.com/settings/tokens.
783
- Generate a token (classic or fine-grained) with the "repo" scope.
784
- Copy the token — it starts with ghp_ or github_pat_.
785
- Paste it in the field below.`}}},obsidian:{connected:{vault_path:"Vault",vault_name:"Name",note_count:"Notes"},fields:{vault_path:{label:"Vault path"},auto_mcp:{label:"Auto-register Obsidian MCP",hint:"Adds an 'obsidian' MCP server pointing at this vault, in this scope."},memory_sync:{label:"Sync APX memory",hint:"Enable mirroring APX memory into the vault, then use the button below."}},actions:{sync_memory:"Sync memory now",sync_memory_done:"Synced {count} file(s) · {changed} changed"}}}},w_={es:CD,en:ND};function ED(){try{const e=localStorage.getItem(Dn.language);if(e&&e in w_)return e}catch{}return"en"}let vp=ED();function aN(e){vp=e;try{localStorage.setItem(Dn.language,e)}catch{}}const rN=[{value:"es",label:"Español"},{value:"en",label:"English"}];function S_(){return vp}function RD(e){const t=w_[vp],a=e.split(".");let o=t;for(const i of a)if(o&&typeof o=="object"&&i in o)o=o[i];else return;return typeof o=="string"?o:void 0}function TD(e,t){return t?e.replace(/\{(\w+)\}/g,(a,o)=>o in t?String(t[o]):`{${o}}`):e}function AD(e){const t=RD(e);if(t!==void 0)return t;if(vp!=="es"){const a=w_.es,o=e.split(".");let i=a;for(const c of o)if(i&&typeof i=="object"&&c in i)i=i[c];else return;return typeof i=="string"?i:void 0}}function u(e,t){const a=AD(e);return a===void 0?e:TD(a,t)}function C_(e){const[t,a]=x.useState(!1);x.useEffect(()=>{try{a(localStorage.getItem(e)==="true")}catch{}},[e]);const o=x.useCallback(()=>a(i=>{const c=!i;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:t,toggle:o}}function MD({collapsed:e,onToggle:t}){return n.jsx(Ue,{content:u(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),side:"bottom",children:n.jsx("button",{type:"button",onClick:t,"aria-label":u(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:n.jsx(oS,{className:ge("size-4 transition-transform",e&&"rotate-180")})})})}function zD({sections:e,active:t,onChange:a,collapsed:o=!1}){return n.jsx("nav",{className:ge("hidden md:flex shrink-0 flex-col gap-1 py-3 transition-all",o?"w-12 items-center px-1":"w-44 px-2"),children:e.map((i,c)=>n.jsxs("div",{className:ge("w-full",c>0&&"mt-2"),children:[!o&&i.title&&n.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:i.title}),n.jsx("div",{className:"space-y-0.5",children:i.items.map(({key:d,label:f,icon:m,badge:g,mark:h})=>{const b=t===d,_=n.jsxs("button",{type:"button",onClick:()=>a(d),"data-testid":`tabnav-${d||"index"}`,className:ge("relative flex cursor-pointer items-center rounded-lg transition-colors",o?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",b?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[n.jsx(m,{className:"size-4 shrink-0"}),o&&h&&n.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex items-center justify-center rounded-full bg-card",children:h}),!o&&n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"flex-1 truncate text-left text-xs",children:f}),h&&n.jsx("span",{className:"flex shrink-0 items-center",children:h}),g!==void 0&&n.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:g})]})]});return o?n.jsx(Ue,{content:f,side:"right",children:_},d):n.jsx(x.Fragment,{children:_},d)})})]},c))})}var bk=Object.prototype.hasOwnProperty;function Ax(e,t){var a,o;if(e===t)return!0;if(e&&t&&(a=e.constructor)===t.constructor){if(a===Date)return e.getTime()===t.getTime();if(a===RegExp)return e.toString()===t.toString();if(a===Array){if((o=e.length)===t.length)for(;o--&&Ax(e[o],t[o]););return o===-1}if(!a||typeof e=="object"){o=0;for(a in e)if(bk.call(e,a)&&++o&&!bk.call(t,a)||!(a in t)||!Ax(e[a],t[a]))return!1;return Object.keys(t).length===o}}return e!==e&&t!==t}const oN=0,iN=1,lN=2,_k=3,cN=4,ha=new WeakMap,Wa=()=>{},Zt=Wa(),Mx=Object,lt=e=>e===Zt,xa=e=>typeof e=="function",nr=(e,t)=>({...e,...t}),zx=e=>xa(e.then),dh={},Pd={},N_="undefined",iu=typeof window!=N_,Ox=typeof document!=N_,OD=iu&&"Deno"in window,DD=()=>iu&&typeof window.requestAnimationFrame!=N_,uN=(e,t)=>{const a=ha.get(e);return[()=>!lt(t)&&e.get(t)||dh,o=>{if(!lt(t)){const i=e.get(t);t in Pd||(Pd[t]=i),a[5](t,nr(i,o),i||dh)}},a[6],()=>!lt(t)&&t in Pd?Pd[t]:!lt(t)&&e.get(t)||dh]};let Dx=!0;const PD=()=>Dx,[Px,Lx]=iu&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Wa,Wa],LD=()=>{const e=Ox&&document.visibilityState;return lt(e)||e!=="hidden"},ID=e=>(Ox&&document.addEventListener("visibilitychange",e),Px("focus",e),()=>{Ox&&document.removeEventListener("visibilitychange",e),Lx("focus",e)}),BD=e=>{const t=()=>{Dx=!0,e()},a=()=>{Dx=!1};return Px("online",t),Px("offline",a),()=>{Lx("online",t),Lx("offline",a)}},$D={isOnline:PD,isVisible:LD},UD={initFocus:ID,initReconnect:BD},vk=!Kc.useId,To=!iu||OD,qD=e=>DD()?window.requestAnimationFrame(e):setTimeout(e,1),pc=To?x.useEffect:x.useLayoutEffect,fh=typeof navigator<"u"&&navigator.connection,yk=!To&&fh&&(["slow-2g","2g"].includes(fh.effectiveType)||fh.saveData),Ld=new WeakMap,HD=e=>Mx.prototype.toString.call(e),ph=(e,t)=>e===`[object ${t}]`;let VD=0;const Ix=e=>{const t=typeof e,a=HD(e),o=ph(a,"Date"),i=ph(a,"RegExp"),c=ph(a,"Object");let d,f;if(Mx(e)===e&&!o&&!i){if(d=Ld.get(e),d)return d;if(d=++VD+"~",Ld.set(e,d),Array.isArray(e)){for(d="@",f=0;f<e.length;f++)d+=Ix(e[f])+",";Ld.set(e,d)}if(c){d="#";const m=Mx.keys(e).sort();for(;!lt(f=m.pop());)lt(e[f])||(d+=f+":"+Ix(e[f])+",");Ld.set(e,d)}}else d=o?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return d},E_=e=>{if(xa(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Ix(e):"",[e,t]};let FD=0;const wf=()=>++FD;async function dN(...e){const[t,a,o,i]=e,c=nr({populateCache:!0,throwOnError:!0},typeof i=="boolean"?{revalidate:i}:i||{});let d=c.populateCache;const f=c.rollbackOnError;let m=c.optimisticData;const g=_=>typeof f=="function"?f(_):f!==!1,h=c.throwOnError;if(xa(a)){const _=a,j=[],E=t.keys();for(const y of E)!/^\$(inf|sub)\$/.test(y)&&_(t.get(y)._k)&&j.push(y);return Promise.all(j.map(b))}return b(a);async function b(_){const[j]=E_(_);if(!j)return;const[E,y]=uN(t,j),[k,N,w,S]=ha.get(t),R=()=>{const q=k[j];return(xa(c.revalidate)?c.revalidate(E().data,_):c.revalidate!==!1)&&(delete w[j],delete S[j],q&&q[0])?q[0](lN).then(()=>E().data):E().data};if(e.length<3)return R();let A=o,T,z=!1;const M=wf();N[j]=[M,0];const P=!lt(m),L=E(),I=L.data,D=L._c,$=lt(D)?I:D;if(P&&(m=xa(m)?m($,I):m,y({data:m,_c:$})),xa(A))try{A=A($)}catch(q){T=q,z=!0}if(A&&zx(A))if(A=await A.catch(q=>{T=q,z=!0}),M!==N[j][0]){if(z)throw T;return A}else z&&P&&g(T)&&(d=!0,y({data:$,_c:Zt}));if(d&&!z)if(xa(d)){const q=d(A,$);y({data:q,error:Zt,_c:Zt})}else y({data:A,error:Zt,_c:Zt});if(N[j][1]=wf(),Promise.resolve(R()).then(()=>{y({_c:Zt})}),z){if(h)throw T;return}return A}}const jk=(e,t)=>{for(const a in e)e[a][0]&&e[a][0](t)},GD=(e,t)=>{if(!ha.has(e)){const o=nr(UD,t),i=Object.create(null),c=dN.bind(Zt,e);let d=Wa;const f=Object.create(null),m=(_,j)=>{const E=f[_]||[];return f[_]=E,E.push(j),()=>{const y=E.indexOf(j);y>=0&&(E[y]=E[E.length-1],E.pop())}},g=(_,j,E)=>{e.set(_,j);const y=f[_];if(y)for(const k of y)k(j,E)},h=_=>{const j=ha.get(e),[,E,y,k]=j,N=wf();j[8]++;for(const R in y)delete y[R];for(const R in k)delete k[R];for(const R in E)E[R]=[N,N];const w={};for(const R of[...e.keys()]){const A=e.get(R);e.delete(R);const T=f[R];if(T)for(const z of T)z(w,A)}const S=!_||_.revalidate!==!1;for(const R in i){const A=i[R];for(let T=0;T<A.length;T++)A[T](cN,{revalidate:S&&!T})}},b=()=>{if(!ha.has(e)&&(ha.set(e,[i,Object.create(null),Object.create(null),Object.create(null),c,g,m,h,0]),!To)){const _=o.initFocus(setTimeout.bind(Zt,jk.bind(Zt,i,oN))),j=o.initReconnect(setTimeout.bind(Zt,jk.bind(Zt,i,iN)));d=()=>{_&&_(),j&&j(),ha.delete(e)}}};return b(),[e,c,b,d,h]}const a=ha.get(e);return[e,a[4],Zt,Zt,a[7]]},YD=(e,t,a,o,i)=>{const c=a.errorRetryCount,d=i.retryCount,f=~~((Math.random()+.5)*(1<<(d<8?d:8)))*a.errorRetryInterval;!lt(c)&&d>c||setTimeout(o,f,i)},KD=Ax,[fN,Sf,,,XD]=GD(new Map),QD=nr({onLoadingSlow:Wa,onSuccess:Wa,onError:Wa,onErrorRetry:YD,onDiscarded:Wa,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:yk?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:yk?5e3:3e3,compare:KD,isPaused:()=>!1,cache:fN,mutate:Sf,unload:XD,fallback:{}},$D),WD=(e,t)=>{const a=nr(e,t);if(t){const{use:o,fallback:i,cacheData:c}=e,{use:d,fallback:f,cacheData:m}=t;o&&d&&(a.use=o.concat(d)),i&&f&&(a.fallback=nr(i,f)),c&&m&&(a.cacheData=nr(c,m))}return a},ZD=x.createContext({}),JD="$inf$",pN=iu&&window.__SWR_DEVTOOLS_USE__,eP=pN?window.__SWR_DEVTOOLS_USE__:[],tP=()=>{pN&&(window.__SWR_DEVTOOLS_REACT__=Kc)},nP=e=>xa(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],mN=()=>{const e=x.useContext(ZD);return x.useMemo(()=>nr(QD,e),[e])},sP=e=>(t,a,o)=>e(t,a&&((...c)=>{const[d]=E_(t),[,,,f]=ha.get(fN);if(d.startsWith(JD))return a(...c);const m=f[d];return lt(m)?a(...c):(delete f[d],m)}),o),aP=eP.concat(sP),rP=e=>function(...a){const o=mN(),[i,c,d]=nP(a),f=WD(o,d);let m=e;const{use:g}=f,h=(g||[]).concat(aP);for(let b=h.length;b--;)m=h[b](m);return m(i,c||f.fetcher||null,f)},oP=(e,t,a)=>{const o=t[e]||(t[e]=[]);return o.push(a),()=>{const i=o.indexOf(a);i>=0&&(o[i]=o[o.length-1],o.pop())}};tP();const Id=Kc.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}}),mh={dedupe:!0},kk=(e,t,a)=>{var o;return t?((o=e.get(t))==null?void 0:o.has(a))===!0:!1},gh=(e,t,a)=>{if(!t)return;let o=e.get(t);o||(o=new Set,e.set(t,o)),o.add(a)},iP=({value:e,getCacheData:t,canCommit:a,setCache:o})=>{const i=c=>{a()&&lt(t())&&o(c)};Promise.resolve(e).then(c=>{i({data:c,error:Zt})},c=>{i({error:c})})},Cf=Promise.resolve(Zt);Cf.status="fulfilled";Cf.value=Zt;const lP=()=>Wa,cP=(e,t,a)=>{const{cache:o,compare:i,suspense:c,fallbackData:d,revalidateOnMount:f,revalidateIfStale:m,refreshInterval:g,refreshWhenHidden:h,refreshWhenOffline:b,keepPreviousData:_,strictServerPrefetchWarning:j}=a,[E,y,k,N]=ha.get(o),[w,S]=E_(e),R=x.useRef(!1),A=x.useRef(!1),T=x.useRef(w),z=x.useRef(t),M=x.useRef(a),P=()=>M.current,L=()=>P().isVisible()&&P().isOnline(),[I,D,$,q]=uN(o,w),G=x.useRef({}).current,U=lt(d)?lt(a.fallback)?Zt:a.fallback[w]:d,V=a.cacheData,X=w?V?.[w]:Zt,Q=w?N[w]:Zt,W=lt(Q)&&!lt(X),B=W?X:Q,K=(de,Le)=>{for(const ye in G){const Ce=ye;if(Ce==="data"){if(!i(de[Ce],Le[Ce])&&(!lt(de[Ce])||!i(Re,Le[Ce])))return!1}else if(Le[Ce]!==de[Ce])return!1}return!0},ee=!R.current,F=x.useMemo(()=>{const de=I(),Le=q(),ye=it=>{const Tt=nr(it);return delete Tt._k,(()=>{if(!w||!t||P().isPaused())return!1;if(ee&&!lt(f))return f;const Ct=lt(U)?Tt.data:U;return c&&W&&lt(Ct)?!1:lt(Ct)||m})()?{isValidating:!0,isLoading:!0,...Tt}:Tt},Ce=ye(de),Qe=de===Le?Ce:ye(Le);let Ge=Ce;return[()=>{const it=ye(I());return K(it,Ge)?(Ge.data=it.data,Ge.isLoading=it.isLoading,Ge.isValidating=it.isValidating,Ge.error=it.error,Ge):(Ge=it,it)},()=>Qe]},[o,w]),ne=Uc.useSyncExternalStore(x.useCallback(de=>$(w,(Le,ye)=>{K(ye,Le)||de()}),[o,w]),F[0],F[1]),Z=E[w]&&E[w].length>0,fe=ne.data;let Y=lt(fe)?U&&zx(U)?Id(U):U:fe;const oe=ne.error,ve=x.useRef(Y),ie=x.useRef(Zt);let xe=ie.current;xe||(xe=new WeakMap,ie.current=xe);const ke=x.useRef(null);let Re=_?lt(fe)?lt(ve.current)?Y:ve.current:fe:Y;const Ae=w&&lt(Y),Ie=x.useRef(null);!To&&Uc.useSyncExternalStore(lP,()=>(Ie.current=!1,Ie),()=>(Ie.current=!0,Ie));const Oe=Ie.current;j&&Oe&&!c&&Ae&&console.warn(`Missing pre-initiated data for serialized key "${w}" 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 Te=!w||!t||P().isPaused()||Z&&!lt(oe)?!1:ee&&!lt(f)?f:c&&W&&Ae?!1:c?lt(Y)?!1:m:lt(Y)||m,Ne=ee&&Te,Me=lt(ne.isValidating)?Ne:ne.isValidating,De=lt(ne.isLoading)?Ne:ne.isLoading,qe=x.useCallback(async de=>{const Le=z.current;if(!w||!Le||A.current||P().isPaused())return!1;let ye,Ce,Qe=!0;const Ge=de||{},it=!k[w]||!Ge.dedupe,Tt=W&&!kk(xe,V,w)&&!lt(B)&&lt(I().data),_t=()=>vk?!A.current&&w===T.current&&R.current:w===T.current,Ct={isValidating:!1,isLoading:!1},je=()=>{D(Ct)},ze=()=>{const We=k[w];We&&We[1]===Ce&&delete k[w]},Ye={isValidating:!0};lt(I().data)&&(Ye.isLoading=!0);try{if(it&&(D(Ye),a.loadingTimeout&&lt(I().data)&&setTimeout(()=>{Qe&&_t()&&P().onLoadingSlow(w,a)},a.loadingTimeout),Tt&&gh(xe,V,w),k[w]=[Tt?B:Le(S),wf()],Tt&&N[w]&&delete N[w]),[ye,Ce]=k[w],ye=await ye,it&&setTimeout(ze,a.dedupingInterval),!k[w]||k[w][1]!==Ce)return it&&_t()&&P().onDiscarded(w),!1;Ct.error=Zt;const We=y[w];if(!lt(We)&&(Ce<=We[0]||Ce<=We[1]||We[1]===0))return je(),it&&_t()&&P().onDiscarded(w),!1;const ft=I().data;Ct.data=i(ft,ye)?ft:ye,it&&_t()&&P().onSuccess(ye,w,a)}catch(We){ze();const ft=P(),{shouldRetryOnError:Rt}=ft;ft.isPaused()||(Ct.error=We,it&&_t()&&(ft.onError(We,w,ft),(Rt===!0||xa(Rt)&&Rt(We))&&(!P().revalidateOnFocus||!P().revalidateOnReconnect||L())&&ft.onErrorRetry(We,w,ft,Qt=>{const ot=E[w];ot&&ot[0]&&ot[0](_k,Qt)},{retryCount:(Ge.retryCount||0)+1,dedupe:!0})))}return Qe=!1,je(),!0},[w,o]),Xe=x.useCallback((...de)=>dN(o,T.current,...de),[]);if(pc(()=>{const de=ke.current;de&&(ke.current=null,gh(xe,de.cacheData,de.key),lt(I().data)&&D({data:de.data,error:Zt,_k:de._k}),N[de.key]&&delete N[de.key])}),pc(()=>{z.current=t,M.current=a,lt(fe)||(ve.current=fe)}),pc(()=>{if(t||!W||lt(B)||kk(xe,V,w)||!lt(I().data))return;gh(xe,V,w);const de=y[w];iP({value:B,getCacheData:()=>I().data,canCommit:()=>!A.current&&w===T.current&&y[w]===de,setCache:Le=>D({...Le,_k:S})})}),pc(()=>{if(!w)return;const de=qe.bind(Zt,mh);let Le=0;P().revalidateOnFocus&&(Le=Date.now()+P().focusThrottleInterval);const Ce=oP(w,E,(Qe,Ge={})=>{if(Qe==oN){const it=Date.now();P().revalidateOnFocus&&it>Le&&L()&&(Le=it+P().focusThrottleInterval,de())}else if(Qe==iN)P().revalidateOnReconnect&&L()&&de();else{if(Qe==lN)return qe();if(Qe==_k)return qe(Ge);if(Qe==cN&&(ve.current=Zt,Ge.revalidate))return qe()}});return A.current=!1,T.current=w,R.current=!0,D({_k:S}),Te&&(k[w]||(lt(Y)||To?de():qD(de))),()=>{A.current=!0,Ce()}},[w]),pc(()=>{let de;function Le(){const Ce=xa(g)?g(I().data):g;Ce&&de!==-1&&(de=setTimeout(ye,Ce))}function ye(){!I().error&&(h||P().isVisible())&&(b||P().isOnline())?qe(mh).then(Le):Le()}return Le(),()=>{de&&(clearTimeout(de),de=-1)}},[g,h,b,w]),x.useDebugValue(Re),c){if(!vk&&To&&Ae&&lt(B))throw new Error("Fallback data is required when using Suspense in SSR.");Ae&&(z.current=t,M.current=a,A.current=!1);const de=!lt(B)&&Ae;let Le=Zt;if(de&&W)Le=B&&zx(B)?Id(B):B,Y=Le,Re=Le,To||(ke.current={data:Le,_k:S,key:w,cacheData:V});else{const Ce=de?Xe(B):Cf;Id(Ce)}if(!lt(oe)&&Ae)throw oe;const ye=Ae&&lt(Le)?qe(mh):Cf;!lt(Re)&&Ae&&(ye.status="fulfilled",ye.value=!0),Id(ye)}return{mutate:Xe,get data(){return G.data=!0,Re},get error(){return G.error=!0,oe},get isValidating(){return G.isValidating=!0,Me},get isLoading(){return G.isLoading=!0,De}}},Be=rP(cP);let sl=null;function Ro(e){sl=e}function R_(){return sl}class lu extends Error{status;body;constructor(t,a,o){super(a),this.status=t,this.body=o}}async function mc(e,t,a,o={}){const i={"content-type":"application/json",...sl?{authorization:`Bearer ${sl}`}:{},...o.headers||{}},c=await fetch(t,{...o,method:e,headers:i,body:a!==void 0?JSON.stringify(a):void 0});if(!c.ok){let d="",f=null;try{f=await c.json(),d=f?.error||JSON.stringify(f)}catch{d=await c.text()}throw new lu(c.status,`${e} ${t} → ${c.status}: ${d}`,f)}if(c.status!==204)return await c.json()}function Ao(e){const t=e;if(Array.isArray(e))return{items:e,total:e.length};if(t&&Array.isArray(t.data)){const a=t.data;return{items:a,total:typeof t.meta?.total=="number"?t.meta.total:a.length}}if(t&&Array.isArray(t.sessions)){const a=t.sessions;return{items:a,total:a.length}}return{items:[],total:0}}const se={get:e=>mc("GET",e),post:(e,t)=>mc("POST",e,t),put:(e,t)=>mc("PUT",e,t),patch:(e,t)=>mc("PATCH",e,t),del:e=>mc("DELETE",e)};async function gN(e,t,a,o){const i=await fetch(e,{method:"POST",signal:o,headers:{"content-type":"application/json",...sl?{authorization:`Bearer ${sl}`}:{}},body:JSON.stringify(t)});if(!i.ok||!i.body){const m=await i.text().catch(()=>"");throw new lu(i.status,`POST ${e} → ${i.status}: ${m||"stream failed"}`)}const c=i.body.getReader(),d=new TextDecoder("utf-8");let f="";for(;;){const{value:m,done:g}=await c.read();if(g)break;f+=d.decode(m,{stream:!0});let h=f.indexOf(`
786
- `);for(;h>=0;){const b=f.slice(0,h).trim();if(f=f.slice(h+1),b)try{a(JSON.parse(b))}catch{}h=f.indexOf(`
787
- `)}}if(f.trim())try{a(JSON.parse(f.trim()))}catch{}}const uP={get:()=>se.get("/api/health")},Zn={list:()=>se.get("/api/projects"),register:e=>se.post("/api/projects",{path:e}),remove:e=>se.del(`/api/projects/${encodeURIComponent(e)}`),rebuild:e=>se.post(`/api/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>se.get(`/api/projects/${e}/config`),set:(e,t)=>se.patch(`/api/projects/${e}/config`,{set:t}),unset:(e,t)=>se.patch(`/api/projects/${e}/config`,{unset:t}),put:(e,t)=>se.put(`/api/projects/${e}/config`,t)},apcProject:{set:(e,t,a)=>se.patch(`/api/projects/${e}/apc-project`,{set:t,unset:a}),put:(e,t)=>se.put(`/api/projects/${e}/apc-project`,t)},memory:{get:e=>se.get(`/api/projects/${e}/memory`),put:(e,t)=>se.put(`/api/projects/${e}/memory`,{body:t})}},an={list:(e,t)=>se.get(`/api/projects/${e}/agents${t?.stats?"?stats=1":""}`),get:(e,t)=>se.get(`/api/projects/${e}/agents/${t}`),create:(e,t)=>se.post(`/api/projects/${e}/agents`,t),update:(e,t,a)=>se.patch(`/api/projects/${e}/agents/${encodeURIComponent(t)}`,a),remove:(e,t)=>se.del(`/api/projects/${e}/agents/${encodeURIComponent(t)}`),chat:(e,t,a)=>se.post(`/api/projects/${e}/agents/${encodeURIComponent(t)}/chat`,a),memory:{get:(e,t)=>se.get(`/api/projects/${e}/agents/${t}/memory`),put:(e,t,a)=>se.put(`/api/projects/${e}/agents/${t}/memory`,{body:a})},vault:e=>se.get(e?.includeRemoved?"/api/agents/vault?include_removed=1":"/api/agents/vault"),vaultCreate:(e,t={},a="")=>se.post("/api/agents/vault",{slug:e,fields:t,body:a}),vaultPatch:(e,t)=>se.patch(`/api/agents/vault/${encodeURIComponent(e)}`,t),vaultRemove:e=>se.del(`/api/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>se.post(`/api/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,t)=>se.post(`/api/projects/${e}/agents/import`,{slug:t})},Wr={list:(e,t)=>se.get(`/api/projects/${e}/agents/${t}/conversations`),get:(e,t,a)=>se.get(`/api/projects/${e}/agents/${t}/conversations/${a}`),threads:e=>se.get(`/api/projects/${e}/super-agent/threads`),thread:(e,t,a)=>se.get(`/api/projects/${e}/super-agent/threads/${t}/${a}`),remove:(e,t,a)=>se.del(`/api/projects/${e}/agents/${t}/conversations/${a}`),removeThread:(e,t,a)=>se.del(`/api/projects/${e}/super-agent/threads/${t}/${a}`),compact:(e,t,a)=>se.post(a?`/api/projects/${e}/agents/${t}/conversations/${a}/compact`:`/api/projects/${e}/agents/${t}/compact`,{})},Br={list:e=>se.get(`/api/projects/${e}/routines`),get:(e,t)=>se.get(`/api/projects/${e}/routines/${t}`),run:(e,t)=>se.post(`/api/projects/${e}/routines/${t}/run`),enable:(e,t)=>se.post(`/api/projects/${e}/routines/${t}/enable`),disable:(e,t)=>se.post(`/api/projects/${e}/routines/${t}/disable`),upsert:(e,t)=>se.post(`/api/projects/${e}/routines`,t),remove:(e,t)=>se.del(`/api/projects/${e}/routines/${encodeURIComponent(t)}`)},Qn={list:(e,t="open")=>se.get(`/api/projects/${e}/tasks?state=${t}`).then(a=>Ao(a).items),global:(e="open")=>se.get(`/api/tasks?state=${e}`).then(t=>Ao(t).items),listPage:(e,{state:t,limit:a,offset:o})=>se.get(`/api/projects/${e}/tasks?state=${t}&limit=${a}&offset=${o}`).then(i=>Ao(i)),globalPage:({state:e,limit:t,offset:a,status:o})=>se.get(`/api/tasks?state=${e}&limit=${t}&offset=${a}`+(o?`&status=${o}`:"")).then(i=>Ao(i)),get:(e,t)=>se.get(`/api/projects/${e}/tasks/${t}`),add:(e,t)=>se.post(`/api/projects/${e}/tasks`,t),patch:(e,t,a)=>se.patch(`/api/projects/${e}/tasks/${t}`,{patch:a}),status:(e,t,a)=>se.post(`/api/projects/${e}/tasks/${t}/status`,{status:a}),done:(e,t)=>se.post(`/api/projects/${e}/tasks/${t}/done`),drop:(e,t)=>se.post(`/api/projects/${e}/tasks/${t}/drop`),reopen:(e,t)=>se.post(`/api/projects/${e}/tasks/${t}/reopen`),summary:e=>se.get(`/api/projects/${e}/tasks-summary`)},$r={list:e=>se.get(`/api/projects/${e}/mcps`),check:e=>se.get(`/api/projects/${e}/mcps/check`),add:(e,t,a)=>se.post(`/api/projects/${e}/mcps?scope=${t}`,a),remove:(e,t,a="shared")=>se.del(`/api/projects/${e}/mcps/${encodeURIComponent(t)}?scope=${a}`),test:(e,t)=>se.post(`/api/projects/${e}/mcps/${encodeURIComponent(t)}/test`,{}),logs:(e,t)=>se.get(`/api/projects/${e}/mcps/${encodeURIComponent(t)}/logs`)},ko=e=>`?scope=${e}`,Yn={catalog:e=>se.get(`/api/projects/${e}/integrations/catalog`),list:(e,t="project")=>se.get(`/api/projects/${e}/integrations${ko(t)}`),status:(e,t,a="project")=>se.get(`/api/projects/${e}/integrations/${t}${ko(a)}`),configure:(e,t,a,o)=>se.post(`/api/projects/${e}/integrations/${t}/configure${ko(a)}`,o),validate:(e,t,a="project")=>se.post(`/api/projects/${e}/integrations/${t}/validate${ko(a)}`,{}),deactivate:(e,t,a="project")=>se.post(`/api/projects/${e}/integrations/${t}/deactivate${ko(a)}`,{}),action:(e,t,a,o="project")=>se.post(`/api/projects/${e}/integrations/${t}/action/${a}${ko(o)}`,{}),remove:(e,t,a="project")=>se.del(`/api/projects/${e}/integrations/${t}${ko(a)}`),asanaConfigure:(e,t,a)=>Yn.configure(e,"asana",t,{personal_access_token:a.personalAccessToken,workspace_gid:a.workspaceGid}),asanaValidate:(e,t)=>Yn.validate(e,"asana",t),asanaWorkspaces:(e,t)=>Yn.action(e,"asana","workspaces",t)},qc={list:(e,t={})=>se.get(`/api/projects/${e}/vars${t.reveal?"?reveal=1":""}`),get:(e,t,a={})=>se.get(`/api/projects/${e}/vars/${encodeURIComponent(t)}${a.reveal?"?reveal=1":""}`),upsert:(e,t)=>se.post(`/api/projects/${e}/vars`,t),remove:(e,t,a="project")=>se.del(`/api/projects/${e}/vars/${encodeURIComponent(t)}?scope=${a}`)},hh=e=>{const t=new URLSearchParams;for(const[o,i]of Object.entries(e))i!==void 0&&i!==""&&t.set(o,String(i));const a=t.toString();return a?`?${a}`:""},Nf={global:(e={})=>se.get(`/api/messages/global${hh(e)}`),project:(e,t={})=>se.get(`/api/projects/${e}/messages${hh(t)}`),search:(e,t,a=50)=>se.get(`/api/projects/${e}/messages/search${hh({q:t,limit:a})}`)},dP={global:e=>se.get(`/api/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`).then(t=>({sessions:Ao(t).items})),page:({engine:e,q:t,deep:a,cwd:o,limit:i,offset:c})=>{const d=new URLSearchParams({limit:String(i),offset:String(c)});return e&&d.set("engine",e),t?.trim()&&d.set("q",t.trim()),a&&d.set("deep","1"),o?.trim()&&d.set("cwd",o.trim()),se.get(`/api/sessions?${d.toString()}`).then(f=>Ao(f))}},fP={list:()=>se.get("/api/tools")},Pn={channels:{list:()=>se.get("/api/telegram/channels"),upsert:e=>se.post("/api/telegram/channels",e),patch:(e,t)=>se.patch(`/api/telegram/channels/${e}`,t),remove:e=>se.del(`/api/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>se.get("/api/telegram/contacts"),patch:(e,t)=>se.patch(`/api/telegram/contacts/${encodeURIComponent(String(e))}`,t),remove:e=>se.del(`/api/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>se.get("/api/telegram/roles"),set:(e,t)=>se.put(`/api/telegram/roles/${encodeURIComponent(e)}`,{tools:t}),remove:e=>se.del(`/api/telegram/roles/${encodeURIComponent(e)}`)},status:()=>se.get("/api/telegram/status"),start:()=>se.post("/api/telegram/start"),stop:()=>se.post("/api/telegram/stop"),send:e=>se.post("/api/telegram/send",e)},Hc={list:()=>se.get("/api/engines"),presets:()=>se.get("/api/engines/presets"),models:e=>se.post("/api/engines/models",e)},pP=Object.freeze(Object.defineProperty({__proto__:null,Engines:Hc},Symbol.toStringTag,{value:"Module"})),al={reload:()=>se.post("/api/admin/reload"),shutdown:()=>se.post("/api/admin/shutdown"),config:{get:()=>se.get("/api/admin/config"),patch:e=>se.patch("/api/admin/config",e)},superAgent:()=>se.get("/api/admin/super-agent"),logs:(e="errors",t=200)=>se.get(`/api/admin/logs?file=${e}&limit=${t}`)},rl={list:()=>se.get("/api/pair/list"),revoke:e=>se.del(`/api/pair/revoke/${encodeURIComponent(e)}`),init:()=>se.post("/api/pair/init",{}),status:e=>se.get(`/api/pair/status/${encodeURIComponent(e)}`),confirm:e=>se.post("/api/pair/confirm",e)},wk={get:()=>se.get("/api/identity"),patch:e=>se.patch("/api/identity",e)},hN={send:(e,t)=>se.post(`/api/projects/${e}/super-agent/chat`,t),stream:(e,t,a,o)=>gN(`/api/projects/${e}/super-agent/chat/stream`,t,a,o),summarize:e=>se.post("/api/super-agent/summarize",e)},Ef={dirs:e=>se.get(`/api/admin/fs/dirs?path=${encodeURIComponent(e)}`),pickDir:e=>se.get(`/api/admin/fs/pick-dir${e?`?prompt=${encodeURIComponent(e)}`:""}`)},mP=["alloy","echo","fable","onyx","nova","shimmer"],gP=["Kore","Puck","Charon","Fenrir","Aoede"],hP=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],xP=["tts-1","tts-1-hd"],bP=["happy","sad","excited","angry","calm","whisper","shout","laugh","cry","narrator","neutral"],_P=["tiny","base","small","medium","large-v2","large-v3","large-v3-turbo"],Rf={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) or any OpenAI-compatible endpoint (set a base URL for a local server, e.g. QVox)."},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 vP(e){const t=R_(),a=await fetch(`/api/voice/tts?path=${encodeURIComponent(e)}`,{headers:t?{authorization:`Bearer ${t}`}:{}});if(!a.ok){const i=await a.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${a.status}): ${i.slice(0,160)}`)}const o=await a.blob();return URL.createObjectURL(o)}const Tf={providers:()=>se.get("/api/tts/providers"),sttHardware:()=>se.get("/api/transcribe/hardware"),sttModels:e=>se.get(`/api/transcribe/models?backend=${e}`),say:e=>se.post("/api/tts/say",e),turn:e=>se.post("/api/voice/turn",e)},xN={manifest:()=>se.get("/api/deck/manifest"),setWidget:(e,t)=>se.patch(`/api/deck/widgets/${encodeURIComponent(e)}`,t),exec:e=>se.post("/api/deck/exec",e)},wo=e=>`/api/projects/${e}/code/sessions`,Ya={sessions:{list:e=>se.get(wo(e)).then(t=>t.sessions),get:(e,t)=>se.get(`${wo(e)}/${t}`),create:(e,t={})=>se.post(wo(e),t),update:(e,t,a)=>se.patch(`${wo(e)}/${t}`,a),remove:(e,t)=>se.del(`${wo(e)}/${t}`)},changes:(e,t)=>se.get(`${wo(e)}/${t}/changes`),stream:(e,t,a,o,i)=>gN(`${wo(e)}/${t}/chat/stream`,a,o,i)},Ws={list:e=>se.get(`/api/projects/${encodeURIComponent(e)}/artifacts`),read:(e,t)=>se.get(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),run:(e,t,a=[])=>se.post(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/run`,{args:a}),remove:(e,t)=>se.del(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),write:(e,t,a)=>se.patch(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{content:a}),rename:(e,t,a)=>se.patch(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{newName:a}),preview:(e,t,a=!0)=>se.post(`/api/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/preview`,{watch:a}),previews:e=>se.get(`/api/projects/${encodeURIComponent(e)}/previews`),stopPreview:e=>se.del(`/api/previews/${encodeURIComponent(e)}`),openTunnel:(e,t)=>se.post(`/api/previews/${encodeURIComponent(e)}/tunnel`,{provider:t}),closeTunnel:e=>se.del(`/api/previews/${encodeURIComponent(e)}/tunnel`)},Us={list:e=>{const t=new URLSearchParams;e&&(t.set("project_path",e),t.set("scope",e));const a=t.toString();return se.get(a?`/api/skills?${a}`:"/api/skills")},detail:(e,t)=>{const a=t?`?project_path=${encodeURIComponent(t)}`:"";return se.get(`/api/skills/${encodeURIComponent(e)}/detail${a}`)},setEnabled:e=>se.put("/api/skills/enabled",e),create:e=>se.post("/api/skills",e),importZip:e=>se.post("/api/skills/import/zip",e),importRepo:e=>se.post("/api/skills/import/repo",e),remove:(e,t)=>{const a=t?`?project_path=${encodeURIComponent(t)}`:"";return se.del(`/api/skills/${encodeURIComponent(e)}${a}`)},inspector:()=>se.get("/api/skills/inspector"),updateInspector:e=>se.put("/api/skills/inspector",e),index:(e={})=>se.post("/api/skills/index",e),inspect:(e,t)=>se.post("/api/skills/inspect",{prompt:e,project_path:t})},Vr={get:e=>se.get(`/api/projects/${e}/organization`),createArea:(e,t)=>se.post(`/api/projects/${e}/organization/areas`,t),updateArea:(e,t,a)=>se.patch(`/api/projects/${e}/organization/areas/${encodeURIComponent(t)}`,a),removeArea:(e,t)=>se.del(`/api/projects/${e}/organization/areas/${encodeURIComponent(t)}`),createRole:(e,t)=>se.post(`/api/projects/${e}/organization/roles`,t),updateRole:(e,t,a)=>se.patch(`/api/projects/${e}/organization/roles/${encodeURIComponent(t)}`,a),removeRole:(e,t)=>se.del(`/api/projects/${e}/organization/roles/${encodeURIComponent(t)}`)},kc={tree:(e,t="project")=>se.get(`/api/projects/${e}/fs/tree?scope=${t}`),read:(e,t,a="project")=>se.get(`/api/projects/${e}/fs/file?scope=${a}&path=${encodeURIComponent(t)}`),write:(e,t,a,o="project")=>se.put(`/api/projects/${e}/fs/file`,{scope:o,path:t,content:a}),mkdir:(e,t,a="project")=>se.post(`/api/projects/${e}/fs/dir`,{scope:a,path:t}),remove:(e,t,a="project")=>se.del(`/api/projects/${e}/fs/entry?scope=${a}&path=${encodeURIComponent(t)}`)};function cu(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/projects",()=>Zn.list(),{refreshInterval:Qf.projects});return{projects:(e||[]).slice().sort((c,d)=>{const f=Number(c.id),m=Number(d.id);return f===0&&m!==0?-1:m===0&&f!==0?1:f-m}),error:t,isLoading:a,mutate:o}}function uu(e){const{projects:t,isLoading:a,mutate:o}=cu();return{project:t.find(c=>String(c.id)===e)??null,isLoading:a,mutate:o}}function T_(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/identity",()=>wk.get());return{identity:e||{},error:t,isLoading:a,mutate:o,save:async c=>{const d=await wk.patch(c);return await o(d,{revalidate:!1}),d}}}function yp(){const{identity:e}=T_();return e?.agent_name?.trim()||"APX"}function yP(){return[{id:"desktop",label:u("nav.modules.desktop"),href:"/m/desktop",icon:vb},{id:"code",label:u("nav.modules.code"),href:"/m/code",icon:ya}]}function jP(e,t,a){const[o,i]=x.useState(t);return x.useLayoutEffect(()=>{const c=e.current;if(!c||!a)return;const d=()=>{const m=getComputedStyle(c),g=(parseFloat(m.paddingTop)||0)+(parseFloat(m.paddingBottom)||0),h=c.clientHeight-g;if(h<=0)return;const b=parseFloat(m.rowGap)||12,j=(c.querySelector("[data-rail-probe]")?.offsetHeight??56)+b,y=Math.max(0,Math.floor((h+b)/j))-1;i(y>=t?t:Math.max(0,y-1))};d();const f=new ResizeObserver(d);return f.observe(c),()=>f.disconnect()},[e,t,a]),a?Math.min(o,t):t}function Sk({projects:e,label:t,sublabel:a,icon:o,tooltip:i,header:c,active:d,testId:f,onSelect:m,isActive:g}){return n.jsxs(y_,{children:[n.jsxs(j_,{"data-testid":f,title:i,"aria-label":i,className:"group flex w-full cursor-pointer flex-col items-center gap-1",children:[n.jsx("span",{className:ge("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",d&&"ring-2 ring-foreground ring-offset-2 ring-offset-card"),children:o??t}),a&&n.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:a})]}),n.jsxs(k_,{side:"right",align:"start",sideOffset:8,className:"max-h-[70vh] w-64",children:[n.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:j,idleClass:E}=N6(b);return n.jsxs(af,{"data-testid":`project-menu-item-${h.id}`,onClick:()=>m(_),className:ge(g(_)&&"bg-accent/60 text-foreground"),children:[n.jsx("span",{className:ge("flex size-6 shrink-0 items-center justify-center rounded-md text-[10px] font-bold",E),children:j}),n.jsx("span",{className:"truncate",children:b})]},h.id)})]})]})}function kP({onSelect:e,onOpenRoby:t,onOpenAddProject:a}){const{projects:o,isLoading:i}=cu(),c=ns(),d=yP(),f=yp(),m=x.useRef(null),{collapsed:g,toggle:h}=C_(Dn.sidebarCollapsed+".projects"),b=w=>c.pathname===w||c.pathname.startsWith(`${w}/`),_=o.find(w=>String(w.id)==="0"),j=o.filter(w=>String(w.id)!=="0").sort((w,S)=>Number(S.id)-Number(w.id)),E=jP(m,j.length,!g&&j.length>0),y=j.slice(0,E),k=j.slice(E),N=k.some(w=>b(`/p/${w.id}`));return n.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-hidden bg-transparent py-3",children:[n.jsx(Ue,{content:u("nav.apx_admin"),side:"right",children:n.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:n.jsx(TM,{size:36})})}),n.jsx(Ue,{content:u("inbox.title"),side:"right",children:n.jsx("button",{type:"button",onClick:()=>e("/m/inbox"),"data-testid":"nav-inbox",className:`flex size-10 cursor-pointer items-center justify-center rounded-xl border transition ${b("/m/inbox")?"border-primary bg-primary/10":"border-border bg-muted/40 hover:bg-muted"}`,"aria-label":u("inbox.title"),children:n.jsx(Jc,{size:18})})}),i&&n.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),_&&n.jsx(zi,{label:u("base.title"),testId:"project-avatar-0",title:u("base.subtitle"),active:b("/p/0"),isDefault:!0,icon:n.jsx("img",{src:"/modules/superagent.png",alt:u("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),d.map(w=>n.jsx(zi,{label:w.label,testId:`module-avatar-${w.id}`,title:w.label,active:b(w.href),icon:n.jsx(w.icon,{size:18}),onClick:()=>e(w.href)},w.id)),n.jsxs("div",{className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3",children:[j.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),n.jsx(Ue,{content:u(g?"nav.expand_projects":"nav.collapse_projects"),side:"right",children:n.jsx("button",{type:"button",onClick:h,"data-testid":"nav-toggle-projects","aria-label":u(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:n.jsx(ms,{className:ge("size-3.5 transition-transform",g&&"-rotate-90")})})})]}),n.jsxs("div",{ref:m,className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3 overflow-hidden py-1.5",children:[j.length>0&&g&&n.jsx(Sk,{projects:j,icon:n.jsx(FA,{size:18}),sublabel:String(j.length),tooltip:u("nav.all_projects"),header:u("nav.all_projects"),active:j.some(w=>b(`/p/${w.id}`)),testId:"nav-projects-folder",onSelect:e,isActive:b}),j.length>0&&!g&&n.jsxs(n.Fragment,{children:[n.jsx("div",{"data-rail-probe":!0,"aria-hidden":!0,className:"invisible absolute w-full",children:n.jsx(zi,{label:"Ag",active:!1,onClick:()=>{}})}),y.map(w=>{const S=w.name||w.path.split("/").pop()||String(w.id),R=`/p/${w.id}`;return n.jsx("div",{"data-rail-item":!0,className:"w-full",children:n.jsx(zi,{label:S,testId:`project-avatar-${w.id}`,title:`${S} — ${w.path}`,active:b(R),onClick:()=>e(R)})},w.id)}),k.length>0&&n.jsx(Sk,{projects:k,label:`+${k.length}`,tooltip:u("nav.more_projects",{count:k.length}),header:u("nav.more_projects",{count:k.length}),active:N,testId:"nav-projects-overflow",onSelect:e,isActive:b})]}),n.jsx(zi,{label:u("nav.add_project"),isAdd:!0,testId:"nav-add-project",icon:n.jsx(Dt,{size:18}),active:!1,onClick:()=>a?a():e("/?action=add-project"),title:u("nav.add_project")})]})]}),n.jsx(zi,{label:u("nav.settings"),isSettings:!0,testId:"nav-settings",icon:n.jsx(Xf,{size:16}),active:c.pathname==="/settings"||c.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:u("nav.settings")}),n.jsx(Ue,{content:u("settings_ui.documentation"),side:"right",children:n.jsx("a",{href:"https://agentprojectcontext.github.io/apx/docs/",target:"_blank",rel:"noopener noreferrer","data-testid":"nav-docs","aria-label":u("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:n.jsx(yA,{size:18})})}),n.jsx(Ue,{content:u("superagent.talk",{persona:f}),side:"right",children:n.jsx("button",{type:"button",onClick:t,"data-testid":"nav-roby","aria-label":u("superagent.talk",{persona:f}),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:n.jsx(rn,{size:18})})})]})}function bN(e){switch(e){case"personal":return u("settings_ui.kind_personal");case"company":return u("settings_ui.kind_company");case"app":return u("settings_ui.kind_app");case"software":return u("settings_ui.kind_software");case"default":return u("settings_ui.kind_default");case"other":return u("settings_ui.kind_other");default:return u("nav.project")}}function Ve({title:e,description:t,action:a,className:o,children:i,fullHeight:c}){return n.jsxs("section",{className:ge("rounded-xl border border-border bg-card p-5",c&&"flex h-full min-h-0 flex-col",o),children:[n.jsxs("header",{className:ge("mb-4 flex items-start justify-between gap-4",c&&"shrink-0"),children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),t&&n.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:t})]}),a]}),n.jsx("div",{className:ge(c&&"flex min-h-0 flex-1 flex-col"),children:i})]})}function Ck({children:e}){return n.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 du({ok:e}){return n.jsx("span",{className:ge("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const wP=x.forwardRef(function(t,a){const{render:o,className:i,disabled:c=!1,focusableWhenDisabled:d=!1,nativeButton:f=!0,style:m,...g}=t,{getButtonProps:h,buttonRef:b}=no({disabled:c,focusableWhenDisabled:d,native:f});return Et("button",t,{state:{disabled:c},ref:[a,b],props:[g,h]})}),Nk=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Ek=Pc,A_=(e,t)=>a=>{var o;if(t?.variants==null)return Ek(e,a?.class,a?.className);const{variants:i,defaultVariants:c}=t,d=Object.keys(i).map(g=>{const h=a?.[g],b=c?.[g];if(h===null)return null;const _=Nk(h)||Nk(b);return i[g][_]}),f=a&&Object.entries(a).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:_,...j}=h;return Object.entries(j).every(E=>{let[y,k]=E;return Array.isArray(k)?k.includes({...c,...f}[y]):{...c,...f}[y]===k})?[...g,b,_]:g},[]);return Ek(e,d,m,a?.class,a?.className)},SP=A_("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 or({className:e,variant:t="default",size:a="default",...o}){return n.jsx(wP,{"data-slot":"button",className:St(SP({variant:t,size:a,className:e})),...o})}const CP={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},NP={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},EP={disabled:!1,...NP},M_={valid(e){return e===null?null:e?{"data-valid":""}:{"data-invalid":""}}},RP={invalid:void 0,name:void 0,validityData:{state:CP,errors:[],error:"",value:"",initialValue:null},setValidityData:Nn,disabled:void 0,setTouched:Nn,setDirty:Nn,setFilled:Nn,setFocused:Nn,validationMode:"onSubmit",shouldValidateOnChange:()=>!1,state:EP,registerFieldControl:Nn,validation:{getValidationProps:(e,t=sn)=>t,inputRef:{current:null},registeredInputs:new Map,registerInput:Nn,getInputControl:()=>null,commit:async()=>{},change:Nn}},TP=x.createContext(RP);function fu(e=!0){const t=x.useContext(TP);if(t.setValidityData===Nn&&!e)throw new Error(gn(28));return t}const AP=x.createContext({elementRef:{current:null},formRef:{current:{fields:new Map}},errors:{},clearErrors:Nn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function z_(){return x.useContext(AP)}const MP=x.createContext({controlId:void 0,registerControlId:Nn,labelId:void 0,setLabelId:Nn,messageIds:[],setMessageIds:Nn,getDescriptionProps:e=>e});function jp(){return x.useContext(MP)}function zP(e,t,a,o=!0,i){const[c,d]=x.useState(),f=ra(i?`${i}-label`:void 0),m=e??t??c;return Pe(()=>{const g=e||t||!o?void 0:OP(a.current,f);c!==g&&d(g)}),m}function OP(e,t){const a=DP(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}function DP(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const a=e.id;if(a){const i=e.nextElementSibling;if(i&&i.htmlFor===a)return i}const o=e.labels;return o&&o[0]}function kp(e={}){const{id:t,implicit:a=!1,controlRef:o}=e,{controlId:i,registerControlId:c}=jp(),d=ra(t),f=a?i:void 0,m=Hn(()=>Symbol()),g=x.useRef(!1),h=x.useRef(t!=null),b=He(()=>{!g.current||c===Nn||(g.current=!1,c(m.current,void 0))});return Pe(()=>{if(c===Nn)return;let _;if(a){const j=o?.current;bt(j)&&j.closest("label")!=null?_=t??null:_=f??d}else if(t!=null)h.current=!0,_=t;else if(h.current)_=d;else{b();return}if(_===void 0){b();return}g.current=!0,c(m.current,_)},[t,o,f,c,a,d,m,b]),x.useEffect(()=>b,[b]),i??d}function O_(e,t,a,o,i=!0,c){const{registerFieldControl:d}=fu(),f=Hn(()=>Symbol());Pe(()=>{const m=f.current;if(!i){d(m,void 0);return}d(m,{controlRef:e,getValue:o,id:t,name:c,value:a})},[e,i,o,t,c,d,f,a]),Pe(()=>{const m=f.current;return()=>{d(m,void 0)}},[d,f])}const PP=x.forwardRef(function(t,a){const{render:o,className:i,id:c,name:d,value:f,disabled:m=!1,onValueChange:g,defaultValue:h,autoFocus:b=!1,style:_,...j}=t,{state:E,name:y,disabled:k,setTouched:N,setDirty:w,validityData:S,setFocused:R,setFilled:A,validationMode:T,validation:z}=fu(),{clearErrors:M}=z_(),P=k||m,L=y??d,I={...E,disabled:P},{labelId:D}=jp(),$=kp({id:c});Pe(()=>{const W=f!=null;z.inputRef.current?.value||W&&f!==""?A(!0):W&&f===""&&A(!1)},[z.inputRef,A,f]);const q=x.useRef(null);Pe(()=>{b&&q.current===Kn(vt(q.current))&&R(!0)},[b,R]);const[G]=nl({controlled:f,default:h,name:"FieldControl",state:"value"}),U=f!==void 0,V=U?G:void 0,X=He(()=>z.inputRef.current?.value);return O_(z.inputRef,$,V,X,!P,d),Et("input",t,{ref:[a,q],state:I,props:[{id:$,disabled:P,name:L,ref:z.inputRef,"aria-labelledby":D,autoFocus:b,...U?{value:V}:{defaultValue:h},onChange(W){const B=W.currentTarget.value;g?.(B,rt(ka,W.nativeEvent)),w(B!==(S.initialValue??"")),A(B!==""),W.nativeEvent.defaultPrevented||(M(L),z.change(B))},onFocus(){R(!0)},onBlur(W){N(!0),R(!1),T==="onBlur"&&z.commit(W.currentTarget.value)},onKeyDown(W){W.currentTarget.tagName==="INPUT"&&W.key==="Enter"&&(N(!0),z.commit(W.currentTarget.value))}},j,W=>z.getValidationProps(P,W)],stateAttributesMapping:M_})}),LP=x.forwardRef(function(t,a){return n.jsx(PP,{ref:a,...t})});function IP({className:e,type:t,...a}){return n.jsx(LP,{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),...a})}function BP({className:e,...t}){return n.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 $P(e){return Et(e.defaultTagName??"div",e,e)}const UP=A_("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 qP({className:e,variant:t="default",render:a,...o}){return $P({defaultTagName:"span",props:Ss({className:St(UP({variant:t}),e)},o),render:a,state:{slot:"badge",variant:t}})}const _N=x.createContext(void 0);function HP(){const e=x.useContext(_N);if(e===void 0)throw new Error(gn(63));return e}const vN={...M_,checked(e){return e?{"data-checked":""}:{"data-unchecked":""}}},VP=x.forwardRef(function(t,a){const{checked:o,className:i,defaultChecked:c,"aria-labelledby":d,form:f,id:m,inputRef:g,name:h,nativeButton:b=!1,onCheckedChange:_,readOnly:j=!1,required:E=!1,disabled:y=!1,render:k,uncheckedValue:N,value:w,style:S,...R}=t,{clearErrors:A}=z_(),{state:T,setTouched:z,setDirty:M,validityData:P,setFilled:L,setFocused:I,validationMode:D,disabled:$,name:q,validation:G}=fu(),{labelId:U}=jp(),V=$||y,X=q??h,Q=x.useRef(null),W=rr(Q,g,G.inputRef),B=x.useRef(null),K=ra(),ee=kp({id:m,implicit:!1,controlRef:B}),F=b?void 0:ee,[ne,Z]=nl({controlled:o,default:!!c,name:"Switch",state:"checked"});O_(B,K,ne,void 0,!V,h),Pe(()=>{Q.current&&L(Q.current.checked)},[L]),v_(ne,()=>{A(X),M(ne!==P.initialValue),L(ne),G.change(ne)});const{getButtonProps:fe,buttonRef:Y}=no({disabled:V,native:b}),oe=zP(d,U,Q,!b,F),ve={id:b?ee:K,role:"switch","aria-checked":ne,"aria-readonly":j||void 0,"aria-required":E||void 0,"aria-labelledby":oe,onFocus(){V||I(!0)},onBlur(){const Re=Q.current;!Re||V||(z(!0),I(!1),D==="onBlur"&&G.commit(Re.checked))},onClick(Re){if(j||V)return;Re.preventDefault();const Ae=Q.current;Ae&&Ac(Ae,Re)}},ie={...G.getValidationProps(V),checked:ne,disabled:V,form:f,id:F,name:X,required:E,style:X?RS:Ub,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:W,onChange(Re){if(Re.nativeEvent.defaultPrevented)return;if(j){Re.preventDefault();return}const Ae=Re.currentTarget.checked,Ie=rt(ka,Re.nativeEvent);_?.(Ae,Ie),!Ie.isCanceled&&Z(Ae)},onClick(Re){Re.stopPropagation()},onFocus(){B.current?.focus()},...w!==void 0?{value:w}:sn},xe=x.useMemo(()=>({...T,checked:ne,disabled:V,readOnly:j,required:E}),[T,ne,V,j,E]),ke=Et("span",t,{state:xe,ref:[a,B,Y],props:[ve,R,fe,Re=>G.getValidationProps(V,Re)],stateAttributesMapping:vN});return n.jsxs(_N.Provider,{value:xe,children:[ke,!ne&&X&&N!==void 0&&n.jsx("input",{type:"hidden",form:f,name:X,value:N,disabled:V}),n.jsx("input",{...ie,suppressHydrationWarning:!0})]})}),FP=x.forwardRef(function(t,a){const{render:o,className:i,style:c,...d}=t,f=HP();return Et("span",t,{state:f,ref:a,stateAttributesMapping:vN,props:d})});function GP({className:e,size:t="default",...a}){return n.jsx(VP,{"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),...a,children:n.jsx(FP,{"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 YP({className:e,...t}){return n.jsx(Js,{role:"status","aria-label":"Loading",className:St("size-4 animate-spin",e),...t})}const yN=x.createContext(void 0);function Go(e){const t=x.useContext(yN);if(!e&&t===void 0)throw new Error(gn(27));return t}const jN=x.forwardRef(function(t,a){const{render:o,className:i,style:c,forceRender:d=!1,...f}=t,m=Go(),g=m.useState("open"),h=m.useState("nested"),b=m.useState("mounted"),_=m.useState("transitionStatus");return Et("div",t,{state:{open:g,transitionStatus:_},ref:[m.context.backdropRef,a],stateAttributesMapping:d_,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:d||!h})}),wp=x.forwardRef(function(t,a){const{render:o,className:i,style:c,disabled:d=!1,nativeButton:f=!0,...m}=t,g=Go(),h=g.useState("open"),{getButtonProps:b,buttonRef:_}=no({disabled:d,native:f}),j={disabled:d};function E(y){h&&g.setOpen(!1,rt(T4,y.nativeEvent))}return Et("button",t,{state:j,ref:[a,_],props:[{onClick:E},m,b]})}),kN=x.forwardRef(function(t,a){const{render:o,className:i,style:c,id:d,...f}=t,m=Go(),g=ra(d);return m.useSyncedValueWithCleanup("descriptionElementId",g),Et("p",t,{ref:a,props:[{id:g},f]})}),wN=x.createContext(void 0);function KP(){const e=x.useContext(wN);if(e===void 0)throw new Error(gn(26));return e}const XP={...ru,...Vo,nestedDialogOpen(e){return e?{"data-nested-dialog-open":""}:null}},SN=x.forwardRef(function(t,a){const{render:o,className:i,style:c,finalFocus:d,initialFocus:f,...m}=t,g=Go(),h=g.useState("descriptionElementId"),b=g.useState("disablePointerDismissal"),_=g.useState("floatingRootContext"),j=g.useState("popupProps"),E=g.useState("modal"),y=g.useState("mounted"),k=g.useState("nested"),N=g.useState("nestedOpenDialogCount"),w=g.useState("open"),S=g.useState("openMethod"),R=g.useState("titleElementId"),A=g.useState("transitionStatus"),T=g.useState("role"),z=_.useState("floatingId");KP(),Ca({open:w,ref:g.context.popupRef,onComplete(){w&&g.context.onOpenChangeComplete?.(!0)}});const M=f===void 0?AO(g.context.popupRef):f,P=N>0,L=g.useStateSetter("popupElement"),D=Et("div",t,{state:{open:w,nested:k,transitionStatus:A,nestedDialogOpen:P},props:[j,{id:z,"aria-labelledby":R,"aria-describedby":h,role:T,...dp,hidden:!y,onKeyDown($){xp.has($.key)&&$.stopPropagation()},style:{"--nested-dialogs":N}},m],ref:[a,g.context.popupRef,L],stateAttributesMapping:XP});return n.jsx(Jb,{context:_,openInteractionType:S,disabled:!y,closeOnFocusOut:!b,initialFocus:M,returnFocus:d,modal:E!==!1,restoreFocus:"popup",children:D})}),CN=x.forwardRef(function(t,a){const{keepMounted:o=!1,...i}=t,c=Go(),d=c.useState("mounted"),f=c.useState("modal"),m=c.useState("open");return d||o?n.jsx(wN.Provider,{value:o,children:n.jsxs(Qb,{ref:a,...i,children:[d&&f===!0&&n.jsx(__,{ref:c.context.internalBackdropRef,inert:gp(!m)}),t.children]})}):null});function QP({store:e,parentContext:t,isDrawer:a}){const o=e.useState("open"),i=e.useState("disablePointerDismissal"),c=e.useState("modal"),d=e.useState("popupElement"),f=e.useState("floatingRootContext"),[m,g]=x.useState(0),[h,b]=x.useState(0),_=m===0,j=lp(f,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(E){if(!e.context.outsidePressEnabledRef.current||"button"in E&&E.button!==0)return!1;if("touches"in E){if(E.type==="touchend"){if(E.changedTouches.length!==1||E.touches.length!==0)return!1}else if(E.touches.length!==1)return!1}const y=qn(E);if(_&&!i){if(c){const k=e.context.internalBackdropRef.current,N=e.context.backdropRef.current;return k||N?k===y||N===y||Ze(y,d)&&!y?.hasAttribute("data-base-ui-portal"):!0}return!0}return!1},escapeKey:_});return KC(o&&c===!0,d),e.useContextCallback("onNestedDialogOpen",(E,y)=>{g(E),b(y)}),Pe(()=>(t?.onNestedDialogOpen&&(o?t.onNestedDialogOpen(m+1,h+(a?1:0)):t.onNestedDialogOpen(0,0)),()=>{t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(0,0)}),[a,o,m,h,t]),r_(e,{activeTriggerProps:j.reference,inactiveTriggerProps:j.trigger,popupProps:j.floating,nestedOpenDialogCount:m,nestedOpenDrawerCount:h}),null}const WP={...l_,modal:e=>e.modal,nested:e=>e.nested,nestedOpenDialogCount:e=>e.nestedOpenDialogCount,nestedOpenDrawerCount:e=>e.nestedOpenDrawerCount,disablePointerDismissal:e=>e.disablePointerDismissal,openMethod:e=>e.openMethod,descriptionElementId:e=>e.descriptionElementId,titleElementId:e=>e.titleElementId,viewportElement:e=>e.viewportElement,role:e=>e.role};class ZP extends su{constructor(t,a,o){const i=new au,c=JP(t,i,a,o);super(c,eL(i),WP)}setOpen=(t,a)=>{if(a.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&a.trigger==null&&this.state.activeTriggerId!=null&&(a.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,a),a.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,a);const o={open:t};n_(o,t,a.trigger),this.update(o)}}function JP(e,t,a,o=!1){const i={...o_(),modal:!0,disablePointerDismissal:!1,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e};return i.floatingRootContext=bC(t,a,o),i}function eL(e){return{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:e,onOpenChange:void 0,onOpenChangeComplete:void 0}}function tL(e,t){const{children:a,open:o,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:d,disablePointerDismissal:f=!1,modal:m=!0,actionsRef:g,handle:h,triggerId:b,defaultTriggerId:_=null}=t,j=e==="drawer",E=m,y=f,k="dialog",N=Go(!0),w=N!=null,S={modal:E,disablePointerDismissal:y,nested:w,role:k},R=gC((L,I)=>new ZP({open:i,openProp:o,activeTriggerId:_,triggerIdProp:b,...S},L,I),!0);R.useControlledProp("openProp",o),R.useControlledProp("triggerIdProp",b),R.useSyncedValues(S),R.useContextCallback("onOpenChange",c),R.useContextCallback("onOpenChangeComplete",d);const A=R.useState("open"),T=R.useState("mounted"),z=R.useState("payload");OO(R,A),s_(R);const{forceUnmount:M}=a_(A,R);x.useImperativeHandle(g,()=>({unmount:M,close:()=>R.setOpen(!1,rt(Bb))}),[M,R]);const P=A||T;return n.jsxs(yN.Provider,{value:R,children:[h&&n.jsx(t_,{handle:h,store:R}),P&&n.jsx(QP,{store:R,parentContext:N?.context,isDrawer:j}),typeof a=="function"?a({payload:z}):a]})}function NN(e){return tL("dialog",e)}const EN=x.forwardRef(function(t,a){const{render:o,className:i,style:c,id:d,...f}=t,m=Go(),g=ra(d);return m.useSyncedValueWithCleanup("titleElementId",g),Et("h2",t,{ref:a,props:[{id:g},f]})});function Bx({...e}){return n.jsx(NN,{"data-slot":"dialog",...e})}function nL({...e}){return n.jsx(CN,{"data-slot":"dialog-portal",...e})}function sL({...e}){return n.jsx(wp,{"data-slot":"dialog-close",...e})}function aL({className:e,...t}){return n.jsx(jN,{"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 $x({className:e,children:t,showCloseButton:a=!0,...o}){return n.jsxs(nL,{children:[n.jsx(aL,{}),n.jsxs(SN,{"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,a&&n.jsxs(wp,{"data-slot":"dialog-close",render:n.jsx(or,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[n.jsx(gs,{}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Ux({className:e,...t}){return n.jsx("div",{"data-slot":"dialog-header",className:St("flex flex-col gap-2",e),...t})}function Rk({className:e,showCloseButton:t=!1,children:a,...o}){return n.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:[a,t&&n.jsx(wp,{render:n.jsx(or,{variant:"outline"}),children:"Close"})]})}function qx({className:e,...t}){return n.jsx(EN,{"data-slot":"dialog-title",className:St("font-heading text-base leading-none font-medium",e),...t})}function rL({className:e,...t}){return n.jsx(kN,{"data-slot":"dialog-description",className:St("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const oL={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},iL={sm:"sm",md:"default"};function re({variant:e="secondary",size:t="md",loading:a,className:o,children:i,disabled:c,type:d="button",...f}){return n.jsxs(or,{type:d,variant:oL[e],size:iL[t],disabled:c||a,className:o,...f,children:[a?n.jsx(bn,{size:14}):null,i]})}function Ee(e){return n.jsx(IP,{...e})}function un(e){return n.jsx(BP,{...e})}function lL(e){return n.jsx("select",{...e,className:ge("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 le({label:e,hint:t,badge:a,children:o}){return n.jsxs("div",{className:"block space-y-1",children:[n.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,a&&n.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:a})]}),o,t&&n.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:t})]})}function Bt({checked:e,onChange:t,label:a,disabled:o}){return n.jsxs("label",{className:ge("inline-flex items-center gap-2",o&&"opacity-50"),children:[n.jsx(GP,{checked:e,onCheckedChange:t,disabled:o}),a&&n.jsx("span",{className:"text-sm",children:a})]})}function $e({children:e,tone:t="muted",className:a}){const o=t==="danger"?"destructive":t==="muted"?"secondary":"outline",i={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 n.jsx(qP,{variant:o,className:ge("rounded-md",i[t],a),children:e})}function Xt({open:e,onClose:t,title:a,description:o,children:i,footer:c,size:d="md"}){const f={sm:"sm:max-w-md",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl"};return n.jsx(Bx,{open:e,onOpenChange:m=>{m||t()},children:n.jsxs($x,{className:ge("flex max-h-[88vh] w-full flex-col gap-0 p-0",f[d]),children:[(a||o)&&n.jsxs(Ux,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[a&&n.jsx(qx,{children:a}),o&&n.jsx(rL,{children:o})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:i}),c&&n.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function bn({size:e=14}){return n.jsx(YP,{style:{width:e,height:e}})}function ut({children:e}){return n.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 tt({label:e="Cargando…"}){return n.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[n.jsx(bn,{})," ",e]})}const RN=x.createContext(null);let cL=1;function uL({children:e}){const[t,a]=x.useState([]),o=x.useCallback((c,d)=>{const f=cL++;a(m=>[...m,{id:f,kind:c,message:d}]),setTimeout(()=>{a(m=>m.filter(g=>g.id!==f))},4500)},[]),i=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=i,()=>{delete window.__apxToast}),[i]),n.jsxs(RN.Provider,{value:i,children:[e,n.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=>n.jsx("div",{className:ge("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:n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("span",{className:ge("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")}),n.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function Je(){const e=x.useContext(RN);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function TN(){const{data:e,error:t,isLoading:a}=Be("/api/health",()=>uP.get(),{refreshInterval:Qf.health});return{health:e,error:t,isLoading:a,isUp:!t&&!!e}}function dL(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/engines",()=>Hc.list());return{engines:e?.engines||[],error:t,isLoading:a,mutate:o}}function fL(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/telegram/status",()=>Pn.status(),{refreshInterval:Qf.telegramStatus});return{status:e,error:t,isLoading:a,mutate:o}}function D_(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/telegram/channels",()=>Pn.channels.list());return{channels:e?.channels||[],error:t,isLoading:a,mutate:o}}function P_(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/telegram/contacts",()=>Pn.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:t,isLoading:a,mutate:o}}function ps(e){return typeof e=="string"&&e.startsWith("*** set ***")}function Fr(e,t="(no seteada)"){return ps(e)?e:t}function Lo(e){if(typeof e!="string")return null;const t=e.match(/\(\.\.\.([^)]+)\)/);return t?t[1]:null}function AN({channel:e,onClose:t,onSaved:a}){const o=Je(),[i,c]=x.useState(!1),[d,f]=x.useState({name:""});x.useEffect(()=>{f(e?{...e,bot_token:""}:{name:""})},[e?.name]);const m=async()=>{if(!d.name?.trim()){o.error(u("telegram_channel_dialog.name_required"));return}c(!0);try{e&&e.name!==""&&e?.name===d.name?await Pn.channels.patch(e.name,d):await Pn.channels.upsert(d),o.success(u("telegram_channel_dialog.saved")),a()}catch(g){o.error(g.message)}finally{c(!1)}};return n.jsx(Xt,{open:!!e,onClose:t,title:e?.name?u("telegram_channel_dialog.edit_title",{name:e.name}):u("telegram_channel_dialog.new_title"),description:u("telegram_ui.channel_dialog_desc"),footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:i,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:m,loading:i,children:u("common.save")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("telegram_channel_dialog.name_label"),children:n.jsx(Ee,{value:d.name,onChange:g=>f({...d,name:g.target.value}),disabled:!!e?.name})}),n.jsx(le,{label:u("telegram_channel_dialog.token_label"),hint:e?.bot_token?Fr(e.bot_token):u("telegram_ui.bot_token_hint"),children:n.jsx(Ee,{type:"password",value:d.bot_token||"",onChange:g=>f({...d,bot_token:g.target.value}),placeholder:e?.bot_token?Fr(e.bot_token):""})}),n.jsx(le,{label:u("telegram_channel_dialog.chat_id"),children:n.jsx(Ee,{value:d.chat_id||"",onChange:g=>f({...d,chat_id:g.target.value})})}),n.jsx(le,{label:u("telegram_channel_dialog.project_label"),hint:u("telegram_channel_dialog.project_hint"),children:n.jsx(Ee,{value:d.project||"",onChange:g=>f({...d,project:g.target.value})})}),n.jsx(le,{label:u("telegram_channel_dialog.route_label"),hint:u("telegram_channel_dialog.route_hint"),children:n.jsx(Ee,{value:d.route_to_agent||"",onChange:g=>f({...d,route_to_agent:g.target.value})})}),n.jsx(le,{label:u("telegram_channel_dialog.owner_label"),hint:u("telegram_channel_dialog.owner_hint"),children:n.jsx(Ee,{value:d.owner_user_id!=null?String(d.owner_user_id):"",onChange:g=>{const h=g.target.value.trim();f({...d,owner_user_id:h===""?void 0:/^\d+$/.test(h)?Number(h):h})},placeholder:"889721252"})}),n.jsx(Bt,{checked:!!d.respond_with_engine,onChange:g=>f({...d,respond_with_engine:g}),label:u("telegram_channel_dialog.respond_label")})]})})}function MN({channel:e,onClose:t}){const a=Je(),[o,i]=x.useState(u("admin.telegram_default_message")),[c,d]=x.useState(!1),f=async()=>{if(!(!o.trim()||!e)){d(!0);try{await Pn.send({text:o,channel:e.name}),a.success(u("telegram_ui.message_sent")),t()}catch(m){a.error(m.message)}finally{d(!1)}}};return n.jsx(Xt,{open:!!e,onClose:t,title:e?u("telegram_send_dialog.title",{name:e.name}):"",description:e?u("telegram_ui.send_chat_id",{id:e.chat_id||"—"}):"",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:c,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:f,loading:c,children:u("chat_ui.send")})]}),children:n.jsx(le,{label:u("telegram_ui.message_label"),children:n.jsx(un,{rows:4,value:o,onChange:m=>i(m.target.value)})})})}function zN({bare:e=!1}){const t=Je(),{contacts:a,roles:o,channelOwners:i,isLoading:c,mutate:d}=P_(),f=new Set(i.filter(_=>_.owner_user_id!=null).map(_=>String(_.owner_user_id))),m=Array.from(new Set(["owner","guest",...Object.keys(o)])),g=async(_,j)=>{try{await Pn.contacts.patch(_.user_id,{role:j}),t.success(u("telegram_ui.role_assigned",{name:_.name||_.user_id,role:j})),d()}catch(E){t.error(E.message)}},h=async _=>{if(confirm(u("telegram_contacts.delete_confirm",{name:_.name||String(_.user_id)})))try{await Pn.contacts.remove(_.user_id),t.success(u("telegram_contacts.removed")),d()}catch(j){t.error(j.message)}},b=n.jsxs(n.Fragment,{children:[c&&n.jsx(tt,{}),!c&&a.length===0&&n.jsx(ut,{children:u("telegram_contacts.empty")}),a.length>0&&n.jsx("ul",{className:"space-y-2 text-sm",children:a.map(_=>{const j=f.has(String(_.user_id)),E=j?"owner":_.role||"guest";return n.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("span",{className:"font-medium",children:_.name||"—"}),_.username&&n.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",_.username]}),j&&n.jsx($e,{tone:"success",children:u("telegram_contacts.owner_badge")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ue,{content:u(j?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:n.jsx(lL,{value:E,disabled:j,onChange:y=>g(_,y.target.value),children:m.map(y=>n.jsx("option",{value:y,children:y},y))})}),n.jsx(re,{size:"sm",variant:"destructive",onClick:()=>h(_),children:u("common.delete")})]})]}),n.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[n.jsxs("span",{children:["user_id: ",String(_.user_id)]}),n.jsxs("span",{children:[u("telegram_contacts.last_seen")," ",_.last_seen?_.last_seen.slice(0,10):"—"]}),n.jsx("span",{children:pL(o[E])})]})]},String(_.user_id))})})]});return e?b:n.jsx(Ve,{title:u("telegram_contacts.title"),description:u("telegram_contacts.desc"),children:b})}function pL(e){return!e||e.tools===void 0?"":e.tools==="*"?u("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${u("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:u("telegram_contacts.tools_none"):""}function mL(){const e=Tn(),[t,a]=qo(),o=Je(),{health:i,isUp:c}=TN(),{projects:d,isLoading:f,mutate:m}=cu(),{engines:g,isLoading:h}=dL(),{status:b,mutate:_}=fL(),{channels:j,isLoading:E,mutate:y}=D_(),[k,N]=x.useState(null),[w,S]=x.useState(null),R=async()=>{try{await al.reload(),o.success(u("admin.reload_success"))}catch(M){o.error(M.message)}},A=async()=>{try{b?.enabled?(await Pn.stop(),o.info(u("admin.telegram_polling_stopped"))):(await Pn.start(),o.success(u("admin.telegram_polling_started"))),_()}catch(M){o.error(M.message)}},T=async M=>{if(confirm(u("telegram_channels.delete_confirm",{name:M})))try{await Pn.channels.remove(M),o.success(u("admin.telegram_channel_removed")),y()}catch(P){o.error(P.message)}},z=async(M,P)=>{if(confirm(u("admin.unregister_confirm",{label:P})))try{await Zn.remove(M),o.success(u("project.unregistered")),m()}catch(L){o.error(L.message)}};return n.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[n.jsxs("header",{className:"flex items-end justify-between",children:[n.jsxs("div",{children:[n.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:u("admin.title")}),n.jsx("p",{className:"text-sm text-muted-fg",children:u("admin.subtitle")})]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ue,{content:u("daemon.reload_hint"),children:n.jsxs(re,{size:"sm",onClick:R,children:[u("common.reload")," config"]})}),n.jsxs(re,{size:"sm",variant:"primary",onClick:()=>{const M=new URLSearchParams(t);M.set("action","add-project"),a(M)},children:[n.jsx(Dt,{size:14})," ",u("nav.project")]})]})]}),n.jsx(Ve,{title:u("daemon.version"),children:n.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[n.jsx(xh,{label:u("daemon.version"),value:i?.version||"—"}),n.jsx(xh,{label:u("daemon.uptime"),value:i?`${i.uptime_s}s`:"—"}),n.jsx(xh,{label:u("daemon.status"),value:u(c?"daemon.running":"daemon.down"),ok:c})]})}),n.jsxs(Ve,{title:u("admin.engines_title"),description:u("admin.engines_subtitle"),children:[h&&n.jsx(tt,{}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.map(M=>n.jsx($e,{tone:"info",children:M},M))})]}),n.jsxs(Ve,{title:u("admin.telegram_title"),description:u("admin.telegram_subtitle"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Bt,{checked:!!b?.enabled,onChange:A,label:b?.enabled?u("admin.telegram_polling_on"):u("admin.telegram_polling_off")}),n.jsxs(re,{size:"sm",onClick:()=>N({name:""}),children:[n.jsx(Dt,{size:14})," ",u("admin.telegram_add_channel")]})]}),children:[E&&n.jsx(tt,{}),j.length===0&&n.jsx(ut,{children:u("common.none_yet")}),n.jsx("ul",{className:"space-y-2 text-sm",children:j.map(M=>n.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-medium",children:M.name}),n.jsxs("div",{className:"flex items-center gap-2",children:[M.project&&n.jsxs($e,{tone:"success",children:["project = ",M.project]}),n.jsxs(re,{size:"sm",variant:"ghost",onClick:()=>S(M),children:[n.jsx(Sa,{size:13})," ",u("admin.telegram_send_test")]}),n.jsx(re,{size:"sm",variant:"secondary",onClick:()=>N(M),children:u("common.edit")}),n.jsx(re,{size:"sm",variant:"destructive",onClick:()=>T(M.name),children:u("common.delete")})]})]}),n.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[n.jsxs("span",{children:["chat_id: ",M.chat_id||"—"]}),n.jsxs("span",{children:["route_to_agent: ",M.route_to_agent||"default APX"]}),n.jsxs("span",{children:["engine: ",M.respond_with_engine?u("admin.engine_badge"):u("admin.engine_badge_no")]})]})]},M.name))})]}),n.jsx(zN,{}),n.jsxs(Ve,{title:u("admin.projects_title"),description:u("admin.projects_subtitle"),children:[f&&n.jsx(tt,{}),n.jsx("ul",{className:"divide-y divide-border",children:d.map(M=>n.jsxs("li",{className:"flex items-center gap-3 py-2",children:[n.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",M.id]}),n.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${M.id}`),children:[n.jsx("span",{className:"font-medium",children:M.name||M.path.split("/").pop()}),n.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:M.path})]}),n.jsxs($e,{children:[M.agents??0," ",u("admin.agents_badge")]}),Number(M.id)!==0&&n.jsx(re,{size:"sm",variant:"destructive",onClick:()=>z(String(M.id),M.name||M.path),children:u("admin.unregister")})]},M.id))})]}),n.jsx(AN,{channel:k,onClose:()=>N(null),onSaved:()=>{N(null),y()}}),n.jsx(MN,{channel:w,onClose:()=>S(null)})]})}function xh({label:e,value:t,ok:a}){return n.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),n.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[a!==void 0&&n.jsx(du,{ok:a}),n.jsx("span",{children:t})]})]})}const gL={list:(e=!1)=>se.get(`/api/inbox${e?"?include_empty=1":""}`).then(t=>Ao(t).items)};function hL(e=!1){const{data:t,error:a,isLoading:o,mutate:i}=Be(`/api/inbox?include_empty=${e?1:0}`,()=>gL.list(e),{refreshInterval:15e3});return{rows:t??[],error:a,isLoading:o,mutate:i}}function xL(){const e=Tn(),[t,a]=x.useState(!1),{rows:o,isLoading:i}=hL(t),c=d=>{if(d.kind==="super_agent"){e("/p/0/chat");return}e(`/p/${d.project_id}/agents/${encodeURIComponent(d.agent_slug)}`)};return n.jsxs(Ve,{fullHeight:!0,title:u("inbox.title"),description:u("inbox.subtitle"),action:n.jsx(re,{size:"sm",variant:t?"primary":"ghost",onClick:()=>a(d=>!d),children:u("inbox.show_quiet")}),children:[i?n.jsx(tt,{}):null,!i&&o.length===0?n.jsx(ut,{children:u("inbox.empty")}):null,n.jsx("ul",{className:"space-y-2","data-testid":"inbox-list",children:o.map(d=>n.jsx("li",{children:n.jsxs("button",{type:"button","data-testid":`inbox-row-${d.agent_slug}`,onClick:()=>c(d),className:`flex w-full items-start gap-3 rounded-md border px-3 py-2 text-left transition ${d.pinned?"border-primary/60 bg-primary/5 hover:bg-primary/10":"border-border bg-muted/30 hover:bg-muted/50"}`,children:[n.jsx("span",{className:"mt-0.5 text-lg leading-none",children:d.agent_emoji||"🤖"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsxs("span",{className:"flex min-w-0 items-baseline gap-2",children:[n.jsx("span",{className:"truncate font-medium",children:d.agent_name||d.agent_slug}),d.pinned?n.jsx($e,{tone:"info",children:u("inbox.pinned")}):null,n.jsx("span",{className:"ml-auto shrink-0 text-xs opacity-50 sm:hidden",children:Tk(d.last_activity_at)})]}),n.jsxs("span",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-xs opacity-55",children:[d.project_name?n.jsx("span",{className:"truncate",children:d.project_name}):null,d.channel?n.jsxs("span",{className:"opacity-70",children:["· ",d.channel]}):null]}),n.jsx("span",{className:"mt-1 block line-clamp-2 text-sm leading-snug opacity-75 sm:line-clamp-1",children:d.preview||u("inbox.no_reply_yet")})]}),n.jsx("span",{className:"hidden shrink-0 text-xs opacity-50 sm:block",children:Tk(d.last_activity_at)})]})},`${d.project_id??"global"}-${d.agent_slug}`))})]})}function Tk(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?"":new Date().toDateString()===t.toDateString()?t.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):t.toLocaleDateString()}const ON=x.createContext(null),DN=x.createContext(null),PN=x.createContext(""),LN=x.createContext(null),IN=x.createContext(null),BN=x.createContext(null);function bL({children:e}){const[t,a]=x.useState(null),[o,i]=x.useState(""),[c,d]=x.useState(null);return n.jsx(DN.Provider,{value:a,children:n.jsx(ON.Provider,{value:t,children:n.jsx(LN.Provider,{value:i,children:n.jsx(PN.Provider,{value:o,children:n.jsx(BN.Provider,{value:d,children:n.jsx(IN.Provider,{value:c,children:e})})})})})})}function _L(){return x.useContext(ON)}function vL(e,t){const a=x.useContext(DN);x.useEffect(()=>(a?.({collapsed:e,toggle:t}),()=>a?.(null)),[e,t,a])}function yL(){return x.useContext(PN)}function jL(e){const t=x.useContext(LN);x.useEffect(()=>(t?.(e),()=>t?.("")),[e,t])}function kL(){return x.useContext(IN)}function wL(e){const t=x.useContext(BN);x.useEffect(()=>(t?.(e),()=>t?.(null)),[e,t])}function $N({sections:e,active:t,onChange:a,collapsed:o,onToggleCollapse:i,actions:c,contentClassName:d,testId:f,children:m}){return vL(o,i),n.jsxs("div",{className:"flex h-full",children:[n.jsx(zD,{sections:e,active:t,onChange:a,collapsed:o}),n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[c?n.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 px-6 pt-3",children:c}):null,n.jsx("div",{className:ge("flex-1 min-h-0 overflow-y-auto",d),"data-testid":f,children:m})]})]})}function SL({className:e}){return n.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M18.833 9.637a4.167 4.167 0 1 1 0 8.333 4.167 4.167 0 0 1 0-8.333zm-13.666 0a4.167 4.167 0 1 1 0 8.333 4.167 4.167 0 0 1 0-8.333zM12 2a4.167 4.167 0 1 1 0 8.333A4.167 4.167 0 0 1 12 2z"})})}function UN({className:e}){return n.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M19.355 18.538a68.967 68.959 0 0 0 1.858-2.954.81.81 0 0 0-.062-.9c-.516-.685-1.504-2.075-2.042-3.362-.553-1.321-.636-3.375-.64-4.377a1.707 1.707 0 0 0-.358-1.05l-3.198-4.064a3.744 3.744 0 0 1-.076.543c-.106.503-.307 1.004-.536 1.5-.134.29-.29.6-.446.914l-.31.626c-.516 1.068-.997 2.227-1.132 3.59-.124 1.26.046 2.73.815 4.481.128.011.257.025.386.044a6.363 6.363 0 0 1 3.326 1.505c.916.79 1.744 1.922 2.415 3.5zM8.199 22.569c.073.012.146.02.22.02.78.024 2.095.092 3.16.29.87.16 2.593.64 4.01 1.055 1.083.316 2.198-.548 2.355-1.664.114-.814.33-1.735.725-2.58l-.01.005c-.67-1.87-1.522-3.078-2.416-3.849a5.295 5.295 0 0 0-2.778-1.257c-1.54-.216-2.952.19-3.84.45.532 2.218.368 4.829-1.425 7.531zM5.533 9.938c-.023.1-.056.197-.098.29L2.82 16.059a1.602 1.602 0 0 0 .313 1.772l4.116 4.24c2.103-3.101 1.796-6.02.836-8.3-.728-1.73-1.832-3.081-2.55-3.831zM9.32 14.01c.615-.183 1.606-.465 2.745-.534-.683-1.725-.848-3.233-.716-4.577.154-1.552.7-2.847 1.235-3.95.113-.235.223-.454.328-.664.149-.297.288-.577.419-.86.217-.47.379-.885.46-1.27.08-.38.08-.72-.014-1.043-.095-.325-.297-.675-.68-1.06a1.6 1.6 0 0 0-1.475.36l-4.95 4.452a1.602 1.602 0 0 0-.513.952l-.427 2.83c.672.59 2.328 2.316 3.335 4.711.09.21.175.43.253.653z"})})}function CL({className:e}){return n.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:n.jsx("path",{d:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z"})})}const Ak={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 qN({mood:e="happy",className:t}){const a=Ak[e]??Ak.happy,[o,i]=a.eyes,c="text-emerald-700 dark:text-emerald-600/70";return n.jsxs("div",{"aria-hidden":!0,className:St("select-none whitespace-pre font-mono leading-none text-emerald-400",t),children:[a.top&&n.jsx("div",{children:n.jsx("span",{className:c,children:` ${a.top}`})}),n.jsx("div",{children:" ▄███████▄"}),n.jsxs("div",{children:[" █ ",n.jsx("span",{className:c,children:"██"})," ",n.jsx("span",{className:c,children:"██"})," █"]}),n.jsx("div",{children:` █ ${o} ${i} █`}),n.jsx("div",{children:` █ ${a.mouth} █`}),n.jsx("div",{children:" ▀███████▀"})]})}function HN({mood:e="confused",title:t,titleClassName:a,message:o,action:i,className:c,testId:d}){return n.jsx("div",{className:St("grid h-full place-items-center p-8",c),"data-testid":d,children:n.jsxs("div",{className:"flex flex-col items-center text-center",children:[n.jsx(qN,{mood:e,className:"mb-6 text-sm"}),t!=null&&n.jsx("div",{className:St("font-mono font-semibold leading-none tracking-tight text-foreground",a),children:t}),o!=null&&n.jsx("p",{className:"mt-4 max-w-sm text-sm text-muted-fg",children:o}),i&&n.jsx("div",{className:"mt-6",children:i})]})})}const L_={pending:{labelKey:"tasks.status_pending",color:"text-amber-500",dot:"bg-amber-400",Icon:RA},running:{labelKey:"tasks.status_running",color:"text-sky-500",dot:"bg-sky-400",Icon:Js,spin:!0},in_review:{labelKey:"tasks.status_in_review",color:"text-violet-500",dot:"bg-violet-400",Icon:K2},blocked:{labelKey:"tasks.status_blocked",color:"text-slate-400",dot:"bg-slate-400",Icon:TA}},VN=["pending","running","in_review","blocked"];function Af(e){return e.state==="done"?"done":e.state==="dropped"?"dropped":e.status??"pending"}function I_(e){return u(L_[e].labelKey)}function Mf({status:e,className:t}){if(e==="done")return n.jsx(Vf,{className:ge("size-4 text-emerald-500",t)});if(e==="dropped")return n.jsx(Y2,{className:ge("size-4 text-muted-foreground",t)});const a=L_[e];return n.jsx(a.Icon,{className:ge("size-4",a.color,a.spin&&"animate-spin",t)})}function B_({status:e}){const t=e==="done"?u("tasks.done_label"):e==="dropped"?u("tasks.dropped_label"):I_(e),a=e==="done"?"text-emerald-500 border-emerald-500/30":e==="dropped"?"text-muted-foreground border-border":`${L_[e].color} border-current/30`;return n.jsxs("span",{className:ge("inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium capitalize",a),children:[n.jsx(Mf,{status:e,className:"size-3"}),t]})}function NL(e,t){var a,o=1;e==null&&(e=0),t==null&&(t=0);function i(){var c,d=a.length,f,m=0,g=0;for(c=0;c<d;++c)f=a[c],m+=f.x,g+=f.y;for(m=(m/d-e)*o,g=(g/d-t)*o,c=0;c<d;++c)f=a[c],f.x-=m,f.y-=g}return i.initialize=function(c){a=c},i.x=function(c){return arguments.length?(e=+c,i):e},i.y=function(c){return arguments.length?(t=+c,i):t},i.strength=function(c){return arguments.length?(o=+c,i):o},i}function EL(e){const t=+this._x.call(null,e),a=+this._y.call(null,e);return FN(this.cover(t,a),t,a,e)}function FN(e,t,a,o){if(isNaN(t)||isNaN(a))return e;var i,c=e._root,d={data:o},f=e._x0,m=e._y0,g=e._x1,h=e._y1,b,_,j,E,y,k,N,w;if(!c)return e._root=d,e;for(;c.length;)if((y=t>=(b=(f+g)/2))?f=b:g=b,(k=a>=(_=(m+h)/2))?m=_:h=_,i=c,!(c=c[N=k<<1|y]))return i[N]=d,e;if(j=+e._x.call(null,c.data),E=+e._y.call(null,c.data),t===j&&a===E)return d.next=c,i?i[N]=d:e._root=d,e;do i=i?i[N]=new Array(4):e._root=new Array(4),(y=t>=(b=(f+g)/2))?f=b:g=b,(k=a>=(_=(m+h)/2))?m=_:h=_;while((N=k<<1|y)===(w=(E>=_)<<1|j>=b));return i[w]=c,i[N]=d,e}function RL(e){var t,a,o=e.length,i,c,d=new Array(o),f=new Array(o),m=1/0,g=1/0,h=-1/0,b=-1/0;for(a=0;a<o;++a)isNaN(i=+this._x.call(null,t=e[a]))||isNaN(c=+this._y.call(null,t))||(d[a]=i,f[a]=c,i<m&&(m=i),i>h&&(h=i),c<g&&(g=c),c>b&&(b=c));if(m>h||g>b)return this;for(this.cover(m,g).cover(h,b),a=0;a<o;++a)FN(this,d[a],f[a],e[a]);return this}function TL(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var a=this._x0,o=this._y0,i=this._x1,c=this._y1;if(isNaN(a))i=(a=Math.floor(e))+1,c=(o=Math.floor(t))+1;else{for(var d=i-a||1,f=this._root,m,g;a>e||e>=i||o>t||t>=c;)switch(g=(t<o)<<1|e<a,m=new Array(4),m[g]=f,f=m,d*=2,g){case 0:i=a+d,c=o+d;break;case 1:a=i-d,c=o+d;break;case 2:i=a+d,o=c-d;break;case 3:a=i-d,o=c-d;break}this._root&&this._root.length&&(this._root=f)}return this._x0=a,this._y0=o,this._x1=i,this._y1=c,this}function AL(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function ML(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 Jn(e,t,a,o,i){this.node=e,this.x0=t,this.y0=a,this.x1=o,this.y1=i}function zL(e,t,a){var o,i=this._x0,c=this._y0,d,f,m,g,h=this._x1,b=this._y1,_=[],j=this._root,E,y;for(j&&_.push(new Jn(j,i,c,h,b)),a==null?a=1/0:(i=e-a,c=t-a,h=e+a,b=t+a,a*=a);E=_.pop();)if(!(!(j=E.node)||(d=E.x0)>h||(f=E.y0)>b||(m=E.x1)<i||(g=E.y1)<c))if(j.length){var k=(d+m)/2,N=(f+g)/2;_.push(new Jn(j[3],k,N,m,g),new Jn(j[2],d,N,k,g),new Jn(j[1],k,f,m,N),new Jn(j[0],d,f,k,N)),(y=(t>=N)<<1|e>=k)&&(E=_[_.length-1],_[_.length-1]=_[_.length-1-y],_[_.length-1-y]=E)}else{var w=e-+this._x.call(null,j.data),S=t-+this._y.call(null,j.data),R=w*w+S*S;if(R<a){var A=Math.sqrt(a=R);i=e-A,c=t-A,h=e+A,b=t+A,o=j.data}}return o}function OL(e){if(isNaN(h=+this._x.call(null,e))||isNaN(b=+this._y.call(null,e)))return this;var t,a=this._root,o,i,c,d=this._x0,f=this._y0,m=this._x1,g=this._y1,h,b,_,j,E,y,k,N;if(!a)return this;if(a.length)for(;;){if((E=h>=(_=(d+m)/2))?d=_:m=_,(y=b>=(j=(f+g)/2))?f=j:g=j,t=a,!(a=a[k=y<<1|E]))return this;if(!a.length)break;(t[k+1&3]||t[k+2&3]||t[k+3&3])&&(o=t,N=k)}for(;a.data!==e;)if(i=a,!(a=a.next))return this;return(c=a.next)&&delete a.next,i?(c?i.next=c:delete i.next,this):t?(c?t[k]=c:delete t[k],(a=t[0]||t[1]||t[2]||t[3])&&a===(t[3]||t[2]||t[1]||t[0])&&!a.length&&(o?o[N]=a:this._root=a),this):(this._root=c,this)}function DL(e){for(var t=0,a=e.length;t<a;++t)this.remove(e[t]);return this}function PL(){return this._root}function LL(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function IL(e){var t=[],a,o=this._root,i,c,d,f,m;for(o&&t.push(new Jn(o,this._x0,this._y0,this._x1,this._y1));a=t.pop();)if(!e(o=a.node,c=a.x0,d=a.y0,f=a.x1,m=a.y1)&&o.length){var g=(c+f)/2,h=(d+m)/2;(i=o[3])&&t.push(new Jn(i,g,h,f,m)),(i=o[2])&&t.push(new Jn(i,c,h,g,m)),(i=o[1])&&t.push(new Jn(i,g,d,f,h)),(i=o[0])&&t.push(new Jn(i,c,d,g,h))}return this}function BL(e){var t=[],a=[],o;for(this._root&&t.push(new Jn(this._root,this._x0,this._y0,this._x1,this._y1));o=t.pop();){var i=o.node;if(i.length){var c,d=o.x0,f=o.y0,m=o.x1,g=o.y1,h=(d+m)/2,b=(f+g)/2;(c=i[0])&&t.push(new Jn(c,d,f,h,b)),(c=i[1])&&t.push(new Jn(c,h,f,m,b)),(c=i[2])&&t.push(new Jn(c,d,b,h,g)),(c=i[3])&&t.push(new Jn(c,h,b,m,g))}a.push(o)}for(;o=a.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function $L(e){return e[0]}function UL(e){return arguments.length?(this._x=e,this):this._x}function qL(e){return e[1]}function HL(e){return arguments.length?(this._y=e,this):this._y}function $_(e,t,a){var o=new U_(t??$L,a??qL,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function U_(e,t,a,o,i,c){this._x=e,this._y=t,this._x0=a,this._y0=o,this._x1=i,this._y1=c,this._root=void 0}function Mk(e){for(var t={data:e.data},a=t;e=e.next;)a=a.next={data:e.data};return t}var ss=$_.prototype=U_.prototype;ss.copy=function(){var e=new U_(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,a,o;if(!t)return e;if(!t.length)return e._root=Mk(t),e;for(a=[{source:t,target:e._root=new Array(4)}];t=a.pop();)for(var i=0;i<4;++i)(o=t.source[i])&&(o.length?a.push({source:o,target:t.target[i]=new Array(4)}):t.target[i]=Mk(o));return e};ss.add=EL;ss.addAll=RL;ss.cover=TL;ss.data=AL;ss.extent=ML;ss.find=zL;ss.remove=OL;ss.removeAll=DL;ss.root=PL;ss.size=LL;ss.visit=IL;ss.visitAfter=BL;ss.x=UL;ss.y=HL;function es(e){return function(){return e}}function qr(e){return(e()-.5)*1e-6}function VL(e){return e.x+e.vx}function FL(e){return e.y+e.vy}function GL(e){var t,a,o,i=1,c=1;typeof e!="function"&&(e=es(e==null?1:+e));function d(){for(var g,h=t.length,b,_,j,E,y,k,N=0;N<c;++N)for(b=$_(t,VL,FL).visitAfter(f),g=0;g<h;++g)_=t[g],y=a[_.index],k=y*y,j=_.x+_.vx,E=_.y+_.vy,b.visit(w);function w(S,R,A,T,z){var M=S.data,P=S.r,L=y+P;if(M){if(M.index>_.index){var I=j-M.x-M.vx,D=E-M.y-M.vy,$=I*I+D*D;$<L*L&&(I===0&&(I=qr(o),$+=I*I),D===0&&(D=qr(o),$+=D*D),$=(L-($=Math.sqrt($)))/$*i,_.vx+=(I*=$)*(L=(P*=P)/(k+P)),_.vy+=(D*=$)*L,M.vx-=I*(L=1-L),M.vy-=D*L)}return}return R>j+L||T<j-L||A>E+L||z<E-L}}function f(g){if(g.data)return g.r=a[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(a=new Array(h),g=0;g<h;++g)b=t[g],a[b.index]=+e(b,g,t)}}return d.initialize=function(g,h){t=g,o=h,m()},d.iterations=function(g){return arguments.length?(c=+g,d):c},d.strength=function(g){return arguments.length?(i=+g,d):i},d.radius=function(g){return arguments.length?(e=typeof g=="function"?g:es(+g),m(),d):e},d}function YL(e){return e.index}function zk(e,t){var a=e.get(t);if(!a)throw new Error("node not found: "+t);return a}function KL(e){var t=YL,a=b,o,i=es(30),c,d,f,m,g,h=1;e==null&&(e=[]);function b(k){return 1/Math.min(f[k.source.index],f[k.target.index])}function _(k){for(var N=0,w=e.length;N<h;++N)for(var S=0,R,A,T,z,M,P,L;S<w;++S)R=e[S],A=R.source,T=R.target,z=T.x+T.vx-A.x-A.vx||qr(g),M=T.y+T.vy-A.y-A.vy||qr(g),P=Math.sqrt(z*z+M*M),P=(P-c[S])/P*k*o[S],z*=P,M*=P,T.vx-=z*(L=m[S]),T.vy-=M*L,A.vx+=z*(L=1-L),A.vy+=M*L}function j(){if(d){var k,N=d.length,w=e.length,S=new Map(d.map((A,T)=>[t(A,T,d),A])),R;for(k=0,f=new Array(N);k<w;++k)R=e[k],R.index=k,typeof R.source!="object"&&(R.source=zk(S,R.source)),typeof R.target!="object"&&(R.target=zk(S,R.target)),f[R.source.index]=(f[R.source.index]||0)+1,f[R.target.index]=(f[R.target.index]||0)+1;for(k=0,m=new Array(w);k<w;++k)R=e[k],m[k]=f[R.source.index]/(f[R.source.index]+f[R.target.index]);o=new Array(w),E(),c=new Array(w),y()}}function E(){if(d)for(var k=0,N=e.length;k<N;++k)o[k]=+a(e[k],k,e)}function y(){if(d)for(var k=0,N=e.length;k<N;++k)c[k]=+i(e[k],k,e)}return _.initialize=function(k,N){d=k,g=N,j()},_.links=function(k){return arguments.length?(e=k,j(),_):e},_.id=function(k){return arguments.length?(t=k,_):t},_.iterations=function(k){return arguments.length?(h=+k,_):h},_.strength=function(k){return arguments.length?(a=typeof k=="function"?k:es(+k),E(),_):a},_.distance=function(k){return arguments.length?(i=typeof k=="function"?k:es(+k),y(),_):i},_}var XL={value:()=>{}};function GN(){for(var e=0,t=arguments.length,a={},o;e<t;++e){if(!(o=arguments[e]+"")||o in a||/[\s.]/.test(o))throw new Error("illegal type: "+o);a[o]=[]}return new rf(a)}function rf(e){this._=e}function QL(e,t){return e.trim().split(/^|\s+/).map(function(a){var o="",i=a.indexOf(".");if(i>=0&&(o=a.slice(i+1),a=a.slice(0,i)),a&&!t.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:o}})}rf.prototype=GN.prototype={constructor:rf,on:function(e,t){var a=this._,o=QL(e+"",a),i,c=-1,d=o.length;if(arguments.length<2){for(;++c<d;)if((i=(e=o[c]).type)&&(i=WL(a[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++c<d;)if(i=(e=o[c]).type)a[i]=Ok(a[i],e.name,t);else if(t==null)for(i in a)a[i]=Ok(a[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var a in t)e[a]=t[a].slice();return new rf(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var a=new Array(i),o=0,i,c;o<i;++o)a[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(c=this._[e],o=0,i=c.length;o<i;++o)c[o].value.apply(t,a)},apply:function(e,t,a){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,c=o.length;i<c;++i)o[i].value.apply(t,a)}};function WL(e,t){for(var a=0,o=e.length,i;a<o;++a)if((i=e[a]).name===t)return i.value}function Ok(e,t,a){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=XL,e=e.slice(0,o).concat(e.slice(o+1));break}return a!=null&&e.push({name:t,value:a}),e}var ol=0,wc=0,gc=0,YN=1e3,zf,Sc,Of=0,Io=0,Sp=0,Vc=typeof performance=="object"&&performance.now?performance:Date,KN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function XN(){return Io||(KN(ZL),Io=Vc.now()+Sp)}function ZL(){Io=0}function Hx(){this._call=this._time=this._next=null}Hx.prototype=QN.prototype={constructor:Hx,restart:function(e,t,a){if(typeof e!="function")throw new TypeError("callback is not a function");a=(a==null?XN():+a)+(t==null?0:+t),!this._next&&Sc!==this&&(Sc?Sc._next=this:zf=this,Sc=this),this._call=e,this._time=a,Vx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Vx())}};function QN(e,t,a){var o=new Hx;return o.restart(e,t,a),o}function JL(){XN(),++ol;for(var e=zf,t;e;)(t=Io-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ol}function Dk(){Io=(Of=Vc.now())+Sp,ol=wc=0;try{JL()}finally{ol=0,t8(),Io=0}}function e8(){var e=Vc.now(),t=e-Of;t>YN&&(Sp-=t,Of=e)}function t8(){for(var e,t=zf,a,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(a=t._next,t._next=null,t=e?e._next=a:zf=a);Sc=e,Vx(o)}function Vx(e){if(!ol){wc&&(wc=clearTimeout(wc));var t=e-Io;t>24?(e<1/0&&(wc=setTimeout(Dk,e-Vc.now()-Sp)),gc&&(gc=clearInterval(gc))):(gc||(Of=Vc.now(),gc=setInterval(e8,YN)),ol=1,KN(Dk))}}const n8=1664525,s8=1013904223,Pk=4294967296;function a8(){let e=1;return()=>(e=(n8*e+s8)%Pk)/Pk}function r8(e){return e.x}function o8(e){return e.y}var i8=10,l8=Math.PI*(3-Math.sqrt(5));function c8(e){var t,a=1,o=.001,i=1-Math.pow(o,1/300),c=0,d=.6,f=new Map,m=QN(b),g=GN("tick","end"),h=a8();e==null&&(e=[]);function b(){_(),g.call("tick",t),a<o&&(m.stop(),g.call("end",t))}function _(y){var k,N=e.length,w;y===void 0&&(y=1);for(var S=0;S<y;++S)for(a+=(c-a)*i,f.forEach(function(R){R(a)}),k=0;k<N;++k)w=e[k],w.fx==null?w.x+=w.vx*=d:(w.x=w.fx,w.vx=0),w.fy==null?w.y+=w.vy*=d:(w.y=w.fy,w.vy=0);return t}function j(){for(var y=0,k=e.length,N;y<k;++y){if(N=e[y],N.index=y,N.fx!=null&&(N.x=N.fx),N.fy!=null&&(N.y=N.fy),isNaN(N.x)||isNaN(N.y)){var w=i8*Math.sqrt(.5+y),S=y*l8;N.x=w*Math.cos(S),N.y=w*Math.sin(S)}(isNaN(N.vx)||isNaN(N.vy))&&(N.vx=N.vy=0)}}function E(y){return y.initialize&&y.initialize(e,h),y}return j(),t={tick:_,restart:function(){return m.restart(b),t},stop:function(){return m.stop(),t},nodes:function(y){return arguments.length?(e=y,j(),f.forEach(E),t):e},alpha:function(y){return arguments.length?(a=+y,t):a},alphaMin:function(y){return arguments.length?(o=+y,t):o},alphaDecay:function(y){return arguments.length?(i=+y,t):+i},alphaTarget:function(y){return arguments.length?(c=+y,t):c},velocityDecay:function(y){return arguments.length?(d=1-y,t):1-d},randomSource:function(y){return arguments.length?(h=y,f.forEach(E),t):h},force:function(y,k){return arguments.length>1?(k==null?f.delete(y):f.set(y,E(k)),t):f.get(y)},find:function(y,k,N){var w=0,S=e.length,R,A,T,z,M;for(N==null?N=1/0:N*=N,w=0;w<S;++w)z=e[w],R=y-z.x,A=k-z.y,T=R*R+A*A,T<N&&(M=z,N=T);return M},on:function(y,k){return arguments.length>1?(g.on(y,k),t):g.on(y)}}}function u8(){var e,t,a,o,i=es(-30),c,d=1,f=1/0,m=.81;function g(j){var E,y=e.length,k=$_(e,r8,o8).visitAfter(b);for(o=j,E=0;E<y;++E)t=e[E],k.visit(_)}function h(){if(e){var j,E=e.length,y;for(c=new Array(E),j=0;j<E;++j)y=e[j],c[y.index]=+i(y,j,e)}}function b(j){var E=0,y,k,N=0,w,S,R;if(j.length){for(w=S=R=0;R<4;++R)(y=j[R])&&(k=Math.abs(y.value))&&(E+=y.value,N+=k,w+=k*y.x,S+=k*y.y);j.x=w/N,j.y=S/N}else{y=j,y.x=y.data.x,y.y=y.data.y;do E+=c[y.data.index];while(y=y.next)}j.value=E}function _(j,E,y,k){if(!j.value)return!0;var N=j.x-t.x,w=j.y-t.y,S=k-E,R=N*N+w*w;if(S*S/m<R)return R<f&&(N===0&&(N=qr(a),R+=N*N),w===0&&(w=qr(a),R+=w*w),R<d&&(R=Math.sqrt(d*R)),t.vx+=N*j.value*o/R,t.vy+=w*j.value*o/R),!0;if(j.length||R>=f)return;(j.data!==t||j.next)&&(N===0&&(N=qr(a),R+=N*N),w===0&&(w=qr(a),R+=w*w),R<d&&(R=Math.sqrt(d*R)));do j.data!==t&&(S=c[j.data.index]*o/R,t.vx+=N*S,t.vy+=w*S);while(j=j.next)}return g.initialize=function(j,E){e=j,a=E,h()},g.strength=function(j){return arguments.length?(i=typeof j=="function"?j:es(+j),h(),g):i},g.distanceMin=function(j){return arguments.length?(d=j*j,g):Math.sqrt(d)},g.distanceMax=function(j){return arguments.length?(f=j*j,g):Math.sqrt(f)},g.theta=function(j){return arguments.length?(m=j*j,g):Math.sqrt(m)},g}function d8(e){var t=es(.1),a,o,i;typeof e!="function"&&(e=es(e==null?0:+e));function c(f){for(var m=0,g=a.length,h;m<g;++m)h=a[m],h.vx+=(i[m]-h.x)*o[m]*f}function d(){if(a){var f,m=a.length;for(o=new Array(m),i=new Array(m),f=0;f<m;++f)o[f]=isNaN(i[f]=+e(a[f],f,a))?0:+t(a[f],f,a)}}return c.initialize=function(f){a=f,d()},c.strength=function(f){return arguments.length?(t=typeof f=="function"?f:es(+f),d(),c):t},c.x=function(f){return arguments.length?(e=typeof f=="function"?f:es(+f),d(),c):e},c}function f8(e){var t=es(.1),a,o,i;typeof e!="function"&&(e=es(e==null?0:+e));function c(f){for(var m=0,g=a.length,h;m<g;++m)h=a[m],h.vy+=(i[m]-h.y)*o[m]*f}function d(){if(a){var f,m=a.length;for(o=new Array(m),i=new Array(m),f=0;f<m;++f)o[f]=isNaN(i[f]=+e(a[f],f,a))?0:+t(a[f],f,a)}}return c.initialize=function(f){a=f,d()},c.strength=function(f){return arguments.length?(t=typeof f=="function"?f:es(+f),d(),c):t},c.y=function(f){return arguments.length?(e=typeof f=="function"?f:es(+f),d(),c):e},c}const $s={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc",hub:"#94a3b8"};function Lk(e){return{agent:u("agents_ui.kind_agent"),memory:u("agents_ui.kind_memory"),thread:u("agents_ui.kind_thread"),task:u("agents_ui.kind_task"),routine:u("agents_ui.kind_routine"),agentlink:u("agents_ui.kind_hierarchy")}[e]??e}const Ik={core:24,hub:12,leaf:6},Lr=e=>e.role??"leaf",Bk=(e,t,a)=>Math.max(t,Math.min(a,e)),$k=e=>{const t=new Map;for(const a of e)t.set(a.id,a);return[...t.values()]},p8=(e,t=26)=>e.length>t?`${e.slice(0,t)}…`:e;function WN({nodes:e,edges:t,height:a=520,onNodeClick:o,toolbar:i}){const d=Math.round(1e3*a/760),f=x.useRef(null),m=x.useRef(null),g=x.useRef(null),h=x.useRef([]),b=x.useRef([]),_=x.useRef(null),j=x.useRef(null),E=x.useRef(null),y=x.useRef(!1),k=x.useRef({tx:0,ty:0,k:1}),N=x.useRef(()=>{}),[,w]=x.useState(0),[S,R]=x.useState(null),[A,T]=x.useState(!1),z=1e3/2,M=d/2,P=()=>w(Y=>Y+1),L=e.length>44;x.useEffect(()=>{const Y=Math.min(1e3,d)*.3,oe=e.filter(Te=>Lr(Te)==="hub"),ve=new Map;oe.forEach((Te,Ne)=>ve.set(Te.id,Ne/Math.max(1,oe.length)*Math.PI*2-Math.PI/2));const ie=e.map((Te,Ne)=>{const Me=Lr(Te);if(Me==="core")return{...Te,x:z,y:M,fx:z,fy:M};const De=ve.get(Te.id)??Ne/Math.max(1,e.length)*Math.PI*2,qe=Me==="hub"?Y:Y*1.7;return{...Te,x:z+Math.cos(De)*qe,y:M+Math.sin(De)*qe}}),xe=new Map(ie.map(Te=>[Te.id,Te])),ke=t.map(Te=>({source:xe.get(Te.source),target:xe.get(Te.target)})).filter(Te=>!!Te.source&&!!Te.target);h.current=ie,b.current=ke,P();const Re=Te=>{const Ne=Lr(Te.source),Me=Lr(Te.target);return Ne==="core"||Me==="core"?170:Ne==="hub"&&Me==="hub"?130:58},Ae=Te=>{const Ne=Lr(Te);return Ne==="core"?-700:Ne==="hub"?-360:-90},Ie=c8(ie).force("link",KL(ke).distance(Re).strength(.5)).force("charge",u8().strength(Ae)).force("center",NL(z,M).strength(.03)).force("x",d8(z).strength(.02)).force("y",f8(M).strength(.02)).force("collide",GL(Te=>Ik[Lr(Te)]+8)).alphaDecay(.025).on("tick",P);g.current=Ie;const Oe=setTimeout(()=>N.current(),1400);return()=>{clearTimeout(Oe),Ie.stop()}},[e,t,a]);const I=(Y,oe)=>{const ve=m.current.getBoundingClientRect();return{x:(Y-ve.left)/ve.width*1e3,y:(oe-ve.top)/ve.height*d}},D=(Y,oe,ve)=>{const ie=k.current,xe=Bk(ie.k*ve,.25,8);k.current={k:xe,tx:Y-(Y-ie.tx)*(xe/ie.k),ty:oe-(oe-ie.ty)*(xe/ie.k)},P()};N.current=()=>{const Y=h.current.filter(Ne=>Ne.x!=null&&Ne.y!=null);if(!Y.length)return;let oe=1/0,ve=1/0,ie=-1/0,xe=-1/0;for(const Ne of Y)oe=Math.min(oe,Ne.x),ve=Math.min(ve,Ne.y),ie=Math.max(ie,Ne.x),xe=Math.max(xe,Ne.y);const ke=60,Re=Math.max(1,ie-oe),Ae=Math.max(1,xe-ve),Ie=Bk(Math.min((1e3-ke*2)/Re,(d-ke*2)/Ae),.25,2.5),Oe=(oe+ie)/2,Te=(ve+xe)/2;k.current={k:Ie,tx:1e3/2-Oe*Ie,ty:d/2-Te*Ie},P()},x.useEffect(()=>{const Y=m.current;if(!Y)return;const oe=ve=>{ve.preventDefault();const ie=I(ve.clientX,ve.clientY);D(ie.x,ie.y,ve.deltaY>0?.9:1.1)};return Y.addEventListener("wheel",oe,{passive:!1}),()=>Y.removeEventListener("wheel",oe)},[]),x.useEffect(()=>{if(!A)return;const Y=oe=>{oe.key==="Escape"&&T(!1)};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[A]);const $=(Y,oe)=>{const ve=I(Y,oe),ie=k.current;return{x:(ve.x-ie.tx)/ie.k,y:(ve.y-ie.ty)/ie.k}},q=Y=>oe=>{Lr(Y)!=="core"&&(oe.stopPropagation(),_.current=Y,E.current={x:oe.clientX,y:oe.clientY},y.current=!1,oe.target.setPointerCapture?.(oe.pointerId),g.current?.alphaTarget(.3).restart())},G=Y=>{j.current={x:Y.clientX,y:Y.clientY},Y.currentTarget.setPointerCapture?.(Y.pointerId)},U=Y=>{if(_.current){const oe=E.current;oe&&!y.current&&Math.hypot(Y.clientX-oe.x,Y.clientY-oe.y)>4&&(y.current=!0);const ve=$(Y.clientX,Y.clientY);_.current.fx=ve.x,_.current.fy=ve.y;return}if(j.current){const oe=m.current.getBoundingClientRect();k.current.tx+=(Y.clientX-j.current.x)/oe.width*1e3,k.current.ty+=(Y.clientY-j.current.y)/oe.height*d,j.current={x:Y.clientX,y:Y.clientY},P()}},V=()=>{const Y=_.current;Y&&(Y.fx=null,Y.fy=null),_.current=null,j.current=null,g.current?.alphaTarget(0)},X=Y=>()=>{y.current||ee(Y)},Q=h.current,W=b.current,B=k.current,K=[...new Set(e.map(Y=>Y.kind))].filter(Y=>Y!=="agent"&&Y!=="hub"),ee=Y=>{R(Y),o?.(Y)},F=S?$k(W.filter(Y=>Y.target.id===S.id).map(Y=>Y.source)):[],ne=S?$k(W.filter(Y=>Y.source.id===S.id).map(Y=>Y.target)):[],Z=S?.detail&&S.detail.trim()!==S.label.trim()?S.detail:null,fe=({onClick:Y,title:oe,children:ve})=>n.jsx("button",{type:"button",title:oe,onClick:Y,className:"grid size-7 place-items-center rounded-md border border-border bg-card/80 text-muted-fg backdrop-blur hover:text-foreground",children:ve});return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{ref:f,className:A?"fixed inset-0 z-[60] flex flex-col gap-3 bg-background p-4":"relative",children:[n.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden rounded-xl border border-border bg-gradient-to-b from-background to-muted/20",children:[n.jsxs("div",{className:"absolute right-2 top-2 z-10 flex items-center gap-1.5",children:[i,n.jsx(fe,{onClick:()=>D(z,M,1.2),title:u("agents_ui.brain_zoom_in"),children:n.jsx(Dt,{size:14})}),n.jsx(fe,{onClick:()=>D(z,M,.83),title:u("agents_ui.brain_zoom_out"),children:n.jsx(oM,{size:14})}),n.jsx(fe,{onClick:()=>N.current(),title:u("agents_ui.brain_fit"),children:n.jsx(GA,{size:14})}),n.jsx(fe,{onClick:()=>T(Y=>!Y),title:u(A?"agents_ui.brain_exit_fs":"agents_ui.brain_fullscreen"),children:A?n.jsx(rM,{size:14}):n.jsx(aM,{size:14})})]}),n.jsxs("svg",{ref:m,viewBox:`0 0 1000 ${d}`,preserveAspectRatio:"xMidYMid meet",style:A?{height:"100%",width:"100%"}:{height:a},className:"w-full touch-none select-none",onPointerMove:U,onPointerUp:V,onPointerLeave:V,children:[n.jsxs("defs",{children:[n.jsxs("filter",{id:"brain-glow",x:"-80%",y:"-80%",width:"260%",height:"260%",children:[n.jsx("feGaussianBlur",{stdDeviation:"3",result:"blur"}),n.jsxs("feMerge",{children:[n.jsx("feMergeNode",{in:"blur"}),n.jsx("feMergeNode",{in:"SourceGraphic"})]})]}),n.jsxs("radialGradient",{id:"brain-core",cx:"50%",cy:"50%",r:"50%",children:[n.jsx("stop",{offset:"0%",stopColor:$s.agent,stopOpacity:"0.9"}),n.jsx("stop",{offset:"55%",stopColor:$s.agent,stopOpacity:"0.35"}),n.jsx("stop",{offset:"100%",stopColor:$s.agent,stopOpacity:"0"})]}),n.jsxs("radialGradient",{id:"brain-bg",cx:"50%",cy:"50%",r:"60%",children:[n.jsx("stop",{offset:"0%",stopColor:$s.agent,stopOpacity:"0.10"}),n.jsx("stop",{offset:"100%",stopColor:$s.agent,stopOpacity:"0"})]})]}),n.jsx("rect",{x:0,y:0,width:1e3,height:d,fill:"url(#brain-bg)",onPointerDown:G,className:"cursor-grab active:cursor-grabbing"}),n.jsxs("g",{transform:`translate(${B.tx},${B.ty}) scale(${B.k})`,children:[W.map((Y,oe)=>{const ve=$s[Y.target.kind==="hub"?Y.source.kind:Y.target.kind],ie=1.4+oe%5*.35;return n.jsxs("g",{children:[n.jsx("line",{x1:Y.source.x,y1:Y.source.y,x2:Y.target.x,y2:Y.target.y,stroke:ve,strokeOpacity:.16,strokeWidth:1.4}),n.jsx("line",{x1:Y.target.x,y1:Y.target.y,x2:Y.source.x,y2:Y.source.y,stroke:ve,strokeOpacity:.5,strokeWidth:2,strokeLinecap:"round",strokeDasharray:"1 14",children:n.jsx("animate",{attributeName:"stroke-dashoffset",values:"15;0",dur:`${ie}s`,repeatCount:"indefinite"})})]},oe)}),Q.map((Y,oe)=>{const ve=Lr(Y),ie=$s[Y.kind];if(ve==="core"){const Te=Y.emoji&&Y.emoji.trim()||Y.label.slice(0,2).toUpperCase();return n.jsxs("g",{transform:`translate(${Y.x},${Y.y})`,children:[n.jsxs("circle",{r:54,fill:"url(#brain-core)",children:[n.jsx("animate",{attributeName:"r",values:"50;58;50",dur:"4s",repeatCount:"indefinite"}),n.jsx("animate",{attributeName:"opacity",values:"0.85;1;0.85",dur:"4s",repeatCount:"indefinite"})]}),n.jsxs("circle",{r:26,fill:"none",stroke:$s.agent,strokeWidth:1.5,opacity:.5,children:[n.jsx("animate",{attributeName:"r",values:"26;48",dur:"3.2s",repeatCount:"indefinite"}),n.jsx("animate",{attributeName:"opacity",values:"0.5;0",dur:"3.2s",repeatCount:"indefinite"})]}),n.jsx("circle",{r:24,fill:$s.agent,filter:"url(#brain-glow)"}),n.jsx("circle",{r:24,fill:"none",stroke:"#ffffff",strokeOpacity:.35,strokeWidth:1}),n.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fontSize:Te.length<=2?20:11,fontWeight:700,fill:"#1a1030",children:Te.length>8?Te.slice(0,8):Te})]},Y.id)}const xe=S?.id===Y.id,ke=Ik[ve]+(xe?3:0),Re=2.4+oe%6*.4,Ae=`${oe%6*.3}s`,Ie=ve==="hub",Oe=Ie||xe||!L;return n.jsxs("g",{transform:`translate(${Y.x},${Y.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:q(Y),onClick:X(Y),children:[n.jsxs("circle",{r:ke,fill:ie,filter:"url(#brain-glow)",opacity:.3,children:[n.jsx("animate",{attributeName:"r",values:`${ke};${ke+6};${ke}`,dur:`${Re}s`,begin:Ae,repeatCount:"indefinite"}),n.jsx("animate",{attributeName:"opacity",values:"0.32;0.08;0.32",dur:`${Re}s`,begin:Ae,repeatCount:"indefinite"})]}),n.jsx("circle",{r:ke,fill:ie,fillOpacity:xe?1:.95,stroke:xe?"#fff":"#ffffff",strokeOpacity:xe?1:.25,strokeWidth:xe?2:1}),Y.emoji&&Ie&&n.jsx("text",{textAnchor:"middle",dominantBaseline:"central",fontSize:11,style:{pointerEvents:"none"},children:Y.emoji}),Oe&&n.jsx("text",{x:ke+4,y:4,fontSize:Ie?11:10,className:Ie?"fill-foreground font-medium":"fill-foreground/80",style:{pointerEvents:"none"},children:Y.label.length>22?`${Y.label.slice(0,22)}…`:Y.label})]},Y.id)})]})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[K.map(Y=>n.jsxs("span",{className:"inline-flex items-center gap-1",children:[n.jsx("span",{className:"size-2 rounded-full",style:{background:$s[Y]}})," ",Lk(Y)]},Y)),n.jsxs("span",{className:"ml-auto",children:[u("agents_ui.brain_pan_hint")," · ",u("agents_ui.nodes_drag_hint",{n:String(e.length)})]})]})]}),S&&n.jsxs("div",{className:"space-y-2.5 rounded-lg border border-border bg-card p-3 text-xs",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"size-2.5 rounded-full",style:{background:$s[S.kind]}}),S.emoji&&n.jsx("span",{className:"text-sm leading-none",children:S.emoji}),n.jsx("span",{className:"text-[13px] font-semibold",children:S.label}),n.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-fg",children:Lk(S.kind)}),S.relation&&n.jsxs("span",{className:"text-muted-fg",children:["· ",S.relation]}),n.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[S.slug&&o&&n.jsx("button",{type:"button",onClick:()=>o(S),className:"text-primary hover:underline",children:u("agents_ui.brain_open")}),n.jsx("button",{type:"button",onClick:()=>R(null),className:"text-muted-fg hover:text-foreground",children:"✕"})]})]}),Z&&n.jsx("p",{className:"whitespace-pre-wrap text-muted-fg",children:Z}),F.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-fg/70",children:u("agents_ui.brain_part_of")}),F.map(Y=>n.jsx(Uk,{node:Y,onClick:()=>R(Y)},Y.id))]}),ne.length>0&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[n.jsxs("span",{className:"text-[10px] uppercase tracking-wide text-muted-fg/70",children:[u("agents_ui.brain_branches")," · ",ne.length]}),ne.map(Y=>n.jsx(Uk,{node:Y,onClick:()=>R(Y)},Y.id))]})]})]})}function Uk({node:e,onClick:t}){return n.jsxs("button",{type:"button",onClick:t,className:"inline-flex max-w-[220px] items-center gap-1 rounded-md border border-border bg-muted/40 px-1.5 py-0.5 text-[11px] hover:border-muted-fg/50 hover:bg-muted",children:[n.jsx("span",{className:"size-1.5 shrink-0 rounded-full",style:{background:$s[e.kind]}}),e.emoji&&n.jsx("span",{className:"leading-none",children:e.emoji}),n.jsx("span",{className:"truncate",children:p8(e.label,28)})]})}function qk({pid:e}){const t=Tn(),a=Be(`/api/projects/${e}/tasks?state=open`,()=>Qn.list(e),{refreshInterval:2e4}),o=Be(`/api/projects/${e}/tasks-summary`,()=>Qn.summary(e),{refreshInterval:2e4}),i=Be(`/api/projects/${e}/routines`,()=>Br.list(e)),c=Be(`/api/projects/${e}/agents`,()=>an.list(e)),d=Be(`/api/projects/${e}/mcps`,()=>$r.list(e)),f=Be(`/api/projects/${e}/artifacts`,()=>Ws.list(e)),m=c.data??[],g=m.filter(y=>y.is_master||y.type==="orchestrator"),h=m.filter(y=>!(y.is_master||y.type==="orchestrator")),b=m8(m),_=b.some(y=>y.area),j=(i.data??[]).filter(y=>y.enabled).length,E=[...a.data??[]].sort((y,k)=>(k.created_at||"").localeCompare(y.created_at||"")).slice(0,6);return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[n.jsx(So,{title:u("project.overview.agents"),value:m.length,href:`/p/${e}/agents`,icon:rn}),n.jsx(So,{title:u("project.overview.tasks_open"),value:o.data?.open??a.data?.length??"…",href:`/p/${e}/tasks`,icon:pl}),n.jsx(So,{title:u("project.overview.routines_active"),value:j,href:`/p/${e}/routines`,icon:zo}),n.jsx(So,{title:u("project.overview.artifacts"),value:f.data?.length??"…",href:`/p/${e}/artifacts`,icon:gb})]}),o.data&&n.jsx("div",{className:"flex flex-wrap gap-2",children:VN.map(y=>n.jsxs(ff,{to:`/p/${e}/tasks`,className:"flex items-center gap-1.5 rounded-lg border border-border bg-card px-3 py-1.5 text-xs hover:bg-accent/40",children:[n.jsx(Mf,{status:y,className:"size-3.5"}),n.jsx("span",{className:"capitalize text-muted-foreground",children:I_(y)}),n.jsx("span",{className:"font-semibold",children:o.data.status?.[y]??0})]},y))}),n.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[n.jsx(Ve,{title:u("project.overview.roster"),className:"!p-4",children:m.length===0?n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.overview.no_agents")}):_?n.jsx("div",{className:"space-y-3",children:b.map(y=>n.jsx(bh,{label:y.area||u("agents_ui.uncategorized"),icon:db,agents:y.agents,pid:e,navigate:t},y.area??"__none"))}):n.jsxs("div",{className:"space-y-3",children:[g.length>0&&n.jsx(bh,{label:u("project.overview.orchestrators"),icon:va,agents:g,pid:e,navigate:t}),h.length>0&&n.jsx(bh,{label:u("project.overview.specialists"),icon:rn,agents:h,pid:e,navigate:t})]})}),n.jsx(Ve,{title:u("project.overview.recent_tasks"),className:"!p-4",action:n.jsx(ff,{to:`/p/${e}/tasks`,className:"text-xs text-sky-500 hover:text-sky-400",children:u("common.view_all")}),children:E.length===0?n.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-fg",children:[n.jsx(Hf,{className:"size-4"}),u("project.overview.no_activity")]}):n.jsx("ul",{className:"space-y-1.5",children:E.map(y=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>t(`/p/${e}/tasks?task=${y.id}`),className:"flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left hover:bg-accent/40",children:[n.jsx(Mf,{status:Af(y),className:"size-3.5 shrink-0"}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:y.title}),n.jsx(B_,{status:Af(y)})]})},y.id))})})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[n.jsx(So,{title:u("project.overview.chat"),value:u("project.overview.chat_value"),href:`/p/${e}/chat`,icon:Jc}),n.jsx(So,{title:u("project.overview.mcps"),value:d.data?.length??"…",href:`/p/${e}/mcps`,icon:Yf}),n.jsx(So,{title:u("project.overview.routines"),value:i.data?.length??"…",href:`/p/${e}/routines`,icon:zo})]}),m.length>0&&n.jsx(Ve,{title:u("project.overview.brain_title"),description:u("project.overview.brain_desc"),className:"!p-4",children:n.jsx(h8,{pid:e,agents:m,routines:i.data??[],navigate:t})})]})}function m8(e){const t=new Map;for(const a of e){const o=a.area||null;t.has(o)||t.set(o,[]),t.get(o).push(a)}return[...t.entries()].sort(([a],[o])=>a===null?1:o===null?-1:a.localeCompare(o)).map(([a,o])=>({area:a,agents:o}))}function g8(e){return e.split(`
788
- `).map(t=>t.replace(/^[-*#>\s]+/,"").trim()).filter(t=>t.length>2&&!t.startsWith("```")).slice(0,5)}function h8({pid:e,agents:t,routines:a,navigate:o}){const[i,c]=x.useState(!1),d=Be(i?`/team-brain/${e}/${t.map(b=>b.slug).join(",")}`:null,async()=>{const b=await Qn.list(e,"all"),_=await Promise.all(t.map(async j=>{const[E,y]=await Promise.all([an.get(e,j.slug).catch(()=>null),Wr.list(e,j.slug).catch(()=>[])]);return[j.slug,{memory:E?.memory||"",threads:(y||[]).slice(0,4).map(k=>({title:k.title||k.filename,id:k.id}))}]}));return{tasks:b,perAgent:Object.fromEntries(_)}}),f=i&&!!d.data,{nodes:m,edges:g}=x.useMemo(()=>{const b=[],_=[],j="__root";b.push({id:j,label:u("project.overview.brain_core"),kind:"agent",role:"core",emoji:"🧠"});const E=new Set(t.map(k=>k.slug)),y=k=>t.some(N=>N.parent===k);for(const k of t){const N=!!k.is_master||k.type==="orchestrator";b.push({id:k.slug,label:k.slug,slug:k.slug,kind:N?"agent":"agentlink",role:f||N||y(k.slug)?"hub":"leaf",emoji:k.emoji||void 0,relation:k.role||u(N?"project.agents.orchestrator":"project.overview.specialists"),detail:k.description||void 0})}for(const k of t){const N=k.parent&&E.has(k.parent)?k.parent:j;_.push({source:N,target:k.slug})}if(f&&d.data){const{tasks:k,perAgent:N}=d.data,w=(S,R,A,T,z)=>{b.push({id:S,label:R,kind:A,detail:z}),_.push({source:T,target:S})};for(const S of t){const R=N[S.slug];g8(R?.memory||"").forEach((A,T)=>w(`${S.slug}:m${T}`,A,"memory",S.slug,A)),(R?.threads||[]).forEach((A,T)=>w(`${S.slug}:th${T}`,A.title,"thread",S.slug)),k.filter(A=>A.agent===S.slug).slice(0,4).forEach((A,T)=>w(`${S.slug}:ts${T}`,A.title,"task",S.slug,A.body||void 0)),a.filter(A=>A.spec?.agent===S.slug).slice(0,2).forEach((A,T)=>w(`${S.slug}:rt${T}`,A.name,"routine",S.slug,`schedule: ${A.schedule}`))}}return{nodes:b,edges:_}},[t,a,f,d.data]),h=n.jsxs("button",{type:"button",onClick:()=>c(b=>!b),className:ge("inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-[11px] font-medium backdrop-blur transition-colors",i?"border-primary/40 bg-primary/15 text-foreground":"border-border bg-card/80 text-muted-fg hover:text-foreground"),children:[n.jsx(Dc,{className:ge("size-3.5",d.isLoading&&"animate-pulse")}),u(i?"agents_ui.brain_collapse":"agents_ui.brain_expand")]});return n.jsx(WN,{nodes:m,edges:g,height:620,toolbar:h,onNodeClick:b=>{b.slug&&o(`/p/${e}/agents/${b.slug}`)}})}function bh({label:e,icon:t,agents:a,pid:o,navigate:i}){return n.jsxs("div",{children:[n.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[n.jsx(t,{className:"size-3.5"}),e," (",a.length,")"]}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(c=>n.jsxs("button",{type:"button",onClick:()=>i(`/p/${o}/agents/${c.slug}`),className:ge("inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-2 py-1 text-xs hover:border-muted-fg/50"),children:[n.jsx("span",{className:"text-sm leading-none",children:c.emoji||"🤖"}),n.jsx("span",{className:"truncate",children:c.slug}),c.role&&n.jsxs("span",{className:"truncate text-[10px] text-muted-fg",children:["· ",c.role]})]},c.slug))})]})}function So({title:e,value:t,href:a,icon:o}){return n.jsxs(ff,{to:a,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[n.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:n.jsx(o,{size:20})}),n.jsxs("div",{children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),n.jsx("div",{className:"text-2xl font-semibold",children:t})]})]})}function x8(){const e=Tn(),{projects:t,isLoading:a}=cu();return n.jsxs(Ve,{title:u("base.workspaces_title"),description:u("base.workspaces_desc"),action:n.jsxs(re,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[n.jsx(Dt,{size:14})," ",u("base.workspaces_new")]}),children:[a&&n.jsx(tt,{}),!a&&t.length===0&&n.jsx(ut,{children:u("base.workspaces_empty")}),n.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:t.map(o=>{const i=String(o.id)==="0",c=i?u("base.title"):o.name||o.path.split("/").pop()||String(o.id);return n.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:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Z2,{className:"size-4 text-muted-fg"}),n.jsx("span",{className:"truncate text-sm font-semibold",children:c}),n.jsx($e,{tone:i?"success":"info",children:i?u("base.title"):bN(o.kind)})]}),n.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}function b8(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const ZN=x.createContext(null);function Na(){const e=x.useContext(ZN);if(e===null)throw new Error(gn(60));return e}const _8=(e,t)=>Object.is(e,t);function il(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function of(e,t,a){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:il(o,t,a))}function v8(e,t,a){return e.filter(o=>!il(t,o,a))}function Fx(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function JN(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function y8(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(JN(t)){for(const a of t)for(const o of a.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const a of t)if(a&&a.value==null&&a.label!=null)return!0;return!1}function eE(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 Fx(e)}function Ii(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Fx(e.value):Fx(e)}function tE(e,t,a){function o(){return eE(e,a)}if(a&&e!=null)return a(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 i=t,c=JN(i)?i.flatMap(d=>d.items):i;if(e==null||typeof e!="object"){const d=c.find(f=>f.value===e);return d&&d.label!=null?d.label:o()}if("value"in e){const d=c.find(f=>f&&f.value===e.value);if(d&&d.label!=null)return d.label}}return o()}function j8(e,t,a){return e.reduce((o,i,c)=>(c>0&&o.push(", "),o.push(n.jsx(x.Fragment,{children:tE(i,t,a)},c)),o),[])}const st={id:e=>e.id,labelId:e=>e.labelId,modal:e=>e.modal,items:e=>e.items,itemToStringLabel:e=>e.itemToStringLabel,isItemEqualToValue:e=>e.isItemEqualToValue,value:e=>e.value,hasSelectedValue:e=>{const{value:t,multiple:a,itemToStringValue:o}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:Ii(t,o)!==""},hasNullItemLabel:(e,t)=>t?y8(e.items):!1,open:e=>e.open,mounted:e=>e.mounted,forceMount:e=>e.forceMount,transitionStatus:e=>e.transitionStatus,openMethod:e=>e.openMethod,activeIndex:e=>e.activeIndex,selectedIndex:e=>e.selectedIndex,isActive:(e,t)=>e.activeIndex===t,isSelected:(e,t)=>{const a=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(i=>il(t,i,a)):il(t,o,a)},isSelectedByFocus:(e,t)=>e.selectedIndex===t,popupProps:e=>e.popupProps,triggerProps:e=>e.triggerProps,triggerElement:e=>e.triggerElement,positionerElement:e=>e.positionerElement,listElement:e=>e.listElement,popupSide:e=>e.popupSide,scrollUpArrowVisible:e=>e.scrollUpArrowVisible,scrollDownArrowVisible:e=>e.scrollDownArrowVisible,hasScrollArrows:e=>e.hasScrollArrows};function k8(e,t,a=(o,i)=>o===i){return e.length===t.length&&e.every((o,i)=>a(o,t[i]))}function Cc(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}const Zs=1;function q_(e,t){return Math.max(0,e-t)}function Df(e,t){if(t<=0)return 0;const a=Cc(e,0,t),o=a,i=t-a,c=o<=Zs,d=i<=Zs;return c&&d?o<=i?0:t:c?0:d?t:a}function w8(e){const{id:t,value:a,defaultValue:o=null,onValueChange:i,open:c,defaultOpen:d=!1,onOpenChange:f,name:m,form:g,autoComplete:h,disabled:b=!1,readOnly:_=!1,required:j=!1,modal:E=!0,actionsRef:y,inputRef:k,onOpenChangeComplete:N,items:w,multiple:S=!1,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:T=_8,highlightItemOnHover:z=!0,children:M}=e,{clearErrors:P}=z_(),{setDirty:L,setTouched:I,setFocused:D,validityData:$,setFilled:q,name:G,disabled:U,validation:V,validationMode:X}=fu(),Q=kp({id:t}),W=U||b,B=G??m,[K,ee]=nl({controlled:a,default:S?o??ja:o,name:"Select",state:"value"}),[F,ne]=nl({controlled:c,default:d,name:"Select",state:"open"}),Z=x.useRef([]),fe=x.useRef([]),Y=x.useRef(null),oe=x.useRef(null),ve=x.useRef(0),ie=x.useRef(null),xe=x.useRef([]),ke=x.useRef(!1),Re=x.useRef(null),Ae=x.useRef(null),Ie=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Oe=x.useRef(!1),{mounted:Te,setMounted:Ne,transitionStatus:Me}=hl(F),{openMethod:De,triggerProps:qe}=JC(F),Xe=Hn(()=>new su({id:Q,labelId:void 0,modal:E,multiple:S,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:T,value:K,open:F,mounted:Te,transitionStatus:Me,items:w,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,me=nt(Xe,st.activeIndex),de=nt(Xe,st.selectedIndex),Le=nt(Xe,st.triggerElement),ye=nt(Xe,st.positionerElement),Ce=y6(De),Qe=De??Ce,Ge=x.useMemo(()=>S?"":Ii(K,A),[S,K,A]),it=x.useMemo(()=>S&&Array.isArray(K)?K.map(ht=>Ii(ht,A)):Ii(K,A),[S,K,A]),Tt=mn(Le),_t=He(()=>it);O_(Tt,Q,K,_t,!W,m);const Ct=x.useRef(K),je=S?Array.isArray(K)&&K.length>0:K!=null&&Ge!=="";Pe(()=>{q(je)},[je,q]),Pe(function(){let $t=K,Ln=!1;if(S){const Mn=Array.isArray(K)?K:[];Ln=Mn.length===0,$t=Mn[Mn.length-1]}const rs=Ln?-1:of(xe.current,$t,T),xs=rs===-1?null:rs;xs===null&&(Ae.current=null),!F&&Xe.set("selectedIndex",xs)},[S,F,K,T,Xe]);function ze(ht){const $t=$.initialValue;return Array.isArray(ht)&&Array.isArray($t)?!k8(ht,$t,(Ln,rs)=>il(Ln,rs,T)):ht!==$t}v_(K,()=>{P(B),L(ze(K)),V.change(K)});const Ye=He((ht,$t)=>{f?.(ht,$t),!$t.isCanceled&&(ne(ht),!ht&&($t.reason===Oo||$t.reason===rp)&&(I(!0),D(!1),X==="onBlur"&&V.commit(K)))}),We=He(()=>{Ne(!1),Xe.update({activeIndex:null,openMethod:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1}),N?.(!1)});Ca({enabled:!y,open:F,ref:Y,onComplete(){F||We()}}),x.useImperativeHandle(y,()=>({unmount:We}),[We]);const ft=He((ht,$t)=>{i?.(ht,$t),!$t.isCanceled&&ee(ht)}),Rt=He(ht=>{const $t=q_(ht.scrollHeight,ht.clientHeight),Ln=Df(ht.scrollTop,$t),rs=Ln>0,xs=Ln<$t;Xe.set("scrollUpArrowVisible",rs),Xe.set("scrollDownArrowVisible",xs)}),Qt=LO({open:F,onOpenChange:Ye,elements:{reference:Le,floating:ye}}),ot=sC(Qt,{enabled:!_&&!W,event:"mousedown"}),Pt=lp(Qt),on=SC(Qt,{enabled:!_&&!W,listRef:Z,activeIndex:me,selectedIndex:de,disabledIndices:ja,onNavigate(ht){ht===null&&!F||Xe.set("activeIndex",ht)},focusItemOnHover:z}),Yt=CC(Qt,{enabled:!_&&!W&&(F||!S),listRef:fe,activeIndex:me,selectedIndex:de,disabledIndices:ht=>sN(Z.current[ht]),onMatch(ht){F?Xe.set("activeIndex",ht):ft(xe.current[ht],rt(ka))},onTyping(ht){ke.current=ht}}),Fn=x.useMemo(()=>Ss(Yt.reference,on.reference,Pt.reference,ot.reference,qe),[ot.reference,Yt.reference,on.reference,Pt.reference,qe]),An=x.useMemo(()=>Ss(dp,Yt.floating,on.floating,Pt.floating),[Yt.floating,on.floating,Pt.floating]),as=on.item??sn;b8(()=>{Xe.update({popupProps:An,triggerProps:Fn})}),Xe.useSyncedValues({id:Q,modal:E,multiple:S,value:K,open:F,mounted:Te,transitionStatus:Me,popupProps:An,triggerProps:Fn,items:w,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:T,openMethod:Qe});const dn=x.useMemo(()=>({store:Xe,floatingContext:Qt,required:j,disabled:W,readOnly:_,multiple:S,highlightItemOnHover:z,setValue:ft,setOpen:Ye,listRef:Z,popupRef:Y,scrollHandlerRef:oe,handleScrollArrowVisibility:Rt,scrollArrowsMountedCountRef:ve,itemProps:as,valueRef:ie,valuesRef:xe,labelsRef:fe,typingRef:ke,selectionRef:Ie,firstItemTextRef:Re,selectedItemTextRef:Ae,validation:V,onOpenChangeComplete:N,alignItemWithTriggerActiveRef:Oe,initialValueRef:Ct}),[Xe,Qt,j,W,_,S,z,ft,Ye,as,V,N,Rt]),hs=rr(k,V.inputRef),Rs=S?void 0:B,oa=x.useMemo(()=>!S||!Array.isArray(K)||!B?null:K.map(ht=>{const $t=Ii(ht,A);return n.jsx("input",{type:"hidden",form:g,name:B,value:$t,disabled:W},$t)}),[S,K,g,B,A,W]);return n.jsxs(ZN.Provider,{value:dn,children:[M,n.jsx("input",{...V.getValidationProps(W,{onFocus(){Xe.state.triggerElement?.focus({focusVisible:!0})},onChange(ht){if(ht.nativeEvent.defaultPrevented||W||_)return;const $t=ht.currentTarget.value,Ln=rt(ka,ht.nativeEvent);function rs(){if(S)return;const xs=$t.toLowerCase();let Mn=xe.current.findIndex(vn=>Ii(vn,A).toLowerCase()===xs||eE(vn,R).toLowerCase()===xs);Mn===-1&&(Mn=xe.current.findIndex((vn,ia)=>{const dr=fe.current[ia];return dr!=null&&dr.toLowerCase()===xs}));const Wt=xe.current[Mn];Wt!=null&&ft(Wt,Ln)}Xe.set("forceMount",!0),queueMicrotask(rs)}}),id:Q&&Rs==null?`${Q}-hidden-input`:void 0,form:g,name:Rs,autoComplete:h,value:Ge,disabled:W,required:j&&!(S&&je),readOnly:_,ref:hs,style:B?RS:Ub,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),oa]})}function S8(e,t){return e??t}const C8=400,N8={...wx,...M_,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},E8=x.forwardRef(function(t,a){const{render:o,className:i,id:c,disabled:d=!1,nativeButton:f=!0,style:m,...g}=t,{setTouched:h,setFocused:b,validationMode:_,state:j,disabled:E}=fu(),{labelId:y}=jp(),{store:k,setOpen:N,selectionRef:w,validation:S,readOnly:R,required:A,alignItemWithTriggerActiveRef:T,disabled:z}=Na(),M=E||z||d,P=nt(k,st.open),L=nt(k,st.mounted),I=nt(k,st.value),D=nt(k,st.triggerProps),$=nt(k,st.positionerElement),q=nt(k,st.listElement),G=nt(k,st.popupSide),U=nt(k,st.id),V=nt(k,st.labelId),X=nt(k,st.hasSelectedValue),Q=L&&$?G:null,W=c??U,B=S8(y,V);kp({id:W});const K=mn($),ee=x.useRef(null),{getButtonProps:F,buttonRef:ne}=no({disabled:M,native:f}),Z=k.useStateSetter("triggerElement"),fe=Rn(),Y=Rn(),oe=Rn();x.useEffect(()=>{if(P)return oe.start(C8,()=>{w.current.allowUnselectedMouseUp=!0,w.current.allowSelectedMouseUp=!0}),()=>{oe.clear()};w.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Y.clear()},[P,w,Y,oe]);const ve=Ss(D,{id:W,role:"combobox","aria-expanded":P,"aria-haspopup":"listbox","aria-controls":P?q?.id??gf($)?.id:void 0,"aria-labelledby":B,"aria-readonly":R||void 0,"aria-required":A||void 0,tabIndex:M?-1:0,onFocus(ke){b(!0),P&&T.current&&N(!1,rt(ka,ke.nativeEvent)),fe.start(0,()=>{k.set("forceMount",!0)})},onBlur(ke){Ze($,ke.relatedTarget)||(h(!0),b(!1),_==="onBlur"&&S.commit(I))},onMouseDown(ke){if(P)return;const Re=vt(ke.currentTarget);function Ae(Ie){if(!ee.current)return;const Oe=Ie.target;Ze(ee.current,Oe)||Ze(K.current,Oe)||eN(Ie,ee.current)||N(!1,rt(kS,Ie))}Y.start(0,()=>{Re.addEventListener("mouseup",Ae,{once:!0})})}},g,F),ie=S.getValidationProps(M,ve);ie.role="combobox";const xe={...j,open:P,disabled:M,value:I,readOnly:R,popupSide:Q,placeholder:!X};return Et("button",t,{ref:[a,ee,ne,Z],state:xe,stateAttributesMapping:N8,props:ie})}),R8={value:()=>null},T8=x.forwardRef(function(t,a){const{className:o,render:i,children:c,placeholder:d,style:f,...m}=t,{store:g,valueRef:h}=Na(),b=nt(g,st.value),_=nt(g,st.items),j=nt(g,st.itemToStringLabel),E=nt(g,st.hasSelectedValue),y=!E&&d!=null&&c==null,k=nt(g,st.hasNullItemLabel,y),N={value:b,placeholder:!E};let w=null;return typeof c=="function"?w=c(b):c!=null?w=c:y&&!k?w=d:Array.isArray(b)?w=j8(b,_,j):w=tE(b,_,j),Et("span",t,{state:N,ref:[a,h],props:[{children:w},m],stateAttributesMapping:R8})}),A8=x.forwardRef(function(t,a){const{render:o,className:i,style:c,...d}=t,{store:f}=Na(),g={open:nt(f,st.open)};return Et("span",t,{state:g,ref:a,props:[{"aria-hidden":!0,children:"▼"},d],stateAttributesMapping:EC})}),M8=x.forwardRef(function(t,a){const{store:o}=Na(),i=nt(o,st.mounted),c=nt(o,st.forceMount);return i||c?n.jsx(Qb,{ref:a,...t}):null}),nE=x.createContext(void 0);function H_(){const e=x.useContext(nE);if(!e)throw new Error(gn(59));return e}function Pf(e,t){e&&Object.assign(e.style,t)}const sE={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},z8={position:"fixed"},O8=x.forwardRef(function(t,a){const{anchor:o,className:i,render:c,positionMethod:d,side:f,align:m,sideOffset:g,alignOffset:h,collisionBoundary:b="clipping-ancestors",collisionPadding:_,arrowPadding:j,sticky:E,disableAnchorTracking:y,alignItemWithTrigger:k=!0,collisionAvoidance:N=KS,style:w,...S}=t,{store:R,listRef:A,labelsRef:T,alignItemWithTriggerActiveRef:z,selectedItemTextRef:M,valuesRef:P,initialValueRef:L,popupRef:I,setValue:D,floatingContext:$}=Na(),q=nt(R,st.open),G=nt(R,st.mounted),U=nt(R,st.modal),V=nt(R,st.value),X=nt(R,st.openMethod),Q=nt(R,st.positionerElement),W=nt(R,st.triggerElement),B=nt(R,st.isItemEqualToValue),K=nt(R,st.transitionStatus),ee=x.useRef(null),F=x.useRef(null),[ne,Z]=x.useState(k),fe=G&&ne&&X!=="touch";!G&&ne!==k&&Z(k),x.useImperativeHandle(z,()=>fe),XC((fe||U)&&q,X==="touch",Q,W);const Y=f_({anchor:o,floatingRootContext:$,positionMethod:d,mounted:G,side:f,sideOffset:g,align:m,alignOffset:h,arrowPadding:j,collisionBoundary:b,collisionPadding:_,sticky:E,disableAnchorTracking:y??fe,collisionAvoidance:N,keepMounted:!0}),oe=fe?"none":Y.side,ve=fe?z8:Y.positionerStyles,ie={open:q,side:oe,align:Y.align,anchorHidden:Y.anchorHidden};Pe(()=>{R.set("popupSide",Y.side)},[R,Y.side]);const xe=R.useStateSetter("positionerElement"),ke=p_(t,ie,{styles:ve,transitionStatus:K,props:S,refs:[a,xe],hidden:!G,inert:!q}),Re=x.useRef(0),Ae=He(Oe=>{if(P.current.length===0)return;const Te=Re.current;if(Re.current=Oe.size,Oe.size===Te)return;const Ne=rt(ka);if(Te!==0&&!R.state.multiple&&V!==null&&of(P.current,V,B)===-1){const De=L.current,Xe=De!=null&&of(P.current,De,B)!==-1?De:null;D(Xe,Ne),Xe===null&&(R.set("selectedIndex",null),M.current=null)}if(Te!==0&&R.state.multiple&&Array.isArray(V)){const Me=V.filter(De=>of(P.current,De,B)!==-1);Me.length!==V.length&&(D(Me,Ne),Me.length===0&&(R.set("selectedIndex",null),M.current=null))}if(q&&fe){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Me={height:""};Pf(Q,Me),Pf(I.current,Me)}}),Ie=x.useMemo(()=>({...Y,side:oe,alignItemWithTriggerActive:fe,setControlledAlignItemWithTrigger:Z,scrollUpArrowRef:ee,scrollDownArrowRef:F}),[Y,oe,fe,Z]);return n.jsx(bp,{elementsRef:A,labelsRef:T,onMapChange:Ae,children:n.jsxs(nE.Provider,{value:Ie,children:[G&&U&&n.jsx(__,{inert:gp(!q),cutout:W}),ke]})})}),Bd="base-ui-disable-scrollbar",Gx={className:Bd,getElement(e){return n.jsx("style",{nonce:e,href:Bd,precedence:"base-ui:low",children:`.${Bd}{scrollbar-width:none}.${Bd}::-webkit-scrollbar{display:none}`})}},D8=x.createContext(void 0),P8={disableStyleElements:!1};function L8(){return x.useContext(D8)??P8}const I8={...ru,...Vo},B8=x.forwardRef(function(t,a){const{render:o,className:i,style:c,finalFocus:d,...f}=t,{store:m,popupRef:g,onOpenChangeComplete:h,setOpen:b,valueRef:_,firstItemTextRef:j,selectedItemTextRef:E,multiple:y,handleScrollArrowVisibility:k,scrollHandlerRef:N,listRef:w,highlightItemOnHover:S,floatingContext:R}=Na(),{side:A,align:T,alignItemWithTriggerActive:z,isPositioned:M,setControlledAlignItemWithTrigger:P}=H_(),L=FC()!=null,I=pp(),{nonce:D,disableStyleElements:$}=L8(),q=nt(m,st.id),G=nt(m,st.open),U=nt(m,st.openMethod),V=nt(m,st.mounted),X=nt(m,st.popupProps),Q=nt(m,st.transitionStatus),W=nt(m,st.triggerElement),B=nt(m,st.positionerElement),K=nt(m,st.listElement),ee=x.useRef(!1),F=x.useRef(!1),ne=x.useRef({}),Z=Ji(),fe=He(ie=>{if(!B||!g.current||!F.current)return;const xe=B.style.top==="0px",ke=B.style.bottom==="0px";if(ee.current||!z||!xe&&!ke){k(ie);return}const Re=Vk(B),Ae=Nc(B.getBoundingClientRect().height,"y",Re),Ie=vt(B),Oe=Jt(B),Te=Oe.getComputedStyle(B),Ne=parseFloat(Te.marginTop),Me=parseFloat(Te.marginBottom),De=Hk(Oe.getComputedStyle(g.current)),qe=Math.min(Ie.documentElement.clientHeight-Ne-Me,De),Xe=ie.scrollTop,me=$d(ie);let de=null;const Le=Ge=>{B.style.height=`${Ge}px`},ye=xe?me-Xe:Xe,Ce=Math.min(Ae+ye,qe);if(ye<=Zs){const Ge=Cc(ye,0,qe-Ae);Ge>0&&Le(Ae+Ge),ie.scrollTop=xe?me:0,qe-(Ae+Ge)<=Zs&&(ee.current=!0),k(ie);return}if(qe-Ce>Zs)de=xe?1/0:0;else if(ke&&Xe<me){const Ge=Ae+ye-qe;de=Xe-(ye-Ge)}const Qe=Math.ceil(Ce);if(Qe!==0&&Le(Qe),de!=null){const Ge=Cc(de,0,$d(ie));Math.abs(ie.scrollTop-Ge)>Zs&&(ie.scrollTop=Ge)}Qe>=qe-Zs&&(ee.current=!0),k(ie)});x.useImperativeHandle(N,()=>fe,[fe]),Ca({open:G,ref:g,onComplete(){G&&h?.(!0)}});const Y={open:G,transitionStatus:Q,side:A,align:T};Pe(()=>{!B||!g.current||Object.keys(ne.current).length||(ne.current={top:B.style.top||"0",left:B.style.left||"0",right:B.style.right,height:B.style.height,bottom:B.style.bottom,minHeight:B.style.minHeight,maxHeight:B.style.maxHeight,marginTop:B.style.marginTop,marginBottom:B.style.marginBottom})},[g,B]),Pe(()=>{G||z||(F.current=!1,ee.current=!1,Pf(B,ne.current))},[G,z,B,g]),Pe(()=>{const ie=g.current;if(!G||!W||!B||!ie||z&&!M||m.state.transitionStatus==="ending")return;if(F.current=!0,ie.style.removeProperty("--transform-origin"),!z){Z.request(()=>k(K||ie));return}const xe=$8(ie);try{let ke=E.current;ke?.isConnected||(ke=!st.hasSelectedValue(m.state)&&j.current?.isConnected?j.current:null);const Re=_.current,Ae=Jt(B),Ie=Ae.getComputedStyle(B),Oe=Ae.getComputedStyle(ie),Te=vt(W),Ne=Vk(W),Me=Ud(W.getBoundingClientRect(),Ne),De=Ud(B.getBoundingClientRect(),Ne),qe=Me.height,Xe=K||ie,me=Xe.scrollHeight,de=parseFloat(Oe.borderBottomWidth),Le=parseFloat(Ie.marginTop)||10,ye=parseFloat(Ie.marginBottom)||10,Ce=parseFloat(Ie.minHeight)||100,Qe=Hk(Oe),Ge=5,it=5,Tt=20,_t=Te.documentElement.clientHeight-Le-ye,Ct=Te.documentElement.clientWidth,je=_t-Me.bottom+qe;let ze,Ye=I==="rtl"?Me.right-De.width:Me.left,We=0;if(ke&&Re){const dn=Ud(Re.getBoundingClientRect(),Ne);ze=Ud(ke.getBoundingClientRect(),Ne),Ye=De.left+(I==="rtl"?dn.right-ze.right:dn.left-ze.left);const hs=dn.top-Me.top+dn.height/2;We=ze.top-De.top+ze.height/2-hs}const ft=je+We+ye+de;let Rt=Math.min(_t,ft);const Qt=_t-Le-ye,ot=ft-Rt,Pt=Ct-it;B.style.left=`${Cc(Ye,Ge,Pt-De.width)}px`,B.style.height=`${Rt}px`,B.style.maxHeight="none",B.style.marginTop=`${Le}px`,B.style.marginBottom=`${ye}px`,ie.style.height="100%";const on=$d(Xe),Yt=ot>=on-Zs;Yt&&(Rt=Math.min(_t,De.height)-(ot-on));const Fn=Me.top<Tt||Me.bottom>_t-Tt||Math.ceil(Rt)+Zs<Math.min(me,Ce),An=(Ae.visualViewport?.scale??1)!==1&&lr;if(Fn||An){Pf(B,ne.current),P(!1);return}const as=Math.max(Ce,Rt);if(Yt){const dn=Math.max(0,_t-ft);B.style.top=De.height>=Qt?"0":`${dn}px`,B.style.height=`${Rt}px`,Xe.scrollTop=$d(Xe)}else B.style.bottom="0",Xe.scrollTop=ot;if(ze){const dn=De.top,hs=De.height,Rs=ze.top+ze.height/2,oa=Cc(hs>0?(Rs-dn)/hs*100:50,0,100);ie.style.setProperty("--transform-origin",`50% ${oa}%`)}(as===_t||Rt>=Qe)&&(ee.current=!0),k(Xe),S&&m.state.selectedIndex===null&&m.state.activeIndex===null&&w.current[0]!=null&&m.set("activeIndex",0)}finally{xe()}},[m,G,B,W,_,j,E,g,k,z,P,Z,K,w,S,I,M]),x.useEffect(()=>{if(!z||!B||!G)return;const ie=Jt(B);function xe(ke){b(!1,rt(A4,ke))}return xt(ie,"resize",xe)},[b,z,B,G]);const oe={...K?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${q}-list`},onKeyDown(ie){L&&xp.has(ie.key)&&ie.stopPropagation()},onScroll(ie){K||fe(ie.currentTarget)},...z&&{style:K?{height:"100%"}:sE},className:!K&&z?Gx.className:void 0},ve=Et("div",t,{ref:[a,g],state:Y,stateAttributesMapping:I8,props:[X,oe,mp(Q),f]});return n.jsxs(x.Fragment,{children:[!$&&Gx.getElement(D),n.jsx(Jb,{context:R,modal:!1,disabled:!V,openInteractionType:U,returnFocus:d,restoreFocus:!0,children:ve})]})});function Hk(e){const t=e.maxHeight;return t.endsWith("px")&&parseFloat(t)||1/0}function $d(e){return q_(e.scrollHeight,e.clientHeight)}function Vk(e){return cC.getScale(e)}function Nc(e,t,a){return e/a[t]}function Ud(e,t){return Bc({x:Nc(e.x,"x",t),y:Nc(e.y,"y",t),width:Nc(e.width,"x",t),height:Nc(e.height,"y",t)})}const Fk=[["transform","none"],["scale","1"],["translate","0 0"]];function $8(e){const{style:t}=e,a={};for(const[o,i]of Fk)a[o]=t.getPropertyValue(o),t.setProperty(o,i,"important");return()=>{for(const[o]of Fk){const i=a[o];i?t.setProperty(o,i):t.removeProperty(o)}}}const U8=x.forwardRef(function(t,a){const{render:o,className:i,style:c,...d}=t,{store:f,scrollHandlerRef:m,multiple:g}=Na(),{alignItemWithTriggerActive:h}=H_(),b=nt(f,st.hasScrollArrows),_=nt(f,st.openMethod),E={id:`${nt(f,st.id)}-list`,role:"listbox","aria-multiselectable":g||void 0,onScroll(k){m.current?.(k.currentTarget)},...h&&{style:sE},className:b&&_!=="touch"?Gx.className:void 0},y=f.useStateSetter("listElement");return Et("div",t,{ref:[a,y],props:[E,d]})}),aE=x.createContext(void 0);function V_(){const e=x.useContext(aE);if(!e)throw new Error(gn(57));return e}const q8=x.memo(x.forwardRef(function(t,a){const{render:o,className:i,style:c,value:d=null,label:f,disabled:m=!1,nativeButton:g=!1,...h}=t,b=x.useRef(null),_=ou({guess:!0,label:f,textRef:b}),{store:j,itemProps:E,setOpen:y,setValue:k,selectionRef:N,typingRef:w,valuesRef:S,multiple:R,selectedItemTextRef:A,disabled:T,readOnly:z}=Na(),M=T||m,P=nt(j,st.isActive,_.index),L=nt(j,st.open),I=nt(j,st.isSelected,d),D=nt(j,st.isSelectedByFocus,_.index),$=nt(j,st.isItemEqualToValue),q=_.index,G=x.useRef(null);Pe(()=>{const Z=S.current;return Z[q]=d,()=>{delete Z[q]}},[q,d,S]),Pe(()=>{const Z=j.state.value;let fe=Z;R&&Array.isArray(Z)&&(fe=Z.length>0?Z[Z.length-1]:void 0),fe!==void 0&&il(d,fe,$)&&(j.set("selectedIndex",q),b.current&&(A.current=b.current))},[q,R,$,j,d,A]);const U=x.useRef("mouse"),V=x.useRef(!1),{getButtonProps:X,buttonRef:Q}=no({disabled:M,focusableWhenDisabled:!0,native:g,composite:!0}),W={disabled:M,selected:I,highlighted:P};function B(Z){if(T||z)return;const fe=j.state.value;if(R){const Y=Array.isArray(fe)?fe:[],oe=I?v8(Y,d,$):[...Y,d];k(oe,rt(Fi,Z))}else k(d,rt(Fi,Z)),y(!1,rt(Fi,Z))}function K(){N.current.dragY=0}const ee={role:"option","aria-selected":I,tabIndex:L&&P?0:-1,onKeyDown(Z){j.set("activeIndex",q),Z.key===" "&&w.current&&Z.preventDefault()},onClick(Z){const fe=U.current!=="touch",Y=Z.nativeEvent.pointerType,oe=fe&&zb(Z.nativeEvent)&&(Y!==void 0||P),ve=fe&&!oe&&!V.current;V.current=!1,!(M||ve)&&B(Z.nativeEvent)},onPointerEnter(Z){U.current=Z.pointerType},onPointerMove(Z){if(Z.pointerType==="mouse"&&Z.buttons===1){const fe=N.current;fe.dragY+=Z.movementY,fe.dragY**2>=64&&(fe.allowUnselectedMouseUp=!0)}},onPointerDown(Z){U.current=Z.pointerType,V.current=!0,K()},onMouseUp(){if(K(),M||U.current==="touch"||V.current)return;const Z=!N.current.allowSelectedMouseUp&&I,fe=!N.current.allowUnselectedMouseUp&&!I;Z||fe||(V.current=!0,G.current?.click(),V.current=!1)}},F=Et("div",t,{ref:[Q,a,_.ref,G],state:W,props:[E,ee,h,X]}),ne=x.useMemo(()=>({selected:I,index:q,textRef:b,selectedByFocus:D}),[I,q,b,D]);return n.jsx(aE.Provider,{value:ne,children:F})})),H8=x.forwardRef(function(t,a){const{selected:o}=V_();return t.keepMounted||o?n.jsx(V8,{...t,ref:a}):null}),V8=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:i,keepMounted:c,...d}=e,{selected:f}=V_(),m=x.useRef(null),{transitionStatus:g,setMounted:h}=hl(f),_=Et("span",e,{ref:[t,m],state:{selected:f,transitionStatus:g},props:[{"aria-hidden":!0,children:"✔️"},d],stateAttributesMapping:Vo});return Ca({open:f,ref:m,onComplete(){f||h(!1)}}),_})),F8=x.memo(x.forwardRef(function(t,a){const{index:o,textRef:i,selectedByFocus:c}=V_(),{firstItemTextRef:d,selectedItemTextRef:f}=Na(),{render:m,className:g,style:h,...b}=t,_=x.useCallback(E=>{E&&(o===0&&(d.current=E),c&&(f.current=E))},[d,f,o,c]);return Et("div",t,{ref:[_,a,i],props:b})})),rE=x.forwardRef(function(t,a){const{render:o,className:i,style:c,direction:d,keepMounted:f,...m}=t,g=d==="up",{store:h,popupRef:b,listRef:_,handleScrollArrowVisibility:j,scrollArrowsMountedCountRef:E}=Na(),{side:y,scrollDownArrowRef:k,scrollUpArrowRef:N}=H_(),w=g?st.scrollUpArrowVisible:st.scrollDownArrowVisible,S=nt(h,w),R=nt(h,st.openMethod),A=S&&R!=="touch",T=Rn(),z=g?N:k,{mounted:M,transitionStatus:P,setMounted:L}=hl(A);Pe(()=>(E.current+=1,h.set("hasScrollArrows",!0),()=>{E.current=Math.max(0,E.current-1),E.current===0&&h.set("hasScrollArrows",!1)}),[h,E]),Ca({open:A,ref:z,onComplete(){A||L(!1)}});const $=Et("div",t,{ref:[a,z],state:{direction:d,visible:A,side:y,transitionStatus:P},props:[{"aria-hidden":!0,children:g?"▲":"▼",style:{position:"absolute"},onMouseMove(G){if(G.movementX===0&&G.movementY===0||T.isStarted())return;h.set("activeIndex",null);function U(){const V=h.state.listElement??b.current;if(!V)return;h.set("activeIndex",null),j(V);const X=q_(V.scrollHeight,V.clientHeight),Q=Df(V.scrollTop,X),W=Q===(g?0:X),B=_.current;if(Q!==V.scrollTop&&(V.scrollTop=Q),W){T.clear();return}if(B.length>0){const K=z.current?.offsetHeight||0;V.scrollTop=G8(B,g,Q,V.clientHeight,K,X)}T.start(40,U)}T.start(40,U)},onMouseLeave(){T.clear()}},m],stateAttributesMapping:Vo});return M||f?$:null});function G8(e,t,a,o,i,c){if(t){let h=0;const b=a+i-Zs;for(let E=0;E<e.length;E+=1){const y=e[E];if(y&&y.offsetTop>=b){h=E;break}}const _=Math.max(0,h-1),j=e[_];return _<h&&j?Df(j.offsetTop-i,c):0}let d=e.length-1;const f=a+o-i+Zs;for(let h=0;h<e.length;h+=1){const b=e[h];if(b&&b.offsetTop+b.offsetHeight>f){d=Math.max(0,h-1);break}}const m=Math.min(e.length-1,d+1),g=e[m];return m>d&&g?Df(g.offsetTop+g.offsetHeight-o+i,c):c}const Y8=x.forwardRef(function(t,a){return n.jsx(rE,{...t,ref:a,direction:"down"})}),K8=x.forwardRef(function(t,a){return n.jsx(rE,{...t,ref:a,direction:"up"})}),X8=w8;function Q8({className:e,...t}){return n.jsx(T8,{"data-slot":"select-value",className:St("flex flex-1 text-left",e),...t})}function W8({className:e,size:t="default",children:a,...o}){return n.jsxs(E8,{"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:[a,n.jsx(A8,{render:n.jsx(ms,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function Z8({className:e,children:t,side:a="bottom",sideOffset:o=4,align:i="center",alignOffset:c=0,alignItemWithTrigger:d=!0,...f}){return n.jsx(M8,{children:n.jsx(O8,{side:a,sideOffset:o,align:i,alignOffset:c,alignItemWithTrigger:d,className:"isolate z-50",children:n.jsxs(B8,{"data-slot":"select-content","data-align-trigger":d,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),...f,children:[n.jsx(eI,{}),n.jsx(U8,{children:t}),n.jsx(tI,{})]})})})}function J8({className:e,children:t,...a}){return n.jsxs(q8,{"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),...a,children:[n.jsx(F8,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:t}),n.jsx(H8,{render:n.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:n.jsx(Yr,{className:"pointer-events-none"})})]})}function eI({className:e,...t}){return n.jsx(K8,{"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:n.jsx(fb,{})})}function tI({className:e,...t}){return n.jsx(Y8,{"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:n.jsx(ms,{})})}function ct({value:e,onChange:t,options:a,placeholder:o="— elegir —",disabled:i,className:c,showIcon:d=!1}){return n.jsxs(X8,{value:e,onValueChange:f=>t(f??""),disabled:i,children:[n.jsx(W8,{className:ge("h-9 w-full",c),children:n.jsx(Q8,{placeholder:o,children:f=>{const m=a.find(h=>h.value===f),g=d?m?.icon:void 0;return n.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g&&n.jsx(g,{className:"size-3.5 shrink-0"}),n.jsx("span",{className:"truncate",children:m?.label??f})]})}})}),n.jsx(Z8,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:a.map(f=>{const m=f.icon;return n.jsx(J8,{value:f.value,disabled:f.disabled,children:n.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m?n.jsx(m,{className:"size-4 shrink-0 text-muted-fg"}):null,f.description?n.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[n.jsx("span",{className:"truncate font-medium",children:f.label}),n.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:f.description})]}):n.jsx("span",{className:"truncate",children:f.label})]})},f.value)})})]})}const Gk=320;function nI(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 sI(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function aI(e){const t=e.meta?.model;return typeof t=="string"&&t?t:null}function rI(e){const t=e.meta?.usage;if(!t||typeof t!="object")return null;const a=(t.input_tokens||0)+(t.output_tokens||0);return a>0?a:null}function oI({m:e}){const[t,a]=x.useState(!1),o=(e.body?.length||0)>Gk,i=!o||t?e.body:`${e.body.slice(0,Gk)}…`,c=aI(e),d=rI(e);return n.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?n.jsx(V2,{size:14,className:"text-blue-400"}):n.jsx(G2,{size:14,className:"text-emerald-400"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[n.jsx("span",{className:"font-mono",children:nI(e.ts)}),n.jsx($e,{tone:"info",children:e.channel}),e.type&&n.jsx($e,{children:e.type}),n.jsx("span",{className:"font-medium text-foreground",children:sI(e)}),c&&n.jsx("span",{className:"font-mono text-[11px] text-sky-400/90",children:c}),d!==null&&n.jsxs("span",{className:"font-mono text-[11px]",children:[d," tok"]})]}),e.body&&n.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:i}),o&&n.jsx("button",{type:"button",onClick:()=>a(f=>!f),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:u(t?"logs.show_less":"logs.show_more")})]})]})}function iI(){const[e,t]=x.useState(!1),a=Be(e?"/api/admin/logs?errors":null,()=>al.logs("errors",200)),o=a.data?.entries||[];return n.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:i=>t(i.target.open),children:[n.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[u("logs.daemon_errors"),o.length?` · ${o.length}`:""]}),n.jsxs("div",{className:"border-t border-border p-3",children:[a.isLoading&&n.jsx(tt,{}),e&&!a.isLoading&&o.length===0&&n.jsx("p",{className:"text-xs text-muted-fg",children:u("logs.no_errors")}),n.jsx("ul",{className:"space-y-1",children:o.map((i,c)=>n.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[n.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof i.ts=="string"&&n.jsx("span",{className:"font-mono",children:new Date(i.ts).toLocaleString()}),typeof i.level=="string"&&n.jsx("span",{className:"text-destructive",children:i.level})]}),n.jsx("p",{className:"whitespace-pre-wrap break-words font-mono",children:String(i.msg??i.message??i.error??i.raw??JSON.stringify(i)).slice(0,500)})]},c))})]})]})}function lI({pid:e}){const t=!e||String(e)==="0",[a,o]=x.useState(""),[i,c]=x.useState(""),[d,f]=x.useState(""),[m,g]=x.useState(""),h=a.trim()||void 0,b=t?`/api/messages/global?channel=${h??""}`:`/api/projects/${e}/messages?channel=${h??""}`,_=Be(b,()=>t?Nf.global({channel:h,limit:300}):Nf.project(e,{channel:h,limit:300})),j=x.useMemo(()=>[..._.data||[]].sort((k,N)=>(N.ts||"").localeCompare(k.ts||"")),[_.data]),E=x.useMemo(()=>Array.from(new Set(j.map(k=>k.type).filter(Boolean))),[j]),y=x.useMemo(()=>j.filter(k=>!(i&&k.direction!==i||d&&k.type!==d||m&&!(k.body||"").toLowerCase().includes(m.toLowerCase()))),[j,i,d,m]);return n.jsxs(Ve,{title:u("logs.title"),description:u(t?"logs.desc_global":"logs.desc_project"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Ee,{placeholder:u("logs.filter_channel"),value:a,onChange:k=>o(k.target.value),className:"w-44"}),n.jsx(re,{size:"sm",variant:"secondary",onClick:()=>_.mutate(),children:n.jsx(Cs,{size:13})})]}),children:[t&&n.jsx(iI,{}),n.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[n.jsx("div",{className:"w-36",children:n.jsx(ct,{value:i,onChange:c,placeholder:u("logs.filter_dir"),options:[{value:"",label:u("logs.all_directions")},{value:"in",label:u("logs.in")},{value:"out",label:u("logs.out")}]})}),n.jsx("div",{className:"w-40",children:n.jsx(ct,{value:d,onChange:f,placeholder:u("logs.filter_type"),options:[{value:"",label:u("logs.all_types")},...E.map(k=>({value:k,label:k}))]})}),n.jsx(Ee,{placeholder:u("logs.search_text"),value:m,onChange:k=>g(k.target.value),className:"w-56"}),n.jsxs("span",{className:"text-[11px] text-muted-fg",children:[y.length," ",u("logs.count_of")," ",j.length]})]}),_.isLoading&&n.jsx(tt,{}),_.error&&n.jsx(ut,{children:u("logs.error",{msg:_.error.message})}),!_.isLoading&&!_.error&&y.length===0&&n.jsx(ut,{children:h?u("logs.no_activity_ch",{ch:h}):u("logs.no_activity")}),n.jsx("ul",{className:"space-y-1 text-sm",children:y.map((k,N)=>n.jsx(oI,{m:k},`${k.ts}-${N}`))})]})}function oE({value:e,onChange:t,options:a,placeholder:o=u("shared_ui.model_combobox_ph"),invalid:i,invalidHint:c,className:d}){const[f,m]=x.useState(!1),[g,h]=x.useState(e),b=x.useRef(null),_=x.useRef(null),[j,E]=x.useState(null);x.useEffect(()=>{h(e)},[e]),x.useLayoutEffect(()=>{if(!f)return;const S=()=>{const R=b.current;if(!R)return;const A=R.getBoundingClientRect();E({top:A.bottom+4,left:A.left,width:A.width})};return S(),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[f]),x.useEffect(()=>{if(!f)return;const S=R=>{const A=R.target;b.current?.contains(A)||_.current?.contains(A)||m(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[f]);const y=g.trim().toLowerCase(),N=y&&!(g===e)?a.filter(S=>S.toLowerCase().includes(y)):a,w=S=>{t(S),h(S),m(!1)};return n.jsxs("div",{ref:b,className:ge("relative",d),children:[n.jsxs("div",{className:ge("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",i?"border-amber-500/60":"border-border"),children:[i&&n.jsx(Ue,{content:c||u("models_ui.invalid_hint"),children:n.jsx("span",{children:n.jsx(wb,{className:"size-3.5 shrink-0 text-amber-400"})})}),n.jsx("input",{value:g,placeholder:o,onChange:S=>{h(S.target.value),t(S.target.value),m(!0)},onFocus:()=>m(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),n.jsx("button",{type:"button",tabIndex:-1,onClick:()=>m(S=>!S),className:"shrink-0 text-muted-fg hover:text-foreground",children:n.jsx(ms,{className:"size-4"})})]}),f&&N.length>0&&j&&Gs.createPortal(n.jsx("ul",{ref:_,style:{position:"fixed",top:j.top,left:j.left,width:j.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:N.map(S=>n.jsx("li",{children:n.jsx("button",{type:"button",onMouseDown:R=>{R.preventDefault(),w(S)},className:ge("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",S===e&&"bg-accent/50"),children:n.jsx("span",{className:"truncate font-mono text-xs",children:S})})},S))}),document.body)]})}function ur(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/admin/config",()=>al.config.get()),i=async(c,d)=>{const f=await al.config.patch({set:c,unset:d});return await o({config:f.config},{revalidate:!1}),f.config};return{config:e?.config||{},error:t,isLoading:a,mutate:o,patch:i}}function iE(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/admin/super-agent",()=>al.superAgent());return{superAgent:e,error:t,isLoading:a,mutate:o}}const cI="modulepreload",uI=function(e){return"/"+e},Yk={},dI=function(t,a,o){let i=Promise.resolve();if(a&&a.length>0){let d=function(g){return Promise.all(g.map(h=>Promise.resolve(h).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const f=document.querySelector("meta[property=csp-nonce]"),m=f?.nonce||f?.getAttribute("nonce");i=d(a.map(g=>{if(g=uI(g),g in Yk)return;Yk[g]=!0;const h=g.endsWith(".css"),b=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const _=document.createElement("link");if(_.rel=h?"stylesheet":cI,h||(_.as="script"),_.crossOrigin="",_.href=g,m&&_.setAttribute("nonce",m),document.head.appendChild(_),h)return new Promise((j,E)=>{_.addEventListener("load",j),_.addEventListener("error",()=>E(new Error(`Unable to preload CSS for ${g}`)))})}))}function c(d){const f=new Event("vite:preloadError",{cancelable:!0});if(f.payload=d,window.dispatchEvent(f),!f.defaultPrevented)throw d}return i.then(d=>{for(const f of d||[])f.status==="rejected"&&c(f.reason);return t().catch(c)})},fI={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"},pI={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"},Mc=[{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 _h(e,t){return t&&t in e?e[t]:e.custom}const Lf={anthropic:sa,openai:rn,gemini:YA,groq:pl,openrouter:Zc,ollama:iS,azure:MA,mock:cx,custom:aa},Za={anthropic:{base_url:"",default_model:"claude-sonnet-5",api_key_env:"ANTHROPIC_API_KEY",known_models:["claude-opus-4-8","claude-sonnet-5","claude-haiku-4-5","claude-fable-5"]},openai:{base_url:"https://api.openai.com/v1",default_model:"gpt-5.4-mini",api_key_env:"OPENAI_API_KEY",known_models:["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-5.1","gpt-4.1-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-flash","gemini-3.1-pro-preview","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"]},groq:{base_url:"https://api.groq.com/openai/v1",default_model:"openai/gpt-oss-20b",api_key_env:"GROQ_API_KEY",known_models:["openai/gpt-oss-120b","openai/gpt-oss-20b","qwen/qwen3.6-27b","groq/compound","groq/compound-mini","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","anthropic/claude-sonnet-5","openai/gpt-5.4-mini","google/gemini-2.5-flash"]},ollama:{base_url:"http://127.0.0.1:11434",default_model:"gemma2:9b",api_key_env:"",known_models:[]},azure:{base_url:"",default_model:"",api_key_env:"AZURE_OPENAI_API_KEY",known_models:[]},mock:{base_url:"",default_model:"mock",api_key_env:"",known_models:["mock"]},custom:{base_url:"",default_model:"",api_key_env:"",known_models:[]}};let Kk=!1;async function mI(){if(!Kk)try{const{Engines:e}=await dI(async()=>{const{Engines:a}=await Promise.resolve().then(()=>pP);return{Engines:a}},[]),{presets:t}=await e.presets();for(const[a,o]of Object.entries(t||{}))a in Za&&o&&Object.assign(Za[a],o);Kk=!0}catch{}}function lE(e){const t=e.indexOf(":");return t<0?{provider:e,model:""}:{provider:e.slice(0,t),model:e.slice(t+1)}}function vh({value:e,onChange:t,providers:a}){const{provider:o,model:i}=lE(e),c=a.find(h=>h.slug===o),d=!!o&&!c,f=x.useMemo(()=>{const h=c?Za[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...h]))},[c]),m=h=>{const b=a.find(j=>j.slug===h),_=b?.default_model||Za[b?.engine]?.default_model||"";t(_?`${h}:${_}`:`${h}:`)},g=h=>t(`${o}:${h}`);return n.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[n.jsx(ct,{value:o,onChange:m,placeholder:d?u("router_panel.provider_not_found",{name:o}):u("router_panel.provider_ph"),options:a.map(h=>({value:h.slug,label:h.slug,icon:Lf[h.engine]}))}),n.jsx(oE,{value:i,onChange:g,options:f,invalid:d,invalidHint:u("router_panel.provider_not_configured",{name:o})})]})}function gI(){const e=Je(),{superAgent:t,isLoading:a,mutate:o}=iE(),{config:i,patch:c}=ur(),[d,f]=x.useState(""),[m,g]=x.useState([]),[h,b]=x.useState(""),[_,j]=x.useState(null),[E,y]=x.useState(!1),[k,N]=x.useState({model:"",fallback:[]});x.useEffect(()=>{if(!t)return;const L=t.model_fallback?.models||[],I=Array.isArray(L)?L:[];f(t.model||""),g(I),N({model:t.model||"",fallback:I})},[t]);const w=x.useMemo(()=>{const L=i.engines||{};return Object.entries(L).map(([I,D])=>({slug:I,engine:D?.engine||I,default_model:D?.default_model||Za[D?.engine||I]?.default_model}))},[i.engines]),S=L=>{const{provider:I}=lE(L);return w.some(D=>D.slug===I)};if(a||!t)return n.jsx(tt,{});const R=d!==k.model||JSON.stringify(m)!==JSON.stringify(k.fallback),A=async()=>{y(!0);try{await c({"super_agent.model":d,"super_agent.model_fallback.enabled":m.length>0,"super_agent.model_fallback.models":m}),e.success(u("router_panel.saved_toast")),N({model:d,fallback:m}),o()}catch(L){e.error(L.message)}finally{y(!1)}},T=()=>{const L=h.trim().replace(/:$/,"");!L||!L.includes(":")||m.includes(L)||(g([...m,L]),b(""))},z=(L,I)=>{const D=[...m];D[L]=I,g(D)},M=L=>{g(m.filter((I,D)=>D!==L)),_===L&&j(null)},P=(L,I)=>{const D=L+I;if(D<0||D>=m.length)return;const $=[...m];[$[L],$[D]]=[$[D],$[L]],g($)};return n.jsx(Ve,{title:u("router_panel.title"),description:u("router_panel.description"),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs($e,{tone:"success",children:[n.jsx(Zc,{size:11})," ",u("router_panel.badge_default")]}),n.jsx("span",{className:`font-mono text-xs ${!S(d)&&d?"text-amber-400":""}`,children:d||"—"}),m.map(L=>n.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[n.jsx(F2,{size:12}),n.jsx("span",{className:`font-mono text-xs ${S(L)?"":"text-amber-400"}`,children:L})]},L))]}),w.length===0?n.jsx("p",{className:"text-xs text-muted-fg",children:u("router_panel.no_providers")}):n.jsx(le,{label:u("router_panel.active_model_label"),hint:u("router_panel.active_model_hint"),children:n.jsx(vh,{value:d,onChange:f,providers:w})}),n.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"mb-2",children:[n.jsx("div",{className:"text-sm font-medium",children:u("router_panel.fallback_title")}),n.jsx("div",{className:"text-xs text-muted-fg",children:u("router_panel.fallback_desc")})]}),n.jsxs("ul",{className:"mb-3 space-y-1",children:[m.map((L,I)=>{const D=!S(L),$=_===I;return n.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("span",{className:"w-6 text-muted-fg",children:["#",I+1]}),$?n.jsx("div",{className:"flex-1",children:n.jsx(vh,{value:L,onChange:q=>z(I,q),providers:w})}):n.jsxs("button",{type:"button",onClick:()=>j(I),className:"flex flex-1 items-center gap-1.5 text-left",children:[D&&n.jsx(wb,{size:12,className:"text-amber-400"}),n.jsx("span",{className:`font-mono ${D?"text-amber-400":""}`,children:L})]}),$?n.jsx(re,{size:"sm",variant:"secondary",onClick:()=>j(null),children:u("router_panel.done")}):n.jsx(re,{size:"sm",variant:"ghost",onClick:()=>j(I),children:n.jsx(wa,{size:12})}),n.jsx(re,{size:"sm",variant:"ghost",onClick:()=>P(I,-1),disabled:I===0,children:"↑"}),n.jsx(re,{size:"sm",variant:"ghost",onClick:()=>P(I,1),disabled:I===m.length-1,children:"↓"}),n.jsx(re,{size:"sm",variant:"destructive",onClick:()=>M(I),children:n.jsx(_n,{size:12})})]})},`${I}-${L}`)}),m.length===0&&n.jsx("li",{className:"text-xs text-muted-fg",children:u("router_panel.fallback_empty")})]}),w.length>0&&n.jsxs("div",{className:"space-y-2",children:[n.jsx("div",{className:"text-xs text-muted-fg",children:u("router_panel.add_to_chain")}),n.jsx(vh,{value:h,onChange:b,providers:w}),n.jsxs(re,{size:"sm",variant:"secondary",onClick:T,disabled:!h.includes(":")||h.endsWith(":"),children:[n.jsx(Dt,{size:13})," ",u("router_panel.add_to_chain")]})]})]}),n.jsx(re,{variant:"primary",loading:E,disabled:!R,onClick:A,children:u(R?"router_panel.save":"router_panel.saved")})]})})}const hI=[{model:"openai:gpt-4o",when:{has_image:!0}},{model:"anthropic:claude-3-5-haiku",when:{max_prompt_chars:400}}];function xI({when:e}){const t=[];return!e||Object.keys(e).length===0?t.push({icon:n.jsx(Zr,{size:11}),label:u("routing_panel.when_any")}):(e.has_image===!0&&t.push({icon:n.jsx(ux,{size:11}),label:u("routing_panel.when_image")}),e.has_image===!1&&t.push({icon:n.jsx(ux,{size:11}),label:u("routing_panel.when_no_image")}),Number.isFinite(e.min_prompt_chars)&&t.push({icon:n.jsx(Yg,{size:11}),label:u("routing_panel.when_min_prompt",{n:String(e.min_prompt_chars)})}),Number.isFinite(e.max_prompt_chars)&&t.push({icon:n.jsx(Yg,{size:11}),label:u("routing_panel.when_max_prompt",{n:String(e.max_prompt_chars)})}),Number.isFinite(e.min_context_chars)&&t.push({icon:n.jsx(Yg,{size:11}),label:u("routing_panel.when_min_context",{n:String(e.min_context_chars)})}),Array.isArray(e.channels)&&e.channels.length>0&&t.push({icon:n.jsx(mM,{size:11}),label:u("routing_panel.when_channels",{list:e.channels.join(", ")})}),Array.isArray(e.keywords)&&e.keywords.length>0&&t.push({icon:n.jsx(QA,{size:11}),label:u("routing_panel.when_keywords",{list:e.keywords.join(", ")})})),n.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:t.map((a,o)=>n.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-fg",children:[a.icon," ",a.label]},o))})}function bI(){const e=Je(),{config:t,isLoading:a,patch:o}=ur(),[i,c]=x.useState(!1),[d,f]=x.useState("[]"),[m,g]=x.useState(!1),[h,b]=x.useState(!1),[_,j]=x.useState(!1),[E,y]=x.useState({enabled:!1,rulesText:"[]"});x.useEffect(()=>{const M=t.super_agent?.routing||{},P=Array.isArray(M.rules)?M.rules:[],L=JSON.stringify(P,null,2);c(M.enabled===!0),f(L),y({enabled:M.enabled===!0,rulesText:L})},[t.super_agent?.routing]);const k=x.useMemo(()=>{try{const M=JSON.parse(d);return Array.isArray(M)?{rules:M,error:null}:{rules:[],error:u("routing_panel.json_not_array")}}catch(M){return{rules:[],error:u("routing_panel.json_error",{msg:M.message})}}},[d]);if(a)return n.jsx(tt,{});const N=k.rules,w=N.length,S=k.error?d:JSON.stringify(N),R=(()=>{try{return JSON.stringify(JSON.parse(E.rulesText))}catch{return E.rulesText}})(),A=i!==E.enabled||S!==R,T=async()=>{if(!k.error){b(!0);try{await o({"super_agent.routing":{enabled:i,rules:N}}),e.success(u("routing_panel.saved_toast"));const M=JSON.stringify(N,null,2);f(M),y({enabled:i,rulesText:M})}catch(M){e.error(M.message)}finally{b(!1),j(!1)}}},z=i&&w>0;return n.jsxs("div",{"data-testid":"routing-panel",children:[n.jsx(Ve,{title:u("routing_panel.title"),description:u("routing_panel.description"),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[n.jsx("span",{"data-testid":"routing-signal",children:z?n.jsxs($e,{tone:"success",children:[n.jsx(Gg,{size:11})," ",u("routing_panel.signal_on",{n:String(w)})]}):i?n.jsxs($e,{tone:"warning",children:[n.jsx(Gg,{size:11})," ",u("routing_panel.signal_on_empty")]}):n.jsxs($e,{tone:"muted",children:[n.jsx(Gg,{size:11})," ",u("routing_panel.signal_off")]})}),n.jsx(Ue,{content:u("routing_panel.helper"),children:n.jsx("span",{className:"text-xs text-muted-fg underline decoration-dotted underline-offset-2",children:u("routing_panel.how_it_works")})})]}),n.jsx(Bt,{checked:i,onChange:c,label:u("routing_panel.enable_label")}),n.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[n.jsxs("div",{children:[n.jsx("div",{className:"text-sm font-medium",children:u("routing_panel.rules_title")}),n.jsx("div",{className:"text-xs text-muted-fg",children:u("routing_panel.rules_desc")})]}),n.jsx(re,{size:"sm",variant:"secondary",onClick:()=>g(M=>!M),children:u(m?"routing_panel.hide_editor":"routing_panel.edit_rules")})]}),n.jsxs("ul",{className:"space-y-1.5",children:[N.map((M,P)=>n.jsxs("li",{className:"rounded-md bg-card px-2.5 py-2 text-xs",children:[n.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[n.jsxs("span",{className:"w-6 text-muted-fg",children:["#",P+1]}),n.jsx("span",{className:"font-mono text-[12px]",children:M.model||"—"})]}),n.jsx("div",{className:"pl-8",children:n.jsx(xI,{when:M.when})})]},P)),w===0&&!k.error&&n.jsx("li",{className:"text-xs text-muted-fg",children:u("routing_panel.rules_empty")})]})]}),m&&n.jsxs(le,{label:u("routing_panel.editor_label"),hint:u("routing_panel.json_hint"),children:[n.jsx(un,{rows:10,className:"font-mono text-xs",value:d,onChange:M=>f(M.target.value),spellCheck:!1}),k.error?n.jsx("span",{className:"mt-1 block text-[11px] text-red-400",children:k.error}):n.jsx("button",{type:"button",className:"mt-1 text-[11px] text-muted-fg underline decoration-dotted underline-offset-2",onClick:()=>f(JSON.stringify(hI,null,2)),children:u("routing_panel.insert_example")})]}),n.jsx("p",{className:"text-[11px] leading-relaxed text-muted-fg",children:u("routing_panel.helper")}),n.jsx(re,{variant:"primary",loading:h,disabled:!A||!!k.error,onClick:()=>j(!0),children:u(A?"routing_panel.save":"routing_panel.saved")})]})}),n.jsx(Xt,{open:_,onClose:()=>j(!1),title:u("routing_panel.confirm_title"),description:u("routing_panel.confirm_body"),footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:()=>j(!1),children:u("routing_panel.cancel")}),n.jsx(re,{variant:"primary",loading:h,onClick:T,children:u("routing_panel.confirm_apply")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:i?u("routing_panel.confirm_on",{n:String(w)}):u("routing_panel.confirm_off")})})]})}function _I({provider:e,onEdit:t,onDelete:a,onToggle:o}){const i=_h(fI,e.engine),c=_h(pI,e.engine),d=_h(Lf,e.engine),f=Mc.find(b=>b.value===e.engine)?.label||e.engine,m=typeof e.api_key=="string"&&e.api_key.length>0,g=Lo(e.api_key),h=e.is_active!==!1;return n.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:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("div",{className:ge("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",i),children:n.jsx(d,{className:"size-5 text-white"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),n.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),n.jsxs("span",{className:ge("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[n.jsx(d,{className:"size-3"})," ",f]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[n.jsx(Ue,{content:u(h?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:n.jsxs("button",{type:"button",onClick:b=>{b.stopPropagation(),o()},className:ge("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:[n.jsx("span",{className:ge("size-1.5 rounded-full",h?"bg-emerald-400":"bg-muted-fg/40")}),u(h?"providers_card.active":"providers_card.off")]})}),n.jsx(Ue,{content:u("providers_modal.delete"),children:n.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),a()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:n.jsx(_n,{className:"size-3.5"})})})]})]}),n.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[n.jsx(hc,{label:u("providers_card.model"),value:e.default_model||"—",mono:!0}),e.base_url&&n.jsx(hc,{label:u("providers_card.base_url"),value:e.base_url,mono:!0,truncate:!0}),n.jsx(hc,{label:u("providers_card.api_key"),value:m?g?`…${g}`:u("providers_card.key_set"):"—",mono:!!g}),e.default_temperature!==void 0&&n.jsx(hc,{label:u("providers_card.temp"),value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&n.jsx(hc,{label:u("providers_card.price_io"),value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function hc({label:e,value:t,mono:a,truncate:o}){return n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:e}),n.jsx("span",{className:ge("text-foreground",a&&"font-mono",o&&"max-w-[180px] truncate"),children:t})]})}const Xk={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:""},vI=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function xc(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function qd(e){if(e==null)return"";const t=Number(e);return Number.isFinite(t)?String(t):""}function yI(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:qd(e.pricing?.input_per_million),p_output:qd(e.pricing?.output_per_million),p_cache_read:qd(e.pricing?.cache_read_per_million),p_cache_write:qd(e.pricing?.cache_write_per_million)}}function jI({open:e,initial:t,existingSlugs:a,onClose:o,onSave:i}){const c=!!t,[d,f]=x.useState(Xk),[m,g]=x.useState(!1),[h,b]=x.useState(null),[_,j]=x.useState([]),[E,y]=x.useState(!1),[k,N]=x.useState(null),[w,S]=x.useState(!1),[R,A]=x.useState("");x.useEffect(()=>{if(!e)return;const Q=t?yI(t):Xk;f(Q),b(null),N(null),S(!1);const W=Za[Q.engine];j(W?.known_models||[])},[e,t]);const T=Q=>f(W=>({...W,...Q})),z=Q=>{const W=Za[Q];T({engine:Q,name:Q==="custom"?d.name:Mc.find(B=>B.value===Q)?.label||Q,slug:Q==="custom"?d.slug:Q,base_url:W.base_url,default_model:W.default_model}),j(W.known_models),N(null)},M=Q=>{const W=Za[Q];T({engine:Q,base_url:d.base_url||W.base_url,default_model:d.default_model||W.default_model}),j(W.known_models)},P=async()=>{y(!0),N(null);try{const Q=await Hc.models({engine:d.engine,slug:d.slug||xc(d.name),base_url:d.base_url||void 0,api_key:d.api_key_value||void 0});if(Q.error){N(Q.error);return}j(Q.models),Q.models.length===0&&N(u("providers_modal.err_no_models"))}catch(Q){N(Q.message||u("providers_modal.err_list_models"))}finally{y(!1)}},L=x.useMemo(()=>d.default_model&&!_.includes(d.default_model)?[d.default_model,..._]:_,[_,d.default_model]),I=()=>{const Q=(d.slug||xc(d.name)).trim();if(!Q)return b(u("providers_modal.err_slug_required")),null;if(!c&&a.includes(Q))return b(u("providers_modal.err_slug_exists",{slug:Q})),null;let W;if(d.model_context_limits_json.trim())try{const ee=JSON.parse(d.model_context_limits_json);if(!ee||typeof ee!="object"||Array.isArray(ee))throw new Error;W=ee}catch{return b(u("providers_modal.err_model_limits_json")),null}const K=[d.p_input,d.p_output,d.p_cache_read,d.p_cache_write].map(ee=>ee.trim()).some(Boolean)?{input_per_million:Number(d.p_input||0),output_per_million:Number(d.p_output||0),cache_read_per_million:Number(d.p_cache_read||0),cache_write_per_million:Number(d.p_cache_write||0)}:void 0;return{provider:{slug:Q,name:d.name.trim()||Q,engine:d.engine,base_url:d.base_url.trim()||void 0,default_model:d.default_model.trim()||void 0,default_temperature:d.default_temperature,default_max_tokens:d.default_max_tokens,is_active:d.is_active,context_limit_tokens:d.context_limit_tokens||void 0,model_context_limits:W,pricing:K},modelLimits:W}},D=()=>{const Q=I();if(!Q)return;const{provider:W}=Q,B={name:W.name,engine:W.engine,is_active:W.is_active!==!1,default_temperature:W.default_temperature,default_max_tokens:W.default_max_tokens};W.base_url&&(B.base_url=W.base_url),W.default_model&&(B.default_model=W.default_model),W.context_limit_tokens&&(B.context_limit_tokens=W.context_limit_tokens),W.model_context_limits&&(B.model_context_limits=W.model_context_limits),W.pricing&&(B.pricing=W.pricing),d.api_key_value.trim()&&(B.api_key=d.api_key_value.trim()),A(JSON.stringify(B,null,2)),b(null),S(!0)},$=async()=>{g(!0),b(null);try{if(w){const W=(d.slug||xc(d.name)).trim();if(!W){b(u("providers_modal.err_slug_required_form"));return}let B;try{B=JSON.parse(R)}catch{b(u("providers_modal.err_json_invalid"));return}if(!B||typeof B!="object"||Array.isArray(B)){b(u("providers_modal.err_json_object"));return}const K=B;if(!K.engine||typeof K.engine!="string"){b(u("providers_modal.err_engine_missing"));return}const ee={slug:W,name:typeof K.name=="string"?K.name:W,engine:String(K.engine),base_url:typeof K.base_url=="string"?K.base_url:void 0,default_model:typeof K.default_model=="string"?K.default_model:void 0,is_active:K.is_active!==!1};await i({provider:ee,raw:K,originalSlug:t?.slug}),o();return}const Q=I();if(!Q)return;await i({provider:Q.provider,apiKeyValue:d.api_key_value.trim()||void 0,originalSlug:t?.slug}),o()}catch(Q){b(Q.message||u("providers_modal.err_save"))}finally{g(!1)}},q=c&&ps(t?.api_key),G=Lo(t?.api_key),U=q?u("providers_modal.api_key_set",{suffix:G??""}):"sk-…",V=d.engine==="ollama",X=Za[d.engine]?.api_key_env;return n.jsx(Xt,{open:e,onClose:o,title:c?u("providers_modal.edit_title",{name:t?.name||t?.slug||""}):u("providers_modal.new_title"),description:u("providers_modal.description"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:o,disabled:m,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:$,loading:m,children:u(c?"common.save":"common.create")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between",children:[c?n.jsx("span",{}):n.jsx("div",{className:"flex flex-wrap gap-1.5",children:vI.map(Q=>{const W=Lf[Q],B=Q==="custom"?u("providers_modal.custom"):Mc.find(ee=>ee.value===Q)?.label||Q,K=d.engine===Q;return n.jsxs("button",{type:"button",onClick:()=>z(Q),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${K?"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:[n.jsx(W,{className:"size-3.5"})," ",B]},Q)})}),n.jsxs("button",{type:"button",onClick:()=>w?S(!1):D(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${w?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[n.jsx(kA,{className:"size-3.5"})," ",u(w?"providers_modal.form_mode":"providers_modal.json_mode")]})]}),w?n.jsxs("div",{className:"space-y-2",children:[n.jsx(le,{label:u("providers_modal.json_label"),hint:u("providers_modal.json_hint",{slug:d.slug||xc(d.name)||"<slug>"}),children:n.jsx(un,{rows:14,className:"font-mono text-xs",value:R,onChange:Q=>A(Q.target.value),spellCheck:!1})}),n.jsx("p",{className:"text-[11px] text-muted-fg",children:u("providers_modal.json_help")})]}):n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("providers_modal.name_label"),children:n.jsx(Ee,{value:d.name,onChange:Q=>T({name:Q.target.value,slug:c?d.slug:xc(Q.target.value)}),placeholder:u("providers_modal.name_ph")})}),n.jsx(le,{label:u("providers_modal.engine_label"),children:n.jsx(ct,{value:d.engine,onChange:Q=>M(Q),options:Mc.map(Q=>({value:Q.value,label:Q.label,icon:Lf[Q.value]}))})})]}),n.jsx(le,{label:u("providers_modal.base_url_label"),hint:u("providers_modal.base_url_hint"),children:n.jsx(Ee,{value:d.base_url,onChange:Q=>T({base_url:Q.target.value}),placeholder:u("providers_modal.base_url_ph")})}),!V&&n.jsx(le,{label:u("providers_modal.api_key_label"),hint:q?u("providers_modal.api_key_hint_existing"):X?u("providers_modal.api_key_hint_env",{env:X}):u("providers_modal.api_key_hint"),children:n.jsx(Ee,{type:"password",autoComplete:"new-password",value:d.api_key_value,onChange:Q=>T({api_key_value:Q.target.value}),placeholder:U})}),n.jsx(le,{label:u("providers_modal.model_label"),children:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(oE,{value:d.default_model,onChange:Q=>T({default_model:Q}),options:L,className:"flex-1"}),n.jsx(Ue,{content:u("providers_modal.list_models_hint"),children:n.jsxs(re,{size:"sm",variant:"secondary",onClick:P,disabled:E,"aria-label":u("providers_modal.list_models_hint"),children:[E?n.jsx(Js,{className:"size-3.5 animate-spin"}):n.jsx(Cs,{className:"size-3.5"}),u("providers_modal.load_models")]})})]}),k&&n.jsx("p",{className:"text-[11px] text-amber-400",children:k})]})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("providers_modal.max_tokens_label"),children:n.jsx(Ee,{type:"number",min:256,step:256,value:d.default_max_tokens,onChange:Q=>T({default_max_tokens:parseInt(Q.target.value)||4096})})}),n.jsx(le,{label:u("providers_modal.temperature_label",{value:d.default_temperature.toFixed(1)}),children:n.jsx("input",{type:"range",min:0,max:2,step:.1,value:d.default_temperature,onChange:Q=>T({default_temperature:parseFloat(Q.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),n.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[n.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:u("providers_modal.pricing_summary")}),n.jsxs("div",{className:"mt-3 space-y-3",children:[n.jsx(le,{label:u("providers_modal.context_limit_label"),children:n.jsx(Ee,{type:"number",min:0,step:1024,value:d.context_limit_tokens,onChange:Q=>T({context_limit_tokens:parseInt(Q.target.value)||0})})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("providers_modal.price_input"),children:n.jsx(Ee,{type:"number",min:0,step:1e-4,value:d.p_input,onChange:Q=>T({p_input:Q.target.value}),placeholder:"0.15"})}),n.jsx(le,{label:u("providers_modal.price_output"),children:n.jsx(Ee,{type:"number",min:0,step:1e-4,value:d.p_output,onChange:Q=>T({p_output:Q.target.value}),placeholder:"0.60"})}),n.jsx(le,{label:u("providers_modal.price_cache_read"),children:n.jsx(Ee,{type:"number",min:0,step:1e-4,value:d.p_cache_read,onChange:Q=>T({p_cache_read:Q.target.value}),placeholder:"0.03"})}),n.jsx(le,{label:u("providers_modal.price_cache_write"),children:n.jsx(Ee,{type:"number",min:0,step:1e-4,value:d.p_cache_write,onChange:Q=>T({p_cache_write:Q.target.value}),placeholder:"0.00"})})]}),n.jsx(le,{label:u("providers_modal.model_limits_label"),hint:'{"gpt-4o-mini":128000}',children:n.jsx(un,{rows:3,className:"font-mono text-xs",value:d.model_context_limits_json,onChange:Q=>T({model_context_limits_json:Q.target.value})})})]})]}),n.jsx(Bt,{checked:d.is_active,onChange:Q=>T({is_active:Q}),label:u("providers_modal.active_label")})]}),h&&n.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:h})]})})}const kI=new Set(Mc.map(e=>e.value));function wI(e,t){const a=typeof t.engine=="string"&&t.engine||(kI.has(e)?e:"custom");return{slug:e,name:typeof t.name=="string"?t.name:void 0,engine:a,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 SI(){const e=Je(),{config:t,isLoading:a,patch:o,mutate:i}=ur(),[c,d]=x.useState(!1),[f,m]=x.useState(null);if(a)return n.jsx(tt,{});const g=t.engines||{},h=Object.entries(g).map(([N,w])=>wI(N,w||{})),b=h.map(N=>N.slug),_=()=>{m(null),d(!0)},j=N=>{m(N),d(!0)},E=async({provider:N,apiKeyValue:w,raw:S})=>{if(S){await o({[`engines.${N.slug}`]:S}),e.success(u("engines_panel.saved_json")),i();return}const R=`engines.${N.slug}`,A={[`${R}.name`]:N.name,[`${R}.engine`]:N.engine,[`${R}.is_active`]:N.is_active!==!1,[`${R}.default_temperature`]:N.default_temperature,[`${R}.default_max_tokens`]:N.default_max_tokens},T=[],z=(M,P)=>{P===void 0||P===""?T.push(`${R}.${M}`):A[`${R}.${M}`]=P};z("base_url",N.base_url),z("default_model",N.default_model),z("context_limit_tokens",N.context_limit_tokens),z("pricing",N.pricing),z("model_context_limits",N.model_context_limits),w&&(A[`${R}.api_key`]=w),await o(A,T),e.success(u("engines_panel.saved")),i()},y=async N=>{try{await o({[`engines.${N.slug}.is_active`]:N.is_active===!1}),i()}catch(w){e.error(w.message)}},k=async N=>{if(confirm(u("engines_panel.delete_confirm",{name:N.name||N.slug})))try{await o(void 0,[`engines.${N.slug}`]),e.success(u("engines_panel.deleted")),i()}catch(w){e.error(w.message)}};return n.jsxs(Ve,{title:u("engines_panel.title"),description:u("engines_panel.description"),action:n.jsxs(re,{size:"sm",variant:"primary",onClick:_,children:[n.jsx(Dt,{size:14})," ",u("engines_panel.new_btn")]}),children:[h.length===0?n.jsx(ut,{children:u("engines_panel.empty")}):n.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[h.map(N=>n.jsx(_I,{provider:N,onEdit:()=>j(N),onDelete:()=>k(N),onToggle:()=>y(N)},N.slug)),n.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:[n.jsx(Dt,{size:20}),n.jsx("span",{className:"text-sm font-medium",children:u("engines_panel.add_card")})]})]}),n.jsx(jI,{open:c,initial:f,existingSlugs:b,onClose:()=>{d(!1),m(null)},onSave:E})]})}function cE(){return n.jsxs("div",{className:"space-y-6",children:[n.jsx(gI,{}),n.jsx(bI,{}),n.jsx(SI,{})]})}function CI(){const e=Je(),[t,a]=x.useState(!1),i=Be(t?"/api/agents/vault?include_removed=1":"/api/agents/vault",()=>an.vault({includeRemoved:t})),c=i.data||[],[d,f]=x.useState(null),m=async h=>{const b=h.source!=="user",_=b?u("base.defaults_tombstone_msg",{slug:h.slug}):u("base.defaults_delete_msg",{slug:h.slug});if(confirm(_))try{await an.vaultRemove(h.slug),e.success(u(b?"base.defaults_hidden":"base.defaults_deleted")),i.mutate()}catch(j){e.error(j.message)}},g=async h=>{try{await an.vaultRestore(h),e.success(u("base.defaults_restored")),i.mutate()}catch(b){e.error(b.message)}};return n.jsxs(Ve,{title:u("base.defaults_title"),description:u("base.defaults_desc"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Bt,{checked:t,onChange:a,label:u("base.defaults_show_removed")}),n.jsxs(re,{size:"sm",onClick:()=>f("new"),children:[n.jsx(Dt,{size:14})," ",u("base.defaults_new")]})]}),children:[i.isLoading&&n.jsx(tt,{}),!i.isLoading&&c.length===0&&n.jsx(ut,{children:u("base.defaults_empty")}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(h=>{const b=t&&h.tombstoned;return n.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:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.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?n.jsx(va,{className:"size-4 text-white"}):n.jsx(rn,{className:"size-4 text-white"})}),n.jsx("span",{className:"truncate text-sm font-semibold",children:h.slug}),n.jsx(NI,{source:h.source})]}),n.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?n.jsx(yh,{label:u("base.defaults_restore"),onClick:()=>g(h.slug),variant:"secondary",children:n.jsx(fl,{size:13})}):n.jsxs(n.Fragment,{children:[n.jsx(yh,{label:u("base.defaults_edit"),onClick:()=>f(h),variant:"ghost",children:n.jsx(wa,{size:13})}),n.jsx(yh,{label:h.source==="user"?u("base.defaults_delete"):u("base.defaults_hide"),onClick:()=>m(h),variant:"ghost-destructive",children:n.jsx(_n,{size:13})})]})})]}),h.model?n.jsx($e,{tone:"info",children:h.model}):n.jsx("span",{className:"text-[10px] text-muted-fg",children:u("agents_ui.model_router_default")}),h.description&&n.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:h.description}),n.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.role&&n.jsx($e,{children:h.role}),h.skills?.map(_=>n.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[n.jsx(sa,{size:9})," ",_]},_)),h.tools?.map(_=>n.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[n.jsx(aa,{size:9})," ",_]},_))]})]},h.slug)})}),d!==null&&n.jsx(EI,{agent:d==="new"?null:d,onClose:()=>f(null),onSaved:()=>{f(null),i.mutate()}})]})}function NI({source:e}){return e==="user"?n.jsx($e,{tone:"success",children:u("agents_ui.source_user")}):e==="user-override"?n.jsx($e,{tone:"warning",children:u("agents_ui.source_override")}):n.jsx($e,{tone:"muted",children:u("agents_ui.source_bundled")})}function yh({label:e,onClick:t,variant:a="ghost",children:o}){const i="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 n.jsxs(m_,{children:[n.jsx(g_,{render:n.jsx("button",{type:"button",onClick:t,"aria-label":e,className:`${i} ${c[a]}`,children:o})}),n.jsx(h_,{children:e})]})}function EI({agent:e,onClose:t,onSaved:a}){const o=Je(),[i,c]=x.useState(!1),d=!e,[f,m]=x.useState(e?.slug??""),[g,h]=x.useState(e?.role??""),[b,_]=x.useState(e?.model??""),[j,E]=x.useState(e?.description??""),[y,k]=x.useState(e?.language??"es"),[N,w]=x.useState((e?.skills??[]).join(", ")),[S,R]=x.useState((e?.tools??[]).join(", ")),[A,T]=x.useState(!!e?.is_master),[z,M]=x.useState(e?.body??""),P=async()=>{const L={role:g||void 0,model:b||void 0,description:j||void 0,language:y||void 0,skills:N,tools:S,is_master:A};c(!0);try{if(d){if(!/^[a-z][a-z0-9_-]*$/.test(f))throw new Error(u("base.defaults_slug_invalid"));await an.vaultCreate(f,L,z),o.success(u("base.defaults_created",{slug:f}))}else await an.vaultPatch(e.slug,{fields:L,body:z}),o.success(u("base.defaults_saved",{slug:e.slug}));a()}catch(I){o.error(I.message)}finally{c(!1)}};return n.jsx(Xt,{open:!0,onClose:t,title:d?u("base.defaults_new_title"):u("base.defaults_edit_title",{slug:e.slug}),description:d?u("base.defaults_new_desc"):e.source==="bundled"?u("base.defaults_bundled_desc"):u("base.defaults_user_desc"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:i,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:P,loading:i,children:u("common.save")})]}),children:n.jsxs("div",{className:"space-y-3",children:[d&&n.jsx(le,{label:"slug",hint:u("agents_ui.slug_kebab_hint"),children:n.jsx(Ee,{autoFocus:!0,value:f,onChange:L=>m(L.target.value),placeholder:"reviewer"})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:"role",children:n.jsx(Ee,{value:g,onChange:L=>h(L.target.value),placeholder:"Code reviewer"})}),n.jsx(le,{label:"model",children:n.jsx(Ee,{value:b,onChange:L=>_(L.target.value),placeholder:"openrouter:..."})}),n.jsx(le,{label:"language",children:n.jsx(Ee,{value:y,onChange:L=>k(L.target.value),placeholder:"es"})}),n.jsx(le,{label:"is_master",children:n.jsx("div",{className:"flex h-9 items-center",children:n.jsx(Bt,{checked:A,onChange:T,label:u("base.defaults_master_label")})})})]}),n.jsx(le,{label:"description",children:n.jsx(Ee,{value:j,onChange:L=>E(L.target.value)})}),n.jsx(le,{label:"skills",hint:u("agents_ui.comma_separated"),children:n.jsx(Ee,{value:N,onChange:L=>w(L.target.value),placeholder:"code-review, git"})}),n.jsx(le,{label:"tools",hint:u("agents_ui.comma_separated"),children:n.jsx(Ee,{value:S,onChange:L=>R(L.target.value),placeholder:"read, write, run"})}),n.jsx(le,{label:"body",hint:u("agents_ui.body_hint"),children:n.jsx(un,{value:z,onChange:L=>M(L.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const RI=20,Qk=[10,20,50,100];function F_({key:e,fetchPage:t,resetKey:a,initialPageSize:o=RI,swr:i}){const[c,d]=x.useState(1),[f,m]=x.useState(o);x.useEffect(()=>{d(1)},[a]);const g=(c-1)*f,h=Be(e==null?null:[e,f,g],()=>t(f,g),{keepPreviousData:!0,...i}),b=h.data?.total??0,_=Math.max(1,Math.ceil(b/f)),j=Math.min(c,_);x.useEffect(()=>{c!==j&&d(j)},[c,j]);const E=b===0?0:g,y=Math.min(g+f,b);return{items:h.data?.items??[],isLoading:h.isLoading,error:h.error,mutate:h.mutate,page:j,pageCount:_,total:b,start:E,end:y,pageSize:f,setPage:d,setPageSize:k=>{m(k),d(1)}}}function TI({page:e,pageCount:t,total:a,start:o,end:i,pageSize:c,onPage:d,onPageSize:f}){return a<=Qk[0]?null:n.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3 text-xs text-muted-fg",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx("span",{className:"tabular-nums",children:u("common.pager_range",{from:o+1,to:i,total:a})}),n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx("span",{children:u("common.pager_per_page")}),n.jsx("div",{className:"w-[4.5rem]",children:n.jsx(ct,{value:String(c),onChange:m=>f(Number(m)),options:Qk.map(m=>({value:String(m),label:String(m)}))})})]})]}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(re,{size:"sm",variant:"ghost",disabled:e<=1,onClick:()=>d(e-1),"aria-label":u("common.pager_prev"),children:n.jsx(CA,{size:14})}),n.jsx("span",{className:"px-1 tabular-nums",children:u("common.pager_page",{page:e,total:t})}),n.jsx(re,{size:"sm",variant:"ghost",disabled:e>=t,onClick:()=>d(e+1),"aria-label":u("common.pager_next"),children:n.jsx(Zr,{size:14})})]})]})}function G_({paged:e,fullHeight:t,className:a,children:o}){const i=n.jsx(TI,{page:e.page,pageCount:e.pageCount,total:e.total,start:e.start,end:e.end,pageSize:e.pageSize,onPage:e.setPage,onPageSize:e.setPageSize});return t?n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[n.jsx("div",{className:ge("min-h-0 flex-1 overflow-y-auto",a),children:o}),n.jsx("div",{className:"shrink-0",children:i})]}):n.jsxs("div",{className:a,children:[o,i]})}const AI={apx:"success",claude:"info",codex:"warning"};function MI({pid:e}={}){const t=Je(),a=yp(),o=!e||String(e)==="0",{project:i}=uu(o?"":e),c=o?void 0:i?.path||void 0,[d,f]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(!1);x.useEffect(()=>{const R=setTimeout(()=>b(m.trim()),350);return()=>clearTimeout(R)},[m]);const E=F_({key:`/api/sessions?engine=${d}&q=${h}&deep=${_?1:0}&cwd=${c||""}`,fetchPage:(R,A)=>dP.page({engine:d||void 0,q:h||void 0,deep:_,cwd:c,limit:R,offset:A}),resetKey:`${d}|${h}|${_?1:0}|${c||""}`}),y=()=>{g(""),b(""),f(""),j(!1)},k=async R=>{try{await navigator.clipboard.writeText(`apx session resume ${R.id} --continue`),t.success(u("base.sessions_cmd_copied"))}catch{t.error(u("base.sessions_copy_failed"))}},N=R=>{const A=`Continue this session: ${R.id} (engine: ${R.engine}${R.title?`, title: "${R.title}"`:""}${R.cwd?`, folder: ${R.cwd}`:""}). With these instructions: `;window.dispatchEvent(new CustomEvent("apx:roby-prompt",{detail:{prompt:A}}))},w=async R=>{if(!R.cwd){t.error(u("base.sessions_no_folder"));return}try{await xN.exec({kind:"open_path",target:R.cwd})}catch(A){t.error(u("base.sessions_folder_failed",{msg:A.message}))}},S=async R=>{const A=R.path||R.cwd;if(!A){t.error(u("base.sessions_no_path"));return}try{await navigator.clipboard.writeText(A),t.success(u("base.sessions_path_copied"))}catch{t.error(u("base.sessions_copy_failed"))}};return n.jsxs(Ve,{fullHeight:!0,title:u("base.sessions_title"),description:o?u("base.sessions_desc"):u("base.sessions_desc_scoped",{path:c||"…"}),action:n.jsx(Ue,{content:u("base.sessions_refresh"),children:n.jsx(re,{size:"sm",variant:"secondary",onClick:()=>E.mutate(),children:n.jsx(Cs,{size:13})})}),children:[n.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[n.jsxs("div",{className:"relative flex-1",children:[n.jsx(qi,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-fg"}),n.jsx(Ee,{className:"pl-8",placeholder:u("base.sessions_search_ph"),value:m,onChange:R=>g(R.target.value)})]}),n.jsx(Ue,{content:u("base.sessions_deep_tip"),children:n.jsx(re,{size:"sm",variant:_?"primary":"secondary",onClick:()=>j(R=>!R),children:u("base.sessions_deep")})}),n.jsx("div",{className:"w-36",children:n.jsx(ct,{value:d,onChange:f,options:[{value:"",label:u("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),n.jsx(Ue,{content:u("base.sessions_clear"),children:n.jsx(re,{size:"sm",variant:"ghost",onClick:y,children:n.jsx(gs,{size:14})})})]}),E.isLoading&&n.jsx(tt,{}),E.error&&n.jsx(ut,{children:u("base.sessions_error",{msg:E.error.message})}),!E.isLoading&&!E.error&&E.total===0&&n.jsx(ut,{children:h?u("base.sessions_no_match",{q:h}):u("base.sessions_empty")}),n.jsx(G_,{paged:E,fullHeight:!0,children:n.jsx("ul",{className:"space-y-1 text-sm",children:E.items.map((R,A)=>n.jsxs("li",{className:"group flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx($e,{tone:AI[R.engine]||"muted",children:R.engine}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate",children:R.title||R.id}),n.jsxs("div",{className:"flex items-center gap-2 font-mono text-[10px] text-muted-fg",children:[n.jsx("span",{className:"shrink-0",children:R.id}),R.cwd&&n.jsxs("span",{className:"truncate",children:["· ",R.cwd]})]})]}),R.mtime>0&&n.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(R.mtime).toLocaleString()}),n.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-60 transition-opacity group-hover:opacity-100",children:[n.jsx(Ue,{content:u("base.sessions_act_cmd"),children:n.jsx(re,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_cmd"),onClick:()=>k(R),children:n.jsx(ya,{size:13})})}),n.jsx(Ue,{content:u("base.sessions_act_ask",{name:a}),children:n.jsx(re,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_ask",{name:a}),onClick:()=>N(R),children:n.jsx(rn,{size:13})})}),n.jsx(Ue,{content:u("base.sessions_act_folder"),children:n.jsx(re,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_folder"),onClick:()=>w(R),children:n.jsx(Ho,{size:13})})}),n.jsx(Ue,{content:u("base.sessions_act_path"),children:n.jsx(re,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_path"),onClick:()=>S(R),children:n.jsx(Mo,{size:13})})})]})]},`${R.engine}-${R.id}-${A}`))})})]})}function zI(){const e=Tn(),[t,a]=x.useState("open"),[o,i]=x.useState(""),c=t==="open"?o:"",d=F_({key:`/api/tasks?state=${t}&status=${c}`,fetchPage:(f,m)=>Qn.globalPage({state:t,limit:f,offset:m,status:c}),resetKey:`${t}|${c}`});return n.jsxs(Ve,{fullHeight:!0,title:u("project.global_tasks.title"),description:u("project.global_tasks.subtitle"),action:n.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(f=>n.jsx(re,{size:"sm",variant:t===f?"primary":"ghost",onClick:()=>a(f),children:f},f))}),children:[t==="open"?n.jsxs("div",{className:"mb-3 flex flex-wrap gap-1",children:[n.jsx(re,{size:"sm",variant:o===""?"primary":"ghost",onClick:()=>i(""),children:u("project.global_tasks.any_status")}),["pending","running","in_review","blocked"].map(f=>n.jsx(re,{size:"sm",variant:o===f?"primary":"ghost",onClick:()=>i(f),children:f.replace("_"," ")},f))]}):null,d.isLoading&&n.jsx(tt,{}),!d.isLoading&&d.total===0&&n.jsx(ut,{children:u("project.global_tasks.empty")}),n.jsx(G_,{paged:d,fullHeight:!0,children:n.jsx("ul",{className:"space-y-2 text-sm",children:d.items.map(f=>n.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("button",{type:"button",onClick:()=>e(`/p/${f.project_id}/tasks`),title:u("project.global_tasks.go_project"),children:n.jsx($e,{tone:"info",children:(f.project_name||"").split("/").pop()||f.project_id})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"font-medium",children:f.title}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[n.jsx("span",{children:f.state}),f.agent&&n.jsxs($e,{tone:"muted",children:["@",f.agent]}),f.tags?.map(m=>n.jsxs("span",{children:["#",m]},m)),f.due&&n.jsxs("span",{children:[u("project.global_tasks.due")," ",f.due]})]})]})]},`${f.project_id}-${f.id}`))})})]})}const uE=x.createContext(void 0);function Y_(){const e=x.useContext(uE);if(e===void 0)throw new Error(gn(64));return e}const Cp={tabActivationDirection:e=>({"data-activation-direction":e})},OI=x.forwardRef(function(t,a){const{className:o,defaultValue:i=0,onValueChange:c,orientation:d="horizontal",render:f,value:m,style:g,...h}=t,b=t.defaultValue!==void 0,_=x.useRef([]),[j,E]=x.useState(()=>new Map),[y,k]=nl({controlled:m,default:i,name:"Tabs",state:"value"}),N=m!==void 0,[w,S]=x.useState(()=>new Map),R=x.useRef(void 0),A=x.useCallback(Y=>Yx(w,Y),[w]),[T,z]=x.useState(()=>({previousValue:y,tabActivationDirection:"none"})),{previousValue:M,tabActivationDirection:P}=T;let L=P,I=!1;M!==y&&(L=Wk(M,y,d,w),I=M!=null&&y!=null&&A(y)==null);const D=I?M:y,$=M!==D||P!==L;Pe(()=>{$&&z({previousValue:D,tabActivationDirection:L})},[D,$,L]);const q=He((Y,oe)=>{const ve=Wk(y,Y,d,w);oe.activationDirection=ve,c?.(Y,oe),!oe.isCanceled&&k(Y)}),G=He((Y,oe)=>{c?.(Y,rt(oe,void 0,void 0,{activationDirection:"none"}))}),U=He((Y,oe)=>(E(ve=>{const ie=new Map(ve);return ie.set(Y,oe),ie}),()=>{E(ve=>{if(ve.get(Y)!==oe)return ve;const ie=new Map(ve);return ie.delete(Y),ie})})),V=x.useCallback(Y=>j.get(Y),[j]),X=x.useCallback(Y=>{for(const oe of w.values())if(Y===oe.value)return oe.id},[w]),Q=x.useMemo(()=>({getTabElementBySelectedValue:A,getTabIdByPanelValue:X,getTabPanelIdByValue:V,onValueChange:q,orientation:d,registerMountedTabPanel:U,setTabMap:S,tabActivationDirection:L,value:y}),[A,X,V,q,d,U,S,L,y]),W=x.useMemo(()=>{for(const Y of w.values())if(Y.value===y)return Y},[w,y]),B=x.useMemo(()=>{for(const Y of w.values())if(!Y.disabled)return Y.value},[w]),K=x.useRef(!b),ee=x.useRef(i),F=x.useRef(b),ne=x.useRef(!1);Pe(()=>{if(N)return;function Y(xe,ke){k(xe),z({previousValue:xe,tabActivationDirection:"none"}),G(xe,ke),K.current=!1}if(w.size===0){ne.current&&y!==null&&!R.current?.isConnected&&Y(null,Cj);return}ne.current=!0,R.current=w.keys().next().value;const oe=W?.disabled,ve=W==null&&y!==null;if(!oe&&y===ee.current&&(F.current=!1),F.current&&oe&&y===ee.current)return;const ie=K.current;if(oe||ve){const xe=B??null;if(y===xe){K.current=!1;return}let ke=Cj;ie?ke=Nj:oe&&(ke=wS),Y(xe,ke);return}ie&&W!=null&&(G(y,Nj),K.current=!1)},[B,N,G,W,k,w,y]);const fe=Et("div",t,{state:{orientation:d,tabActivationDirection:L},ref:a,props:h,stateAttributesMapping:Cp});return n.jsx(uE.Provider,{value:Q,children:n.jsx(bp,{elementsRef:_,children:fe})})});function Yx(e,t){for(const[a,o]of e.entries())if(t===o.value)return a;return null}function Wk(e,t,a,o){if(e==null||t==null)return"none";const[i,c,d]=a==="horizontal"?["left","left","right"]:["top","up","down"],f=Yx(o,e),m=Yx(o,t);if(f==null||m==null)return f!==m&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?t>e?d:c:"none";const g=f.getBoundingClientRect()[i],h=m.getBoundingClientRect()[i];return h<g?c:h>g?d:"none"}const dE="data-composite-item-active",fE=x.createContext(void 0);function DI(){const e=x.useContext(fE);if(e===void 0)throw new Error(gn(65));return e}const PI=x.forwardRef(function(t,a){const{className:o,disabled:i=!1,render:c,value:d,id:f,nativeButton:m=!0,style:g,...h}=t,{value:b,getTabPanelIdByValue:_,onValueChange:j,orientation:E,tabActivationDirection:y}=Y_(),{activateOnFocus:k,registerTabResizeObserverElement:N,tabsListElement:w}=DI(),{highlightedIndex:S,onHighlightedIndexChange:R}=hp(),A=ra(f),T=x.useMemo(()=>({disabled:i,id:A,value:d}),[i,A,d]),{compositeProps:z,compositeRef:M,index:P}=tN({metadata:T}),L=d===b,I=x.useRef(!1),D=x.useRef(null),$=He(ne=>{D.current?.(),D.current=ne?N(ne):null});Pe(()=>{if(I.current){I.current=!1;return}if(!(L&&P>-1&&S!==P))return;const ne=w;if(ne!=null){const Z=Kn(vt(ne));if(Z&&Ze(ne,Z))return}i||R(P)},[L,P,S,R,i,w]);const{getButtonProps:q,buttonRef:G}=no({disabled:i,native:m,focusableWhenDisabled:!0}),U=_(d),V=x.useRef(!1),X=x.useRef(!1);function Q(ne){j(d,rt(ka,ne.nativeEvent,void 0,{activationDirection:"none"}))}function W(ne){L||i||Q(ne)}function B(ne){L||i||k&&(!V.current||X.current)&&Q(ne)}function K(ne){if(L||i)return;V.current=!0,X.current=ne.button===0;const Z=vt(ne.currentTarget);function fe(){V.current=!1,X.current=!1,Z.removeEventListener("pointerup",fe),Z.removeEventListener("pointercancel",fe)}Z.addEventListener("pointerup",fe),Z.addEventListener("pointercancel",fe)}return Et("button",t,{state:{disabled:i,active:L,orientation:E,tabActivationDirection:y},ref:[a,G,M,$],props:[z,{role:"tab","aria-controls":U,"aria-selected":L,id:A,onClick:W,onFocus:B,onPointerDown:K,[dE]:L?"":void 0,onKeyDownCapture(){I.current=!0}},h,q],stateAttributesMapping:Cp})}),LI={...Cp,...Vo},II=x.forwardRef(function(t,a){const{className:o,value:i,render:c,keepMounted:d=!1,style:f,...m}=t,{value:g,getTabIdByPanelValue:h,orientation:b,tabActivationDirection:_,registerMountedTabPanel:j}=Y_(),E=ra(),{ref:y,index:k}=ou(),N=i===g,{mounted:w,transitionStatus:S,setMounted:R}=hl(N),A=!w,T=h(i),z={hidden:A,orientation:b,tabActivationDirection:_,transitionStatus:S},M=x.useRef(null),P=Et("div",t,{state:z,ref:[a,y,M],props:[{"aria-labelledby":T,hidden:A,id:E,role:"tabpanel",tabIndex:N?0:-1,inert:gp(!N),"data-index":k},m],stateAttributesMapping:LI});return Ca({open:N,ref:M,onComplete(){N||R(!1)}}),Pe(()=>{if(!(E==null||A&&!d))return j(i,E)},[A,d,i,E,j]),d||w?P:null}),BI=[];function $I(e){const{loopFocus:t=!0,orientation:a="both",grid:o,onLoop:i,direction:c,highlightedIndex:d,onHighlightedIndexChange:f,rootRef:m,enableHomeAndEndKeys:g=!1,stopEventPropagation:h,disabledIndices:b,modifierKeys:_=BI}=e,[j,E]=x.useState(0),y=o!=null,k=x.useRef(null),N=rr(k,m),w=x.useRef([]),S=x.useRef(!1),R=d??j,A=He((L,I=!1)=>{if((f??E)(L),I){const D=w.current[L];fk(k.current,D,c,a)}}),T=He(L=>{if(L.size===0||S.current)return;S.current=!0;const I=Array.from(L.keys()),D=I.find(q=>q?.hasAttribute(dE))??null,$=D?L.get(D)?.index??-1:-1;if($!==-1)A($);else if(bf(I,R,b)){const q=Qa(I,{disabledIndices:b});Rc(I,q)||A(q)}fk(k.current,D,c,a)});Pe(()=>{if(b==null||d!=null||!S.current)return;const L=w.current;if(bf(L,R,b)){const I=Qa(L,{disabledIndices:b});Rc(L,I)||A(I)}},[b,d,R,w,A]);const z=He((L,I,D)=>i?i(L,I,D,w):D),M=He(L=>{const I=L.key===Rx||L.key===Tx;if(!xp.has(L.key)||!g&&I||UI(L,_)||!k.current)return;const $=c==="rtl",q=$?Nx:Ex,G=$?Ex:Nx,U=a==="vertical"?Cx:q,V=a==="vertical"?Sx:G,X=qn(L.nativeEvent);if(X!=null&&dk(X)&&!sN(X)){const F=X.selectionStart,ne=X.selectionEnd,Z=X.value;if(F==null||L.shiftKey||F!==ne||L.key!==V&&F<Z.length||L.key!==U&&F>0)return}let Q=R;const W=tf(w,b),B=vx(w,b);o!=null&&(Q=o({disabledIndices:b,elementsRef:w,event:L,highlightedIndex:R,loopFocus:t,maxIndex:B,minIndex:W,onLoop:z,orientation:a,rtl:$}));const K=a!=="vertical"&&L.key===q||a!=="horizontal"&&L.key===Cx,ee=a!=="vertical"&&L.key===G||a!=="horizontal"&&L.key===Sx;g&&(L.key===Rx?Q=W:L.key===Tx&&(Q=B)),Q===R&&(K||ee)&&(t&&Q===B&&K?(Q=W,i&&(Q=i(L,R,Q,w))):t&&Q===W&&ee?(Q=B,i&&(Q=i(L,R,Q,w))):Q=Qa(w.current,{startingIndex:Q,decrement:ee,disabledIndices:b})),Q!==R&&!Rc(w.current,Q)&&(h&&L.stopPropagation(),(y||I||K||ee)&&L.preventDefault(),A(Q,!0),queueMicrotask(()=>{w.current[Q]?.focus()}))});return{props:{ref:N,onFocus(L){const I=k.current,D=qn(L.nativeEvent);!I||D==null||!dk(D)||D.setSelectionRange(0,D.value.length)},onKeyDown:M},highlightedIndex:R,onHighlightedIndexChange:A,elementsRef:w,onMapChange:T,relayKeyboardEvent:M}}function UI(e,t){for(const a of L6)if(!t.includes(a)&&e.getModifierState(a))return!0;return!1}function qI(e){const{render:t,className:a,style:o,refs:i=ja,props:c=ja,state:d=sn,stateAttributesMapping:f,highlightedIndex:m,onHighlightedIndexChange:g,orientation:h,grid:b,loopFocus:_,onLoop:j,enableHomeAndEndKeys:E,onMapChange:y,stopEventPropagation:k=!0,rootRef:N,disabledIndices:w,modifierKeys:S,highlightItemOnHover:R=!1,tag:A="div",...T}=e,z=pp(),{props:M,highlightedIndex:P,onHighlightedIndexChange:L,elementsRef:I,onMapChange:D,relayKeyboardEvent:$}=$I({grid:b,loopFocus:_,onLoop:j,orientation:h,highlightedIndex:m,onHighlightedIndexChange:g,rootRef:N,stopEventPropagation:k,enableHomeAndEndKeys:E,direction:z,disabledIndices:w,modifierKeys:S}),q=Et(A,e,{state:d,ref:i,props:[M,...c,T],stateAttributesMapping:f}),G=x.useMemo(()=>({highlightedIndex:P,onHighlightedIndexChange:L,highlightItemOnHover:R,relayKeyboardEvent:$}),[P,L,R,$]);return n.jsx($C.Provider,{value:G,children:n.jsx(bp,{elementsRef:I,onMapChange:U=>{y?.(U),D(U)},children:q})})}const HI=x.forwardRef(function(t,a){const{activateOnFocus:o=!1,className:i,loopFocus:c=!0,render:d,style:f,...m}=t,{orientation:g,setTabMap:h,tabActivationDirection:b}=Y_(),[_,j]=x.useState(0),[E,y]=x.useState(null),k=x.useRef(new Set),N=x.useRef(new Set),w=x.useRef(null);Pe(()=>{if(typeof ResizeObserver>"u")return;const M=new ResizeObserver(()=>{k.current.forEach(P=>{P()})});return w.current=M,E&&M.observe(E),N.current.forEach(P=>{M.observe(P)}),()=>{M.disconnect(),w.current=null}},[E]);const S=He(M=>(k.current.add(M),()=>{k.current.delete(M)})),R=He(M=>(N.current.add(M),w.current?.observe(M),()=>{N.current.delete(M),w.current?.unobserve(M)})),A={orientation:g,tabActivationDirection:b},T={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},z=x.useMemo(()=>({activateOnFocus:o,registerIndicatorUpdateListener:S,registerTabResizeObserverElement:R,tabsListElement:E}),[o,S,R,E]);return n.jsx(fE.Provider,{value:z,children:n.jsx(qI,{render:d,className:i,style:f,state:A,refs:[a,y],props:[T,m],stateAttributesMapping:Cp,highlightedIndex:_,enableHomeAndEndKeys:!0,loopFocus:c,orientation:g,onHighlightedIndexChange:j,onMapChange:h,disabledIndices:ja})})});function Np({className:e,...t}){return n.jsx(OI,{"data-slot":"tabs",className:St("flex flex-col gap-4",e),...t})}const VI=A_("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 Ep({className:e,variant:t="default",...a}){return n.jsx(HI,{"data-slot":"tabs-list","data-variant":t,className:St(VI({variant:t}),e),...a})}function qs({className:e,...t}){return n.jsx(PI,{"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 fs({className:e,...t}){return n.jsx(II,{"data-slot":"tabs-content",className:St("text-sm outline-none",e),...t})}function Zk(e,t){let a=e;for(const o of t.split(".")){if(!a||typeof a!="object"||Array.isArray(a))return;a=a[o]}return a}function K_(e,t=""){const a={};for(const[o,i]of Object.entries(e)){const c=t?`${t}.${o}`:o;i&&typeof i=="object"&&!Array.isArray(i)?Object.assign(a,K_(i,c)):a[c]=i}return a}function pE(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("JSON debe ser objeto.");return t}function lf({sections:e,source:t,placeholderSource:a,jsonTitle:o,jsonDescription:i,saveLabel:c=u("common.save"),onSaveFields:d,onSaveJson:f,busy:m,hideJson:g=!1}){const h=e[0]?.key||"json",[b,_]=x.useState({}),[j,E]=x.useState(""),[y,k]=x.useState("");x.useEffect(()=>{const A={};for(const T of e.flatMap(z=>z.fields))A[T.path]=Zk(t,T.path)??"";_(A),E(JSON.stringify(t||{},null,2)),k("")},[t,e]);const N=x.useMemo(()=>new Set(e.flatMap(A=>A.fields.map(T=>T.path))),[e]),w=async()=>{const A={},T=[];for(const z of e.flatMap(M=>M.fields)){const M=b[z.path];if(!ps(M)){if(M===""||M===void 0||M===null){T.push(z.path);continue}if(z.kind==="number"){const P=Number(M);Number.isFinite(P)&&(A[z.path]=P)}else A[z.path]=M}}await d(A,T.filter(z=>N.has(z)))},S=async()=>{k("");try{await f(pE(j))}catch(A){k(A.message)}},R=A=>n.jsxs("div",{className:"space-y-4",children:[A.description&&n.jsx("p",{className:"text-sm text-muted-fg",children:A.description}),n.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:A.fields.map(T=>n.jsx(FI,{field:T,value:b[T.path],inherited:Zk(a,T.path),onChange:z=>_(M=>({...M,[T.path]:z}))},T.path))}),n.jsx(re,{variant:"primary",loading:m,onClick:w,children:c})]});return g&&e.length<=1?e[0]?R(e[0]):null:n.jsxs(Np,{defaultValue:h,className:"space-y-4",children:[n.jsxs(Ep,{className:"flex flex-wrap",children:[e.map(A=>n.jsx(qs,{value:A.key,children:A.label},A.key)),!g&&n.jsx(qs,{value:"json",children:"JSON"})]}),e.map(A=>n.jsx(fs,{value:A.key,children:R(A)},A.key)),!g&&n.jsx(fs,{value:"json",children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:o}),i&&n.jsx("p",{className:"text-xs text-muted-fg",children:i})]}),n.jsx(un,{rows:18,className:"font-mono text-xs",value:j,onChange:A=>E(A.target.value)}),y&&n.jsx("p",{className:"text-xs text-destructive",children:y}),n.jsx(re,{variant:"primary",loading:m,onClick:S,children:u("settings_ui.save_json")})]})})]})}function FI({field:e,value:t,inherited:a,onChange:o}){const i=e.placeholder||Jk(a)||(ps(t)?Fr(t):""),c=e.hint||(a!==void 0?`Heredado: ${Jk(a)}`:void 0);return e.kind==="boolean"?n.jsx("div",{className:"flex items-end pb-1",children:n.jsx(Bt,{checked:t===!0,onChange:o,label:e.label})}):n.jsx(le,{label:e.label,hint:c,children:e.kind==="select"?n.jsx(ct,{value:String(t||""),onChange:o,placeholder:i||"(sin override)",options:[{value:"",label:i||"(sin override)"},...(e.options||[]).map(d=>({value:String(d.value),label:d.label}))]}):e.kind==="textarea"?n.jsx(un,{rows:4,value:String(t||""),placeholder:i,onChange:d=>o(d.target.value)}):n.jsx(Ee,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(ps(t)?"":t||""),placeholder:e.kind==="password"&&ps(t)?Fr(t):e.kind==="password"&&ps(a)?Fr(a):i,onChange:d=>o(d.target.value)})})}function Jk(e){return e==null||e===""?"":ps(e)?Fr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function GI(){return[{key:"routing",label:u("settings_ui.cfg_overrides_label"),description:u("settings_ui.cfg_overrides_desc"),fields:[{path:"route_to_agent",label:u("settings_ui.cfg_route_to_agent"),placeholder:"master"},{path:"super_agent.model",label:u("settings_ui.cfg_super_agent_model")},{path:"super_agent.permission_mode",label:u("settings_ui.cfg_permission_mode"),kind:"select",options:Cb.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:u("settings_ui.cfg_extra_prompt"),kind:"textarea"}]}]}function YI(){return[{key:"engines",label:u("settings_ui.cfg_engines_label"),fields:[{path:"engines.ollama.base_url",label:u("settings_ui.cfg_ollama_url")},{path:"engines.anthropic.api_key",label:u("settings_ui.cfg_anthropic_key"),kind:"password"},{path:"engines.openai.api_key",label:u("settings_ui.cfg_openai_key"),kind:"password"},{path:"engines.groq.api_key",label:u("settings_ui.cfg_groq_key"),kind:"password"},{path:"engines.openrouter.api_key",label:u("settings_ui.cfg_openrouter_key"),kind:"password"},{path:"engines.gemini.api_key",label:u("settings_ui.cfg_gemini_key"),kind:"password"}]}]}function KI(){return[{key:"identity",label:u("settings_ui.cfg_project_label"),description:u("settings_ui.cfg_project_desc"),fields:[{path:"name",label:u("settings_ui.cfg_name")},{path:"version",label:u("settings_ui.cfg_version")},{path:"apf",label:u("settings_ui.cfg_apc_spec")},{path:"apx",label:u("settings_ui.cfg_apx_install")},{path:"apx_id",label:u("settings_ui.cfg_apx_storage_id")}]}]}function mE({pid:e}){const t=Je(),{project:a}=uu(e),{channels:o,isLoading:i,mutate:c}=D_(),d=String(e),f=a?.name||a?.path?.split("/").pop()||d,m=`proj-${d}`,g=o.find(z=>z.project===d||z.project===f||z.name===m),[h,b]=x.useState(!!g),[_,j]=x.useState(""),[E,y]=x.useState(""),[k,N]=x.useState(""),[w,S]=x.useState(!0),[R,A]=x.useState(!1);if(x.useEffect(()=>{g?(b(!0),j(""),y(g.chat_id||""),N(g.route_to_agent||""),S(g.respond_with_engine??!0)):(b(!1),j(""),y(""),N(""),S(!0))},[g?.name,g?.chat_id,g?.route_to_agent]),i)return n.jsx(tt,{});const T=async()=>{A(!0);try{if(!h){g&&(await Pn.channels.remove(g.name),t.success(u("project.telegram.cleared"))),await c();return}const z={name:g?.name||m,project:d,chat_id:E,route_to_agent:k,respond_with_engine:w,..._?{bot_token:_}:{}};g?await Pn.channels.patch(g.name,z):await Pn.channels.upsert(z),t.success(u("project.telegram.saved")),await c(),j("")}catch(z){t.error(z.message)}finally{A(!1)}};return n.jsx(Ve,{title:u("project.telegram.title"),description:u("project.telegram.subtitle"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Bt,{checked:h,onChange:b,label:u(h?"project.telegram.override_active":"project.telegram.use_default")}),g&&n.jsx($e,{tone:"success",children:u("project.telegram.channel_badge",{name:g.name})})]}),h&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("project.telegram.bot_token"),hint:g?.bot_token?`${Fr(g.bot_token)} ${u("telegram_ui.empty_keep")}`:u("project.telegram.bot_hint_none"),children:n.jsx(Ee,{type:"password",value:_,onChange:z=>j(z.target.value),placeholder:g?.bot_token?Fr(g.bot_token):""})}),n.jsx(le,{label:u("project.telegram.chat_id"),children:n.jsx(Ee,{value:E,onChange:z=>y(z.target.value)})}),n.jsx(le,{label:u("project.telegram.route_agent"),hint:u("project.telegram.route_hint"),children:n.jsx(Ee,{value:k,onChange:z=>N(z.target.value)})})]}),n.jsx(Bt,{checked:w,onChange:S,label:u("project.telegram.respond_engine")})]}),n.jsx("div",{className:"pt-2",children:n.jsx(re,{variant:"primary",loading:R,onClick:T,children:u("common.save")})}),!h&&!g&&n.jsx(ut,{children:u("project.telegram.no_override")})]})})}function XI({pid:e}){const t=Je(),a=Tn(),{project:o,mutate:i}=uu(e),c=Be(`/api/projects/${e}/config`,()=>Zn.config.show(e)),d=String(e)==="0";if(c.isLoading)return n.jsx(tt,{});if(!c.data)return n.jsx(ut,{children:u("project.config.no_data")});const f=async h=>{await Zn.apcProject.put(e,h),t.success(u("project.config.save_project")),c.mutate()},m=async h=>{await Zn.config.put(e,h),t.success(u("project.config.save_override")),c.mutate()},g=async(h,b)=>{await Zn.config.set(e,h),b.length&&await Zn.config.unset(e,b),t.success(u("project.config.save_fields_success")),c.mutate()};return n.jsxs("div",{className:"space-y-6",children:[n.jsx(Ve,{title:u("project.config.section_title"),description:u("project.config.section_desc"),children:n.jsxs(Np,{defaultValue:"settings",className:"space-y-4",children:[n.jsxs(Ep,{className:"flex flex-wrap",children:[n.jsx(qs,{value:"settings",children:u("project.config.tab_settings")}),n.jsx(qs,{value:"engines",children:u("settings_ui.cfg_engines_label")}),!d&&n.jsx(qs,{value:"telegram",children:u("project.nav.telegram")}),n.jsx(qs,{value:"project",children:u("project.config.tab_project")}),n.jsx(qs,{value:"json",children:"JSON"})]}),n.jsx(fs,{value:"settings",children:n.jsx(lf,{sections:GI(),source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,onSaveFields:g,onSaveJson:m,hideJson:!0})}),n.jsx(fs,{value:"engines",children:n.jsx(lf,{sections:YI(),source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,onSaveFields:g,onSaveJson:m,hideJson:!0})}),!d&&n.jsx(fs,{value:"telegram",children:n.jsx(mE,{pid:e})}),n.jsx(fs,{value:"project",children:n.jsx(lf,{sections:KI(),source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,onSaveFields:async(h,b)=>{await Zn.apcProject.set(e,WI(h),b),t.success(u("project.config.save_meta_success")),c.mutate()},onSaveJson:f,hideJson:!0})}),n.jsx(fs,{value:"json",children:n.jsxs("div",{className:"space-y-6",children:[n.jsx(ew,{title:c.data.project_config_path,description:".apc/config.json — overrides del proyecto.",source:c.data.project_only,onSave:m}),n.jsx(ew,{title:c.data.project_json_path,description:".apc/project.json — metadata APC portable.",source:c.data.apc_project||{},onSave:f}),n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{className:"text-xs text-muted-fg",children:u("project.config.effective_read")}),n.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)})]})]})})]})}),!d&&o?n.jsx(QI,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{i(),a("/")}}):null]})}function QI({pid:e,label:t,onRebuilt:a,onUnregistered:o}){const i=Je(),[c,d]=x.useState(null),[f,m]=x.useState(null),g=async()=>{d("rebuild");try{await Zn.rebuild(e),i.success(u("project.rebuild_done")),a()}catch(b){i.error(b.message)}finally{d(null),m(null)}},h=async()=>{d("unregister");try{await Zn.remove(e),i.success(u("project.unregistered")),o()}catch(b){i.error(b.message)}finally{d(null),m(null)}};return n.jsxs(n.Fragment,{children:[n.jsx(Ve,{title:u("project.danger.title"),description:u("project.danger.subtitle"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium",children:u("project.rebuild")}),n.jsx("div",{className:"text-xs text-muted-fg",children:u("project.danger.rebuild_desc")})]}),n.jsxs(re,{size:"sm",variant:"secondary",onClick:()=>m("rebuild"),children:[n.jsx(Cs,{size:13})," ",u("project.rebuild")]})]}),n.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:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium",children:u("admin.unregister")}),n.jsx("div",{className:"text-xs text-muted-fg",children:u("project.danger.unregister_desc")})]}),n.jsxs(re,{size:"sm",variant:"destructive",onClick:()=>m("unregister"),children:[n.jsx(_n,{size:13})," ",u("admin.unregister")]})]})]})}),n.jsx(Xt,{open:f==="rebuild",onClose:()=>c?null:m(null),title:u("project.danger.rebuild_confirm_title"),description:u("project.danger.rebuild_confirm_desc",{label:t}),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:g,loading:c==="rebuild",children:u("project.rebuild")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.danger.rebuild_long")})}),n.jsx(Xt,{open:f==="unregister",onClose:()=>c?null:m(null),title:u("project.danger.unregister_confirm_title"),description:u("project.unregister_confirm",{label:t}),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:u("common.cancel")}),n.jsx(re,{variant:"destructive",onClick:h,loading:c==="unregister",children:u("admin.unregister")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.danger.unregister_long")})})]})}function ew({title:e,description:t,source:a,onSave:o}){const[i,c]=x.useState(""),[d,f]=x.useState(""),[m,g]=x.useState(!1);x.useEffect(()=>{c(JSON.stringify(a||{},null,2)),f("")},[a]);const h=async()=>{f(""),g(!0);try{await o(pE(i))}catch(b){f(b.message)}finally{g(!1)}};return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{children:[n.jsx("h3",{className:"text-sm font-medium",children:e}),t&&n.jsx("p",{className:"text-xs text-muted-fg",children:t})]}),n.jsx(un,{rows:14,className:"font-mono text-xs",value:i,onChange:b=>c(b.target.value)}),d&&n.jsx("p",{className:"text-xs text-destructive",children:d}),n.jsx(re,{variant:"primary",loading:m,onClick:h,children:u("settings_ui.save_json")})]})}function WI(e){const t={};for(const[a,o]of Object.entries(K_(e)))ps(o)||(t[a]=o);return t}function Ki(e){return String(e||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function gE({open:e,onClose:t,pid:a,editing:o,onSaved:i}){const c=Je(),[d,f]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(!1);x.useEffect(()=>{e&&(f(o?.name??""),g(o?.slug??""),b(o?.goal??""))},[e,o]);const E=async()=>{if(d.trim()){j(!0);try{o?await Vr.updateArea(a,o.slug,{name:d,goal:h}):await Vr.createArea(a,{name:d,slug:m||Ki(d),goal:h}),c.success(u("common.saved")),i(),t()}catch(y){c.error(y instanceof Error?y.message:String(y))}finally{j(!1)}}};return n.jsx(Xt,{open:e,onClose:t,title:u(o?"structure.edit_area":"structure.new_area"),footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,children:u("common.cancel")}),n.jsx(re,{variant:"primary","data-testid":"area-create",onClick:()=>void E(),loading:_,disabled:!d.trim(),children:u(o?"common.save":"structure.create_area")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("structure.name"),children:n.jsx(Ee,{autoFocus:!0,"data-testid":"area-name",value:d,onChange:y=>{f(y.target.value),o||g(Ki(y.target.value))},placeholder:"Engineering"})}),!o&&n.jsx(le,{label:u("structure.slug"),children:n.jsx(Ee,{value:m,onChange:y=>g(Ki(y.target.value)),className:"font-mono",placeholder:"engineering"})}),n.jsx(le,{label:u("structure.goal"),hint:u("structure.goal_hint"),children:n.jsx(un,{value:h,onChange:y=>b(y.target.value),rows:2})})]})})}function hE({open:e,onClose:t,pid:a,areas:o,editing:i,presetArea:c,onSaved:d}){const f=Je(),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(""),[E,y]=x.useState(""),[k,N]=x.useState(!1);x.useEffect(()=>{e&&(g(i?.name??""),b(i?.slug??""),j(i?.area??c??""),y(i?.description??""))},[e,i,c]);const w=async()=>{if(m.trim()){N(!0);try{i?await Vr.updateRole(a,i.slug,{name:m,area:_||null,description:E}):await Vr.createRole(a,{name:m,slug:h||Ki(m),area:_||null,description:E}),f.success(u("common.saved")),d(),t()}catch(R){f.error(R instanceof Error?R.message:String(R))}finally{N(!1)}}},S=[{value:"",label:u("structure.no_area")},...o.map(R=>({value:R.slug,label:R.name}))];return n.jsx(Xt,{open:e,onClose:t,title:u(i?"structure.edit_role":"structure.new_role"),footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:()=>void w(),loading:k,disabled:!m.trim(),children:u(i?"common.save":"structure.create_role")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("structure.name"),children:n.jsx(Ee,{autoFocus:!0,value:m,onChange:R=>{g(R.target.value),i||b(Ki(R.target.value))},placeholder:"Tech Lead"})}),!i&&n.jsx(le,{label:u("structure.slug"),children:n.jsx(Ee,{value:h,onChange:R=>b(Ki(R.target.value)),className:"font-mono",placeholder:"tech-lead"})}),n.jsx(le,{label:u("structure.area"),children:n.jsx(ct,{value:_,onChange:j,options:S,placeholder:u("structure.no_area")})}),n.jsx(le,{label:u("structure.description"),children:n.jsx(un,{value:E,onChange:R=>y(R.target.value),rows:2})})]})})}function xE({value:e,onChange:t}){return n.jsx(Ee,{value:e,onChange:a=>t([...a.target.value].slice(-2).join("")),className:"text-center text-lg",placeholder:"🤖","aria-label":u("agents_form.emoji")})}const ZI=[{value:"total",labelKey:"auto_total"},{value:"automatico",labelKey:"auto_automatico"},{value:"permiso",labelKey:"auto_permiso"}];function bE({value:e,onChange:t}){return n.jsx("div",{className:"inline-flex w-full rounded-lg border border-border p-0.5",children:ZI.map(a=>n.jsx("button",{type:"button",onClick:()=>t(a.value),className:ge("flex-1 rounded-md px-2 py-1 text-[12px] font-medium capitalize transition-colors",e===a.value?"bg-primary/15 text-foreground":"text-muted-foreground hover:text-foreground"),children:u(`agents_form.${a.labelKey}`)},a.value))})}function _E({pid:e,area:t,role:a,onArea:o,onRole:i}){const c=Be(`/api/projects/${e}/organization`,()=>Vr.get(e)),[d,f]=x.useState(!1),[m,g]=x.useState(!1),h=c.data?.areas??[],_=(c.data?.roles??[]).filter(y=>t?y.area===t||y.area===null:!0),j=[{value:"",label:u("structure.no_area")},...h.map(y=>({value:y.slug,label:y.name}))],E=[{value:"",label:u("agents_form.no_role")},..._.map(y=>({value:y.slug,label:y.name}))];return n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("agents_form.area"),children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(ct,{value:t,onChange:y=>{o(y)},options:j,placeholder:u("structure.no_area"),className:"flex-1"}),n.jsx(tw,{label:u("structure.new_area"),onClick:()=>f(!0)})]})}),n.jsx(le,{label:u("agents_form.role"),children:n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx(ct,{value:a,onChange:i,options:E,placeholder:u("agents_form.no_role"),className:"flex-1"}),n.jsx(tw,{label:u("structure.new_role"),onClick:()=>g(!0)})]})})]}),n.jsx(gE,{open:d,onClose:()=>f(!1),pid:e,onSaved:()=>void c.mutate()}),n.jsx(hE,{open:m,onClose:()=>g(!1),pid:e,areas:h,presetArea:t||null,onSaved:()=>void c.mutate()})]})}function tw({label:e,onClick:t}){return n.jsx("button",{type:"button",onClick:t,title:e,"aria-label":e,className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(Dt,{className:"size-4"})})}function vE({open:e,onClose:t,onConfirm:a,title:o,description:i,confirmLabel:c,destructive:d=!0}){const[f,m]=x.useState(!1),g=async()=>{m(!0);try{await a(),t()}finally{m(!1)}};return n.jsx(Xt,{open:e,onClose:t,title:o,footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:f,children:u("common.cancel")}),n.jsx(re,{variant:d?"destructive":"primary",onClick:()=>void g(),loading:f,children:c??u("common.confirm")})]}),children:n.jsx("p",{className:"text-sm text-muted-foreground",children:i})})}function Hd(e,t){const a=[],o=/(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]+)\]\(([^)]+)\))/g;let i=0,c,d=0;for(;c=o.exec(e);)c.index>i&&a.push(n.jsx(x.Fragment,{children:e.slice(i,c.index)},`${t}-t${d}`)),c[2]!==void 0?a.push(n.jsx("strong",{children:c[2]},`${t}-b${d}`)):c[4]!==void 0?a.push(n.jsx("em",{children:c[4]},`${t}-i${d}`)):c[6]!==void 0?a.push(n.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]",children:c[6]},`${t}-c${d}`)):c[8]!==void 0&&a.push(n.jsx("a",{href:c[9],target:"_blank",rel:"noreferrer",className:"text-sky-500 underline underline-offset-2 hover:text-sky-400",children:c[8]},`${t}-l${d}`)),i=o.lastIndex,d+=1;return i<e.length&&a.push(n.jsx(x.Fragment,{children:e.slice(i)},`${t}-tend`)),a}function yE({content:e,className:t}){const a=e.replace(/\r\n/g,`
789
- `).split(`
790
- `),o=[];let i=0,c=0;const d=(f,m)=>{const g=m?"ol":"ul";o.push(n.jsx(g,{className:ge("my-2 space-y-1 pl-5",m?"list-decimal":"list-disc"),children:f.map((h,b)=>n.jsx("li",{children:Hd(h,`li${c}-${b}`)},b))},`k${c++}`))};for(;i<a.length;){const f=a[i];if(/^```/.test(f.trim())){const h=[];for(i+=1;i<a.length&&!/^```/.test(a[i].trim());)h.push(a[i++]);i+=1,o.push(n.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg bg-muted/60 p-3 font-mono text-[12px] leading-[1.6]",children:n.jsx("code",{children:h.join(`
791
- `)})},`k${c++}`));continue}if(f.trim()===""){i+=1;continue}const m=f.match(/^(#{1,6})\s+(.*)$/);if(m){const h=m[1].length,b=["text-2xl","text-xl","text-lg","text-base","text-sm","text-sm"];o.push(n.jsx("div",{className:ge("mt-3 mb-1 font-semibold text-foreground",b[h-1]),children:Hd(m[2],`h${c}`)},`k${c++}`)),i+=1;continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(f.trim())){o.push(n.jsx("hr",{className:"my-3 border-border"},`k${c++}`)),i+=1;continue}if(/^>\s?/.test(f)){const h=[];for(;i<a.length&&/^>\s?/.test(a[i]);)h.push(a[i++].replace(/^>\s?/,""));o.push(n.jsx("blockquote",{className:"my-2 border-l-2 border-border pl-3 text-muted-foreground",children:Hd(h.join(" "),`q${c}`)},`k${c++}`));continue}if(/^\s*[-*+]\s+/.test(f)){const h=[];for(;i<a.length&&/^\s*[-*+]\s+/.test(a[i]);)h.push(a[i++].replace(/^\s*[-*+]\s+/,""));d(h,!1);continue}if(/^\s*\d+\.\s+/.test(f)){const h=[];for(;i<a.length&&/^\s*\d+\.\s+/.test(a[i]);)h.push(a[i++].replace(/^\s*\d+\.\s+/,""));d(h,!0);continue}const g=[];for(;i<a.length&&a[i].trim()!==""&&!/^(#{1,6})\s/.test(a[i])&&!/^```/.test(a[i].trim())&&!/^>\s?/.test(a[i])&&!/^\s*[-*+]\s+/.test(a[i])&&!/^\s*\d+\.\s+/.test(a[i]);)g.push(a[i++]);o.push(n.jsx("p",{className:"my-2 leading-relaxed",children:Hd(g.join(" "),`p${c}`)},`k${c++}`))}return n.jsx("div",{className:ge("text-sm text-foreground/90",t),children:o})}function JI({value:e,onChange:t,showPreview:a=!1,placeholder:o,onSave:i,className:c}){return n.jsxs("div",{className:ge("flex min-h-0 flex-1",c),children:[n.jsx("textarea",{value:e,onChange:d=>t(d.target.value),onKeyDown:d=>{i&&(d.metaKey||d.ctrlKey)&&d.key==="s"&&(d.preventDefault(),i())},placeholder:o,spellCheck:!1,className:ge("min-h-0 resize-none bg-transparent p-4 font-mono text-[13px] leading-[1.7] text-foreground/90 outline-none",a?"w-1/2 border-r border-border":"w-full")}),a&&n.jsx("div",{className:"min-h-0 w-1/2 overflow-y-auto p-4",children:n.jsx(yE,{content:e})})]})}function Vd({onClick:e,active:t,disabled:a,children:o}){return n.jsx("button",{type:"button",onClick:e,disabled:a,className:ge("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium transition-colors disabled:opacity-40",t?"bg-primary/15 text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:o})}function e7({content:e}){return n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:n.jsx("tbody",{children:e.split(`
792
- `).map((t,a)=>n.jsxs("tr",{className:"hover:bg-accent/20",children:[n.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:a+1}),n.jsx("td",{className:"whitespace-pre px-4 align-top text-foreground/90",children:t||" "})]},a))})})})}function X_({file:e,loading:t,onSave:a}){const o=typeof a=="function",[i,c]=x.useState(""),[d,f]=x.useState(!1),[m,g]=x.useState(!0),[h,b]=x.useState(!1);if(x.useEffect(()=>{c(e?.content??""),f(!1),g(!0)},[e?.path,e?.content]),t)return n.jsx("div",{className:"flex flex-1 items-center justify-center",children:n.jsx(bn,{size:16})});if(!e)return n.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:u("files.select_prompt")});const _=e.kind==="markdown",j=e.kind==="text"||e.kind==="markdown",E=d&&i!==(e.content??""),y=async()=>{if(!(!a||!E)){b(!0);try{await a(i),f(!1)}finally{b(!1)}}};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"file-viewer",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[n.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e.path,E&&n.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),_&&d&&n.jsxs(Vd,{onClick:()=>g(k=>!k),active:m,children:[n.jsx(OA,{className:"size-3"}),u("files.preview")]}),o&&j&&(d?n.jsxs(n.Fragment,{children:[n.jsxs(Vd,{onClick:()=>{c(e.content??""),f(!1)},disabled:h,children:[n.jsx(fl,{className:"size-3"}),u("files.discard")]}),n.jsxs(Vd,{onClick:()=>void y(),disabled:!E||h,active:E,children:[h?n.jsx(bn,{size:10}):n.jsx(Kf,{className:"size-3"}),u("files.save")]})]}):n.jsxs(Vd,{onClick:()=>f(!0),children:[n.jsx(wa,{className:"size-3"}),u("files.edit")]}))]}),_?d?n.jsx(JI,{value:i,onChange:c,showPreview:m,onSave:()=>void y()}):n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:n.jsx(yE,{content:e.content??""})}):e.kind==="text"?d?n.jsx("textarea",{value:i,onChange:k=>c(k.target.value),onKeyDown:k=>{(k.metaKey||k.ctrlKey)&&k.key==="s"&&(k.preventDefault(),y())},spellCheck:!1,className:"min-h-0 flex-1 resize-none bg-transparent p-4 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none"}):n.jsx(e7,{content:e.content??""}):e.kind==="image"&&e.encoding==="base64"?n.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-auto p-4",children:n.jsx("img",{src:`data:${e.mime};base64,${e.content}`,alt:e.name,className:"max-h-full max-w-full rounded object-contain"})}):n.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-sm text-muted-foreground",children:[n.jsx(qA,{className:"size-8 opacity-50"}),n.jsx("span",{children:e.too_large?u("files.too_large"):u("files.no_preview")}),n.jsxs("span",{className:"flex items-center gap-1 text-xs opacity-70",children:[n.jsx(IA,{className:"size-3"}),(e.size/1024).toFixed(1)," KB"]})]})]})}function t7(){return[{key:"overview",label:u("agents_ui.tab_explorer"),icon:Gf},{key:"memories",label:u("project.nav.memories"),icon:Dc},{key:"records",label:u("project.agent_detail.records_title"),icon:Hf},{key:"sleep",label:u("project.agent_detail.sleep_title"),icon:zo},{key:"brain",label:u("project.agent_detail.brain_title"),icon:sa},{key:"config",label:u("settings.tabs.advanced"),icon:Xf}]}function jE(){return[{value:"",label:u("agents_ui.type_none")},{value:"orchestrator",label:u("agents_ui.type_orchestrator"),description:u("agents_ui.type_orchestrator_desc")},{value:"specialist",label:u("agents_ui.type_specialist"),description:u("agents_ui.type_specialist_desc")},{value:"assistant",label:u("agents_ui.type_assistant"),description:u("agents_ui.type_assistant_desc")},{value:"worker",label:u("agents_ui.type_worker"),description:u("agents_ui.type_worker_desc")},{value:"monitor",label:u("agents_ui.type_monitor"),description:u("agents_ui.type_monitor_desc")}]}const Kx=e=>e.split(",").map(t=>t.trim()).filter(Boolean),n7=(e,t)=>e.filter(a=>a.spec?.agent===t||t==="super-agent"&&a.kind==="super_agent");function s7(e){return e.split(`
793
- `).map(t=>t.replace(/^[-*#>\s]+/,"").trim()).filter(t=>t.length>2&&!t.startsWith("```")).slice(0,12)}function a7({pid:e}){const{slug:t=""}=P2(),a=Tn(),[o,i]=x.useState("overview"),c=t7(),d=Be(`/api/projects/${e}/agents/${t}`,()=>an.get(e,t)),f=Be(`/api/projects/${e}/agents`,()=>an.list(e)),m=Be(`/api/projects/${e}/routines`,()=>Br.list(e)),g=Be(`/api/projects/${e}/messages?agent=${t}`,()=>Nf.project(e,{agent:t,limit:200})),h=Be(`/api/projects/${e}/agents/${t}/conversations`,()=>Wr.list(e,t)),b=Be(`/api/projects/${e}/tasks?all`,()=>Qn.list(e,"all")),_=d.data,j=n7(m.data||[],t),E=(b.data||[]).filter(N=>N.agent===t),y=(f.data||[]).filter(N=>N.parent===t);if(d.isLoading)return n.jsx(tt,{});if(!_)return n.jsx("div",{className:"text-sm text-muted-fg",children:u("project.agent_detail.not_found")});const k=_.is_master?va:rn;return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsx("button",{onClick:()=>a(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:n.jsx(bA,{size:16})}),n.jsx("div",{className:ge("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:n.jsx(k,{className:"size-5 text-white"})}),n.jsxs("div",{children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("h1",{className:"text-lg font-semibold",children:_.slug}),_.is_master&&n.jsxs($e,{tone:"success",children:[n.jsx(va,{size:10})," ",u("project.agents.orchestrator")]}),_.role&&n.jsx($e,{children:_.role}),_.model&&n.jsx($e,{tone:"info",children:_.model}),_.parent&&n.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${_.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[u("project.agent_detail.reports_to")," ",_.parent]})]}),_.description&&n.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:_.description})]})]}),n.jsxs(re,{size:"sm",variant:"primary",onClick:()=>a(`/p/${e}/chat?agent=${t}`),children:[n.jsx(Sa,{size:13})," ",u("project.agent_detail.chat_btn",{slug:_.slug})]})]}),n.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:N,label:w,icon:S})=>n.jsxs("button",{onClick:()=>i(N),className:ge("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",o===N?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[n.jsx(S,{size:14})," ",w]},N))}),o==="overview"&&n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[n.jsx(Fd,{label:u("agents_ui.stat_threads"),value:h.data?.length??0,icon:Jc}),n.jsx(Fd,{label:u("agents_ui.stat_records"),value:g.data?.length??0,icon:Hf}),n.jsx(Fd,{label:u("agents_ui.stat_tasks"),value:E.length,icon:Gf}),n.jsx(Fd,{label:u("agents_ui.stat_heartbeats"),value:j.length,icon:zo})]}),n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsx(Ve,{title:u("agent_detail_extra.skills_title"),description:"",children:n.jsxs("div",{className:"flex flex-wrap gap-1",children:[_.skills?.map(N=>n.jsxs($e,{tone:"info",children:[n.jsx(sa,{size:10})," ",N]},N)),_.tools?.map(N=>n.jsxs($e,{children:[n.jsx(aa,{size:10})," ",N]},N)),!_.skills?.length&&!_.tools?.length&&n.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),n.jsx(Ve,{title:u("project.agent_detail.threads_recent"),description:"",children:n.jsxs("ul",{className:"space-y-1 text-xs",children:[(h.data||[]).slice(0,6).map(N=>n.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[n.jsx("span",{className:"truncate",children:N.title||N.filename}),n.jsxs("span",{className:"shrink-0 text-muted-fg",children:[N.messages??0," ",u("project.agent_detail.msgs_count")]})]},N.id)),!h.data?.length&&n.jsx("li",{className:"text-muted-fg",children:u("project.agent_detail.no_threads")})]})})]}),y.length>0&&n.jsx(Ve,{title:u("project.agent_detail.subagents"),description:u("project.agent_detail.subagents_desc"),children:n.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(N=>n.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${N.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:[n.jsx(rn,{size:14,className:"text-muted-fg"})," ",N.slug]},N.slug))})})]}),o==="memories"&&n.jsx(o7,{pid:e,slug:t,onSaved:()=>d.mutate()}),o==="records"&&n.jsx(i7,{records:g.data||[],loading:g.isLoading}),o==="sleep"&&n.jsx(l7,{routines:j}),o==="brain"&&n.jsx(f7,{slug:t,emoji:_.emoji||void 0,memory:_.memory||"",threads:(h.data||[]).map(N=>({id:N.id,label:N.title||N.filename})),tasks:E.map(N=>({id:N.id,label:N.title,detail:N.body||void 0})),routines:j,parent:_.parent||null,children:y.map(N=>N.slug)}),o==="config"&&n.jsx(r7,{pid:e,agent:_,agents:f.data||[],onSaved:()=>{d.mutate(),f.mutate()},onDeleted:()=>{f.mutate(),a(`/p/${e}/agents`)}})]})}function r7({pid:e,agent:t,agents:a,onSaved:o,onDeleted:i}){const c=Je(),[d,f]=x.useState(t.emoji||""),[m,g]=x.useState(t.type||""),[h,b]=x.useState(t.area||""),[_,j]=x.useState(t.role||""),[E,y]=x.useState(t.autonomy||""),[k,N]=x.useState(t.model||""),[w,S]=x.useState(t.parent||""),[R,A]=x.useState(!!t.is_master),[T,z]=x.useState((t.skills||[]).join(", ")),[M,P]=x.useState((t.tools||[]).join(", ")),[L,I]=x.useState(t.description||""),[D,$]=x.useState(t.system||""),[q,G]=x.useState(!1),[U,V]=x.useState(!1),X=async()=>{G(!0);try{await an.update(e,t.slug,{emoji:d||null,type:m||null,area:h||null,role:_||null,autonomy:E||null,model:k||null,parent:w||null,is_master:R||m==="orchestrator",skills:Kx(T),tools:Kx(M),description:L||null,system:D}),c.success(u("project.agent_detail.update_success")),o()}catch(W){c.error(W.message)}finally{G(!1)}},Q=async()=>{await an.remove(e,t.slug),c.success(u("project.agent_detail.delete_success")),i()};return n.jsxs(Ve,{title:u("project.agent_detail.config_title"),description:`.apc/agents/${t.slug}.md — ${u("agents_ui.config_def_desc")}`,children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-[80px_1fr] gap-3",children:[n.jsx(le,{label:u("agents_form.emoji"),children:n.jsx(xE,{value:d,onChange:f})}),n.jsx(le,{label:u("project.agent_detail.type_label"),children:n.jsx(ct,{value:m,onChange:g,options:jE()})})]}),n.jsx(_E,{pid:e,area:h,role:_,onArea:b,onRole:j}),n.jsx(le,{label:u("agents_form.autonomy"),hint:u("agents_form.autonomy_hint"),children:n.jsx(bE,{value:E,onChange:y})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("project.agent_detail.parent_label"),children:n.jsx(ct,{value:w,onChange:S,placeholder:u("project.agent_detail.none_parent"),options:[{value:"",label:u("project.agent_detail.none_parent")},...a.filter(W=>W.slug!==t.slug).map(W=>({value:W.slug,label:W.slug}))]})}),n.jsx(le,{label:u("project.agent_detail.model_label"),hint:u("project.agent_detail.model_hint"),children:n.jsx(Ee,{value:k,onChange:W=>N(W.target.value),placeholder:u("project.agent_detail.model_ph")})})]}),n.jsx(le,{label:u("project.agent_detail.skills_label"),children:n.jsx(Ee,{value:T,onChange:W=>z(W.target.value),placeholder:"skill-a, skill-b"})}),n.jsx(c7,{value:M,onChange:P}),n.jsx(le,{label:u("project.agent_detail.bio_label"),children:n.jsx(un,{rows:2,value:L,onChange:W=>I(W.target.value)})}),n.jsx(le,{label:u("project.agent_detail.system_label"),hint:u("project.agent_detail.system_hint"),children:n.jsx(un,{rows:10,className:"font-mono text-xs",value:D,onChange:W=>$(W.target.value),placeholder:"You are…"})}),n.jsx(Bt,{checked:R,onChange:A,label:u("project.agent_detail.master_label")}),n.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[n.jsxs(re,{variant:"destructive",onClick:()=>V(!0),children:[n.jsx(_n,{size:13})," ",u("project.agent_detail.delete_btn")]}),n.jsxs(re,{variant:"primary",loading:q,onClick:X,children:[n.jsx(Kf,{size:13})," ",u("project.agent_detail.save_btn")]})]})]}),n.jsx(vE,{open:U,onClose:()=>V(!1),onConfirm:Q,title:u("project.agent_detail.delete_btn"),description:u("project.agent_detail.delete_confirm",{slug:t.slug}),confirmLabel:u("project.agent_detail.delete_btn")})]})}function Fd({label:e,value:t,icon:a}){return n.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[n.jsx(a,{size:13})," ",e]}),n.jsx("div",{className:"mt-1 text-2xl font-semibold",children:t})]})}function o7({pid:e,slug:t,onSaved:a}){const o=Je(),i=Be(`/api/memory/${e}/agent:${t}`,()=>an.memory.get(e,t).then(f=>f.body)),c=x.useMemo(()=>{if(i.data===void 0)return null;const f=i.data??"";return{path:`agents/${t}/memory.md`,name:"memory.md",kind:"markdown",size:f.length,modified:"",encoding:"utf8",content:f}},[i.data,t]),d=async f=>{await an.memory.put(e,t,f),o.success(u("project.agent_detail.memory_saved")),i.mutate(f,{revalidate:!1}),a()};return n.jsx("div",{className:"flex h-[65vh] min-h-[420px] flex-col overflow-hidden rounded-xl border border-border bg-card",children:n.jsx(X_,{file:c,loading:i.isLoading,onSave:d})})}function i7({records:e,loading:t}){const a=x.useMemo(()=>[...e].sort((o,i)=>(i.ts||"").localeCompare(o.ts||"")),[e]);return n.jsxs(Ve,{title:u("project.agent_detail.records_title"),description:u("project.agent_detail.records_desc"),children:[t&&n.jsx(tt,{}),!t&&a.length===0&&n.jsx("p",{className:"text-xs text-muted-fg",children:u("project.agent_detail.no_activity")}),n.jsx("ul",{className:"space-y-1 text-sm",children:a.map((o,i)=>n.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("span",{className:"mt-0.5 shrink-0",children:o.direction==="in"?n.jsx(V2,{size:13,className:"text-blue-400"}):n.jsx(G2,{size:13,className:"text-emerald-400"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[n.jsx("span",{className:"font-mono",children:new Date(o.ts).toLocaleString()}),n.jsx($e,{tone:"info",children:o.channel}),o.type&&n.jsx($e,{children:o.type})]}),o.body&&n.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}-${i}`))})]})}function l7({routines:e}){return e.length===0?n.jsx(Ve,{title:u("project.agent_detail.sleep_title"),description:u("project.agent_detail.sleep_desc"),children:n.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[n.jsx("div",{className:"font-medium text-amber-400",children:u("project.agent_detail.sleep_deep")}),n.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:u("project.agent_detail.sleep_deep_desc")})]})}):n.jsx(Ve,{title:u("project.agent_detail.sleep_title"),description:u("project.agent_detail.sleep_desc"),children:n.jsx("div",{className:"space-y-3",children:e.map(t=>{const a=t.enabled,o=t.last_status==="error";return n.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ge("size-2 rounded-full",o?"bg-destructive":a?"bg-emerald-400":"bg-muted-fg/40")}),n.jsx("span",{className:"text-sm font-medium",children:t.name}),n.jsx($e,{tone:a?"success":"muted",children:u(a?"agents_ui.running":"agents_ui.paused")}),o&&n.jsx($e,{tone:"danger",children:u("agents_ui.last_error")})]}),n.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[n.jsx(Gd,{label:u("agents_ui.field_tick"),value:t.schedule}),n.jsx(Gd,{label:u("agents_ui.field_next_tick"),value:t.next_run_at?new Date(t.next_run_at).toLocaleString():"—"}),n.jsx(Gd,{label:u("agents_ui.field_last_tick"),value:t.last_run_at?new Date(t.last_run_at).toLocaleString():"—"}),n.jsx(Gd,{label:u("agents_ui.field_last_run"),value:t.last_status||"—"})]}),t.last_error&&n.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 Gd({label:e,value:t}){return n.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[n.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),n.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:t})]})}function c7({value:e,onChange:t}){const a=Be("/api/tools",()=>fP.list()),o=Kx(e),i=a.data||[],c=f=>{const m=new Set(o);m.has(f)?m.delete(f):m.add(f),t([...m].join(", "))},d=o.filter(f=>!i.some(m=>m.name===f));return n.jsxs(le,{label:u("agents_ui.tools_label"),hint:u("project.agent_detail.tools_hint"),children:[n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.map(f=>{const m=o.includes(f.name);return n.jsx(Ue,{content:f.description||f.name,children:n.jsx("button",{type:"button",onClick:()=>c(f.name),className:ge("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:f.name})},f.name)}),d.map(f=>n.jsxs("button",{type:"button",onClick:()=>c(f),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:[f," ✕"]},f))]}),n.jsx(Ee,{className:"mt-2",value:e,onChange:f=>t(f.target.value),placeholder:u("project.agent_detail.tools_custom_ph")})]})}const u7=new Set(["the","and","for","with","from","into","your","that","this","una","las","los","del","por","con","para","post","posts","demo","week","weekly"]);function nw(e){return new Set(e.toLowerCase().split(/[^a-záéíóúñ0-9]+/).filter(t=>t.length>3&&!u7.has(t)))}function d7(e,t){for(const a of e)if(t.has(a))return!0;return!1}function f7({slug:e,emoji:t,memory:a,threads:o,tasks:i,routines:c,parent:d,children:f}){const{nodes:m,edges:g}=x.useMemo(()=>{const h=[],b=[],_="__core";h.push({id:_,label:e,kind:"agent",role:"core",emoji:t,relation:"self"});const j=(w,S,R)=>{h.push({id:w,label:S,kind:R,role:"hub",relation:"cluster"}),b.push({source:_,target:w})},E=s7(a),y=o.slice(0,8),k=i.slice(0,8);E.length&&(j("hub-mem",u("agents_ui.kind_memory"),"memory"),E.forEach((w,S)=>{h.push({id:`m${S}`,label:w,kind:"memory",relation:"knows",detail:w}),b.push({source:"hub-mem",target:`m${S}`})})),y.length&&(j("hub-thread",u("agents_ui.kind_thread"),"thread"),y.forEach(w=>{h.push({id:`th-${w.id}`,label:w.label,kind:"thread",relation:"in_thread"}),b.push({source:"hub-thread",target:`th-${w.id}`})})),k.length&&(j("hub-task",u("agents_ui.kind_task"),"task"),k.forEach(w=>{h.push({id:`ts-${w.id}`,label:w.label,kind:"task",relation:"handles_task",detail:w.detail}),b.push({source:"hub-task",target:`ts-${w.id}`})})),c.length&&(j("hub-routine",u("agents_ui.kind_routine"),"routine"),c.forEach(w=>{h.push({id:`rt-${w.name}`,label:w.name,kind:"routine",relation:"ticks",detail:`schedule: ${w.schedule}`}),b.push({source:"hub-routine",target:`rt-${w.name}`})})),f.length&&(j("hub-team",u("agents_ui.kind_hierarchy"),"agentlink"),f.forEach(w=>{h.push({id:`c-${w}`,label:w,kind:"agentlink",role:"hub",relation:"orchestrates",slug:w}),b.push({source:"hub-team",target:`c-${w}`})})),d&&(h.push({id:`p-${d}`,label:d,kind:"agentlink",role:"hub",relation:"reports_to",slug:d}),b.push({source:`p-${d}`,target:_}));const N=y.map(w=>({id:`th-${w.id}`,kw:nw(w.label)}));return k.forEach(w=>{const S=nw(w.label),R=N.find(A=>d7(S,A.kw));R&&b.push({source:`ts-${w.id}`,target:R.id})}),{nodes:h,edges:b}},[e,t,a,o,i,c,d,f]);return n.jsx(Ve,{title:u("project.agent_detail.brain_title"),description:u("project.agent_detail.brain_desc"),children:m.length<=1?n.jsx("p",{className:"text-xs text-muted-fg",children:u("project.agent_detail.brain_empty")}):n.jsx(WN,{nodes:m,edges:g})})}const p7=["","es","en","pt","fr","it","de"],sw=e=>e.split(",").map(t=>t.trim()).filter(Boolean);function kE(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:va}:{gradient:"from-slate-600 to-gray-600",Icon:rn}}const m7=[{key:"threads",icon:Jc,i18n:"agents_ui.stat_threads"},{key:"records",icon:Hf,i18n:"agents_ui.stat_records"},{key:"tasks",icon:pl,i18n:"agents_ui.stat_tasks"},{key:"heartbeats",icon:zo,i18n:"agents_ui.stat_heartbeats"}];function wE({stats:e,className:t}){return e?n.jsx("div",{className:ge("flex items-center gap-3 text-[11px] text-muted-fg",t),children:m7.map(({key:a,icon:o,i18n:i})=>n.jsx(Ue,{content:u(i),children:n.jsxs("span",{className:"inline-flex items-center gap-1 tabular-nums",children:[n.jsx(o,{size:12})," ",e[a]]})},a))}):null}function g7(e){const t=new Map;for(const a of e){const o=a.area||null;t.has(o)||t.set(o,[]),t.get(o).push(a)}return[...t.entries()].sort(([a],[o])=>a===null?1:o===null?-1:a.localeCompare(o)).map(([a,o])=>({area:a,agents:o}))}function h7(e){const t=e.filter(d=>d.is_master),a=t.length===1?t[0]:null,o=d=>d.parent?d.parent:a&&!d.is_master&&d.slug!==a.slug?a.slug:null,i=new Map,c=[];for(const d of e){const f=o(d);f&&e.some(m=>m.slug===f)?(i.has(f)||i.set(f,[]),i.get(f).push(d)):c.push(d)}return{roots:c,childrenByParent:i}}function x7({pid:e}){const t=Tn();Je();const a=Be(`/api/projects/${e}/agents?stats=1`,()=>an.list(e,{stats:!0})),[o,i]=x.useState("hierarchy"),[c,d]=x.useState(!1),[f,m]=x.useState(!1),g=a.data||[],h=E=>t(`/p/${e}/agents/${E}`),b=E=>t(E?`/p/${e}/chat?agent=${E}`:`/p/${e}/chat`),{roots:_,childrenByParent:j}=x.useMemo(()=>h7(g),[g]);return n.jsxs(Ve,{title:u("project.agents.title"),description:u("project.agents.subtitle_full"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[n.jsxs("button",{onClick:()=>i("hierarchy"),className:ge("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[n.jsx(Zc,{size:13})," ",u("project.agents.hierarchy")]}),n.jsxs("button",{onClick:()=>i("list"),className:ge("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[n.jsx(sM,{size:13})," ",u("project.agents.list_view")]})]}),n.jsxs(re,{size:"sm",variant:"ghost",onClick:()=>m(!0),children:[n.jsx(lS,{size:13})," ",u("project.agents.import")]}),n.jsxs(re,{size:"sm",variant:"secondary",onClick:()=>b(),children:[n.jsx(Sa,{size:13})," ",u("project.agents.chat")]}),n.jsxs(re,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>d(!0),children:[n.jsx(Dt,{size:14})," ",u("project.agents.new")]})]}),children:[a.isLoading&&n.jsx(tt,{}),!a.isLoading&&g.length===0&&n.jsx(ut,{children:u("project.agents.empty_text")}),!a.isLoading&&g.length>0&&(o==="hierarchy"?n.jsx(_7,{roots:_,childrenByParent:j,onOpen:h,onChat:b}):n.jsx(v7,{agents:g,onOpen:h,onChat:b})),n.jsx(y7,{open:c,pid:e,agents:g,onClose:()=>d(!1),onCreated:()=>{d(!1),a.mutate()}}),n.jsx(b7,{open:f,pid:e,existing:g.map(E=>E.slug),onClose:()=>m(!1),onImported:()=>a.mutate()})]})}function b7({open:e,onClose:t,onImported:a,pid:o,existing:i}){const c=Je(),d=Be(e?"/api/agents/vault":null,()=>an.vault()),[f,m]=x.useState(""),g=d.data||[],h=async b=>{m(b);try{await an.import(o,b),c.success(u("project.agents.import_success",{slug:b})),a()}catch(_){c.error(_.message)}finally{m("")}};return n.jsxs(Xt,{open:e,onClose:t,title:u("project.agents.import_title"),description:u("project.agents.import_desc"),size:"lg",footer:n.jsx(re,{variant:"ghost",onClick:t,children:u("common.close")}),children:[d.isLoading&&n.jsx(tt,{}),!d.isLoading&&g.length===0&&n.jsx(ut,{children:u("project.agents.import_empty")}),n.jsx("ul",{className:"space-y-2",children:g.map(b=>{const _=i.includes(b.slug);return n.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[n.jsx(rn,{size:16,className:"shrink-0 text-muted-fg"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"text-sm font-medium",children:b.slug}),b.is_master&&n.jsxs($e,{tone:"success",children:[n.jsx(va,{size:9})," ",u("project.agents.orchestrator")]}),b.model&&n.jsx($e,{tone:"info",children:b.model})]}),b.description&&n.jsx("p",{className:"truncate text-xs text-muted-fg",children:b.description})]}),n.jsx(re,{size:"sm",variant:"primary",disabled:_||f===b.slug,loading:f===b.slug,onClick:()=>h(b.slug),children:u(_?"project.agents.import_already":"project.agents.import_btn")})]},b.slug)})})]})}function _7({roots:e,childrenByParent:t,onOpen:a,onChat:o}){return n.jsx("div",{className:"space-y-8",children:e.map(i=>{const c=t.get(i.slug)||[],d=g7(c),f=d.some(m=>m.area);return n.jsxs("div",{className:"flex flex-col items-center",children:[n.jsx(jh,{agent:i,onOpen:a,onChat:o,wide:!0}),c.length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"h-5 w-px bg-border"}),n.jsx("div",{className:"flex flex-col gap-6 border-t border-border pt-5",children:d.map(m=>n.jsxs("div",{className:"flex flex-col items-center gap-3",children:[f&&n.jsxs("span",{className:"rounded-full border border-border bg-muted/40 px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:[m.area||u("agents_ui.uncategorized")," · ",m.agents.length]}),n.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4",children:m.agents.map(g=>n.jsxs("div",{className:"flex flex-col items-center",children:[n.jsx(jh,{agent:g,onOpen:a,onChat:o}),(t.get(g.slug)||[]).length>0&&n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"h-4 w-px bg-border"}),n.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(t.get(g.slug)||[]).map(h=>n.jsx(jh,{agent:h,onOpen:a,onChat:o,compact:!0},h.slug))})]})]},g.slug))})]},m.area??"__none"))})]})]},i.slug)})})}function jh({agent:e,onOpen:t,onChat:a,wide:o,compact:i}){const{gradient:c,Icon:d}=kE(e);return n.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:ge("cursor-pointer rounded-xl border border-border bg-card p-3 transition-colors hover:border-muted-fg/50",o?"w-64":i?"w-44":"w-52"),onClick:()=>t(e.slug),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("div",{className:ge("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:e.emoji?n.jsx("span",{className:"text-base leading-none",children:e.emoji}):n.jsx(d,{className:"size-4 text-white"})}),n.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),n.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&n.jsxs($e,{tone:"success",children:[n.jsx(va,{size:9})," ",u("project.agents.orchestrator")]}),e.role&&n.jsx($e,{children:e.role}),e.model&&!i&&n.jsx($e,{tone:"info",children:e.model})]}),n.jsx(wE,{stats:e.stats,className:"mt-2"}),n.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-border pt-2 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[n.jsxs("button",{onClick:()=>t(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[n.jsx(Wc,{size:12})," ",u("project.agents.view")]}),n.jsxs("button",{onClick:()=>a(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[n.jsx(Sa,{size:12})," ",u("project.agents.chat")]})]})]})}function v7({agents:e,onOpen:t,onChat:a}){const o=[...e].sort((i,c)=>+!!c.is_master-+!!i.is_master||i.slug.localeCompare(c.slug));return n.jsx("div",{className:"space-y-2",children:o.map(i=>{const{gradient:c,Icon:d}=kE(i);return n.jsxs("div",{"data-testid":`agent-card-${i.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(i.slug),children:[n.jsx("div",{className:ge("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:i.emoji?n.jsx("span",{className:"text-lg leading-none",children:i.emoji}):n.jsx(d,{className:"size-4 text-white"})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"text-sm font-semibold",children:i.slug}),i.is_master&&n.jsxs($e,{tone:"success",children:[n.jsx(va,{size:10})," ",u("project.agents.orchestrator")]}),i.role&&n.jsx($e,{children:i.role}),i.model&&n.jsx($e,{tone:"info",children:i.model}),i.parent&&n.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",i.parent]})]}),i.description&&n.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:i.description}),n.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[i.skills?.map(f=>n.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[n.jsx(sa,{size:9})," ",f]},f)),i.tools?.map(f=>n.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[n.jsx(aa,{size:9})," ",f]},f))]})]}),n.jsx(wE,{stats:i.stats,className:"hidden shrink-0 sm:flex"}),n.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[n.jsxs("button",{onClick:()=>t(i.slug),className:"flex items-center gap-1 hover:text-foreground",children:[n.jsx(Wc,{size:12})," ",u("project.agents.view")]}),n.jsxs("button",{onClick:()=>a(i.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[n.jsx(Sa,{size:12})," ",u("project.agents.chat")]})]})]},i.slug)})})}function y7({open:e,onClose:t,onCreated:a,pid:o,agents:i}){const c=Je(),[d,f]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(""),[E,y]=x.useState(""),[k,N]=x.useState(""),[w,S]=x.useState(""),[R,A]=x.useState(""),[T,z]=x.useState(""),[M,P]=x.useState(""),[L,I]=x.useState(""),[D,$]=x.useState(!1),[q,G]=x.useState(""),[U,V]=x.useState(!1),X=()=>{f(""),g(""),b(""),j(""),y(""),N(""),S(""),A(""),z(""),P(""),I(""),$(!1),G("")},Q=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(d)){c.error(u("project.agents.slug_invalid"));return}V(!0);try{await an.create(o,{slug:d,emoji:m||void 0,type:h||void 0,role:_||void 0,area:E||void 0,autonomy:k||void 0,model:w||void 0,language:R||void 0,description:T||void 0,skills:sw(M),tools:sw(L),is_master:D||h==="orchestrator",parent:q||void 0}),c.success(u("project.agents.create_success",{slug:d})),a(),X()}catch(W){c.error(W?.message||u("project.agents.create_error"))}finally{V(!1)}};return n.jsx(Xt,{open:e,onClose:t,title:u("project.agents.new_title"),description:u("project.agents.new_desc"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:U,children:u("common.cancel")}),n.jsx(re,{variant:"primary","data-testid":"agent-create-submit",onClick:Q,loading:U,children:u("common.create")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"grid grid-cols-[80px_1fr_1fr] gap-3",children:[n.jsx(le,{label:u("agents_form.emoji"),children:n.jsx(xE,{value:m,onChange:g})}),n.jsx(le,{label:u("project.agents.slug_label"),children:n.jsx(Ee,{autoFocus:!0,"data-testid":"agent-slug",value:d,onChange:W=>f(W.target.value),placeholder:u("project.agents.slug_ph")})}),n.jsx(le,{label:u("project.agent_detail.type_label"),children:n.jsx(ct,{value:h,onChange:b,options:jE()})})]}),n.jsx(_E,{pid:o,area:E,role:_,onArea:y,onRole:j}),n.jsx(le,{label:u("agents_form.autonomy"),hint:u("agents_form.autonomy_hint"),children:n.jsx(bE,{value:k,onChange:N})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("project.agents.model_label"),hint:u("project.agents.model_hint"),children:n.jsx(Ee,{value:w,onChange:W=>S(W.target.value)})}),n.jsx(le,{label:u("project.agents.lang_label"),children:n.jsx(ct,{value:R,onChange:A,options:p7.map(W=>({value:W,label:W||"—"}))})})]}),n.jsx(le,{label:u("project.agents.desc_label"),children:n.jsx(un,{rows:2,value:T,onChange:W=>z(W.target.value),placeholder:u("project.agents.desc_ph")})}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("project.agents.skills_label"),children:n.jsx(Ee,{value:M,onChange:W=>P(W.target.value),placeholder:u("project.agents.skills_ph")})}),n.jsx(le,{label:u("project.agents.tools_label"),children:n.jsx(Ee,{value:L,onChange:W=>I(W.target.value),placeholder:u("project.agents.tools_ph")})})]}),n.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[n.jsx(le,{label:u("project.agents.parent_label"),hint:u("project.agents.parent_hint"),children:n.jsx(ct,{value:q,onChange:G,placeholder:u("project.agents.none_parent"),options:[{value:"",label:u("project.agents.none_parent")},...i.filter(W=>W.slug!==d).map(W=>({value:W.slug,label:W.slug}))]})}),n.jsx(Bt,{checked:D,onChange:$,label:u("project.agents.master_label")})]})]})})}function Yd(e){return e.split(`
794
- `).map(t=>t.trim()).filter(Boolean)}function Fc(){return{exec_agent:{label:u("agents_ui.kind_exec_agent"),desc:u("agents_ui.kind_exec_agent_desc"),icon:rn},super_agent:{label:u("agents_ui.kind_super_agent"),desc:u("agents_ui.kind_super_agent_desc"),icon:va},telegram:{label:u("agents_ui.kind_telegram"),desc:u("agents_ui.kind_telegram_desc"),icon:Sa},shell:{label:u("agents_ui.kind_shell"),desc:u("agents_ui.kind_shell_desc"),icon:ya},heartbeat:{label:u("agents_ui.kind_heartbeat"),desc:u("agents_ui.kind_heartbeat_desc"),icon:zo}}}function j7(e){const t=Fc();return Object.keys(t).filter(a=>a!=="heartbeat"||e==="heartbeat").map(a=>({value:a,label:t[a].label,description:t[a].desc,icon:t[a].icon}))}function Q_(e){if(!e)return"—";if(e.startsWith("every:")){const t=e.slice(6),a=t.match(/^(\d+)(s|m|h|d)$/);if(a){const o=a[1],i={s:u("agents_ui.unit_seconds"),m:u("agents_ui.unit_minutes"),h:u("agents_ui.unit_hours"),d:u("agents_ui.unit_days")}[a[2]]||a[2];return u("agents_ui.every_n_unit",{n:o,unit:i})}return u("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 k7(){return[{label:u("agents_ui.preset_every_10m"),value:"every:10m"},{label:u("agents_ui.preset_hourly"),value:"every:1h"},{label:u("agents_ui.preset_daily_9am"),value:"cron 0 9 * * *"},{label:u("agents_ui.preset_weekdays_9am"),value:"cron 0 9 * * 1-5"}]}function SE(){return[{v:"{{pre_output}}",where:"prompt",desc:u("agents_ui.var_pre_output_prompt")},{v:"$APX_LLM_OUTPUT",where:"post",desc:u("agents_ui.var_llm_output")},{v:"$APX_STATUS",where:"post",desc:u("agents_ui.var_status")},{v:"$APX_SKIPPED",where:"post",desc:u("agents_ui.var_skipped")},{v:"$APX_PRE_OUTPUT",where:"post",desc:u("agents_ui.var_pre_output")},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:u("agents_ui.var_pre_output_file")},{v:"$APX_PRE_EXIT",where:"post",desc:u("agents_ui.var_pre_exit")},{v:"$APX_ROUTINE",where:"pre/post",desc:u("agents_ui.var_routine")}]}function bc(e){return SE().filter(t=>e==="pre"?t.where.includes("pre"):e==="prompt"?t.where==="prompt":t.where==="post"||t.where==="pre/post")}function w7({routines:e,selectedName:t,onSelect:a}){return n.jsxs("aside",{className:"flex h-full min-h-0 flex-col border-r border-border",children:[n.jsx("div",{className:"shrink-0 px-3 py-2.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:u("project.routines.list_title")}),n.jsx("ul",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto p-2 pt-0",children:e.map(o=>{const i=Fc()[o.kind],c=i?.icon||pl,d=o.name===t;return n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>a(o.name),"aria-current":d,className:ge("w-full rounded-lg border px-2.5 py-2 text-left transition-colors",d?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:ge("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:n.jsx(c,{size:13})}),n.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:o.name}),!o.enabled&&n.jsx("span",{className:"shrink-0 text-[10px] text-muted-fg",children:u("project.routines.paused")}),n.jsx(du,{ok:o.last_status==="ok"?!0:o.last_status==="error"?!1:null})]}),n.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 pl-8 text-[10px] text-muted-fg",children:[n.jsx("span",{className:"truncate",children:i?.label||o.kind}),n.jsxs("span",{className:"shrink-0",children:["⏱ ",Q_(o.schedule)]})]})]})},o.name)})})]})}function S7({title:e,body:t,mono:a}){return n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),n.jsx("div",{className:ge("max-h-44 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 text-xs",a&&"font-mono"),children:t.trim()?t:n.jsx("span",{className:"text-muted-fg",children:u("project.routines.block_empty")})})]})}function CE(e){const t=e.meta||{};return t.skipped?"skipped":t.status==="error"?"error":"ok"}function NE(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 EE({st:e}){return e==="ok"?n.jsx(Yr,{size:13,className:"shrink-0 text-emerald-500"}):e==="error"?n.jsx(gs,{size:13,className:"shrink-0 text-destructive"}):n.jsx(vA,{size:13,className:"shrink-0 text-amber-500"})}function RE(e){return u(e==="ok"?"project.routines.status_ok":e==="error"?"project.routines.status_error":"project.routines.status_skipped")}function kh({title:e,children:t}){return n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),t]})}const wh="whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 font-mono text-[11px]";function C7({m:e,onClose:t}){const a=CE(e),o=e.meta||{},i=o.result||{},c=o.flow||null,d=String(i.reply??i.text??i.stdout??""),f=String(i.error??i.stderr??""),m=String(i.note??""),g=n.jsx("span",{className:"text-muted-fg",children:u("project.routines.block_empty")});return n.jsxs("div",{className:"flex min-h-0 flex-col border-l border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-4 py-2",children:[n.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[n.jsx(EE,{st:a}),n.jsx("span",{className:ge("font-medium",a==="ok"&&"text-emerald-500",a==="error"&&"text-destructive",a==="skipped"&&"text-amber-500"),children:RE(a)}),n.jsx("span",{className:"font-mono text-muted-fg",children:NE(e.ts)})]}),n.jsx("button",{type:"button",onClick:t,"aria-label":u("project.routines.runs_close"),className:"rounded-md p-1 text-muted-fg hover:bg-muted hover:text-foreground",children:n.jsx(gs,{size:14})})]}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 pb-4 text-xs",children:[e.body&&n.jsx("div",{className:"text-muted-fg",children:e.body}),c?.pre&&n.jsx(kh,{title:u("project.routines.block_pre"),children:c.pre.output?.trim()?n.jsx("pre",{className:wh,children:c.pre.output}):g}),n.jsx(kh,{title:u("project.routines.runs_output"),children:d?n.jsx("pre",{className:wh,children:d}):f?n.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-lg bg-destructive/10 px-3 py-2 font-mono text-[11px] text-destructive",children:f}):m?n.jsx("div",{className:"text-muted-fg",children:m}):g}),c?.post&&c.post.length>0&&n.jsx(kh,{title:u("project.routines.block_post"),children:n.jsx("div",{className:"space-y-1.5",children:c.post.map((h,b)=>n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"font-mono text-[10px] text-muted-fg",children:["$ ",h.cmd," ",n.jsxs("span",{className:"opacity-70",children:["· exit ",h.exit]})]}),(h.stdout||h.stderr)&&n.jsx("pre",{className:wh,children:h.stdout||h.stderr})]},b))})})]})]})}function N7({pid:e,name:t,running:a}){const o=Be(`/api/projects/${e}/routines/${t}/runs`,async()=>(await Nf.project(e,{channel:"routine",limit:200})).filter(g=>g.meta?.routine===t&&(g.actor_id==="apx:routine"||g.type==="system"))),i=(o.data||[]).slice(0,50),[c,d]=x.useState(null),f=c&&i.find(m=>m.ts===c)||null;return n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border-t border-border",children:[n.jsx("div",{className:"shrink-0 px-4 pb-1.5 pt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:u("project.routines.runs_title")}),n.jsxs("div",{className:ge("grid min-h-0 flex-1 overflow-hidden",f?"grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]":"grid-cols-1"),children:[n.jsxs("div",{className:"min-h-0 overflow-y-auto px-4 pb-4",children:[o.isLoading&&n.jsx(tt,{}),!o.isLoading&&i.length===0&&n.jsx("div",{className:"text-xs text-muted-fg",children:u("project.routines.runs_empty")}),n.jsxs("ul",{className:"space-y-1",children:[a&&n.jsx("li",{children:n.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:[n.jsx(bn,{size:12}),n.jsx("span",{className:"text-muted-fg",children:u("project.routines.running")})]})}),i.map((m,g)=>{const h=CE(m),b=c===m.ts;return n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>d(b?null:m.ts),"aria-current":b,className:ge("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:[n.jsx(EE,{st:h}),n.jsx("span",{className:"font-mono text-muted-fg",children:NE(m.ts)}),n.jsx("span",{className:ge("font-medium",h==="ok"&&"text-emerald-500",h==="error"&&"text-destructive",h==="skipped"&&"text-amber-500"),children:RE(h)})]})},`${m.ts}-${g}`)})]})]}),f&&n.jsx(C7,{m:f,onClose:()=>d(null)})]})]})}function E7({pid:e,routine:t,onEdit:a,onRun:o,onToggle:i,onDelete:c,running:d}){const f=Fc()[t.kind],m=f?.icon||pl,g=t.spec||{},h=t.pre_commands||[],b=t.post_commands||[],_=[];return h.length&&_.push({title:u("project.routines.block_pre"),body:h.join(`
795
- `),mono:!0}),t.kind==="exec_agent"||t.kind==="super_agent"?_.push({title:u("project.routines.block_prompt"),body:String(g.prompt||"")}):t.kind==="telegram"?_.push({title:u("project.routines.block_text"),body:String(g.text||"")}):t.kind==="shell"?_.push({title:u("project.routines.block_command"),body:String(g.command||""),mono:!0}):t.kind==="heartbeat"&&_.push({title:u("project.routines.block_text"),body:String(g.message||"")}),b.length&&_.push({title:u("project.routines.block_post"),body:b.join(`
796
- `),mono:!0}),n.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[n.jsxs("div",{className:"min-h-0 shrink space-y-4 overflow-y-auto p-4",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3",children:[n.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[n.jsx("span",{className:ge("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:n.jsx(m,{size:14})}),n.jsx("h3",{className:"truncate text-base font-semibold",children:t.name}),n.jsx($e,{tone:t.kind==="shell"?"warning":"info",children:f?.label||t.kind})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[n.jsx(Bt,{checked:t.enabled,onChange:i}),n.jsx(Ue,{content:u("common.run"),children:n.jsx(re,{size:"sm",variant:"secondary",onClick:o,loading:d,children:n.jsx(yb,{size:13})})}),n.jsx(Ue,{content:u("project.routines.edit_hint"),children:n.jsxs(re,{size:"sm",variant:"secondary",onClick:a,children:[n.jsx(wa,{size:13})," ",u("project.routines.edit_btn")]})}),n.jsx(Ue,{content:u("common.delete"),children:n.jsx(re,{size:"sm",variant:"destructive",onClick:c,children:n.jsx(_n,{size:13})})})]})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[n.jsxs("span",{children:["⏱ ",Q_(t.schedule)]}),t.next_run_at&&n.jsxs("span",{children:[u("project.routines.next_run")," ",new Date(t.next_run_at).toLocaleString()]}),t.last_run_at&&n.jsxs("span",{children:[u("project.routines.last_run")," ",new Date(t.last_run_at).toLocaleString()]}),n.jsxs("span",{className:ge(t.last_status==="ok"&&"text-emerald-500",t.last_status==="error"&&"text-destructive"),children:[u("agents_ui.last_label")," ",t.last_status||"—"]})]}),t.last_error&&n.jsx("div",{className:"rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:t.last_error}),n.jsx("div",{className:"space-y-3",children:_.map(j=>n.jsx(S7,{title:j.title,body:j.body,mono:j.mono},j.title))})]}),n.jsx(N7,{pid:e,name:t.name,running:d})]})}function Oi({label:e,hint:t,value:a,onChange:o,vars:i,rows:c=3,mono:d,placeholder:f}){const m=x.useRef(null),g=h=>{const b=m.current?.querySelector("textarea");if(!b){o(a?`${a}${h}`:h);return}const _=b.selectionStart??a.length,j=b.selectionEnd??a.length,E=a.slice(0,_)+h+a.slice(j);o(E),requestAnimationFrame(()=>{b.focus();const y=_+h.length;b.setSelectionRange(y,y)})};return n.jsxs("div",{className:"space-y-1",children:[n.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:e}),t&&n.jsx("div",{className:"text-[11px] text-muted-foreground/70",children:t}),n.jsxs("div",{ref:m,className:"space-y-1.5",children:[n.jsx(un,{rows:c,className:ge(d&&"font-mono text-xs"),value:a,onChange:h=>o(h.target.value),placeholder:f}),i.length>0&&n.jsx("div",{className:"flex flex-wrap gap-1",children:i.map(h=>n.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 R7(){return n.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[n.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:u("project.routines.vars_title")}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:SE().map(e=>n.jsx(Ue,{content:n.jsx("span",{className:"block max-w-[240px] whitespace-normal leading-snug",children:e.desc}),children:n.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,n.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",e.where]})]})},e.v))})]})}function T7({draft:e,onClose:t,onSaved:a,pid:o}){const i=Je(),c=Be(e?`/api/projects/${o}/agents`:null,()=>an.list(o)),[d,f]=x.useState(!1),[m,g]=x.useState(""),[h,b]=x.useState("super_agent"),[_,j]=x.useState("every:10m"),[E,y]=x.useState(!0),[k,N]=x.useState(""),[w,S]=x.useState(""),[R,A]=x.useState("default"),[T,z]=x.useState(""),[M,P]=x.useState(""),[L,I]=x.useState(""),[D,$]=x.useState("heartbeat"),[q,G]=x.useState(""),[U,V]=x.useState(""),[X,Q]=x.useState(""),W=Be(e&&h==="telegram"?"/api/telegram/channels":null,()=>Pn.channels.list());x.useEffect(()=>{if(!e)return;const ie=e.spec&&typeof e.spec=="object"?e.spec:{};g(e.name||""),b(e.kind||"super_agent"),j(e.schedule||"every:10m"),y(e.enabled??!0),N(ie.agent||""),S(ie.prompt||""),A(ie.channel||"default"),z(ie.chat_id?String(ie.chat_id):""),P(ie.text||""),I(ie.command||""),$(ie.channel||"heartbeat"),G(ie.message||""),V((e.pre_commands||[]).join(`
797
- `)),Q((e.post_commands||[]).join(`
798
- `))},[e]);const B=h==="exec_agent"||h==="super_agent"||h==="telegram",K=()=>{switch(h){case"exec_agent":return{agent:k,prompt:w};case"super_agent":return{prompt:w};case"telegram":return{channel:R,...T?{chat_id:T}:{},text:M};case"shell":return{command:L};case"heartbeat":return{channel:D,message:q}}},ee=async()=>{if(!m){i.error(u("project.routines.name_required"));return}f(!0);try{await Br.upsert(o,{name:m,kind:h,schedule:_,enabled:E,spec:K(),pre_commands:B?Yd(U):[],post_commands:B?Yd(X):[]}),i.success(u("project.routines.saved")),a()}catch(ie){i.error(ie?.message||u("project.routines.save_error"))}finally{f(!1)}},F=(()=>{const ie=W.data?.channels||[],xe=["default",...ie.map(Re=>Re.name)];R&&!xe.includes(R)&&xe.push(R);const ke=new Set;return xe.filter(Re=>ke.has(Re)?!1:(ke.add(Re),!0)).map(Re=>{const Ae=ie.find(Oe=>Oe.name===Re),Ie=Ae?.project?`proyecto ${Ae.project}`:Ae?.chat_id?`chat ${Ae.chat_id}`:void 0;return{value:Re,label:Re,description:Ie}})})(),ne=B?Yd(U):[],Z=B?Yd(X):[],fe=(()=>{switch(h){case"exec_agent":return k?u("agents_ui.action_agent_answers",{agent:k}):u("agents_ui.action_agent_pick_answers");case"super_agent":return u("agents_ui.action_super_answers");case"telegram":return u("agents_ui.action_telegram_channel",{channel:R});case"shell":return L?u("agents_ui.summary_runs_cmd",{cmd:L.slice(0,48)}):u("agents_ui.action_runs_shell");case"heartbeat":return u("agents_ui.summary_heartbeat")}})(),Y=h==="telegram"?M:h==="shell"?L:h==="heartbeat"?q:w,oe=Fc()[h].icon,ve=[...ne.map((ie,xe)=>({id:`pre-${xe}`,icon:ya,label:u("agents_ui.step_pre"),detail:ie,action:!1})),{id:"action",icon:oe,label:fe,detail:Y?Y.slice(0,90):u("project.routines.block_empty"),action:!0},...Z.map((ie,xe)=>({id:`post-${xe}`,icon:ya,label:u("agents_ui.step_post"),detail:ie,action:!1}))];return n.jsx(Xt,{open:!!e,onClose:t,title:e?.name?u("project.routines.edit_title",{name:e.name}):u("project.routines.new_title"),description:u("project.routines.dialog_desc"),size:"xl",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:d,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:ee,loading:d,children:u("common.save")})]}),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[n.jsx(Bt,{checked:E,onChange:y,label:u("project.routines.enabled_label")}),n.jsx("span",{className:"text-[11px] text-muted-fg",children:u(E?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),n.jsx(le,{label:u("project.routines.name_field"),hint:e?.name?u("project.routines.name_no_edit"):void 0,children:n.jsx(Ee,{value:m,disabled:!!e?.name,onChange:ie=>g(ie.target.value),placeholder:"resumen-diario"})}),n.jsx(le,{label:u("project.routines.kind_field"),children:n.jsx(ct,{value:h,onChange:ie=>b(ie),options:j7(h)})}),n.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:Fc()[h].desc}),h==="exec_agent"&&n.jsx(le,{label:u("project.routines.agent_field"),hint:u("project.routines.agent_hint"),children:n.jsx(ct,{value:k,onChange:N,placeholder:c.isLoading?u("project.routines.agent_loading"):u("project.routines.agent_pick"),options:(c.data||[]).map(ie=>({value:ie.slug,label:ie.slug,description:[ie.role,ie.model].filter(Boolean).join(" · ")||void 0}))})}),n.jsx(le,{label:u("project.routines.schedule_field"),hint:u("project.routines.schedule_hint"),children:n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex flex-wrap gap-1",children:[k7().map(ie=>n.jsx("button",{type:"button",onClick:()=>j(ie.value),className:ge("rounded-md border px-2 py-0.5 text-[11px]",_===ie.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:ie.label},ie.value)),n.jsx("button",{type:"button",onClick:()=>j("manual"),className:ge("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:u("agents_ui.preset_manual")})]}),n.jsx(Ee,{value:_,onChange:ie=>j(ie.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})}),n.jsx(R7,{})]}),n.jsxs("div",{className:"space-y-3",children:[B&&n.jsx(Oi,{label:u("project.routines.pre_field"),hint:u("project.routines.pre_hint"),rows:2,mono:!0,value:U,onChange:V,vars:bc("pre"),placeholder:"curl -s https://wttr.in/Bariloche"}),h==="exec_agent"&&n.jsx(Oi,{label:u("project.routines.prompt_exec"),rows:4,value:w,onChange:S,vars:bc("prompt"),placeholder:u("project.routines.prompt_exec_ph")}),h==="super_agent"&&n.jsx(Oi,{label:u("project.routines.prompt_super"),rows:4,value:w,onChange:S,vars:bc("prompt"),placeholder:u("project.routines.prompt_super_ph")}),h==="telegram"&&n.jsxs(n.Fragment,{children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("project.routines.tg_channel"),children:n.jsx(ct,{value:R,onChange:A,options:F})}),n.jsx(le,{label:u("project.routines.tg_chat_id"),children:n.jsx(Ee,{value:T,onChange:ie=>z(ie.target.value),placeholder:u("agents_ui.tg_chat_id_ph")})})]}),n.jsx(Oi,{label:u("project.routines.tg_text"),hint:u("project.routines.tg_text_hint"),rows:6,value:M,onChange:P,vars:bc("prompt"),placeholder:u("agents_ui.tg_text_ph")})]}),h==="shell"&&n.jsx(Oi,{label:u("project.routines.shell_field"),hint:u("project.routines.shell_hint"),rows:11,mono:!0,value:L,onChange:I,vars:[],placeholder:"cd /repo && git pull && npm test"}),h==="heartbeat"&&n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("project.routines.hb_channel"),children:n.jsx(Ee,{value:D,onChange:ie=>$(ie.target.value),placeholder:"heartbeat"})}),n.jsx(le,{label:u("project.routines.hb_message"),children:n.jsx(Ee,{value:q,onChange:ie=>G(ie.target.value),placeholder:u("agents_ui.hb_message_ph")})})]}),B&&n.jsx(Oi,{label:u("project.routines.post_field"),hint:u("project.routines.post_hint"),rows:2,mono:!0,value:X,onChange:Q,vars:bc("post"),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})]})]}),n.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[u("project.routines.what_happens")," ",n.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",Q_(_)]})]}),n.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:ve.map((ie,xe)=>n.jsxs("div",{className:"flex items-stretch gap-2",children:[n.jsxs("div",{className:ge("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",ie.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[n.jsxs("div",{className:ge("flex items-center gap-1.5 text-[11px] font-medium",ie.action?"text-emerald-400":"text-muted-fg"),children:[n.jsx(ie.icon,{size:12})," ",ie.label]}),ie.detail&&n.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:ie.detail})]}),xe<ve.length-1&&n.jsx(F2,{size:14,className:"shrink-0 self-center text-muted-fg"})]},ie.id))})]})]})})}function A7({pid:e}){const t=Je(),a=Be(`/api/projects/${e}/routines`,()=>Br.list(e)),[o,i]=qo(),[c,d]=x.useState(null),[f,m]=x.useState(null),[g,h]=x.useState(!1),[b,_]=x.useState(null),[j,E]=x.useState(null),y=a.data||[],k=o.get("r_id"),N=y.find(T=>T.name===k)||null,w=T=>i(z=>{const M=new URLSearchParams(z);return T?M.set("r_id",T):M.delete("r_id"),M},{replace:!0});x.useEffect(()=>{y.length!==0&&(k&&y.some(T=>T.name===k)||w(y[0].name))},[y,k]);const S=async T=>{try{await(T.enabled?Br.disable:Br.enable)(e,T.name),a.mutate()}catch(z){t.error(z?.message||u("project.routines.toggle_error"))}},R=async()=>{if(!b)return;const T=b;_(null),E(T.name);try{await Br.run(e,T.name),t.success(u("project.routines.run_success",{name:T.name})),await Promise.all([a.mutate(),Sf(`/api/projects/${e}/routines/${T.name}/runs`)])}catch(z){t.error(z?.message||u("project.routines.run_error"))}finally{E(null)}},A=async()=>{if(f){h(!0);try{await Br.remove(e,f.name),t.success(u("project.routines.delete_success")),k===f.name&&w(null),m(null),a.mutate()}catch(T){t.error(T?.message||u("project.routines.delete_error"))}finally{h(!1)}}};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[n.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4",children:[n.jsxs("div",{children:[n.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:u("project.routines.title")}),n.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:u("project.routines.subtitle")})]}),n.jsxs(re,{size:"sm",variant:"primary",onClick:()=>d({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[n.jsx(Dt,{size:14})," ",u("project.routines.new_btn")]})]}),a.isLoading&&n.jsx(tt,{}),!a.isLoading&&y.length===0&&n.jsx(ut,{children:u("project.routines.empty")}),y.length>0&&n.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:[n.jsx(w7,{routines:y,selectedName:N?.name??null,onSelect:w}),n.jsx("div",{className:"min-h-0 min-w-0 overflow-hidden",children:N?n.jsx(E7,{pid:e,routine:N,onEdit:()=>d({...N}),onRun:()=>_(N),onToggle:()=>S(N),onDelete:()=>m(N),running:j===N.name},N.name):n.jsx("div",{className:"flex h-full items-center justify-center p-8",children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.routines.detail_empty")})})})]}),n.jsx(T7,{draft:c,onClose:()=>d(null),onSaved:()=>{d(null),a.mutate()},pid:e}),n.jsx(Xt,{open:!!f,onClose:()=>g?null:m(null),title:u("project.routines.delete_confirm",{name:f?.name||""}),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:()=>m(null),disabled:g,children:u("common.cancel")}),n.jsx(re,{variant:"destructive",onClick:A,loading:g,children:u("common.delete")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.routines.delete_confirm_body")})}),n.jsx(Xt,{open:!!b,onClose:()=>_(null),title:u("project.routines.run_confirm",{name:b?.name||""}),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:()=>_(null),children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:R,children:u("common.run")})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.routines.run_confirm_body")})})]})}function Co({label:e,children:t}){return n.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-xs",children:[n.jsx("span",{className:"text-muted-foreground",children:e}),n.jsx("span",{className:"text-right font-mono text-foreground/90",children:t})]})}function M7({pid:e,taskId:t,onClose:a,onChanged:o}){const i=Je(),c=Tn(),{data:d,isLoading:f,mutate:m}=Be(`/api/projects/${e}/tasks/${t}`,()=>Qn.get(e,t)),[g,h]=x.useState(""),[b,_]=x.useState(!1);x.useEffect(()=>{h(d?.body??"")},[d?.id,d?.body]);const j=()=>{m(),o()},E=async w=>{_(!0);try{await w(),j()}catch(S){i.error(S instanceof Error?S.message:String(S))}finally{_(!1)}};if(f)return n.jsx("div",{className:"flex w-80 items-center justify-center border-l border-border",children:n.jsx(bn,{})});if(!d)return null;const y=Af(d),k=d.state==="open",N=g!==(d.body??"");return n.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-l border-border bg-card/40","data-testid":"task-detail",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-4 py-2.5",children:[n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("tasks.detail_title")}),n.jsx("button",{type:"button",onClick:a,"aria-label":u("common.close"),className:"text-muted-foreground hover:text-foreground",children:n.jsx(gs,{className:"size-4"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-4 py-4",children:[n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:u("tasks.field_title")}),n.jsx("div",{className:"text-sm font-semibold",children:d.title})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(B_,{status:y}),n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:d.id})]}),n.jsxs("div",{children:[n.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[n.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:u("tasks.field_prompt")}),N&&n.jsxs("button",{type:"button",onClick:()=>E(async()=>{await Qn.patch(e,d.id,{body:g}),i.success(u("common.saved"))}),className:"flex items-center gap-1 text-[10px] text-emerald-500 hover:text-emerald-400",children:[n.jsx(Kf,{className:"size-3"}),u("files.save")]})]}),n.jsx(un,{rows:4,value:g,onChange:w=>h(w.target.value),placeholder:u("tasks.prompt_ph"),className:"text-xs"})]}),k&&n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:u("tasks.field_status")}),n.jsx(ct,{value:d.status??"pending",onChange:w=>E(()=>Qn.status(e,d.id,w)),options:VN.map(w=>({value:w,label:I_(w)}))})]}),n.jsxs("div",{className:"space-y-1.5 rounded-lg border border-border bg-background/40 p-2.5",children:[d.agent&&n.jsxs(Co,{label:u("tasks.field_agent"),children:["@",d.agent]}),d.created_by&&n.jsx(Co,{label:u("tasks.field_creator"),children:d.created_by}),d.source&&n.jsx(Co,{label:u("tasks.field_source"),children:d.source}),d.due&&n.jsx(Co,{label:u("project.tasks.due"),children:d.due}),n.jsx(Co,{label:u("tasks.field_created"),children:new Date(d.created_at).toLocaleString()}),n.jsx(Co,{label:u("tasks.field_updated"),children:new Date(d.updated_at).toLocaleString()}),d.done_at&&n.jsx(Co,{label:u("tasks.field_done"),children:new Date(d.done_at).toLocaleString()})]}),d.thread&&n.jsxs("button",{type:"button",onClick:()=>c(`/p/${e}/chat?thread=${d.thread}`),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-sky-500/30 bg-sky-500/5 px-3 py-2 text-xs text-sky-500 hover:bg-sky-500/10",children:[n.jsx(mb,{className:"size-3.5"}),u("tasks.view_thread")]})]}),n.jsx("div",{className:"flex shrink-0 gap-2 border-t border-border px-4 py-3",children:k?n.jsxs(n.Fragment,{children:[n.jsxs(re,{size:"sm",variant:"primary",className:"flex-1",loading:b,onClick:()=>E(()=>Qn.done(e,d.id)),children:[n.jsx(Yr,{size:13}),u("tasks.mark_done")]}),n.jsx(re,{size:"sm",variant:"destructive",loading:b,onClick:()=>E(()=>Qn.drop(e,d.id)),"aria-label":u("project.tasks.aria_drop"),children:n.jsx(_n,{size:13})})]}):n.jsxs(re,{size:"sm",variant:"secondary",className:"flex-1",loading:b,onClick:()=>E(()=>Qn.reopen(e,d.id)),children:[n.jsx(fl,{size:13}),u("project.tasks.reopen")]})})]})}function z7({pid:e}){const[t,a]=x.useState("open"),[o,i]=qo(),c=o.get("task"),d=Je(),f=F_({key:`/api/projects/${e}/tasks?state=${t}`,fetchPage:(S,R)=>Qn.listPage(e,{state:t,limit:S,offset:R}),resetKey:t,swr:{dedupingInterval:0,revalidateOnFocus:!0}}),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(!1),[E,y]=x.useState(!1),k=S=>{const R=new URLSearchParams(o);S?R.set("task",S):R.delete("task"),i(R,{replace:!0})},N=async()=>{if(m.trim()){y(!0);try{await Qn.add(e,{title:m.trim(),body:h.trim()||null,source:"web"}),g(""),b(""),j(!1),d.success(u("project.tasks.created")),f.mutate()}catch(S){d.error(S?.message||u("project.tasks.create_error"))}finally{y(!1)}}},w=async(S,R)=>{try{await S(),d.success(R),f.mutate()}catch(A){d.error(A?.message||u("common.error_generic"))}};return n.jsxs(Ve,{fullHeight:!0,title:u("project.tasks.title"),description:u("project.tasks.subtitle"),action:n.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(S=>n.jsx(re,{size:"sm","data-testid":`task-filter-${S}`,variant:t===S?"primary":"ghost",onClick:()=>a(S),children:u(`tasks.state_${S}`)},S))}),children:[n.jsxs("div",{className:"mb-4 shrink-0 space-y-2",children:[n.jsxs("div",{className:"flex items-end gap-2",children:[n.jsx(le,{label:u("project.tasks.add_label"),children:n.jsx(Ee,{"data-testid":"task-input",placeholder:u("project.tasks.add_placeholder"),value:m,onChange:S=>g(S.target.value),onKeyDown:S=>{S.key==="Enter"&&!_&&N()}})}),n.jsxs(re,{variant:"ghost",size:"sm",onClick:()=>j(S=>!S),"aria-label":u("tasks.toggle_prompt"),children:[_?n.jsx(fb,{size:14}):n.jsx(ms,{size:14})," ",u("tasks.field_prompt")]}),n.jsxs(re,{variant:"primary","data-testid":"task-add",onClick:N,loading:E,children:[n.jsx(Dt,{size:14})," ",u("project.tasks.add")]})]}),_&&n.jsx(un,{rows:3,value:h,onChange:S=>b(S.target.value),placeholder:u("tasks.prompt_ph"),className:"text-xs"})]}),n.jsxs("div",{className:"flex min-h-0 flex-1 gap-4",children:[n.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[f.isLoading&&n.jsx(tt,{}),!f.isLoading&&f.total===0&&n.jsxs(ut,{children:[t==="open"?u("project.tasks.empty_open"):u("project.tasks.empty",{state:t})," ",n.jsx("code",{children:'apx task add "…"'})]}),n.jsx(G_,{paged:f,fullHeight:!0,children:n.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:f.items.map(S=>{const R=Af(S);return n.jsxs("li",{"data-testid":`task-${S.id}`,onClick:()=>k(S.id),className:`flex cursor-pointer items-start gap-3 rounded-md border px-3 py-2 hover:border-muted-fg/50 ${c===S.id?"border-primary/50 bg-primary/5":"border-border bg-muted/30"}`,children:[n.jsx(Mf,{status:R,className:"mt-0.5 shrink-0"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"truncate font-medium",children:S.title}),n.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[S.state==="open"&&n.jsx(B_,{status:R}),S.tags?.map(A=>n.jsxs($e,{children:["#",A]},A)),S.agent&&n.jsxs($e,{tone:"info",children:["@",S.agent]}),S.due&&n.jsxs("span",{children:[u("project.tasks.due")," ",S.due]})]})]}),n.jsx("div",{className:"flex shrink-0 gap-1",onClick:A=>A.stopPropagation(),children:S.state==="open"?n.jsxs(n.Fragment,{children:[n.jsx(re,{size:"sm",variant:"secondary","aria-label":u("project.tasks.aria_done"),"data-testid":`task-done-${S.id}`,onClick:()=>w(()=>Qn.done(e,S.id),u("project.tasks.done")),children:n.jsx(Yr,{size:13})}),n.jsx(re,{size:"sm",variant:"destructive","aria-label":u("project.tasks.aria_drop"),"data-testid":`task-drop-${S.id}`,onClick:()=>w(()=>Qn.drop(e,S.id),u("project.tasks.drop")),children:n.jsx(_n,{size:13})})]}):n.jsx(re,{size:"sm",variant:"ghost","aria-label":u("project.tasks.aria_reopen"),"data-testid":`task-reopen-${S.id}`,onClick:()=>w(()=>Qn.reopen(e,S.id),u("project.tasks.reopen")),children:n.jsx(fl,{size:13})})})]},S.id)})})})]}),c&&n.jsx(M7,{pid:e,taskId:c,onClose:()=>k(null),onChanged:()=>f.mutate()})]})]})}const O7="\\$\\{var\\.([^}\\s]+)\\}";function TE(e="g"){return new RegExp(O7,e)}function AE(e){return TE("").test(e)}function D7(e){const t=[];let a=0;for(const o of e.matchAll(TE("g"))){const i=o.index??0;i>a&&t.push({type:"text",value:e.slice(a,i)}),t.push({type:"var",value:o[1]}),a=i+o[0].length}return a<e.length&&t.push({type:"text",value:e.slice(a)}),t}function Sh(e){let t="";for(const a of Array.from(e.childNodes))if(a.nodeType===Node.TEXT_NODE)t+=a.textContent??"";else if(a instanceof HTMLElement){const o=a.dataset.varName;o?t+=`\${var.${o}}`:a.tagName==="BR"?t+="":t+=a.textContent??""}return t.replace(/[\u200B-\u200F\u202A-\u202E\u2060\uFEFF]/g,"").replace(/\u00A0/g," ")}function aw(e,t){e.replaceChildren();const a=D7(t);for(const o of a)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(ME(o.value));(a.length===0||a[a.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function ME(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 P7(e,t){e.deleteContents(),e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(e)}function L7(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!1);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(t)}const W_=x.forwardRef(function({value:t,onChange:a,placeholder:o,className:i,varNames:c=[],onCreateVar:d},f){const m=x.useRef(null),g=x.useRef(null),h=x.useRef(null),[b,_]=x.useState(!1),[j,E]=x.useState(""),y=x.useRef(t);x.useEffect(()=>{const T=m.current;T&&(t===y.current&&T.childNodes.length>0||(aw(T,t),y.current=t))},[t]);const k=x.useCallback(()=>{const T=m.current;if(!T)return;const z=Sh(T);y.current=z,z!==t&&a(z)},[a,t]),N=x.useCallback(()=>{const T=m.current;if(!T)return;const z=Sh(T);if(AE(z)&&B7(T)){const M=$7(T);aw(T,z),M!=null&&U7(T,M)}y.current=Sh(T),y.current!==t&&a(y.current)},[a,t]),w=x.useCallback(()=>{const T=window.getSelection();if(!T||T.rangeCount===0)return;const z=T.getRangeAt(0),M=m.current;M&&M.contains(z.startContainer)&&(h.current=z.cloneRange())},[]),S=x.useCallback(T=>{if(T.key==="Enter"){T.preventDefault(),T.currentTarget.blur();return}if(T.key==="Backspace"){const z=window.getSelection();if(!z||z.rangeCount===0)return;const M=z.getRangeAt(0);if(!M.collapsed)return;const{startContainer:P,startOffset:L}=M;if(P.nodeType===Node.TEXT_NODE&&L===0){const I=P.previousSibling;if(I instanceof HTMLElement&&I.dataset.varName){T.preventDefault(),I.remove(),k();return}}else if(P===m.current){const I=P.childNodes[L-1];if(I instanceof HTMLElement&&I.dataset.varName){T.preventDefault(),I.remove(),k();return}}}},[k]),R=x.useCallback(T=>{const z=m.current;if(!z)return;const M=h.current;z.focus();let P;M&&z.contains(M.startContainer)?P=M:(P=document.createRange(),P.selectNodeContents(z),P.collapse(!1)),P7(P,ME(T)),h.current=null,k()},[k]);x.useImperativeHandle(f,()=>({insertVar:R,focus:()=>m.current?.focus()}),[R]);const A=c.filter(T=>T.toLowerCase().includes(j.toLowerCase()));return n.jsxs("div",{className:ge("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",i),children:[n.jsxs("div",{className:"relative flex-1 min-w-0",children:[n.jsx("div",{ref:m,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:N,onKeyDown:S,onBlur:k,onFocus:w,onMouseUp:w,onKeyUp:w,className:ge("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&&n.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})]}),n.jsxs("div",{ref:g,className:"relative flex",children:[n.jsx(Ue,{content:u("chat_ui.insert_variable"),children:n.jsx("button",{type:"button",onMouseDown:T=>{T.preventDefault(),w()},onClick:()=>_(T=>!T),"aria-label":u("chat_ui.insert_variable"),className:ge("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",b&&"bg-muted/60 text-foreground"),children:n.jsx(Dt,{size:14})})}),b&&n.jsx(I7,{anchorRef:g,query:j,onQuery:E,varNames:A,onPick:T=>{R(T),_(!1),E("")},onClose:()=>{_(!1),E("")},onCreateVar:d})]})]})});function I7({anchorRef:e,query:t,onQuery:a,varNames:o,onPick:i,onClose:c,onCreateVar:d}){const f=x.useRef(null),m=x.useRef(null),[g,h]=x.useState(null),b=x.useCallback(()=>{const _=e.current;if(!_)return;const j=_.getBoundingClientRect(),E=256,y=4,k=8,N=window.innerWidth-E-k,w=Math.max(k,Math.min(j.right-E,N)),S=j.bottom+y,R=f.current?.offsetHeight??260,A=S+R<=window.innerHeight-k?S:Math.max(k,j.top-R-y);h({left:w,top:A,width:E})},[e]);return x.useLayoutEffect(()=>{b()},[b,t,o.length]),x.useEffect(()=>(b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}),[b]),x.useEffect(()=>{m.current?.focus({preventScroll:!0})},[]),x.useEffect(()=>{function _(j){const E=j.target;f.current?.contains(E)||e.current?.contains(E)||c()}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[e,c]),g?Gs.createPortal(n.jsxs("div",{ref:f,style:g,className:"fixed z-[1000] rounded-md border border-border bg-popover shadow-lg",children:[n.jsx("div",{className:"border-b border-border p-2",children:n.jsx("input",{ref:m,value:t,onChange:_=>a(_.target.value),placeholder:u("shared_ui.search_variable_ph"),className:"w-full rounded bg-muted/40 px-2 py-1 text-xs font-mono outline-none"})}),n.jsxs("ul",{className:"max-h-44 overflow-auto p-1 text-xs",children:[o.length===0&&n.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:u("shared_ui.no_matches")}),o.map(_=>n.jsx("li",{children:n.jsx("button",{type:"button",onMouseDown:j=>j.preventDefault(),onClick:()=>i(_),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:_})},_))]}),d&&n.jsx("div",{className:"border-t border-border p-1",children:n.jsxs("button",{type:"button",onMouseDown:_=>_.preventDefault(),onClick:()=>{d(),c()},className:"flex w-full items-center gap-1 rounded px-2 py-1.5 text-left text-xs hover:bg-muted/60",children:[n.jsx(Dt,{size:12})," ",u("shared_ui.create_variable")]})})]}),document.body):null}function B7(e){for(const t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE&&AE(t.textContent??""))return!0;return!1}function $7(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const a=t.getRangeAt(0);if(!e.contains(a.startContainer))return null;const o=a.cloneRange();return o.selectNodeContents(e),o.setEnd(a.startContainer,a.startOffset),o.toString().length}function U7(e,t){const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=t,i=a.nextNode();for(;i;){const c=(i.textContent??"").length;if(o<=c){const d=document.createRange();d.setStart(i,o),d.collapse(!0);const f=window.getSelection();f?.removeAllRanges(),f?.addRange(d);return}o-=c,i=a.nextNode()}L7(e)}function rw(e){return e?Object.entries(e).map(([t,a])=>({key:t,value:String(a)})):[]}function ow(e){const t={};for(const a of e)a.key.trim()&&(t[a.key.trim()]=a.value);return t}function iw({rows:e,onChange:t,keyPlaceholder:a=u("shared_ui.kv_key_ph"),valuePlaceholder:o=u("shared_ui.kv_value_ph"),varNames:i,onCreateVar:c,emptyLabel:d}){const f=(h,b)=>{const _=e.slice();_[h]={..._[h],...b},t(_)},m=h=>t(e.filter((b,_)=>_!==h)),g=()=>t([...e,{key:"",value:""}]);return n.jsxs("div",{className:"space-y-2",children:[e.length===0&&d&&n.jsx("p",{className:"text-[11px] text-muted-foreground",children:d}),e.map((h,b)=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Ee,{value:h.key,onChange:_=>f(b,{key:_.target.value}),placeholder:a,className:"w-40 font-mono text-xs"}),n.jsx("div",{className:"flex-1",children:n.jsx(W_,{value:h.value,onChange:_=>f(b,{value:_}),placeholder:o,varNames:i,onCreateVar:c})}),n.jsx(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(b),"aria-label":u("shared_ui.remove_row"),children:n.jsx(_n,{size:13})})]},b)),n.jsxs(re,{type:"button",size:"sm",variant:"ghost",onClick:g,children:[n.jsx(Dt,{size:12})," ",u("shared_ui.add_row")]})]})}function q7(e){const t=e.raw||{};if(typeof t.description=="string"&&t.description.trim())return t.description.trim();if(e.transport==="http"&&e.url)return e.url.length>64?e.url.slice(0,61)+"…":e.url;const a=[e.command,...e.args||[]].filter(Boolean).join(" ");return a?"$ "+(a.length>64?a.slice(0,61)+"…":a):""}function H7(e,t){return t?.busy?"bg-amber-400 animate-pulse":t?.ok===!1?"bg-red-400":t?.ok?"bg-emerald-400":e?"bg-emerald-500/70":"bg-slate-500"}const V7={apc:"info",runtime:"success",global:"muted"};function Xx(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function Ch(e){return e==="runtime"?u("project.mcps.source_runtime"):e==="apc"?u("project.mcps.source_apc"):e==="claude"?u("project.mcps.source_claude"):e==="codex"?u("project.mcps.source_codex"):e==="cursor"?u("project.mcps.source_cursor"):e==="vscode"?u("project.mcps.source_vscode"):e==="roo"?u("project.mcps.source_roo"):e==="gemini"?u("project.mcps.source_gemini"):e==="global"?u("project.mcps.scope_global"):e}function F7({pid:e}){const t=Je(),a=Be(`/api/projects/${e}/mcps`,()=>$r.list(e)),o=Be(`/api/projects/${e}/mcps/check`,()=>$r.check(e)),i=Be(`/api/projects/${e}/vars`,()=>qc.list(e)),[c,d]=x.useState(null),[f,m]=x.useState(null),[g,h]=x.useState({}),[b,_]=x.useState({}),j=x.useMemo(()=>i.data?Object.keys(i.data.effective).sort():[],[i.data]),E=async(N,w)=>{if(confirm(u("project.mcps.delete_confirm",{name:N,scope:w})))try{await $r.remove(e,N,w),t.success(u("project.mcps.removed")),a.mutate(),f===N&&m(null)}catch(S){t.error(S?.message||u("common.error_generic"))}},y=async N=>{try{await $r.add(e,Xx(N.source),{name:N.name,enabled:!N.enabled}),a.mutate()}catch(w){t.error(w?.message||u("common.error_generic"))}},k=async N=>{m(N),h(w=>({...w,[N]:{busy:!0}})),_(w=>({...w,[N]:!0}));try{const w=await $r.test(e,N);h(S=>({...S,[N]:{ok:w.ok,error:w.error,tools:w.tools}}))}catch(w){h(S=>({...S,[N]:{ok:!1,error:w?.message||"error"}}))}};return n.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[n.jsx("div",{className:"lg:col-span-3",children:n.jsxs(Ve,{title:u("project.mcps.title"),description:u("project.mcps.subtitle"),action:n.jsxs(re,{size:"sm",variant:"primary",onClick:()=>d({kind:"new"}),children:[n.jsx(Dt,{size:14})," ",u("project.mcps.new")]}),children:[o.data?.conflicts?.length?n.jsxs("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:[n.jsx("div",{className:"font-medium",children:u("project.mcps.conflicts",{names:o.data.conflicts.map(N=>N.name).join(", ")})}),n.jsx("ul",{className:"mt-1 space-y-1 text-muted-fg",children:o.data.conflicts.map(N=>n.jsxs("li",{className:"flex gap-2",children:[n.jsx("span",{"aria-hidden":"true",children:"•"}),n.jsx("span",{children:u("project.mcps.conflict_detail",{name:N.name,winner:Ch(N.winner),loser:Ch(N.loser)})})]},`${N.name}-${N.winner}-${N.loser}`))})]}):null,a.isLoading&&n.jsx(tt,{}),!a.isLoading&&(a.data?.length??0)===0&&n.jsx(ut,{children:u("project.mcps.empty")}),n.jsx("ul",{className:"space-y-2 text-sm",children:(a.data||[]).map(N=>{const w=N.source==="apc"||N.source==="runtime"||N.source==="global",S=Xx(N.source),R=f===N.name,A=N.enabled!==!1,T=g[N.name],z=T?.tools||[],M=!!b[N.name],P=q7(N),L=N.transport==="http"?tS:lM;return n.jsx("li",{className:"rounded-md border px-3 py-2 transition-colors "+(R?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>m(N.name),role:"button",children:n.jsxs("div",{className:"flex items-start gap-3",children:[n.jsxs("div",{className:"relative mt-0.5 flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg border border-border bg-background",children:[n.jsx(L,{size:16,className:"text-muted-fg"}),n.jsx("span",{className:ge("absolute -bottom-0.5 -right-0.5 h-2.5 w-2.5 rounded-full border-2 border-card",H7(A,T))})]}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"font-medium",children:N.name}),n.jsx($e,{tone:V7[N.source]??"muted",children:Ch(N.source)}),n.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(N.transport||"stdio").toUpperCase()}),n.jsx("div",{onClick:I=>I.stopPropagation(),children:n.jsx(Bt,{checked:A,onChange:()=>y(N),label:""})}),n.jsx(Ue,{content:u("project.mcps.test_btn"),children:n.jsx(re,{size:"sm",variant:"ghost",onClick:I=>{I.stopPropagation(),k(N.name)},"aria-label":u("project.mcps.test_btn"),children:T?.busy?n.jsx(cx,{size:13,className:"animate-pulse"}):n.jsx(cx,{size:13})})}),n.jsx(Ue,{content:u("project.mcps.logs_btn"),children:n.jsx(re,{size:"sm",variant:"ghost",onClick:I=>{I.stopPropagation(),m(N.name)},"aria-label":u("project.mcps.logs_btn"),children:n.jsx(jb,{size:13})})}),w&&n.jsx(Ue,{content:u("project.mcps.edit_btn"),children:n.jsx(re,{size:"sm",variant:"ghost",onClick:I=>{I.stopPropagation(),d({kind:"edit",entry:N})},"aria-label":u("project.mcps.edit_btn"),children:n.jsx(wa,{size:13})})}),w&&n.jsx(re,{size:"sm",variant:"destructive",onClick:I=>{I.stopPropagation(),E(N.name,S)},children:n.jsx(_n,{size:13})})]}),P&&n.jsx("p",{className:"mt-0.5 truncate font-mono text-xs text-muted-fg",children:P}),T?.ok===!1&&T.error&&n.jsxs("p",{className:"mt-1 flex items-start gap-1 text-xs text-red-400",children:[n.jsx(Y2,{size:12,className:"mt-0.5 flex-shrink-0"})," ",n.jsx("span",{className:"break-words",children:T.error})]}),z.length>0&&n.jsxs("div",{className:"mt-1.5",onClick:I=>I.stopPropagation(),children:[n.jsxs("button",{type:"button",onClick:()=>_(I=>({...I,[N.name]:!I[N.name]})),className:"flex items-center gap-1 text-xs text-muted-fg transition-colors hover:text-fg",children:[n.jsx(aa,{size:12})," ",u("project.mcps.tools_count",{n:z.length}),n.jsx(ms,{size:12,className:ge("transition-transform",M&&"rotate-180")})]}),M&&n.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[z.slice(0,40).map(I=>n.jsx(Ue,{content:I.description||"—",children:n.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[10px] text-muted-fg",children:[n.jsx(ya,{size:10})," ",I.name]})},I.name)),z.length>40&&n.jsxs("span",{className:"text-[10px] text-muted-fg",children:["… +",z.length-40]})]})]})]})]})},`${N.source}-${N.name}`)})}),c&&n.jsx(Y7,{mode:c,pid:e,varNames:j,onClose:()=>d(null),onSaved:()=>{d(null),a.mutate()},onVarsChanged:()=>i.mutate()})]})}),n.jsx("div",{className:"lg:col-span-1",children:n.jsx(G7,{pid:e,mcpName:f,runningTest:!!(f&&g[f]?.busy)})})]})}function G7({pid:e,mcpName:t,runningTest:a}){const[o,i]=x.useState(null),[c,d]=x.useState(null),f=x.useRef(null);x.useEffect(()=>{if(!t){i(null),d(null);return}f.current!==t&&(i(null),d(null),f.current=t);let g=!1;const h=async()=>{try{const j=await $r.logs(e,t);g||(i(j),d(null))}catch(j){g||d(j?.message||"error")}};h();const _=setInterval(h,a?1200:4e3);return()=>{g=!0,clearInterval(_)}},[e,t,a]);const m=x.useRef(null);return x.useEffect(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[o?.events?.length,o?.stderr_tail]),n.jsxs("div",{className:"sticky top-3 flex h-[calc(100vh-7rem)] min-h-[24rem] flex-col rounded-xl border border-border bg-card",children:[n.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs",children:[n.jsx(ya,{size:13,className:"text-muted-fg"}),n.jsx("span",{className:"font-medium",children:u("project.mcps.logs_panel_title")}),t?n.jsx($e,{tone:"info",children:t}):n.jsxs("span",{className:"text-muted-fg",children:["— ",u("project.mcps.logs_panel_pick")]})]}),n.jsxs("div",{ref:m,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!t&&n.jsx("p",{className:"text-muted-fg",children:u("project.mcps.logs_panel_hint")}),t&&c&&n.jsx("p",{className:"text-red-400",children:c}),t&&!c&&o&&n.jsxs(n.Fragment,{children:[n.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&&n.jsx("p",{className:"text-muted-fg",children:o.note}),(!o.events||o.events.length===0)&&!o.stderr_tail&&!o.note&&n.jsx("p",{className:"text-muted-fg",children:u("project.mcps.logs_panel_idle")}),o.events?.map((g,h)=>n.jsxs("div",{className:"flex gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:g.ts.slice(11,19)}),n.jsx("span",{className:g.level==="error"?"text-red-400":g.level==="stderr"?"text-amber-400":"text-emerald-400",children:g.level}),n.jsx("span",{className:"flex-1 break-all",children:g.msg})]},h)),o.stderr_tail&&n.jsxs("div",{className:"mt-2 border-t border-border/60 pt-2",children:[n.jsx("div",{className:"mb-1 text-muted-fg",children:"stderr"}),n.jsx("pre",{className:"whitespace-pre-wrap break-all text-amber-300/80",children:o.stderr_tail})]})]})]})]})}function Y7({mode:e,pid:t,varNames:a,onClose:o,onSaved:i,onVarsChanged:c}){const d=Je(),f=e.kind==="edit",m=f?e.entry:null,[g,h]=x.useState(!1),[b,_]=x.useState(m?Xx(m.source):"runtime"),[j,E]=x.useState(m?.name||""),[y,k]=x.useState(m?.transport==="http"||m?.url?"http":"stdio"),[N,w]=x.useState(m?.command||""),[S,R]=x.useState(m?.args&&m.args.length?m.args:[""]),[A,T]=x.useState(rw(m?.env)),[z,M]=x.useState(m?.url||""),[P,L]=x.useState(rw(m?.headers)),[I,D]=x.useState(m?.enabled!==!1),[$,q]=x.useState(!1),G=async()=>{if(!j.trim()){d.error(u("project.mcps.name_required"));return}h(!0);try{const U=S.map(X=>X.trim()).filter(Boolean),V=y==="stdio"?{name:j.trim(),command:N.trim(),args:U.length?U:void 0,env:A.length?ow(A):void 0,enabled:I}:{name:j.trim(),url:z.trim(),headers:P.length?ow(P):void 0,enabled:I};await $r.add(t,b,V),d.success(u(f?"project.mcps.updated":"project.mcps.added")),i()}catch(U){d.error(U?.message||u("common.error_generic"))}finally{h(!1)}};return n.jsxs(n.Fragment,{children:[n.jsx(Xt,{open:!0,onClose:()=>g?null:o(),title:u(f?"project.mcps.edit_title":"project.mcps.new_title"),description:f?m?.name:u("project.mcps.new_desc"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:o,disabled:g,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:G,loading:g,children:u(f?"project.mcps.save_btn":"project.mcps.add_btn")})]}),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("project.mcps.scope_label"),children:n.jsx(ct,{value:b,onChange:U=>_(U),options:[{value:"runtime",label:u("project.mcps.scope_runtime"),description:u("project.mcps.scope_runtime_desc")},{value:"shared",label:u("project.mcps.scope_shared"),description:u("project.mcps.scope_shared_desc")},{value:"global",label:u("project.mcps.scope_global"),description:u("project.mcps.scope_global_desc")}]})}),n.jsx(le,{label:u("project.mcps.transport_label"),children:n.jsx(ct,{value:y,onChange:U=>k(U),options:[{value:"stdio",label:u("project.mcps.transport_stdio"),description:u("project.mcps.transport_stdio_desc")},{value:"http",label:u("project.mcps.transport_http"),description:u("project.mcps.transport_http_desc")}]})})]}),n.jsx(le,{label:u("project.mcps.name_label"),children:n.jsx(Ee,{value:j,onChange:U=>E(U.target.value),placeholder:u("project.mcps.name_ph"),disabled:f})}),y==="stdio"?n.jsxs(n.Fragment,{children:[n.jsx(le,{label:u("project.mcps.cmd_label"),children:n.jsx(Ee,{value:N,onChange:U=>w(U.target.value),placeholder:u("project.mcps.cmd_ph")})}),n.jsx(le,{label:u("project.mcps.args_label"),hint:u("project.mcps.args_hint_tokens"),children:n.jsx(K7,{args:S,onChange:R,varNames:a,onCreateVar:()=>q(!0)})}),n.jsx(le,{label:u("project.mcps.env_label"),hint:u("project.mcps.env_hint_tokens"),children:n.jsx(iw,{rows:A,onChange:T,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:a,onCreateVar:()=>q(!0),emptyLabel:u("project.mcps.env_empty")})})]}):n.jsxs(n.Fragment,{children:[n.jsx(le,{label:u("project.mcps.url_label"),children:n.jsx(W_,{value:z,onChange:M,placeholder:u("project.mcps.url_ph"),varNames:a,onCreateVar:()=>q(!0)})}),n.jsx(le,{label:u("project.mcps.headers_label"),hint:u("project.mcps.headers_hint"),children:n.jsx(iw,{rows:P,onChange:L,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:a,onCreateVar:()=>q(!0),emptyLabel:u("project.mcps.headers_empty")})})]}),n.jsx(Bt,{checked:I,onChange:D,label:u("project.mcps.enabled_label")})]})}),$&&n.jsx(X7,{pid:t,onClose:()=>q(!1),onCreated:()=>{q(!1),c()}})]})}function K7({args:e,onChange:t,varNames:a,onCreateVar:o}){const i=(f,m)=>{const g=e.slice();g[f]=m,t(g)},c=f=>t(e.filter((m,g)=>g!==f)),d=()=>t([...e,""]);return n.jsxs("div",{className:"space-y-2",children:[e.map((f,m)=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx("div",{className:"flex-1",children:n.jsx(W_,{value:f,onChange:g=>i(m,g),placeholder:u("agents_ui.arg_placeholder"),varNames:a,onCreateVar:o})}),n.jsx(re,{type:"button",size:"sm",variant:"ghost",onClick:()=>c(m),"aria-label":u("agents_ui.remove_arg"),children:n.jsx(_n,{size:13})})]},m)),n.jsxs(re,{type:"button",size:"sm",variant:"ghost",onClick:d,children:[n.jsx(Dt,{size:12})," ",u("project.mcps.add_arg")]})]})}function X7({pid:e,onClose:t,onCreated:a}){const o=Je(),i=String(e)==="0",[c,d]=x.useState(""),[f,m]=x.useState(""),[g,h]=x.useState(!1),[b,_]=x.useState(i?"global":"project"),j=async()=>{if(!c.trim()){o.error(u("project.vars.name_required"));return}if(!f){o.error(u("project.vars.value_required"));return}h(!0);try{await qc.upsert(e,{name:c.trim(),value:f,scope:b}),o.success(u("project.vars.added")),a()}catch(E){o.error(E?.message||u("common.error_generic"))}finally{h(!1)}};return n.jsx(Xt,{open:!0,onClose:()=>g?null:t(),title:u("project.vars.new_title"),description:u("project.vars.new_desc"),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:g,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:j,loading:g,children:u("project.vars.add_btn")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("project.vars.scope_label"),children:n.jsx(ct,{value:b,onChange:E=>_(E),options:[...i?[]:[{value:"project",label:u("project.vars.scope_project"),description:u("project.vars.scope_project_desc")}],{value:"global",label:u("project.vars.scope_global"),description:u("project.vars.scope_global_desc")}]})}),n.jsx(le,{label:u("project.vars.name_label"),hint:u("project.vars.name_hint"),children:n.jsx(Ee,{value:c,onChange:E=>d(E.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),n.jsx(le,{label:u("project.vars.value_label"),hint:u("project.vars.value_hint"),children:n.jsx(Ee,{type:"password",value:f,onChange:E=>m(E.target.value),className:"font-mono text-xs"})})]})})}function zE({icon:e,title:t,description:a,badges:o,rightContent:i,hasTools:c,expanded:d,onToggle:f,children:m}){return n.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:[n.jsxs("button",{type:"button",className:"flex w-full items-center gap-4 p-4 text-left transition-colors hover:bg-muted/40",onClick:f,children:[e,n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("p",{className:"text-sm font-semibold text-foreground",children:t}),o,c&&n.jsx(Ue,{content:"Esta integración expone tools para los agentes",children:n.jsx("span",{children:n.jsx(aa,{className:"h-3 w-3 text-muted-foreground"})})})]}),n.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:a})]}),n.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2",children:[i,n.jsx(Zr,{className:ge("h-4 w-4 text-muted-foreground transition-transform",d&&"rotate-90")})]})]}),d&&m&&n.jsx("div",{className:"border-t border-border",children:m})]})}function Q7({tools:e,isActive:t}){return t?n.jsxs("div",{className:"space-y-2.5 rounded-xl border border-border bg-muted/30 p-3",children:[n.jsx("div",{className:"flex items-center justify-between",children:n.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("integrations.tools_for_agents")})}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(a=>n.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg border border-border bg-background px-2 py-1",children:[n.jsx(aa,{className:"h-2.5 w-2.5 flex-shrink-0 text-muted-foreground"}),n.jsx("span",{className:"font-mono text-[10px] text-foreground",children:a.slug}),n.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"·"}),n.jsx("span",{className:"text-[10px] text-muted-foreground",children:a.desc})]},a.slug))}),n.jsx("p",{className:"text-[10px] text-muted-foreground/70",children:u("integrations.tools_available_note")})]}):null}function W7({value:e,onChange:t,onEnter:a,placeholder:o,ringClassName:i,btnClassName:c}){const[d,f]=x.useState(!1),[m,g]=x.useState(""),[h,b]=x.useState([]),[_,j]=x.useState(null),[E,y]=x.useState(""),[k,N]=x.useState(!1),w=async R=>{N(!0),y("");try{const A=await Ef.dirs(R||"~");g(A.path),t(A.path),j(A.parent),b(A.entries)}catch(A){y(A.message)}finally{N(!1)}},S=async()=>{N(!0);try{const R=await Ef.pickDir(u("add_project.picker_prompt"));if("cancelled"in R)return;t(R.path)}catch{f(!0),await w(e||"~")}finally{N(!1)}};return n.jsxs("div",{className:"space-y-2",children:[n.jsxs("div",{className:"flex gap-2",children:[n.jsx("input",{type:"text",placeholder:o,value:e,onChange:R=>t(R.target.value),onKeyDown:R=>R.key==="Enter"&&a?.(),className:ge("w-full rounded-lg border border-border bg-background px-3 py-2 font-mono text-xs outline-none placeholder:text-muted-foreground/60",i)}),n.jsxs("button",{type:"button",onClick:S,disabled:k,className:ge("flex flex-shrink-0 items-center gap-1.5 rounded-lg border px-3 py-2 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",c),children:[k?n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"}):n.jsx(qi,{className:"h-3.5 w-3.5"}),u("add_project.search_btn")]})]}),d&&n.jsxs("div",{className:"rounded-lg border border-border bg-muted/20",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[n.jsx("span",{className:"truncate font-mono text-[10px] text-muted-foreground",children:m||e||"~"}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx("button",{type:"button",onClick:()=>w("~"),disabled:k,className:"rounded p-1 hover:bg-accent disabled:opacity-50",children:n.jsx(nS,{className:"h-3 w-3"})}),n.jsx("button",{type:"button",onClick:()=>_&&w(_),disabled:!_||k,className:"rounded px-1.5 py-0.5 text-[10px] hover:bg-accent disabled:opacity-50",children:".."}),n.jsx("button",{type:"button",onClick:()=>f(!1),disabled:k,className:"rounded p-1 hover:bg-accent disabled:opacity-50",children:n.jsx(gs,{className:"h-3 w-3"})})]})]}),n.jsxs("div",{className:"max-h-56 overflow-y-auto p-2",children:[k&&n.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 text-[11px] text-muted-foreground",children:[n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"})," ",u("common.loading")]}),!k&&E&&n.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:u("add_project.browser_unavailable")}),!k&&!E&&h.length===0&&n.jsx("p",{className:"px-2 py-1.5 text-[11px] text-muted-foreground",children:u("add_project.no_folders")}),!k&&!E&&h.map(R=>n.jsxs("button",{type:"button",onClick:()=>w(R),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-xs hover:bg-accent",children:[n.jsx(Ho,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),n.jsx("span",{className:"truncate",children:R.split("/").pop()}),n.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-foreground",children:R})]},R))]})]})]})}const Qs=(e,t)=>u(e,t);function lw({on:e,onChange:t,disabled:a,accent:o}){return n.jsx("button",{type:"button",role:"switch","aria-checked":e,disabled:a,onClick:()=>t(!e),className:ge("relative inline-flex h-5 w-9 flex-shrink-0 items-center rounded-full border transition-colors disabled:cursor-not-allowed disabled:opacity-50",e?ge("bg-emerald-500/30",o.border):"border-border bg-muted"),children:n.jsx("span",{className:ge("inline-block h-3.5 w-3.5 transform rounded-full bg-foreground transition-transform",e?"translate-x-4":"translate-x-0.5")})})}const cw={rose:{text:"text-rose-400",border:"border-rose-700/50",hover:"hover:bg-rose-900/20",ring:"focus:border-rose-500/50",wrap:"border-rose-500/30 from-rose-500/20 to-pink-500/20"},slate:{text:"text-slate-200",border:"border-slate-600/60",hover:"hover:bg-slate-700/30",ring:"focus:border-slate-400/60",wrap:"border-slate-500/30 from-slate-500/20 to-slate-700/20"},purple:{text:"text-purple-400",border:"border-purple-700/50",hover:"hover:bg-purple-900/20",ring:"focus:border-purple-500/50",wrap:"border-purple-500/30 from-purple-500/20 to-violet-500/20"}};function Z7(e,t){return e==="github"?n.jsx(eS,{className:ge("h-6 w-6",t.text)}):e==="asana"?n.jsx(SL,{className:ge("h-6 w-6",t.text)}):e==="obsidian"?n.jsx(UN,{className:ge("h-6 w-6",t.text)}):n.jsx("span",{className:ge("text-lg",t.text),children:"◆"})}function J7({pid:e,scope:t,entry:a}){const o=a.ui,i=cw[o.accent||"rose"]||cw.rose,[c,d]=x.useState(!1),[f,m]=x.useState({}),[g,h]=x.useState({}),[b,_]=x.useState(null),[j,E]=x.useState("idle"),[y,k]=x.useState(null),[N,w]=x.useState([]),[S,R]=x.useState(""),[A,T]=x.useState(null),[z,M]=x.useState(null),{data:P,mutate:L,isLoading:I}=Be(`integration-status-${a.slug}-${e}-${t}`,()=>Yn.status(e,a.slug,t),{shouldRetryOnError:!1}),D=P?.status==="active"&&P.is_enabled===!0,$=j==="saving"||j==="validating",q=!D&&N.length===0,G=o.configFields.filter(F=>F.type==="toggle"),V=o.configFields.filter(F=>F.type!=="toggle").some(F=>!f[F.key]?.trim());async function X(){if(!V){E("saving"),k(null);try{const F={...f};for(const Z of G)F[Z.key]===void 0&&(F[Z.key]=Z.default?"true":"false");await Yn.configure(e,a.slug,t,F),E("validating");const ne=await Yn.validate(e,a.slug,t);if(await L(),o.select&&!ne[o.select.key]){const fe=(await Yn.action(e,a.slug,o.select.action,t))[o.select.listKey]||[];fe.length>1&&w(fe.map(Y=>({value:String(Y[o.select.valueKey]),label:String(Y[o.select.labelKey])})))}E("done"),m({})}catch(F){k(F instanceof Error?F.message:u("integrations.err_connect")),E("idle")}}}async function Q(){if(!(!S||!o.select)){E("saving"),k(null);try{await Yn.configure(e,a.slug,t,{[o.select.key]:S}),await Yn.validate(e,a.slug,t),await L(),w([]),E("done")}catch(F){k(F instanceof Error?F.message:u("integrations.err_generic")),E("idle")}}}async function W(){k(null);try{await Yn.deactivate(e,a.slug,t),await L()}catch(F){k(F instanceof Error?F.message:u("integrations.err_generic"))}}async function B(F,ne){k(null),M(null);try{await Yn.configure(e,a.slug,t,{[F]:ne?"true":"false"}),await Yn.validate(e,a.slug,t),await L()}catch(Z){k(Z instanceof Error?Z.message:u("integrations.err_generic"))}}async function K(F){k(null),M(null),T(F);try{const ne=await Yn.action(e,a.slug,F,t);typeof ne?.count=="number"?M(Qs(`integrations.${a.slug}.actions.${F}_done`,{count:ne.count,changed:Number(ne.changed??0)})):M(u("integrations.action_done")),await L()}catch(ne){k(ne instanceof Error?ne.message:u("integrations.err_generic"))}finally{T(null)}}const ee=I?"…":D?u("integrations.status_active"):P?.status==="error"?u("integrations.status_error"):u("integrations.status_unconfigured");return n.jsx(zE,{icon:n.jsx("div",{className:ge("flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-2xl border bg-gradient-to-br",i.wrap),children:Z7(a.slug,i)}),title:a.name,description:a.description,hasTools:(a.tools?.length??0)>0,badges:n.jsxs("span",{className:ge("flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px]",D?"border-emerald-700 bg-emerald-900/20 text-emerald-400":"border-border bg-muted text-muted-foreground"),children:[n.jsx("span",{className:ge("h-1.5 w-1.5 rounded-full",D?"bg-emerald-400":"bg-muted-foreground")}),ee]}),expanded:c,onToggle:()=>d(F=>!F),children:n.jsxs("div",{className:"space-y-4 p-4",children:[y&&n.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-700/30 bg-red-900/20 px-3 py-2.5 text-xs text-red-300",children:[n.jsx(EA,{className:"h-3.5 w-3.5 flex-shrink-0"}),n.jsx("span",{className:"flex-1",children:y}),n.jsx("button",{onClick:()=>k(null),children:n.jsx(gs,{className:"h-3.5 w-3.5"})})]}),D&&N.length===0&&n.jsxs("div",{className:"space-y-1 rounded-xl border border-emerald-700/30 bg-emerald-900/10 p-3",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Vf,{className:"h-3.5 w-3.5 text-emerald-400"}),n.jsx("span",{className:"text-xs font-medium text-emerald-300",children:u("integrations.connected")})]}),(o.connectedFields||[]).map(F=>{const ne=P?.[F];return ne?n.jsxs("p",{className:"pl-5 text-[10px] text-muted-foreground",children:[Qs(`integrations.${a.slug}.connected.${F}`),": ",String(ne)]},F):null})]}),D&&N.length===0&&G.length>0&&n.jsx("div",{className:"space-y-2 rounded-xl border border-border p-3",children:G.map(F=>n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-[11px] font-medium text-foreground",children:Qs(`integrations.${a.slug}.fields.${F.key}.label`)}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:Qs(`integrations.${a.slug}.fields.${F.key}.hint`)})]}),n.jsx(lw,{on:!!P?.[F.key],accent:i,onChange:ne=>B(F.key,ne)})]},F.key))}),D&&N.length===0&&(o.actions?.length??0)>0&&n.jsxs("div",{className:"space-y-2",children:[z&&n.jsx("p",{className:"text-[11px] text-emerald-400",children:z}),n.jsx("div",{className:"flex flex-wrap gap-2",children:o.actions.map(F=>n.jsxs("button",{onClick:()=>K(F.action),disabled:A===F.action,className:ge("flex items-center gap-1.5 rounded-lg border px-3 py-1.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",i.border,i.text,i.hover),children:[A===F.action?n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"}):n.jsx(Cs,{className:"h-3.5 w-3.5"}),Qs(`integrations.${a.slug}.actions.${F.action}`)]},F.action))})]}),N.length>1&&o.select&&n.jsxs("div",{className:"space-y-2",children:[n.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[Qs(`integrations.${a.slug}.select_label`),":"]}),n.jsxs("div",{className:"flex gap-2",children:[n.jsxs("select",{value:S,onChange:F=>R(F.target.value),className:ge("flex-1 rounded-lg border border-border bg-background px-2 py-1.5 text-xs outline-none",i.ring),children:[n.jsx("option",{value:"",children:u("integrations.select_placeholder")}),N.map(F=>n.jsx("option",{value:F.value,children:F.label},F.value))]}),n.jsx("button",{onClick:Q,disabled:!S||$,className:ge("rounded-lg border px-3 py-1.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",i.border,i.text,i.hover),children:$?n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"}):u("integrations.confirm")})]})]}),q&&n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-xs font-semibold text-foreground",children:u("integrations.credentials",{name:a.name})}),o.configFields.map(F=>{if(F.type==="toggle"){const ne=f[F.key]!==void 0?f[F.key]==="true":!!F.default;return n.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border px-3 py-2",children:[n.jsxs("div",{children:[n.jsx("p",{className:"text-[11px] font-medium text-foreground",children:Qs(`integrations.${a.slug}.fields.${F.key}.label`)}),n.jsx("p",{className:"text-[10px] text-muted-foreground",children:Qs(`integrations.${a.slug}.fields.${F.key}.hint`)})]}),n.jsx(lw,{on:ne,accent:i,onChange:Z=>m(fe=>({...fe,[F.key]:Z?"true":"false"}))})]},F.key)}return n.jsxs("div",{className:"space-y-2",children:[F.help_url&&n.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[n.jsxs("button",{type:"button",onClick:()=>_(ne=>ne===F.key?null:F.key),className:"flex w-full items-center justify-between px-3 py-2 text-left transition-colors hover:bg-muted/40",children:[n.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[Qs(`integrations.${a.slug}.fields.${F.key}.help_label`)," ·"," ",n.jsxs("a",{href:F.help_url,target:"_blank",rel:"noreferrer",onClick:ne=>ne.stopPropagation(),className:ge("inline-flex items-center gap-0.5 hover:underline",i.text),children:[F.help_url_label," ",n.jsx(mb,{className:"h-2.5 w-2.5"})]})]}),n.jsx(ms,{className:ge("h-3.5 w-3.5 flex-shrink-0 text-muted-foreground transition-transform",b===F.key&&"rotate-180")})]}),b===F.key&&n.jsx("div",{className:"space-y-1.5 border-t border-border px-3 pb-3 pt-2.5",children:Qs(`integrations.${a.slug}.fields.${F.key}.help_steps`).split(`
799
- `).map((ne,Z)=>n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsxs("span",{className:ge("mt-0.5 flex-shrink-0 font-mono text-[10px]",i.text),children:[Z+1,"."]}),n.jsx("p",{className:"text-[11px] text-muted-foreground",children:ne})]},Z))})]}),n.jsxs("div",{children:[n.jsx("label",{className:"mb-1 block text-[10px] text-muted-foreground",children:Qs(`integrations.${a.slug}.fields.${F.key}.label`)}),F.type==="path"?n.jsx(W7,{value:f[F.key]||"",onChange:ne=>m(Z=>({...Z,[F.key]:ne})),onEnter:X,placeholder:F.placeholder,ringClassName:i.ring,btnClassName:ge(i.border,i.text,i.hover)}):n.jsxs("div",{className:"relative",children:[n.jsx("input",{type:F.type==="password"&&!g[F.key]?"password":"text",placeholder:F.placeholder,value:f[F.key]||"",onChange:ne=>m(Z=>({...Z,[F.key]:ne.target.value})),onKeyDown:ne=>ne.key==="Enter"&&X(),className:ge("w-full rounded-lg border border-border bg-background px-3 py-2 font-mono text-xs outline-none placeholder:text-muted-foreground/60",F.type==="password"&&"pr-14",i.ring)}),F.type==="password"&&n.jsxs("button",{type:"button",onClick:()=>h(ne=>({...ne,[F.key]:!ne[F.key]})),className:"absolute right-2.5 top-1/2 flex -translate-y-1/2 items-center gap-0.5 text-[10px] text-muted-foreground transition-colors hover:text-foreground",children:[g[F.key]?n.jsx(Q2,{className:"h-3 w-3"}):n.jsx(Wc,{className:"h-3 w-3"}),g[F.key]?u("integrations.hide"):u("integrations.reveal")]})]})]})]},F.key)}),j==="validating"&&n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"})," ",u("integrations.verifying")]}),n.jsx("button",{onClick:X,disabled:V||$,className:ge("flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",i.border,i.text,i.hover),children:$?n.jsxs(n.Fragment,{children:[n.jsx(Js,{className:"h-3.5 w-3.5 animate-spin"}),u(j==="saving"?"integrations.saving":"integrations.validating")]}):u("integrations.connect")})]}),a.tools&&a.tools.length>0&&n.jsx(Q7,{pid:e,tools:a.tools,isActive:D}),D&&n.jsx("div",{className:"flex justify-end border-t border-border pt-2",children:n.jsxs("button",{onClick:W,className:"flex items-center gap-1.5 rounded-lg border border-red-700/50 px-3 py-1.5 text-xs text-red-400 transition-all hover:bg-red-900/20",children:[n.jsx(wM,{className:"h-3.5 w-3.5"})," ",u("integrations.deactivate")]})})]})})}const e9={github:{icon:eS,className:"text-slate-200",wrap:"border-slate-500/30 from-slate-500/20 to-slate-700/20"},whatsapp:{icon:CL,className:"text-[#25D366]",wrap:"border-[#25D366]/30 from-[#25D366]/20 to-[#128C7E]/20"},"local-transcription":{icon:_b,className:"text-orange-400",wrap:"border-orange-500/30 from-orange-500/20 to-amber-500/20"}};function t9({entry:e}){const[t,a]=x.useState(!1),o=e9[e.slug]||{icon:Yf,className:"text-muted-foreground",wrap:"border-border from-muted to-muted"},i=o.icon;return n.jsx(zE,{icon:n.jsx("div",{className:`flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-2xl border bg-gradient-to-br ${o.wrap}`,children:n.jsx(i,{className:`h-6 w-6 ${o.className}`})}),title:e.name,description:e.description,badges:n.jsx("span",{className:"rounded-full border border-border bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:u("integrations.coming_soon")}),expanded:t,onToggle:()=>a(c=>!c),children:n.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:u("integrations.coming_soon_body")})})}const n9=[{value:"plugins",labelKey:"integrations.tab_plugins",icon:Yf},{value:"tools",labelKey:"integrations.tab_tools",icon:aa}];function s9({pid:e,scope:t,entry:a}){return a.coming_soon||!a.ui?n.jsx(t9,{entry:a}):n.jsx(J7,{pid:e,scope:t,entry:a})}function a9({pid:e,scope:t}){const{data:a,isLoading:o}=Be(`integrations-catalog-${e}`,()=>Yn.catalog(e));return n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:u("integrations.plugins_hint")}),o&&n.jsx(tt,{}),(a||[]).map(i=>n.jsx(s9,{pid:e,scope:t,entry:i},i.slug)),n.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center",children:n.jsx("p",{className:"text-sm text-muted-foreground",children:u("integrations.more_soon")})})]})}function r9({pid:e}){const{data:t}=Be(`integrations-catalog-${e}`,()=>Yn.catalog(e)),a=(t||[]).filter(o=>!o.coming_soon&&(o.tools?.length??0)>0).flatMap(o=>(o.tools||[]).map(i=>({...i,plugin:o.name,active:o.status.is_enabled})));return n.jsxs("div",{className:"space-y-3",children:[n.jsx("p",{className:"text-xs text-muted-foreground",children:u("integrations.tools_hint")}),a.length===0?n.jsx(ut,{children:u("integrations.tools_empty")}):n.jsx("ul",{className:"space-y-2",children:a.map(o=>n.jsxs("li",{className:ge("rounded-md border border-border bg-muted/30 px-3 py-2",!o.active&&"opacity-55"),children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(aa,{className:"h-3.5 w-3.5 text-muted-foreground"}),n.jsx("span",{className:"font-mono text-xs text-foreground",children:o.slug}),n.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:o.plugin}),n.jsx("span",{className:ge("rounded border px-1.5 py-0.5 text-[10px]",o.active?"border-emerald-700/40 bg-emerald-900/20 text-emerald-400":"border-border bg-muted text-muted-foreground"),children:o.active?u("integrations.tool_active"):u("integrations.tool_inactive")})]}),n.jsx("p",{className:"mt-0.5 pl-5 text-[10px] text-muted-foreground",children:o.desc})]},o.slug))})]})}function o9({pid:e}){const t=String(e)==="0",[a,o]=x.useState("plugins"),[i,c]=x.useState(t?"global":"project");return n.jsxs(Ve,{title:u("integrations.title"),description:u("integrations.description"),children:[!t&&n.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[n.jsx("span",{className:"text-xs text-muted-foreground",children:u("integrations.scope_label")}),["project","global"].map(d=>n.jsx("button",{onClick:()=>c(d),className:ge("rounded-md border px-2.5 py-1 text-xs transition-colors",i===d?"border-primary/50 bg-primary/10 text-foreground":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/50"),children:u(d==="project"?"integrations.scope_project":"integrations.scope_global")},d))]}),n.jsx("div",{className:"mb-4 inline-flex rounded-lg border border-border bg-muted/30 p-0.5",children:n9.map(d=>{const f=d.icon;return n.jsxs("button",{onClick:()=>o(d.value),className:ge("flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs transition-colors",a===d.value?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[n.jsx(f,{className:"h-3.5 w-3.5"})," ",u(d.labelKey)]},d.value)})}),a==="plugins"&&n.jsx(a9,{pid:e,scope:i}),a==="tools"&&n.jsx(r9,{pid:e})]})}function i9({pid:e}){const t=Je(),a=String(e)==="0",[o,i]=x.useState(a?"global":"all"),[c,d]=x.useState(!1),f=Be(`/api/projects/${e}/vars?reveal=${c?1:0}`,()=>qc.list(e,{reveal:c})),[m,g]=x.useState(null),h=x.useMemo(()=>{if(!f.data)return[];const _=[],j=f.data.project||{},E=f.data.global||{};for(const[y,k]of Object.entries(j))_.push({name:y,scope:"project",masked:k});for(const[y,k]of Object.entries(E))j[y]===void 0&&_.push({name:y,scope:"global",masked:k});return _.filter(y=>o==="all"?!0:y.scope===o).sort((y,k)=>y.name.localeCompare(k.name))},[f.data,o]),b=async(_,j)=>{if(confirm(u("project.vars.delete_confirm",{name:_,scope:j})))try{await qc.remove(e,_,j),t.success(u("project.vars.removed")),f.mutate()}catch(E){t.error(E?.message||u("common.error_generic"))}};return n.jsxs(Ve,{title:u("project.vars.title"),description:u(a?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(Bt,{checked:c,onChange:d,label:u("project.vars.reveal_all")}),n.jsxs(re,{size:"sm",variant:"primary",onClick:()=>g({}),children:[n.jsx(Dt,{size:14})," ",u("project.vars.new")]})]}),children:[!a&&n.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[n.jsx("span",{className:"text-muted-fg",children:u("project.vars.filter_label")}),n.jsx(Nh,{active:o==="all",onClick:()=>i("all"),children:u("project.vars.filter_all")}),n.jsx(Nh,{active:o==="project",onClick:()=>i("project"),children:u("project.vars.filter_project")}),n.jsx(Nh,{active:o==="global",onClick:()=>i("global"),children:u("project.vars.filter_global")})]}),f.isLoading&&n.jsx(tt,{}),!f.isLoading&&h.length===0&&n.jsx(ut,{children:u("project.vars.empty")}),h.length>0&&n.jsx("ul",{className:"space-y-2 text-sm",children:h.map(_=>n.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("span",{className:"font-mono text-xs font-medium",children:_.name}),n.jsx($e,{tone:_.scope==="project"?"info":"muted",children:_.scope==="project"?u("project.vars.scope_project"):u("project.vars.scope_global")}),n.jsx("span",{className:"ml-2 font-mono text-xs text-muted-fg",children:_.masked}),n.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[n.jsx(re,{size:"sm",variant:"ghost",onClick:()=>g({name:_.name,scope:_.scope}),"aria-label":u("project.vars.edit_btn"),children:n.jsx(wa,{size:13})}),!(a&&_.scope==="project")&&n.jsx(re,{size:"sm",variant:"destructive",onClick:()=>b(_.name,_.scope),"aria-label":u("project.vars.delete_btn"),children:n.jsx(_n,{size:13})})]})]},`${_.scope}-${_.name}`))}),n.jsx(l9,{open:m!==null,initial:m||void 0,onClose:()=>g(null),pid:e,isBase:a,onSaved:()=>{g(null),f.mutate()}})]})}function Nh({active:e,onClick:t,children:a}){return n.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:a})}function l9({open:e,onClose:t,pid:a,isBase:o,initial:i,onSaved:c}){const d=Je(),[f,m]=x.useState(!1),[g,h]=x.useState(!1),[b,_]=x.useState(i?.name||""),[j,E]=x.useState(i?.value||""),[y,k]=x.useState(i?.scope||(o?"global":"project")),N=!!i?.name;x.useEffect(()=>{e&&(_(i?.name||""),E(i?.value||""),k(i?.scope||(o?"global":"project")),h(!1))},[e,i?.name,i?.scope,i?.value,o]);const w=async()=>{if(!b.trim()){d.error(u("project.vars.name_required"));return}if(!j){d.error(u("project.vars.value_required"));return}m(!0);try{await qc.upsert(a,{name:b.trim(),value:j,scope:y}),d.success(u(N?"project.vars.updated":"project.vars.added")),c()}catch(S){d.error(S?.message||u("common.error_generic"))}finally{m(!1)}};return n.jsx(Xt,{open:e,onClose:()=>f?null:t(),title:u(N?"project.vars.edit_title":"project.vars.new_title"),description:u("project.vars.new_desc"),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:f,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:w,loading:f,children:u(N?"project.vars.save_btn":"project.vars.add_btn")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("project.vars.scope_label"),children:n.jsx(ct,{value:y,onChange:S=>k(S),options:[...o?[]:[{value:"project",label:u("project.vars.scope_project"),description:u("project.vars.scope_project_desc")}],{value:"global",label:u("project.vars.scope_global"),description:u("project.vars.scope_global_desc")}]})}),n.jsx(le,{label:u("project.vars.name_label"),hint:u("project.vars.name_hint"),children:n.jsx(Ee,{value:b,onChange:S=>_(S.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:N,autoFocus:!N})}),n.jsx(le,{label:u("project.vars.value_label"),hint:u("project.vars.value_hint"),children:n.jsxs("div",{className:"relative",children:[n.jsx(Ee,{type:g?"text":"password",value:j,onChange:S=>E(S.target.value),placeholder:N?u("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:N}),n.jsx("button",{type:"button",onClick:()=>h(S=>!S),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":u(g?"project.vars.hide":"project.vars.reveal"),children:g?n.jsx(Q2,{size:14}):n.jsx(Wc,{size:14})})]})})]})})}function Z_({value:e,onValueChange:t,onSubmit:a,onStop:o,busy:i=!1,disabled:c=!1,placeholder:d,autoFocus:f,minRows:m=2,maxRows:g=8,footer:h,className:b}){const _=x.useRef(null);x.useLayoutEffect(()=>{const E=_.current;if(!E)return;const y=()=>{E.style.height="auto",E.offsetHeight;const N=parseFloat(getComputedStyle(E).lineHeight)||20,w=N*m,S=N*g;E.style.height=`${Math.min(Math.max(E.scrollHeight,w),S)}px`,E.style.overflowY=E.scrollHeight>S?"auto":"hidden"};y();const k=requestAnimationFrame(y);return()=>cancelAnimationFrame(k)},[e,m,g]);const j=e.trim().length>0&&!c;return n.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:[n.jsx("textarea",{ref:_,rows:m,value:e,autoFocus:f,disabled:c,placeholder:d,onChange:E=>t(E.target.value),onKeyDown:E=>{if(E.key==="Enter"&&!E.shiftKey){if(E.preventDefault(),i||!j)return;a()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),n.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[n.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:h}),i&&o?n.jsx(Ue,{content:u("chat_ui.stop"),children:n.jsx(or,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":u("chat_ui.stop"),children:n.jsx(kb,{className:"size-3.5",fill:"currentColor"})})}):n.jsx(Ue,{content:u("chat_ui.send"),children:n.jsx(or,{type:"button",size:"icon-sm",variant:"default",onClick:a,disabled:!j,"aria-label":u("chat_ui.send"),children:n.jsx(_A,{className:"size-4"})})})]})]})}function J_({value:e,onChange:t,disabled:a}){const[o,i]=x.useState(!1),[c,d]=x.useState(""),[f,m]=x.useState([]),[g,h]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{if(!o)return;const k=N=>{b.current&&!b.current.contains(N.target)&&i(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[o]),x.useEffect(()=>{if(!o||g)return;let k=!1;return(async()=>{try{const{engines:N}=await Hc.list(),w=await Promise.all(N.map(S=>Hc.models({engine:S}).then(R=>(R.models||[]).map(A=>A.includes(":")?A:`${S}:${A}`)).catch(()=>[])));if(!k){const S=Array.from(new Set(w.flat())).sort();m(S),h(!0)}}catch{k||h(!0)}})(),()=>{k=!0}},[o,g]);const _=c.trim().toLowerCase(),j=_?f.filter(k=>k.toLowerCase().includes(_)):f,E=e||u("shared_ui.auto"),y=k=>{t(k),i(!1),d("")};return n.jsxs("div",{ref:b,className:"relative",children:[n.jsx(Ue,{content:u("chat_ui.pick_model"),children:n.jsxs("button",{type:"button",disabled:a,onClick:()=>i(k=>!k),"data-testid":"chat-model-picker",className:ge("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":u("chat_ui.pick_model"),children:[n.jsx(iS,{className:"size-3 shrink-0"}),n.jsx("span",{className:"truncate font-mono",children:E}),n.jsx(ms,{className:"size-3 shrink-0 opacity-60"})]})}),o&&n.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:[n.jsx("input",{autoFocus:!0,value:c,placeholder:u("shared_ui.model_filter_ph"),onChange:k=>d(k.target.value),onKeyDown:k=>{k.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"}),n.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[n.jsx("li",{children:n.jsxs("button",{type:"button",onMouseDown:k=>{k.preventDefault(),y("")},className:ge("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:[n.jsxs("span",{className:"flex items-center gap-1.5",children:[n.jsx(gs,{className:"size-3"})," ",u("shared_ui.auto_router")]}),!e&&n.jsx(Yr,{className:"size-3"})]})}),!g&&n.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:u("shared_ui.loading_models")}),g&&j.length===0&&c.trim()&&n.jsx("li",{children:n.jsx("button",{type:"button",onMouseDown:k=>{k.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:u("shared_ui.use_value",{value:c.trim()})})}),j.map(k=>n.jsx("li",{children:n.jsxs("button",{type:"button",onMouseDown:N=>{N.preventDefault(),y(k)},className:ge("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",k===e&&"bg-accent/50"),children:[n.jsx("span",{className:"truncate",children:k}),k===e&&n.jsx(Yr,{className:"size-3 shrink-0"})]})},k))]})]})]})}function c9({onSend:e,onStop:t,streaming:a,model:o,onModelChange:i}){const[c,d]=x.useState(""),f=()=>{const m=c.trim();m&&(d(""),e(m))};return n.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:n.jsx(Z_,{value:c,onValueChange:d,onSubmit:f,onStop:t,busy:a,placeholder:u("project.chat.placeholder"),maxRows:12,footer:i?n.jsx(J_,{value:o||"",onChange:i,disabled:a}):void 0})})}function u9(){return{read_file:{icon:Ff,label:u("shared_ui.tool_read_file")},write_file:{icon:UA,label:u("shared_ui.tool_write_file")},edit_file:{icon:pf,label:u("shared_ui.tool_edit_file")},list_files:{icon:hb,label:u("shared_ui.tool_list_files")},search_files:{icon:qi,label:u("shared_ui.tool_search_files")},search_messages:{icon:qi,label:u("shared_ui.tool_search_messages")},tail_messages:{icon:qi,label:u("shared_ui.tool_tail_messages")},run_shell:{icon:ya,label:u("shared_ui.tool_run_shell")},send_telegram:{icon:Sa,label:u("shared_ui.tool_send_telegram")},call_agent:{icon:rn,label:u("shared_ui.tool_call_agent")},call_mcp:{icon:fM,label:u("shared_ui.tool_call_mcp")},call_runtime:{icon:rn,label:u("shared_ui.tool_call_runtime")},create_task:{icon:nM,label:u("shared_ui.tool_create_task")}}}const OE=new Set(["write_file","edit_file"]);function d9(e){return u9()[e]||{icon:aa,label:e}}function f9(e,t){if(!t)return"";const a=i=>typeof t[i]=="string"?t[i]:void 0,o=a("path")||a("file")||a("pattern")||a("query")||a("command")||a("slug")||a("name")||a("agent");return o?String(o):""}function uw(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function p9({status:e}){return e==="running"?n.jsx(Js,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?n.jsx(gs,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?n.jsx(LA,{className:"size-3 shrink-0 text-amber-400"}):n.jsx(Yr,{className:"size-3 shrink-0 text-emerald-400"})}function m9({part:e}){const[t,a]=x.useState(!1),{icon:o,label:i}=d9(e.tool),c=f9(e.tool,e.args),d=OE.has(e.tool),f=!!e.args||e.result!==void 0;return n.jsxs("div",{className:ge("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[n.jsxs("button",{type:"button",onClick:()=>f&&a(m=>!m),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[f?n.jsx(Zr,{className:ge("size-3 shrink-0 text-muted-foreground transition-transform",t&&"rotate-90")}):n.jsx("span",{className:"size-3 shrink-0"}),n.jsx(o,{className:ge("size-3.5 shrink-0",d?"text-violet-400":"text-muted-foreground")}),n.jsx("span",{className:"shrink-0 font-medium",children:i}),c&&n.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),n.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&n.jsx("span",{className:"text-[10px] text-amber-400",children:u("shared_ui.dedup")}),n.jsx(p9,{status:e.status})]})]}),t&&f&&n.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&&n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:u("shared_ui.args")}),n.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:uw(e.args)})]}),e.result!==void 0&&n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:u("shared_ui.result")}),n.jsx("pre",{className:ge("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:uw(e.result)})]})]})]})}function g9(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 h9({part:e,pending:t}){const a=g9(e),o=u(t?"ask_panel.status_waiting":"ask_panel.status_received");return n.jsxs("div",{className:ge("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:[n.jsxs("div",{className:"flex items-center gap-2",children:[t?n.jsx(Js,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):n.jsx(Vf,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),n.jsx(rS,{className:"size-3.5 shrink-0 text-muted-foreground"}),n.jsx("span",{className:"text-[12px] font-medium",children:o}),a.length>1&&n.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[a.length," preguntas"]})]}),a.length>0&&n.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:a.map((i,c)=>n.jsx("li",{className:"list-disc",children:i},c))})]})}function DE(e){const t=e.split(`
800
- `),a=[];let o=null;for(const i of t)if(i.startsWith("- "))o&&a.push(o),o={question:i.slice(2),answer:"",skipped:!1};else if(i.startsWith(" → ")&&o){const c=i.slice(4);o.answer=c,o.skipped=c==="(omitido)"}else return null;return o&&a.push(o),a.length>0?a:null}function x9({text:e}){const t=DE(e);return t?n.jsx("div",{className:"flex w-full justify-center",children:n.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:[n.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[n.jsx(rS,{className:"size-3.5"}),n.jsx("span",{children:u("ask_panel.answers_header")})]}),n.jsx("ul",{className:"space-y-2.5",children:t.map((a,o)=>n.jsxs("li",{className:"space-y-0.5",children:[n.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:a.question}),n.jsx("div",{className:ge("whitespace-pre-wrap text-[13px] leading-snug",a.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:a.answer})]},o))})]})}):null}function Qx(e){return e.parts.filter(t=>t.kind==="text").map(t=>t.text).join(`
801
-
802
- `).trim()}function b9(e){const t=e.args?.questions;if(!Array.isArray(t)||t.length===0)return null;const a=t.map(o=>{if(typeof o=="string")return`- ${o}`;if(!o||typeof o!="object")return null;const i=o;if(typeof i.question!="string")return null;const d=(Array.isArray(i.options)?i.options:[]).map(f=>typeof f=="string"?f:f&&typeof f=="object"&&typeof f.label=="string"?f.label:"").filter(f=>f).join(", ");return d?`- ${i.question} (opciones: ${d})`:`- ${i.question}`}).filter(o=>!!o);return a.length===0?null:`[ask_questions]
803
- ${a.join(`
804
- `)}`}function _9(e){const t=[];for(const a of e.parts)if(a.kind==="text"&&a.text)t.push(a.text);else if(a.kind==="tool"&&a.tool==="ask_questions"){const o=b9(a);o&&t.push(o)}return t.join(`
805
-
806
- `).trim()}const PE=e=>[{kind:"text",text:e}];function LE(e){if(!e||typeof e!="object")return!1;const t=e;return"error"in t&&!!t.error}function v9(e){const t=[];let a=null,o,i=0;for(const c of e){const d=c.ts||new Date().toISOString();if(c.role==="user")a=null,o=void 0,t.push({role:"user",parts:PE(c.content),ts:d});else if(c.role==="assistant"||c.role==="tool"){const f=c.role==="assistant"?c.agent:o;(!a||c.role==="assistant"&&f!==o)&&(a={role:"assistant",parts:[],ts:d},o=f,t.push(a)),c.role==="tool"?a.parts.push({kind:"tool",id:`hist-${i++}`,tool:c.tool||"tool",args:c.args,result:c.result,status:LE(c.result)?"error":"done"}):(c.agent&&(a.agentId=c.agent),c.agent_name&&(a.agent=c.agent_name),c.model&&(a.model=c.model),c.usage&&(a.usage={input_tokens:(a.usage?.input_tokens||0)+(c.usage.input_tokens||0),output_tokens:(a.usage?.output_tokens||0)+(c.usage.output_tokens||0)}),c.content&&a.parts.push({kind:"text",text:c.content}))}}return t}function ev(e,t){const a=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 a(`engine ${t.model||"?"} failed → ${t.retry_with||"retry"}`);case"model_retry":return a(`retry (${t.reason||"?"})`);case"tools_suppressed":return a(`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=LE(t.trace.result);return{...e,parts:e.parts.map(i=>i.kind==="tool"&&i.id===t.trace.id?{...i,result:t.trace.result,status:o?"error":i.status==="deduped"?"deduped":"done"}:i)}}case"final":return{...e,pending:!1,usage:t.result?.usage??e.usage,model:e.model??t.result?.model,agent:e.agent??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 i=[...e.parts],c=i[i.length-1];return c&&c.kind==="text"?i[i.length-1]={...c,text:c.text+o}:i.push({kind:"text",text:o}),{...e,parts:i}}}}function y9(e,t){const[a,o]=x.useState([]),[i,c]=x.useState(!1),[d,f]=x.useState(void 0),m=x.useRef(null),g=x.useRef(void 0),h=x.useRef(0),b=x.useCallback(w=>{o(S=>{const R=[...S],A=R[R.length-1];return A&&A.role==="assistant"&&(R[R.length-1]=w(A)),R})},[]),_=x.useCallback(w=>{if(w.type==="error"){t?.(w.error||u("shared_ui.err_stream"));return}b(S=>ev(S,w))},[b,t]),j=x.useCallback(async(w,S={})=>{const R=w.trim();if(!R||i)return;const A=()=>new Date().toISOString(),T=a.map(M=>({role:M.role,content:_9(M)}));if(o(M=>[...M,{role:"user",parts:PE(R),ts:A()},{role:"assistant",parts:[],ts:A(),pending:!0}]),c(!0),S.agentSlug){try{const M=await an.chat(e,S.agentSlug,{prompt:R,conversation_id:g.current,model:S.model||void 0,channel:"web"});g.current=M.conversation_id,f(M.conversation_id),b(P=>({...P,pending:!1,model:M.engine,agent:S.agentSlug,agentId:S.agentSlug,usage:M.usage,parts:[{kind:"text",text:M.text}]}))}catch(M){t?.(M?.message||u("shared_ui.err_chat_failed")),o(P=>P.filter((L,I)=>I!==P.length-1))}finally{c(!1)}return}const z=new AbortController;m.current=z;try{await hN.stream(e,{prompt:R,previousMessages:T,model:S.model||void 0,channel:"web"},_,z.signal),b(M=>({...M,pending:!1}))}catch(M){z.signal.aborted?b(P=>({...P,pending:!1,parts:[...P.parts,{kind:"text",text:u("code_module.stopped")}]})):(t?.(M?.message||u("shared_ui.err_stream_failed")),o(P=>P.filter((L,I)=>I!==P.length-1)))}finally{c(!1),m.current=null}},[e,a,i,_,b,t]),E=x.useCallback(()=>m.current?.abort(),[]),y=x.useCallback(()=>{i||(h.current++,g.current=void 0,f(void 0),o([]))},[i]),k=x.useCallback(async(w,S)=>{if(i)return;const R=++h.current;o([]);try{const A=await Wr.get(e,w,S);if(R!==h.current)return;const T=(A.messages??[]).filter(z=>z.role==="user"||z.role==="assistant").map(z=>({role:z.role,parts:[{kind:"text",text:z.content}],ts:z.ts||new Date().toISOString()}));g.current=S,f(S),o(T)}catch(A){if(R!==h.current)return;g.current=void 0,f(void 0),o([]),t?.(A?.message||u("shared_ui.err_load_conversation"))}},[e,i,t]),N=x.useCallback(async(w,S)=>{if(i)return;const R=++h.current;o([]);try{const A=await Wr.thread(e,w,S);if(R!==h.current)return;const T=v9(A.messages??[]);g.current=void 0,f(void 0),o(T)}catch(A){if(R!==h.current)return;g.current=void 0,f(void 0),o([]),t?.(A?.message||u("shared_ui.err_load_conversation"))}},[e,i,t]);return{msgs:a,send:j,stop:E,clear:y,load:k,loadThread:N,streaming:i,conversationId:d}}function j9({msg:e,isLast:t,isAskAnswer:a,onCopy:o}){const i=e.role==="user",c=Qx(e),d=e.parts.some(f=>f.kind==="tool");if(i&&a){const f=Qx(e);if(DE(f))return n.jsx(x9,{text:f})}return n.jsxs("div",{className:ge("group flex items-start gap-2",i?"justify-end":"justify-start"),children:[!i&&n.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:n.jsx(rn,{size:14})}),n.jsxs("div",{className:ge("flex min-w-0 flex-col gap-1.5",i?"items-end":"w-full max-w-[85%]"),children:[!i&&e.notes&&e.notes.length>0&&n.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((f,m)=>n.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[n.jsx(xb,{size:10})," ",f]},m))}),!i&&e.inspector&&(e.inspector.loaded?.length||e.inspector.hinted?.length)?n.jsx(Ue,{content:u("shared_ui.skill_inspector_title",{embedder:e.inspector.embedder||"RAG"}),children:n.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] text-sky-400/90",children:[n.jsx(sa,{size:10}),e.inspector.loaded?.map(f=>n.jsx("span",{className:"rounded bg-sky-500/15 px-1 py-0.5 font-mono",children:f},`l-${f}`)),e.inspector.hinted?.map(f=>n.jsxs("span",{className:"rounded border border-sky-500/30 px-1 py-0.5 font-mono opacity-70",children:[f,"?"]},`h-${f}`))]})}):null,e.parts.map((f,m)=>f.kind==="tool"?f.tool==="ask_questions"&&!i?n.jsx(h9,{part:f,pending:!!t},`${f.id}-${m}`):n.jsx(m9,{part:f},`${f.id}-${m}`):f.text?n.jsx("div",{className:ge("whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed shadow-sm",i?"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:f.text},m):null),!i&&e.pending&&e.parts.length===0&&n.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),!i&&(e.agent||e.model)&&n.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px]",children:[e.agent&&n.jsx("span",{className:"rounded bg-emerald-500/15 px-1 py-0.5 font-medium text-emerald-300",children:e.agent}),e.model&&n.jsx("span",{className:"rounded border border-border px-1 py-0.5 font-mono text-muted-foreground",children:e.model})]}),n.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[n.jsx("span",{children:k9(e.ts)}),!i&&e.usage&&(e.usage.input_tokens||e.usage.output_tokens)?n.jsxs("span",{className:"font-mono",children:["· ",(e.usage.input_tokens||0)+(e.usage.output_tokens||0)," tok"]}):null,!i&&d&&n.jsxs("span",{children:["· ",u("shared_ui.tools_count",{n:e.parts.filter(f=>f.kind==="tool").length})]}),o&&c&&n.jsx(Ue,{content:u("chat_ui.copy"),children:n.jsxs("button",{type:"button",onClick:()=>o(c),className:"inline-flex items-center gap-1 hover:text-foreground","aria-label":u("chat_ui.copy"),children:[n.jsx(Mo,{size:10})," ",u("chat_ui.copy")]})})]})]}),i&&n.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:n.jsx(Sb,{size:14})})]})}function k9(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function tv({msgs:e,onCopy:t}){const a=x.useRef(null);if(x.useEffect(()=>{a.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return n.jsx("div",{className:"grid h-full place-items-center p-6",children:n.jsx(ut,{children:u("project.chat.empty")})});const o=e.length-1;return n.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((i,c)=>n.jsx(j9,{msg:i,isLast:c===o,isAskAnswer:w9(e,c),onCopy:t},c)),n.jsx("div",{ref:a})]})}function w9(e,t){const a=e[t];if(!a||a.role!=="user")return!1;const o=e[t-1];if(!o||o.role!=="assistant")return!1;for(let i=o.parts.length-1;i>=0;i--){const c=o.parts[i];if(c.kind==="tool")return c.tool==="ask_questions"}return!1}function S9(e){if(!e)return;const t=e.path??e.file??e.filename;return typeof t=="string"?t:void 0}function IE({msgs:e}){const[t,a]=x.useState(!1),{inTok:o,outTok:i,toolCount:c,changed:d,actors:f}=x.useMemo(()=>{let h=0,b=0,_=0;const j=new Set,E=[],y=new Map;for(const k of e){if(k.role!=="assistant")continue;const N=k.usage?.input_tokens||0,w=k.usage?.output_tokens||0;if(h+=N,b+=w,k.agent||k.model){const S=`${k.agent||""}::${k.model||""}`,R=y.get(S);R?(R.inTok+=N,R.outTok+=w,R.turns+=1):y.set(S,{key:S,agent:k.agent,model:k.model,inTok:N,outTok:w,turns:1})}for(const S of k.parts)if(S.kind==="tool"&&(_+=1,OE.has(S.tool)&&S.status!=="error")){const R=S9(S.args);R&&!j.has(R)&&(j.add(R),E.push({path:R,tool:S.tool}))}}return{inTok:h,outTok:b,toolCount:_,changed:E,actors:[...y.values()]}},[e]),m=o+i,g=d.length>0||f.length>1;return m===0&&c===0&&f.length===0?null:n.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[n.jsxs("button",{type:"button",onClick:()=>g&&a(h=>!h),className:ge("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",g&&"hover:text-foreground"),children:[n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(Gf,{size:12})," ",Di(m)," tok",n.jsxs("span",{className:"text-muted-foreground/60",children:["(",Di(o),"↑ / ",Di(i),"↓)"]})]}),c>0&&n.jsxs("span",{className:"flex items-center gap-1",children:[n.jsx(aa,{size:12})," ",c," tools"]}),d.length>0&&n.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[n.jsx(pf,{size:12})," ",d.length," ",u("chat_ui.ctx_files")]}),f.length===1&&n.jsx("span",{className:"ml-auto truncate font-mono text-muted-foreground/70",children:[f[0].agent,f[0].model].filter(Boolean).join(" · ")}),f.length>1&&n.jsxs("span",{className:"ml-auto flex items-center gap-1 text-sky-400",children:[n.jsx(rn,{size:12})," ",u("chat_ui.ctx_actors",{n:f.length})]}),g&&n.jsx(ms,{className:ge("size-3 shrink-0 transition-transform",t&&"rotate-180")})]}),t&&n.jsxs("div",{className:"max-h-52 space-y-2 overflow-y-auto border-t border-border/60 px-4 py-2",children:[f.length>1&&n.jsx("ul",{className:"space-y-0.5",children:f.map(h=>n.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx(rn,{size:11,className:"shrink-0 text-sky-400"}),n.jsx("span",{className:"shrink-0 font-medium text-emerald-300",children:h.agent||"—"}),n.jsx("span",{className:"truncate font-mono text-muted-foreground/70",children:h.model||"—"}),n.jsxs("span",{className:"ml-auto shrink-0 font-mono text-[10px] text-muted-foreground/60",children:[Di(h.inTok+h.outTok)," tok (",Di(h.inTok),"↑ / ",Di(h.outTok),"↓) ·"," ",u("chat_ui.ctx_turns",{n:h.turns})]})]},h.key))}),d.length>0&&n.jsx("ul",{className:"space-y-0.5",children:d.map(h=>n.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[n.jsx(pf,{size:11,className:"shrink-0 text-violet-400"}),n.jsx("span",{className:"truncate",children:h.path}),n.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:h.tool==="write_file"?"write":"edit"})]},h.path))})]})]})}function Di(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Bi(){return{picked:new Set,text:"",skipped:!1}}function dw(e,t){const a=[];return e.forEach((o,i)=>{const c=t[i]||Bi();if(c.skipped){a.push(`- ${o.question}
807
- → (omitido)`);return}const d=[];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&&d.push(g.join(", "))}const f=c.text.trim();f&&d.push(o.options&&o.options.length>0?`(Otro: ${f})`:f);const m=d.length>0?d.join(" "):"(sin respuesta)";a.push(`- ${o.question}
808
- → ${m}`)}),a.join(`
809
- `)}function BE({turnKey:e,questions:t,onSubmit:a,onDismiss:o,disabled:i}){const c=t.length,[d,f]=x.useState(0),[m,g]=x.useState(()=>t.map(()=>Bi()));x.useEffect(()=>{f(0),g(t.map(()=>Bi()))},[e,t]);const h=t[d],b=m[d]||Bi(),_=!!h?.options&&h.options.length>0,j=!!h?.multiSelect,E=h?.allowText!==!1,y=T=>{g(z=>{const M=[...z],P=M[d]||Bi();return M[d]={...P,...T,skipped:!1},M})},k=T=>{g(z=>{const M=[...z],P=M[d]||Bi(),L=new Set(P.picked);return j?L.has(T)?L.delete(T):L.add(T):(L.clear(),L.add(T)),M[d]={...P,picked:L,skipped:!1},M})},N=x.useMemo(()=>!0,[]),w=d===c-1,S=()=>f(T=>Math.max(0,T-1)),R=()=>{if(w){a(dw(t,m));return}f(T=>Math.min(c-1,T+1))},A=()=>{if(g(T=>{const z=[...T];return z[d]={picked:new Set,text:"",skipped:!0},z}),w){const T=m.map((z,M)=>M===d?{picked:new Set,text:"",skipped:!0}:z);a(dw(t,T))}else f(T=>Math.min(c-1,T+1))};return x.useEffect(()=>{const T=z=>{if(i)return;const M=z.target?.tagName?.toLowerCase(),P=M==="input"||M==="textarea";if(z.key==="Enter"&&(z.metaKey||z.ctrlKey)){z.preventDefault(),R();return}if(!P&&_&&/^[1-9]$/.test(z.key)){const L=parseInt(z.key,10)-1;L<(h?.options?.length||0)&&(z.preventDefault(),k(L))}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)}),!h||c===0?null:n.jsxs("div",{className:ge("mx-3 mb-2 rounded-xl border border-border bg-card/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-card/80",i&&"pointer-events-none opacity-60"),"data-testid":"inline-ask-panel",children:[n.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[n.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:[d+1,"/",c]}),h.header&&n.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}),n.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:h.question}),o&&n.jsx("button",{type:"button",onClick:o,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":u("common.close"),children:n.jsx(gs,{className:"size-3.5"})})]}),n.jsxs("div",{className:"space-y-1 px-2 py-2",children:[_&&h.options.map((T,z)=>{const M=b.picked.has(z);return n.jsxs("button",{type:"button",onClick:()=>k(z),className:ge("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",M?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("div",{className:"text-xs font-medium",children:T.label}),T.description&&n.jsx("div",{className:"text-[11px] text-muted-foreground",children:T.description})]}),j?n.jsx("span",{className:ge("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",M?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:M&&n.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):n.jsx("span",{className:ge("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",M?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:z+1})]},`${z}:${T.label}`)}),(E||!_)&&n.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[_&&n.jsx("div",{className:"mb-1 text-xs font-medium",children:u("ask_panel.other")}),n.jsx("input",{type:"text",value:b.text,onChange:T=>y({text:T.target.value}),placeholder:u(_?"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"})]})]}),n.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[n.jsx("button",{type:"button",onClick:S,disabled:d===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:u("ask_panel.back")}),n.jsxs("div",{className:"flex items-center gap-1",children:[n.jsx("button",{type:"button",onClick:A,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:u("ask_panel.skip")}),n.jsxs("button",{type:"button",onClick:R,disabled:!N,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:[u(w?"ask_panel.submit":"ask_panel.next"),n.jsx(PA,{className:"size-3 opacity-60"})]})]})]})]})}function C9(e){if(typeof e=="string")return{question:e,options:[],multiSelect:!1,allowText:!0};if(!e||typeof e!="object")return null;const t=e,a=typeof t.question=="string"?t.question:"";if(!a)return null;const i=(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 d=c;return{label:d.label,description:typeof d.description=="string"?d.description:void 0}}return null}).filter(c=>c!==null);return{question:a,header:typeof t.header=="string"?t.header:void 0,options:i,multiSelect:t.multiSelect===!0,allowText:t.allowText!==!1}}function $E(e){if(!e.length)return null;const t=e[e.length-1];if(t.role!=="assistant")return null;let a=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"){a=h,o=g;break}}if(!a||o<0)return null;let i=null;if(typeof a.result=="string")try{i=JSON.parse(a.result)}catch{i=null}else a.result&&typeof a.result=="object"&&(i=a.result);const c=[];Array.isArray(a.args?.questions)&&c.push(a.args.questions),i&&Array.isArray(i.questions)&&c.push(i.questions);let d=[];for(const g of c)if(d=g.map(C9).filter(h=>!!h),d.length>0)break;return d.length?{turnKey:`${t.ts||""}#${o}`,questions:d}:null}const Wx={web:{label:"Web",icon:bb,order:0},telegram:{label:"Telegram",icon:Sa,order:1},desktop:{label:"Desktop",icon:vb,order:2},voice:{label:"Voice",icon:_b,order:3},a2a:{label:"Agent ↔ Agent",icon:rn,order:4},schedule:{label:"Schedule",icon:yM,order:5},other:{label:"Other",icon:Ho,order:6}};function fw(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 N9({pid:e,slug:t,onLoaded:a}){const{data:o}=Be(`/api/projects/${e}/agents/${t}/conversations`,()=>Wr.list(e,t),{revalidateOnFocus:!1});return x.useEffect(()=>{a(t,o)},[t,o]),null}function E9({pid:e,agents:t,superAgentSlug:a,superAgentLabel:o,selected:i,onSelect:c,onNewChat:d}){const[f,m]=x.useState(""),[g,h]=x.useState(""),[b,_]=x.useState({}),[j,E]=x.useState({}),[y,k]=x.useState(!1),N=String(e)==="0",w=Be(N?`/api/projects/${e}/super-agent/threads`:null,()=>Wr.threads(e),{revalidateOnFocus:!1}),S=(D,$)=>{$&&E(q=>{const G=q[D];return G&&G.length===$.length&&G===$?q:{...q,[D]:$}})},R=x.useMemo(()=>{const D=[];for(const $ of t)for(const q of j[$.slug]||[])D.push({...q,agent_slug:q.agent_slug||$.slug});return D},[t,j]),A=x.useMemo(()=>{const D=f.trim().toLowerCase();return R.filter($=>!(g&&$.agent_slug!==g||D&&!`${$.title||""} ${$.id} ${$.agent_slug}`.toLowerCase().includes(D)))},[R,f,g]),T=x.useMemo(()=>{if(g&&g!==a)return[];const D=f.trim().toLowerCase();return(w.data||[]).filter($=>D?`${$.title} ${$.id} ${$.channel}`.toLowerCase().includes(D):!0)},[w.data,f,g,a]),z=x.useMemo(()=>{const D=new Map,$=(q,G)=>{const U=D.get(q);U?U.push(G):D.set(q,[G])};for(const q of A)$(fw(q.channel),{type:"conv",conv:q,sortTs:q.started_at||""});for(const q of T)$(fw(q.channel),{type:"thread",thread:q,sortTs:q.last_ts||q.started_at||""});return Array.from(D.entries()).map(([q,G])=>({key:q,items:G.sort((U,V)=>new Date(V.sortTs||0).getTime()-new Date(U.sortTs||0).getTime())})).sort((q,G)=>Wx[q.key].order-Wx[G.key].order)},[A,T]),M=x.useMemo(()=>[{slug:a,label:o},...t.map(D=>({slug:D.slug,label:D.slug}))],[t,a,o]),P=x.useMemo(()=>[{value:"",label:u("project.chat.list.all_agents")},{value:a,label:o},...t.map(D=>({value:D.slug,label:D.slug}))],[t,a,o]),L=R.length+(w.data?.length||0),I=Object.keys(j).length>0||t.length===0||!!w.data;return n.jsxs("aside",{className:"flex h-full w-72 shrink-0 flex-col border-r border-border bg-card/30",children:[t.map(D=>n.jsx(N9,{pid:e,slug:D.slug,onLoaded:S},D.slug)),n.jsxs("header",{className:"flex h-[57px] shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("p",{className:"truncate text-sm font-semibold",children:u("project.chat.list.title")}),n.jsx("p",{className:"text-[10px] text-muted-fg",children:u("project.chat.list.count",{n:L})})]}),n.jsxs("div",{className:"relative",children:[n.jsxs("button",{type:"button",onClick:()=>k(D=>!D),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:[n.jsx(Dt,{className:"size-3"})," ",u("project.chat.list.new")]}),y&&n.jsxs(n.Fragment,{children:[n.jsx("button",{type:"button","aria-hidden":!0,tabIndex:-1,className:"fixed inset-0 z-10 cursor-default",onClick:()=>k(!1)}),n.jsxs("div",{className:"absolute right-0 top-full z-20 mt-1 w-56 rounded-md border border-border bg-card p-1 shadow-lg",children:[n.jsx("p",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-fg",children:u("project.chat.list.pick_agent")}),n.jsx("div",{className:"max-h-64 overflow-y-auto",children:M.map(D=>n.jsxs("button",{type:"button",onClick:()=>{k(!1),d(D.slug)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50",children:[n.jsx(rn,{className:"size-3 shrink-0 text-muted-fg"}),n.jsx("span",{className:"truncate",children:D.label})]},`new-${D.slug}`))})]})]})]})]}),n.jsxs("div",{className:"space-y-2 border-b border-border p-2",children:[n.jsx(Ee,{value:f,onChange:D=>m(D.target.value),placeholder:u("project.chat.list.search")}),n.jsx(ct,{value:g,onChange:h,options:P})]}),n.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-2",children:[!I&&n.jsx("div",{className:"px-2 py-1",children:n.jsx(tt,{})}),z.map(D=>n.jsx(R9,{keyName:D.key,count:D.items.length,collapsed:!!b[D.key],onToggle:()=>_($=>({...$,[D.key]:!$[D.key]})),children:D.items.map($=>{if($.type==="thread"){const U=$.thread,V=i.kind==="thread"&&i.channel===U.channel&&i.threadId===U.id;return n.jsx(pw,{title:U.title,subtitle:[U.channel,`${U.messages} msg`].join(" · "),badge:"super",timeAgo:U.last_ts,selected:V,onClick:()=>c({kind:"thread",channel:U.channel,threadId:U.id},{channel:U.channel,createdAt:U.started_at,title:U.title})},`thread-${U.channel}-${U.id}`)}const q=$.conv,G=i.kind==="conv"&&i.agentSlug===q.agent_slug&&i.convId===q.id;return n.jsx(pw,{title:q.title||q.id,subtitle:[q.agent_slug,`${q.messages??0} msg`].filter(Boolean).join(" · "),badge:q.agent_slug,timeAgo:q.started_at,selected:G,onClick:()=>c({kind:"conv",agentSlug:q.agent_slug,convId:q.id},{channel:q.channel,createdAt:q.started_at,title:q.title})},`${q.agent_slug}-${q.id}`)})},D.key)),I&&R.length===0&&T.length===0&&n.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:u("project.chat.list.empty")})]})]})}function R9({keyName:e,count:t,collapsed:a,onToggle:o,children:i}){const c=Wx[e],d=c.icon;return n.jsxs("section",{className:"space-y-1",children:[n.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:[n.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a?n.jsx(Zr,{className:"size-3"}):n.jsx(ms,{className:"size-3"}),n.jsx(d,{className:"size-3"}),n.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:c.label})]}),n.jsx("span",{className:"text-[10px]",children:t})]}),!a&&n.jsx("div",{className:"space-y-0.5",children:i})]})}function pw({title:e,subtitle:t,badge:a,timeAgo:o,selected:i,onClick:c}){return n.jsxs("button",{type:"button",onClick:c,className:Pc("w-full rounded-md border px-2.5 py-2 text-left transition-colors",i?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[n.jsxs("div",{className:"flex items-start justify-between gap-2",children:[n.jsx("p",{className:Pc("truncate text-sm",i?"font-semibold":"font-medium"),children:e}),o&&n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-fg",children:[n.jsx(K2,{className:"size-2.5"}),T9(o)]})]}),n.jsxs("div",{className:"mt-0.5 flex items-center justify-between gap-2 text-[10px] text-muted-fg",children:[n.jsx("span",{className:"truncate",children:t}),a&&n.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-accent/50 px-1.5 py-0.5",children:[n.jsx(Sb,{className:"size-2.5"}),a]})]})]})}function T9(e){if(!e)return"";const t=new Date(e).getTime();if(!Number.isFinite(t))return"";const a=Date.now()-t,o=Math.floor(a/6e4);if(o<1)return"now";if(o<60)return`${o}m`;const i=Math.floor(o/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}const Kd="__super_agent__";function A9({pid:e}){const t=Je(),[a,o]=qo(),i=Be(`/api/projects/${e}/agents`,()=>an.list(e)),[c,d]=x.useState(!1),[f,m]=x.useState(""),[g,h]=x.useState(null),{msgs:b,send:_,stop:j,clear:E,load:y,loadThread:k,streaming:N}=y9(e,Z=>t.error(Z)),w=yp(),[S,R]=x.useState(()=>{const Z=a.get("agent"),fe=a.get("conv"),Y=a.get("channel"),oe=a.get("thread");return Y&&oe?{kind:"thread",channel:Y,threadId:oe}:Z&&fe?{kind:"conv",agentSlug:Z,convId:fe}:Z?{kind:"live",agentSlug:Z}:{kind:"live",agentSlug:Kd}}),[A,T]=x.useState(void 0),[z,M]=x.useState(!1),[P,L]=x.useState(!1),I=(Z,fe)=>{R(Z),T(fe);const Y=new URLSearchParams;Z.kind==="conv"?(Y.set("agent",Z.agentSlug),Y.set("conv",Z.convId)):Z.kind==="thread"?(Y.set("channel",Z.channel),Y.set("thread",Z.threadId)):Y.set("agent",Z.agentSlug),o(Y,{replace:!0})},D=i.data||[],$=Z=>Z===Kd,q=x.useMemo(()=>S.kind==="thread"?void 0:D.find(Z=>Z.slug===S.agentSlug),[D,S]),G=S.kind==="thread"||$(S.agentSlug);x.useEffect(()=>{S.kind==="conv"?y(S.agentSlug,S.convId):S.kind==="thread"?k(S.channel,S.threadId):E()},[S.kind,S.kind==="conv"?S.convId:S.kind==="thread"?`${S.channel}:${S.threadId}`:S.agentSlug]);const U=async Z=>{if(G){await _(Z,{model:f||void 0});return}q&&await _(Z,{model:f||void 0,agentSlug:q.slug})},V=async Z=>{try{await navigator.clipboard.writeText(Z),t.info(u("project.chat.copied"))}catch{}},X=Z=>{I({kind:"live",agentSlug:Z}),E()},Q=()=>{const Z=G?Kd:q?.slug??S.agentSlug;I({kind:"live",agentSlug:Z}),E()},W=async()=>{L(!0);try{S.kind==="conv"?(await Wr.remove(e,S.agentSlug,S.convId),Sf(`/api/projects/${e}/agents/${S.agentSlug}/conversations`)):S.kind==="thread"&&(await Wr.removeThread(e,S.channel,S.threadId),Sf(`/api/projects/${e}/super-agent/threads`)),t.success(u("project.chat.deleted")),M(!1),Q()}catch(Z){t.error(Z?.message||u("shared_ui.err_chat_failed"))}finally{L(!1)}},B=G?w:q?.slug??S.agentSlug,K=S.kind==="thread"?S.channel:A?.channel||"web",ee=S.kind==="thread"?S.threadId:A?.createdAt,F=S.kind==="live"?u("project.chat.live_title",{agent:B}):A?.title||(S.kind==="thread"?S.threadId:S.convId),ne=ee?u("project.chat.meta_created",{date:M9(ee),channel:K}):u("project.chat.meta_new",{channel:K});return i.isLoading?n.jsx(tt,{}):n.jsxs("div",{className:"flex h-full overflow-hidden rounded-xl border border-border bg-card/40",children:[n.jsx(E9,{pid:e,agents:D,superAgentSlug:Kd,superAgentLabel:u("agents_ui.super_agent_label",{persona:w}),selected:S,onSelect:I,onNewChat:X}),n.jsxs("section",{className:"flex min-w-0 flex-1 flex-col",children:[n.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("h2",{className:"truncate text-sm font-semibold",children:F}),n.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:ne})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[G?n.jsx($e,{tone:"success",children:u("agents_ui.super_agent_badge")}):n.jsx($e,{tone:"info",children:B}),!D.length&&!G&&n.jsxs(re,{variant:"primary",size:"sm",onClick:()=>d(!0),children:[n.jsx(Dt,{size:14})," ",u("project.chat.create_agent")]}),n.jsxs(re,{variant:"ghost",size:"sm",disabled:N||b.length===0,onClick:Q,children:[n.jsx(fl,{size:13})," ",u("project.chat.new_session")]}),(S.kind==="conv"||S.kind==="thread")&&n.jsxs(re,{variant:"destructive",size:"sm",disabled:N,onClick:()=>M(!0),children:[n.jsx(_n,{size:13})," ",u("project.chat.delete")]})]})]}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length?n.jsx(tv,{msgs:b,onCopy:V}):n.jsx("div",{className:"flex h-full items-center justify-center p-8",children:n.jsx("p",{className:"text-sm text-muted-fg",children:u("project.chat.empty")})})}),n.jsx(IE,{msgs:b}),(()=>{const Z=N?null:$E(b);return!Z||Z.turnKey===g?null:n.jsx(BE,{turnKey:Z.turnKey,questions:Z.questions,onSubmit:fe=>void U(fe),onDismiss:()=>h(Z.turnKey),disabled:N})})(),n.jsx(c9,{onSend:U,onStop:j,streaming:N,model:f,onModelChange:m})]}),n.jsx(z9,{open:c,pid:e,onClose:()=>d(!1),onCreated:()=>{d(!1),i.mutate()}}),n.jsx(Xt,{open:z,onClose:()=>M(!1),title:u("project.chat.delete_confirm_title"),description:u("project.chat.delete_confirm_desc"),size:"sm",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:()=>M(!1),disabled:P,children:u("common.cancel")}),n.jsxs(re,{variant:"destructive",onClick:W,loading:P,children:[n.jsx(_n,{size:14})," ",u("project.chat.delete")]})]}),children:n.jsx("p",{className:"text-sm text-muted-fg",children:F})})]})}function M9(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString()}function z9({open:e,onClose:t,onCreated:a,pid:o}){const i=Je(),[c,d]=x.useState(""),[f,m]=x.useState("master"),[g,h]=x.useState(""),[b,_]=x.useState(!0),[j,E]=x.useState(!1),y=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){i.error(u("project.agents.slug_invalid"));return}E(!0);try{await an.create(o,{slug:c,role:f,model:g||void 0,is_master:b}),i.success(u("project.agents.created",{slug:c})),d(""),m("master"),h(""),_(!0),a()}catch(k){i.error(k.message)}finally{E(!1)}};return n.jsx(Xt,{open:e,onClose:t,title:u("project.chat.create_agent_title"),description:u("project.chat.create_agent_desc"),footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:j,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:y,loading:j,children:u("common.create")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:"slug",children:n.jsx(Ee,{autoFocus:!0,value:c,onChange:k=>d(k.target.value),placeholder:"master"})}),n.jsx(le,{label:u("project.chat.role_label"),children:n.jsx(Ee,{value:f,onChange:k=>m(k.target.value),placeholder:"master"})}),n.jsx(le,{label:u("project.chat.model_label"),hint:u("project.chat.model_hint"),children:n.jsx(Ee,{value:g,onChange:k=>h(k.target.value)})}),n.jsx(Bt,{checked:b,onChange:_,label:u("project.chat.master_label")})]})})}function O9(e){return e.kind==="project"?"project":`agent:${e.slug}`}function D9(e){return e.kind==="project"?".apc/memory.md":`agents/${e.slug}/memory.md`}function P9(e,t){return t.kind==="project"?Zn.memory.get(e).then(a=>a.body):an.memory.get(e,t.slug).then(a=>a.body)}function L9(e,t,a){return t.kind==="project"?Zn.memory.put(e,a).then(()=>{}):an.memory.put(e,t.slug,a).then(()=>{})}function mw({active:e,onClick:t,icon:a,iconClass:o,label:i,sub:c}){return n.jsxs("button",{type:"button",onClick:t,className:ge("flex w-full items-center gap-2 rounded px-1.5 py-1 text-left text-[13px]",e?"bg-primary/15 text-foreground":"text-foreground/80 hover:bg-accent/40"),children:[n.jsx(a,{className:ge("size-3.5 shrink-0",o??"text-muted-foreground")}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:i}),c&&n.jsx("span",{className:"shrink-0 truncate text-[11px] text-muted-foreground",children:c})]})}function I9({pid:e}){const t=Je(),[a,o]=x.useState({kind:"project"}),i=Be(`/api/projects/${e}/agents`,()=>an.list(e)),c=`/api/memory/${e}/${O9(a)}`,d=Be(c,()=>P9(e,a)),f=x.useMemo(()=>{if(d.data===void 0)return null;const h=d.data??"";return{path:D9(a),name:"memory.md",kind:"markdown",size:h.length,modified:"",encoding:"utf8",content:h}},[d.data,a]),m=async h=>{await L9(e,a,h),t.success(u("project.memories.saved")),d.mutate(h,{revalidate:!1})},g=i.data||[];return n.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden rounded-xl border border-border bg-card",children:[n.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx(Dc,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"flex-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u("project.memories.sidebar_title")}),n.jsx("button",{type:"button",onClick:()=>{i.mutate(),d.mutate()},className:"text-muted-foreground hover:text-foreground","aria-label":u("common.refresh"),children:n.jsx(Cs,{className:i.isValidating?"size-3.5 animate-spin":"size-3.5"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:[n.jsx("p",{className:"px-1.5 pb-1 pt-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:u("project.memories.general_group")}),n.jsx(mw,{active:a.kind==="project",onClick:()=>o({kind:"project"}),icon:Dc,iconClass:"text-sky-500",label:u("project.memories.general_item")}),n.jsx("p",{className:"px-1.5 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:u("project.memories.agents_title")}),i.isLoading?n.jsx("div",{className:"flex justify-center py-4",children:n.jsx(bn,{size:14})}):g.length===0?n.jsx("div",{className:"px-1.5 py-2",children:n.jsx(ut,{children:u("project.memories.no_agents")})}):g.map(h=>n.jsx(mw,{active:a.kind==="agent"&&a.slug===h.slug,onClick:()=>o({kind:"agent",slug:h.slug}),icon:h.is_master?va:rn,iconClass:h.is_master?"text-violet-400":"text-muted-foreground",label:h.slug,sub:h.role||void 0},h.slug))]})]}),n.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:n.jsx(X_,{file:f,loading:d.isLoading,onSave:m})})]})}function B9({pid:e}){return n.jsx("div",{className:"h-full",children:n.jsx(I9,{pid:e})})}const $9=/\.(html?|jsx|tsx|js)$/i;function U9({pid:e,entry:t,onDeleted:a,onRenamed:o,onRunInTerminal:i,onEditArtifact:c}){const[d,f]=x.useState(!1),[m,g]=x.useState(null),h=Je(),[b,_]=x.useState(null),[j,E]=x.useState(!1),[y,k]=x.useState(!1),N=$9.test(t.name),[w,S]=x.useState(!1),[R,A]=x.useState(t.name),T=x.useRef(null),[z,M]=x.useState(!1),[P,L]=x.useState(!1),[I,D]=x.useState(!1),$=z?["artifact",e,t.name]:null,q=Be($,()=>Ws.read(e,t.name),{revalidateOnFocus:!1}),G=!q.data?.content||q.data.content.startsWith("#!"),U=async F=>{try{await navigator.clipboard.writeText(F),h.info(u("modules_ui.code_copied"))}catch{}},V=async()=>{f(!0),g(null);try{const F=await Ws.run(e,t.name);g(F),F.ok?h.info(u("modules_ui.code_artifact_exit_ok",{ms:F.durationMs??0})):h.error(u("modules_ui.code_artifact_exit_fail",{code:F.exitCode??F.signal??"?",timeout:F.timedOut?u("modules_ui.code_artifact_timeout_suffix"):""}))}catch(F){h.error(F.message)}finally{f(!1)}},X=async()=>{E(!0);try{const F=await Ws.preview(e,t.name);_(F),window.open(F.url,"_blank","noopener,noreferrer")}catch(F){h.error(F.message)}finally{E(!1)}},Q=async()=>{if(b){k(!0);try{const F=await Ws.openTunnel(b.id);_({...b,tunnel:{id:F.id,url:F.url,provider:F.provider}}),window.open(F.url,"_blank","noopener,noreferrer")}catch(F){h.error(F.message)}finally{k(!1)}}},W=async()=>{if(b){try{await Ws.stopPreview(b.id)}catch{}_(null)}},B=async()=>{D(!0);try{await Ws.remove(e,t.name),L(!1),a()}catch(F){h.error(F.message)}finally{D(!1)}},K=()=>{A(t.name),S(!0),requestAnimationFrame(()=>T.current?.select())},ee=async()=>{const F=R.trim();if(S(!1),!(!F||F===t.name))try{await Ws.rename(e,t.name,F),o()}catch(ne){h.error(ne.message)}};return n.jsxs("li",{className:"rounded-md border border-border",children:[n.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1.5 text-xs",children:[n.jsx(gb,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),w?n.jsx("input",{ref:T,value:R,onChange:F=>A(F.target.value),onBlur:()=>void ee(),onKeyDown:F=>{F.key==="Enter"&&ee(),F.key==="Escape"&&S(!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"}):n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:t.name}),n.jsx(Ue,{content:u("code_module.artifacts_rename"),children:n.jsx("button",{type:"button",onClick:K,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(wa,{className:"size-3"})})}),n.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[t.size,"b"]})]}),n.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[n.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5",children:[n.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted-foreground",children:t.path}),n.jsx(Ue,{content:u("code_module.artifacts_copy_path"),children:n.jsx("button",{type:"button",onClick:()=>void U(t.path),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(Mo,{className:"size-3"})})})]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[n.jsxs(Bx,{open:z,onOpenChange:M,children:[n.jsx(Ue,{content:u("code_module.artifacts_view"),children:n.jsxs("button",{type:"button",onClick:()=>M(!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:[n.jsx(Wc,{className:"size-3"}),u("modules_ui.code_artifact_view_short")]})}),n.jsxs($x,{className:"sm:max-w-lg",children:[n.jsx(Ux,{children:n.jsx(qx,{className:"font-mono text-sm",children:t.name})}),q.isLoading?n.jsx("div",{className:"flex justify-center py-6",children:n.jsx(bn,{size:16})}):n.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:q.data?.content??""}),n.jsx(Rk,{showCloseButton:!0})]})]}),c&&n.jsx(Ue,{content:u("code_module.artifacts_edit"),children:n.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:[n.jsx(_M,{className:"size-3"}),u("modules_ui.code_artifact_edit_short")]})}),G&&n.jsx(Ue,{content:u("code_module.artifacts_run"),children:n.jsxs("button",{type:"button",disabled:d,onClick:()=>i?i(`apx artifact run ${t.name}`):void V(),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 disabled:opacity-60 dark:text-emerald-300",children:[d?n.jsx(bn,{size:10}):n.jsx(yb,{className:"size-3"}),u("code_module.artifacts_run")]})}),N&&n.jsx(Ue,{content:u("code_module.artifacts_preview_hint"),children:n.jsxs("button",{type:"button",disabled:j,onClick:()=>void X(),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-sky-500/15 text-sky-700 hover:bg-sky-500/25 disabled:opacity-60 dark:text-sky-300",children:[j?n.jsx(bn,{size:10}):n.jsx(mb,{className:"size-3"}),u("code_module.artifacts_preview")]})}),b&&!b.tunnel&&n.jsx(Ue,{content:u("code_module.artifacts_share_hint"),children:n.jsxs("button",{type:"button",disabled:y,onClick:()=>void Q(),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-amber-500/15 text-amber-700 hover:bg-amber-500/25 disabled:opacity-60 dark:text-amber-300",children:[y?n.jsx(bn,{size:10}):n.jsx(hM,{className:"size-3"}),u("code_module.artifacts_share")]})}),n.jsxs(Bx,{open:P,onOpenChange:L,children:[n.jsx(Ue,{content:u("code_module.artifacts_delete"),children:n.jsx("button",{type:"button",onClick:()=>L(!0),className:"ml-auto rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:n.jsx(_n,{className:"size-3"})})}),n.jsxs($x,{className:"sm:max-w-sm",children:[n.jsx(Ux,{children:n.jsxs(qx,{className:"font-mono text-sm",children:[u("code_module.artifacts_delete")," — ",t.name]})}),n.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:u("code_module.artifacts_delete_confirm")}),n.jsxs(Rk,{children:[n.jsx(sL,{render:n.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:u("common.cancel")}),n.jsxs("button",{type:"button",onClick:()=>void B(),disabled:I,className:ge("inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-xs font-medium",I?"bg-muted text-muted-foreground":"bg-rose-500/15 text-rose-700 hover:bg-rose-500/25 dark:text-rose-300"),children:[I&&n.jsx(bn,{size:10}),u("code_module.delete")]})]})]})]})]}),n.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[u("code_module.artifacts_run_hint")," ",n.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",t.name]})]}),b&&n.jsxs("div",{className:"space-y-1 rounded border border-sky-500/30 bg-sky-500/5 p-2",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground",children:u("code_module.artifacts_preview_local")}),n.jsx("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"min-w-0 flex-1 truncate font-mono text-[10px] text-sky-700 underline hover:text-sky-900 dark:text-sky-300",children:b.url}),n.jsx(Ue,{content:u("code_module.artifacts_copy_url"),children:n.jsx("button",{type:"button",onClick:()=>void U(b.url),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(Mo,{className:"size-3"})})}),n.jsx(Ue,{content:u("code_module.artifacts_stop_preview"),children:n.jsx("button",{type:"button",onClick:()=>void W(),className:"shrink-0 rounded p-0.5 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:n.jsx(kb,{className:"size-3"})})})]}),b.tunnel&&n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"shrink-0 text-[10px] font-medium text-amber-700 dark:text-amber-300",children:u("code_module.artifacts_preview_public")}),n.jsx("a",{href:b.tunnel.url,target:"_blank",rel:"noopener noreferrer",className:"min-w-0 flex-1 truncate font-mono text-[10px] text-amber-700 underline hover:text-amber-900 dark:text-amber-300",children:b.tunnel.url}),n.jsx("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground",children:b.tunnel.provider}),n.jsx(Ue,{content:u("code_module.artifacts_copy_url"),children:n.jsx("button",{type:"button",onClick:()=>void U(b.tunnel.url),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(Mo,{className:"size-3"})})})]})]}),m&&n.jsxs("div",{className:"space-y-1",children:[n.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[n.jsx("span",{className:ge("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:u("modules_ui.code_artifact_exit_badge",{code:m.exitCode??m.signal??"?"})}),m.timedOut&&n.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:u("modules_ui.code_artifact_timeout")}),m.truncated&&n.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:u("modules_ui.code_artifact_truncated")}),n.jsxs("span",{className:"font-mono text-muted-foreground",children:[m.durationMs,"ms"]})]}),m.stdout&&n.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:m.stdout}),m.stderr&&n.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 UE({pid:e,onRunInTerminal:t,onEditArtifact:a}){const o=Be(e?["artifacts",e]:null,()=>Ws.list(e)),i=o.data||[];return n.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:i.length>0?u("code_module.artifacts_count",{n:i.length}):""}),n.jsx(Ue,{content:u("code_module.reload"),children:n.jsx("button",{type:"button",onClick:()=>void o.mutate(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o.isLoading?n.jsx(bn,{size:12}):n.jsx(Cs,{className:"size-3"})})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:i.length===0?n.jsx(ut,{children:u("code_module.artifacts_none")}):n.jsx("ul",{className:"space-y-1.5",children:i.map(c=>n.jsx(U9,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:t,onEditArtifact:a},c.name))})})]})}function q9({pid:e}){const t=Tn(),a=o=>{const i=new URLSearchParams({pid:e,...o}).toString();t(`/m/code?${i}`)};return n.jsx(Ve,{title:u("project.artifacts.title"),description:u("project.artifacts.subtitle"),fullHeight:!0,className:"min-h-[24rem]",children:n.jsx(UE,{pid:e,onRunInTerminal:o=>a({cmd:o}),onEditArtifact:o=>a({edit:o})})})}function H9({pid:e}){const t=Je(),a=Be(`/api/projects/${e}/organization`,()=>Vr.get(e)),[o,i]=x.useState(null),[c,d]=x.useState(null),[f,m]=x.useState(null),g=()=>void a.mutate(),h=a.data?.areas??[],b=a.data?.roles??[],_=E=>b.filter(y=>y.area===E),j=async()=>{f&&(f.kind==="area"?await Vr.removeArea(e,f.slug):await Vr.removeRole(e,f.slug),t.success(u("common.deleted")),g())};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs(Ve,{title:u("structure.title"),description:u("structure.subtitle"),action:n.jsxs("div",{className:"flex gap-2",children:[n.jsxs(re,{size:"sm",variant:"secondary","data-testid":"structure-new-area",onClick:()=>i({}),children:[n.jsx(Dt,{className:"size-3.5"}),u("structure.new_area")]}),n.jsxs(re,{size:"sm",variant:"primary",onClick:()=>d({}),children:[n.jsx(Dt,{className:"size-3.5"}),u("structure.new_role")]})]}),children:[n.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-sky-500/20 bg-sky-500/5 px-3 py-2 text-[13px] text-muted-foreground",children:[n.jsx(xb,{className:"mt-0.5 size-4 shrink-0 text-sky-500"}),n.jsx("span",{children:u("structure.info")})]}),a.isLoading?n.jsx(tt,{}):h.length===0&&b.length===0?n.jsx(ut,{children:u("structure.empty")}):n.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:[h.map(E=>n.jsxs("div",{className:"group rounded-lg border border-border bg-card/50 p-3",children:[n.jsxs("div",{className:"flex items-start gap-2",children:[n.jsx(Z2,{className:"mt-0.5 size-4 shrink-0 text-emerald-500"}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"truncate text-sm font-semibold",children:E.name}),n.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:E.slug})]}),E.goal&&n.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:E.goal})]}),n.jsxs("div",{className:"flex shrink-0 gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[n.jsx("button",{type:"button",onClick:()=>i({editing:E}),className:"text-muted-foreground hover:text-foreground","aria-label":u("common.edit"),children:n.jsx(wa,{className:"size-3.5"})}),n.jsx("button",{type:"button",onClick:()=>m({kind:"area",slug:E.slug,name:E.name}),className:"text-muted-foreground hover:text-red-500","aria-label":u("common.delete"),children:n.jsx(_n,{className:"size-3.5"})})]})]}),n.jsxs("div",{className:"mt-3 border-t border-border/60 pt-2",children:[n.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[n.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[u("structure.roles")," (",_(E.slug).length,")"]}),n.jsxs("button",{type:"button",onClick:()=>d({presetArea:E.slug}),className:"text-[11px] text-sky-500 hover:text-sky-400",children:["+ ",u("structure.add_role")]})]}),n.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[_(E.slug).map(y=>n.jsx(gw,{role:y,onEdit:()=>d({editing:y}),onDelete:()=>m({kind:"role",slug:y.slug,name:y.name})},y.slug)),_(E.slug).length===0&&n.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:u("structure.no_roles")})]})]})]},E.slug)),_(null).length>0&&n.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-card/30 p-3",children:[n.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[n.jsx(db,{className:"size-3.5"}),u("structure.general_roles")]}),n.jsx("div",{className:"flex flex-wrap gap-1.5",children:_(null).map(E=>n.jsx(gw,{role:E,onEdit:()=>d({editing:E}),onDelete:()=>m({kind:"role",slug:E.slug,name:E.name})},E.slug))})]})]})]}),n.jsx(gE,{open:!!o,onClose:()=>i(null),pid:e,editing:o?.editing,onSaved:g}),n.jsx(hE,{open:!!c,onClose:()=>d(null),pid:e,areas:h,editing:c?.editing,presetArea:c?.presetArea,onSaved:g}),n.jsx(vE,{open:!!f,onClose:()=>m(null),onConfirm:j,title:f?.kind==="area"?u("structure.delete_area"):u("structure.delete_role"),description:f?.kind==="area"?u("structure.delete_area_desc",{name:f?.name??""}):u("structure.delete_role_desc",{name:f?.name??""}),confirmLabel:u("common.delete")})]})}function gw({role:e,onEdit:t,onDelete:a}){return n.jsxs("span",{className:"group/chip inline-flex items-center gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px]",children:[n.jsx(db,{className:"size-3 text-muted-foreground"}),n.jsx("span",{children:e.name}),n.jsx("button",{type:"button",onClick:t,className:"opacity-0 transition-opacity group-hover/chip:opacity-100 text-muted-foreground hover:text-foreground","aria-label":u("common.edit"),children:n.jsx(wa,{className:"size-2.5"})}),n.jsx("button",{type:"button",onClick:a,className:"opacity-0 transition-opacity group-hover/chip:opacity-100 text-muted-foreground hover:text-red-500","aria-label":u("common.delete"),children:n.jsx(_n,{className:"size-2.5"})})]})}function V9(e){switch(e){case"markdown":return{Icon:Ff,color:"text-sky-500"};case"text":return{Icon:$A,color:"text-amber-500"};case"image":return{Icon:ux,color:"text-pink-500"};default:return{Icon:W2,color:"text-muted-foreground"}}}function F9(e){const t=e.split("/"),a=[];for(let o=1;o<t.length;o++)a.push(t.slice(0,o).join("/"));return a}function qE({node:e,depth:t,selectedPath:a,expanded:o,toggle:i,onSelect:c,onDelete:d}){const f=e.type==="dir",m=o.has(e.path),g=a===e.path,{Icon:h,color:b}=f?{Icon:m?Ho:J2,color:"text-muted-foreground"}:V9(e.kind);return n.jsxs("div",{children:[n.jsxs("div",{className:ge("group flex items-center gap-1 rounded px-1.5 py-1 text-[13px] cursor-pointer",g?"bg-primary/15 text-foreground":"hover:bg-accent/40 text-foreground/80"),style:{paddingLeft:t*12+6},onClick:()=>f?i(e.path):c(e),children:[f?m?n.jsx(ms,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx(Zr,{className:"size-3.5 shrink-0 text-muted-foreground"}):n.jsx("span",{className:"w-3.5 shrink-0"}),n.jsx(h,{className:ge("size-3.5 shrink-0",b)}),n.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.name}),d&&!f&&n.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),d(e)},className:"opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-red-500","aria-label":`delete ${e.name}`,children:n.jsx(_n,{className:"size-3.5"})})]}),f&&m&&e.children?.map(_=>n.jsx(qE,{node:_,depth:t+1,selectedPath:a,expanded:o,toggle:i,onSelect:c,onDelete:d},_.path))]})}function G9({nodes:e,selectedPath:t,onSelect:a,onDelete:o,className:i}){const[c,d]=x.useState(()=>new Set);x.useEffect(()=>{t&&d(m=>{const g=new Set(m);for(const h of F9(t))g.add(h);return g})},[t]);const f=m=>d(g=>{const h=new Set(g);return h.has(m)?h.delete(m):h.add(m),h});return n.jsx("div",{className:ge("select-none",i),children:e.map(m=>n.jsx(qE,{node:m,depth:0,selectedPath:t,expanded:c,toggle:f,onSelect:a,onDelete:o},m.path))})}function Y9({open:e,onClose:t,pid:a,scope:o,onCreated:i}){const c=Je(),[d,f]=x.useState(""),[m,g]=x.useState(!1),h=async()=>{let b=d.trim().replace(/^\/+/,"");if(b){/\.[a-z0-9]+$/i.test(b)||(b+=".md"),g(!0);try{await kc.write(a,b,"",o),c.success(u("files.created")),f(""),i(b)}catch(_){c.error(_ instanceof Error?_.message:String(_))}finally{g(!1)}}};return n.jsx(Xt,{open:e,onClose:t,title:u("files.new_doc"),description:u("files.new_doc_hint"),footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,children:u("common.cancel")}),n.jsx(re,{variant:"primary","data-testid":"new-file-create",onClick:()=>void h(),loading:m,disabled:!d.trim(),children:u("files.create")})]}),children:n.jsx(le,{label:u("files.path_label"),hint:u("files.path_example"),children:n.jsx(Ee,{autoFocus:!0,"data-testid":"new-file-path",value:d,onChange:b=>f(b.target.value),onKeyDown:b=>{b.key==="Enter"&&h()},placeholder:"cases/onboarding/spec.md"})})})}function HE({pid:e,scope:t,editable:a=!1,emptyHint:o}){const i=Je(),[c,d]=x.useState(null),[f,m]=x.useState(!1),g=`/api/projects/${e}/fs/tree?scope=${t}`,h=Be(g,()=>kc.tree(e,t)),b=c?`/api/projects/${e}/fs/file?scope=${t}&path=${c}`:null,_=Be(b,()=>c?kc.read(e,c,t):null),j=S=>d(S.path),E=a?async S=>{c&&(await kc.write(e,c,S,t),i.success(u("files.saved")),_.mutate())}:void 0,y=a?async S=>{await kc.remove(e,S.path,t),c===S.path&&d(null),i.success(u("files.deleted")),h.mutate()}:void 0,k=S=>{m(!1),d(S),h.mutate()},N=h.data?.tree??[],w=!h.isLoading&&N.length===0;return n.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden rounded-xl border border-border bg-card",children:[n.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-border",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[n.jsx(Ho,{className:"size-4 text-muted-foreground"}),n.jsx("span",{className:"flex-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u(t==="docs"?"files.docs_label":"files.files_label")}),a&&n.jsx("button",{type:"button","data-testid":"docs-new",onClick:()=>m(!0),className:"text-muted-foreground hover:text-foreground","aria-label":u("files.new_doc"),title:u("files.new_doc"),children:n.jsx(lx,{className:"size-4"})}),n.jsx("button",{type:"button",onClick:()=>void h.mutate(),className:"text-muted-foreground hover:text-foreground","aria-label":u("common.refresh"),children:n.jsx(Cs,{className:h.isValidating?"size-3.5 animate-spin":"size-3.5"})})]}),n.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:[h.isLoading?n.jsx("div",{className:"flex justify-center py-6",children:n.jsx(bn,{size:14})}):w?n.jsx("div",{className:"p-3",children:n.jsx(ut,{children:n.jsxs("div",{className:"space-y-2",children:[n.jsx("p",{children:o??u("files.empty")}),a&&n.jsxs(re,{size:"sm",variant:"secondary",onClick:()=>m(!0),children:[n.jsx(lx,{className:"size-3.5"}),u("files.new_doc")]})]})})}):n.jsx(G9,{nodes:N,selectedPath:c,onSelect:j,onDelete:y}),h.data?.truncated&&n.jsx("p",{className:"px-2 py-1 text-[10px] text-muted-foreground/60",children:u("files.truncated")})]})]}),n.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:n.jsx(X_,{file:_.data??null,loading:!!b&&_.isLoading,onSave:E})}),a&&n.jsx(Y9,{open:f,onClose:()=>m(!1),pid:e,scope:t,onCreated:k})]})}function K9({pid:e}){return n.jsx("div",{className:"h-full",children:n.jsx(HE,{pid:e,scope:"docs",editable:!0,emptyHint:u("files.docs_empty")})})}function X9({pid:e}){return n.jsx("div",{className:"h-full",children:n.jsx(HE,{pid:e,scope:"project"})})}const Eh="default";function Q9(e){const t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||e}function VE(e){return e==="builtin"?{label:u("skills_page.source_builtin"),tone:"info"}:e==="project"?{label:u("skills_page.source_project"),tone:"success"}:{label:u("skills_page.source_global"),tone:"muted"}}function Rh(e){const t=[],a=/(\*\*[^*]+\*\*|`[^`]+`)/g;let o=0,i,c=0;for(;i=a.exec(e);){i.index>o&&t.push(e.slice(o,i.index));const d=i[0];d.startsWith("**")?t.push(n.jsx("strong",{children:d.slice(2,-2)},c++)):t.push(n.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-[0.85em]",children:d.slice(1,-1)},c++)),o=i.index+d.length}return o<e.length&&t.push(e.slice(o)),t}function W9(e){const t=e.split(`
810
- `),a=[];let o=0,i=0;for(;o<t.length;){const c=t[o];if(c.trim().startsWith("```")){const m=[];for(o++;o<t.length&&!t[o].trim().startsWith("```");)m.push(t[o]),o++;o++,a.push(n.jsx("pre",{className:"my-2 overflow-x-auto rounded-md border border-border bg-muted/50 p-3 text-xs",children:n.jsx("code",{children:m.join(`
811
- `)})},i++));continue}const d=c.match(/^(#{1,4})\s+(.*)$/);if(d){const m=d[1].length,g=m===1?"mt-4 mb-1 text-lg font-semibold":m===2?"mt-3 mb-1 text-base font-semibold":"mt-2 mb-0.5 text-sm font-semibold";a.push(n.jsx("div",{className:g,children:Rh(d[2])},i++)),o++;continue}if(/^\s*[-*]\s+/.test(c)){const m=[];for(;o<t.length&&/^\s*[-*]\s+/.test(t[o]);)m.push(n.jsx("li",{children:Rh(t[o].replace(/^\s*[-*]\s+/,""))},m.length)),o++;a.push(n.jsx("ul",{className:"my-1 list-disc space-y-0.5 pl-5 text-sm",children:m},i++));continue}if(c.trim()===""){o++;continue}const f=[];for(;o<t.length&&t[o].trim()!==""&&!/^(#{1,4})\s/.test(t[o])&&!/^\s*[-*]\s+/.test(t[o])&&!t[o].trim().startsWith("```");)f.push(t[o]),o++;a.push(n.jsx("p",{className:"my-1.5 text-sm leading-relaxed",children:Rh(f.join(" "))},i++))}return a}function Z9(e){return new Promise((t,a)=>{const o=new FileReader;o.onload=()=>t(String(o.result).replace(/^data:.*;base64,/,"")),o.onerror=()=>a(new Error("read failed")),o.readAsDataURL(e)})}function FE({scope:e,selectable:t=!1}){const a=Je(),[o,i]=x.useState(e??Eh),c=e??o,d=c===Eh?void 0:c,[f,m]=x.useState(!1),[g,h]=x.useState(null),[b,_]=x.useState("preview"),[j,E]=x.useState(!1),[y,k]=x.useState(!1),N=x.useRef(null),{data:w}=Be(t?"/api/projects":null,()=>Zn.list()),S=x.useMemo(()=>[{value:Eh,label:u("skills_page.scope_super_agent")},...(w??[]).map(V=>({value:V.path,label:V.name||Q9(V.path)}))],[w]),{data:R,mutate:A,isLoading:T}=Be(["/api/skills",c],()=>Us.list(d)),z=x.useMemo(()=>R?.skills??[],[R]),M=z.filter(V=>V.enabled!==!1).length,P=g&&z.some(V=>V.slug===g)?g:z[0]?.slug??null,{data:L}=Be(P?["/skill-detail",c,P]:null,()=>Us.detail(P,d)),I=async(V,X)=>{m(!0);try{await Us.setEnabled({slug:V,enabled:X,scope:c}),await A()}catch(Q){a.error(u("skills_page.toggle_failed",{msg:Q.message}))}finally{m(!1)}},D=async V=>{if(window.confirm(u("skills_page.delete_confirm",{slug:V}))){m(!0);try{await Us.remove(V,d),a.success(u("skills_page.deleted_ok",{slug:V})),g===V&&h(null),await A()}catch(X){a.error(u("skills_page.delete_failed",{msg:X.message}))}finally{m(!1)}}},$=async(V,X)=>{a.success(X),h(V),await A()},q=async(V,X,Q)=>{await Us.create({slug:V,description:X,body:Q,project_path:d}),await $(V,u("skills_page.created_ok",{slug:V}))},G=async V=>{const X=await Us.importRepo({url:V,project_path:d});await $(X.slug,u("skills_page.imported_ok",{slug:X.slug}))},U=async V=>{if(V){m(!0);try{const X=await Z9(V),Q=await Us.importZip({data:X,project_path:d});await $(Q.slug,u("skills_page.imported_ok",{slug:Q.slug}))}catch(X){a.error(u("skills_page.import_failed",{msg:X.message}))}finally{m(!1),N.current&&(N.current.value="")}}};return n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t?n.jsx("div",{className:"w-64",children:n.jsx(ct,{value:c,onChange:V=>{i(V),h(null)},options:S,placeholder:u("skills_page.scope_ph")})}):null,n.jsx($e,{tone:"muted",children:u("skills_page.count_label",{n:z.length,on:M})})]}),n.jsxs(y_,{children:[n.jsxs(j_,{disabled:f,className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:[n.jsx(Dt,{size:15})," ",u("skills_page.add_menu")," ",n.jsx(ms,{size:14})]}),n.jsxs(k_,{align:"end",sideOffset:6,className:"w-72",children:[n.jsxs(af,{onClick:()=>E(!0),children:[n.jsx(dM,{size:15,className:"text-muted-fg"}),n.jsx(Th,{title:u("skills_page.add_online"),hint:u("skills_page.add_online_hint")})]}),n.jsxs(af,{onClick:()=>N.current?.click(),children:[n.jsx(lS,{size:15,className:"text-muted-fg"}),n.jsx(Th,{title:u("skills_page.add_zip"),hint:u("skills_page.add_zip_hint")})]}),n.jsxs(af,{onClick:()=>k(!0),children:[n.jsx(Zc,{size:15,className:"text-muted-fg"}),n.jsx(Th,{title:u("skills_page.add_repo"),hint:u("skills_page.add_repo_hint")})]})]})]}),n.jsx("input",{ref:N,type:"file",accept:".zip",className:"hidden",onChange:V=>U(V.target.files?.[0])})]}),T||!R?n.jsx(tt,{}):n.jsxs("div",{className:"grid min-h-[62vh] gap-4 lg:grid-cols-[20rem_1fr]",children:[n.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:n.jsx("ul",{className:"max-h-[62vh] divide-y divide-border overflow-y-auto",children:z.length===0?n.jsx("li",{className:"px-3 py-4 text-sm text-muted-fg",children:u("skills_page.empty")}):z.map(V=>n.jsx(J9,{skill:V,active:V.slug===P,busy:f,onSelect:()=>h(V.slug),onToggle:X=>I(V.slug,X)},V.slug))})}),n.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border bg-card",children:P?L?n.jsxs("div",{className:"flex h-full max-h-[62vh] flex-col",children:[n.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border px-5 py-4",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("code",{className:"text-sm font-semibold",children:L.slug}),(()=>{const V=VE(L.source);return n.jsx($e,{tone:V.tone,children:V.label})})(),L.private&&n.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-fg",children:[n.jsx(aS,{size:11})," ",u("skills_page.private_badge")]})]}),L.description&&n.jsx("p",{className:"mt-1 text-sm text-muted-fg",children:L.description}),n.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-6 gap-y-1 text-xs text-muted-fg",children:[n.jsxs("span",{children:[u("skills_page.added_by"),": ",n.jsx("span",{className:"text-foreground",children:L.private?u("skills_page.by_apx"):u("skills_page.by_you")})]}),n.jsxs("span",{children:[u("skills_page.activator"),": ",n.jsx("span",{className:"text-foreground",children:u("skills_page.activator_value")})]})]})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[(L.source==="global"||L.source==="project")&&n.jsx(Ue,{content:u("skills_page.delete_btn"),children:n.jsx(re,{variant:"ghost",size:"sm",disabled:f,onClick:()=>D(L.slug),"aria-label":u("skills_page.delete_btn"),children:n.jsx(_n,{size:14})})}),n.jsx(Bt,{checked:L.private?!0:L.enabled,disabled:f||L.private,onChange:V=>I(L.slug,V),label:L.private||L.enabled?u("skills_page.on"):u("skills_page.off")})]})]}),n.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:[n.jsx(hw,{active:b==="preview",onClick:()=>_("preview"),icon:Ff,label:u("skills_page.tab_preview")}),n.jsx(hw,{active:b==="source",onClick:()=>_("source"),icon:zA,label:u("skills_page.tab_source")})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:b==="preview"?n.jsx("div",{className:"prose-none",children:W9(L.body||"")}):n.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-fg",children:L.body})})]}):n.jsx("div",{className:"p-6",children:n.jsx(tt,{})}):n.jsx("div",{className:"grid h-full place-items-center p-8 text-sm text-muted-fg",children:u("skills_page.select_a_skill")})})]}),n.jsx(eB,{open:j,onClose:()=>E(!1),onCreate:q}),n.jsx(tB,{open:y,onClose:()=>k(!1),onImport:G})]})}function Th({title:e,hint:t}){return n.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[n.jsx("span",{className:"font-medium",children:e}),n.jsx("span",{className:"text-[11px] text-muted-fg",children:t})]})}function hw({active:e,onClick:t,icon:a,label:o}){return n.jsxs("button",{type:"button",onClick:t,className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition ${e?"bg-accent text-foreground":"text-muted-fg hover:text-foreground"}`,children:[n.jsx(a,{size:13})," ",o]})}function J9({skill:e,active:t,busy:a,onSelect:o,onToggle:i}){const c=VE(e.source),d=e.private?!0:e.enabled!==!1;return n.jsx("li",{children:n.jsxs("div",{className:`flex items-center gap-2 px-3 py-2.5 ${t?"bg-accent/50":"hover:bg-accent/25"}`,children:[n.jsxs("button",{type:"button",onClick:o,className:"min-w-0 flex-1 text-left",children:[n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("code",{className:"truncate text-[13px] font-medium",children:e.slug}),e.private&&n.jsx(aS,{size:10,className:"shrink-0 text-muted-fg"})]}),n.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[n.jsx($e,{tone:c.tone,children:c.label}),e.overridden&&n.jsx($e,{tone:"warning",children:u("skills_page.overridden_badge")})]})]}),n.jsx(Bt,{checked:d,disabled:a||e.private,onChange:i})]})})}function eB({open:e,onClose:t,onCreate:a}){const o=Je(),[i,c]=x.useState(""),[d,f]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(!1),_=/^[a-z0-9][a-z0-9-]*$/.test(i),j=()=>{c(""),f(""),g("")},E=async()=>{if(_){b(!0);try{await a(i,d,m),j(),t()}catch(y){o.error(u("skills_page.create_failed",{msg:y.message}))}finally{b(!1)}}};return n.jsx(Xt,{open:e,onClose:t,title:u("skills_page.create_dialog_title"),description:u("skills_page.add_desc"),size:"lg",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:h,children:u("skills_page.cancel")}),n.jsxs(re,{variant:"primary",onClick:E,disabled:h||!_,loading:h,children:[n.jsx(Dt,{size:14})," ",u("skills_page.add_btn")]})]}),children:n.jsxs("div",{className:"space-y-4",children:[n.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[n.jsx(le,{label:u("skills_page.add_slug_label"),children:n.jsx(Ee,{value:i,placeholder:u("skills_page.add_slug_ph"),disabled:h,onChange:y=>c(y.target.value.toLowerCase())})}),n.jsx(le,{label:u("skills_page.add_desc_label"),children:n.jsx(Ee,{value:d,placeholder:u("skills_page.add_desc_ph"),disabled:h,onChange:y=>f(y.target.value)})})]}),n.jsx(le,{label:u("skills_page.add_body_label"),children:n.jsx(un,{value:m,placeholder:u("skills_page.add_body_ph"),disabled:h,rows:10,onChange:y=>g(y.target.value)})})]})})}function tB({open:e,onClose:t,onImport:a}){const o=Je(),[i,c]=x.useState(""),[d,f]=x.useState(!1),m=/^(https?:\/\/|git@|ssh:\/\/|git:\/\/)\S+$/.test(i.trim()),g=async()=>{if(m){f(!0);try{await a(i.trim()),c(""),t()}catch(h){o.error(u("skills_page.import_failed",{msg:h.message}))}finally{f(!1)}}};return n.jsx(Xt,{open:e,onClose:t,title:u("skills_page.repo_dialog_title"),size:"md",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:d,children:u("skills_page.cancel")}),n.jsxs(re,{variant:"primary",onClick:g,disabled:d||!m,loading:d,children:[n.jsx(Zc,{size:14})," ",u("skills_page.import_btn")]})]}),children:n.jsx(le,{label:u("skills_page.repo_url_label"),hint:u("skills_page.repo_url_hint"),children:n.jsx(Ee,{value:i,placeholder:u("skills_page.repo_url_ph"),disabled:d,onChange:h=>c(h.target.value),onKeyDown:h=>{h.key==="Enter"&&g()}})})})}function nB({pid:e}){const{project:t}=uu(e),a=e==="0"?"default":t?.path;return a?n.jsx(FE,{scope:a}):n.jsx(tt,{})}function sB(){const e=Tn(),t=ns(),{pid:a=""}=P2(),{project:o}=uu(a),{collapsed:i,toggle:c}=C_(Dn.sidebarCollapsed+".project"),d=String(a)==="0",{data:f}=Be(`integrations-catalog-${a}`,()=>Yn.catalog(a),{shouldRetryOnError:!1}),m=f?.find(j=>j.slug==="obsidian"),g=m?.status?.status==="active"&&!!m?.status?.is_enabled,h=x.useMemo(()=>{const j=g?n.jsx(UN,{className:"size-3 text-purple-400"}):void 0,E=!d&&o?.kind==="company";return[d?{title:u("base.nav_general"),items:[{key:"workspaces",label:u("base.workspaces_title"),icon:jA},{key:"models",label:u("settings.tabs.engines"),icon:pb},{key:"agent-defaults",label:u("base.defaults_title"),icon:rn}]}:null,{title:u("project.sections.workspace"),items:[{key:"",label:u("project.nav.overview"),icon:eM},...E?[{key:"structure",label:u("project.nav.structure"),icon:wA}]:[],{key:"agents",label:u("project.nav.agents"),icon:rn},{key:"memories",label:u("project.nav.memories"),icon:Dc,mark:j},{key:"skills",label:u("skills_page.title"),icon:sa},{key:"artifacts",label:u("project.nav.artifacts"),icon:gb}]},{title:u("base.nav_activity"),items:[{key:"chat",label:u("project.nav.chat"),icon:Jc},{key:"sessions",label:u("base.sessions_title"),icon:WA},{key:"logs",label:u("project.nav.logs"),icon:jb}]},d?null:{title:u("project.sections.content"),items:[{key:"docs",label:u("project.nav.docs"),icon:Ff},{key:"files",label:u("project.nav.files"),icon:hb}]},{title:u("project.sections.automation"),items:[{key:"routines",label:u("project.nav.routines"),icon:zo},{key:"tasks",label:u("project.nav.tasks"),icon:pl},{key:"mcps",label:u("project.nav.mcps"),icon:Yf},{key:"integrations",label:"Integrations",icon:SA},{key:"vars",label:u("project.nav.vars"),icon:sS}]},{title:u("project.sections.config"),items:[{key:"config",label:u("project.nav.config"),icon:Xf}]}].filter(Boolean)},[d,o?.kind,g]),b=t.pathname.replace(`/p/${a}`,"").replace(/^\//,"").split("/")[0];if(!o)return n.jsx(HN,{testId:"screen-project-not-found",mood:"confused",message:u("project.not_found",{pid:a}),action:n.jsx(or,{variant:"outline",onClick:()=>e("/"),children:u("not_found.home")})});const _=j=>{const E=j?`/p/${a}/${j}`:`/p/${a}`;e(E)};return n.jsx($N,{sections:h,active:b,onChange:_,collapsed:i,onToggleCollapse:c,contentClassName:"w-full space-y-6 py-6 pt-3 pr-6 pl-1",testId:`project-tab-${b||"overview"}`,children:n.jsxs($2,{children:[n.jsx(zt,{index:!0,element:n.jsx(qk,{pid:a})}),n.jsx(zt,{path:"workspaces",element:n.jsx(x8,{})}),n.jsx(zt,{path:"models",element:n.jsx(cE,{})}),n.jsx(zt,{path:"agent-defaults",element:n.jsx(CI,{})}),n.jsx(zt,{path:"sessions",element:n.jsx(MI,{pid:a})}),n.jsx(zt,{path:"logs",element:n.jsx(lI,{pid:a})}),n.jsx(zt,{path:"config",element:n.jsx(XI,{pid:a})}),n.jsx(zt,{path:"telegram",element:n.jsx(mE,{pid:a})}),n.jsx(zt,{path:"agents",element:n.jsx(x7,{pid:a})}),n.jsx(zt,{path:"agents/:slug",element:n.jsx(a7,{pid:a})}),n.jsx(zt,{path:"structure",element:n.jsx(H9,{pid:a})}),n.jsx(zt,{path:"docs",element:n.jsx(K9,{pid:a})}),n.jsx(zt,{path:"files",element:n.jsx(X9,{pid:a})}),n.jsx(zt,{path:"memories",element:n.jsx(B9,{pid:a})}),n.jsx(zt,{path:"skills",element:n.jsx(nB,{pid:a})}),n.jsx(zt,{path:"routines",element:n.jsx(A7,{pid:a})}),n.jsx(zt,{path:"tasks",element:d?n.jsx(zI,{}):n.jsx(z7,{pid:a})}),n.jsx(zt,{path:"mcps",element:n.jsx(F7,{pid:a})}),n.jsx(zt,{path:"integrations",element:n.jsx(o9,{pid:a})}),n.jsx(zt,{path:"artifacts",element:n.jsx(q9,{pid:a})}),n.jsx(zt,{path:"vars",element:n.jsx(i9,{pid:a})}),n.jsx(zt,{path:"threads",element:n.jsx(O3,{to:`/p/${a}/chat`,replace:!0})}),n.jsx(zt,{path:"chat",element:n.jsx(A9,{pid:a})}),n.jsx(zt,{path:"*",element:n.jsx(qk,{pid:a})})]})})}function aB({value:e,onChange:t,options:a,placeholder:o,className:i}){const c=w=>a.find(S=>S.value===w)?.label??w,[d,f]=x.useState(!1),[m,g]=x.useState(c(e)),h=x.useRef(null),b=x.useRef(null),[_,j]=x.useState(null);x.useEffect(()=>{g(c(e))},[e,a]),x.useLayoutEffect(()=>{if(!d)return;const w=()=>{const S=h.current;if(!S)return;const R=S.getBoundingClientRect();j({top:R.bottom+4,left:R.left,width:R.width})};return w(),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),()=>{window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w)}},[d]),x.useEffect(()=>{if(!d)return;const w=S=>{const R=S.target;h.current?.contains(R)||b.current?.contains(R)||(g(c(e)),f(!1))};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[d,e,a]);const E=m.trim().toLowerCase(),y=m===c(e),k=E&&!y?a.filter(w=>w.label.toLowerCase().includes(E)||w.value.toLowerCase().includes(E)):a,N=w=>{t(w.value),g(w.label),f(!1)};return n.jsxs("div",{ref:h,className:ge("relative",i),children:[n.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-input bg-transparent px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring dark:bg-input/30 dark:hover:bg-input/50",children:[n.jsx("input",{value:m,placeholder:o,onChange:w=>{g(w.target.value),f(!0)},onFocus:()=>f(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),n.jsx("button",{type:"button",tabIndex:-1,onClick:()=>f(w=>!w),className:"shrink-0 text-muted-fg hover:text-foreground",children:n.jsx(ms,{className:"size-4"})})]}),d&&k.length>0&&_&&Gs.createPortal(n.jsx("ul",{ref:b,style:{position:"fixed",top:_.top,left:_.left,width:_.width},className:"z-[1000] max-h-60 overflow-y-auto rounded-lg bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:k.map(w=>n.jsx("li",{children:n.jsx("button",{type:"button",onMouseDown:S=>{S.preventDefault(),N(w)},className:ge("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",w.value===e&&"bg-accent/50"),children:n.jsx("span",{className:"truncate font-mono text-xs",children:w.label})})},w.value))}),document.body)]})}const rB=["es","en","pt","fr","it","de","ca","gl","eu","nl","sv","no","da","fi","is","pl","cs","sk","sl","hr","sr","uk","ru","bg","ro","hu","el","tr","ar","he","fa","hi","bn","ta","ur","id","ms","vi","th","ko","ja","zh"];function oB(e){return e&&e.charAt(0).toLocaleUpperCase()+e.slice(1)}function iB(){const e=S_();let t=null;try{t=new Intl.DisplayNames([e],{type:"language"})}catch{t=null}return rB.map(a=>{const o=t?.of(a);return{value:a,label:o?oB(o):a}}).sort((a,o)=>a.label.localeCompare(o.label,e))}const lB=["UTC","America/Argentina/Buenos_Aires","America/Sao_Paulo","America/New_York","America/Los_Angeles","America/Mexico_City","Europe/London","Europe/Madrid","Europe/Berlin","Asia/Tokyo","Asia/Shanghai","Australia/Sydney"];function cB(){try{const e=Intl.supportedValuesOf;if(typeof e=="function")return e("timeZone")}catch{}return lB}function xw(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function uB(e,t){try{const a=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t).find(c=>c.type==="timeZoneName")?.value??"GMT",o=/GMT([+-])(\d{1,2})(?::(\d{2}))?/.exec(a);return o?(o[1]==="-"?-1:1)*(parseInt(o[2],10)*60+(o[3]?parseInt(o[3],10):0)):0}catch{return 0}}function dB(e){const t=e<0?"-":"+",a=Math.abs(e),o=String(Math.floor(a/60)).padStart(2,"0"),i=String(a%60).padStart(2,"0");return`GMT${t}${o}:${i}`}let Xd=null;function fB(){if(Xd)return Xd;const e=new Date;return Xd=cB().map(t=>({value:t,label:t,off:uB(t,e)})).sort((t,a)=>t.off-a.off||t.value.localeCompare(a.value)).map(({value:t,off:a})=>({value:t,label:`(${dB(a)}) ${t}`})),Xd}function pB(){const e=Je(),{identity:t,isLoading:a,save:o}=T_(),[i,c]=x.useState({}),[d,f]=x.useState(!1),m=x.useMemo(()=>fB(),[]);if(x.useEffect(()=>{c({...t,timezone:t?.timezone||xw()})},[t]),a)return n.jsx(tt,{});const g=async()=>{f(!0);try{await o({owner_name:i.owner_name,owner_context:i.owner_context,language:i.language,timezone:i.timezone}),e.success(u("settings.identity.saved"))}catch(h){e.error(h.message)}finally{f(!1)}};return n.jsxs(Ve,{title:u("settings.identity.title"),description:u("settings.identity.subtitle"),children:[t?null:n.jsx(ut,{children:u("common.none_yet")}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("settings.identity.owner_name"),children:n.jsx(Ee,{value:i.owner_name||"",onChange:h=>c({...i,owner_name:h.target.value})})}),n.jsx(le,{label:u("settings.identity.language"),children:n.jsx(ct,{value:i.language||"es",onChange:h=>c({...i,language:h}),options:iB()})}),n.jsx(le,{label:u("settings.identity.timezone"),hint:u("settings.identity.timezone_hint"),children:n.jsx(aB,{value:i.timezone||xw(),onChange:h=>c({...i,timezone:h}),options:m})})]}),n.jsx("div",{className:"mt-3",children:n.jsx(le,{label:u("settings.identity.owner_context"),hint:u("settings.identity.owner_context_hint"),children:n.jsx(un,{rows:3,value:i.owner_context||"",onChange:h=>c({...i,owner_context:h.target.value})})})}),n.jsx("div",{className:"mt-4",children:n.jsx(re,{variant:"primary",loading:d,onClick:g,children:u("common.save")})})]})}function mB(){const e=Je(),t=Tn(),{superAgent:a,isLoading:o,mutate:i}=iE(),{patch:c}=ur(),{identity:d,save:f}=T_(),[m,g]=x.useState(!0),[h,b]=x.useState(""),[_,j]=x.useState(""),[E,y]=x.useState("permiso"),[k,N]=x.useState(!1);if(x.useEffect(()=>{a&&(g(!!a.enabled),b(a.system||""),y(a.permission_mode||"permiso"))},[a]),x.useEffect(()=>{j(d.personality||"")},[d.personality]),o||!a)return n.jsx(tt,{});const w=async()=>{N(!0);try{await c({"super_agent.enabled":m,"super_agent.system":h,"super_agent.permission_mode":E},["super_agent.name"]),await f({personality:_}),e.success(u("settings.super_agent.saved")),i()}catch(S){e.error(S.message)}finally{N(!1)}};return n.jsx(Ve,{title:u("settings.super_agent.title"),description:u("settings.super_agent.behavior_subtitle"),children:n.jsxs("div",{className:"space-y-4",children:[n.jsx("div",{className:"flex items-center gap-3",children:n.jsx(Bt,{checked:m,onChange:g,label:u("settings.super_agent.enabled_label")})}),n.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("div",{className:"text-sm font-medium",children:u("settings.super_agent.model_active")}),n.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:a.model||"—"})]}),n.jsxs(re,{size:"sm",variant:"secondary",onClick:()=>t("/p/0/models"),children:[n.jsx(pb,{size:13})," ",u("settings.super_agent.model_configure")]})]}),n.jsx(le,{label:u("settings.super_agent.permission_mode"),children:n.jsx(ct,{value:E,onChange:y,options:Cb.map(S=>({value:S,label:S}))})}),n.jsx(le,{label:u("settings.super_agent.personality"),children:n.jsx(un,{rows:2,value:_,onChange:S=>j(S.target.value)})}),n.jsx(le,{label:u("settings.super_agent.system"),hint:u("settings.super_agent.system_hint"),children:n.jsx(un,{rows:6,className:"font-mono text-xs",value:h,onChange:S=>b(S.target.value),placeholder:u("settings.super_agent.system_ph")})}),n.jsx(re,{variant:"primary",loading:k,onClick:w,children:u("common.save")})]})})}const Xi={list:()=>se.get("/api/profiles"),get:e=>se.get(`/api/profiles/${encodeURIComponent(e)}`),doctor:e=>se.get(`/api/profiles/doctor${e?`?id=${encodeURIComponent(e)}`:""}`),install:(e,t=!1)=>se.post("/api/profiles/install",{source:e,force:t}),use:(e,t=!1)=>se.post("/api/profiles/use",{id:e,force:t}),off:()=>se.post("/api/profiles/off",{}),setConfig:(e,t)=>se.patch("/api/profiles/config",{values:e,id:t}),uninstall:e=>se.del(`/api/profiles/${encodeURIComponent(e)}`)};function gB(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/profiles",()=>Xi.list());return{active:e?.active??null,profiles:e?.profiles??[],error:t,isLoading:a,mutate:o}}function hB(e){const{data:t,error:a,isLoading:o,mutate:i}=Be(e?`/api/profiles/${e}`:null,()=>Xi.get(e));return{profile:t,error:a,isLoading:o,mutate:i}}function xB(e){const{data:t,error:a,isLoading:o,mutate:i}=Be(e?`/api/profiles/doctor?id=${e}`:"/api/profiles/doctor",()=>Xi.doctor(e||void 0));return{doctor:t,error:a,isLoading:o,mutate:i}}function bB(){const e=Je(),{active:t,profiles:a,isLoading:o,mutate:i}=gB(),[c,d]=x.useState(null),f=c??t??a[0]?.id??null,{profile:m,mutate:g}=hB(f),{doctor:h,mutate:b}=xB(t),[_,j]=x.useState({}),[E,y]=x.useState(!1),[k,N]=x.useState(!1);x.useEffect(()=>{if(!m)return;const P={};for(const[L,I]of Object.entries(m.config||{}))P[L]=String(I??"");j(P)},[m?.id,m?.config]);const w=async()=>{await Promise.all([i(),g(),b()])};if(o)return n.jsx(tt,{});const S=async(P,L)=>{y(!0);try{const I=await Xi.use(P,L);for(const D of I.warnings||[])e.error(D);await w(),e.success(u("settings.profile.activated"))}catch(I){e.error(I.message)}finally{y(!1)}},R=async()=>{y(!0);try{await Xi.off(),await w(),e.success(u("settings.profile.deactivated"))}catch(P){e.error(P.message)}finally{y(!1),N(!1)}},A=async()=>{if(m){y(!0);try{const P=await Xi.setConfig(_,m.id);await w();const L=P.routines?.installed?.length??0;e.success(L>0?u("settings.profile.saved_with_routines"):u("settings.profile.saved"))}catch(P){e.error(P.message)}finally{y(!1)}}},T=m?.schema?.properties||{},z=!!m?.budget&&!!m?.tokens&&m.tokens>m.budget,M=!!m?.active;return n.jsxs("div",{className:"flex flex-col gap-4","data-testid":"profile-panel",children:[n.jsxs(Ve,{title:u("settings.profile.title"),description:u("settings.profile.subtitle"),children:[n.jsxs("div",{"data-testid":"profile-vanilla-hint",className:"mb-3 flex items-start gap-2 rounded-md border border-border bg-muted/40 p-3 text-sm",children:[n.jsx(xb,{size:16,className:"mt-0.5 shrink-0 opacity-70"}),n.jsx("span",{children:u(t?"settings.profile.active_hint":"settings.profile.vanilla_hint")})]}),a.length?n.jsx("div",{className:"grid gap-2 lg:grid-cols-2",children:a.map(P=>n.jsxs("button",{"data-testid":`profile-row-${P.id}`,type:"button",onClick:()=>d(P.id),className:`flex items-start justify-between gap-3 rounded-md border p-3 text-left transition ${P.id===f?"border-primary bg-muted/40":"border-border hover:bg-muted/20"}`,children:[n.jsxs("span",{className:"min-w-0",children:[n.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[n.jsx("span",{className:"font-medium",children:P.name}),n.jsx($e,{children:P.source}),P.active?n.jsx($e,{tone:"success",children:u("settings.profile.active")}):null]}),P.description?n.jsx("span",{className:"mt-0.5 block text-sm opacity-70",children:P.description}):null]}),n.jsx("span",{className:"shrink-0 text-xs opacity-60",children:P.version?`v${P.version}`:""})]},P.id))}):n.jsx(ut,{children:u("settings.profile.none_available")}),m?n.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[m.active?n.jsx(re,{variant:"destructive",loading:E,onClick:()=>N(!0),children:u("settings.profile.deactivate")}):n.jsx(re,{variant:"primary",loading:E,onClick:()=>S(m.id,!!t),children:u(t?"settings.profile.replace_active":"settings.profile.activate")}),n.jsxs("span",{className:"text-xs opacity-60",children:[u("settings.profile.token_cost"),": ~",m.tokens??0,m.budget?` / ${m.budget}`:"",z?` — ${u("settings.profile.over_budget")}`:""]})]}):null]}),n.jsxs("div",{className:"grid items-start gap-4 xl:grid-cols-2",children:[n.jsx(Ve,{title:u("settings.profile.settings_title"),description:u("settings.profile.settings_subtitle"),children:Object.keys(T).length?n.jsxs(n.Fragment,{children:[M?null:n.jsx("p",{className:"mb-3 text-sm opacity-60",children:u("settings.profile.settings_locked")}),n.jsx("div",{className:"grid gap-3 sm:grid-cols-2",children:Object.entries(T).map(([P,L])=>n.jsx(le,{label:L.title||P,hint:L.description,children:L.enum?n.jsx(ct,{value:_[P]??String(L.default??""),onChange:I=>j({..._,[P]:I}),options:L.enum.map(I=>({value:String(I),label:String(I)})),disabled:!M}):n.jsx(Ee,{value:_[P]??"",disabled:!M,onChange:I=>j({..._,[P]:I.target.value})})},P))}),n.jsx("div",{className:"mt-4",children:n.jsx(re,{variant:"primary",loading:E,disabled:!M,onClick:A,children:u("common.save")})})]}):n.jsx(ut,{children:u("settings.profile.no_settings")})}),n.jsxs("div",{className:"flex flex-col gap-4",children:[n.jsx(Ve,{title:u("settings.profile.doctor_title"),description:h?.summary||"",children:h?.checks?.length?n.jsx("ul",{className:"flex flex-col gap-2",children:h.checks.map((P,L)=>n.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[n.jsx(wb,{size:16,className:`mt-0.5 shrink-0 ${P.level==="error"?"text-red-500":"text-amber-500"}`}),n.jsxs("span",{className:"min-w-0",children:[n.jsxs("span",{className:"opacity-60",children:["[",P.label,"]"]})," ",P.detail,P.fix?n.jsx("code",{className:"mt-1 block overflow-x-auto rounded bg-muted px-1.5 py-0.5 text-xs",children:P.fix}):null]})]},L))}):n.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[n.jsx(Vf,{size:16,className:"text-emerald-500"}),u(t?"settings.profile.doctor_clean":"settings.profile.doctor_vanilla")]})}),n.jsx(Ve,{title:u("settings.profile.preview_title"),description:m?.active?u("settings.profile.preview_subtitle"):u("settings.profile.preview_inactive"),children:n.jsx("pre",{"data-testid":"profile-preview",className:`max-h-[32rem] overflow-auto whitespace-pre-wrap rounded-md border border-border bg-muted/30 p-3 text-xs leading-relaxed ${m?.active?"":"opacity-60"}`,children:m?.preview||u("settings.profile.preview_empty")})})]})]}),n.jsx(Xt,{open:k,onClose:()=>N(!1),title:u("settings.profile.deactivate_title"),footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{onClick:()=>N(!1),children:u("common.cancel")}),n.jsx(re,{variant:"destructive",loading:E,onClick:R,children:u("settings.profile.deactivate")})]}),children:u("settings.profile.deactivate_confirm")})]})}const Ah={providers:()=>se.get("/api/embeddings/providers"),test:(e={})=>se.post("/api/embeddings/test",e),reindex:()=>se.post("/api/embeddings/reindex",{})},_B=()=>[{value:"auto",label:u("memory_panel.provider_auto")},{value:"ollama",label:u("memory_panel.provider_ollama")},{value:"gemini",label:u("memory_panel.provider_gemini")},{value:"openai",label:u("memory_panel.provider_openai")},{value:"tf",label:u("memory_panel.provider_tf")}],vB=()=>[{value:"chain",label:u("memory_panel.mode_chain")},{value:"single",label:u("memory_panel.mode_single")}],bw=e=>e.startsWith("***");function yB(){const e=Je(),{config:t,isLoading:a,patch:o}=ur(),{data:i,mutate:c}=Be("/api/embeddings/providers",()=>Ah.providers()),[d,f]=x.useState(!1),[m,g]=x.useState(null);if(a)return n.jsx(tt,{});const h=t.memory||{},b=h.embeddings||{},_=i?.configured_provider||b.provider||"auto",j=i?.mode||b.mode||"chain",E=i?.engines||[],y=async w=>{f(!0);try{await o(w),await c()}catch(S){e.error(u("memory_panel.save_failed",{msg:S.message}))}finally{f(!1)}},k=async()=>{f(!0),g(null);try{const w=await Ah.test({});g(`${w.embedder} · dim ${w.dim} · ${w.ms}ms`),e.success(u("memory_panel.test_ok",{embedder:w.embedder}))}catch(w){e.error(u("memory_panel.test_failed",{msg:w.message}))}finally{f(!1)}},N=async()=>{f(!0);try{const w=await Ah.reindex();e.success(u("memory_panel.reindexed",{indexed:w.indexed,cleared:w.cleared}))}catch(w){e.error(u("memory_panel.reindex_failed",{msg:w.message}))}finally{f(!1)}};return n.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[n.jsx(Ve,{title:u("memory_panel.embeddings_title"),description:u("memory_panel.embeddings_desc"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("memory_panel.provider_label"),hint:u("memory_panel.provider_hint"),children:n.jsx(ct,{value:_,onChange:w=>y({"memory.embeddings.provider":w}),options:_B(),disabled:d,className:"max-w-xl"})}),n.jsx(le,{label:u("memory_panel.mode_label"),hint:u("memory_panel.mode_hint"),children:n.jsx(ct,{value:j,onChange:w=>y({"memory.embeddings.mode":w}),options:vB(),disabled:d,className:"max-w-md"})}),n.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:E.map(w=>n.jsxs($e,{tone:w.available?"success":"muted",children:[w.id,": ",w.available?u("memory_panel.available"):u("memory_panel.unavailable")]},w.id))}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[n.jsxs(re,{variant:"secondary",onClick:k,loading:d,children:[n.jsx(sa,{size:14})," ",u("memory_panel.test_btn")]}),n.jsxs(re,{variant:"secondary",onClick:N,loading:d,children:[n.jsx(X2,{size:14})," ",u("memory_panel.reindex_btn")]}),m&&n.jsx("span",{className:"text-sm text-muted-foreground",children:m})]})]})}),n.jsxs(Ve,{title:u("memory_panel.ollama_title"),description:u("memory_panel.ollama_desc"),children:[n.jsx(le,{label:u("memory_panel.model_label"),children:n.jsx(Ee,{defaultValue:b.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:d,onBlur:w=>{const S=w.target.value.trim();S&&S!==b.ollama?.model&&y({"memory.embeddings.ollama.model":S})},className:"max-w-md"})}),n.jsx(le,{label:u("memory_panel.base_url_label"),hint:u("memory_panel.ollama_base_url_hint"),children:n.jsx(Ee,{defaultValue:b.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:d,onBlur:w=>y({"memory.embeddings.ollama.base_url":w.target.value.trim()}),className:"max-w-md"})})]}),n.jsxs(Ve,{title:u("memory_panel.openai_title"),description:u("memory_panel.openai_desc"),children:[n.jsx(le,{label:u("memory_panel.model_label"),children:n.jsx(Ee,{defaultValue:b.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:d,onBlur:w=>{const S=w.target.value.trim();S&&S!==b.openai?.model&&y({"memory.embeddings.openai.model":S})},className:"max-w-md"})}),n.jsx(le,{label:u("memory_panel.api_key_label"),hint:u("memory_panel.openai_key_hint"),children:n.jsx(Ee,{type:"password",defaultValue:b.openai?.api_key||"",placeholder:"sk-…",disabled:d,onBlur:w=>{const S=w.target.value;S&&!bw(S)&&y({"memory.embeddings.openai.api_key":S})},className:"max-w-md"})})]}),n.jsxs(Ve,{title:u("memory_panel.gemini_title"),description:u("memory_panel.gemini_desc"),children:[n.jsx(le,{label:u("memory_panel.model_label"),children:n.jsx(Ee,{defaultValue:b.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:d,onBlur:w=>{const S=w.target.value.trim();S&&S!==b.gemini?.model&&y({"memory.embeddings.gemini.model":S})},className:"max-w-md"})}),n.jsx(le,{label:u("memory_panel.api_key_label"),hint:u("memory_panel.gemini_key_hint"),children:n.jsx(Ee,{type:"password",defaultValue:b.gemini?.api_key||"",placeholder:"AIza…",disabled:d,onBlur:w=>{const S=w.target.value;S&&!bw(S)&&y({"memory.embeddings.gemini.api_key":S})},className:"max-w-md"})})]}),n.jsxs(Ve,{title:u("memory_panel.compaction_title"),description:u("memory_panel.compaction_desc"),children:[n.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[n.jsx(le,{label:u("memory_panel.threshold_label"),hint:u("memory_panel.threshold_hint"),children:n.jsx(Ee,{type:"number",min:1,defaultValue:h.compact_threshold??60,placeholder:"60",disabled:d,onBlur:w=>{const S=parseInt(w.target.value,10);Number.isFinite(S)&&S>0&&S!==h.compact_threshold&&y({"memory.compact_threshold":S})},className:"max-w-[10rem]"})}),n.jsx(le,{label:u("memory_panel.keep_recent_label"),hint:u("memory_panel.keep_recent_hint"),children:n.jsx(Ee,{type:"number",min:1,defaultValue:h.keep_recent??40,placeholder:"40",disabled:d,onBlur:w=>{const S=parseInt(w.target.value,10);Number.isFinite(S)&&S>0&&S!==h.keep_recent&&y({"memory.keep_recent":S})},className:"max-w-[10rem]"})})]}),n.jsx(le,{label:u("memory_panel.compact_model_label"),hint:u("memory_panel.compact_model_hint"),children:n.jsx(Ee,{defaultValue:h.compact_model||"ollama:gemma4:31b-cloud",placeholder:"ollama:gemma4:31b-cloud",disabled:d,onBlur:w=>{const S=w.target.value.trim();S&&S!==h.compact_model&&y({"memory.compact_model":S})},className:"max-w-md"})}),n.jsx(le,{label:u("memory_panel.compact_fallback_label"),hint:u("memory_panel.compact_fallback_hint"),children:n.jsx(Ee,{defaultValue:h.compact_fallback_model||"",placeholder:u("memory_panel.compact_fallback_ph"),disabled:d,onBlur:w=>{const S=w.target.value.trim();S!==(h.compact_fallback_model||"")&&y({"memory.compact_fallback_model":S})},className:"max-w-md"})})]})]})}function jB(){return[{key:"load_threshold",label:u("settings_ui.knob_load_threshold"),hint:u("settings_ui.knob_load_threshold_hint"),step:.01,min:0,max:1},{key:"hint_threshold",label:u("settings_ui.knob_hint_threshold"),hint:u("settings_ui.knob_hint_threshold_hint"),step:.01,min:0,max:1},{key:"margin",label:u("settings_ui.knob_margin"),hint:u("settings_ui.knob_margin_hint"),step:.01,min:0,max:1},{key:"max_loaded",label:u("settings_ui.knob_max_loaded"),hint:u("settings_ui.knob_max_loaded_hint"),step:1,min:0,max:5},{key:"max_hints",label:u("settings_ui.knob_max_hints"),hint:u("settings_ui.knob_max_hints_hint"),step:1,min:0,max:8},{key:"prompt_floor",label:u("settings_ui.knob_prompt_floor"),hint:u("settings_ui.knob_prompt_floor_hint"),step:1,min:0,max:40},{key:"body_char_cap",label:u("settings_ui.knob_body_char_cap"),hint:u("settings_ui.knob_body_char_cap_hint"),step:500,min:500,max:2e4}]}function kB(){const e=Je(),{data:t,mutate:a,isLoading:o}=Be("/api/skills/inspector",()=>Us.inspector()),[i,c]=x.useState(!1),[d,f]=x.useState(""),[m,g]=x.useState(null);if(o||!t)return n.jsx(tt,{});const h=t.config,b=t.index,_=async y=>{c(!0);try{await Us.updateInspector(y),await a()}catch(k){e.error(u("settings_ui.could_not_save",{msg:k.message}))}finally{c(!1)}},j=async(y=!1)=>{c(!0);try{const k=await Us.index({force:y});e.success(u("settings_ui.indexed_with",{embedder:k.embedder,dim:k.dim,added:k.changed.added,refreshed:k.changed.refreshed,removed:k.changed.removed})),await a()}catch(k){e.error(u("settings_ui.index_failed",{msg:k.message}))}finally{c(!1)}},E=async()=>{if(d.trim()){c(!0),g(null);try{const y=await Us.inspect(d.trim());g(y.trace)}catch(y){e.error(u("settings_ui.dry_run_failed",{msg:y.message}))}finally{c(!1)}}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs("div",{className:"grid gap-6 lg:grid-cols-2 lg:items-start",children:[n.jsx(Ve,{title:u("settings_ui.inspector_title"),description:u("settings_ui.inspector_desc"),children:n.jsxs("div",{className:"space-y-4",children:[n.jsx(le,{label:u("settings_ui.enable_inspector"),hint:u("settings_ui.enable_inspector_hint"),children:n.jsx(Bt,{checked:h.enabled,disabled:i,onChange:y=>_({enabled:y}),label:h.enabled?u("settings_ui.on"):u("settings_ui.off")})}),n.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[n.jsx($e,{tone:b.count>0?"success":"warning",children:u("settings_ui.index_count",{n:b.count})}),n.jsx($e,{tone:"muted",children:b.embedder||u("settings_ui.not_indexed")}),b.dim?n.jsx($e,{tone:"muted",children:u("settings_ui.dim",{dim:b.dim})}):null,b.updated_at?n.jsx("span",{className:"text-xs text-muted-foreground",children:u("settings_ui.updated_at",{date:new Date(b.updated_at).toLocaleString()})}):null]}),n.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[n.jsxs(re,{variant:"secondary",onClick:()=>j(!1),loading:i,children:[n.jsx(Cs,{size:14})," ",u("settings_ui.reindex")]}),n.jsxs(re,{variant:"secondary",onClick:()=>j(!0),loading:i,children:[n.jsx(Cs,{size:14})," ",u("settings_ui.reindex_forced")]}),n.jsx("span",{className:"text-xs text-muted-foreground",children:u("settings_ui.embedder_source")})]})]})}),n.jsx(Ve,{title:u("settings_ui.test_title"),description:u("settings_ui.test_desc"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsx(Ee,{value:d,placeholder:u("settings_ui.test_placeholder"),disabled:i,onChange:y=>f(y.target.value),onKeyDown:y=>{y.key==="Enter"&&E()},className:"max-w-xl flex-1"}),n.jsxs(re,{variant:"primary",onClick:E,loading:i,children:[n.jsx(kM,{size:14})," ",u("settings_ui.test_btn")]})]}),m&&n.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-sm",children:[n.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[n.jsx(sa,{size:14,className:"text-muted-foreground"}),n.jsx("span",{className:"text-muted-foreground",children:m.embedder||"—"}),m.jit?n.jsx($e,{tone:"warning",children:u("settings_ui.jit_empty_index")}):null,m.reason&&!m.loaded?.length&&!m.hinted?.length?n.jsx($e,{tone:"muted",children:m.reason}):null]}),m.loaded?.length?n.jsxs("div",{className:"mb-1",children:[n.jsxs("span",{className:"text-muted-foreground",children:[u("settings_ui.loaded_label")," "]}),m.loaded.map(y=>n.jsx($e,{tone:"success",className:"mr-1",children:y},y))]}):null,m.hinted?.length?n.jsxs("div",{className:"mb-1",children:[n.jsxs("span",{className:"text-muted-foreground",children:[u("settings_ui.suggested_label")," "]}),m.hinted.map(y=>n.jsx($e,{tone:"info",className:"mr-1",children:y},y))]}):null,m.scored?.length?n.jsx("div",{className:"mt-2 space-y-0.5 font-mono text-xs text-muted-foreground",children:m.scored.map(y=>n.jsxs("div",{children:[y.sim.toFixed(3)," ",y.slug]},y.slug))}):null]})]})})]}),n.jsx(Ve,{title:u("settings_ui.thresholds_title"),description:u("settings_ui.thresholds_desc"),children:n.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 xl:grid-cols-4",children:jB().map(y=>n.jsx(le,{label:y.label,hint:y.hint,children:n.jsx(Ee,{type:"number",step:y.step,min:y.min,max:y.max,defaultValue:String(h[y.key]),disabled:i,onBlur:k=>{const N=Number(k.target.value);Number.isFinite(N)&&N!==h[y.key]&&_({[y.key]:N})},className:"max-w-[12rem]"})},y.key))})})]})}function wB(){const[e,t]=qo(),a=e.get("tab")==="rag"?"rag":"manager",o=i=>{const c=new URLSearchParams(e);c.set("tab",i),t(c,{replace:!0})};return n.jsxs("div",{className:"space-y-5",children:[n.jsxs("div",{className:"flex items-center gap-1 border-b border-border",children:[n.jsx(_w,{active:a==="manager",onClick:()=>o("manager"),icon:sa,label:u("skills_page.manager_tab")}),n.jsx(_w,{active:a==="rag",onClick:()=>o("rag"),icon:xM,label:u("skills_page.rag_tab")})]}),a==="manager"?n.jsx(FE,{selectable:!0}):n.jsx(kB,{})]})}function _w({active:e,onClick:t,icon:a,label:o}){return n.jsxs("button",{type:"button",onClick:t,className:`-mb-px inline-flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm font-medium transition ${e?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"}`,children:[n.jsx(a,{size:15})," ",o]})}function SB(){const e=Je(),{config:t,isLoading:a,patch:o,mutate:i}=ur(),c=t.telegram?.channels||[],d=Math.max(0,c.findIndex(A=>A.name==="default")),f=c[d],[m,g]=x.useState(!0),[h,b]=x.useState(1500),[_,j]=x.useState(!0),[E,y]=x.useState(""),[k,N]=x.useState(""),[w,S]=x.useState(!1);if(x.useEffect(()=>{g(!!t.telegram?.enabled),b(Number(t.telegram?.poll_interval_ms||1500)),j(!!t.telegram?.respond_with_engine),y(""),N(f?.chat_id||"")},[t,f?.chat_id]),a)return n.jsx(tt,{});const R=async()=>{S(!0);try{const A=c.slice(),T={name:"default",chat_id:k,respond_with_engine:_,...E?{bot_token:E}:{}};c.length===0?A.push(T):A[d]={...f,...T},await o({"telegram.enabled":m,"telegram.poll_interval_ms":h,"telegram.respond_with_engine":_,"telegram.channels":A}),e.success(u("settings.telegram_global.saved")),i(),y("")}catch(A){e.error(A.message)}finally{S(!1)}};return n.jsx(Ve,{title:u("settings.telegram_global.title"),description:u("settings.telegram_global.subtitle"),children:n.jsxs("div",{className:"space-y-3",children:[n.jsxs("div",{className:"flex items-center gap-3",children:[n.jsx(Bt,{checked:m,onChange:g,label:u("settings.telegram_global.enabled")}),n.jsx(Bt,{checked:_,onChange:j,label:u("settings.telegram_global.respond_with_engine")})]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("settings.telegram_global.bot_token"),hint:f?.bot_token?`…${Lo(f.bot_token)??""} ${u("telegram_ui.secret_set_replace")}`:u("telegram_ui.bot_token_hint_short"),children:n.jsx(Ee,{type:"password",value:E,onChange:A=>y(A.target.value),placeholder:f?.bot_token?`…${Lo(f.bot_token)??""} ${u("telegram_ui.secret_already_set")}`:""})}),n.jsx(le,{label:u("settings.telegram_global.chat_id"),children:n.jsx(Ee,{value:k,onChange:A=>N(A.target.value),placeholder:"889721252"})}),n.jsx(le,{label:u("settings.telegram_global.poll_interval"),children:n.jsx(Ee,{type:"number",value:String(h),onChange:A=>b(Number(A.target.value)||1500)})})]}),n.jsx(re,{variant:"primary",loading:w,onClick:R,children:u("common.save")})]})})}function CB(){const e=Je(),{channels:t,isLoading:a,mutate:o}=D_(),{contacts:i}=P_(),[c,d]=x.useState(null),[f,m]=x.useState(null),g=new Map;for(const b of i)g.set(String(b.user_id),b.name||`@${b.username||b.user_id}`);const h=async b=>{if(confirm(u("telegram_channels.delete_confirm",{name:b})))try{await Pn.channels.remove(b),e.success(u("telegram_channels.removed")),o()}catch(_){e.error(_.message)}};return n.jsxs(Ve,{title:u("telegram_channels.title"),description:u("telegram_channels.desc"),action:n.jsxs(re,{size:"sm",onClick:()=>d({name:""}),children:[n.jsx(Dt,{size:14})," ",u("telegram_channels.new_btn")]}),children:[a&&n.jsx(tt,{}),!a&&t.length===0&&n.jsx(ut,{children:u("telegram_channels.empty")}),n.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))||u("telegram_ui.user_id_fallback",{id:b.owner_user_id}):u("telegram_channels.no_owner");return n.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsx("span",{className:"font-medium",children:b.name}),n.jsxs("div",{className:"flex items-center gap-2",children:[b.project&&n.jsxs($e,{tone:"success",children:["project = ",b.project]}),n.jsxs(re,{size:"sm",variant:"ghost",onClick:()=>m(b),children:[n.jsx(Sa,{size:13})," ",u("admin.telegram_send_test")]}),n.jsx(re,{size:"sm",variant:"secondary",onClick:()=>d(b),children:u("common.edit")}),n.jsx(re,{size:"sm",variant:"destructive",onClick:()=>h(b.name),children:u("common.delete")})]})]}),n.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[n.jsxs("span",{children:["chat_id: ",b.chat_id||"—"]}),n.jsxs("span",{children:["bot_token: ",b.bot_token?`…${Lo(b.bot_token)??""}`:"—"]}),n.jsxs("span",{children:["route_to_agent: ",b.route_to_agent||u("telegram_ui.default_apx")]}),n.jsxs("span",{children:["engine: ",b.respond_with_engine?u("telegram_ui.yes"):u("telegram_ui.no")]}),n.jsxs("span",{className:"col-span-2",children:[u("telegram_channels.owner_label")," ",_]})]})]},b.name)})}),n.jsx(AN,{channel:c,onClose:()=>d(null),onSaved:()=>{d(null),o()}}),n.jsx(MN,{channel:f,onClose:()=>m(null)})]})}const vw=new Set(["owner","guest"]);function NB(){const e=Je(),{roles:t,mutate:a,isLoading:o}=P_(),[i,c]=x.useState(""),[d,f]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState(!1),_=async()=>{const y=i.trim();if(!y){e.error(u("telegram_roles.name_required"));return}if(vw.has(y)){e.error(u("telegram_roles.builtin_error",{name:y}));return}b(!0);try{const k=m?"*":d.split(",").map(N=>N.trim()).filter(Boolean);await Pn.roles.set(y,k),e.success(u("telegram_roles.saved",{name:y})),c(""),f(""),g(!1),a()}catch(k){e.error(k.message)}finally{b(!1)}},j=async y=>{if(confirm(u("telegram_roles.delete_confirm",{name:y})))try{await Pn.roles.remove(y),e.success(u("telegram_roles.removed")),a()}catch(k){e.error(k.message)}},E=Object.entries(t);return n.jsxs(Ve,{title:u("telegram_roles.title"),description:u("telegram_roles.desc"),children:[o&&n.jsx(tt,{}),E.length===0&&!o&&n.jsx(ut,{children:u("telegram_roles.empty")}),E.length>0&&n.jsx("ul",{className:"space-y-2 text-sm",children:E.map(([y,k])=>{const N=vw.has(y),w=k?.tools==="*"?u("telegram_roles.tools_all"):Array.isArray(k?.tools)&&k.tools.length>0?k.tools.join(", "):u("telegram_roles.tools_none");return n.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsxs("div",{className:"flex items-center justify-between gap-2",children:[n.jsxs("div",{className:"min-w-0",children:[n.jsx("span",{className:"font-medium",children:y}),N&&n.jsx($e,{tone:"info",children:u("telegram_roles.builtin")})]}),!N&&n.jsx(re,{size:"sm",variant:"destructive",onClick:()=>j(y),children:u("telegram_roles.delete_btn")})]}),n.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[u("telegram_contacts.tools_label")," ",w]})]},y)})}),n.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[n.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[n.jsx(Dt,{size:14})," ",u("telegram_roles.new_title")]}),n.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[n.jsx(le,{label:u("telegram_roles.name_label"),children:n.jsx(Ee,{value:i,onChange:y=>c(y.target.value),placeholder:u("telegram_roles.name_ph")})}),n.jsx(le,{label:u("telegram_roles.tools_label"),hint:u("telegram_roles.tools_hint"),children:n.jsx(Ee,{value:d,onChange:y=>f(y.target.value),disabled:m,placeholder:u("telegram_roles.tools_ph")})})]}),n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx(Bt,{checked:m,onChange:g,label:u("telegram_roles.full_access")}),n.jsx(re,{variant:"primary",loading:h,onClick:_,children:u("telegram_roles.save_btn")})]})]})]})}const GE="apx.settings.telegramTab";function EB(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(GE);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function RB(){const[e,t]=x.useState("default");x.useEffect(()=>{t(EB())},[]);const a=o=>{const i=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";t(i);try{window.localStorage.setItem(GE,i)}catch{}};return n.jsxs(Np,{value:e,onValueChange:a,className:"w-full",children:[n.jsxs(Ep,{children:[n.jsx(qs,{value:"default",children:u("settings.telegram_global.title")}),n.jsx(qs,{value:"channels",children:u("telegram_channels.title")}),n.jsx(qs,{value:"contacts",children:u("telegram_contacts.title")}),n.jsx(qs,{value:"roles",children:u("telegram_roles.title")})]}),n.jsx(fs,{value:"default",className:"mt-4",children:n.jsx(SB,{})}),n.jsx(fs,{value:"channels",className:"mt-4",children:n.jsx(CB,{})}),n.jsx(fs,{value:"contacts",className:"mt-4",children:n.jsx(zN,{})}),n.jsx(fs,{value:"roles",className:"mt-4",children:n.jsx(NB,{})})]})}function TB(){const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/pair/list",()=>rl.list(),{refreshInterval:Qf.pairList});return{clients:e?.clients||[],error:t,isLoading:a,mutate:o}}var Pi={},Mh,yw;function AB(){return yw||(yw=1,Mh=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Mh}var zh={},Ir={},jw;function Yo(){if(jw)return Ir;jw=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 Ir.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},Ir.getSymbolTotalCodewords=function(o){return t[o]},Ir.getBCHDigit=function(a){let o=0;for(;a!==0;)o++,a>>>=1;return o},Ir.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},Ir.isKanjiModeEnabled=function(){return typeof e<"u"},Ir.toSJIS=function(o){return e(o)},Ir}var Oh={},kw;function nv(){return kw||(kw=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.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: "+a)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,i){if(e.isValid(o))return o;try{return t(o)}catch{return i}}})(Oh)),Oh}var Dh,ww;function MB(){if(ww)return Dh;ww=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const a=Math.floor(t/8);return(this.buffer[a]>>>7-t%8&1)===1},put:function(t,a){for(let o=0;o<a;o++)this.putBit((t>>>a-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),t&&(this.buffer[a]|=128>>>this.length%8),this.length++}},Dh=e,Dh}var Ph,Sw;function zB(){if(Sw)return Ph;Sw=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,a,o,i){const c=t*this.size+a;this.data[c]=o,i&&(this.reservedBit[c]=!0)},e.prototype.get=function(t,a){return this.data[t*this.size+a]},e.prototype.xor=function(t,a,o){this.data[t*this.size+a]^=o},e.prototype.isReserved=function(t,a){return this.reservedBit[t*this.size+a]},Ph=e,Ph}var Lh={},Cw;function OB(){return Cw||(Cw=1,(function(e){const t=Yo().getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const i=Math.floor(o/7)+2,c=t(o),d=c===145?26:Math.ceil((c-13)/(2*i-2))*2,f=[c-7];for(let m=1;m<i-1;m++)f[m]=f[m-1]-d;return f.push(6),f.reverse()},e.getPositions=function(o){const i=[],c=e.getRowColCoords(o),d=c.length;for(let f=0;f<d;f++)for(let m=0;m<d;m++)f===0&&m===0||f===0&&m===d-1||f===d-1&&m===0||i.push([c[f],c[m]]);return i}})(Lh)),Lh}var Ih={},Nw;function DB(){if(Nw)return Ih;Nw=1;const e=Yo().getSymbolSize,t=7;return Ih.getPositions=function(o){const i=e(o);return[[0,0],[i-t,0],[0,i-t]]},Ih}var Bh={},Ew;function PB(){return Ew||(Ew=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(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},e.from=function(i){return e.isValid(i)?parseInt(i,10):void 0},e.getPenaltyN1=function(i){const c=i.size;let d=0,f=0,m=0,g=null,h=null;for(let b=0;b<c;b++){f=m=0,g=h=null;for(let _=0;_<c;_++){let j=i.get(b,_);j===g?f++:(f>=5&&(d+=t.N1+(f-5)),g=j,f=1),j=i.get(_,b),j===h?m++:(m>=5&&(d+=t.N1+(m-5)),h=j,m=1)}f>=5&&(d+=t.N1+(f-5)),m>=5&&(d+=t.N1+(m-5))}return d},e.getPenaltyN2=function(i){const c=i.size;let d=0;for(let f=0;f<c-1;f++)for(let m=0;m<c-1;m++){const g=i.get(f,m)+i.get(f,m+1)+i.get(f+1,m)+i.get(f+1,m+1);(g===4||g===0)&&d++}return d*t.N2},e.getPenaltyN3=function(i){const c=i.size;let d=0,f=0,m=0;for(let g=0;g<c;g++){f=m=0;for(let h=0;h<c;h++)f=f<<1&2047|i.get(g,h),h>=10&&(f===1488||f===93)&&d++,m=m<<1&2047|i.get(h,g),h>=10&&(m===1488||m===93)&&d++}return d*t.N3},e.getPenaltyN4=function(i){let c=0;const d=i.data.length;for(let m=0;m<d;m++)c+=i.data[m];return Math.abs(Math.ceil(c*100/d/5)-10)*t.N4};function a(o,i,c){switch(o){case e.Patterns.PATTERN000:return(i+c)%2===0;case e.Patterns.PATTERN001:return i%2===0;case e.Patterns.PATTERN010:return c%3===0;case e.Patterns.PATTERN011:return(i+c)%3===0;case e.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(c/3))%2===0;case e.Patterns.PATTERN101:return i*c%2+i*c%3===0;case e.Patterns.PATTERN110:return(i*c%2+i*c%3)%2===0;case e.Patterns.PATTERN111:return(i*c%3+(i+c)%2)%2===0;default:throw new Error("bad maskPattern:"+o)}}e.applyMask=function(i,c){const d=c.size;for(let f=0;f<d;f++)for(let m=0;m<d;m++)c.isReserved(m,f)||c.xor(m,f,a(i,m,f))},e.getBestMask=function(i,c){const d=Object.keys(e.Patterns).length;let f=0,m=1/0;for(let g=0;g<d;g++){c(g),e.applyMask(g,i);const h=e.getPenaltyN1(i)+e.getPenaltyN2(i)+e.getPenaltyN3(i)+e.getPenaltyN4(i);e.applyMask(g,i),h<m&&(m=h,f=g)}return f}})(Bh)),Bh}var Qd={},Rw;function YE(){if(Rw)return Qd;Rw=1;const e=nv(),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],a=[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 Qd.getBlocksCount=function(i,c){switch(c){case e.L:return t[(i-1)*4+0];case e.M:return t[(i-1)*4+1];case e.Q:return t[(i-1)*4+2];case e.H:return t[(i-1)*4+3];default:return}},Qd.getTotalCodewordsCount=function(i,c){switch(c){case e.L:return a[(i-1)*4+0];case e.M:return a[(i-1)*4+1];case e.Q:return a[(i-1)*4+2];case e.H:return a[(i-1)*4+3];default:return}},Qd}var $h={},_c={},Tw;function LB(){if(Tw)return _c;Tw=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let o=1;for(let i=0;i<255;i++)e[i]=o,t[o]=i,o<<=1,o&256&&(o^=285);for(let i=255;i<512;i++)e[i]=e[i-255]})(),_c.log=function(o){if(o<1)throw new Error("log("+o+")");return t[o]},_c.exp=function(o){return e[o]},_c.mul=function(o,i){return o===0||i===0?0:e[t[o]+t[i]]},_c}var Aw;function IB(){return Aw||(Aw=1,(function(e){const t=LB();e.mul=function(o,i){const c=new Uint8Array(o.length+i.length-1);for(let d=0;d<o.length;d++)for(let f=0;f<i.length;f++)c[d+f]^=t.mul(o[d],i[f]);return c},e.mod=function(o,i){let c=new Uint8Array(o);for(;c.length-i.length>=0;){const d=c[0];for(let m=0;m<i.length;m++)c[m]^=t.mul(i[m],d);let f=0;for(;f<c.length&&c[f]===0;)f++;c=c.slice(f)}return c},e.generateECPolynomial=function(o){let i=new Uint8Array([1]);for(let c=0;c<o;c++)i=e.mul(i,new Uint8Array([1,t.exp(c)]));return i}})($h)),$h}var Uh,Mw;function BB(){if(Mw)return Uh;Mw=1;const e=IB();function t(a){this.genPoly=void 0,this.degree=a,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 i=new Uint8Array(o.length+this.degree);i.set(o);const c=e.mod(i,this.genPoly),d=this.degree-c.length;if(d>0){const f=new Uint8Array(this.degree);return f.set(c,d),f}return c},Uh=t,Uh}var qh={},Hh={},Vh={},zw;function KE(){return zw||(zw=1,Vh.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Vh}var fa={},Ow;function XE(){if(Ow)return fa;Ow=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let a="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";a=a.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+a+`)(?:.|[\r
812
- ]))+`;fa.KANJI=new RegExp(a,"g"),fa.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),fa.BYTE=new RegExp(o,"g"),fa.NUMERIC=new RegExp(e,"g"),fa.ALPHANUMERIC=new RegExp(t,"g");const i=new RegExp("^"+a+"$"),c=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return fa.testKanji=function(m){return i.test(m)},fa.testNumeric=function(m){return c.test(m)},fa.testAlphanumeric=function(m){return d.test(m)},fa}var Dw;function Ko(){return Dw||(Dw=1,(function(e){const t=KE(),a=XE();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,d){if(!c.ccBits)throw new Error("Invalid mode: "+c);if(!t.isValid(d))throw new Error("Invalid version: "+d);return d>=1&&d<10?c.ccBits[0]:d<27?c.ccBits[1]:c.ccBits[2]},e.getBestModeForData=function(c){return a.testNumeric(c)?e.NUMERIC:a.testAlphanumeric(c)?e.ALPHANUMERIC:a.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(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.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: "+i)}}e.from=function(c,d){if(e.isValid(c))return c;try{return o(c)}catch{return d}}})(Hh)),Hh}var Pw;function $B(){return Pw||(Pw=1,(function(e){const t=Yo(),a=YE(),o=nv(),i=Ko(),c=KE(),d=7973,f=t.getBCHDigit(d);function m(_,j,E){for(let y=1;y<=40;y++)if(j<=e.getCapacity(y,E,_))return y}function g(_,j){return i.getCharCountIndicator(_,j)+4}function h(_,j){let E=0;return _.forEach(function(y){const k=g(y.mode,j);E+=k+y.getBitsLength()}),E}function b(_,j){for(let E=1;E<=40;E++)if(h(_,E)<=e.getCapacity(E,j,i.MIXED))return E}e.from=function(j,E){return c.isValid(j)?parseInt(j,10):E},e.getCapacity=function(j,E,y){if(!c.isValid(j))throw new Error("Invalid QR Code version");typeof y>"u"&&(y=i.BYTE);const k=t.getSymbolTotalCodewords(j),N=a.getTotalCodewordsCount(j,E),w=(k-N)*8;if(y===i.MIXED)return w;const S=w-g(y,j);switch(y){case i.NUMERIC:return Math.floor(S/10*3);case i.ALPHANUMERIC:return Math.floor(S/11*2);case i.KANJI:return Math.floor(S/13);case i.BYTE:default:return Math.floor(S/8)}},e.getBestVersionForData=function(j,E){let y;const k=o.from(E,o.M);if(Array.isArray(j)){if(j.length>1)return b(j,k);if(j.length===0)return 1;y=j[0]}else y=j;return m(y.mode,y.getLength(),k)},e.getEncodedBits=function(j){if(!c.isValid(j)||j<7)throw new Error("Invalid QR Code version");let E=j<<12;for(;t.getBCHDigit(E)-f>=0;)E^=d<<t.getBCHDigit(E)-f;return j<<12|E}})(qh)),qh}var Fh={},Lw;function UB(){if(Lw)return Fh;Lw=1;const e=Yo(),t=1335,a=21522,o=e.getBCHDigit(t);return Fh.getEncodedBits=function(c,d){const f=c.bit<<3|d;let m=f<<10;for(;e.getBCHDigit(m)-o>=0;)m^=t<<e.getBCHDigit(m)-o;return(f<<10|m)^a},Fh}var Gh={},Yh,Iw;function qB(){if(Iw)return Yh;Iw=1;const e=Ko();function t(a){this.mode=e.NUMERIC,this.data=a.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 i,c,d;for(i=0;i+3<=this.data.length;i+=3)c=this.data.substr(i,3),d=parseInt(c,10),o.put(d,10);const f=this.data.length-i;f>0&&(c=this.data.substr(i),d=parseInt(c,10),o.put(d,f*3+1))},Yh=t,Yh}var Kh,Bw;function HB(){if(Bw)return Kh;Bw=1;const e=Ko(),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 a(o){this.mode=e.ALPHANUMERIC,this.data=o}return a.getBitsLength=function(i){return 11*Math.floor(i/2)+6*(i%2)},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(i){let c;for(c=0;c+2<=this.data.length;c+=2){let d=t.indexOf(this.data[c])*45;d+=t.indexOf(this.data[c+1]),i.put(d,11)}this.data.length%2&&i.put(t.indexOf(this.data[c]),6)},Kh=a,Kh}var Xh,$w;function VB(){if($w)return Xh;$w=1;const e=Ko();function t(a){this.mode=e.BYTE,typeof a=="string"?this.data=new TextEncoder().encode(a):this.data=new Uint8Array(a)}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(a){for(let o=0,i=this.data.length;o<i;o++)a.put(this.data[o],8)},Xh=t,Xh}var Qh,Uw;function FB(){if(Uw)return Qh;Uw=1;const e=Ko(),t=Yo();function a(o){this.mode=e.KANJI,this.data=o}return a.getBitsLength=function(i){return i*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(o){let i;for(i=0;i<this.data.length;i++){let c=t.toSJIS(this.data[i]);if(c>=33088&&c<=40956)c-=33088;else if(c>=57408&&c<=60351)c-=49472;else throw new Error("Invalid SJIS character: "+this.data[i]+`
813
- Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},Qh=a,Qh}var Wh={exports:{}},qw;function GB(){return qw||(qw=1,(function(e){var t={single_source_shortest_paths:function(a,o,i){var c={},d={};d[o]=0;var f=t.PriorityQueue.make();f.push(o,0);for(var m,g,h,b,_,j,E,y,k;!f.empty();){m=f.pop(),g=m.value,b=m.cost,_=a[g]||{};for(h in _)_.hasOwnProperty(h)&&(j=_[h],E=b+j,y=d[h],k=typeof d[h]>"u",(k||y>E)&&(d[h]=E,f.push(h,E),c[h]=g))}if(typeof i<"u"&&typeof d[i]>"u"){var N=["Could not find a path from ",o," to ",i,"."].join("");throw new Error(N)}return c},extract_shortest_path_from_predecessor_list:function(a,o){for(var i=[],c=o;c;)i.push(c),a[c],c=a[c];return i.reverse(),i},find_path:function(a,o,i){var c=t.single_source_shortest_paths(a,o,i);return t.extract_shortest_path_from_predecessor_list(c,i)},PriorityQueue:{make:function(a){var o=t.PriorityQueue,i={},c;a=a||{};for(c in o)o.hasOwnProperty(c)&&(i[c]=o[c]);return i.queue=[],i.sorter=a.sorter||o.default_sorter,i},default_sorter:function(a,o){return a.cost-o.cost},push:function(a,o){var i={value:a,cost:o};this.queue.push(i),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 Hw;function YB(){return Hw||(Hw=1,(function(e){const t=Ko(),a=qB(),o=HB(),i=VB(),c=FB(),d=XE(),f=Yo(),m=GB();function g(N){return unescape(encodeURIComponent(N)).length}function h(N,w,S){const R=[];let A;for(;(A=N.exec(S))!==null;)R.push({data:A[0],index:A.index,mode:w,length:A[0].length});return R}function b(N){const w=h(d.NUMERIC,t.NUMERIC,N),S=h(d.ALPHANUMERIC,t.ALPHANUMERIC,N);let R,A;return f.isKanjiModeEnabled()?(R=h(d.BYTE,t.BYTE,N),A=h(d.KANJI,t.KANJI,N)):(R=h(d.BYTE_KANJI,t.BYTE,N),A=[]),w.concat(S,R,A).sort(function(z,M){return z.index-M.index}).map(function(z){return{data:z.data,mode:z.mode,length:z.length}})}function _(N,w){switch(w){case t.NUMERIC:return a.getBitsLength(N);case t.ALPHANUMERIC:return o.getBitsLength(N);case t.KANJI:return c.getBitsLength(N);case t.BYTE:return i.getBitsLength(N)}}function j(N){return N.reduce(function(w,S){const R=w.length-1>=0?w[w.length-1]:null;return R&&R.mode===S.mode?(w[w.length-1].data+=S.data,w):(w.push(S),w)},[])}function E(N){const w=[];for(let S=0;S<N.length;S++){const R=N[S];switch(R.mode){case t.NUMERIC:w.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:w.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:w.push([R,{data:R.data,mode:t.BYTE,length:g(R.data)}]);break;case t.BYTE:w.push([{data:R.data,mode:t.BYTE,length:g(R.data)}])}}return w}function y(N,w){const S={},R={start:{}};let A=["start"];for(let T=0;T<N.length;T++){const z=N[T],M=[];for(let P=0;P<z.length;P++){const L=z[P],I=""+T+P;M.push(I),S[I]={node:L,lastCount:0},R[I]={};for(let D=0;D<A.length;D++){const $=A[D];S[$]&&S[$].node.mode===L.mode?(R[$][I]=_(S[$].lastCount+L.length,L.mode)-_(S[$].lastCount,L.mode),S[$].lastCount+=L.length):(S[$]&&(S[$].lastCount=L.length),R[$][I]=_(L.length,L.mode)+4+t.getCharCountIndicator(L.mode,w))}}A=M}for(let T=0;T<A.length;T++)R[A[T]].end=0;return{map:R,table:S}}function k(N,w){let S;const R=t.getBestModeForData(N);if(S=t.from(w,R),S!==t.BYTE&&S.bit<R.bit)throw new Error('"'+N+'" cannot be encoded with mode '+t.toString(S)+`.
814
- Suggested mode is: `+t.toString(R));switch(S===t.KANJI&&!f.isKanjiModeEnabled()&&(S=t.BYTE),S){case t.NUMERIC:return new a(N);case t.ALPHANUMERIC:return new o(N);case t.KANJI:return new c(N);case t.BYTE:return new i(N)}}e.fromArray=function(w){return w.reduce(function(S,R){return typeof R=="string"?S.push(k(R,null)):R.data&&S.push(k(R.data,R.mode)),S},[])},e.fromString=function(w,S){const R=b(w,f.isKanjiModeEnabled()),A=E(R),T=y(A,S),z=m.find_path(T.map,"start","end"),M=[];for(let P=1;P<z.length-1;P++)M.push(T.table[z[P]].node);return e.fromArray(j(M))},e.rawSplit=function(w){return e.fromArray(b(w,f.isKanjiModeEnabled()))}})(Gh)),Gh}var Vw;function KB(){if(Vw)return zh;Vw=1;const e=Yo(),t=nv(),a=MB(),o=zB(),i=OB(),c=DB(),d=PB(),f=YE(),m=BB(),g=$B(),h=UB(),b=Ko(),_=YB();function j(T,z){const M=T.size,P=c.getPositions(z);for(let L=0;L<P.length;L++){const I=P[L][0],D=P[L][1];for(let $=-1;$<=7;$++)if(!(I+$<=-1||M<=I+$))for(let q=-1;q<=7;q++)D+q<=-1||M<=D+q||($>=0&&$<=6&&(q===0||q===6)||q>=0&&q<=6&&($===0||$===6)||$>=2&&$<=4&&q>=2&&q<=4?T.set(I+$,D+q,!0,!0):T.set(I+$,D+q,!1,!0))}}function E(T){const z=T.size;for(let M=8;M<z-8;M++){const P=M%2===0;T.set(M,6,P,!0),T.set(6,M,P,!0)}}function y(T,z){const M=i.getPositions(z);for(let P=0;P<M.length;P++){const L=M[P][0],I=M[P][1];for(let D=-2;D<=2;D++)for(let $=-2;$<=2;$++)D===-2||D===2||$===-2||$===2||D===0&&$===0?T.set(L+D,I+$,!0,!0):T.set(L+D,I+$,!1,!0)}}function k(T,z){const M=T.size,P=g.getEncodedBits(z);let L,I,D;for(let $=0;$<18;$++)L=Math.floor($/3),I=$%3+M-8-3,D=(P>>$&1)===1,T.set(L,I,D,!0),T.set(I,L,D,!0)}function N(T,z,M){const P=T.size,L=h.getEncodedBits(z,M);let I,D;for(I=0;I<15;I++)D=(L>>I&1)===1,I<6?T.set(I,8,D,!0):I<8?T.set(I+1,8,D,!0):T.set(P-15+I,8,D,!0),I<8?T.set(8,P-I-1,D,!0):I<9?T.set(8,15-I-1+1,D,!0):T.set(8,15-I-1,D,!0);T.set(P-8,8,1,!0)}function w(T,z){const M=T.size;let P=-1,L=M-1,I=7,D=0;for(let $=M-1;$>0;$-=2)for($===6&&$--;;){for(let q=0;q<2;q++)if(!T.isReserved(L,$-q)){let G=!1;D<z.length&&(G=(z[D]>>>I&1)===1),T.set(L,$-q,G),I--,I===-1&&(D++,I=7)}if(L+=P,L<0||M<=L){L-=P,P=-P;break}}}function S(T,z,M){const P=new a;M.forEach(function(q){P.put(q.mode.bit,4),P.put(q.getLength(),b.getCharCountIndicator(q.mode,T)),q.write(P)});const L=e.getSymbolTotalCodewords(T),I=f.getTotalCodewordsCount(T,z),D=(L-I)*8;for(P.getLengthInBits()+4<=D&&P.put(0,4);P.getLengthInBits()%8!==0;)P.putBit(0);const $=(D-P.getLengthInBits())/8;for(let q=0;q<$;q++)P.put(q%2?17:236,8);return R(P,T,z)}function R(T,z,M){const P=e.getSymbolTotalCodewords(z),L=f.getTotalCodewordsCount(z,M),I=P-L,D=f.getBlocksCount(z,M),$=P%D,q=D-$,G=Math.floor(P/D),U=Math.floor(I/D),V=U+1,X=G-U,Q=new m(X);let W=0;const B=new Array(D),K=new Array(D);let ee=0;const F=new Uint8Array(T.buffer);for(let oe=0;oe<D;oe++){const ve=oe<q?U:V;B[oe]=F.slice(W,W+ve),K[oe]=Q.encode(B[oe]),W+=ve,ee=Math.max(ee,ve)}const ne=new Uint8Array(P);let Z=0,fe,Y;for(fe=0;fe<ee;fe++)for(Y=0;Y<D;Y++)fe<B[Y].length&&(ne[Z++]=B[Y][fe]);for(fe=0;fe<X;fe++)for(Y=0;Y<D;Y++)ne[Z++]=K[Y][fe];return ne}function A(T,z,M,P){let L;if(Array.isArray(T))L=_.fromArray(T);else if(typeof T=="string"){let G=z;if(!G){const U=_.rawSplit(T);G=g.getBestVersionForData(U,M)}L=_.fromString(T,G||40)}else throw new Error("Invalid data");const I=g.getBestVersionForData(L,M);if(!I)throw new Error("The amount of data is too big to be stored in a QR Code");if(!z)z=I;else if(z<I)throw new Error(`
815
- The chosen QR Code version cannot contain this amount of data.
816
- Minimum version required to store current data is: `+I+`.
817
- `);const D=S(z,M,L),$=e.getSymbolSize(z),q=new o($);return j(q,z),E(q),y(q,z),N(q,M,0),z>=7&&k(q,z),w(q,D),isNaN(P)&&(P=d.getBestMask(q,N.bind(null,q,M))),d.applyMask(P,q),N(q,M,P),{modules:q,version:z,errorCorrectionLevel:M,maskPattern:P,segments:L}}return zh.create=function(z,M){if(typeof z>"u"||z==="")throw new Error("No input text");let P=t.M,L,I;return typeof M<"u"&&(P=t.from(M.errorCorrectionLevel,t.M),L=g.from(M.version),I=d.from(M.maskPattern),M.toSJISFunc&&e.setToSJISFunction(M.toSJISFunc)),A(z,L,P,I)},zh}var Zh={},Jh={},Fw;function QE(){return Fw||(Fw=1,(function(e){function t(a){if(typeof a=="number"&&(a=a.toString()),typeof a!="string")throw new Error("Color should be defined as hex string");let o=a.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+a);(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 i=parseInt(o.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+o.slice(0,6).join("")}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const i=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,c=o.width&&o.width>=21?o.width:void 0,d=o.scale||4;return{width:c,scale:c?4:d,margin:i,color:{dark:t(o.color.dark||"#000000ff"),light:t(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(o,i){return i.width&&i.width>=o+i.margin*2?i.width/(o+i.margin*2):i.scale},e.getImageWidth=function(o,i){const c=e.getScale(o,i);return Math.floor((o+i.margin*2)*c)},e.qrToImageData=function(o,i,c){const d=i.modules.size,f=i.modules.data,m=e.getScale(d,c),g=Math.floor((d+c.margin*2)*m),h=c.margin*m,b=[c.color.light,c.color.dark];for(let _=0;_<g;_++)for(let j=0;j<g;j++){let E=(_*g+j)*4,y=c.color.light;if(_>=h&&j>=h&&_<g-h&&j<g-h){const k=Math.floor((_-h)/m),N=Math.floor((j-h)/m);y=b[f[k*d+N]?1:0]}o[E++]=y.r,o[E++]=y.g,o[E++]=y.b,o[E]=y.a}}})(Jh)),Jh}var Gw;function XB(){return Gw||(Gw=1,(function(e){const t=QE();function a(i,c,d){i.clearRect(0,0,c.width,c.height),c.style||(c.style={}),c.height=d,c.width=d,c.style.height=d+"px",c.style.width=d+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(c,d,f){let m=f,g=d;typeof m>"u"&&(!d||!d.getContext)&&(m=d,d=void 0),d||(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),a(b,g,h),b.putImageData(_,0,0),g},e.renderToDataURL=function(c,d,f){let m=f;typeof m>"u"&&(!d||!d.getContext)&&(m=d,d=void 0),m||(m={});const g=e.render(c,d,m),h=m.type||"image/png",b=m.rendererOpts||{};return g.toDataURL(h,b.quality)}})(Zh)),Zh}var ex={},Yw;function QB(){if(Yw)return ex;Yw=1;const e=QE();function t(i,c){const d=i.a/255,f=c+'="'+i.hex+'"';return d<1?f+" "+c+'-opacity="'+d.toFixed(2).slice(1)+'"':f}function a(i,c,d){let f=i+c;return typeof d<"u"&&(f+=" "+d),f}function o(i,c,d){let f="",m=0,g=!1,h=0;for(let b=0;b<i.length;b++){const _=Math.floor(b%c),j=Math.floor(b/c);!_&&!g&&(g=!0),i[b]?(h++,b>0&&_>0&&i[b-1]||(f+=g?a("M",_+d,.5+j+d):a("m",m,0),m=0,g=!1),_+1<c&&i[b+1]||(f+=a("h",h),h=0)):m++}return f}return ex.render=function(c,d,f){const m=e.getOptions(d),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"/>':"",j="<path "+t(m.color.dark,"stroke")+' d="'+o(h,g,m.margin)+'"/>',E='viewBox="0 0 '+b+" "+b+'"',k='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+E+' shape-rendering="crispEdges">'+_+j+`</svg>
818
- `;return typeof f=="function"&&f(null,k),k},ex}var Kw;function WB(){if(Kw)return Pi;Kw=1;const e=AB(),t=KB(),a=XB(),o=QB();function i(c,d,f,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=f,f=d,d=m=void 0):b===3&&(d.getContext&&typeof g>"u"?(g=m,m=void 0):(g=m,m=f,f=d,d=void 0))}else{if(b<1)throw new Error("Too few arguments provided");return b===1?(f=d,d=m=void 0):b===2&&!d.getContext&&(m=f,f=d,d=void 0),new Promise(function(j,E){try{const y=t.create(f,m);j(c(y,d,m))}catch(y){E(y)}})}try{const j=t.create(f,m);g(null,c(j,d,m))}catch(j){g(j)}}return Pi.create=t.create,Pi.toCanvas=i.bind(null,a.render),Pi.toDataURL=i.bind(null,a.renderToDataURL),Pi.toString=i.bind(null,function(c,d,f){return o.render(c,f)}),Pi}var ZB=WB();const JB=nb(ZB);function e$({value:e,size:t=200}){const[a,o]=x.useState(null);return x.useEffect(()=>{let i=!0;return JB.toDataURL(e,{margin:2,width:t*2,errorCorrectionLevel:"M"}).then(c=>{i&&o(c)}).catch(()=>{i&&o(null)}),()=>{i=!1}},[e,t]),n.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:t+24,height:t+24},children:a?n.jsx("img",{src:a,width:t,height:t,alt:"QR"}):n.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function t$(e){return e.find(t=>!t.includes("127.0.0.1")&&!t.includes("localhost"))||e[0]||window.location.origin}function n$({open:e,onClose:t,onPaired:a}){const o=Je(),[i,c]=x.useState(null),[d,f]=x.useState(null),[m,g]=x.useState(0),[h,b]=x.useState(!1),_=x.useRef(null),j=x.useCallback(async()=>{c(null),f(null),b(!1);try{const w=await rl.init();c(w),g(Math.round((w.ttl_ms||9e4)/1e3))}catch(w){w instanceof lu&&w.status===403?f(u("settings.devices_pair_localhost_only")):f(w.message)}},[]);x.useEffect(()=>{e?j():(c(null),f(null),b(!1))},[e,j]),x.useEffect(()=>{if(!i||h||m<=0)return;const w=window.setTimeout(()=>g(S=>S-1),1e3);return()=>window.clearTimeout(w)},[i,m,h]),x.useEffect(()=>{if(!e||!i||h)return;let w=!0;const S=async()=>{try{const R=await rl.status(i.pairing_id);if(!w)return;if(R.status==="confirmed"){b(!0),o.success(u("settings.devices_pair_done")),a(),window.setTimeout(()=>{w&&t()},900);return}if(R.status==="expired"||R.status==="unknown"){g(0);return}}catch{}_.current=window.setTimeout(S,1500)};return _.current=window.setTimeout(S,1500),()=>{w=!1,_.current&&window.clearTimeout(_.current)}},[e,i,h,t,a,o]);const E=!!i&&!h&&m<=0,y=i?t$(i.lan_urls):"",k=i?`${y}/#pair=${i.pairing_id}`:"",N=async(w,S)=>{try{await navigator.clipboard.writeText(w),o.success(S)}catch{o.error(w)}};return n.jsxs(Xt,{open:e,onClose:t,title:u("settings.devices_pair_title"),description:u("settings.devices_pair_desc"),footer:n.jsx(re,{variant:"secondary",onClick:t,children:u("common.close")}),children:[d&&n.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:d}),!d&&!i&&n.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[n.jsx(bn,{})," ",u("common.loading")]}),!d&&i&&n.jsxs("div",{className:"flex flex-col items-center gap-4",children:[n.jsx("div",{className:E?"opacity-40":"",children:n.jsx(e$,{value:k,size:196})}),h?n.jsx("p",{className:"text-sm font-medium text-emerald-500",children:u("settings.devices_pair_done")}):E?n.jsxs("div",{className:"flex flex-col items-center gap-2",children:[n.jsx("p",{className:"text-sm text-muted-fg",children:u("settings.devices_pair_expired")}),n.jsx(re,{variant:"primary",onClick:()=>void j(),children:u("settings.devices_pair_regen")})]}):n.jsxs(n.Fragment,{children:[n.jsx("p",{className:"text-center text-xs text-muted-fg",children:u("settings.devices_pair_scan")}),n.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[n.jsx(bn,{size:12}),n.jsx("span",{children:u("settings.devices_pair_waiting")}),n.jsxs("span",{className:"tabular-nums",children:["· ",u("settings.devices_pair_expires",{s:m})]})]}),n.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"text-xs text-muted-fg",children:u("settings.devices_pair_link")}),n.jsxs("div",{className:"flex items-stretch gap-2",children:[n.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:k}),n.jsx(Ue,{content:u("settings.devices_pair_copy"),children:n.jsx(re,{size:"sm",variant:"secondary",onClick:()=>N(k,u("settings.devices_pair_copied")),children:n.jsx(Mo,{size:14})})})]})]}),n.jsxs("div",{className:"space-y-1",children:[n.jsx("p",{className:"text-xs text-muted-fg",children:u("settings.devices_pair_code")}),n.jsxs("div",{className:"flex items-stretch gap-2",children:[n.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-center text-sm",children:i.pairing_id}),n.jsx(Ue,{content:u("settings.devices_pair_copy"),children:n.jsx(re,{size:"sm",variant:"secondary",onClick:()=>N(i.pairing_id,u("settings.devices_pair_copied_code")),children:n.jsx(Mo,{size:14})})})]})]})]})]})]})]})}function s$(){const e=Je(),{clients:t,isLoading:a,mutate:o}=TB(),[i,c]=x.useState(!1),[d,f]=x.useState(""),m=async h=>{if(confirm(u("settings.devices_revoke_confirm",{id:h})))try{await rl.revoke(h),e.success(u("settings.devices_revoke_success")),o()}catch(b){e.error(b.message)}},g=()=>{const h=d.trim();if(h){Ro(h);try{localStorage.setItem(Dn.token,h)}catch{}f(""),e.success(u("settings.token_saved"))}};return n.jsxs("div",{className:"space-y-6",children:[n.jsxs(Ve,{title:u("settings.devices"),description:u("settings.devices_sub"),action:n.jsxs(re,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[n.jsx(pM,{size:14})," ",u("settings.devices_pair_btn")]}),children:[a&&n.jsx(tt,{}),!a&&t.length===0&&n.jsx(ut,{children:u("settings.devices_empty")}),t.length>0&&n.jsx("ul",{className:"space-y-2 text-sm",children:t.map(h=>n.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[n.jsx("span",{className:"font-medium",children:h.label||h.id}),n.jsx($e,{tone:h.kind==="web"?"info":h.kind==="deck"?"success":"muted",children:h.kind}),n.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",h.token_suffix]}),n.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[u("settings.devices_last_seen")," ",h.last_seen?new Date(h.last_seen).toLocaleString():u("settings.devices_never")]}),n.jsx(re,{size:"sm",variant:"destructive",onClick:()=>m(h.id),children:u("settings.devices_revoke")})]},h.id))}),n.jsx(n$,{open:i,onClose:()=>c(!1),onPaired:()=>o()})]}),n.jsxs(Ve,{title:u("settings.token"),description:u("settings.token_sub"),children:[n.jsx(le,{label:u("settings_ui.bearer_label"),children:n.jsx(Ee,{type:"password",placeholder:R_()?u("settings.token_active"):u("settings.token_paste"),value:d,onChange:h=>f(h.target.value),className:"font-mono",onKeyDown:h=>{h.key==="Enter"&&g()}})}),n.jsx("div",{className:"mt-2",children:n.jsx(re,{variant:"primary",onClick:g,children:u("common.save")})})]})]})}const a$=[{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:Cb.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 r$(){const{config:e,isLoading:t,patch:a,mutate:o}=ur();if(t)return n.jsx(tt,{});const i=async c=>{const d={};for(const[f,m]of Object.entries(K_(c)))ps(m)||(d[f]=m);await a(d),o()};return n.jsx(Ve,{title:u("global_config.title"),description:u("settings_ui.global_config_desc"),children:n.jsx(lf,{sections:a$,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:u("settings_ui.global_json_desc"),onSaveFields:async(c,d)=>{await a(c,d),o()},onSaveJson:i})})}function o$(){const e=Je(),{health:t,isUp:a}=TN(),o=async()=>{try{await al.reload(),e.success(u("settings.advanced.reload_success"))}catch(i){e.error(i.message)}};return n.jsxs("div",{className:"space-y-6",children:[n.jsx(Ve,{title:u("daemon.version"),action:n.jsx(re,{size:"sm",onClick:o,children:u("common.reload")}),children:n.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[n.jsx(tx,{label:u("daemon.version"),value:t?.version||"—"}),n.jsx(tx,{label:u("daemon.uptime"),value:t?`${t.uptime_s}s`:"—"}),n.jsx(tx,{label:u("daemon.status"),value:u(a?"daemon.running":"daemon.down"),ok:a})]})}),n.jsx(r$,{})]})}function tx({label:e,value:t,ok:a}){return n.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[n.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),n.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[a!==void 0&&n.jsx(du,{ok:a}),n.jsx("span",{children:t})]})]})}function i$(){const{preference:e,set:t}=Nb(),[a,o]=x.useState(S_()),i=c=>{aN(c),o(c),window.location.reload()};return n.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[n.jsx(Ve,{title:u("settings.appearance"),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(re,{variant:e==="light"?"primary":"secondary",onClick:()=>t("light"),children:u("settings.light_mode")}),n.jsx(re,{variant:e==="dark"?"primary":"secondary",onClick:()=>t("dark"),children:u("settings.dark_mode")}),n.jsx(re,{variant:e==="system"?"primary":"secondary",onClick:()=>t("system"),children:u("settings.system_mode")})]})}),n.jsx(Ve,{title:u("settings.language"),children:n.jsx("div",{className:"flex items-center gap-2",children:rN.map(c=>n.jsx(re,{variant:a===c.value?"primary":"secondary",onClick:()=>i(c.value),children:c.label},c.value))})})]})}function l$({className:e,...t}){return n.jsx("kbd",{"data-slot":"kbd",className:St("pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm bg-muted px-1 font-sans text-xs font-medium text-muted-foreground select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background dark:in-data-[slot=tooltip-content]:bg-background/10 [&_svg:not([class*='size-'])]:size-3",e),...t})}const Zx=typeof navigator<"u"&&/mac/i.test(navigator.platform||"");function c$(e){return(Zx?{CommandOrControl:"⌘ Cmd",CmdOrCtrl:"⌘ Cmd",Command:"⌘ Cmd",Cmd:"⌘ Cmd",Super:"⌘ Cmd",Meta:"⌘ Cmd",Control:"⌃ Ctrl",Ctrl:"⌃ Ctrl",Option:"⌥ Opt",Alt:"⌥ Opt",Shift:"⇧ Shift"}:{CommandOrControl:"Ctrl",CmdOrCtrl:"Ctrl",Control:"Ctrl",Ctrl:"Ctrl",Command:"Win",Cmd:"Win",Super:"Win",Meta:"Win",Option:"Alt",Alt:"Alt",Shift:"Shift"})[e]??e}function u$(e){return(e||"").split("+").map(t=>t.trim()).filter(Boolean)}function d$(e){const t=e.code;if(/^(Shift|Control|Alt|Meta|OS)(Left|Right)?$/.test(t))return null;let a;if((a=t.match(/^Key([A-Z])$/))||(a=t.match(/^Digit(\d)$/))||(a=t.match(/^Numpad(\d)$/))||(a=t.match(/^(F\d{1,2})$/))||(a=t.match(/^Arrow(Up|Down|Left|Right)$/)))return a[1];const o={Space:"Space",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown",Insert:"Insert",Minus:"-",Equal:"=",BracketLeft:"[",BracketRight:"]",Backslash:"\\",Semicolon:";",Quote:"'",Comma:",",Period:".",Slash:"/",Backquote:"`"};return o[t]?o[t]:e.key&&e.key.length===1?e.key.toUpperCase():null}function f$(e){const t=d$(e);if(!t)return null;const a=[];(Zx?e.metaKey:e.ctrlKey)&&a.push("CommandOrControl"),Zx&&e.ctrlKey&&a.push("Control"),e.altKey&&a.push("Alt"),e.shiftKey&&a.push("Shift");const o=a.length>0,i=/^F\d{1,2}$/.test(t);return!o&&!i?null:(a.push(t),a.join("+"))}function p$({value:e,onChange:t,disabled:a,className:o,trailing:i}){const[c,d]=x.useState(!1),f=x.useRef(null);x.useEffect(()=>{if(!c)return;const g=h=>{if(h.preventDefault(),h.stopPropagation(),h.key==="Escape"){d(!1);return}const b=f$(h);b&&(t(b),d(!1))};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[c,t]);const m=u$(e);return n.jsxs("div",{className:ge("flex h-9 w-full max-w-md items-center rounded-md border border-border bg-transparent transition",c&&"ring-2 ring-ring",a&&"opacity-50",o),children:[n.jsxs("button",{ref:f,type:"button",disabled:a,onClick:()=>d(g=>!g),onBlur:()=>d(!1),"aria-label":u("modules_ui.desktop_shortcut_record"),className:"flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-l-md px-3 text-sm outline-none hover:bg-muted/40 focus-visible:bg-muted/40",children:[c?n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.desktop_shortcut_recording")}):m.length?n.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:m.map((g,h)=>n.jsxs("span",{className:"flex items-center gap-1",children:[h>0&&n.jsx("span",{className:"text-xs text-muted-fg",children:"+"}),n.jsx(l$,{className:"h-6 min-w-6 border border-border bg-muted px-1.5 text-[13px] font-semibold text-fg shadow-sm",children:c$(g)})]},h))}):n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.desktop_shortcut_record")}),n.jsx("span",{className:"ml-auto whitespace-nowrap pl-2 text-xs text-muted-fg",children:u(c?"modules_ui.desktop_shortcut_esc":"modules_ui.desktop_shortcut_change")})]}),i?n.jsx("div",{className:"flex h-full items-center border-l border-border px-1",children:i}):null]})}const $i={status:()=>se.get("/api/desktop/status"),start:()=>se.post("/api/desktop/start",{}),stop:()=>se.post("/api/desktop/stop",{}),restart:()=>se.post("/api/desktop/restart",{}),autostartGet:()=>se.get("/api/desktop/autostart"),autostartSet:e=>se.post("/api/desktop/autostart",{enable:e})};function m$(e=30){return se.get(`/api/messages/global?channel=desktop&limit=${e}`)}function WE({showConfigLink:e=!1}){const t=Je(),{data:a,isLoading:o,mutate:i}=Be("/api/desktop/status",()=>$i.status(),{refreshInterval:5e3}),c=!!a?.running,[d,f]=x.useState(null),m=async(_,j)=>{f(_);try{await j()}catch(E){t.error(E.message)}finally{f(null),setTimeout(()=>i(),1200)}},g=()=>m("start",async()=>{const _=await $i.start();t.success(_.already?u("modules_ui.desktop_start_already"):u("modules_ui.desktop_start_done"))}),h=()=>m("stop",async()=>{const _=await $i.stop();t.success(_.stopped?u("modules_ui.desktop_stop_done"):u("modules_ui.desktop_stop_none"))}),b=()=>m("restart",async()=>{(await $i.restart()).reloaded>0?t.success(u("modules_ui.desktop_restart_done")):t.info(u("modules_ui.desktop_restart_none"))});return n.jsx(Ve,{title:u("desktop_screen.status_title"),description:u("modules_ui.desktop_status_desc"),action:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(re,{variant:"primary",size:"sm",onClick:g,loading:d==="start",disabled:c||d!==null&&d!=="start",children:u("modules_ui.desktop_start")}),n.jsx(re,{variant:"secondary",size:"sm",onClick:h,loading:d==="stop",disabled:!c||d!==null&&d!=="stop",children:u("modules_ui.desktop_stop")}),n.jsx(re,{variant:"secondary",size:"sm",onClick:b,loading:d==="restart",disabled:!c||d!==null&&d!=="restart",title:u("modules_ui.desktop_restart_hint"),children:u("modules_ui.desktop_restart")}),e&&n.jsx(qf,{to:"/settings/desktop",children:n.jsxs(re,{size:"sm",variant:"ghost",children:[n.jsx(Xf,{size:14})," ",u("desktop_screen.open_config")]})})]}),children:o?n.jsx(tt,{}):n.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[n.jsx(du,{ok:c}),n.jsx("span",{className:"font-medium",children:u(c?"modules_ui.desktop_running":"modules_ui.desktop_stopped")}),n.jsx("button",{type:"button",onClick:()=>i(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:u("modules_ui.desktop_refresh")}),n.jsxs("span",{className:"text-xs text-muted-fg",children:["(",u("modules_ui.desktop_from_terminal")," ",n.jsx(Ck,{children:"apx desktop start"})," · ",n.jsx(Ck,{children:"apx desktop --debug"}),")"]})]})})}const g$="CommandOrControl+G",h$=()=>[{value:"left",label:u("modules_ui.desktop_pos_left")},{value:"center",label:u("modules_ui.desktop_pos_center")},{value:"right",label:u("modules_ui.desktop_pos_right")}],x$=()=>[{value:"system",label:u("modules_ui.desktop_theme_system")},{value:"light",label:u("modules_ui.desktop_theme_light")},{value:"dark",label:u("modules_ui.desktop_theme_dark")}];function b$(){const e=Je(),{config:t,isLoading:a,patch:o}=ur(),i=t,c=i.desktop?.shortcut||i.overlay?.shortcut||g$,d=i.desktop?.enabled!==!1,f=i.desktop?.theme||"system",m=i.desktop?.position||"right",{data:g,mutate:h}=Be("/api/desktop/autostart",()=>$i.autostartGet()),[b,_]=x.useState(c),[j,E]=x.useState(!1),[y,k]=x.useState(!1);x.useEffect(()=>_(c),[c]);const N=async()=>{const R=b.trim();if(!(!R||R===c)){E(!0);try{await o({"desktop.shortcut":R}),e.success(u("modules_ui.desktop_shortcut_saved"))}catch(A){e.error(A.message)}finally{E(!1)}}},w=async(R,A,T)=>{E(!0);try{await o({[R]:A}),e.success(T)}catch(z){e.error(z.message)}finally{E(!1)}},S=async R=>{k(!0);try{await $i.autostartSet(R),await h(),e.success(u(R?"modules_ui.desktop_autostart_on":"modules_ui.desktop_autostart_off"))}catch(A){e.error(A.message)}finally{k(!1)}};return n.jsxs("div",{className:"space-y-6","data-testid":"settings-desktop",children:[n.jsx(WE,{}),n.jsx(Ve,{title:u("desktop_screen.autostart_title"),description:u("modules_ui.desktop_autostart_desc"),children:g?n.jsxs("div",{className:"flex items-center justify-between gap-3",children:[n.jsx(Bt,{checked:g.enabled,onChange:S,disabled:y,label:g.enabled?u("common.enabled"):u("common.disabled")}),n.jsx("span",{className:"text-xs text-muted-fg",children:u("modules_ui.desktop_platform",{platform:g.platform})})]}):n.jsx(tt,{})}),n.jsx(Ve,{title:u("desktop_screen.shortcut_title"),description:u("modules_ui.desktop_shortcut_desc"),children:a?n.jsx(tt,{}):n.jsx(le,{label:u("modules_ui.desktop_accelerator"),hint:u("modules_ui.desktop_accelerator_hint"),children:n.jsx(p$,{value:b,onChange:_,disabled:j,trailing:n.jsx(re,{variant:"primary",size:"sm",onClick:N,loading:j,disabled:!b.trim()||b.trim()===c,children:u("common.save")})})})}),n.jsx(Ve,{title:u("desktop_screen.appearance_title"),description:u("modules_ui.desktop_appearance_desc"),children:a?n.jsx(tt,{}):n.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n.jsx(le,{label:u("modules_ui.desktop_theme"),hint:u("modules_ui.desktop_restart_apply"),children:n.jsx(ct,{value:f,onChange:R=>w("desktop.theme",R,u("modules_ui.desktop_theme_set",{value:R})),options:x$(),disabled:j})}),n.jsx(le,{label:u("modules_ui.desktop_position"),hint:u("modules_ui.desktop_position_hint"),children:n.jsx(ct,{value:m,onChange:R=>w("desktop.position",R,u("modules_ui.desktop_position_set",{value:R})),options:h$(),disabled:j})})]})}),n.jsx(Ve,{title:u("desktop_screen.activation_title"),description:u("modules_ui.desktop_activation_desc"),children:a?n.jsx(tt,{}):n.jsxs("div",{className:"space-y-3",children:[n.jsx(Bt,{checked:d,onChange:R=>w("desktop.enabled",R,u(R?"modules_ui.desktop_enabled_toast":"modules_ui.desktop_disabled_toast")),disabled:j,label:u(d?"modules_ui.desktop_plugin_on":"modules_ui.desktop_plugin_off")}),n.jsxs("p",{className:"text-xs text-muted-fg",children:[u("modules_ui.desktop_stt_engine")," ",n.jsx(qf,{to:"/settings/voice",className:"font-medium text-fg underline underline-offset-2",children:u("nav.modules.voice")})," ",u("modules_ui.desktop_stt_engine_suffix")]})]})})]})}function _$({engines:e,order:t,onToggleEnabled:a,onToggleEmotions:o,onReorder:i,onConfigure:c,onRemove:d,onAddNew:f,busy:m}){const g=e.filter(j=>j.id!=="mock"),h=new Map(g.map(j=>[j.id,j])),b=[...t.filter(j=>h.has(j)),...g.map(j=>j.id).filter(j=>!t.includes(j))],_=(j,E)=>{const y=b.indexOf(j),k=y+E;if(y<0||k<0||k>=b.length)return;const N=[...b];[N[y],N[k]]=[N[k],N[y]],i(N)};return n.jsxs("div",{className:"space-y-2",children:[b.map((j,E)=>{const y=h.get(j),k=Rf[j],N=y.custom?y.label||j:k?.name||j,w=y.custom?y.note||u("voice_ui.custom_note"):k?.note||"";return n.jsxs("div",{"data-testid":`voice-provider-${j}`,className:ge("flex items-center gap-3 rounded-lg border px-3 py-2.5 border-border",!y.enabled&&"opacity-60"),children:[n.jsxs("div",{className:"flex flex-col",children:[n.jsx("button",{type:"button",onClick:()=>_(j,-1),disabled:m||E===0,"aria-label":u("voice_ui.move_up"),"data-testid":`voice-provider-${j}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:n.jsx(fb,{className:"size-3.5"})}),n.jsx("button",{type:"button",onClick:()=>_(j,1),disabled:m||E===b.length-1,"aria-label":u("voice_ui.move_down"),"data-testid":`voice-provider-${j}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:n.jsx(ms,{className:"size-3.5"})})]}),n.jsx(du,{ok:y.available?!0:y.configured?!1:null}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-sm font-medium",children:N}),y.custom&&n.jsx($e,{tone:"info",children:u("voice_ui.badge_custom")}),k?.local&&n.jsx($e,{tone:"info",children:u("voice_ui.badge_local")}),y.available?n.jsx($e,{tone:"success",children:u("voice_ui.badge_available")}):y.configured?n.jsx($e,{tone:"warning",children:u("voice_ui.badge_unavailable")}):n.jsx($e,{tone:"muted",children:u("voice_ui.badge_not_configured")})]}),n.jsx("div",{className:"truncate text-xs text-muted-fg",children:w})]}),n.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.emotionsApplicable&&n.jsx("button",{type:"button",onClick:()=>o(j,!y.emotionsOn),disabled:m,title:u("voice_ui.emotions_hint"),"data-testid":`voice-provider-${j}-emotions`,className:ge("rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:opacity-50",y.emotionsOn?"border-emerald-500/50 bg-emerald-500/10 text-emerald-300":"border-border text-muted-fg hover:text-fg"),children:u("voice_ui.emotions_short")}),n.jsx(Bt,{checked:y.enabled,onChange:S=>a(j,S),disabled:m}),n.jsxs(re,{size:"sm",variant:"secondary",onClick:()=>c(j),"data-testid":`voice-provider-${j}-config`,children:[n.jsx(gM,{className:"size-3.5"})," ",u("voice_ui.configure")]}),y.custom&&n.jsx(re,{size:"sm",variant:"ghost",onClick:()=>d(j),disabled:m,"aria-label":u("voice_ui.remove"),"data-testid":`voice-provider-${j}-remove`,children:n.jsx(_n,{className:"size-3.5"})})]})]},j)}),n.jsxs("button",{type:"button",onClick:f,disabled:m,"data-testid":"voice-provider-add",className:"flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-border px-3 py-2.5 text-sm text-muted-fg transition-colors hover:border-emerald-500/50 hover:text-fg disabled:opacity-50",children:[n.jsx(Dt,{className:"size-4"})," ",u("voice_ui.add_provider")]})]})}function Cn(e){return typeof e=="string"?e:e==null?"":String(e)}function v$(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Xw({on:e,setOn:t,tags:a,setTags:o}){return n.jsxs("div",{className:"rounded-md border border-border/60 p-3 space-y-2",children:[n.jsx(Bt,{checked:e,onChange:t,label:u("voice_ui.emotions_label")}),n.jsx("p",{className:"text-xs text-muted-fg",children:u("voice_ui.emotions_hint")}),e&&n.jsx(le,{label:u("voice_ui.emotions_tags_label"),hint:u("voice_ui.emotions_tags_hint"),children:n.jsx(Ee,{value:a,onChange:i=>o(i.target.value),placeholder:bP.join(", ")})})]})}function y$({open:e,providerId:t,config:a,onClose:o,onSave:i}){const[c,d]=x.useState(!1),[f,m]=x.useState(null),[g,h]=x.useState(""),[b,_]=x.useState({}),[j,E]=x.useState(!1),[y,k]=x.useState(""),[N,w]=x.useState(!1);if(x.useEffect(()=>{if(!e||!t)return;m(null),h("");const D=a||{},$=D.emotions;if(E(!!$?.enabled),k(Array.isArray($?.tags)?$.tags.join(", "):""),w(!1),t==="__new__"||t.startsWith("custom:")){const G=D;_({label:Cn(G.label),base_url:Cn(G.base_url),model:Cn(G.model),voice:Cn(G.voice),format:Cn(G.format),style:Cn(G.style),temperature:Cn(G.temperature)})}else if(t==="piper"){const G=D;_({bin:Cn(G.bin),model:Cn(G.model),speaker:Cn(G.speaker)})}else if(t==="elevenlabs"){const G=D;_({model:Cn(G.model),voice_id:Cn(G.voice_id),output_format:Cn(G.output_format)})}else if(t==="openai"){const G=D;_({model:Cn(G.model)||"tts-1",voice:Cn(G.voice)||"alloy",format:Cn(G.format)||"mp3"})}else if(t==="gemini"){const G=D;_({model:Cn(G.model),voice:Cn(G.voice)||"Kore",style:Cn(G.style)})}else _({})},[e,t,a]),!t)return null;const S=t==="__new__",R=S||t.startsWith("custom:"),A=Rf[t],T=D=>_($=>({...$,...D})),z=t!=="piper"&&t!=="mock",M=z&&ps(a?.api_key),P=M?u("voice_ui.api_key_set",{suffix:Lo(a?.api_key)??""}):u("voice_ui.api_key_label"),L=S?u("voice_ui.new_provider"):R?b.label||t.slice(7):A?.name||t,I=async()=>{d(!0),m(null);try{const D=S?v$(b.label):R?t.slice(7):"";if(R){if(!b.label.trim())throw new Error(u("voice_ui.err_label_required"));if(!b.base_url.trim())throw new Error(u("voice_ui.err_base_url_required"));if(!D)throw new Error(u("voice_ui.err_label_required"))}const $=R?`voice.tts.custom.${D}`:`voice.tts.${t}`,q={},G=[],U=(V,X)=>{X.trim()?q[`${$}.${V}`]=X.trim():G.push(`${$}.${V}`)};if(R?(q[`${$}.label`]=b.label.trim(),q[`${$}.base_url`]=b.base_url.trim(),U("style",b.style),b.temperature.trim()&&!Number.isNaN(Number(b.temperature))?q[`${$}.temperature`]=Number(b.temperature):G.push(`${$}.temperature`),U("model",b.model),U("voice",b.voice)):t==="piper"?(U("bin",b.bin),U("model",b.model),b.speaker.trim()?q[`${$}.speaker`]=b.speaker.trim():G.push(`${$}.speaker`)):t==="elevenlabs"?(U("model",b.model),U("voice_id",b.voice_id),U("output_format",b.output_format)):t==="openai"?(U("model",b.model),U("voice",b.voice),U("format",b.format)):t==="gemini"&&(U("model",b.model),U("voice",b.voice),U("style",b.style)),R||t==="gemini"){q[`${$}.emotions.enabled`]=j;const V=y.split(",").map(X=>X.trim().toLowerCase()).filter(Boolean);V.length?q[`${$}.emotions.tags`]=V:G.push(`${$}.emotions.tags`)}z&&g.trim()&&(q[`${$}.api_key`]=g.trim()),await i({set:q,unset:G}),o()}catch(D){m(D.message||u("voice_ui.err_save"))}finally{d(!1)}};return n.jsx(Xt,{open:e,onClose:o,title:u("voice_screen.configure_provider",{name:L}),description:R?u("voice_ui.custom_desc"):A?.note,size:"md",footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:o,disabled:c,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:I,loading:c,"data-testid":"voice-provider-save",children:u("common.save")})]}),children:n.jsxs("div",{className:"space-y-3",children:[t==="piper"&&n.jsxs(n.Fragment,{children:[n.jsx(le,{label:u("voice_ui.piper_bin_label"),hint:u("voice_ui.piper_bin_hint"),children:n.jsx(Ee,{value:b.bin,onChange:D=>T({bin:D.target.value}),placeholder:"piper"})}),n.jsx(le,{label:u("voice_ui.piper_model_label"),hint:u("voice_ui.piper_model_hint"),children:n.jsx(Ee,{value:b.model,onChange:D=>T({model:D.target.value}),placeholder:"/abs/path/voice.onnx"})}),n.jsx(le,{label:u("voice_ui.piper_speaker_label"),hint:u("voice_ui.piper_speaker_hint"),children:n.jsx(Ee,{value:b.speaker,onChange:D=>T({speaker:D.target.value}),placeholder:"0"})})]}),t==="elevenlabs"&&n.jsxs(n.Fragment,{children:[n.jsx(le,{label:u("voice_ui.api_key_label"),hint:M?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_secret_hint",{env:"ELEVENLABS_API_KEY"}),children:n.jsx(Ee,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:P})}),n.jsx(le,{label:u("voice_ui.model_label"),children:n.jsx(ct,{value:b.model||"",onChange:D=>T({model:D}),options:hP.map(D=>({value:D,label:D})),placeholder:"eleven_multilingual_v2"})}),n.jsx(le,{label:u("voice_ui.voice_id_label"),hint:u("voice_ui.voice_id_hint"),children:n.jsx(Ee,{value:b.voice_id,onChange:D=>T({voice_id:D.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),n.jsx(le,{label:u("voice_ui.output_format_label"),children:n.jsx(Ee,{value:b.output_format,onChange:D=>T({output_format:D.target.value}),placeholder:"mp3_44100_128"})})]}),t==="openai"&&n.jsxs(n.Fragment,{children:[n.jsx(le,{label:u("voice_ui.api_key_label"),hint:M?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:n.jsx(Ee,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:P})}),n.jsx(le,{label:u("voice_ui.model_label"),children:n.jsx(ct,{value:b.model||"tts-1",onChange:D=>T({model:D}),options:xP.map(D=>({value:D,label:D}))})}),n.jsx(le,{label:u("voice_ui.voice_label"),children:n.jsx(ct,{value:b.voice||"alloy",onChange:D=>T({voice:D}),options:mP.map(D=>({value:D,label:D}))})}),n.jsx(le,{label:u("voice_ui.format_label"),children:n.jsx(ct,{value:b.format||"mp3",onChange:D=>T({format:D}),options:["mp3","opus","aac","flac","wav"].map(D=>({value:D,label:D}))})})]}),R&&n.jsxs(n.Fragment,{children:[n.jsx(le,{label:u("voice_ui.label_label"),hint:u("voice_ui.label_hint"),children:n.jsx(Ee,{value:b.label,onChange:D=>T({label:D.target.value}),placeholder:"QVox"})}),n.jsx(le,{label:u("voice_ui.base_url_req_label"),hint:u("voice_ui.base_url_req_hint"),children:n.jsx(Ee,{value:b.base_url,onChange:D=>T({base_url:D.target.value}),placeholder:"http://127.0.0.1:5111/v1"})}),n.jsx(le,{label:u("voice_ui.api_key_label"),hint:u(M?"voice_ui.api_key_keep_hint":"voice_ui.api_key_optional_hint"),children:n.jsx(Ee,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:P})}),n.jsx(le,{label:u("voice_ui.style_label"),hint:u("voice_ui.openai_style_hint"),children:n.jsx(un,{rows:2,value:b.style||"",onChange:D=>T({style:D.target.value}),placeholder:u("voice_ui.style_ph")})}),n.jsx(le,{label:u("voice_ui.temperature_label"),hint:u("voice_ui.temperature_hint"),children:n.jsx(Ee,{value:b.temperature,onChange:D=>T({temperature:D.target.value}),inputMode:"decimal",placeholder:"0.7"})}),n.jsx(Xw,{on:j,setOn:E,tags:y,setTags:k}),n.jsxs("div",{children:[n.jsxs("button",{type:"button",onClick:()=>w(D=>!D),className:"text-xs text-muted-fg hover:text-fg",children:[N?"▾ ":"▸ ",u("voice_ui.advanced")]}),N&&n.jsxs("div",{className:"mt-2 space-y-3",children:[n.jsx(le,{label:u("voice_ui.model_label"),hint:u("voice_ui.custom_model_hint"),children:n.jsx(Ee,{value:b.model,onChange:D=>T({model:D.target.value}),placeholder:u("voice_ui.custom_optional_ph")})}),n.jsx(le,{label:u("voice_ui.voice_label"),hint:u("voice_ui.custom_voice_hint"),children:n.jsx(Ee,{value:b.voice,onChange:D=>T({voice:D.target.value}),placeholder:u("voice_ui.custom_optional_ph")})})]})]})]}),t==="gemini"&&n.jsxs(n.Fragment,{children:[n.jsx(le,{label:u("voice_ui.api_key_label"),hint:M?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_reuse_hint",{engine:"engines.gemini.api_key",env:"GEMINI_API_KEY"}),children:n.jsx(Ee,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:P})}),n.jsx(le,{label:u("voice_ui.model_label"),hint:u("voice_ui.gemini_model_hint"),children:n.jsx(Ee,{value:b.model,onChange:D=>T({model:D.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),n.jsx(le,{label:u("voice_ui.voice_label"),children:n.jsx(ct,{value:b.voice||"Kore",onChange:D=>T({voice:D}),options:gP.map(D=>({value:D,label:D}))})}),n.jsx(le,{label:u("voice_ui.style_label"),hint:u("voice_ui.style_hint"),children:n.jsx(un,{rows:2,value:b.style||"",onChange:D=>T({style:D.target.value}),placeholder:u("voice_ui.style_ph")})}),n.jsx(Xw,{on:j,setOn:E,tags:y,setTags:k})]}),t==="mock"&&n.jsx("p",{className:"text-sm text-muted-fg",children:u("voice_ui.mock_desc")}),f&&n.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f})]})})}function j$(){const e=x.useRef(null),t=x.useRef(null),[a,o]=x.useState(!1),[i,c]=x.useState(!1),d=x.useCallback(()=>{t.current&&(URL.revokeObjectURL(t.current),t.current=null)},[]);x.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),d()},[d]);const f=x.useCallback(async g=>{c(!0);try{d();const h=await vP(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)}},[d]),m=x.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),o(!1)},[]);return{play:f,stop:m,playing:a,loading:i}}function k$({engines:e,defaultProvider:t,mode:a}){const o=Je(),{play:i,stop:c,playing:d,loading:f}=j$(),[m,g]=x.useState(u("voice_ui.test_default_text")),[h,b]=x.useState(""),[_,j]=x.useState(!1),[E,y]=x.useState(null),N=[{value:"",label:a==="single"&&t&&t!=="auto"?u("voice_ui.test_default_engine",{name:Rf[t]?.name||t}):u("voice_ui.test_default_chain")},...e.filter(S=>S.id!=="mock").map(S=>({value:S.id,label:S.custom?S.label||S.id:Rf[S.id]?.name||S.id,disabled:!S.available}))],w=async()=>{const S=m.trim();if(!S){o.error(u("voice_ui.test_empty_error"));return}j(!0);try{const R=await Tf.say({text:S,provider:h||void 0});y(R),await i(R.audio_path)}catch(R){o.error(R.message||u("voice_ui.test_synth_error"))}finally{j(!1)}};return n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("voice_ui.test_engine_label"),hint:u("voice_ui.test_engine_hint"),children:n.jsx(ct,{value:h,onChange:b,options:N})}),n.jsx(le,{label:u("voice_ui.test_text_label"),children:n.jsx(un,{rows:2,value:m,onChange:S=>g(S.target.value),placeholder:u("voice_ui.test_text_ph"),"data-testid":"voice-test-input"})}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsxs(re,{variant:"primary",onClick:w,loading:_,disabled:f,"data-testid":"voice-test-say",children:[n.jsx(jM,{className:"size-4"})," ",u("voice_ui.say_this")]}),d?n.jsxs(re,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[n.jsx(kb,{className:"size-4"})," ",u("voice_ui.stop")]}):E?n.jsxs(re,{variant:"secondary",onClick:()=>i(E.audio_path),loading:f,"data-testid":"voice-test-replay",children:[n.jsx(yb,{className:"size-4"})," ",u("voice_ui.replay")]}):null,E&&n.jsxs("span",{className:"text-xs text-muted-fg",children:[u("voice_ui.engine_result"),": ",n.jsx("strong",{children:E.provider}),E.duration_s?` · ${E.duration_s.toFixed(1)}s`:""]})]})]})}const Qw={metal:{label:"Metal",cls:"text-emerald-400 border-emerald-500/40 bg-emerald-500/10"},cuda:{label:"CUDA",cls:"text-lime-400 border-lime-500/40 bg-lime-500/10"},rocm:{label:"Vulkan / ROCm",cls:"text-orange-400 border-orange-500/40 bg-orange-500/10"},none:{label:"CPU",cls:"text-muted-fg border-border bg-muted"}};function Ww({gpu:e}){const t=Qw[e]??Qw.none;return n.jsx("span",{className:`inline-flex items-center rounded-md border px-1.5 py-0.5 text-[11px] font-medium ${t.cls}`,children:t.label})}function w$(e){return e.backend==="mlx"?"Metal · mlx-whisper":e.backend==="faster"?(e.device==="cuda"?"CUDA":"CPU")+" · faster-whisper":e.backend}const S$=()=>[{value:"auto",label:u("voice_ui.stt_provider_auto")},{value:"local",label:u("voice_ui.stt_provider_local")},{value:"openai",label:u("voice_ui.stt_provider_openai")},{value:"custom",label:u("voice_ui.stt_provider_custom")}],Zw=()=>[{value:"auto",label:u("voice_ui.lang_auto")},{value:"es",label:u("voice_ui.lang_es")},{value:"en",label:u("voice_ui.lang_en")},{value:"pt",label:u("voice_ui.lang_pt")},{value:"fr",label:u("voice_ui.lang_fr")},{value:"it",label:u("voice_ui.lang_it")},{value:"de",label:u("voice_ui.lang_de")}];function C$({config:e,onPatch:t,busy:a}){const[o,i]=x.useState(null);x.useEffect(()=>{let $=!0;return Tf.sttHardware().then(q=>{$&&i(q)}).catch(()=>{}),()=>{$=!1}},[]);const c=e.provider||"auto",d=e.local||{},f=e.openai||{},m=e.custom||{},g=d.model||"small",h=d.language||"auto",b=c==="auto"||c==="local",_=($,q,G)=>{const U=G.trim();U!==(q||"").trim()&&t({[$]:U})},j=($,q)=>{const G=q.trim();!G||ps(G)||t({[$]:G})},E=$=>ps($)?u("voice_ui.api_key_set",{suffix:Lo($)??""}):u("voice_ui.api_key_label"),y=d.backend||"auto",k=o?.hardware.gpu||"none",N=y==="auto"?o?.recommended.backend||"faster":y,w=N==="mlx",S=w?"metal":N==="faster"&&k==="cuda"?"cuda":"none",R=()=>{const $=[{value:"auto",label:u("voice_ui.stt_backend_auto")}];return k==="metal"&&$.push({value:"mlx",label:"Metal — mlx-whisper"}),$.push({value:"faster",label:k==="cuda"?"CUDA — faster-whisper":"CPU — faster-whisper"}),$},[A,T]=x.useState([]);x.useEffect(()=>{let $=!0;return Tf.sttModels(N).then(q=>{$&&T(q.models)}).catch(()=>{$&&T([])}),()=>{$=!1}},[N]);const z=$=>`${$.id} · ${$.downloaded?"✓ "+$.size:$.size}`,M=()=>A.length?A.map($=>({value:w?$.repo:$.id,label:z($)})):_P.map($=>({value:$,label:$})),P=w?d.mlx_model||o?.recommended.model||"":g,L=w?"transcription.local.mlx_model":"transcription.local.model",I=A.find($=>(w?$.repo:$.id)===P),D=!!I&&!I.downloaded;return n.jsxs("div",{className:"space-y-3",children:[o&&n.jsxs("div",{className:"rounded-lg border border-border bg-muted px-3 py-2 text-sm",children:[n.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[n.jsxs("span",{className:"text-muted-fg",children:[u("voice_ui.stt_hw_label"),":"]}),n.jsx(Ww,{gpu:o.hardware.gpu}),n.jsx("span",{className:"font-medium text-fg",children:o.hardware.gpuName||o.hardware.platform}),o.hardware.mem_gb?n.jsxs("span",{className:"text-muted-fg",children:["· ",o.hardware.mem_gb," GB",o.hardware.unified_memory?" unified":""]}):null]}),n.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[u("voice_ui.stt_hw_recommended"),":"," ",n.jsx("span",{className:"text-fg",children:o.recommended.model})," ","(",w$(o.recommended),")",o.recommended.limited?` — ${u("voice_ui.stt_hw_limited")}`:""]})]}),n.jsx(le,{label:u("voice_ui.stt_engine_label"),hint:u("voice_ui.stt_engine_hint"),children:n.jsx(ct,{value:c,onChange:$=>t({"transcription.provider":$}),options:S$(),disabled:a,className:"max-w-md"})}),b&&n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("voice_ui.stt_backend_label"),hint:u("voice_ui.stt_backend_hint"),children:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(ct,{value:y,onChange:$=>t({"transcription.local.backend":$}),options:R(),disabled:a,className:"max-w-xs"}),n.jsx(Ww,{gpu:S})]})}),n.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n.jsx(le,{label:u("voice_ui.stt_model_label"),hint:D?u("voice_ui.stt_model_needs_download",{size:I.size}):u("voice_ui.stt_model_hint"),children:n.jsx(ct,{value:P,onChange:$=>t({[L]:$}),options:M(),disabled:a})}),n.jsx(le,{label:u("voice_ui.stt_language_label"),hint:u("voice_ui.stt_language_hint"),children:n.jsx(ct,{value:h,onChange:$=>t({"transcription.local.language":$}),options:Zw(),disabled:a})})]})]}),c==="openai"&&n.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n.jsx(le,{label:u("voice_ui.api_key_label"),hint:ps(f.api_key)?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:n.jsx(Ee,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:E(f.api_key),onBlur:$=>j("transcription.openai.api_key",$.target.value),disabled:a})}),n.jsx(le,{label:u("voice_ui.stt_openai_model_label"),hint:u("voice_ui.stt_openai_model_hint"),children:n.jsx(Ee,{defaultValue:f.model||"",placeholder:"whisper-1",onBlur:$=>_("transcription.openai.model",f.model,$.target.value),disabled:a})})]}),c==="custom"&&n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("voice_ui.stt_custom_baseurl_label"),hint:u("voice_ui.stt_custom_baseurl_hint"),children:n.jsx(Ee,{defaultValue:m.base_url||"",placeholder:"http://localhost:8000/v1",onBlur:$=>_("transcription.custom.base_url",m.base_url,$.target.value),disabled:a})}),n.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[n.jsx(le,{label:u("voice_ui.stt_custom_model_label"),hint:u("voice_ui.stt_custom_model_hint"),children:n.jsx(Ee,{defaultValue:m.model||"",placeholder:"mlx-community/whisper-large-v3-turbo",onBlur:$=>_("transcription.custom.model",m.model,$.target.value),disabled:a})}),n.jsx(le,{label:u("voice_ui.stt_language_label"),hint:u("voice_ui.stt_language_hint"),children:n.jsx(ct,{value:m.language||"auto",onChange:$=>t({"transcription.custom.language":$}),options:Zw(),disabled:a})})]}),n.jsx(le,{label:u("voice_ui.api_key_label"),hint:u("voice_ui.stt_custom_key_hint"),children:n.jsx(Ee,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:E(m.api_key),onBlur:$=>j("transcription.custom.api_key",$.target.value),disabled:a})})]})]})}function N$(){const e=Je(),{config:t,isLoading:a,patch:o,mutate:i}=ur(),{data:c,isLoading:d,error:f,mutate:m}=Be("/api/tts/providers",()=>Tf.providers()),[g,h]=x.useState(null),[b,_]=x.useState(!1),j=t,E=j.voice?.tts||{},y=j.transcription||{},k=c?.configured_provider||E.provider||"auto",N=c?.mode||E.mode||"chain",w=c?.order||[],S=(c?.engines||[]).map(I=>{if(!(!!I.custom||I.id==="gemini"))return I;const $=I.custom?E.custom?.[I.id.slice(7)]:E.gemini;return{...I,emotionsApplicable:!0,emotionsOn:!!$?.emotions?.enabled}}),R=x.useMemo(()=>!g||g==="__new__"?{}:g.startsWith("custom:")?E.custom?.[g.slice(7)]||{}:E[g]||{},[g,E]),A=async(I,D)=>{_(!0);try{const $=I.startsWith("custom:")?`voice.tts.custom.${I.slice(7)}.enabled`:`voice.tts.${I}.enabled`;await o({[$]:D}),await m()}catch($){e.error($.message)}finally{_(!1)}},T=async(I,D)=>{_(!0);try{const $=I.startsWith("custom:")?`voice.tts.custom.${I.slice(7)}.emotions.enabled`:`voice.tts.${I}.emotions.enabled`;await o({[$]:D}),await m(),await i()}catch($){e.error($.message)}finally{_(!1)}},z=async I=>{_(!0);try{await o({"voice.tts.order":I}),await m()}catch(D){e.error(D.message)}finally{_(!1)}},M=async({set:I,unset:D})=>{await o(I,D.length?D:void 0),await m(),await i(),e.success(u("voice_ui.toast_config_saved"))},P=async I=>{if(I.startsWith("custom:")&&window.confirm(u("voice_ui.remove_confirm"))){_(!0);try{const D=I.slice(7);await o({"voice.tts.order":w.filter($=>$!==I)},[`voice.tts.custom.${D}`]),await m(),await i(),e.success(u("voice_ui.toast_provider_removed"))}catch(D){e.error(D.message)}finally{_(!1)}}},L=async(I,D)=>{try{await o(I,D),e.success(u("voice_ui.toast_transcription_updated"))}catch($){e.error($.message)}};return n.jsxs("div",{"data-testid":"screen-voice",children:[n.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[n.jsx(Ve,{title:u("voice_screen.providers_title"),description:u("voice_ui.providers_desc"),children:d||a?n.jsx(tt,{}):f?n.jsx(ut,{children:u("voice_ui.providers_load_error",{msg:f.message})}):n.jsx(_$,{engines:S,order:w,onToggleEnabled:A,onToggleEmotions:T,onReorder:z,onConfigure:I=>h(I),onRemove:P,onAddNew:()=>h("__new__"),busy:b})}),n.jsxs("div",{className:"space-y-6",children:[n.jsx(Ve,{title:u("voice_screen.test_title"),description:u("voice_ui.test_desc"),children:n.jsx(k$,{engines:S,defaultProvider:k,mode:N})}),n.jsx(Ve,{title:u("voice_screen.stt_title"),description:u("voice_ui.stt_desc"),children:a?n.jsx(tt,{}):n.jsx(C$,{config:y,onPatch:L})})]})]}),n.jsx(y$,{open:!!g,providerId:g,config:R,onClose:()=>h(null),onSave:M})]})}function E$(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 R$({manifest:e}){const t=e.daemon,a=e.safety;return n.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[n.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[n.jsxs("span",{className:"font-semibold text-foreground",children:[t.name," ",n.jsxs("span",{className:"font-normal text-muted-fg",children:["v",t.version]})]}),n.jsxs("div",{className:"flex items-center gap-1.5",children:[n.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_daemon_active",{uptime:E$(t.uptime_s)})})]})]}),n.jsxs("div",{className:"flex flex-wrap gap-2",children:[n.jsxs("span",{className:"text-muted-fg",children:[t.host,":",t.port]}),n.jsx("span",{className:"text-muted-fg",children:"·"}),n.jsxs("span",{className:"text-muted-fg",children:[u("modules_ui.deck_daemon_started")," ",new Date(t.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),n.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[a.direct_shell===!1&&n.jsx($e,{tone:"success",children:u("modules_ui.deck_safety_no_shell")}),a.arbitrary_commands===!1&&n.jsx($e,{tone:"success",children:u("modules_ui.deck_safety_no_arbitrary")}),a.dangerous_actions_require_confirmation&&n.jsx($e,{tone:"info",children:u("modules_ui.deck_safety_confirm")})]})]})}function T$(e){return e==="available"?"success":e==="configured"?"info":"muted"}function A$(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function M$(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function z$({widget:e,onToggle:t}){const a=e.source==="external",[o,i]=x.useState(!1),c=e.user_enabled===!0,d=async f=>{if(!(!t||o)){i(!0);try{await t(f)}finally{i(!1)}}};return n.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:ge("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",a?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[n.jsx(Ue,{content:e.source==="apx"?u("deck_screen.widget_native"):u("deck_screen.widget_external"),children:n.jsx("span",{className:ge("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")})}),n.jsxs("div",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"font-medium",children:e.title}),n.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),n.jsx($e,{tone:M$(e.kind),children:e.kind}),n.jsx($e,{tone:T$(e.status),children:A$(e.status)}),a?n.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:n.jsx(Bt,{checked:c,onChange:d,disabled:o||!t})}):n.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function O$({desktop:e,widgets:t,onToggle:a}){return t.length===0?null:n.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[n.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),n.jsx("ul",{className:"space-y-1.5",children:t.map(o=>n.jsx(z$,{widget:o,onToggle:o.source==="external"?i=>a(o.id,i):void 0},o.id))})]})}function D$(){Je();const{data:e,error:t,isLoading:a,mutate:o}=Be("/api/deck/manifest",()=>xN.manifest(),{refreshInterval:3e4}),i=async(h,b)=>{},c=e?.deck.desktops??[],d=e?.deck.widgets??[],f=c.map(h=>({desktop:h,widgets:d.filter(b=>b.desktop===h.id)})),g=d.filter(h=>h.source==="external").filter(h=>h.user_enabled===!0).length;return n.jsxs("div",{className:"relative min-h-full","data-testid":"screen-deck",children:[n.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6 pointer-events-none select-none blur-[2px] opacity-60","aria-hidden":!0,inert:!0,children:[e&&n.jsx(R$,{manifest:e}),n.jsxs(Ve,{title:u("deck_screen.widgets_title"),description:a?u("modules_ui.deck_loading_manifest"):t?u("modules_ui.deck_manifest_error"):u("modules_ui.deck_widgets_summary",{count:d.length,enabled:g}),action:n.jsx(Ue,{content:u("deck_screen.reload_manifest"),children:n.jsx(re,{size:"sm",variant:"ghost",onClick:()=>o(),disabled:a,"aria-label":u("deck_screen.reload_manifest"),children:n.jsx(Cs,{size:14,className:a?"animate-spin":""})})}),children:[a&&n.jsx(tt,{label:u("modules_ui.deck_loading_manifest_full")}),!a&&t&&n.jsxs(ut,{children:[u("modules_ui.deck_manifest_load_failed")," ",n.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>o(),children:u("modules_ui.deck_retry")})]}),!a&&!t&&d.length===0&&n.jsx(ut,{children:u("modules_ui.deck_no_widgets")}),!a&&!t&&d.length>0&&n.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:f.filter(h=>h.widgets.length>0).map(h=>n.jsx(O$,{desktop:h.desktop,widgets:h.widgets,onToggle:i},h.desktop.id))})]}),e?.apx&&n.jsx(Ve,{title:u("deck_screen.context_title"),description:u("modules_ui.deck_context_desc"),children:n.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_active_project")}),n.jsx("span",{className:"font-medium",children:e.apx.active_project?e.apx.active_project.name:u("modules_ui.deck_none")})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_registered_projects")}),n.jsx("span",{className:"font-medium",children:e.apx.projects.length})]}),n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_active_plugins")}),n.jsx("span",{className:"font-medium",children:Object.keys(e.apx.plugins).join(", ")||"—"})]})]})})]}),n.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center p-6 backdrop-blur-[1px]",role:"dialog","aria-modal":"true","aria-labelledby":"deck-coming-soon-title","data-testid":"deck-coming-soon",children:n.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card/95 p-8 text-center shadow-2xl",children:[n.jsx("div",{className:"mx-auto mb-4 flex size-12 items-center justify-center rounded-full bg-muted",children:n.jsx(DA,{className:"size-6 text-muted-fg"})}),n.jsx("span",{className:"inline-block rounded-full bg-muted px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:u("deck_screen.preview_badge")}),n.jsx("h2",{id:"deck-coming-soon-title",className:"mt-3 text-lg font-semibold",children:u("deck_screen.preview_title")}),n.jsx("p",{className:"mt-2 text-sm text-muted-fg",children:u("deck_screen.preview_body")})]})})]})}const P$=[{title:u("settings.account_section"),items:[{key:"identity",label:u("settings.tabs.identity"),icon:Sb}]},{title:u("settings.agents_section"),items:[{key:"super_agent",label:u("settings.tabs.super_agent"),icon:rn},{key:"profile",label:u("settings.tabs.profile"),icon:ZA},{key:"engines",label:u("settings.tabs.engines"),icon:pb},{key:"memory",label:"Memory (RAG)",icon:X2},{key:"skills",label:u("skills_page.title"),icon:sa}]},{title:u("settings.channels_section"),items:[{key:"telegram",label:u("settings.tabs.telegram"),icon:Sa},{key:"devices",label:u("settings.tabs.devices"),icon:bM}]},{title:u("settings.modules_section"),items:[{key:"voice",label:u("nav.modules.voice"),icon:_b},{key:"desktop",label:u("nav.modules.desktop"),icon:vb},{key:"deck",label:u("nav.modules.deck"),icon:tM},{key:"web",label:u("nav.modules.web"),icon:tS}]},{title:u("settings.advanced_section"),items:[{key:"advanced",label:u("settings.tabs.advanced"),icon:jb}]}],L$=new Set(["engines","telegram","memory","skills","web","voice","profile"]),I$={identity:()=>n.jsx(pB,{}),super_agent:()=>n.jsx(mB,{}),profile:()=>n.jsx(bB,{}),engines:()=>n.jsx(cE,{}),memory:()=>n.jsx(yB,{}),skills:()=>n.jsx(wB,{}),telegram:()=>n.jsx(RB,{}),devices:()=>n.jsx(s$,{}),voice:()=>n.jsx(N$,{}),deck:()=>n.jsx(D$,{}),desktop:()=>n.jsx(b$,{}),web:()=>n.jsx(i$,{}),advanced:()=>n.jsx(o$,{})};function B$(){const e=Tn(),t=ns(),a=$$(t.pathname),o=I$[a],{collapsed:i,toggle:c}=C_(Dn.sidebarCollapsed+".settings");return n.jsx($N,{sections:P$,active:a,onChange:d=>e(d==="identity"?"/settings":`/settings/${U$(d)}`),collapsed:i,onToggleCollapse:c,contentClassName:`w-full ${L$.has(a)?"":"mx-auto max-w-3xl"} space-y-6 py-6 pt-3 pr-6 pl-4`,testId:`settings-tab-${a}`,children:n.jsx(o,{})})}function $$(e){switch(e.split("/").filter(Boolean)[1]||"identity"){case"super-agent":return"super_agent";case"profile":return"profile";case"engines":return"engines";case"memory":return"memory";case"skills":return"skills";case"telegram":return"telegram";case"devices":return"devices";case"voice":return"voice";case"deck":return"deck";case"desktop":return"desktop";case"web":return"web";case"appearance":return"web";case"config":case"advanced":return"advanced";default:return"identity"}}function U$(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function q$(){const{data:e,isLoading:t,mutate:a}=Be("/api/messages/global?channel=desktop",()=>m$(40),{refreshInterval:8e3});return n.jsx("div",{className:"mx-auto max-w-3xl space-y-6 p-6","data-testid":"screen-desktop",children:n.jsxs("div",{className:"space-y-6",children:[n.jsx("div",{children:n.jsx(WE,{showConfigLink:!0})}),n.jsx("div",{children:n.jsx(Ve,{title:u("desktop_screen.last_conv_title"),description:u("modules_ui.desktop_last_conv_desc"),action:n.jsx("button",{type:"button",onClick:()=>a(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:u("modules_ui.desktop_refresh")}),children:n.jsx(H$,{messages:e||[],loading:t})})})]})})}function H$({messages:e,loading:t}){const a=x.useMemo(()=>F$(e),[e]);return t?n.jsx(tt,{}):e.length?n.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:a.slice().reverse().map((o,i)=>n.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:o.map((c,d)=>n.jsx(V$,{m:c},d))},i))}):n.jsx(ut,{children:u("modules_ui.desktop_no_messages")})}function V$({m:e}){const t=e.direction==="in",a=G$(e.ts);return n.jsxs("div",{className:"py-1",children:[n.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[n.jsx("span",{className:"font-semibold",children:u(t?"modules_ui.desktop_you":"modules_ui.desktop_roby")}),n.jsx("span",{children:a})]}),n.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(t?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||n.jsx("span",{className:"italic opacity-50",children:u("modules_ui.desktop_empty_msg")})})]})}function F$(e){const t=[];for(const a of e)a.direction==="in"||!t.length?t.push([a]):t[t.length-1].push(a);return t}function G$(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 Y$(e,t){const a=getComputedStyle(e),o=parseFloat(a.fontSize);return t*o}function K$(e,t){const a=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(a.fontSize);return t*o}function X$(e){return e/100*window.innerHeight}function Q$(e){return e/100*window.innerWidth}function W$(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 Ec({groupSize:e,panelElement:t,styleProp:a}){let o;const[i,c]=W$(a);switch(c){case"%":{o=i/100*e;break}case"px":{o=i;break}case"rem":{o=K$(t,i);break}case"em":{o=Y$(t,i);break}case"vh":{o=X$(i);break}case"vw":{o=Q$(i);break}}return o}function ts(e){return parseFloat(e.toFixed(3))}function ll({group:e}){const{orientation:t,panels:a}=e;return a.reduce((o,i)=>(o+=t==="horizontal"?i.element.offsetWidth:i.element.offsetHeight,o),0)}function Jx(e){const{panels:t}=e,a=ll({group:e});return a===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:i,panelConstraints:c}=o;let d=0;if(c.collapsedSize!==void 0){const h=Ec({groupSize:a,panelElement:i,styleProp:c.collapsedSize});d=ts(h/a*100)}let f;if(c.defaultSize!==void 0){const h=Ec({groupSize:a,panelElement:i,styleProp:c.defaultSize});f=ts(h/a*100)}let m=0;if(c.minSize!==void 0){const h=Ec({groupSize:a,panelElement:i,styleProp:c.minSize});m=ts(h/a*100)}let g=100;if(c.maxSize!==void 0){const h=Ec({groupSize:a,panelElement:i,styleProp:c.maxSize});g=ts(h/a*100)}return{groupResizeBehavior:c.groupResizeBehavior,collapsedSize:d,collapsible:c.collapsible===!0,defaultSize:f,disabled:c.disabled,minSize:m,maxSize:g,panelId:o.id}})}function Ft(e,t="Assertion error"){if(!e)throw Error(t)}function eb(e,t){return Array.from(t).sort(e==="horizontal"?Z$:J$)}function Z$(e,t){const a=e.element.offsetLeft-t.element.offsetLeft;return a!==0?a:e.element.offsetWidth-t.element.offsetWidth}function J$(e,t){const a=e.element.offsetTop-t.element.offsetTop;return a!==0?a:e.element.offsetHeight-t.element.offsetHeight}function ZE(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function JE(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 eU({orientation:e,rects:t,targetRect:a}){const o={x:a.x+a.width/2,y:a.y+a.height/2};let i,c=Number.MAX_VALUE;for(const d of t){const{x:f,y:m}=JE(o,d),g=e==="horizontal"?f:m;g<c&&(c=g,i=d)}return Ft(i,"No rect found"),i}let Wd;function tU(){return Wd===void 0&&(typeof matchMedia=="function"?Wd=!!matchMedia("(pointer:coarse)").matches:Wd=!1),Wd}function eR(e){const{element:t,orientation:a,panels:o,separators:i}=e,c=eb(a,Array.from(t.children).filter(ZE).map(E=>({element:E}))).map(({element:E})=>E),d=[];let f=!1,m=!1,g=-1,h=-1,b=0,_,j=[];{let E=-1;for(const y of c)y.hasAttribute("data-panel")&&(E++,y.hasAttribute("data-disabled")||(b++,g===-1&&(g=E),h=E))}if(b>1){let E=-1;for(const y of c)if(y.hasAttribute("data-panel")){E++;const k=o.find(N=>N.element===y);if(k){if(_){const N=_.element.getBoundingClientRect(),w=y.getBoundingClientRect();let S;if(m){const R=a==="horizontal"?new DOMRect(N.right,N.top,0,N.height):new DOMRect(N.left,N.bottom,N.width,0),A=a==="horizontal"?new DOMRect(w.left,w.top,0,w.height):new DOMRect(w.left,w.top,w.width,0);switch(j.length){case 0:{S=[R,A];break}case 1:{const T=j[0],z=eU({orientation:a,rects:[N,w],targetRect:T.element.getBoundingClientRect()});S=[T,z===N?A:R];break}default:{S=j;break}}}else j.length?S=j:S=[a==="horizontal"?new DOMRect(N.right,w.top,w.left-N.right,w.height):new DOMRect(w.left,N.bottom,w.width,w.top-N.bottom)];for(const R of S){let A="width"in R?R:R.element.getBoundingClientRect();const T=tU()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(A.width<T){const M=T-A.width;A=new DOMRect(A.x-M/2,A.y,A.width+M,A.height)}if(A.height<T){const M=T-A.height;A=new DOMRect(A.x,A.y-M/2,A.width,A.height+M)}const z=E<=g||E>h;!f&&!z&&d.push({group:e,groupSize:ll({group:e}),panels:[_,k],separator:"width"in R?void 0:R,rect:A}),f=!1}}m=!1,_=k,j=[]}}else if(y.hasAttribute("data-separator")){y.ariaDisabled!==null&&(f=!0);const k=i.find(N=>N.element===y);k?j.push(k):(_=void 0,j=[])}else m=!0}return d}class tR{#e={};addListener(t,a){const o=this.#e[t];return o===void 0?this.#e[t]=[a]:o.includes(a)||o.push(a),()=>{this.removeListener(t,a)}}emit(t,a){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,a);else{let i=!1,c=null;const d=Array.from(o);for(let f=0;f<d.length;f++){const m=d[f];try{m.call(null,a)}catch(g){c===null&&(i=!0,c=g)}}if(i)throw c}}removeAllListeners(){this.#e={}}removeListener(t,a){const o=this.#e[t];if(o!==void 0){const i=o.indexOf(a);i>=0&&o.splice(i,1)}}}let Qi={cursorFlags:0,state:"inactive"};const sv=new tR;function Bo(){return Qi}function nU(e){return sv.addListener("change",e)}function sU(e){const t=Qi,a={...Qi};a.cursorFlags=e,Qi=a,sv.emit("change",{prev:t,next:a})}function Wi(e){const t=Qi;Qi=e,sv.emit("change",{prev:t,next:e})}const aU=e=>e,nx=()=>{},nR=1,sR=2,aR=4,rR=8,Jw=3,e2=12;let Zd;function t2(){return Zd===void 0&&(Zd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Zd=!0)),Zd}function rU({cursorFlags:e,groups:t,state:a}){let o=0,i=0;switch(a){case"active":case"hover":t.forEach(c=>{if(!c.mutableState.disableCursor)switch(c.orientation){case"horizontal":{o++;break}case"vertical":{i++;break}}})}if(!(o===0&&i===0)){switch(a){case"active":{if(e&&t2()){const c=(e&nR)!==0,d=(e&sR)!==0,f=(e&aR)!==0,m=(e&rR)!==0;if(c)return f?"se-resize":m?"ne-resize":"e-resize";if(d)return f?"sw-resize":m?"nw-resize":"w-resize";if(f)return"s-resize";if(m)return"n-resize"}break}}return t2()?o>0&&i>0?"move":o>0?"ew-resize":"ns-resize":o>0&&i>0?"grab":o>0?"col-resize":"row-resize"}}const n2=new WeakMap;function av(e){if(!e.defaultView||!e.adoptedStyleSheets)return;let{prevStyle:t,styleSheet:a}=n2.get(e)??{};a===void 0&&(a=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(a):e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]));const o=Bo();switch(o.state){case"active":case"hover":{const i=rU({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(d=>d.group),state:o.state}),c=`*, *:hover {cursor: ${i} !important; }`;if(t===c)return;t=c,i?a.cssRules.length===0?a.insertRule(c):a.replaceSync(c):a.cssRules.length===1&&a.deleteRule(0);break}case"inactive":{t=void 0,a.cssRules.length===1&&a.deleteRule(0);break}}n2.set(e,{prevStyle:t,styleSheet:a})}let ba=new Map;const oR=new tR;function oU(e){ba=new Map(ba),ba.delete(e)}function s2(e,t){for(const[a]of ba)if(a.id===e)return a}function Gr(e,t){for(const[a,o]of ba)if(a.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function so(){return ba}function rv(e,t){return oR.addListener("groupChange",a=>{a.group.id===e&&t(a)})}function ir(e,t,a){const o=ba.get(e);ba=new Map(ba),ba.set(e,t),oR.emit("groupChange",{group:e,isUserInteraction:a?.isUserInteraction===!0,prev:o,next:t})}function iR(e){const t=Bo(),a=so();let o=!1;switch(t.state){case"active":Wi({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(av(e),o=!0,t.hitRegions.forEach(i=>{if(!a.has(i.group))return;const c=Gr(i.group.id,!0);ir(i.group,c,{isUserInteraction:!0})}))}return o}function a2(e){e.defaultPrevented||iR(e.currentTarget)}function iU(e,t,a){let o,i={x:1/0,y:1/0};for(const c of t){const d=JE(a,c.rect);switch(e){case"horizontal":{d.x<=i.x&&(o=c,i=d);break}case"vertical":{d.y<=i.y&&(o=c,i=d);break}}}return o?{distance:i,hitRegion:o}:void 0}function lU(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function cU(e,t){if(e===t)throw new Error("Cannot compare node with itself");const a={a:i2(e),b:i2(t)};let o;for(;a.a.at(-1)===a.b.at(-1);)o=a.a.pop(),a.b.pop();Ft(o,"Stacking order can only be calculated for elements with a common ancestor");const i={a:o2(r2(a.a)),b:o2(r2(a.b))};if(i.a===i.b){const c=o.childNodes,d={a:a.a.at(-1),b:a.b.at(-1)};let f=c.length;for(;f--;){const m=c[f];if(m===d.a)return 1;if(m===d.b)return-1}}return Math.sign(i.a-i.b)}const uU=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function dU(e){const t=getComputedStyle(lR(e)??e).display;return t==="flex"||t==="inline-flex"}function fU(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||dU(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"||uU.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function r2(e){let t=e.length;for(;t--;){const a=e[t];if(Ft(a,"Missing node"),fU(a))return a}return null}function o2(e){return e&&Number(getComputedStyle(e).zIndex)||0}function i2(e){const t=[];for(;e;)t.push(e),e=lR(e);return t}function lR(e){const{parentNode:t}=e;return lU(t)?t.host:t}function pU(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 mU({groupElement:e,hitRegion:t,pointerEventTarget:a}){if(!ZE(a)||a.contains(e)||e.contains(a))return!0;if(cU(a,e)>0){let o=a;for(;o;){if(o.contains(e))return!0;if(pU(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function ov(e,t){const a=[];return t.forEach((o,i)=>{if(i.disabled)return;const c=eR(i),d=iU(i.orientation,c,{x:e.clientX,y:e.clientY});d&&d.distance.x<=0&&d.distance.y<=0&&mU({groupElement:i.element,hitRegion:d.hitRegion.rect,pointerEventTarget:e.target})&&a.push(d.hitRegion)}),a}function gU(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!=t[a])return!1;return!0}function Xn(e,t,a=0){return Math.abs(ts(e)-ts(t))<=a}function ma(e,t){return Xn(e,t)?0:e>t?1:-1}function Ui({overrideDisabledPanels:e,panelConstraints:t,prevSize:a,size:o}){const{collapsedSize:i=0,collapsible:c,disabled:d,maxSize:f=100,minSize:m=0}=t;if(d&&!e)return a;if(ma(o,m)<0)if(c){const g=(i+m)/2;ma(o,g)<0?o=i:o=m}else o=m;return o=Math.min(f,o),o=ts(o),o}function Gc({delta:e,initialLayout:t,panelConstraints:a,pivotIndices:o,prevLayout:i,trigger:c}){if(Xn(e,0))return t;const d=c==="imperative-api",f=Object.values(t),m=Object.values(i),g=[...f],[h,b]=o;Ft(h!=null,"Invalid first pivot index"),Ft(b!=null,"Invalid second pivot index");let _=0;switch(c){case"keyboard":{{const y=e<0?b:h,k=a[y];Ft(k,`Panel constraints not found for index ${y}`);const{collapsedSize:N=0,collapsible:w,minSize:S=0}=k;if(w){const R=f[y];if(Ft(R!=null,`Previous layout not found for panel index ${y}`),Xn(R,N)){const A=S-R;ma(A,Math.abs(e))>0&&(e=e<0?0-A:A)}}}{const y=e<0?h:b,k=a[y];Ft(k,`No panel constraints found for index ${y}`);const{collapsedSize:N=0,collapsible:w,minSize:S=0}=k;if(w){const R=f[y];if(Ft(R!=null,`Previous layout not found for panel index ${y}`),Xn(R,S)){const A=R-N;ma(A,Math.abs(e))>0&&(e=e<0?0-A:A)}}}break}default:{const y=e<0?b:h,k=a[y];Ft(k,`Panel constraints not found for index ${y}`);const N=f[y],{collapsible:w,collapsedSize:S,minSize:R}=k;if(w&&ma(N,R)<0)if(e>0){const A=R-S,T=A/2,z=N+e;ma(z,R)<0&&(e=ma(e,T)<=0?0:A)}else{const A=R-S,T=100-A/2,z=N-e;ma(z,R)<0&&(e=ma(100+e,T)>0?0:-A)}break}}{const y=e<0?1:-1;let k=e<0?b:h,N=0;for(;;){const S=f[k];Ft(S!=null,`Previous layout not found for panel index ${k}`);const R=Ui({overrideDisabledPanels:d,panelConstraints:a[k],prevSize:S,size:100})-S;if(N+=R,k+=y,k<0||k>=a.length)break}const w=Math.min(Math.abs(e),Math.abs(N));e=e<0?0-w:w}{let y=e<0?h:b;for(;y>=0&&y<a.length;){const k=Math.abs(e)-Math.abs(_),N=f[y];Ft(N!=null,`Previous layout not found for panel index ${y}`);const w=N-k,S=Ui({overrideDisabledPanels:d,panelConstraints:a[y],prevSize:N,size:w});if(!Xn(N,S)&&(_+=N-S,g[y]=S,_.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?y--:y++}}if(gU(m,g))return i;{const y=e<0?b:h,k=f[y];Ft(k!=null,`Previous layout not found for panel index ${y}`);const N=k+_,w=Ui({overrideDisabledPanels:d,panelConstraints:a[y],prevSize:k,size:N});if(g[y]=w,!Xn(w,N)){let S=N-w,R=e<0?b:h;for(;R>=0&&R<a.length;){const A=g[R];Ft(A!=null,`Previous layout not found for panel index ${R}`);const T=A+S,z=Ui({overrideDisabledPanels:d,panelConstraints:a[R],prevSize:A,size:T});if(Xn(A,z)||(S-=z-A,g[R]=z),Xn(S,0))break;e>0?R--:R++}}}const j=Object.values(g).reduce((y,k)=>k+y,0);if(!Xn(j,100,.1))return i;const E=Object.keys(i);return g.reduce((y,k,N)=>(y[E[N]]=k,y),{})}function $o(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(t[a]===void 0||ma(e[a],t[a])!==0)return!1;return!0}function Uo({layout:e,panelConstraints:t}){const a=Object.values(e),o=[...a],i=o.reduce((f,m)=>f+m,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(f=>`${f}%`).join(", ")}`);if(!Xn(i,100)&&o.length>0)for(let f=0;f<t.length;f++){const m=o[f];Ft(m!=null,`No layout data found for index ${f}`);const g=100/i*m;o[f]=g}let c=0;for(let f=0;f<t.length;f++){const m=a[f];Ft(m!=null,`No layout data found for index ${f}`);const g=o[f];Ft(g!=null,`No layout data found for index ${f}`);const h=Ui({overrideDisabledPanels:!0,panelConstraints:t[f],prevSize:m,size:g});g!=h&&(c+=g-h,o[f]=h)}if(!Xn(c,0))for(let f=0;f<t.length;f++){const m=o[f];Ft(m!=null,`No layout data found for index ${f}`);const g=m+c,h=Ui({overrideDisabledPanels:!0,panelConstraints:t[f],prevSize:m,size:g});if(m!==h&&(c-=h-m,o[f]=h,Xn(c,0)))break}const d=Object.keys(e);return o.reduce((f,m,g)=>(f[d[g]]=m,f),{})}function cR({groupId:e,panelId:t}){const a=()=>{const m=so();for(const[g,{defaultLayoutDeferred:h,derivedPanelConstraints:b,layout:_,groupSize:j,separatorToPanels:E}]of m)if(g.id===e)return{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:g,groupSize:j,layout:_,separatorToPanels:E};throw Error(`Group ${e} not found`)},o=()=>{const m=a().derivedPanelConstraints.find(g=>g.panelId===t);if(m!==void 0)return m;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{const m=a().group.panels.find(g=>g.id===t);if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},c=()=>{const m=a().layout[t];if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},d=({nextSize:m,panels:g,prevLayout:h,derivedPanelConstraints:b})=>{const _=c(),j=g.findIndex(k=>k.id===t),E=j===0,y=j===g.length-1;if(y&&m<_&&(E||g.slice(0,j).every((k,N)=>{const w=b[N];return w?.collapsible&&Xn(w.collapsedSize,h[w.panelId])}))){const k=g.slice(0,j).reduce((N,w)=>N+h[w.id],0);return{...h,[t]:ts(100-k)}}return Gc({delta:y?_-m:m-_,initialLayout:h,panelConstraints:b,pivotIndices:y?[j-1,j]:[j,j+1],prevLayout:h,trigger:"imperative-api"})},f=m=>{const g=c();if(m===g)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:_,groupSize:j,layout:E,separatorToPanels:y}=a(),k=d({nextSize:m,panels:_.panels,prevLayout:E,derivedPanelConstraints:b}),N=Uo({layout:k,panelConstraints:b});$o(E,N)||ir(_,{defaultLayoutDeferred:h,derivedPanelConstraints:b,groupSize:j,layout:N,separatorToPanels:y})};return{collapse:()=>{const{collapsible:m,collapsedSize:g}=o(),{mutableValues:h}=i(),b=c();m&&b!==g&&(h.expandToSize=b,f(g))},expand:()=>{const{collapsible:m,collapsedSize:g,minSize:h}=o(),{mutableValues:b}=i(),_=c();if(m&&_===g){let j=b.expandToSize??h;j===0&&(j=1),f(j)}},getSize:()=>{const{group:m}=a(),g=c(),{element:h}=i(),b=m.orientation==="horizontal"?h.offsetWidth:h.offsetHeight;return{asPercentage:g,inPixels:b}},isCollapsed:()=>{const{collapsible:m,collapsedSize:g}=o(),h=c();return m&&Xn(g,h)},resize:m=>{const{group:g}=a(),{element:h}=i(),b=ll({group:g}),_=Ec({groupSize:b,panelElement:h,styleProp:m}),j=ts(_/b*100);f(j)}}}function l2(e){if(e.defaultPrevented)return;const t=so();ov(e,t).forEach(a=>{if(a.separator&&!a.separator.disableDoubleClick){const o=a.panels.find(i=>i.panelConstraints.defaultSize!==void 0);if(o){const i=o.panelConstraints.defaultSize,c=cR({groupId:a.group.id,panelId:o.id});c&&i!==void 0&&(c.resize(i),e.preventDefault())}}})}function cf(e){const t=so();for(const[a]of t)if(a.separators.some(o=>o.element===e))return a;throw Error("Could not find parent Group for separator element")}function uR({groupId:e}){const t=()=>{const a=so();for(const[o,i]of a)if(o.id===e)return{group:o,...i};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:a,layout:o}=t();return a?{}:o},setLayout(a){const{defaultLayoutDeferred:o,derivedPanelConstraints:i,group:c,groupSize:d,layout:f,separatorToPanels:m}=t(),g=Uo({layout:a,panelConstraints:i});return o?f:($o(f,g)||ir(c,{defaultLayoutDeferred:o,derivedPanelConstraints:i,groupSize:d,layout:g,separatorToPanels:m}),g)}}}function No(e,t){const a=cf(e),o=Gr(a.id,!0),i=a.separators.find(h=>h.element===e);Ft(i,"Matching separator not found");const c=o.separatorToPanels.get(i);Ft(c,"Matching panels not found");const d=c.map(h=>a.panels.indexOf(h)),f=uR({groupId:a.id}).getLayout(),m=Gc({delta:t,initialLayout:f,panelConstraints:o.derivedPanelConstraints,pivotIndices:d,prevLayout:f,trigger:"keyboard"}),g=Uo({layout:m,panelConstraints:o.derivedPanelConstraints});$o(f,g)||ir(a,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:g,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function c2(e){if(e.defaultPrevented)return;const t=e.currentTarget,a=cf(t);if(!a.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),a.orientation==="vertical"&&No(t,5);break}case"ArrowLeft":{e.preventDefault(),a.orientation==="horizontal"&&No(t,-5);break}case"ArrowRight":{e.preventDefault(),a.orientation==="horizontal"&&No(t,5);break}case"ArrowUp":{e.preventDefault(),a.orientation==="vertical"&&No(t,-5);break}case"End":{e.preventDefault(),No(t,100);break}case"Enter":{e.preventDefault();const o=cf(t),i=Gr(o.id,!0),{derivedPanelConstraints:c,layout:d,separatorToPanels:f}=i,m=o.separators.find(_=>_.element===t);Ft(m,"Matching separator not found");const g=f.get(m);Ft(g,"Matching panels not found");const h=g[0],b=c.find(_=>_.panelId===h.id);if(Ft(b,"Panel metadata not found"),b.collapsible){const _=d[h.id],j=b.collapsedSize===_?o.mutableState.expandedPanelSizes[h.id]??b.minSize:b.collapsedSize;No(t,j-_)}break}case"F6":{e.preventDefault();const o=cf(t).separators.map(d=>d.element),i=Array.from(o).findIndex(d=>d===e.currentTarget);Ft(i!==null,"Index not found");const c=e.shiftKey?i>0?i-1:o.length-1:i+1<o.length?i+1:0;o[c].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),No(t,-100);break}}}function u2(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=so(),a=ov(e,t),o=new Map;let i=!1;a.forEach(c=>{c.separator&&(i||(i=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const d=t.get(c.group);d&&o.set(c.group,d.layout)}),Wi({cursorFlags:0,hitRegions:a,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),a.length&&e.preventDefault()}function dR({document:e,event:t,hitRegions:a,initialLayoutMap:o,mountedGroups:i,pointerDownAtPoint:c,prevCursorFlags:d}){let f=0;a.forEach(g=>{const{group:h,groupSize:b}=g,{orientation:_,panels:j}=h,{disableCursor:E}=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 k=o.get(h),N=i.get(h);if(!k||!N)return;const{defaultLayoutDeferred:w,derivedPanelConstraints:S,groupSize:R,layout:A,separatorToPanels:T}=N;if(S&&A&&T){const z=Gc({delta:y,initialLayout:k,panelConstraints:S,pivotIndices:g.panels.map(M=>j.indexOf(M)),prevLayout:A,trigger:"mouse-or-touch"});if($o(z,A)){if(y!==0&&!E)switch(_){case"horizontal":{f|=y<0?nR:sR;break}case"vertical":{f|=y<0?aR:rR;break}}}else ir(g.group,{defaultLayoutDeferred:w,derivedPanelConstraints:S,groupSize:R,layout:z,separatorToPanels:T})}});let m=0;t.movementX===0?m|=d&Jw:m|=f&Jw,t.movementY===0?m|=d&e2:m|=f&e2,sU(m),av(e)}function d2(e){const t=so(),a=Bo();switch(a.state){case"active":dR({document:e.currentTarget,event:e,hitRegions:a.hitRegions,initialLayoutMap:a.initialLayoutMap,mountedGroups:t,prevCursorFlags:a.cursorFlags})}}function f2(e){if(e.defaultPrevented)return;const t=Bo(),a=so();switch(t.state){case"active":{if(e.buttons===0){Wi({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{if(!a.has(o.group))return;const i=Gr(o.group.id,!0);ir(o.group,i,{isUserInteraction:!0})});return}for(const o of t.hitRegions)if(o.separator){const{element:i}=o.separator;i.hasPointerCapture?.(e.pointerId)||i.setPointerCapture?.(e.pointerId)}dR({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:a,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=ov(e,a);o.length===0?t.state!=="inactive"&&Wi({cursorFlags:0,state:"inactive"}):Wi({cursorFlags:0,hitRegions:o,state:"hover"}),av(e.currentTarget);break}}}function p2(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Bo().state){case"hover":Wi({cursorFlags:0,state:"inactive"})}}function m2(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||iR(e.currentTarget)&&e.preventDefault()}function g2(e){let t=0,a=0;const o={};for(const c of e)if(c.defaultSize!==void 0){t++;const d=ts(c.defaultSize);a+=d,o[c.panelId]=d}else o[c.panelId]=void 0;const i=e.length-t;if(i!==0){const c=ts((100-a)/i);for(const d of e)d.defaultSize===void 0&&(o[d.panelId]=c)}return o}function hU(e,t,a){if(!a[0])return;const o=e.panels.find(m=>m.element===t);if(!o||!o.onResize)return;const i=ll({group:e}),c=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,d=o.mutableValues.prevSize,f={asPercentage:ts(c/i*100),inPixels:c};o.mutableValues.prevSize=f,o.onResize(f,o.id,d)}function xU(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(e[a]!==t[a])return!1;return!0}function bU(e,t){return e.length!==t.length?!1:e.every((a,o)=>xU(a,t[o]))}function _U({group:e,nextGroupSize:t,prevGroupSize:a,prevLayout:o}){if(a<=0||t<=0||a===t)return o;let i=0,c=0,d=!1;const f=new Map,m=[];for(const b of e.panels){const _=o[b.id]??0;switch(b.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{d=!0;const j=_/100*a,E=ts(j/t*100);f.set(b.id,E),i+=E;break}case"preserve-relative-size":default:{m.push(b.id),c+=_;break}}}if(!d||m.length===0)return o;const g=100-i,h={...o};if(f.forEach((b,_)=>{h[_]=b}),c>0)for(const b of m){const _=o[b]??0;h[b]=ts(_/c*g)}else{const b=ts(g/m.length);for(const _ of m)h[_]=b}return h}function vU(e,t){const a=e.map(i=>i.id),o=Object.keys(t);if(a.length!==o.length)return!1;for(const i of a)if(!o.includes(i))return!1;return!0}const Li=new Map;function yU(e){let t=!0;Ft(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const a=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,i=new Set,c=new a(E=>{for(const y of E){const{borderBoxSize:k,target:N}=y;if(N===e.element){if(t){const w=ll({group:e});if(w===0)return;const S=Gr(e.id);if(!S)return;const R=Jx(e),A=S.defaultLayoutDeferred?g2(R):S.layout,T=_U({group:e,nextGroupSize:w,prevGroupSize:S.groupSize,prevLayout:A}),z=Uo({layout:T,panelConstraints:R});if(!S.defaultLayoutDeferred&&$o(S.layout,z)&&bU(S.derivedPanelConstraints,R)&&S.groupSize===w)continue;ir(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:w,layout:z,separatorToPanels:S.separatorToPanels})}}else hU(e,N,k)}});c.observe(e.element),e.panels.forEach(E=>{Ft(!o.has(E.id),`Panel ids must be unique; id "${E.id}" was used more than once`),o.add(E.id),E.onResize&&c.observe(E.element)});const d=ll({group:e}),f=Jx(e),m=e.panels.map(({id:E})=>E).join(",");let g=e.mutableState.defaultLayout;g&&(vU(e.panels,g)||(g=void 0));const h=e.mutableState.layouts[m]??g??g2(f),b=Uo({layout:h,panelConstraints:f}),_=e.element.ownerDocument;Li.set(_,(Li.get(_)??0)+1);const j=new Map;return eR(e).forEach(E=>{E.separator&&j.set(E.separator,E.panels)}),ir(e,{defaultLayoutDeferred:d===0,derivedPanelConstraints:f,groupSize:d,layout:b,separatorToPanels:j}),e.separators.forEach(E=>{Ft(!i.has(E.id),`Separator ids must be unique; id "${E.id}" was used more than once`),i.add(E.id),E.element.addEventListener("keydown",c2)}),Li.get(_)===1&&(_.addEventListener("contextmenu",a2,!0),_.addEventListener("dblclick",l2,!0),_.addEventListener("pointerdown",u2,!0),_.addEventListener("pointerleave",d2),_.addEventListener("pointermove",f2),_.addEventListener("pointerout",p2),_.addEventListener("pointerup",m2,!0)),function(){t=!1,Li.set(_,Math.max(0,(Li.get(_)??0)-1)),oU(e),e.separators.forEach(E=>{E.element.removeEventListener("keydown",c2)}),Li.get(_)||(_.removeEventListener("contextmenu",a2,!0),_.removeEventListener("dblclick",l2,!0),_.removeEventListener("pointerdown",u2,!0),_.removeEventListener("pointerleave",d2),_.removeEventListener("pointermove",f2),_.removeEventListener("pointerout",p2),_.removeEventListener("pointerup",m2,!0)),c.disconnect()}}function jU(){const[e,t]=x.useState({}),a=x.useCallback(()=>t({}),[]);return[e,a]}function iv(e){const t=x.useId();return`${e??t}`}const Xo=typeof window<"u"?x.useLayoutEffect:x.useEffect;function zc(e){const t=x.useRef(e);return Xo(()=>{t.current=e},[e]),x.useCallback((...a)=>t.current?.(...a),[t])}function lv(...e){return zc(t=>{e.forEach(a=>{if(a)switch(typeof a){case"function":{a(t);break}case"object":{a.current=t;break}}})})}function cv(e){const t=x.useRef({...e});return Xo(()=>{for(const a in e)t.current[a]=e[a]},[e]),t.current}const fR=x.createContext(null);function kU(e,t){const a=x.useRef({getLayout:()=>({}),setLayout:aU});x.useImperativeHandle(t,()=>a.current,[]),Xo(()=>{Object.assign(a.current,uR({groupId:e}))})}function tb({children:e,className:t,defaultLayout:a,disableCursor:o,disabled:i,elementRef:c,groupRef:d,id:f,onLayoutChange:m,onLayoutChanged:g,orientation:h="horizontal",resizeTargetMinimumSize:b={coarse:20,fine:10},style:_,...j}){const E=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),y=zc(I=>{$o(E.current.onLayoutChange,I)||(E.current.onLayoutChange=I,m?.(I))}),k=zc((I,D)=>{$o(E.current.onLayoutChanged,I)||(E.current.onLayoutChanged=I,g?.(I,{isUserInteraction:D}))}),N=iv(f),w=x.useRef(null),[S,R]=jU(),A=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),T=lv(w,c);kU(N,d);const z=zc((I,D)=>{const $=Bo(),q=s2(I),G=Gr(I);if(G){let U=!1;switch($.state){case"active":{U=$.hitRegions.some(V=>V.group===q);break}}return{flexGrow:G.layout[D]??1,pointerEvents:U?"none":void 0}}if(a?.[D])return{flexGrow:a?.[D]}}),M=cv({defaultLayout:a,disableCursor:o}),P=x.useMemo(()=>({get disableCursor(){return!!M.disableCursor},getPanelStyles:z,id:N,orientation:h,registerPanel:I=>{const D=A.current;return D.panels=eb(h,[...D.panels,I]),R(),()=>{D.panels=D.panels.filter($=>$!==I),R()}},registerSeparator:I=>{const D=A.current;return D.separators=eb(h,[...D.separators,I]),R(),()=>{D.separators=D.separators.filter($=>$!==I),R()}},updatePanelProps:(I,{disabled:D})=>{const $=A.current.panels.find(U=>U.id===I);$&&($.panelConstraints.disabled=D);const q=s2(N),G=Gr(N);q&&G&&ir(q,{...G,derivedPanelConstraints:Jx(q)})},updateSeparatorProps:(I,{disabled:D,disableDoubleClick:$})=>{const q=A.current.separators.find(G=>G.id===I);q&&(q.disabled=D,q.disableDoubleClick=$)}}),[z,N,R,h,M]),L=x.useRef(null);return Xo(()=>{const I=w.current;if(I===null)return;const D=A.current;let $;if(M.defaultLayout!==void 0&&Object.keys(M.defaultLayout).length===D.panels.length){$={};for(const W of D.panels){const B=M.defaultLayout[W.id];B!==void 0&&($[W.id]=B)}}const q={disabled:!!i,element:I,id:N,mutableState:{defaultLayout:$,disableCursor:!!M.disableCursor,expandedPanelSizes:A.current.lastExpandedPanelSizes,layouts:A.current.layouts},orientation:h,panels:D.panels,resizeTargetMinimumSize:D.resizeTargetMinimumSize,separators:D.separators};L.current=q;const G=yU(q),{defaultLayoutDeferred:U,derivedPanelConstraints:V,layout:X}=Gr(q.id,!0);!U&&V.length>0&&(y(X),k(X,!1));const Q=rv(N,W=>{const{defaultLayoutDeferred:B,derivedPanelConstraints:K,layout:ee}=W.next;if(B||K.length===0)return;const F=q.panels.map(({id:Z})=>Z).join(",");q.mutableState.layouts[F]=ee,K.forEach(Z=>{if(Z.collapsible){const{layout:fe}=W.prev??{};if(fe){const Y=Xn(Z.collapsedSize,ee[Z.panelId]),oe=Xn(Z.collapsedSize,fe[Z.panelId]);Y&&!oe&&(q.mutableState.expandedPanelSizes[Z.panelId]=fe[Z.panelId])}}});const ne=Bo().state!=="active";y(ee),ne&&k(ee,W.isUserInteraction)});return()=>{L.current=null,G(),Q()}},[i,N,k,y,h,S,M]),x.useEffect(()=>{const I=L.current;I&&(I.mutableState.defaultLayout=a,I.mutableState.disableCursor=!!o)}),n.jsx(fR.Provider,{value:P,children:n.jsx("div",{...j,className:t,"data-group":!0,"data-testid":N,id:N,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})})}tb.displayName="Group";function uv(){const e=x.useContext(fR);return Ft(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function wU(e,t){const{id:a}=uv(),o=x.useRef({collapse:nx,expand:nx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:nx});x.useImperativeHandle(t,()=>o.current,[]),Xo(()=>{Object.assign(o.current,cR({groupId:a,panelId:e}))})}function Eo({children:e,className:t,collapsedSize:a="0%",collapsible:o=!1,defaultSize:i,disabled:c,elementRef:d,groupResizeBehavior:f="preserve-relative-size",id:m,maxSize:g="100%",minSize:h="0%",onResize:b,panelRef:_,style:j,...E}){const y=!!m,k=iv(m),N=cv({disabled:c}),w=x.useRef(null),S=lv(w,d),{getPanelStyles:R,id:A,orientation:T,registerPanel:z,updatePanelProps:M}=uv(),P=b!==null,L=zc((q,G,U)=>{b?.(q,m,U)});Xo(()=>{const q=w.current;if(q!==null){const G={element:q,id:k,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:P?L:void 0,panelConstraints:{groupResizeBehavior:f,collapsedSize:a,collapsible:o,defaultSize:i,disabled:N.disabled,maxSize:g,minSize:h}};return z(G)}},[f,a,o,i,P,k,y,g,h,L,z,N]),x.useEffect(()=>{M(k,{disabled:c})},[c,k,M]),wU(k,_);const I=()=>{const q=R(A,k);if(q)return JSON.stringify(q)},D=x.useSyncExternalStore(q=>rv(A,q),I,I);let $;return D?$=JSON.parse(D):i!==void 0?$={flexGrow:void 0,flexShrink:void 0,flexBasis:i}:$={flexGrow:1},n.jsx("div",{...E,"data-disabled":c||void 0,"data-panel":!0,"data-testid":k,id:k,ref:S,style:{...SU,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...$},children:n.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...j,touchAction:T==="horizontal"?"pan-y":"pan-x"},children:e})})}Eo.displayName="Panel";const SU={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function CU({layout:e,panelConstraints:t,panelId:a,panelIndex:o}){let i,c;const d=e[a],f=t.find(m=>m.panelId===a);if(f){const m=f.maxSize,g=f.collapsible?f.collapsedSize:f.minSize,h=[o,o+1];c=Uo({layout:Gc({delta:g-d,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[a],i=Uo({layout:Gc({delta:m-d,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[a]}return{valueControls:a,valueMax:i,valueMin:c,valueNow:d}}function dv({children:e,className:t,disabled:a,disableDoubleClick:o,elementRef:i,id:c,style:d,...f}){const m=iv(c),g=cv({disabled:a,disableDoubleClick:o}),[h,b]=x.useState({}),[_,j]=x.useState("inactive"),[E,y]=x.useState(!1),k=x.useRef(null),N=lv(k,i),{disableCursor:w,id:S,orientation:R,registerSeparator:A,updateSeparatorProps:T}=uv(),z=R==="horizontal"?"vertical":"horizontal";Xo(()=>{const L=k.current;if(L!==null){const I={disabled:g.disabled,disableDoubleClick:g.disableDoubleClick,element:L,id:m},D=A(I),$=nU(G=>{j(G.next.state!=="inactive"&&G.next.hitRegions.some(U=>U.separator===I)?G.next.state:"inactive")}),q=rv(S,G=>{const{derivedPanelConstraints:U,layout:V,separatorToPanels:X}=G.next,Q=X.get(I);if(Q){const W=Q[0],B=Q.indexOf(W);b(CU({layout:V,panelConstraints:U,panelId:W.id,panelIndex:B}))}});return()=>{$(),q(),D()}}},[S,m,A,g]),x.useEffect(()=>{T(m,{disabled:a,disableDoubleClick:o})},[a,o,m,T]);let M;a&&!w&&(M="not-allowed");let P;if(a)P="disabled";else switch(_){case"active":{P="active";break}default:E?P="focus":P=_}return n.jsx("div",{...f,"aria-controls":h.valueControls,"aria-disabled":a||void 0,"aria-orientation":z,"aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:e,className:t,"data-separator":P,"data-testid":m,id:m,onBlur:()=>y(!1),onFocus:()=>y(!0),ref:N,role:"separator",style:{flexBasis:"auto",cursor:M,...d,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:a?void 0:0})}dv.displayName="Separator";function NU({projects:e,value:t,onChange:a,disabled:o}){const i=e.map(c=>{const d=c.path?.split("/").filter(Boolean).pop()||u("modules_ui.code_project_fallback",{id:c.id});return{value:String(c.id),label:c.name||d,icon:VA,description:c.path}});return n.jsx("div",{className:"w-full","data-testid":"code-project-select",children:n.jsx(ct,{value:t,onChange:a,options:i,placeholder:u("modules_ui.code_pick_project_ph"),disabled:o})})}function EU({sessions:e,activeId:t,busy:a,onSelect:o,onCreate:i,onRename:c,onDelete:d}){return n.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("code_module.sessions")}),n.jsx(Ue,{content:u("code_module.new_session"),children:n.jsxs("button",{type:"button",onClick:i,disabled:a,"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:[n.jsx(Dt,{className:"size-3"})," ",u("code_module.new_session")]})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?n.jsx("div",{className:"p-2",children:n.jsx(ut,{children:u("code_module.no_sessions")})}):n.jsx("ul",{className:"space-y-0.5",children:e.map(f=>n.jsxs("li",{className:"group/item relative",children:[n.jsxs("button",{type:"button",onClick:()=>o(f.id),className:ge("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",f.id===t?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[n.jsx(bb,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),n.jsxs("span",{className:"min-w-0 flex-1",children:[n.jsx("span",{className:"block truncate font-medium",children:f.title}),n.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[f.mode," · ",f.messageCount," msg",f.model?` · ${f.model}`:""]})]})]}),n.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[n.jsx(Ue,{content:u("code_module.rename"),children:n.jsx("button",{type:"button",onClick:()=>c(f.id,f.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:n.jsx(wa,{className:"size-3"})})}),n.jsx(Ue,{content:u("code_module.delete"),children:n.jsx("button",{type:"button",onClick:()=>d(f.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:n.jsx(_n,{className:"size-3"})})})]})]},f.id))})})]})}function RU({mode:e,onChange:t,disabled:a}){const o=(i,c,d,f)=>n.jsx(Ue,{content:d,children:n.jsxs("button",{type:"button",disabled:a,"data-testid":`code-mode-${i}`,"aria-pressed":e===i,onClick:()=>t(i),className:ge("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors disabled:opacity-50",e===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[n.jsx(f,{className:"size-3.5"})," ",c]})});return n.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[o("build",u("code_module.mode_build"),u("code_module.mode_build_hint"),XA),o("plan",u("code_module.mode_plan"),u("code_module.mode_plan_hint"),AA)]})}function TU({value:e,onValueChange:t,onSubmit:a,onStop:o,busy:i,disabled:c,mode:d,onModeChange:f,model:m,onModelChange:g}){return n.jsx(Z_,{value:e,onValueChange:t,onSubmit:a,onStop:o,busy:i,disabled:c,placeholder:u("code_module.placeholder"),minRows:1,maxRows:6,footer:n.jsxs("div",{className:"flex items-center gap-2",children:[n.jsx(RU,{mode:d,onChange:f,disabled:i}),n.jsx(J_,{value:m,onChange:g,disabled:i})]})})}function sx(e,t){let a=0;for(const o of e.parts||[])o.kind==="text"&&t.text&&(a+=o.text.length),o.kind==="tool"&&t.tool&&(o.args&&(a+=JSON.stringify(o.args).length),o.result!==void 0&&(a+=JSON.stringify(o.result).length));return Math.ceil(a/4)}function AU(e){let t=null,a=0,o=0;for(const d of e)d.role==="user"?a++:o++,d.role==="assistant"&&d.usage&&(t={input:d.usage.input_tokens,output:d.usage.output_tokens,model:d.model});const i=t?.input??0,c=t?.output??0;return{model:t?.model??null,input:i,output:c,total:i+c,hasUsage:!!t,messages:e.length,userMsgs:a,assistantMsgs:o}}function MU(e){let t=0,a=0,o=0;for(const d of e)d.role==="user"?t+=sx(d,{text:!0}):a+=sx(d,{text:!0}),o+=sx(d,{tool:!0});const i=t+a+o||1,c=(d,f)=>({key:d,tokens:f,percent:Math.round(f/i*100)});return[c("user",t),c("assistant",a),c("tool",o)].filter(d=>d.tokens>0)}const h2={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Ka({label:e,value:t}){return n.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[n.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),n.jsx("span",{className:"min-w-0 truncate text-right font-mono text-xs text-foreground",children:t})]})}function x2(e){if(!e)return"";const t=new Date(e),a=o=>String(o).padStart(2,"0");return`${a(t.getDate())} ${t.toLocaleString("es",{month:"short"})} ${t.getFullYear()}, ${a(t.getHours())}:${a(t.getMinutes())}`}function zU({turns:e,session:t}){const a=x.useMemo(()=>AU(e),[e]),o=x.useMemo(()=>MU(e),[e]);return e.length===0?n.jsx("div",{className:"p-3",children:n.jsx(ut,{children:u("code_module.ctx_none")})}):n.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[n.jsx(Ka,{label:u("code_module.ctx_model"),value:a.model||u("modules_ui.code_ctx_auto")}),t?.mode&&n.jsx(Ka,{label:u("modules_ui.code_ctx_mode"),value:t.mode}),t?.agentSlug&&n.jsx(Ka,{label:u("modules_ui.code_ctx_agent"),value:t.agentSlug}),n.jsx(Ka,{label:u("code_module.ctx_messages"),value:u("modules_ui.code_ctx_msgs_value",{user:a.userMsgs,assistant:a.assistantMsgs})}),n.jsx(Ka,{label:u("code_module.ctx_input"),value:a.input.toLocaleString()}),n.jsx(Ka,{label:u("code_module.ctx_output"),value:a.output.toLocaleString()}),n.jsx(Ka,{label:u("modules_ui.code_ctx_tokens_total"),value:(a.input+a.output).toLocaleString()}),t?.createdAt&&n.jsx(Ka,{label:u("modules_ui.code_ctx_created"),value:x2(t.createdAt)}),t?.updatedAt&&n.jsx(Ka,{label:u("modules_ui.code_ctx_activity"),value:x2(t.updatedAt)}),n.jsx("hr",{className:"border-border my-2"}),n.jsxs("div",{children:[n.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:u("code_module.ctx_breakdown")}),o.length>0?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:o.map(i=>n.jsx(Ue,{content:`${i.key}: ${i.tokens} (${i.percent}%)`,children:n.jsx("div",{className:h2[i.key],style:{width:`${i.percent}%`}})},i.key))}),n.jsx("ul",{className:"mt-2 space-y-1",children:o.map(i=>n.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[n.jsx("span",{className:`size-2 rounded-full ${h2[i.key]}`}),n.jsx("span",{className:"flex-1 text-foreground/80",children:u(`code_module.seg_${i.key}`)}),n.jsxs("span",{className:"font-mono text-muted-foreground",children:[i.tokens," · ",i.percent,"%"]})]},i.key))})]}):n.jsx("p",{className:"text-[11px] text-muted-foreground",children:u("code_module.ctx_none")})]})]})}function OU(e){const t=[];for(const a of(e||"").split(`
819
- `))a.startsWith("diff --git")||a.startsWith("index ")||a.startsWith("--- ")||a.startsWith("+++ ")||a.startsWith("new file")||a.startsWith("deleted file")||a.startsWith("similarity index")||a.startsWith("rename ")||(a.startsWith("@@")?t.push({kind:"hunk",text:a}):a.startsWith("+")?t.push({kind:"add",text:a.slice(1)}):a.startsWith("-")?t.push({kind:"del",text:a.slice(1)}):t.push({kind:"ctx",text:a.replace(/^ /,"")}));for(;t.length&&t[t.length-1].kind==="ctx"&&t[t.length-1].text==="";)t.pop();return t}function DU({patch:e}){const t=x.useMemo(()=>OU(e),[e]);return t.length?n.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:n.jsx("code",{className:"block",children:t.map((a,o)=>n.jsxs("div",{className:ge("px-2 whitespace-pre",a.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",a.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",a.kind==="hunk"&&"bg-muted/60 text-muted-foreground",a.kind==="ctx"&&"text-foreground/70"),children:[n.jsx("span",{className:"select-none opacity-50",children:a.kind==="add"?"+":a.kind==="del"?"-":" "}),a.text]},o))})}):null}const PU={added:lx,modified:pf,deleted:HA},LU={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 IU({file:e}){const[t,a]=x.useState(!1),o=PU[e.status];return n.jsxs("li",{className:"rounded-md border border-border",children:[n.jsxs("button",{type:"button",onClick:()=>a(i=>!i),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[n.jsx(Zr,{className:ge("size-3 shrink-0 transition-transform",t&&"rotate-90")}),n.jsx(o,{className:ge("size-3.5 shrink-0",LU[e.status])}),n.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),n.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&n.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&n.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),t&&n.jsx("div",{className:"border-t border-border p-1.5",children:n.jsx(DU,{patch:e.patch})})]})}function BU({changes:e,loading:t,onRefresh:a}){const o=e?.files||[];return n.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[n.jsx("span",{className:"text-[11px] text-muted-foreground",children:o.length>0?u("code_module.changes_files",{n:o.length}):""}),n.jsx(Ue,{content:u("code_module.reload"),children:n.jsx("button",{type:"button",onClick:a,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:t?n.jsx(bn,{size:12}):n.jsx(Cs,{className:"size-3"})})})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?n.jsx(ut,{children:u("code_module.changes_no_git")}):o.length===0?n.jsx(ut,{children:u("code_module.changes_none")}):n.jsx("ul",{className:"space-y-1.5",children:o.map(i=>n.jsx(IU,{file:i},i.path))})})]})}const $U=[{value:"context",icon:Gf,label:"tab_context"},{value:"changes",icon:KA,label:"tab_changes"},{value:"artifacts",icon:cM,label:"tab_artifacts"}];function UU({pid:e,turns:t,changes:a,changesLoading:o,onRefreshChanges:i,session:c,onRunInTerminal:d,onEditArtifact:f}){const[m,g]=x.useState("context"),h=a?.files.length||0;return n.jsxs(Np,{value:m,onValueChange:g,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[n.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:n.jsx(Ep,{variant:"line",className:"w-full",children:$U.map(({value:b,icon:_,label:j})=>{const E=m===b,y=u(`code_module.${j}`);return n.jsx(Ue,{content:y,children:n.jsxs(qs,{value:b,className:E?"flex-1 min-w-0":"w-8 shrink-0",children:[n.jsx(_,{className:"size-3.5 shrink-0"}),E&&n.jsx("span",{className:"truncate text-xs",children:y}),b==="changes"&&h>0&&n.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)})})}),n.jsx(fs,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:n.jsx(zU,{turns:t,session:c})}),n.jsx(fs,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(BU,{changes:a,loading:o,onRefresh:i})}),n.jsx(fs,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(UE,{pid:e,onRunInTerminal:d,onEditArtifact:f})})]})}function qU(e){const t=[];for(const o of e){const i=o.split("/").filter(Boolean);let c=t,d="";for(let f=0;f<i.length;f++){d=d?`${d}/${i[f]}`:i[f];const m=f===i.length-1;let g=c.find(h=>h.name===i[f]);g||(g={name:i[f],path:d,type:m?"file":"dir",children:m?void 0:[]},c.push(g)),m||(c=g.children)}}const a=o=>(o.forEach(i=>{i.children&&(i.children=a(i.children))}),o.sort((i,c)=>i.type!==c.type?i.type==="dir"?-1:1:i.name.localeCompare(c.name)));return a(t)}function pR({node:e,depth:t,onOpenFile:a,openDirs:o,toggleDir:i}){const c=e.type==="dir",d=c&&o.has(e.path);return n.jsxs("li",{children:[n.jsxs("button",{type:"button",onClick:()=>c?i(e.path):a(e.path),style:{paddingLeft:`${t*12+6}px`},className:ge("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?n.jsxs(n.Fragment,{children:[n.jsx(Zr,{className:ge("size-3 shrink-0 transition-transform",d&&"rotate-90")}),d?n.jsx(Ho,{className:"size-3.5 shrink-0 text-amber-400"}):n.jsx(J2,{className:"size-3.5 shrink-0 text-amber-400"})]}):n.jsxs(n.Fragment,{children:[n.jsx("span",{className:"size-3 shrink-0"}),n.jsx(W2,{className:"size-3.5 shrink-0 text-sky-400"})]}),n.jsx("span",{className:"truncate",children:e.name})]}),c&&d&&e.children&&e.children.length>0&&n.jsx("ul",{children:e.children.map(f=>n.jsx(pR,{node:f,depth:t+1,onOpenFile:a,openDirs:o,toggleDir:i},f.path))})]})}function HU({pid:e,projectPath:t,className:a,onOpenFile:o}){const[i,c]=x.useState([]),[d,f]=x.useState(!1),[m,g]=x.useState(!1),[h,b]=x.useState(()=>new Set),_=x.useCallback(async()=>{f(!0);try{const w=(await se.post("/api/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(`
820
- `).map(S=>S.trim()).filter(Boolean);c(w),g(!0)}catch{g(!0)}finally{f(!1)}},[e]);x.useEffect(()=>{b(new Set),_()},[_]);const j=x.useCallback(N=>{b(w=>{const S=new Set(w);return S.has(N)?S.delete(N):S.add(N),S})},[]),E=x.useCallback(()=>{b(new Set)},[]),y=qU(i),k=h.size>0;return n.jsxs("div",{className:ge("flex h-full flex-col",a),"data-testid":"code-file-tree",children:[n.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-3 py-2",children:[n.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Archivos"}),n.jsxs("div",{className:"flex items-center gap-0.5",children:[n.jsx(Ue,{content:u("code_module.tree_collapse_all"),children:n.jsx("button",{type:"button",onClick:E,disabled:!k,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:n.jsx(NA,{className:"size-3"})})}),n.jsx(Ue,{content:u("code_module.reload"),children:n.jsx("button",{type:"button",onClick:()=>void _(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:d?n.jsx(bn,{size:12}):n.jsx(Cs,{className:"size-3"})})})]})]}),n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:m?y.length===0?n.jsx("div",{className:"p-3",children:n.jsx(ut,{children:"Sin archivos"})}):n.jsx("ul",{children:y.map(N=>n.jsx(pR,{node:N,depth:0,onOpenFile:o??(()=>{}),openDirs:h,toggleDir:j},N.path))}):n.jsx("div",{className:"flex justify-center pt-6",children:n.jsx(bn,{size:14})})})]})}function VU({path:e,content:t,loading:a,onSave:o}){const i=typeof o=="function",[c,d]=x.useState(t),[f,m]=x.useState(!1);x.useEffect(()=>{d(t)},[t]);const g=i&&c!==t,h=async()=>{if(!(!o||!g)){m(!0);try{await o(c)}finally{m(!1)}}};return n.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"code-file-viewer",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[n.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e,g&&n.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),i&&n.jsxs(n.Fragment,{children:[n.jsx(Ue,{content:u("code_module.discard_changes"),children:n.jsxs("button",{type:"button",onClick:()=>d(t),disabled:!g||f,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:[n.jsx(fl,{className:"size-3"}),"Descartar"]})}),n.jsx(Ue,{content:u("code_module.save_shortcut_hint"),children:n.jsxs("button",{type:"button",onClick:()=>void h(),disabled:!g||f,className:ge("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",g&&!f?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[f?n.jsx(bn,{size:10}):n.jsx(Kf,{className:"size-3"}),"Guardar"]})})]})]}),a?n.jsx("div",{className:"flex flex-1 items-center justify-center",children:n.jsx(bn,{size:16})}):i?n.jsx("textarea",{value:c,onChange:b=>d(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}):n.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:n.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:n.jsx("tbody",{children:t.split(`
821
- `).map((b,_)=>n.jsxs("tr",{className:"hover:bg-accent/20",children:[n.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}),n.jsx("td",{className:"px-4 py-0 align-top text-foreground/90 whitespace-pre",children:b||" "})]},_))})})})]})}function FU({pid:e,className:t,initCmd:a,onClose:o}){const[i,c]=x.useState([]),[d,f]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState([]),[_,j]=x.useState(-1),E=x.useRef(null),y=x.useRef(null);x.useEffect(()=>{E.current?.scrollIntoView({behavior:"smooth"})},[i]),x.useEffect(()=>{a&&(f(a),setTimeout(()=>y.current?.focus(),50))},[a]);const k=async w=>{const S=w.trim();if(S){b(R=>[S,...R.slice(0,49)]),j(-1),c(R=>[...R,{type:"cmd",text:`$ ${S}`}]),g(!0);try{const R=await se.post("/api/run",{cmd:S,project:e});R.stdout&&c(A=>[...A,{type:"out",text:R.stdout}]),R.stderr&&c(A=>[...A,{type:"err",text:R.stderr}])}catch(R){c(A=>[...A,{type:"err",text:String(R.message)}])}finally{g(!1)}}},N=w=>{if(w.key==="Enter")k(d),f("");else if(w.key==="ArrowUp"){w.preventDefault();const S=Math.min(_+1,h.length-1);j(S),f(h[S]??"")}else if(w.key==="ArrowDown"){w.preventDefault();const S=Math.max(_-1,-1);j(S),f(S===-1?"":h[S]??"")}};return n.jsxs("div",{className:ge("flex h-full min-h-0 flex-col bg-card/60",t),"data-testid":"code-terminal",children:[n.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1",children:[n.jsx(ya,{className:"size-3 text-muted-foreground"}),n.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),n.jsx(Ue,{content:u("code_module.terminal_clear"),children:n.jsx("button",{type:"button",onClick:()=>c([]),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(BA,{className:"size-3"})})}),n.jsx(Ue,{content:u("code_module.terminal_close"),children:n.jsx("button",{type:"button",onClick:()=>o?.(),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.jsx(gs,{className:"size-3"})})})]}),n.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:[i.map((w,S)=>n.jsx("div",{className:ge("whitespace-pre-wrap break-all",w.type==="cmd"&&"text-emerald-400",w.type==="err"&&"text-rose-400",w.type==="out"&&"text-foreground/90"),children:w.text},S)),n.jsx("div",{ref:E})]}),n.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-3 py-1",children:[n.jsx("span",{className:"mr-2 text-[11px] text-emerald-400 font-mono",children:"$"}),n.jsx("input",{ref:y,value:d,onChange:w=>f(w.target.value),onKeyDown:N,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 vc="super-agent";function ax(){return n.jsx(dv,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function GU(){return n.jsx(dv,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function YU(){const e=Je(),t=Be("/api/projects",()=>Zn.list()),a=x.useMemo(()=>t.data||[],[t.data]),[o,i]=x.useState(""),[c,d]=x.useState(null),[f,m]=x.useState(vc),[g,h]=x.useState([]),[b,_]=x.useState(""),[j,E]=x.useState(!1),[y,k]=x.useState(!0),[N,w]=x.useState(!0),[S,R]=x.useState(!1),[A,T]=x.useState(""),[z,M]=x.useState(!1),P=x.useRef(null),[L,I]=qo(),D=x.useRef(!1),[$,q]=x.useState([]),[G,U]=x.useState("chat"),V=x.useCallback(je=>{R(!0),T(je)},[]);x.useEffect(()=>{!o&&a.length&&i(String(a[0].id))},[o,a]);const X=Be(o?["code-sessions",o]:null,()=>Ya.sessions.list(o)),Q=Be(o?["agents",o]:null,()=>an.list(o)),W=Be(o&&c?["code-session",o,c]:null,()=>Ya.sessions.get(o,c)),B=Be(o&&c?["code-changes",o,c]:null,()=>Ya.changes(o,c));x.useEffect(()=>{const je=X.data||[];!c&&je.length&&d(je[0].id),c&&je.length&&!je.some(ze=>ze.id===c)&&d(je[0]?.id??null)},[X.data,c]),x.useEffect(()=>{W.data&&m(W.data.agentSlug||vc)},[W.data]),x.useEffect(()=>{j||(W.data?h(W.data.messages||[]):c||h([]))},[W.data,c,j]),x.useEffect(()=>()=>P.current?.abort(),[]);const K=W.data,ee=K?.mode==="plan"?"plan":"build",F=K?.model||"",ne=je=>{je===o||j||(i(je),d(null),h([]))},Z=je=>{j||je===c||(d(je),h([]))},fe=async()=>{if(!(!o||j))try{const je=await Ya.sessions.create(o,{title:u("code_module.untitled"),agentSlug:f!==vc?f:null});await X.mutate(),d(je.id),h([])}catch(je){e.error(je.message)}},Y=async(je,ze)=>{const Ye=window.prompt(u("code_module.rename"),ze);if(!(!Ye||Ye===ze))try{await Ya.sessions.update(o,je,{title:Ye}),await X.mutate(),je===c&&await W.mutate()}catch(We){e.error(We.message)}},oe=async je=>{if(!j&&window.confirm(u("code_module.delete_confirm")))try{await Ya.sessions.remove(o,je),je===c&&(d(null),h([])),await X.mutate()}catch(ze){e.error(ze.message)}},ve=async je=>{if(m(je),!!c)try{await Ya.sessions.update(o,c,{agentSlug:je!==vc?je:null}),await Promise.all([W.mutate(),X.mutate()])}catch(ze){e.error(ze.message)}},ie=x.useCallback(async je=>{if(c)try{await Ya.sessions.update(o,c,je),await Promise.all([W.mutate(),X.mutate()])}catch(ze){e.error(ze.message)}},[o,c,W,X,e]),xe=()=>{P.current?.abort(),E(!1)},ke=je=>h(ze=>{const Ye=[...ze],We=Ye[Ye.length-1];return We&&We.role==="assistant"&&(Ye[Ye.length-1]=je(We)),Ye}),Re=async je=>{const ze=(je??b).trim();if(!ze||j||!o||!c)return;const Ye=new Date().toISOString();h(Rt=>[...Rt,{role:"user",parts:[{kind:"text",text:ze}],ts:Ye},{role:"assistant",parts:[],ts:Ye,pending:!0}]),_(""),E(!0);const We=new AbortController;P.current=We;const ft=Rt=>{if(Rt.type==="error"){e.error(Rt.error||u("modules_ui.code_stream_error"));return}ke(Qt=>ev(Qt,Rt))};try{await Ya.stream(o,c,{prompt:ze},ft,We.signal),ke(Rt=>({...Rt,pending:!1}))}catch(Rt){We.signal.aborted?ke(Qt=>({...Qt,pending:!1,parts:[...Qt.parts,{kind:"text",text:u("code_module.stopped")}]})):(e.error(Rt.message),h(Qt=>Qt.filter((ot,Pt)=>Pt!==Qt.length-1)))}finally{P.current===We&&(P.current=null),E(!1),W.mutate(),X.mutate(),B.mutate()}},Ae=async je=>{try{await navigator.clipboard.writeText(je),e.info(u("modules_ui.code_copied"))}catch{}},Ie=x.useCallback(je=>{U(je),q(ze=>ze.some(Ye=>Ye.path===je)?ze:[...ze,{path:je,content:"",loading:!0}]),se.post("/run",{cmd:`cat "${je}"`,project:o}).then(ze=>{const Ye=ze.stdout||ze.stderr||u("modules_ui.code_file_empty");q(We=>We.map(ft=>ft.path===je?{...ft,content:Ye,loading:!1}:ft))}).catch(ze=>{q(Ye=>Ye.map(We=>We.path===je?{...We,content:u("modules_ui.code_file_error",{msg:ze.message}),loading:!1}:We))})},[o]),Oe=x.useCallback(je=>{q(ze=>ze.filter(Ye=>Ye.path!==je)),U(ze=>ze===je?"chat":ze)},[]),Te=x.useCallback(je=>{const ze=`artifacts/${je}`;U(ze),q(Ye=>Ye.some(We=>We.path===ze)?Ye:[...Ye,{path:ze,content:"",loading:!0,artifactName:je}]),Ws.read(o,je).then(Ye=>{q(We=>We.map(ft=>ft.path===ze?{...ft,content:Ye.content,loading:!1}:ft))}).catch(Ye=>{q(We=>We.map(ft=>ft.path===ze?{...ft,content:u("modules_ui.code_file_error",{msg:Ye.message}),loading:!1}:ft))})},[o]);x.useEffect(()=>{if(D.current)return;const je=L.get("pid"),ze=L.get("cmd"),Ye=L.get("edit");if(!(!je||!ze&&!Ye)){if(String(o)!==String(je)){i(String(je));return}D.current=!0,Ye&&Te(Ye),ze&&V(ze.endsWith(" ")?ze:ze+" "),I({},{replace:!0})}},[L,o,Te,V,I]);const Ne=x.useCallback(async(je,ze)=>{const Ye=$.find(We=>We.path===je);if(Ye?.artifactName)try{await Ws.write(o,Ye.artifactName,ze),q(We=>We.map(ft=>ft.path===je?{...ft,content:ze}:ft)),e.info(u("modules_ui.code_saved"))}catch(We){e.error(We.message)}},[$,o,e]),Me=!t.isLoading&&a.length>0,De=x.useMemo(()=>{const je=[{value:vc,label:u("modules_ui.code_super_agent"),icon:rn,description:u("modules_ui.code_super_agent_desc")}],ze=(Q.data||[]).map(Ye=>({value:Ye.slug,label:Ye.slug,icon:rn,description:Ye.description||Ye.role||void 0}));return[...je,...ze]},[Q.data]),qe=x.useMemo(()=>g,[g]),Xe=x.useMemo(()=>X.data?.find(je=>je.id===c)?.title||"",[X.data,c]),me=x.useMemo(()=>a.find(je=>String(je.id)===o),[a,o]);jL(Xe);const[de,Le]=x.useState(null),ye=j?null:$E(g),Ce=ye&&ye.turnKey!==de,Qe=je=>{Re(je)},Ge=x.useCallback(()=>k(je=>!je),[]),it=x.useCallback(()=>M(je=>!je),[]),Tt=x.useCallback(()=>R(je=>!je),[]),_t=x.useCallback(()=>w(je=>!je),[]),Ct=x.useMemo(()=>c?n.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:oS,open:y,toggle:Ge,title:u("modules_ui.code_panel_sessions")},{Icon:hb,open:z,toggle:it,title:u("modules_ui.code_panel_tree")},{Icon:ya,open:S,toggle:Tt,title:u("modules_ui.code_panel_terminal")},{Icon:uM,open:N,toggle:_t,title:u("modules_ui.code_panel_context")}].map(({Icon:je,open:ze,toggle:Ye,title:We})=>n.jsx(Ue,{content:We,children:n.jsx("button",{type:"button",onClick:Ye,"data-active":ze,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:n.jsx(je,{className:"size-3.5"})})},We))}):null,[c,y,z,S,N,Ge,it,Tt,_t]);return wL(Ct),n.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:t.isLoading?n.jsx(tt,{}):Me?n.jsxs(tb,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[n.jsx(Eo,{id:"top",defaultSize:S?"55%":"100%",minSize:"20%",children:n.jsxs(tb,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[y&&n.jsxs(n.Fragment,{children:[n.jsx(Eo,{id:"left",defaultSize:"14%",minSize:"8%",children:n.jsxs("aside",{className:"flex h-full flex-col",children:[n.jsx("div",{className:"shrink-0 border-b border-border p-2",children:n.jsx(NU,{projects:a,value:o,onChange:ne,disabled:j})}),n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:n.jsx(EU,{sessions:X.data||[],activeId:c,busy:j,onSelect:Z,onCreate:fe,onRename:Y,onDelete:oe})}),n.jsx("div",{className:"shrink-0 border-t border-border p-2",children:n.jsx(ct,{value:f,onChange:ve,options:De,disabled:j,showIcon:!0})})]})}),n.jsx(ax,{})]}),z&&n.jsxs(n.Fragment,{children:[n.jsx(Eo,{id:"tree",defaultSize:"13%",minSize:"8%",children:n.jsx("div",{className:"h-full",children:n.jsx(HU,{pid:o,projectPath:me?.path,onOpenFile:Ie})})}),n.jsx(ax,{})]}),n.jsx(Eo,{id:"main",defaultSize:"50%",minSize:"20%",children:n.jsxs("div",{className:"flex h-full flex-col",children:[$.length>0&&n.jsxs("div",{className:"flex shrink-0 items-center gap-0 overflow-x-auto border-b border-border",children:[n.jsxs("button",{type:"button",onClick:()=>U("chat"),"data-active":G==="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:[n.jsx(bb,{className:"size-3 shrink-0"}),u("modules_ui.code_chat_tab")]}),$.map(je=>{const ze=je.path.split("/").pop()??je.path,Ye=G===je.path;return n.jsxs("div",{"data-active":Ye,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:[n.jsx(Ue,{content:je.path,children:n.jsx("button",{type:"button",onClick:()=>U(je.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:ze})}),n.jsx(Ue,{content:u("code_module.close"),children:n.jsx("button",{type:"button",onClick:()=>Oe(je.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:n.jsx(gs,{className:"size-2.5"})})})]},je.path)})]}),G==="chat"?n.jsxs(n.Fragment,{children:[n.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?g.length?n.jsx(tv,{msgs:g,onCopy:Ae}):n.jsx("div",{className:"grid h-full place-items-center p-6",children:n.jsx(ut,{children:u("code_module.empty_chat")})}):n.jsx("div",{className:"grid h-full place-items-center p-6",children:n.jsx(ut,{children:u("code_module.pick_project")})})}),Ce&&ye&&n.jsx(BE,{turnKey:ye.turnKey,questions:ye.questions,onSubmit:Qe,onDismiss:()=>Le(ye.turnKey),disabled:j})]}):n.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const je=$.find(ze=>ze.path===G);return je?n.jsx(VU,{path:je.path,content:je.content,loading:je.loading,onSave:je.artifactName?ze=>Ne(je.path,ze):void 0}):null})()}),n.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:n.jsx(TU,{value:b,onValueChange:_,onSubmit:()=>void Re(),onStop:xe,busy:j,disabled:!c,mode:ee,onModeChange:je=>void ie({mode:je}),model:F,onModelChange:je=>void ie({model:je||null})})})]})}),N&&n.jsxs(n.Fragment,{children:[n.jsx(ax,{}),n.jsx(Eo,{id:"right",defaultSize:"22%",minSize:"15%",children:n.jsx("aside",{className:"flex h-full flex-col",children:n.jsx(UU,{pid:o,turns:qe,changes:B.data,changesLoading:B.isLoading,onRefreshChanges:()=>void B.mutate(),session:W.data?{title:W.data.title,mode:W.data.mode,createdAt:W.data.createdAt,updatedAt:W.data.updatedAt,agentSlug:W.data.agentSlug??null}:null,onRunInTerminal:V,onEditArtifact:Te})})})]})]})}),S&&o&&n.jsxs(n.Fragment,{children:[n.jsx(GU,{}),n.jsx(Eo,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:n.jsx(FU,{pid:o,initCmd:A,onClose:Tt,className:"h-full"})})]})]}):n.jsx("div",{className:"grid flex-1 place-items-center",children:n.jsx(ut,{children:u("code_module.no_projects")})})})}function KU({open:e,onClose:t}){const{mutate:a}=mN(),o=Tn(),i=Je(),[c,d]=x.useState(""),[f,m]=x.useState(!1),[g,h]=x.useState(""),[b,_]=x.useState([]),[j,E]=x.useState(null),[y,k]=x.useState(""),[N,w]=x.useState(!1),[S,R]=x.useState(!1),A=async(M,P=!1)=>{w(!0),k("");try{const L=await Ef.dirs(M||"~");h(L.path),d(L.path),E(L.parent),_(L.entries)}catch(L){const I=L.message;k(I),P||i.error(I)}finally{w(!1)}};x.useEffect(()=>{e||(d(""),m(!1),h(""),_([]),E(null),k(""))},[e]);const T=async()=>{w(!0);try{const M=await Ef.pickDir(u("add_project.picker_prompt"));if("cancelled"in M)return;d(M.path);return}catch{m(!0),await A(c||"~")}finally{w(!1)}},z=async()=>{const M=c.trim();if(!M){i.error(u("add_project.path_required"));return}R(!0);try{const P=await Zn.register(M);i.success(u("add_project.registered",{id:P.id})),await a("/api/projects"),t(),o(`/p/${P.id}`)}catch(P){i.error(P.message)}finally{R(!1)}};return n.jsx(Xt,{open:e,onClose:t,title:u("add_project.title"),description:u("add_project.subtitle"),footer:n.jsxs(n.Fragment,{children:[n.jsx(re,{variant:"ghost",onClick:t,disabled:S,children:u("common.cancel")}),n.jsx(re,{variant:"primary",onClick:z,loading:S,children:u("add_project.register")})]}),children:n.jsxs("div",{className:"space-y-3",children:[n.jsx(le,{label:u("add_project.path_label"),hint:u("add_project.path_hint"),children:n.jsxs("div",{className:"flex gap-2",children:[n.jsx(Ee,{autoFocus:!0,placeholder:u("add_project.path_placeholder"),value:c,onChange:M=>d(M.target.value),onKeyDown:M=>{M.key==="Enter"&&z()}}),n.jsxs(re,{onClick:T,disabled:N,children:[n.jsx(qi,{size:14})," ",u("add_project.search_btn")]})]})}),f&&n.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[n.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[n.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:g||c||"~"}),n.jsxs("div",{className:"flex gap-1",children:[n.jsx(re,{size:"sm",variant:"ghost",onClick:()=>A("~"),disabled:N,children:n.jsx(nS,{size:13})}),n.jsx(re,{size:"sm",variant:"ghost",onClick:()=>j&&A(j),disabled:!j||N,children:".."}),n.jsx(re,{size:"sm",variant:"ghost",onClick:()=>m(!1),disabled:N,children:n.jsx(gs,{size:13})})]})]}),n.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[N&&n.jsx(tt,{}),!N&&y&&n.jsx(ut,{children:u("add_project.browser_unavailable")}),!N&&!y&&b.length===0&&n.jsx(ut,{children:u("add_project.no_folders")}),!N&&!y&&b.map(M=>n.jsxs("button",{type:"button",onClick:()=>A(M),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[n.jsx(Ho,{size:14,className:"text-muted-fg"}),n.jsx("span",{className:"truncate",children:M.split("/").pop()}),n.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:M})]},M))]})]})]})})}function XU({onPaired:e}){const[t,a]=x.useState(""),[o,i]=x.useState(QU()),[c,d]=x.useState(!1),[f,m]=x.useState(null);async function g(){const h=t.trim();if(!h){m(u("pairing.err_required"));return}d(!0),m(null);try{const b=await rl.confirm({pairing_id:h,label:o.trim()||void 0});Ro(b.token);try{localStorage.setItem(Dn.token,b.token)}catch{}e()}catch(b){m(WU(b)),d(!1)}}return n.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:n.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[n.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[n.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:n.jsx(sS,{size:20})}),n.jsxs("div",{children:[n.jsx("h1",{className:"text-base font-semibold",children:u("pairing.title")}),n.jsx("p",{className:"text-xs text-muted-fg",children:u("pairing.subtitle")})]})]}),n.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[n.jsx("li",{className:"font-medium text-foreground",children:u("pairing.steps_title")}),n.jsxs("li",{children:["1. ",u("pairing.step_1")]}),n.jsxs("li",{children:["2. ",u("pairing.step_2")]}),n.jsxs("li",{children:["3. ",u("pairing.step_3")]})]}),n.jsxs("form",{className:"space-y-3",onSubmit:h=>{h.preventDefault(),g()},children:[n.jsx(le,{label:u("pairing.code_label"),children:n.jsx(Ee,{value:t,onChange:h=>a(h.target.value),placeholder:u("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),n.jsx(le,{label:u("pairing.label_label"),hint:u("pairing.revoke_hint"),children:n.jsx(Ee,{value:o,onChange:h=>i(h.target.value),placeholder:u("pairing.label_ph")})}),f&&n.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f}),n.jsx(re,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:u(c?"pairing.linking":"pairing.submit")})]})]})})}function QU(){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 WU(e){if(e instanceof lu){if(e.status===410)return u("pairing.err_expired");if(e.status===404||e.status===409)return u("pairing.err_unknown")}return u("pairing.err_generic")}function ZU({...e}){return n.jsx(NN,{"data-slot":"sheet",...e})}function JU({...e}){return n.jsx(CN,{"data-slot":"sheet-portal",...e})}function eq({className:e,...t}){return n.jsx(jN,{"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 tq({className:e,children:t,side:a="right",showCloseButton:o=!0,...i}){return n.jsxs(JU,{children:[n.jsx(eq,{}),n.jsxs(SN,{"data-slot":"sheet-content","data-side":a,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),...i,children:[t,o&&n.jsxs(wp,{"data-slot":"sheet-close",render:n.jsx(or,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[n.jsx(gs,{}),n.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function nq({className:e,...t}){return n.jsx("div",{"data-slot":"sheet-header",className:St("flex flex-col gap-0.5 p-4",e),...t})}function sq({className:e,...t}){return n.jsx(EN,{"data-slot":"sheet-title",className:St("font-heading text-base font-medium text-foreground",e),...t})}function aq({className:e,...t}){return n.jsx(kN,{"data-slot":"sheet-description",className:St("text-sm text-muted-foreground",e),...t})}function rq({value:e,projectPath:t,onPick:a}){const o=oq(e),i=o?iq(e):"",{data:c}=Be(o?["/api/skills",t||""]:null,()=>Us.list(t)),d=c?.skills||[],f=x.useMemo(()=>{const m=i.toLowerCase();return m?d.filter(g=>g.slug.toLowerCase().includes(m)).slice(0,8):d.slice(0,8)},[d,i]);return!o||f.length===0?null:n.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[n.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:f.map(m=>n.jsx("li",{children:n.jsxs("button",{type:"button",onClick:()=>a(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:[n.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",m.slug]}),n.jsx("span",{className:"truncate text-xs text-muted-foreground",children:m.description})]})},m.slug))}),n.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 oq(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function iq(e){const t=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return t?t[1]:""}function lq(){try{const e=localStorage.getItem(Dn.robyChat);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>a&&Array.isArray(a.parts)&&!a.pending):[]}catch{return[]}}function cq({open:e,onOpenChange:t}){const a=yp(),o=Je(),[i,c]=x.useState(lq),[d,f]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState(""),_=x.useRef(null);x.useEffect(()=>{const w=i.filter(S=>!S.pending);try{w.length?localStorage.setItem(Dn.robyChat,JSON.stringify(w)):localStorage.removeItem(Dn.robyChat)}catch{}},[i]);const j=()=>{if(!m){c([]),f("");try{localStorage.removeItem(Dn.robyChat)}catch{}}};x.useEffect(()=>()=>_.current?.abort(),[]),x.useEffect(()=>{const w=S=>{const R=S.detail?.prompt;typeof R=="string"&&(t(!0),f(R))};return window.addEventListener("apx:roby-prompt",w),()=>window.removeEventListener("apx:roby-prompt",w)},[t]);const E=()=>{_.current?.abort(),g(!1)},y=w=>c(S=>{const R=[...S],A=R[R.length-1];return A?.role==="assistant"&&(R[R.length-1]=w(A)),R}),k=async()=>{const w=d.trim();if(!w||m)return;const S=new Date().toISOString(),R=i.filter(M=>!M.pending).map(M=>({role:M.role,content:Qx(M)}));c(M=>[...M,{role:"user",parts:[{kind:"text",text:w}],ts:S},{role:"assistant",parts:[],ts:S,pending:!0}]),f(""),g(!0);const A=new AbortController;_.current=A;let T=!1;const z=M=>{if(M?.type==="error"){T=!0,o.error(M.error||"error"),c(P=>{const L=[...P],I=L[L.length-1];return I?.role==="assistant"&&I.pending&&L.pop(),L});return}y(P=>ev(P,M))};try{await hN.stream(0,{prompt:w,previousMessages:R,model:h||void 0,channel:"web_sidebar"},z,A.signal),y(M=>({...M,pending:!1}))}catch(M){A.signal.aborted?y(P=>({...P,pending:!1,parts:[...P.parts,{kind:"text",text:u("project.chat.stopped_marker")}]})):T||(o.error(M.message),c(P=>{const L=[...P],I=L[L.length-1];return I?.role==="assistant"&&I.pending&&L.pop(),L}))}finally{_.current===A&&(_.current=null),g(!1)}},N=async w=>{try{await navigator.clipboard.writeText(w),o.info(u("project.chat.copied"))}catch{}};return n.jsx(ZU,{open:e,onOpenChange:t,children:n.jsxs(tq,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[n.jsxs(nq,{className:"pr-12",children:[n.jsxs(sq,{className:"flex items-center gap-2",children:[n.jsx(rn,{size:18})," ",u("superagent.title",{persona:a}),n.jsx("span",{className:"text-xs font-normal text-muted-fg",children:u("superagent.badge")})]}),n.jsx(aq,{children:u("superagent.desc")})]}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:i.length===0?n.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:u("superagent.empty",{persona:a})}):n.jsx(tv,{msgs:i,onCopy:N})}),n.jsx(IE,{msgs:i}),n.jsxs("div",{className:"border-t border-border p-3",children:[n.jsx("div",{className:"mb-1.5",children:n.jsx(rq,{value:d,onPick:w=>f(`/${w} `)})}),n.jsx(Z_,{value:d,onValueChange:f,onSubmit:()=>void k(),onStop:E,busy:m,placeholder:u("superagent.placeholder"),footer:n.jsx(J_,{value:h,onChange:b,disabled:m})}),n.jsx("div",{className:"mt-1.5 flex justify-end",children:n.jsxs(or,{size:"xs",variant:"ghost",onClick:j,disabled:m||i.length===0,children:[n.jsx(Dt,{className:"size-3"})," ",u("superagent.new_chat")]})})]})]})})}function uq(){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"}const b2=new Map;function dq(e){const t=b2.get(e);if(t)return t;const a=rl.confirm({pairing_id:e,label:uq(),kind:"web"});return b2.set(e,a),a}function fq(){const[e,t]=x.useState({status:"loading"}),[a,o]=x.useState(0),i=x.useCallback(()=>{t({status:"loading"}),o(c=>c+1)},[]);return x.useEffect(()=>{let c=!1;return(async()=>{try{const h=await fetch("/api/health");if(!h.ok)throw new Error(`HTTP ${h.status}`)}catch(h){c||t({status:"error",reason:String(h)});return}const d=window.location.hash.replace(/^#/,""),f=new URLSearchParams(d),m=f.get("pair");if(m)try{const h=await dq(m);Ro(h.token);try{localStorage.setItem(Dn.token,h.token)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search),t({status:"ok"});return}catch{}const g=f.get("token");if(g){Ro(g);try{localStorage.setItem(Dn.token,g)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const h=localStorage.getItem(Dn.token);h&&Ro(h)}catch{}try{const h=await fetch("/api/admin/web-token");if(h.ok){const b=await h.json();if(b?.token){Ro(b.token);try{localStorage.setItem(Dn.token,b.token)}catch{}}}}catch{}if(!R_()){c||t({status:"unpaired"});return}try{await se.get("/api/projects"),c||t({status:"ok"})}catch(h){if(h instanceof lu&&(h.status===401||h.status===403)){Ro(null);try{localStorage.removeItem(Dn.token)}catch{}c||t({status:"unpaired"})}else c||t({status:"error",reason:String(h)})}})(),()=>{c=!0}},[a]),{...e,reload:i}}function pq(){const e=fq();return e.status==="loading"?n.jsx(_2,{text:u("daemon.connecting")}):e.status==="error"?n.jsx(_2,{mood:"sad",text:u("daemon.unreachable"),sub:`${u("daemon.unreachable_hint")}
822
-
823
- ${e.reason}`}):e.status==="unpaired"?n.jsx(XU,{onPaired:e.reload}):n.jsx(uL,{children:n.jsx(j6,{delay:0,children:n.jsx(mq,{})})})}function mq(){const e=Tn(),t=ns(),[a,o]=qo(),{theme:i,toggle:c}=Nb(),d=a.get("action")==="add-project",[f,m]=x.useState(!1),g=()=>{const b=new URLSearchParams(a);b.delete("action"),o(b,{replace:!0})},h=()=>{const b=new URLSearchParams(a);b.set("action","add-project"),o(b)};return n.jsx(bL,{children:n.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[n.jsx(kP,{onSelect:b=>e(b),onOpenRoby:()=>m(!0),onOpenAddProject:h}),n.jsxs("main",{className:"m-2 flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[n.jsx(gq,{onToggleTheme:c,isDark:i==="dark",pathname:t.pathname}),n.jsx("div",{className:"flex-1 overflow-y-auto",children:n.jsxs($2,{children:[n.jsx(zt,{path:"/",element:n.jsx(mL,{})}),n.jsx(zt,{path:"/m/inbox",element:n.jsx(xL,{})}),n.jsx(zt,{path:"/settings/*",element:n.jsx(B$,{})}),n.jsx(zt,{path:"/m/desktop/*",element:n.jsx(q$,{})}),n.jsx(zt,{path:"/m/code/*",element:n.jsx(YU,{})}),n.jsx(zt,{path:"/p/:pid/*",element:n.jsx(sB,{})}),n.jsx(zt,{path:"*",element:n.jsx(vq,{})})]})})]}),n.jsx(KU,{open:d,onClose:g}),n.jsx(cq,{open:f,onOpenChange:m})]})})}function gq({onToggleTheme:e,isDark:t,pathname:a}){const{projects:o}=cu(),i=yL(),c=a.split("/").filter(Boolean),d=c[0]==="p"?o.find(E=>String(E.id)===c[1]):void 0,f=c[0]==="settings"?bq(c[1]):c[0]==="p"?_q(c[2]):"",m=c[0]==="p"&&c[1]==="0",g=d?.name||d?.path?.split("/").pop()||u("nav.project"),h=a==="/"?u("topbar.breadcrumb_root"):c[0]==="settings"?[u("topbar.breadcrumb_root"),u("nav.settings"),f].filter(Boolean).join(" › "):c[0]==="m"?[u("topbar.breadcrumb_root"),xq(c[1]),i].filter(Boolean).join(" › "):c[0]==="p"?m?[u("topbar.breadcrumb_root"),u("topbar.breadcrumb_base"),f].filter(Boolean).join(" › "):[u("topbar.breadcrumb_root"),u("topbar.breadcrumb_projects"),g,f].filter(Boolean).join(" › "):u("topbar.breadcrumb_root"),b=a==="/"?"":c[0]==="settings"?u("settings.subtitle"):c[0]==="p"?m?u("base.subtitle"):d?`${bN(d.kind)} · ${d.path}`:"":"",_=_L(),j=kL();return n.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[_&&n.jsx(MD,{collapsed:_.collapsed,onToggle:_.toggle}),n.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[h,b&&n.jsxs("span",{className:"text-muted-fg/50",children:[" · ",b]})]}),j,n.jsx(hq,{}),n.jsx(Ue,{content:u(t?"topbar.light":"topbar.dark"),children:n.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?n.jsx(vM,{size:14}):n.jsx(iM,{size:14})})})]})}function hq(){const e=S_(),t=a=>{a!==e&&(aN(a),window.location.reload())};return n.jsxs(y_,{children:[n.jsxs(j_,{"data-testid":"lang-menu",title:u("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:[n.jsx(JA,{size:14}),n.jsx("span",{className:"text-[11px] font-medium uppercase",children:e})]}),n.jsx(k_,{align:"end",children:n.jsx(wD,{value:e,onValueChange:a=>t(a),children:rN.map(a=>n.jsx(SD,{value:a.value,children:a.label},a.value))})})]})}function xq(e){switch(e){case"desktop":return u("nav.modules.desktop");case"code":return u("nav.modules.code");default:return e||""}}function bq(e){switch(e){case"super-agent":return u("settings.tabs.super_agent");case"engines":return u("settings.tabs.engines");case"telegram":return u("settings.tabs.telegram");case"devices":return u("settings.tabs.devices");case"voice":return u("nav.modules.voice");case"deck":return u("nav.modules.deck");case"desktop":return u("nav.modules.desktop");case"appearance":return u("settings.appearance");case"config":case"advanced":return u("settings.tabs.advanced");case"identity":default:return e||""}}function _q(e){switch(e){case"chat":return u("project.nav.chat");case"telegram":return u("project.nav.telegram");case"agents":return u("project.nav.agents");case"routines":return u("project.nav.routines");case"tasks":return u("project.nav.tasks");case"mcps":return u("project.nav.mcps");case"artifacts":return u("project.nav.artifacts");case"config":return u("project.nav.config");case"workspaces":return u("base.workspaces_title");case"models":return u("settings.tabs.engines");case"agent-defaults":return u("base.defaults_title");case"sessions":return u("base.sessions_title");case"logs":return u("project.nav.logs");case"memories":return u("project.nav.memories");default:return""}}function _2({text:e,sub:t,mood:a="happy"}){return n.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:n.jsxs("div",{className:"flex flex-col items-center text-center",children:[n.jsx(qN,{mood:a,className:"mb-4 text-xs"}),n.jsx("div",{className:"text-foreground",children:e}),t&&n.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:t})]})})}function vq(){const e=Tn();return n.jsx(HN,{testId:"screen-not-found",mood:"confused",title:u("not_found.title"),titleClassName:"text-7xl",message:u("not_found.message"),action:n.jsx(or,{variant:"outline",onClick:()=>e("/"),children:u("not_found.home")})})}mI();P5.createRoot(document.getElementById("root")).render(n.jsx(Kc.StrictMode,{children:n.jsx(oA,{children:n.jsx(NM,{children:n.jsx(pq,{})})})}));
824
- //# sourceMappingURL=index-CBR_-QyA.js.map