@agentprojectcontext/apx 1.57.0 → 1.58.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 (47) hide show
  1. package/package.json +1 -1
  2. package/src/core/apc/paths.js +7 -0
  3. package/src/core/stores/organization.js +152 -0
  4. package/src/core/stores/project-files.js +199 -0
  5. package/src/core/stores/tasks.js +36 -3
  6. package/src/host/daemon/api/agents.js +22 -2
  7. package/src/host/daemon/api/files-project.js +99 -0
  8. package/src/host/daemon/api/organization.js +88 -0
  9. package/src/host/daemon/api/shared.js +7 -0
  10. package/src/host/daemon/api/tasks.js +14 -0
  11. package/src/host/daemon/api.js +4 -0
  12. package/src/interfaces/cli/commands/org.js +77 -0
  13. package/src/interfaces/cli/index.js +48 -0
  14. package/src/interfaces/web/dist/assets/index-Cl0WXtxF.css +1 -0
  15. package/src/interfaces/web/dist/assets/index-DPAuXATr.js +705 -0
  16. package/src/interfaces/web/dist/assets/index-DPAuXATr.js.map +1 -0
  17. package/src/interfaces/web/dist/index.html +2 -2
  18. package/src/interfaces/web/src/components/agents/AgentFormFields.tsx +123 -0
  19. package/src/interfaces/web/src/components/common/ConfirmDialog.tsx +51 -0
  20. package/src/interfaces/web/src/components/files/FileBrowser.tsx +138 -0
  21. package/src/interfaces/web/src/components/files/FileTree.tsx +133 -0
  22. package/src/interfaces/web/src/components/files/FileViewer.tsx +167 -0
  23. package/src/interfaces/web/src/components/files/MarkdownEditor.tsx +48 -0
  24. package/src/interfaces/web/src/components/files/MarkdownPreview.tsx +146 -0
  25. package/src/interfaces/web/src/components/files/NewFileDialog.tsx +66 -0
  26. package/src/interfaces/web/src/components/structure/StructureDialogs.tsx +172 -0
  27. package/src/interfaces/web/src/components/tasks/TaskDetailPanel.tsx +142 -0
  28. package/src/interfaces/web/src/components/tasks/taskStatus.tsx +57 -0
  29. package/src/interfaces/web/src/i18n/en.ts +104 -0
  30. package/src/interfaces/web/src/i18n/es.ts +104 -0
  31. package/src/interfaces/web/src/lib/api/organization.ts +18 -0
  32. package/src/interfaces/web/src/lib/api/projectFiles.ts +19 -0
  33. package/src/interfaces/web/src/lib/api/tasks.ts +16 -1
  34. package/src/interfaces/web/src/lib/api.ts +2 -0
  35. package/src/interfaces/web/src/lib/slug.ts +11 -0
  36. package/src/interfaces/web/src/screens/ProjectScreen.tsx +21 -2
  37. package/src/interfaces/web/src/screens/project/AgentDetailScreen.tsx +31 -11
  38. package/src/interfaces/web/src/screens/project/AgentsTab.tsx +24 -7
  39. package/src/interfaces/web/src/screens/project/DocsTab.tsx +13 -0
  40. package/src/interfaces/web/src/screens/project/FilesTab.tsx +12 -0
  41. package/src/interfaces/web/src/screens/project/Overview.tsx +122 -10
  42. package/src/interfaces/web/src/screens/project/StructureTab.tsx +147 -0
  43. package/src/interfaces/web/src/screens/project/TasksTab.tsx +101 -62
  44. package/src/interfaces/web/src/types/daemon.ts +63 -0
  45. package/src/interfaces/web/dist/assets/index-CEI8DfVg.css +0 -1
  46. package/src/interfaces/web/dist/assets/index-DJ-ocXOR.js +0 -651
  47. package/src/interfaces/web/dist/assets/index-DJ-ocXOR.js.map +0 -1
@@ -1,651 +0,0 @@
1
- function xT(e,t){for(var s=0;s<t.length;s++){const o=t[s];if(typeof o!="string"&&!Array.isArray(o)){for(const l in o)if(l!=="default"&&!(l in e)){const c=Object.getOwnPropertyDescriptor(o,l);c&&Object.defineProperty(e,l,c.get?c:{enumerable:!0,get:()=>o[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))o(l);new MutationObserver(l=>{for(const c of l)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&o(u)}).observe(document,{childList:!0,subtree:!0});function s(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();function Dx(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ch={exports:{}},Ki={};/**
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 y1;function bT(){if(y1)return Ki;y1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function s(o,l,c){var u=null;if(c!==void 0&&(u=""+c),l.key!==void 0&&(u=""+l.key),"key"in l){c={};for(var p in l)p!=="key"&&(c[p]=l[p])}else c=l;return l=c.ref,{$$typeof:e,type:o,key:u,ref:l!==void 0?l:null,props:c}}return Ki.Fragment=t,Ki.jsx=s,Ki.jsxs=s,Ki}var j1;function _T(){return j1||(j1=1,Ch.exports=bT()),Ch.exports}var r=_T(),Nh={exports:{}},ct={};/**
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 w1;function vT(){if(w1)return ct;w1=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function k(I){return I===null||typeof I!="object"?null:(I=v&&I[v]||I["@@iterator"],typeof I=="function"?I:null)}var E={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,j={};function C(I,G,Z){this.props=I,this.context=G,this.refs=j,this.updater=Z||E}C.prototype.isReactComponent={},C.prototype.setState=function(I,G){if(typeof I!="object"&&typeof I!="function"&&I!=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,I,G,"setState")},C.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function S(){}S.prototype=C.prototype;function N(I,G,Z){this.props=I,this.context=G,this.refs=j,this.updater=Z||E}var R=N.prototype=new S;R.constructor=N,y(R,C.prototype),R.isPureReactComponent=!0;var M=Array.isArray;function T(){}var z={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function U(I,G,Z){var te=Z.ref;return{$$typeof:e,type:I,key:G,ref:te!==void 0?te:null,props:Z}}function L(I,G){return U(I.type,G,I.props)}function H(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function O(I){var G={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(Z){return G[Z]})}var P=/\/+/g;function B(I,G){return typeof I=="object"&&I!==null&&I.key!=null?O(""+I.key):G.toString(36)}function $(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(T,T):(I.status="pending",I.then(function(G){I.status==="pending"&&(I.status="fulfilled",I.value=G)},function(G){I.status==="pending"&&(I.status="rejected",I.reason=G)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function q(I,G,Z,te,de){var ee=typeof I;(ee==="undefined"||ee==="boolean")&&(I=null);var ne=!1;if(I===null)ne=!0;else switch(ee){case"bigint":case"string":case"number":ne=!0;break;case"object":switch(I.$$typeof){case e:case t:ne=!0;break;case g:return ne=I._init,q(ne(I._payload),G,Z,te,de)}}if(ne)return de=de(I),ne=te===""?"."+B(I,0):te,M(de)?(Z="",ne!=null&&(Z=ne.replace(P,"$&/")+"/"),q(de,G,Z,"",function(Me){return Me})):de!=null&&(H(de)&&(de=L(de,Z+(de.key==null||I&&I.key===de.key?"":(""+de.key).replace(P,"$&/")+"/")+ne)),G.push(de)),1;ne=0;var ae=te===""?".":te+":";if(M(I))for(var pe=0;pe<I.length;pe++)te=I[pe],ee=ae+B(te,pe),ne+=q(te,G,Z,ee,de);else if(pe=k(I),typeof pe=="function")for(I=pe.call(I),pe=0;!(te=I.next()).done;)te=te.value,ee=ae+B(te,pe++),ne+=q(te,G,Z,ee,de);else if(ee==="object"){if(typeof I.then=="function")return q($(I),G,Z,te,de);throw G=String(I),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return ne}function X(I,G,Z){if(I==null)return I;var te=[],de=0;return q(I,te,"","",function(ee){return G.call(Z,ee,de++)}),te}function Y(I){if(I._status===-1){var G=I._result;G=G(),G.then(function(Z){(I._status===0||I._status===-1)&&(I._status=1,I._result=Z)},function(Z){(I._status===0||I._status===-1)&&(I._status=2,I._result=Z)}),I._status===-1&&(I._status=0,I._result=G)}if(I._status===1)return I._result.default;throw I._result}var F=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},K={map:X,forEach:function(I,G,Z){X(I,function(){G.apply(this,arguments)},Z)},count:function(I){var G=0;return X(I,function(){G++}),G},toArray:function(I){return X(I,function(G){return G})||[]},only:function(I){if(!H(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return ct.Activity=b,ct.Children=K,ct.Component=C,ct.Fragment=s,ct.Profiler=l,ct.PureComponent=N,ct.StrictMode=o,ct.Suspense=m,ct.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=z,ct.__COMPILER_RUNTIME={__proto__:null,c:function(I){return z.H.useMemoCache(I)}},ct.cache=function(I){return function(){return I.apply(null,arguments)}},ct.cacheSignal=function(){return null},ct.cloneElement=function(I,G,Z){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var te=y({},I.props),de=I.key;if(G!=null)for(ee in G.key!==void 0&&(de=""+G.key),G)!D.call(G,ee)||ee==="key"||ee==="__self"||ee==="__source"||ee==="ref"&&G.ref===void 0||(te[ee]=G[ee]);var ee=arguments.length-2;if(ee===1)te.children=Z;else if(1<ee){for(var ne=Array(ee),ae=0;ae<ee;ae++)ne[ae]=arguments[ae+2];te.children=ne}return U(I.type,de,te)},ct.createContext=function(I){return I={$$typeof:u,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:c,_context:I},I},ct.createElement=function(I,G,Z){var te,de={},ee=null;if(G!=null)for(te in G.key!==void 0&&(ee=""+G.key),G)D.call(G,te)&&te!=="key"&&te!=="__self"&&te!=="__source"&&(de[te]=G[te]);var ne=arguments.length-2;if(ne===1)de.children=Z;else if(1<ne){for(var ae=Array(ne),pe=0;pe<ne;pe++)ae[pe]=arguments[pe+2];de.children=ae}if(I&&I.defaultProps)for(te in ne=I.defaultProps,ne)de[te]===void 0&&(de[te]=ne[te]);return U(I,ee,de)},ct.createRef=function(){return{current:null}},ct.forwardRef=function(I){return{$$typeof:p,render:I}},ct.isValidElement=H,ct.lazy=function(I){return{$$typeof:g,_payload:{_status:-1,_result:I},_init:Y}},ct.memo=function(I,G){return{$$typeof:h,type:I,compare:G===void 0?null:G}},ct.startTransition=function(I){var G=z.T,Z={};z.T=Z;try{var te=I(),de=z.S;de!==null&&de(Z,te),typeof te=="object"&&te!==null&&typeof te.then=="function"&&te.then(T,F)}catch(ee){F(ee)}finally{G!==null&&Z.types!==null&&(G.types=Z.types),z.T=G}},ct.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},ct.use=function(I){return z.H.use(I)},ct.useActionState=function(I,G,Z){return z.H.useActionState(I,G,Z)},ct.useCallback=function(I,G){return z.H.useCallback(I,G)},ct.useContext=function(I){return z.H.useContext(I)},ct.useDebugValue=function(){},ct.useDeferredValue=function(I,G){return z.H.useDeferredValue(I,G)},ct.useEffect=function(I,G){return z.H.useEffect(I,G)},ct.useEffectEvent=function(I){return z.H.useEffectEvent(I)},ct.useId=function(){return z.H.useId()},ct.useImperativeHandle=function(I,G,Z){return z.H.useImperativeHandle(I,G,Z)},ct.useInsertionEffect=function(I,G){return z.H.useInsertionEffect(I,G)},ct.useLayoutEffect=function(I,G){return z.H.useLayoutEffect(I,G)},ct.useMemo=function(I,G){return z.H.useMemo(I,G)},ct.useOptimistic=function(I,G){return z.H.useOptimistic(I,G)},ct.useReducer=function(I,G,Z){return z.H.useReducer(I,G,Z)},ct.useRef=function(I){return z.H.useRef(I)},ct.useState=function(I){return z.H.useState(I)},ct.useSyncExternalStore=function(I,G,Z){return z.H.useSyncExternalStore(I,G,Z)},ct.useTransition=function(){return z.H.useTransition()},ct.version="19.2.7",ct}var k1;function Uc(){return k1||(k1=1,Nh.exports=vT()),Nh.exports}var x=Uc();const Hc=Dx(x),yT=xT({__proto__:null,default:Hc},[x]);var Eh={exports:{}},Xi={},Rh={exports:{}},Th={};/**
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 S1;function jT(){return S1||(S1=1,(function(e){function t(q,X){var Y=q.length;q.push(X);e:for(;0<Y;){var F=Y-1>>>1,K=q[F];if(0<l(K,X))q[F]=X,q[Y]=K,Y=F;else break e}}function s(q){return q.length===0?null:q[0]}function o(q){if(q.length===0)return null;var X=q[0],Y=q.pop();if(Y!==X){q[0]=Y;e:for(var F=0,K=q.length,I=K>>>1;F<I;){var G=2*(F+1)-1,Z=q[G],te=G+1,de=q[te];if(0>l(Z,Y))te<K&&0>l(de,Z)?(q[F]=de,q[te]=Y,F=te):(q[F]=Z,q[G]=Y,F=G);else if(te<K&&0>l(de,Y))q[F]=de,q[te]=Y,F=te;else break e}}return X}function l(q,X){var Y=q.sortIndex-X.sortIndex;return Y!==0?Y:q.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var u=Date,p=u.now();e.unstable_now=function(){return u.now()-p}}var m=[],h=[],g=1,b=null,v=3,k=!1,E=!1,y=!1,j=!1,C=typeof setTimeout=="function"?setTimeout:null,S=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function R(q){for(var X=s(h);X!==null;){if(X.callback===null)o(h);else if(X.startTime<=q)o(h),X.sortIndex=X.expirationTime,t(m,X);else break;X=s(h)}}function M(q){if(y=!1,R(q),!E)if(s(m)!==null)E=!0,T||(T=!0,O());else{var X=s(h);X!==null&&$(M,X.startTime-q)}}var T=!1,z=-1,D=5,U=-1;function L(){return j?!0:!(e.unstable_now()-U<D)}function H(){if(j=!1,T){var q=e.unstable_now();U=q;var X=!0;try{e:{E=!1,y&&(y=!1,S(z),z=-1),k=!0;var Y=v;try{t:{for(R(q),b=s(m);b!==null&&!(b.expirationTime>q&&L());){var F=b.callback;if(typeof F=="function"){b.callback=null,v=b.priorityLevel;var K=F(b.expirationTime<=q);if(q=e.unstable_now(),typeof K=="function"){b.callback=K,R(q),X=!0;break t}b===s(m)&&o(m),R(q)}else o(m);b=s(m)}if(b!==null)X=!0;else{var I=s(h);I!==null&&$(M,I.startTime-q),X=!1}}break e}finally{b=null,v=Y,k=!1}X=void 0}}finally{X?O():T=!1}}}var O;if(typeof N=="function")O=function(){N(H)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,B=P.port2;P.port1.onmessage=H,O=function(){B.postMessage(null)}}else O=function(){C(H,0)};function $(q,X){z=C(function(){q(e.unstable_now())},X)}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(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(q){switch(v){case 1:case 2:case 3:var X=3;break;default:X=v}var Y=v;v=X;try{return q()}finally{v=Y}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(q,X){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var Y=v;v=q;try{return X()}finally{v=Y}},e.unstable_scheduleCallback=function(q,X,Y){var F=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?F+Y:F):Y=F,q){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=Y+K,q={id:g++,callback:X,priorityLevel:q,startTime:Y,expirationTime:K,sortIndex:-1},Y>F?(q.sortIndex=Y,t(h,q),s(m)===null&&q===s(h)&&(y?(S(z),z=-1):y=!0,$(M,Y-F))):(q.sortIndex=K,t(m,q),E||k||(E=!0,T||(T=!0,O()))),q},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(q){var X=v;return function(){var Y=v;v=X;try{return q.apply(this,arguments)}finally{v=Y}}}})(Th)),Th}var C1;function wT(){return C1||(C1=1,Rh.exports=jT()),Rh.exports}var Ah={exports:{}},Vn={};/**
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 N1;function kT(){if(N1)return Vn;N1=1;var e=Uc();function t(m){var h="https://react.dev/errors/"+m;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+m+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(t(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(m,h,g){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:b==null?null:""+b,children:m,containerInfo:h,implementation:g}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(m,h){if(m==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Vn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Vn.createPortal=function(m,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(t(299));return c(m,h,null,g)},Vn.flushSync=function(m){var h=u.T,g=o.p;try{if(u.T=null,o.p=2,m)return m()}finally{u.T=h,o.p=g,o.d.f()}},Vn.preconnect=function(m,h){typeof m=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,o.d.C(m,h))},Vn.prefetchDNS=function(m){typeof m=="string"&&o.d.D(m)},Vn.preinit=function(m,h){if(typeof m=="string"&&h&&typeof h.as=="string"){var g=h.as,b=p(g,h.crossOrigin),v=typeof h.integrity=="string"?h.integrity:void 0,k=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?o.d.S(m,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:k}):g==="script"&&o.d.X(m,{crossOrigin:b,integrity:v,fetchPriority:k,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Vn.preinitModule=function(m,h){if(typeof m=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=p(h.as,h.crossOrigin);o.d.M(m,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&o.d.M(m)},Vn.preload=function(m,h){if(typeof m=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,b=p(g,h.crossOrigin);o.d.L(m,g,{crossOrigin:b,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Vn.preloadModule=function(m,h){if(typeof m=="string")if(h){var g=p(h.as,h.crossOrigin);o.d.m(m,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else o.d.m(m)},Vn.requestFormReset=function(m){o.d.r(m)},Vn.unstable_batchedUpdates=function(m,h){return m(h)},Vn.useFormState=function(m,h,g){return u.H.useFormState(m,h,g)},Vn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Vn.version="19.2.7",Vn}var E1;function vk(){if(E1)return Ah.exports;E1=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(),Ah.exports=kT(),Ah.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 R1;function ST(){if(R1)return Xi;R1=1;var e=wT(),t=Uc(),s=vk();function o(n){var a="https://react.dev/errors/"+n;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function c(n){var a=n,i=n;if(n.alternate)for(;a.return;)a=a.return;else{n=a;do a=n,(a.flags&4098)!==0&&(i=a.return),n=a.return;while(n)}return a.tag===3?i:null}function u(n){if(n.tag===13){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function p(n){if(n.tag===31){var a=n.memoizedState;if(a===null&&(n=n.alternate,n!==null&&(a=n.memoizedState)),a!==null)return a.dehydrated}return null}function m(n){if(c(n)!==n)throw Error(o(188))}function h(n){var a=n.alternate;if(!a){if(a=c(n),a===null)throw Error(o(188));return a!==n?null:n}for(var i=n,d=a;;){var _=i.return;if(_===null)break;var w=_.alternate;if(w===null){if(d=_.return,d!==null){i=d;continue}break}if(_.child===w.child){for(w=_.child;w;){if(w===i)return m(_),n;if(w===d)return m(_),a;w=w.sibling}throw Error(o(188))}if(i.return!==d.return)i=_,d=w;else{for(var A=!1,V=_.child;V;){if(V===i){A=!0,i=_,d=w;break}if(V===d){A=!0,d=_,i=w;break}V=V.sibling}if(!A){for(V=w.child;V;){if(V===i){A=!0,i=w,d=_;break}if(V===d){A=!0,d=w,i=_;break}V=V.sibling}if(!A)throw Error(o(189))}}if(i.alternate!==d)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?n:a}function g(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n;for(n=n.child;n!==null;){if(a=g(n),a!==null)return a;n=n.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),E=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),N=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),H=Symbol.iterator;function O(n){return n===null||typeof n!="object"?null:(n=H&&n[H]||n["@@iterator"],typeof n=="function"?n:null)}var P=Symbol.for("react.client.reference");function B(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===P?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case y:return"Fragment";case C:return"Profiler";case j:return"StrictMode";case M:return"Suspense";case T:return"SuspenseList";case U:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case E:return"Portal";case N:return n.displayName||"Context";case S:return(n._context.displayName||"Context")+".Consumer";case R:var a=n.render;return n=n.displayName,n||(n=a.displayName||a.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case z:return a=n.displayName||null,a!==null?a:B(n.type)||"Memo";case D:a=n._payload,n=n._init;try{return B(n(a))}catch{}}return null}var $=Array.isArray,q=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},F=[],K=-1;function I(n){return{current:n}}function G(n){0>K||(n.current=F[K],F[K]=null,K--)}function Z(n,a){K++,F[K]=n.current,n.current=a}var te=I(null),de=I(null),ee=I(null),ne=I(null);function ae(n,a){switch(Z(ee,a),Z(de,n),Z(te,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?$0(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=$0(a),n=F0(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}G(te),Z(te,n)}function pe(){G(te),G(de),G(ee)}function Me(n){n.memoizedState!==null&&Z(ne,n);var a=te.current,i=F0(a,n.type);a!==i&&(Z(de,n),Z(te,i))}function ue(n){de.current===n&&(G(te),G(de)),ne.current===n&&(G(ne),$i._currentValue=Y)}var me,ke;function je(n){if(me===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);me=a&&a[1]||"",ke=-1<i.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+me+n+ke}var Be=!1;function He(n,a){if(!n||Be)return"";Be=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(a){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(fe){var oe=fe}Reflect.construct(n,[],ye)}else{try{ye.call()}catch(fe){oe=fe}n.call(ye.prototype)}}else{try{throw Error()}catch(fe){oe=fe}(ye=n())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(fe){if(fe&&oe&&typeof fe.stack=="string")return[fe.stack,oe.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var _=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");_&&_.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var w=d.DetermineComponentFrameRoot(),A=w[0],V=w[1];if(A&&V){var Q=A.split(`
44
- `),re=V.split(`
45
- `);for(_=d=0;d<Q.length&&!Q[d].includes("DetermineComponentFrameRoot");)d++;for(;_<re.length&&!re[_].includes("DetermineComponentFrameRoot");)_++;if(d===Q.length||_===re.length)for(d=Q.length-1,_=re.length-1;1<=d&&0<=_&&Q[d]!==re[_];)_--;for(;1<=d&&0<=_;d--,_--)if(Q[d]!==re[_]){if(d!==1||_!==1)do if(d--,_--,0>_||Q[d]!==re[_]){var ge=`
46
- `+Q[d].replace(" at new "," at ");return n.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",n.displayName)),ge}while(1<=d&&0<=_);break}}}finally{Be=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?je(i):""}function we(n,a){switch(n.tag){case 26:case 27:case 5:return je(n.type);case 16:return je("Lazy");case 13:return n.child!==a&&a!==null?je("Suspense Fallback"):je("Suspense");case 19:return je("SuspenseList");case 0:case 15:return He(n.type,!1);case 11:return He(n.type.render,!1);case 1:return He(n.type,!0);case 31:return je("Activity");default:return""}}function Re(n){try{var a="",i=null;do a+=we(n,i),i=n,n=n.return;while(n);return a}catch(d){return`
47
- Error generating stack: `+d.message+`
48
- `+d.stack}}var ve=Object.prototype.hasOwnProperty,Ce=e.unstable_scheduleCallback,De=e.unstable_cancelCallback,Pe=e.unstable_shouldYield,Ie=e.unstable_requestPaint,le=e.unstable_now,_e=e.unstable_getCurrentPriorityLevel,qe=e.unstable_ImmediatePriority,Ne=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,et=e.unstable_LowPriority,at=e.unstable_IdlePriority,vt=e.log,Mt=e.unstable_setDisableYieldValue,lt=null,Rt=null;function xe(n){if(typeof vt=="function"&&Mt(n),Rt&&typeof Rt.setStrictMode=="function")try{Rt.setStrictMode(lt,n)}catch{}}var Le=Math.clz32?Math.clz32:Xe,Ke=Math.log,it=Math.LN2;function Xe(n){return n>>>=0,n===0?32:31-(Ke(n)/it|0)|0}var ft=256,Ot=262144,Wt=4194304;function Yt(n){var a=n&42;if(a!==0)return a;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Zt(n,a,i){var d=n.pendingLanes;if(d===0)return 0;var _=0,w=n.suspendedLanes,A=n.pingedLanes;n=n.warmLanes;var V=d&134217727;return V!==0?(d=V&~w,d!==0?_=Yt(d):(A&=V,A!==0?_=Yt(A):i||(i=V&~n,i!==0&&(_=Yt(i))))):(V=d&~w,V!==0?_=Yt(V):A!==0?_=Yt(A):i||(i=d&~n,i!==0&&(_=Yt(i)))),_===0?0:a!==0&&a!==_&&(a&w)===0&&(w=_&-_,i=a&-a,w>=i||w===32&&(i&4194048)!==0)?a:_}function fn(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function es(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function fs(){var n=Wt;return Wt<<=1,(Wt&62914560)===0&&(Wt=4194304),n}function js(n){for(var a=[],i=0;31>i;i++)a.push(n);return a}function pn(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function ws(n,a,i,d,_,w){var A=n.pendingLanes;n.pendingLanes=i,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=i,n.entangledLanes&=i,n.errorRecoveryDisabledLanes&=i,n.shellSuspendCounter=0;var V=n.entanglements,Q=n.expirationTimes,re=n.hiddenUpdates;for(i=A&~i;0<i;){var ge=31-Le(i),ye=1<<ge;V[ge]=0,Q[ge]=-1;var oe=re[ge];if(oe!==null)for(re[ge]=null,ge=0;ge<oe.length;ge++){var fe=oe[ge];fe!==null&&(fe.lane&=-536870913)}i&=~ye}d!==0&&xa(n,d,0),w!==0&&_===0&&n.tag!==0&&(n.suspendedLanes|=w&~(A&~a))}function xa(n,a,i){n.pendingLanes|=a,n.suspendedLanes&=~a;var d=31-Le(a);n.entangledLanes|=a,n.entanglements[d]=n.entanglements[d]|1073741824|i&261930}function Is(n,a){var i=n.entangledLanes|=a;for(n=n.entanglements;i;){var d=31-Le(i),_=1<<d;_&a|n[d]&a&&(n[d]|=a),i&=~_}}function ba(n,a){var i=a&-a;return i=(i&42)!==0?1:ut(i),(i&(n.suspendedLanes|a))!==0?0:i}function ut(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Pt(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function mn(){var n=X.p;return n!==0?n:(n=window.event,n===void 0?32:m1(n.type))}function Cn(n,a){var i=X.p;try{return X.p=n,a()}finally{X.p=i}}var yn=Math.random().toString(36).slice(2),$t="__reactFiber$"+yn,zn="__reactProps$"+yn,Xs="__reactContainer$"+yn,ai="__reactEvents$"+yn,eu="__reactListeners$"+yn,lE="__reactHandles$"+yn,A_="__reactResources$"+yn,ri="__reactMarker$"+yn;function bp(n){delete n[$t],delete n[zn],delete n[ai],delete n[eu],delete n[lE]}function Po(n){var a=n[$t];if(a)return a;for(var i=n.parentNode;i;){if(a=i[Xs]||i[$t]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(n=Z0(n);n!==null;){if(i=n[$t])return i;n=Z0(n)}return a}n=i,i=n.parentNode}return null}function Io(n){if(n=n[$t]||n[Xs]){var a=n.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return n}return null}function oi(n){var a=n.tag;if(a===5||a===26||a===27||a===6)return n.stateNode;throw Error(o(33))}function Bo(n){var a=n[A_];return a||(a=n[A_]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Nn(n){n[ri]=!0}var M_=new Set,O_={};function $r(n,a){Uo(n,a),Uo(n+"Capture",a)}function Uo(n,a){for(O_[n]=a,n=0;n<a.length;n++)M_.add(a[n])}var iE=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]*$"),z_={},D_={};function cE(n){return ve.call(D_,n)?!0:ve.call(z_,n)?!1:iE.test(n)?D_[n]=!0:(z_[n]=!0,!1)}function tu(n,a,i){if(cE(a))if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(a);return;case"boolean":var d=a.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){n.removeAttribute(a);return}}n.setAttribute(a,""+i)}}function nu(n,a,i){if(i===null)n.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(a);return}n.setAttribute(a,""+i)}}function _a(n,a,i,d){if(d===null)n.removeAttribute(i);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(a,i,""+d)}}function ks(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function L_(n){var a=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function uE(n,a,i){var d=Object.getOwnPropertyDescriptor(n.constructor.prototype,a);if(!n.hasOwnProperty(a)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var _=d.get,w=d.set;return Object.defineProperty(n,a,{configurable:!0,get:function(){return _.call(this)},set:function(A){i=""+A,w.call(this,A)}}),Object.defineProperty(n,a,{enumerable:d.enumerable}),{getValue:function(){return i},setValue:function(A){i=""+A},stopTracking:function(){n._valueTracker=null,delete n[a]}}}}function _p(n){if(!n._valueTracker){var a=L_(n)?"checked":"value";n._valueTracker=uE(n,a,""+n[a])}}function P_(n){if(!n)return!1;var a=n._valueTracker;if(!a)return!0;var i=a.getValue(),d="";return n&&(d=L_(n)?n.checked?"true":"false":n.value),n=d,n!==i?(a.setValue(n),!0):!1}function su(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var dE=/[\n"\\]/g;function Ss(n){return n.replace(dE,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function vp(n,a,i,d,_,w,A,V){n.name="",A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"?n.type=A:n.removeAttribute("type"),a!=null?A==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+ks(a)):n.value!==""+ks(a)&&(n.value=""+ks(a)):A!=="submit"&&A!=="reset"||n.removeAttribute("value"),a!=null?yp(n,A,ks(a)):i!=null?yp(n,A,ks(i)):d!=null&&n.removeAttribute("value"),_==null&&w!=null&&(n.defaultChecked=!!w),_!=null&&(n.checked=_&&typeof _!="function"&&typeof _!="symbol"),V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?n.name=""+ks(V):n.removeAttribute("name")}function I_(n,a,i,d,_,w,A,V){if(w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"&&(n.type=w),a!=null||i!=null){if(!(w!=="submit"&&w!=="reset"||a!=null)){_p(n);return}i=i!=null?""+ks(i):"",a=a!=null?""+ks(a):i,V||a===n.value||(n.value=a),n.defaultValue=a}d=d??_,d=typeof d!="function"&&typeof d!="symbol"&&!!d,n.checked=V?n.checked:!!d,n.defaultChecked=!!d,A!=null&&typeof A!="function"&&typeof A!="symbol"&&typeof A!="boolean"&&(n.name=A),_p(n)}function yp(n,a,i){a==="number"&&su(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function Ho(n,a,i,d){if(n=n.options,a){a={};for(var _=0;_<i.length;_++)a["$"+i[_]]=!0;for(i=0;i<n.length;i++)_=a.hasOwnProperty("$"+n[i].value),n[i].selected!==_&&(n[i].selected=_),_&&d&&(n[i].defaultSelected=!0)}else{for(i=""+ks(i),a=null,_=0;_<n.length;_++){if(n[_].value===i){n[_].selected=!0,d&&(n[_].defaultSelected=!0);return}a!==null||n[_].disabled||(a=n[_])}a!==null&&(a.selected=!0)}}function B_(n,a,i){if(a!=null&&(a=""+ks(a),a!==n.value&&(n.value=a),i==null)){n.defaultValue!==a&&(n.defaultValue=a);return}n.defaultValue=i!=null?""+ks(i):""}function U_(n,a,i,d){if(a==null){if(d!=null){if(i!=null)throw Error(o(92));if($(d)){if(1<d.length)throw Error(o(93));d=d[0]}i=d}i==null&&(i=""),a=i}i=ks(a),n.defaultValue=i,d=n.textContent,d===i&&d!==""&&d!==null&&(n.value=d),_p(n)}function Vo(n,a){if(a){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=a;return}}n.textContent=a}var fE=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 H_(n,a,i){var d=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?d?n.setProperty(a,""):a==="float"?n.cssFloat="":n[a]="":d?n.setProperty(a,i):typeof i!="number"||i===0||fE.has(a)?a==="float"?n.cssFloat=i:n[a]=(""+i).trim():n[a]=i+"px"}function V_(n,a,i){if(a!=null&&typeof a!="object")throw Error(o(62));if(n=n.style,i!=null){for(var d in i)!i.hasOwnProperty(d)||a!=null&&a.hasOwnProperty(d)||(d.indexOf("--")===0?n.setProperty(d,""):d==="float"?n.cssFloat="":n[d]="");for(var _ in a)d=a[_],a.hasOwnProperty(_)&&i[_]!==d&&H_(n,_,d)}else for(var w in a)a.hasOwnProperty(w)&&H_(n,w,a[w])}function jp(n){if(n.indexOf("-")===-1)return!1;switch(n){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pE=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"]]),mE=/^[\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 au(n){return mE.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function va(){}var wp=null;function kp(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var qo=null,$o=null;function q_(n){var a=Io(n);if(a&&(n=a.stateNode)){var i=n[zn]||null;e:switch(n=a.stateNode,a.type){case"input":if(vp(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Ss(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var d=i[a];if(d!==n&&d.form===n.form){var _=d[zn]||null;if(!_)throw Error(o(90));vp(d,_.value,_.defaultValue,_.defaultValue,_.checked,_.defaultChecked,_.type,_.name)}}for(a=0;a<i.length;a++)d=i[a],d.form===n.form&&P_(d)}break e;case"textarea":B_(n,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&Ho(n,!!i.multiple,a,!1)}}}var Sp=!1;function $_(n,a,i){if(Sp)return n(a,i);Sp=!0;try{var d=n(a);return d}finally{if(Sp=!1,(qo!==null||$o!==null)&&(Fu(),qo&&(a=qo,n=$o,$o=qo=null,q_(a),n)))for(a=0;a<n.length;a++)q_(n[a])}}function li(n,a){var i=n.stateNode;if(i===null)return null;var d=i[zn]||null;if(d===null)return null;i=d[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(n=n.type,d=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!d;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(o(231,a,typeof i));return i}var ya=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cp=!1;if(ya)try{var ii={};Object.defineProperty(ii,"passive",{get:function(){Cp=!0}}),window.addEventListener("test",ii,ii),window.removeEventListener("test",ii,ii)}catch{Cp=!1}var er=null,Np=null,ru=null;function F_(){if(ru)return ru;var n,a=Np,i=a.length,d,_="value"in er?er.value:er.textContent,w=_.length;for(n=0;n<i&&a[n]===_[n];n++);var A=i-n;for(d=1;d<=A&&a[i-d]===_[w-d];d++);return ru=_.slice(n,1<d?1-d:void 0)}function ou(n){var a=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&a===13&&(n=13)):n=a,n===10&&(n=13),32<=n||n===13?n:0}function lu(){return!0}function G_(){return!1}function ts(n){function a(i,d,_,w,A){this._reactName=i,this._targetInst=_,this.type=d,this.nativeEvent=w,this.target=A,this.currentTarget=null;for(var V in n)n.hasOwnProperty(V)&&(i=n[V],this[V]=i?i(w):w[V]);return this.isDefaultPrevented=(w.defaultPrevented!=null?w.defaultPrevented:w.returnValue===!1)?lu:G_,this.isPropagationStopped=G_,this}return b(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=lu)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=lu)},persist:function(){},isPersistent:lu}),a}var Fr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},iu=ts(Fr),ci=b({},Fr,{view:0,detail:0}),hE=ts(ci),Ep,Rp,ui,cu=b({},ci,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ap,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==ui&&(ui&&n.type==="mousemove"?(Ep=n.screenX-ui.screenX,Rp=n.screenY-ui.screenY):Rp=Ep=0,ui=n),Ep)},movementY:function(n){return"movementY"in n?n.movementY:Rp}}),Y_=ts(cu),gE=b({},cu,{dataTransfer:0}),xE=ts(gE),bE=b({},ci,{relatedTarget:0}),Tp=ts(bE),_E=b({},Fr,{animationName:0,elapsedTime:0,pseudoElement:0}),vE=ts(_E),yE=b({},Fr,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),jE=ts(yE),wE=b({},Fr,{data:0}),K_=ts(wE),kE={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},SE={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"},CE={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function NE(n){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(n):(n=CE[n])?!!a[n]:!1}function Ap(){return NE}var EE=b({},ci,{key:function(n){if(n.key){var a=kE[n.key]||n.key;if(a!=="Unidentified")return a}return n.type==="keypress"?(n=ou(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?SE[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ap,charCode:function(n){return n.type==="keypress"?ou(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?ou(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),RE=ts(EE),TE=b({},cu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),X_=ts(TE),AE=b({},ci,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ap}),ME=ts(AE),OE=b({},Fr,{propertyName:0,elapsedTime:0,pseudoElement:0}),zE=ts(OE),DE=b({},cu,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),LE=ts(DE),PE=b({},Fr,{newState:0,oldState:0}),IE=ts(PE),BE=[9,13,27,32],Mp=ya&&"CompositionEvent"in window,di=null;ya&&"documentMode"in document&&(di=document.documentMode);var UE=ya&&"TextEvent"in window&&!di,Q_=ya&&(!Mp||di&&8<di&&11>=di),W_=" ",Z_=!1;function J_(n,a){switch(n){case"keyup":return BE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ev(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Fo=!1;function HE(n,a){switch(n){case"compositionend":return ev(a);case"keypress":return a.which!==32?null:(Z_=!0,W_);case"textInput":return n=a.data,n===W_&&Z_?null:n;default:return null}}function VE(n,a){if(Fo)return n==="compositionend"||!Mp&&J_(n,a)?(n=F_(),ru=Np=er=null,Fo=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return Q_&&a.locale!=="ko"?null:a.data;default:return null}}var qE={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 tv(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a==="input"?!!qE[n.type]:a==="textarea"}function nv(n,a,i,d){qo?$o?$o.push(d):$o=[d]:qo=d,a=Zu(a,"onChange"),0<a.length&&(i=new iu("onChange","change",null,i,d),n.push({event:i,listeners:a}))}var fi=null,pi=null;function $E(n){I0(n,0)}function uu(n){var a=oi(n);if(P_(a))return n}function sv(n,a){if(n==="change")return a}var av=!1;if(ya){var Op;if(ya){var zp="oninput"in document;if(!zp){var rv=document.createElement("div");rv.setAttribute("oninput","return;"),zp=typeof rv.oninput=="function"}Op=zp}else Op=!1;av=Op&&(!document.documentMode||9<document.documentMode)}function ov(){fi&&(fi.detachEvent("onpropertychange",lv),pi=fi=null)}function lv(n){if(n.propertyName==="value"&&uu(pi)){var a=[];nv(a,pi,n,kp(n)),$_($E,a)}}function FE(n,a,i){n==="focusin"?(ov(),fi=a,pi=i,fi.attachEvent("onpropertychange",lv)):n==="focusout"&&ov()}function GE(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return uu(pi)}function YE(n,a){if(n==="click")return uu(a)}function KE(n,a){if(n==="input"||n==="change")return uu(a)}function XE(n,a){return n===a&&(n!==0||1/n===1/a)||n!==n&&a!==a}var ps=typeof Object.is=="function"?Object.is:XE;function mi(n,a){if(ps(n,a))return!0;if(typeof n!="object"||n===null||typeof a!="object"||a===null)return!1;var i=Object.keys(n),d=Object.keys(a);if(i.length!==d.length)return!1;for(d=0;d<i.length;d++){var _=i[d];if(!ve.call(a,_)||!ps(n[_],a[_]))return!1}return!0}function iv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function cv(n,a){var i=iv(n);n=0;for(var d;i;){if(i.nodeType===3){if(d=n+i.textContent.length,n<=a&&d>=a)return{node:i,offset:a-n};n=d}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=iv(i)}}function uv(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?uv(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function dv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=su(n.document);a instanceof n.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)n=a.contentWindow;else break;a=su(n.document)}return a}function Dp(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var QE=ya&&"documentMode"in document&&11>=document.documentMode,Go=null,Lp=null,hi=null,Pp=!1;function fv(n,a,i){var d=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Pp||Go==null||Go!==su(d)||(d=Go,"selectionStart"in d&&Dp(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),hi&&mi(hi,d)||(hi=d,d=Zu(Lp,"onSelect"),0<d.length&&(a=new iu("onSelect","select",null,a,i),n.push({event:a,listeners:d}),a.target=Go)))}function Gr(n,a){var i={};return i[n.toLowerCase()]=a.toLowerCase(),i["Webkit"+n]="webkit"+a,i["Moz"+n]="moz"+a,i}var Yo={animationend:Gr("Animation","AnimationEnd"),animationiteration:Gr("Animation","AnimationIteration"),animationstart:Gr("Animation","AnimationStart"),transitionrun:Gr("Transition","TransitionRun"),transitionstart:Gr("Transition","TransitionStart"),transitioncancel:Gr("Transition","TransitionCancel"),transitionend:Gr("Transition","TransitionEnd")},Ip={},pv={};ya&&(pv=document.createElement("div").style,"AnimationEvent"in window||(delete Yo.animationend.animation,delete Yo.animationiteration.animation,delete Yo.animationstart.animation),"TransitionEvent"in window||delete Yo.transitionend.transition);function Yr(n){if(Ip[n])return Ip[n];if(!Yo[n])return n;var a=Yo[n],i;for(i in a)if(a.hasOwnProperty(i)&&i in pv)return Ip[n]=a[i];return n}var mv=Yr("animationend"),hv=Yr("animationiteration"),gv=Yr("animationstart"),WE=Yr("transitionrun"),ZE=Yr("transitionstart"),JE=Yr("transitioncancel"),xv=Yr("transitionend"),bv=new Map,Bp="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(" ");Bp.push("scrollEnd");function Bs(n,a){bv.set(n,a),$r(a,[n])}var du=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Cs=[],Ko=0,Up=0;function fu(){for(var n=Ko,a=Up=Ko=0;a<n;){var i=Cs[a];Cs[a++]=null;var d=Cs[a];Cs[a++]=null;var _=Cs[a];Cs[a++]=null;var w=Cs[a];if(Cs[a++]=null,d!==null&&_!==null){var A=d.pending;A===null?_.next=_:(_.next=A.next,A.next=_),d.pending=_}w!==0&&_v(i,_,w)}}function pu(n,a,i,d){Cs[Ko++]=n,Cs[Ko++]=a,Cs[Ko++]=i,Cs[Ko++]=d,Up|=d,n.lanes|=d,n=n.alternate,n!==null&&(n.lanes|=d)}function Hp(n,a,i,d){return pu(n,a,i,d),mu(n)}function Kr(n,a){return pu(n,null,null,a),mu(n)}function _v(n,a,i){n.lanes|=i;var d=n.alternate;d!==null&&(d.lanes|=i);for(var _=!1,w=n.return;w!==null;)w.childLanes|=i,d=w.alternate,d!==null&&(d.childLanes|=i),w.tag===22&&(n=w.stateNode,n===null||n._visibility&1||(_=!0)),n=w,w=w.return;return n.tag===3?(w=n.stateNode,_&&a!==null&&(_=31-Le(i),n=w.hiddenUpdates,d=n[_],d===null?n[_]=[a]:d.push(a),a.lane=i|536870912),w):null}function mu(n){if(50<Pi)throw Pi=0,Qm=null,Error(o(185));for(var a=n.return;a!==null;)n=a,a=n.return;return n.tag===3?n.stateNode:null}var Xo={};function eR(n,a,i,d){this.tag=n,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ms(n,a,i,d){return new eR(n,a,i,d)}function Vp(n){return n=n.prototype,!(!n||!n.isReactComponent)}function ja(n,a){var i=n.alternate;return i===null?(i=ms(n.tag,a,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=a,i.type=n.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=n.flags&65011712,i.childLanes=n.childLanes,i.lanes=n.lanes,i.child=n.child,i.memoizedProps=n.memoizedProps,i.memoizedState=n.memoizedState,i.updateQueue=n.updateQueue,a=n.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function vv(n,a){n.flags&=65011714;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=a,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=i.childLanes,n.lanes=i.lanes,n.child=i.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=i.memoizedProps,n.memoizedState=i.memoizedState,n.updateQueue=i.updateQueue,n.type=i.type,a=i.dependencies,n.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),n}function hu(n,a,i,d,_,w){var A=0;if(d=n,typeof n=="function")Vp(n)&&(A=1);else if(typeof n=="string")A=rT(n,i,te.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case U:return n=ms(31,i,a,_),n.elementType=U,n.lanes=w,n;case y:return Xr(i.children,_,w,a);case j:A=8,_|=24;break;case C:return n=ms(12,i,a,_|2),n.elementType=C,n.lanes=w,n;case M:return n=ms(13,i,a,_),n.elementType=M,n.lanes=w,n;case T:return n=ms(19,i,a,_),n.elementType=T,n.lanes=w,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case N:A=10;break e;case S:A=9;break e;case R:A=11;break e;case z:A=14;break e;case D:A=16,d=null;break e}A=29,i=Error(o(130,n===null?"null":typeof n,"")),d=null}return a=ms(A,i,a,_),a.elementType=n,a.type=d,a.lanes=w,a}function Xr(n,a,i,d){return n=ms(7,n,d,a),n.lanes=i,n}function qp(n,a,i){return n=ms(6,n,null,a),n.lanes=i,n}function yv(n){var a=ms(18,null,null,0);return a.stateNode=n,a}function $p(n,a,i){return a=ms(4,n.children!==null?n.children:[],n.key,a),a.lanes=i,a.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},a}var jv=new WeakMap;function Ns(n,a){if(typeof n=="object"&&n!==null){var i=jv.get(n);return i!==void 0?i:(a={value:n,source:a,stack:Re(a)},jv.set(n,a),a)}return{value:n,source:a,stack:Re(a)}}var Qo=[],Wo=0,gu=null,gi=0,Es=[],Rs=0,tr=null,Qs=1,Ws="";function wa(n,a){Qo[Wo++]=gi,Qo[Wo++]=gu,gu=n,gi=a}function wv(n,a,i){Es[Rs++]=Qs,Es[Rs++]=Ws,Es[Rs++]=tr,tr=n;var d=Qs;n=Ws;var _=32-Le(d)-1;d&=~(1<<_),i+=1;var w=32-Le(a)+_;if(30<w){var A=_-_%5;w=(d&(1<<A)-1).toString(32),d>>=A,_-=A,Qs=1<<32-Le(a)+_|i<<_|d,Ws=w+n}else Qs=1<<w|i<<_|d,Ws=n}function Fp(n){n.return!==null&&(wa(n,1),wv(n,1,0))}function Gp(n){for(;n===gu;)gu=Qo[--Wo],Qo[Wo]=null,gi=Qo[--Wo],Qo[Wo]=null;for(;n===tr;)tr=Es[--Rs],Es[Rs]=null,Ws=Es[--Rs],Es[Rs]=null,Qs=Es[--Rs],Es[Rs]=null}function kv(n,a){Es[Rs++]=Qs,Es[Rs++]=Ws,Es[Rs++]=tr,Qs=a.id,Ws=a.overflow,tr=n}var Dn=null,Jt=null,Nt=!1,nr=null,Ts=!1,Yp=Error(o(519));function sr(n){var a=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw xi(Ns(a,n)),Yp}function Sv(n){var a=n.stateNode,i=n.type,d=n.memoizedProps;switch(a[$t]=n,a[zn]=d,i){case"dialog":jt("cancel",a),jt("close",a);break;case"iframe":case"object":case"embed":jt("load",a);break;case"video":case"audio":for(i=0;i<Bi.length;i++)jt(Bi[i],a);break;case"source":jt("error",a);break;case"img":case"image":case"link":jt("error",a),jt("load",a);break;case"details":jt("toggle",a);break;case"input":jt("invalid",a),I_(a,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":jt("invalid",a);break;case"textarea":jt("invalid",a),U_(a,d.value,d.defaultValue,d.children)}i=d.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||d.suppressHydrationWarning===!0||V0(a.textContent,i)?(d.popover!=null&&(jt("beforetoggle",a),jt("toggle",a)),d.onScroll!=null&&jt("scroll",a),d.onScrollEnd!=null&&jt("scrollend",a),d.onClick!=null&&(a.onclick=va),a=!0):a=!1,a||sr(n,!0)}function Cv(n){for(Dn=n.return;Dn;)switch(Dn.tag){case 5:case 31:case 13:Ts=!1;return;case 27:case 3:Ts=!0;return;default:Dn=Dn.return}}function Zo(n){if(n!==Dn)return!1;if(!Nt)return Cv(n),Nt=!0,!1;var a=n.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||dh(n.type,n.memoizedProps)),i=!i),i&&Jt&&sr(n),Cv(n),a===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));Jt=W0(n)}else if(a===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));Jt=W0(n)}else a===27?(a=Jt,xr(n.type)?(n=gh,gh=null,Jt=n):Jt=a):Jt=Dn?Ms(n.stateNode.nextSibling):null;return!0}function Qr(){Jt=Dn=null,Nt=!1}function Kp(){var n=nr;return n!==null&&(rs===null?rs=n:rs.push.apply(rs,n),nr=null),n}function xi(n){nr===null?nr=[n]:nr.push(n)}var Xp=I(null),Wr=null,ka=null;function ar(n,a,i){Z(Xp,a._currentValue),a._currentValue=i}function Sa(n){n._currentValue=Xp.current,G(Xp)}function Qp(n,a,i){for(;n!==null;){var d=n.alternate;if((n.childLanes&a)!==a?(n.childLanes|=a,d!==null&&(d.childLanes|=a)):d!==null&&(d.childLanes&a)!==a&&(d.childLanes|=a),n===i)break;n=n.return}}function Wp(n,a,i,d){var _=n.child;for(_!==null&&(_.return=n);_!==null;){var w=_.dependencies;if(w!==null){var A=_.child;w=w.firstContext;e:for(;w!==null;){var V=w;w=_;for(var Q=0;Q<a.length;Q++)if(V.context===a[Q]){w.lanes|=i,V=w.alternate,V!==null&&(V.lanes|=i),Qp(w.return,i,n),d||(A=null);break e}w=V.next}}else if(_.tag===18){if(A=_.return,A===null)throw Error(o(341));A.lanes|=i,w=A.alternate,w!==null&&(w.lanes|=i),Qp(A,i,n),A=null}else A=_.child;if(A!==null)A.return=_;else for(A=_;A!==null;){if(A===n){A=null;break}if(_=A.sibling,_!==null){_.return=A.return,A=_;break}A=A.return}_=A}}function Jo(n,a,i,d){n=null;for(var _=a,w=!1;_!==null;){if(!w){if((_.flags&524288)!==0)w=!0;else if((_.flags&262144)!==0)break}if(_.tag===10){var A=_.alternate;if(A===null)throw Error(o(387));if(A=A.memoizedProps,A!==null){var V=_.type;ps(_.pendingProps.value,A.value)||(n!==null?n.push(V):n=[V])}}else if(_===ne.current){if(A=_.alternate,A===null)throw Error(o(387));A.memoizedState.memoizedState!==_.memoizedState.memoizedState&&(n!==null?n.push($i):n=[$i])}_=_.return}n!==null&&Wp(a,n,i,d),a.flags|=262144}function xu(n){for(n=n.firstContext;n!==null;){if(!ps(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function Zr(n){Wr=n,ka=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Ln(n){return Nv(Wr,n)}function bu(n,a){return Wr===null&&Zr(n),Nv(n,a)}function Nv(n,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},ka===null){if(n===null)throw Error(o(308));ka=a,n.dependencies={lanes:0,firstContext:a},n.flags|=524288}else ka=ka.next=a;return i}var tR=typeof AbortController<"u"?AbortController:function(){var n=[],a=this.signal={aborted:!1,addEventListener:function(i,d){n.push(d)}};this.abort=function(){a.aborted=!0,n.forEach(function(i){return i()})}},nR=e.unstable_scheduleCallback,sR=e.unstable_NormalPriority,xn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Zp(){return{controller:new tR,data:new Map,refCount:0}}function bi(n){n.refCount--,n.refCount===0&&nR(sR,function(){n.controller.abort()})}var _i=null,Jp=0,el=0,tl=null;function aR(n,a){if(_i===null){var i=_i=[];Jp=0,el=nh(),tl={status:"pending",value:void 0,then:function(d){i.push(d)}}}return Jp++,a.then(Ev,Ev),a}function Ev(){if(--Jp===0&&_i!==null){tl!==null&&(tl.status="fulfilled");var n=_i;_i=null,el=0,tl=null;for(var a=0;a<n.length;a++)(0,n[a])()}}function rR(n,a){var i=[],d={status:"pending",value:null,reason:null,then:function(_){i.push(_)}};return n.then(function(){d.status="fulfilled",d.value=a;for(var _=0;_<i.length;_++)(0,i[_])(a)},function(_){for(d.status="rejected",d.reason=_,_=0;_<i.length;_++)(0,i[_])(void 0)}),d}var Rv=q.S;q.S=function(n,a){f0=le(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&aR(n,a),Rv!==null&&Rv(n,a)};var Jr=I(null);function em(){var n=Jr.current;return n!==null?n:Ft.pooledCache}function _u(n,a){a===null?Z(Jr,Jr.current):Z(Jr,a.pool)}function Tv(){var n=em();return n===null?null:{parent:xn._currentValue,pool:n}}var nl=Error(o(460)),tm=Error(o(474)),vu=Error(o(542)),yu={then:function(){}};function Av(n){return n=n.status,n==="fulfilled"||n==="rejected"}function Mv(n,a,i){switch(i=n[i],i===void 0?n.push(a):i!==a&&(a.then(va,va),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,zv(n),n;default:if(typeof a.status=="string")a.then(va,va);else{if(n=Ft,n!==null&&100<n.shellSuspendCounter)throw Error(o(482));n=a,n.status="pending",n.then(function(d){if(a.status==="pending"){var _=a;_.status="fulfilled",_.value=d}},function(d){if(a.status==="pending"){var _=a;_.status="rejected",_.reason=d}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw n=a.reason,zv(n),n}throw to=a,nl}}function eo(n){try{var a=n._init;return a(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(to=i,nl):i}}var to=null;function Ov(){if(to===null)throw Error(o(459));var n=to;return to=null,n}function zv(n){if(n===nl||n===vu)throw Error(o(483))}var sl=null,vi=0;function ju(n){var a=vi;return vi+=1,sl===null&&(sl=[]),Mv(sl,n,a)}function yi(n,a){a=a.props.ref,n.ref=a!==void 0?a:null}function wu(n,a){throw a.$$typeof===v?Error(o(525)):(n=Object.prototype.toString.call(a),Error(o(31,n==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":n)))}function Dv(n){function a(J,W){if(n){var se=J.deletions;se===null?(J.deletions=[W],J.flags|=16):se.push(W)}}function i(J,W){if(!n)return null;for(;W!==null;)a(J,W),W=W.sibling;return null}function d(J){for(var W=new Map;J!==null;)J.key!==null?W.set(J.key,J):W.set(J.index,J),J=J.sibling;return W}function _(J,W){return J=ja(J,W),J.index=0,J.sibling=null,J}function w(J,W,se){return J.index=se,n?(se=J.alternate,se!==null?(se=se.index,se<W?(J.flags|=67108866,W):se):(J.flags|=67108866,W)):(J.flags|=1048576,W)}function A(J){return n&&J.alternate===null&&(J.flags|=67108866),J}function V(J,W,se,be){return W===null||W.tag!==6?(W=qp(se,J.mode,be),W.return=J,W):(W=_(W,se),W.return=J,W)}function Q(J,W,se,be){var Ze=se.type;return Ze===y?ge(J,W,se.props.children,be,se.key):W!==null&&(W.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===D&&eo(Ze)===W.type)?(W=_(W,se.props),yi(W,se),W.return=J,W):(W=hu(se.type,se.key,se.props,null,J.mode,be),yi(W,se),W.return=J,W)}function re(J,W,se,be){return W===null||W.tag!==4||W.stateNode.containerInfo!==se.containerInfo||W.stateNode.implementation!==se.implementation?(W=$p(se,J.mode,be),W.return=J,W):(W=_(W,se.children||[]),W.return=J,W)}function ge(J,W,se,be,Ze){return W===null||W.tag!==7?(W=Xr(se,J.mode,be,Ze),W.return=J,W):(W=_(W,se),W.return=J,W)}function ye(J,W,se){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=qp(""+W,J.mode,se),W.return=J,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case k:return se=hu(W.type,W.key,W.props,null,J.mode,se),yi(se,W),se.return=J,se;case E:return W=$p(W,J.mode,se),W.return=J,W;case D:return W=eo(W),ye(J,W,se)}if($(W)||O(W))return W=Xr(W,J.mode,se,null),W.return=J,W;if(typeof W.then=="function")return ye(J,ju(W),se);if(W.$$typeof===N)return ye(J,bu(J,W),se);wu(J,W)}return null}function oe(J,W,se,be){var Ze=W!==null?W.key:null;if(typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint")return Ze!==null?null:V(J,W,""+se,be);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case k:return se.key===Ze?Q(J,W,se,be):null;case E:return se.key===Ze?re(J,W,se,be):null;case D:return se=eo(se),oe(J,W,se,be)}if($(se)||O(se))return Ze!==null?null:ge(J,W,se,be,null);if(typeof se.then=="function")return oe(J,W,ju(se),be);if(se.$$typeof===N)return oe(J,W,bu(J,se),be);wu(J,se)}return null}function fe(J,W,se,be,Ze){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return J=J.get(se)||null,V(W,J,""+be,Ze);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case k:return J=J.get(be.key===null?se:be.key)||null,Q(W,J,be,Ze);case E:return J=J.get(be.key===null?se:be.key)||null,re(W,J,be,Ze);case D:return be=eo(be),fe(J,W,se,be,Ze)}if($(be)||O(be))return J=J.get(se)||null,ge(W,J,be,Ze,null);if(typeof be.then=="function")return fe(J,W,se,ju(be),Ze);if(be.$$typeof===N)return fe(J,W,se,bu(W,be),Ze);wu(W,be)}return null}function Ve(J,W,se,be){for(var Ze=null,Tt=null,Fe=W,pt=W=0,kt=null;Fe!==null&&pt<se.length;pt++){Fe.index>pt?(kt=Fe,Fe=null):kt=Fe.sibling;var At=oe(J,Fe,se[pt],be);if(At===null){Fe===null&&(Fe=kt);break}n&&Fe&&At.alternate===null&&a(J,Fe),W=w(At,W,pt),Tt===null?Ze=At:Tt.sibling=At,Tt=At,Fe=kt}if(pt===se.length)return i(J,Fe),Nt&&wa(J,pt),Ze;if(Fe===null){for(;pt<se.length;pt++)Fe=ye(J,se[pt],be),Fe!==null&&(W=w(Fe,W,pt),Tt===null?Ze=Fe:Tt.sibling=Fe,Tt=Fe);return Nt&&wa(J,pt),Ze}for(Fe=d(Fe);pt<se.length;pt++)kt=fe(Fe,J,pt,se[pt],be),kt!==null&&(n&&kt.alternate!==null&&Fe.delete(kt.key===null?pt:kt.key),W=w(kt,W,pt),Tt===null?Ze=kt:Tt.sibling=kt,Tt=kt);return n&&Fe.forEach(function(jr){return a(J,jr)}),Nt&&wa(J,pt),Ze}function st(J,W,se,be){if(se==null)throw Error(o(151));for(var Ze=null,Tt=null,Fe=W,pt=W=0,kt=null,At=se.next();Fe!==null&&!At.done;pt++,At=se.next()){Fe.index>pt?(kt=Fe,Fe=null):kt=Fe.sibling;var jr=oe(J,Fe,At.value,be);if(jr===null){Fe===null&&(Fe=kt);break}n&&Fe&&jr.alternate===null&&a(J,Fe),W=w(jr,W,pt),Tt===null?Ze=jr:Tt.sibling=jr,Tt=jr,Fe=kt}if(At.done)return i(J,Fe),Nt&&wa(J,pt),Ze;if(Fe===null){for(;!At.done;pt++,At=se.next())At=ye(J,At.value,be),At!==null&&(W=w(At,W,pt),Tt===null?Ze=At:Tt.sibling=At,Tt=At);return Nt&&wa(J,pt),Ze}for(Fe=d(Fe);!At.done;pt++,At=se.next())At=fe(Fe,J,pt,At.value,be),At!==null&&(n&&At.alternate!==null&&Fe.delete(At.key===null?pt:At.key),W=w(At,W,pt),Tt===null?Ze=At:Tt.sibling=At,Tt=At);return n&&Fe.forEach(function(gT){return a(J,gT)}),Nt&&wa(J,pt),Ze}function Ut(J,W,se,be){if(typeof se=="object"&&se!==null&&se.type===y&&se.key===null&&(se=se.props.children),typeof se=="object"&&se!==null){switch(se.$$typeof){case k:e:{for(var Ze=se.key;W!==null;){if(W.key===Ze){if(Ze=se.type,Ze===y){if(W.tag===7){i(J,W.sibling),be=_(W,se.props.children),be.return=J,J=be;break e}}else if(W.elementType===Ze||typeof Ze=="object"&&Ze!==null&&Ze.$$typeof===D&&eo(Ze)===W.type){i(J,W.sibling),be=_(W,se.props),yi(be,se),be.return=J,J=be;break e}i(J,W);break}else a(J,W);W=W.sibling}se.type===y?(be=Xr(se.props.children,J.mode,be,se.key),be.return=J,J=be):(be=hu(se.type,se.key,se.props,null,J.mode,be),yi(be,se),be.return=J,J=be)}return A(J);case E:e:{for(Ze=se.key;W!==null;){if(W.key===Ze)if(W.tag===4&&W.stateNode.containerInfo===se.containerInfo&&W.stateNode.implementation===se.implementation){i(J,W.sibling),be=_(W,se.children||[]),be.return=J,J=be;break e}else{i(J,W);break}else a(J,W);W=W.sibling}be=$p(se,J.mode,be),be.return=J,J=be}return A(J);case D:return se=eo(se),Ut(J,W,se,be)}if($(se))return Ve(J,W,se,be);if(O(se)){if(Ze=O(se),typeof Ze!="function")throw Error(o(150));return se=Ze.call(se),st(J,W,se,be)}if(typeof se.then=="function")return Ut(J,W,ju(se),be);if(se.$$typeof===N)return Ut(J,W,bu(J,se),be);wu(J,se)}return typeof se=="string"&&se!==""||typeof se=="number"||typeof se=="bigint"?(se=""+se,W!==null&&W.tag===6?(i(J,W.sibling),be=_(W,se),be.return=J,J=be):(i(J,W),be=qp(se,J.mode,be),be.return=J,J=be),A(J)):i(J,W)}return function(J,W,se,be){try{vi=0;var Ze=Ut(J,W,se,be);return sl=null,Ze}catch(Fe){if(Fe===nl||Fe===vu)throw Fe;var Tt=ms(29,Fe,null,J.mode);return Tt.lanes=be,Tt.return=J,Tt}finally{}}}var no=Dv(!0),Lv=Dv(!1),rr=!1;function nm(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function sm(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function or(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function lr(n,a,i){var d=n.updateQueue;if(d===null)return null;if(d=d.shared,(zt&2)!==0){var _=d.pending;return _===null?a.next=a:(a.next=_.next,_.next=a),d.pending=a,a=mu(n),_v(n,null,i),a}return pu(n,d,a,i),mu(n)}function ji(n,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var d=a.lanes;d&=n.pendingLanes,i|=d,a.lanes=i,Is(n,i)}}function am(n,a){var i=n.updateQueue,d=n.alternate;if(d!==null&&(d=d.updateQueue,i===d)){var _=null,w=null;if(i=i.firstBaseUpdate,i!==null){do{var A={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};w===null?_=w=A:w=w.next=A,i=i.next}while(i!==null);w===null?_=w=a:w=w.next=a}else _=w=a;i={baseState:d.baseState,firstBaseUpdate:_,lastBaseUpdate:w,shared:d.shared,callbacks:d.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=a:n.next=a,i.lastBaseUpdate=a}var rm=!1;function wi(){if(rm){var n=tl;if(n!==null)throw n}}function ki(n,a,i,d){rm=!1;var _=n.updateQueue;rr=!1;var w=_.firstBaseUpdate,A=_.lastBaseUpdate,V=_.shared.pending;if(V!==null){_.shared.pending=null;var Q=V,re=Q.next;Q.next=null,A===null?w=re:A.next=re,A=Q;var ge=n.alternate;ge!==null&&(ge=ge.updateQueue,V=ge.lastBaseUpdate,V!==A&&(V===null?ge.firstBaseUpdate=re:V.next=re,ge.lastBaseUpdate=Q))}if(w!==null){var ye=_.baseState;A=0,ge=re=Q=null,V=w;do{var oe=V.lane&-536870913,fe=oe!==V.lane;if(fe?(wt&oe)===oe:(d&oe)===oe){oe!==0&&oe===el&&(rm=!0),ge!==null&&(ge=ge.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});e:{var Ve=n,st=V;oe=a;var Ut=i;switch(st.tag){case 1:if(Ve=st.payload,typeof Ve=="function"){ye=Ve.call(Ut,ye,oe);break e}ye=Ve;break e;case 3:Ve.flags=Ve.flags&-65537|128;case 0:if(Ve=st.payload,oe=typeof Ve=="function"?Ve.call(Ut,ye,oe):Ve,oe==null)break e;ye=b({},ye,oe);break e;case 2:rr=!0}}oe=V.callback,oe!==null&&(n.flags|=64,fe&&(n.flags|=8192),fe=_.callbacks,fe===null?_.callbacks=[oe]:fe.push(oe))}else fe={lane:oe,tag:V.tag,payload:V.payload,callback:V.callback,next:null},ge===null?(re=ge=fe,Q=ye):ge=ge.next=fe,A|=oe;if(V=V.next,V===null){if(V=_.shared.pending,V===null)break;fe=V,V=fe.next,fe.next=null,_.lastBaseUpdate=fe,_.shared.pending=null}}while(!0);ge===null&&(Q=ye),_.baseState=Q,_.firstBaseUpdate=re,_.lastBaseUpdate=ge,w===null&&(_.shared.lanes=0),fr|=A,n.lanes=A,n.memoizedState=ye}}function Pv(n,a){if(typeof n!="function")throw Error(o(191,n));n.call(a)}function Iv(n,a){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)Pv(i[n],a)}var al=I(null),ku=I(0);function Bv(n,a){n=za,Z(ku,n),Z(al,a),za=n|a.baseLanes}function om(){Z(ku,za),Z(al,al.current)}function lm(){za=ku.current,G(al),G(ku)}var hs=I(null),As=null;function ir(n){var a=n.alternate;Z(hn,hn.current&1),Z(hs,n),As===null&&(a===null||al.current!==null||a.memoizedState!==null)&&(As=n)}function im(n){Z(hn,hn.current),Z(hs,n),As===null&&(As=n)}function Uv(n){n.tag===22?(Z(hn,hn.current),Z(hs,n),As===null&&(As=n)):cr()}function cr(){Z(hn,hn.current),Z(hs,hs.current)}function gs(n){G(hs),As===n&&(As=null),G(hn)}var hn=I(0);function Su(n){for(var a=n;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||mh(i)||hh(i)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Ca=0,dt=null,It=null,bn=null,Cu=!1,rl=!1,so=!1,Nu=0,Si=0,ol=null,oR=0;function cn(){throw Error(o(321))}function cm(n,a){if(a===null)return!1;for(var i=0;i<a.length&&i<n.length;i++)if(!ps(n[i],a[i]))return!1;return!0}function um(n,a,i,d,_,w){return Ca=w,dt=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,q.H=n===null||n.memoizedState===null?wy:Sm,so=!1,w=i(d,_),so=!1,rl&&(w=Vv(a,i,d,_)),Hv(n),w}function Hv(n){q.H=Ei;var a=It!==null&&It.next!==null;if(Ca=0,bn=It=dt=null,Cu=!1,Si=0,ol=null,a)throw Error(o(300));n===null||_n||(n=n.dependencies,n!==null&&xu(n)&&(_n=!0))}function Vv(n,a,i,d){dt=n;var _=0;do{if(rl&&(ol=null),Si=0,rl=!1,25<=_)throw Error(o(301));if(_+=1,bn=It=null,n.updateQueue!=null){var w=n.updateQueue;w.lastEffect=null,w.events=null,w.stores=null,w.memoCache!=null&&(w.memoCache.index=0)}q.H=ky,w=a(i,d)}while(rl);return w}function lR(){var n=q.H,a=n.useState()[0];return a=typeof a.then=="function"?Ci(a):a,n=n.useState()[0],(It!==null?It.memoizedState:null)!==n&&(dt.flags|=1024),a}function dm(){var n=Nu!==0;return Nu=0,n}function fm(n,a,i){a.updateQueue=n.updateQueue,a.flags&=-2053,n.lanes&=~i}function pm(n){if(Cu){for(n=n.memoizedState;n!==null;){var a=n.queue;a!==null&&(a.pending=null),n=n.next}Cu=!1}Ca=0,bn=It=dt=null,rl=!1,Si=Nu=0,ol=null}function Kn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bn===null?dt.memoizedState=bn=n:bn=bn.next=n,bn}function gn(){if(It===null){var n=dt.alternate;n=n!==null?n.memoizedState:null}else n=It.next;var a=bn===null?dt.memoizedState:bn.next;if(a!==null)bn=a,It=n;else{if(n===null)throw dt.alternate===null?Error(o(467)):Error(o(310));It=n,n={memoizedState:It.memoizedState,baseState:It.baseState,baseQueue:It.baseQueue,queue:It.queue,next:null},bn===null?dt.memoizedState=bn=n:bn=bn.next=n}return bn}function Eu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ci(n){var a=Si;return Si+=1,ol===null&&(ol=[]),n=Mv(ol,n,a),a=dt,(bn===null?a.memoizedState:bn.next)===null&&(a=a.alternate,q.H=a===null||a.memoizedState===null?wy:Sm),n}function Ru(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ci(n);if(n.$$typeof===N)return Ln(n)}throw Error(o(438,String(n)))}function mm(n){var a=null,i=dt.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var d=dt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(a={data:d.data.map(function(_){return _.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=Eu(),dt.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(n),d=0;d<n;d++)i[d]=L;return a.index++,i}function Na(n,a){return typeof a=="function"?a(n):a}function Tu(n){var a=gn();return hm(a,It,n)}function hm(n,a,i){var d=n.queue;if(d===null)throw Error(o(311));d.lastRenderedReducer=i;var _=n.baseQueue,w=d.pending;if(w!==null){if(_!==null){var A=_.next;_.next=w.next,w.next=A}a.baseQueue=_=w,d.pending=null}if(w=n.baseState,_===null)n.memoizedState=w;else{a=_.next;var V=A=null,Q=null,re=a,ge=!1;do{var ye=re.lane&-536870913;if(ye!==re.lane?(wt&ye)===ye:(Ca&ye)===ye){var oe=re.revertLane;if(oe===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null}),ye===el&&(ge=!0);else if((Ca&oe)===oe){re=re.next,oe===el&&(ge=!0);continue}else ye={lane:0,revertLane:re.revertLane,gesture:null,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},Q===null?(V=Q=ye,A=w):Q=Q.next=ye,dt.lanes|=oe,fr|=oe;ye=re.action,so&&i(w,ye),w=re.hasEagerState?re.eagerState:i(w,ye)}else oe={lane:ye,revertLane:re.revertLane,gesture:re.gesture,action:re.action,hasEagerState:re.hasEagerState,eagerState:re.eagerState,next:null},Q===null?(V=Q=oe,A=w):Q=Q.next=oe,dt.lanes|=ye,fr|=ye;re=re.next}while(re!==null&&re!==a);if(Q===null?A=w:Q.next=V,!ps(w,n.memoizedState)&&(_n=!0,ge&&(i=tl,i!==null)))throw i;n.memoizedState=w,n.baseState=A,n.baseQueue=Q,d.lastRenderedState=w}return _===null&&(d.lanes=0),[n.memoizedState,d.dispatch]}function gm(n){var a=gn(),i=a.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=n;var d=i.dispatch,_=i.pending,w=a.memoizedState;if(_!==null){i.pending=null;var A=_=_.next;do w=n(w,A.action),A=A.next;while(A!==_);ps(w,a.memoizedState)||(_n=!0),a.memoizedState=w,a.baseQueue===null&&(a.baseState=w),i.lastRenderedState=w}return[w,d]}function qv(n,a,i){var d=dt,_=gn(),w=Nt;if(w){if(i===void 0)throw Error(o(407));i=i()}else i=a();var A=!ps((It||_).memoizedState,i);if(A&&(_.memoizedState=i,_n=!0),_=_.queue,_m(Gv.bind(null,d,_,n),[n]),_.getSnapshot!==a||A||bn!==null&&bn.memoizedState.tag&1){if(d.flags|=2048,ll(9,{destroy:void 0},Fv.bind(null,d,_,i,a),null),Ft===null)throw Error(o(349));w||(Ca&127)!==0||$v(d,a,i)}return i}function $v(n,a,i){n.flags|=16384,n={getSnapshot:a,value:i},a=dt.updateQueue,a===null?(a=Eu(),dt.updateQueue=a,a.stores=[n]):(i=a.stores,i===null?a.stores=[n]:i.push(n))}function Fv(n,a,i,d){a.value=i,a.getSnapshot=d,Yv(a)&&Kv(n)}function Gv(n,a,i){return i(function(){Yv(a)&&Kv(n)})}function Yv(n){var a=n.getSnapshot;n=n.value;try{var i=a();return!ps(n,i)}catch{return!0}}function Kv(n){var a=Kr(n,2);a!==null&&os(a,n,2)}function xm(n){var a=Kn();if(typeof n=="function"){var i=n;if(n=i(),so){xe(!0);try{i()}finally{xe(!1)}}}return a.memoizedState=a.baseState=n,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:n},a}function Xv(n,a,i,d){return n.baseState=i,hm(n,It,typeof d=="function"?d:Na)}function iR(n,a,i,d,_){if(Ou(n))throw Error(o(485));if(n=a.action,n!==null){var w={payload:_,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(A){w.listeners.push(A)}};q.T!==null?i(!0):w.isTransition=!1,d(w),i=a.pending,i===null?(w.next=a.pending=w,Qv(a,w)):(w.next=i.next,a.pending=i.next=w)}}function Qv(n,a){var i=a.action,d=a.payload,_=n.state;if(a.isTransition){var w=q.T,A={};q.T=A;try{var V=i(_,d),Q=q.S;Q!==null&&Q(A,V),Wv(n,a,V)}catch(re){bm(n,a,re)}finally{w!==null&&A.types!==null&&(w.types=A.types),q.T=w}}else try{w=i(_,d),Wv(n,a,w)}catch(re){bm(n,a,re)}}function Wv(n,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(d){Zv(n,a,d)},function(d){return bm(n,a,d)}):Zv(n,a,i)}function Zv(n,a,i){a.status="fulfilled",a.value=i,Jv(a),n.state=i,a=n.pending,a!==null&&(i=a.next,i===a?n.pending=null:(i=i.next,a.next=i,Qv(n,i)))}function bm(n,a,i){var d=n.pending;if(n.pending=null,d!==null){d=d.next;do a.status="rejected",a.reason=i,Jv(a),a=a.next;while(a!==d)}n.action=null}function Jv(n){n=n.listeners;for(var a=0;a<n.length;a++)(0,n[a])()}function ey(n,a){return a}function ty(n,a){if(Nt){var i=Ft.formState;if(i!==null){e:{var d=dt;if(Nt){if(Jt){t:{for(var _=Jt,w=Ts;_.nodeType!==8;){if(!w){_=null;break t}if(_=Ms(_.nextSibling),_===null){_=null;break t}}w=_.data,_=w==="F!"||w==="F"?_:null}if(_){Jt=Ms(_.nextSibling),d=_.data==="F!";break e}}sr(d)}d=!1}d&&(a=i[0])}}return i=Kn(),i.memoizedState=i.baseState=a,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ey,lastRenderedState:a},i.queue=d,i=vy.bind(null,dt,d),d.dispatch=i,d=xm(!1),w=km.bind(null,dt,!1,d.queue),d=Kn(),_={state:a,dispatch:null,action:n,pending:null},d.queue=_,i=iR.bind(null,dt,_,w,i),_.dispatch=i,d.memoizedState=n,[a,i,!1]}function ny(n){var a=gn();return sy(a,It,n)}function sy(n,a,i){if(a=hm(n,a,ey)[0],n=Tu(Na)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var d=Ci(a)}catch(A){throw A===nl?vu:A}else d=a;a=gn();var _=a.queue,w=_.dispatch;return i!==a.memoizedState&&(dt.flags|=2048,ll(9,{destroy:void 0},cR.bind(null,_,i),null)),[d,w,n]}function cR(n,a){n.action=a}function ay(n){var a=gn(),i=It;if(i!==null)return sy(a,i,n);gn(),a=a.memoizedState,i=gn();var d=i.queue.dispatch;return i.memoizedState=n,[a,d,!1]}function ll(n,a,i,d){return n={tag:n,create:i,deps:d,inst:a,next:null},a=dt.updateQueue,a===null&&(a=Eu(),dt.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=n.next=n:(d=i.next,i.next=n,n.next=d,a.lastEffect=n),n}function ry(){return gn().memoizedState}function Au(n,a,i,d){var _=Kn();dt.flags|=n,_.memoizedState=ll(1|a,{destroy:void 0},i,d===void 0?null:d)}function Mu(n,a,i,d){var _=gn();d=d===void 0?null:d;var w=_.memoizedState.inst;It!==null&&d!==null&&cm(d,It.memoizedState.deps)?_.memoizedState=ll(a,w,i,d):(dt.flags|=n,_.memoizedState=ll(1|a,w,i,d))}function oy(n,a){Au(8390656,8,n,a)}function _m(n,a){Mu(2048,8,n,a)}function uR(n){dt.flags|=4;var a=dt.updateQueue;if(a===null)a=Eu(),dt.updateQueue=a,a.events=[n];else{var i=a.events;i===null?a.events=[n]:i.push(n)}}function ly(n){var a=gn().memoizedState;return uR({ref:a,nextImpl:n}),function(){if((zt&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}function iy(n,a){return Mu(4,2,n,a)}function cy(n,a){return Mu(4,4,n,a)}function uy(n,a){if(typeof a=="function"){n=n();var i=a(n);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return n=n(),a.current=n,function(){a.current=null}}function dy(n,a,i){i=i!=null?i.concat([n]):null,Mu(4,4,uy.bind(null,a,n),i)}function vm(){}function fy(n,a){var i=gn();a=a===void 0?null:a;var d=i.memoizedState;return a!==null&&cm(a,d[1])?d[0]:(i.memoizedState=[n,a],n)}function py(n,a){var i=gn();a=a===void 0?null:a;var d=i.memoizedState;if(a!==null&&cm(a,d[1]))return d[0];if(d=n(),so){xe(!0);try{n()}finally{xe(!1)}}return i.memoizedState=[d,a],d}function ym(n,a,i){return i===void 0||(Ca&1073741824)!==0&&(wt&261930)===0?n.memoizedState=a:(n.memoizedState=i,n=m0(),dt.lanes|=n,fr|=n,i)}function my(n,a,i,d){return ps(i,a)?i:al.current!==null?(n=ym(n,i,d),ps(n,a)||(_n=!0),n):(Ca&42)===0||(Ca&1073741824)!==0&&(wt&261930)===0?(_n=!0,n.memoizedState=i):(n=m0(),dt.lanes|=n,fr|=n,a)}function hy(n,a,i,d,_){var w=X.p;X.p=w!==0&&8>w?w:8;var A=q.T,V={};q.T=V,km(n,!1,a,i);try{var Q=_(),re=q.S;if(re!==null&&re(V,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var ge=rR(Q,d);Ni(n,a,ge,_s(n))}else Ni(n,a,d,_s(n))}catch(ye){Ni(n,a,{then:function(){},status:"rejected",reason:ye},_s())}finally{X.p=w,A!==null&&V.types!==null&&(A.types=V.types),q.T=A}}function dR(){}function jm(n,a,i,d){if(n.tag!==5)throw Error(o(476));var _=gy(n).queue;hy(n,_,a,Y,i===null?dR:function(){return xy(n),i(d)})}function gy(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:Y},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Na,lastRenderedState:i},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function xy(n){var a=gy(n);a.next===null&&(a=n.alternate.memoizedState),Ni(n,a.next.queue,{},_s())}function wm(){return Ln($i)}function by(){return gn().memoizedState}function _y(){return gn().memoizedState}function fR(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var i=_s();n=or(i);var d=lr(a,n,i);d!==null&&(os(d,a,i),ji(d,a,i)),a={cache:Zp()},n.payload=a;return}a=a.return}}function pR(n,a,i){var d=_s();i={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Ou(n)?yy(a,i):(i=Hp(n,a,i,d),i!==null&&(os(i,n,d),jy(i,a,d)))}function vy(n,a,i){var d=_s();Ni(n,a,i,d)}function Ni(n,a,i,d){var _={lane:d,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Ou(n))yy(a,_);else{var w=n.alternate;if(n.lanes===0&&(w===null||w.lanes===0)&&(w=a.lastRenderedReducer,w!==null))try{var A=a.lastRenderedState,V=w(A,i);if(_.hasEagerState=!0,_.eagerState=V,ps(V,A))return pu(n,a,_,0),Ft===null&&fu(),!1}catch{}finally{}if(i=Hp(n,a,_,d),i!==null)return os(i,n,d),jy(i,a,d),!0}return!1}function km(n,a,i,d){if(d={lane:2,revertLane:nh(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},Ou(n)){if(a)throw Error(o(479))}else a=Hp(n,i,d,2),a!==null&&os(a,n,2)}function Ou(n){var a=n.alternate;return n===dt||a!==null&&a===dt}function yy(n,a){rl=Cu=!0;var i=n.pending;i===null?a.next=a:(a.next=i.next,i.next=a),n.pending=a}function jy(n,a,i){if((i&4194048)!==0){var d=a.lanes;d&=n.pendingLanes,i|=d,a.lanes=i,Is(n,i)}}var Ei={readContext:Ln,use:Ru,useCallback:cn,useContext:cn,useEffect:cn,useImperativeHandle:cn,useLayoutEffect:cn,useInsertionEffect:cn,useMemo:cn,useReducer:cn,useRef:cn,useState:cn,useDebugValue:cn,useDeferredValue:cn,useTransition:cn,useSyncExternalStore:cn,useId:cn,useHostTransitionStatus:cn,useFormState:cn,useActionState:cn,useOptimistic:cn,useMemoCache:cn,useCacheRefresh:cn};Ei.useEffectEvent=cn;var wy={readContext:Ln,use:Ru,useCallback:function(n,a){return Kn().memoizedState=[n,a===void 0?null:a],n},useContext:Ln,useEffect:oy,useImperativeHandle:function(n,a,i){i=i!=null?i.concat([n]):null,Au(4194308,4,uy.bind(null,a,n),i)},useLayoutEffect:function(n,a){return Au(4194308,4,n,a)},useInsertionEffect:function(n,a){Au(4,2,n,a)},useMemo:function(n,a){var i=Kn();a=a===void 0?null:a;var d=n();if(so){xe(!0);try{n()}finally{xe(!1)}}return i.memoizedState=[d,a],d},useReducer:function(n,a,i){var d=Kn();if(i!==void 0){var _=i(a);if(so){xe(!0);try{i(a)}finally{xe(!1)}}}else _=a;return d.memoizedState=d.baseState=_,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:_},d.queue=n,n=n.dispatch=pR.bind(null,dt,n),[d.memoizedState,n]},useRef:function(n){var a=Kn();return n={current:n},a.memoizedState=n},useState:function(n){n=xm(n);var a=n.queue,i=vy.bind(null,dt,a);return a.dispatch=i,[n.memoizedState,i]},useDebugValue:vm,useDeferredValue:function(n,a){var i=Kn();return ym(i,n,a)},useTransition:function(){var n=xm(!1);return n=hy.bind(null,dt,n.queue,!0,!1),Kn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,i){var d=dt,_=Kn();if(Nt){if(i===void 0)throw Error(o(407));i=i()}else{if(i=a(),Ft===null)throw Error(o(349));(wt&127)!==0||$v(d,a,i)}_.memoizedState=i;var w={value:i,getSnapshot:a};return _.queue=w,oy(Gv.bind(null,d,w,n),[n]),d.flags|=2048,ll(9,{destroy:void 0},Fv.bind(null,d,w,i,a),null),i},useId:function(){var n=Kn(),a=Ft.identifierPrefix;if(Nt){var i=Ws,d=Qs;i=(d&~(1<<32-Le(d)-1)).toString(32)+i,a="_"+a+"R_"+i,i=Nu++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=oR++,a="_"+a+"r_"+i.toString(32)+"_";return n.memoizedState=a},useHostTransitionStatus:wm,useFormState:ty,useActionState:ty,useOptimistic:function(n){var a=Kn();a.memoizedState=a.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=km.bind(null,dt,!0,i),i.dispatch=a,[n,a]},useMemoCache:mm,useCacheRefresh:function(){return Kn().memoizedState=fR.bind(null,dt)},useEffectEvent:function(n){var a=Kn(),i={impl:n};return a.memoizedState=i,function(){if((zt&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},Sm={readContext:Ln,use:Ru,useCallback:fy,useContext:Ln,useEffect:_m,useImperativeHandle:dy,useInsertionEffect:iy,useLayoutEffect:cy,useMemo:py,useReducer:Tu,useRef:ry,useState:function(){return Tu(Na)},useDebugValue:vm,useDeferredValue:function(n,a){var i=gn();return my(i,It.memoizedState,n,a)},useTransition:function(){var n=Tu(Na)[0],a=gn().memoizedState;return[typeof n=="boolean"?n:Ci(n),a]},useSyncExternalStore:qv,useId:by,useHostTransitionStatus:wm,useFormState:ny,useActionState:ny,useOptimistic:function(n,a){var i=gn();return Xv(i,It,n,a)},useMemoCache:mm,useCacheRefresh:_y};Sm.useEffectEvent=ly;var ky={readContext:Ln,use:Ru,useCallback:fy,useContext:Ln,useEffect:_m,useImperativeHandle:dy,useInsertionEffect:iy,useLayoutEffect:cy,useMemo:py,useReducer:gm,useRef:ry,useState:function(){return gm(Na)},useDebugValue:vm,useDeferredValue:function(n,a){var i=gn();return It===null?ym(i,n,a):my(i,It.memoizedState,n,a)},useTransition:function(){var n=gm(Na)[0],a=gn().memoizedState;return[typeof n=="boolean"?n:Ci(n),a]},useSyncExternalStore:qv,useId:by,useHostTransitionStatus:wm,useFormState:ay,useActionState:ay,useOptimistic:function(n,a){var i=gn();return It!==null?Xv(i,It,n,a):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:mm,useCacheRefresh:_y};ky.useEffectEvent=ly;function Cm(n,a,i,d){a=n.memoizedState,i=i(d,a),i=i==null?a:b({},a,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var Nm={enqueueSetState:function(n,a,i){n=n._reactInternals;var d=_s(),_=or(d);_.payload=a,i!=null&&(_.callback=i),a=lr(n,_,d),a!==null&&(os(a,n,d),ji(a,n,d))},enqueueReplaceState:function(n,a,i){n=n._reactInternals;var d=_s(),_=or(d);_.tag=1,_.payload=a,i!=null&&(_.callback=i),a=lr(n,_,d),a!==null&&(os(a,n,d),ji(a,n,d))},enqueueForceUpdate:function(n,a){n=n._reactInternals;var i=_s(),d=or(i);d.tag=2,a!=null&&(d.callback=a),a=lr(n,d,i),a!==null&&(os(a,n,i),ji(a,n,i))}};function Sy(n,a,i,d,_,w,A){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(d,w,A):a.prototype&&a.prototype.isPureReactComponent?!mi(i,d)||!mi(_,w):!0}function Cy(n,a,i,d){n=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,d),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,d),a.state!==n&&Nm.enqueueReplaceState(a,a.state,null)}function ao(n,a){var i=a;if("ref"in a){i={};for(var d in a)d!=="ref"&&(i[d]=a[d])}if(n=n.defaultProps){i===a&&(i=b({},i));for(var _ in n)i[_]===void 0&&(i[_]=n[_])}return i}function Ny(n){du(n)}function Ey(n){console.error(n)}function Ry(n){du(n)}function zu(n,a){try{var i=n.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(d){setTimeout(function(){throw d})}}function Ty(n,a,i){try{var d=n.onCaughtError;d(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(_){setTimeout(function(){throw _})}}function Em(n,a,i){return i=or(i),i.tag=3,i.payload={element:null},i.callback=function(){zu(n,a)},i}function Ay(n){return n=or(n),n.tag=3,n}function My(n,a,i,d){var _=i.type.getDerivedStateFromError;if(typeof _=="function"){var w=d.value;n.payload=function(){return _(w)},n.callback=function(){Ty(a,i,d)}}var A=i.stateNode;A!==null&&typeof A.componentDidCatch=="function"&&(n.callback=function(){Ty(a,i,d),typeof _!="function"&&(pr===null?pr=new Set([this]):pr.add(this));var V=d.stack;this.componentDidCatch(d.value,{componentStack:V!==null?V:""})})}function mR(n,a,i,d,_){if(i.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(a=i.alternate,a!==null&&Jo(a,i,_,!0),i=hs.current,i!==null){switch(i.tag){case 31:case 13:return As===null?Gu():i.alternate===null&&un===0&&(un=3),i.flags&=-257,i.flags|=65536,i.lanes=_,d===yu?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([d]):a.add(d),Jm(n,d,_)),!1;case 22:return i.flags|=65536,d===yu?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([d])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([d]):i.add(d)),Jm(n,d,_)),!1}throw Error(o(435,i.tag))}return Jm(n,d,_),Gu(),!1}if(Nt)return a=hs.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=_,d!==Yp&&(n=Error(o(422),{cause:d}),xi(Ns(n,i)))):(d!==Yp&&(a=Error(o(423),{cause:d}),xi(Ns(a,i))),n=n.current.alternate,n.flags|=65536,_&=-_,n.lanes|=_,d=Ns(d,i),_=Em(n.stateNode,d,_),am(n,_),un!==4&&(un=2)),!1;var w=Error(o(520),{cause:d});if(w=Ns(w,i),Li===null?Li=[w]:Li.push(w),un!==4&&(un=2),a===null)return!0;d=Ns(d,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,n=_&-_,i.lanes|=n,n=Em(i.stateNode,d,n),am(i,n),!1;case 1:if(a=i.type,w=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(pr===null||!pr.has(w))))return i.flags|=65536,_&=-_,i.lanes|=_,_=Ay(_),My(_,n,i,d),am(i,_),!1}i=i.return}while(i!==null);return!1}var Rm=Error(o(461)),_n=!1;function Pn(n,a,i,d){a.child=n===null?Lv(a,null,i,d):no(a,n.child,i,d)}function Oy(n,a,i,d,_){i=i.render;var w=a.ref;if("ref"in d){var A={};for(var V in d)V!=="ref"&&(A[V]=d[V])}else A=d;return Zr(a),d=um(n,a,i,A,w,_),V=dm(),n!==null&&!_n?(fm(n,a,_),Ea(n,a,_)):(Nt&&V&&Fp(a),a.flags|=1,Pn(n,a,d,_),a.child)}function zy(n,a,i,d,_){if(n===null){var w=i.type;return typeof w=="function"&&!Vp(w)&&w.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=w,Dy(n,a,w,d,_)):(n=hu(i.type,null,d,a,a.mode,_),n.ref=a.ref,n.return=a,a.child=n)}if(w=n.child,!Pm(n,_)){var A=w.memoizedProps;if(i=i.compare,i=i!==null?i:mi,i(A,d)&&n.ref===a.ref)return Ea(n,a,_)}return a.flags|=1,n=ja(w,d),n.ref=a.ref,n.return=a,a.child=n}function Dy(n,a,i,d,_){if(n!==null){var w=n.memoizedProps;if(mi(w,d)&&n.ref===a.ref)if(_n=!1,a.pendingProps=d=w,Pm(n,_))(n.flags&131072)!==0&&(_n=!0);else return a.lanes=n.lanes,Ea(n,a,_)}return Tm(n,a,i,d,_)}function Ly(n,a,i,d){var _=d.children,w=n!==null?n.memoizedState:null;if(n===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((a.flags&128)!==0){if(w=w!==null?w.baseLanes|i:i,n!==null){for(d=a.child=n.child,_=0;d!==null;)_=_|d.lanes|d.childLanes,d=d.sibling;d=_&~w}else d=0,a.child=null;return Py(n,a,w,i,d)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},n!==null&&_u(a,w!==null?w.cachePool:null),w!==null?Bv(a,w):om(),Uv(a);else return d=a.lanes=536870912,Py(n,a,w!==null?w.baseLanes|i:i,i,d)}else w!==null?(_u(a,w.cachePool),Bv(a,w),cr(),a.memoizedState=null):(n!==null&&_u(a,null),om(),cr());return Pn(n,a,_,i),a.child}function Ri(n,a){return n!==null&&n.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Py(n,a,i,d,_){var w=em();return w=w===null?null:{parent:xn._currentValue,pool:w},a.memoizedState={baseLanes:i,cachePool:w},n!==null&&_u(a,null),om(),Uv(a),n!==null&&Jo(n,a,d,!0),a.childLanes=_,null}function Du(n,a){return a=Pu({mode:a.mode,children:a.children},n.mode),a.ref=n.ref,n.child=a,a.return=n,a}function Iy(n,a,i){return no(a,n.child,null,i),n=Du(a,a.pendingProps),n.flags|=2,gs(a),a.memoizedState=null,n}function hR(n,a,i){var d=a.pendingProps,_=(a.flags&128)!==0;if(a.flags&=-129,n===null){if(Nt){if(d.mode==="hidden")return n=Du(a,d),a.lanes=536870912,Ri(null,n);if(im(a),(n=Jt)?(n=Q0(n,Ts),n=n!==null&&n.data==="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:tr!==null?{id:Qs,overflow:Ws}:null,retryLane:536870912,hydrationErrors:null},i=yv(n),i.return=a,a.child=i,Dn=a,Jt=null)):n=null,n===null)throw sr(a);return a.lanes=536870912,null}return Du(a,d)}var w=n.memoizedState;if(w!==null){var A=w.dehydrated;if(im(a),_)if(a.flags&256)a.flags&=-257,a=Iy(n,a,i);else if(a.memoizedState!==null)a.child=n.child,a.flags|=128,a=null;else throw Error(o(558));else if(_n||Jo(n,a,i,!1),_=(i&n.childLanes)!==0,_n||_){if(d=Ft,d!==null&&(A=ba(d,i),A!==0&&A!==w.retryLane))throw w.retryLane=A,Kr(n,A),os(d,n,A),Rm;Gu(),a=Iy(n,a,i)}else n=w.treeContext,Jt=Ms(A.nextSibling),Dn=a,Nt=!0,nr=null,Ts=!1,n!==null&&kv(a,n),a=Du(a,d),a.flags|=4096;return a}return n=ja(n.child,{mode:d.mode,children:d.children}),n.ref=a.ref,a.child=n,n.return=a,n}function Lu(n,a){var i=a.ref;if(i===null)n!==null&&n.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(n===null||n.ref!==i)&&(a.flags|=4194816)}}function Tm(n,a,i,d,_){return Zr(a),i=um(n,a,i,d,void 0,_),d=dm(),n!==null&&!_n?(fm(n,a,_),Ea(n,a,_)):(Nt&&d&&Fp(a),a.flags|=1,Pn(n,a,i,_),a.child)}function By(n,a,i,d,_,w){return Zr(a),a.updateQueue=null,i=Vv(a,d,i,_),Hv(n),d=dm(),n!==null&&!_n?(fm(n,a,w),Ea(n,a,w)):(Nt&&d&&Fp(a),a.flags|=1,Pn(n,a,i,w),a.child)}function Uy(n,a,i,d,_){if(Zr(a),a.stateNode===null){var w=Xo,A=i.contextType;typeof A=="object"&&A!==null&&(w=Ln(A)),w=new i(d,w),a.memoizedState=w.state!==null&&w.state!==void 0?w.state:null,w.updater=Nm,a.stateNode=w,w._reactInternals=a,w=a.stateNode,w.props=d,w.state=a.memoizedState,w.refs={},nm(a),A=i.contextType,w.context=typeof A=="object"&&A!==null?Ln(A):Xo,w.state=a.memoizedState,A=i.getDerivedStateFromProps,typeof A=="function"&&(Cm(a,i,A,d),w.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof w.getSnapshotBeforeUpdate=="function"||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(A=w.state,typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount(),A!==w.state&&Nm.enqueueReplaceState(w,w.state,null),ki(a,d,w,_),wi(),w.state=a.memoizedState),typeof w.componentDidMount=="function"&&(a.flags|=4194308),d=!0}else if(n===null){w=a.stateNode;var V=a.memoizedProps,Q=ao(i,V);w.props=Q;var re=w.context,ge=i.contextType;A=Xo,typeof ge=="object"&&ge!==null&&(A=Ln(ge));var ye=i.getDerivedStateFromProps;ge=typeof ye=="function"||typeof w.getSnapshotBeforeUpdate=="function",V=a.pendingProps!==V,ge||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(V||re!==A)&&Cy(a,w,d,A),rr=!1;var oe=a.memoizedState;w.state=oe,ki(a,d,w,_),wi(),re=a.memoizedState,V||oe!==re||rr?(typeof ye=="function"&&(Cm(a,i,ye,d),re=a.memoizedState),(Q=rr||Sy(a,i,Q,d,oe,re,A))?(ge||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(a.flags|=4194308)):(typeof w.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=d,a.memoizedState=re),w.props=d,w.state=re,w.context=A,d=Q):(typeof w.componentDidMount=="function"&&(a.flags|=4194308),d=!1)}else{w=a.stateNode,sm(n,a),A=a.memoizedProps,ge=ao(i,A),w.props=ge,ye=a.pendingProps,oe=w.context,re=i.contextType,Q=Xo,typeof re=="object"&&re!==null&&(Q=Ln(re)),V=i.getDerivedStateFromProps,(re=typeof V=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(A!==ye||oe!==Q)&&Cy(a,w,d,Q),rr=!1,oe=a.memoizedState,w.state=oe,ki(a,d,w,_),wi();var fe=a.memoizedState;A!==ye||oe!==fe||rr||n!==null&&n.dependencies!==null&&xu(n.dependencies)?(typeof V=="function"&&(Cm(a,i,V,d),fe=a.memoizedState),(ge=rr||Sy(a,i,ge,d,oe,fe,Q)||n!==null&&n.dependencies!==null&&xu(n.dependencies))?(re||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(d,fe,Q),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(d,fe,Q)),typeof w.componentDidUpdate=="function"&&(a.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof w.componentDidUpdate!="function"||A===n.memoizedProps&&oe===n.memoizedState||(a.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&oe===n.memoizedState||(a.flags|=1024),a.memoizedProps=d,a.memoizedState=fe),w.props=d,w.state=fe,w.context=Q,d=ge):(typeof w.componentDidUpdate!="function"||A===n.memoizedProps&&oe===n.memoizedState||(a.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||A===n.memoizedProps&&oe===n.memoizedState||(a.flags|=1024),d=!1)}return w=d,Lu(n,a),d=(a.flags&128)!==0,w||d?(w=a.stateNode,i=d&&typeof i.getDerivedStateFromError!="function"?null:w.render(),a.flags|=1,n!==null&&d?(a.child=no(a,n.child,null,_),a.child=no(a,null,i,_)):Pn(n,a,i,_),a.memoizedState=w.state,n=a.child):n=Ea(n,a,_),n}function Hy(n,a,i,d){return Qr(),a.flags|=256,Pn(n,a,i,d),a.child}var Am={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Mm(n){return{baseLanes:n,cachePool:Tv()}}function Om(n,a,i){return n=n!==null?n.childLanes&~i:0,a&&(n|=bs),n}function Vy(n,a,i){var d=a.pendingProps,_=!1,w=(a.flags&128)!==0,A;if((A=w)||(A=n!==null&&n.memoizedState===null?!1:(hn.current&2)!==0),A&&(_=!0,a.flags&=-129),A=(a.flags&32)!==0,a.flags&=-33,n===null){if(Nt){if(_?ir(a):cr(),(n=Jt)?(n=Q0(n,Ts),n=n!==null&&n.data!=="&"?n:null,n!==null&&(a.memoizedState={dehydrated:n,treeContext:tr!==null?{id:Qs,overflow:Ws}:null,retryLane:536870912,hydrationErrors:null},i=yv(n),i.return=a,a.child=i,Dn=a,Jt=null)):n=null,n===null)throw sr(a);return hh(n)?a.lanes=32:a.lanes=536870912,null}var V=d.children;return d=d.fallback,_?(cr(),_=a.mode,V=Pu({mode:"hidden",children:V},_),d=Xr(d,_,i,null),V.return=a,d.return=a,V.sibling=d,a.child=V,d=a.child,d.memoizedState=Mm(i),d.childLanes=Om(n,A,i),a.memoizedState=Am,Ri(null,d)):(ir(a),zm(a,V))}var Q=n.memoizedState;if(Q!==null&&(V=Q.dehydrated,V!==null)){if(w)a.flags&256?(ir(a),a.flags&=-257,a=Dm(n,a,i)):a.memoizedState!==null?(cr(),a.child=n.child,a.flags|=128,a=null):(cr(),V=d.fallback,_=a.mode,d=Pu({mode:"visible",children:d.children},_),V=Xr(V,_,i,null),V.flags|=2,d.return=a,V.return=a,d.sibling=V,a.child=d,no(a,n.child,null,i),d=a.child,d.memoizedState=Mm(i),d.childLanes=Om(n,A,i),a.memoizedState=Am,a=Ri(null,d));else if(ir(a),hh(V)){if(A=V.nextSibling&&V.nextSibling.dataset,A)var re=A.dgst;A=re,d=Error(o(419)),d.stack="",d.digest=A,xi({value:d,source:null,stack:null}),a=Dm(n,a,i)}else if(_n||Jo(n,a,i,!1),A=(i&n.childLanes)!==0,_n||A){if(A=Ft,A!==null&&(d=ba(A,i),d!==0&&d!==Q.retryLane))throw Q.retryLane=d,Kr(n,d),os(A,n,d),Rm;mh(V)||Gu(),a=Dm(n,a,i)}else mh(V)?(a.flags|=192,a.child=n.child,a=null):(n=Q.treeContext,Jt=Ms(V.nextSibling),Dn=a,Nt=!0,nr=null,Ts=!1,n!==null&&kv(a,n),a=zm(a,d.children),a.flags|=4096);return a}return _?(cr(),V=d.fallback,_=a.mode,Q=n.child,re=Q.sibling,d=ja(Q,{mode:"hidden",children:d.children}),d.subtreeFlags=Q.subtreeFlags&65011712,re!==null?V=ja(re,V):(V=Xr(V,_,i,null),V.flags|=2),V.return=a,d.return=a,d.sibling=V,a.child=d,Ri(null,d),d=a.child,V=n.child.memoizedState,V===null?V=Mm(i):(_=V.cachePool,_!==null?(Q=xn._currentValue,_=_.parent!==Q?{parent:Q,pool:Q}:_):_=Tv(),V={baseLanes:V.baseLanes|i,cachePool:_}),d.memoizedState=V,d.childLanes=Om(n,A,i),a.memoizedState=Am,Ri(n.child,d)):(ir(a),i=n.child,n=i.sibling,i=ja(i,{mode:"visible",children:d.children}),i.return=a,i.sibling=null,n!==null&&(A=a.deletions,A===null?(a.deletions=[n],a.flags|=16):A.push(n)),a.child=i,a.memoizedState=null,i)}function zm(n,a){return a=Pu({mode:"visible",children:a},n.mode),a.return=n,n.child=a}function Pu(n,a){return n=ms(22,n,null,a),n.lanes=0,n}function Dm(n,a,i){return no(a,n.child,null,i),n=zm(a,a.pendingProps.children),n.flags|=2,a.memoizedState=null,n}function qy(n,a,i){n.lanes|=a;var d=n.alternate;d!==null&&(d.lanes|=a),Qp(n.return,a,i)}function Lm(n,a,i,d,_,w){var A=n.memoizedState;A===null?n.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:d,tail:i,tailMode:_,treeForkCount:w}:(A.isBackwards=a,A.rendering=null,A.renderingStartTime=0,A.last=d,A.tail=i,A.tailMode=_,A.treeForkCount=w)}function $y(n,a,i){var d=a.pendingProps,_=d.revealOrder,w=d.tail;d=d.children;var A=hn.current,V=(A&2)!==0;if(V?(A=A&1|2,a.flags|=128):A&=1,Z(hn,A),Pn(n,a,d,i),d=Nt?gi:0,!V&&n!==null&&(n.flags&128)!==0)e:for(n=a.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&qy(n,i,a);else if(n.tag===19)qy(n,i,a);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===a)break e;for(;n.sibling===null;){if(n.return===null||n.return===a)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(_){case"forwards":for(i=a.child,_=null;i!==null;)n=i.alternate,n!==null&&Su(n)===null&&(_=i),i=i.sibling;i=_,i===null?(_=a.child,a.child=null):(_=i.sibling,i.sibling=null),Lm(a,!1,_,i,w,d);break;case"backwards":case"unstable_legacy-backwards":for(i=null,_=a.child,a.child=null;_!==null;){if(n=_.alternate,n!==null&&Su(n)===null){a.child=_;break}n=_.sibling,_.sibling=i,i=_,_=n}Lm(a,!0,i,null,w,d);break;case"together":Lm(a,!1,null,null,void 0,d);break;default:a.memoizedState=null}return a.child}function Ea(n,a,i){if(n!==null&&(a.dependencies=n.dependencies),fr|=a.lanes,(i&a.childLanes)===0)if(n!==null){if(Jo(n,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(n!==null&&a.child!==n.child)throw Error(o(153));if(a.child!==null){for(n=a.child,i=ja(n,n.pendingProps),a.child=i,i.return=a;n.sibling!==null;)n=n.sibling,i=i.sibling=ja(n,n.pendingProps),i.return=a;i.sibling=null}return a.child}function Pm(n,a){return(n.lanes&a)!==0?!0:(n=n.dependencies,!!(n!==null&&xu(n)))}function gR(n,a,i){switch(a.tag){case 3:ae(a,a.stateNode.containerInfo),ar(a,xn,n.memoizedState.cache),Qr();break;case 27:case 5:Me(a);break;case 4:ae(a,a.stateNode.containerInfo);break;case 10:ar(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,im(a),null;break;case 13:var d=a.memoizedState;if(d!==null)return d.dehydrated!==null?(ir(a),a.flags|=128,null):(i&a.child.childLanes)!==0?Vy(n,a,i):(ir(a),n=Ea(n,a,i),n!==null?n.sibling:null);ir(a);break;case 19:var _=(n.flags&128)!==0;if(d=(i&a.childLanes)!==0,d||(Jo(n,a,i,!1),d=(i&a.childLanes)!==0),_){if(d)return $y(n,a,i);a.flags|=128}if(_=a.memoizedState,_!==null&&(_.rendering=null,_.tail=null,_.lastEffect=null),Z(hn,hn.current),d)break;return null;case 22:return a.lanes=0,Ly(n,a,i,a.pendingProps);case 24:ar(a,xn,n.memoizedState.cache)}return Ea(n,a,i)}function Fy(n,a,i){if(n!==null)if(n.memoizedProps!==a.pendingProps)_n=!0;else{if(!Pm(n,i)&&(a.flags&128)===0)return _n=!1,gR(n,a,i);_n=(n.flags&131072)!==0}else _n=!1,Nt&&(a.flags&1048576)!==0&&wv(a,gi,a.index);switch(a.lanes=0,a.tag){case 16:e:{var d=a.pendingProps;if(n=eo(a.elementType),a.type=n,typeof n=="function")Vp(n)?(d=ao(n,d),a.tag=1,a=Uy(null,a,n,d,i)):(a.tag=0,a=Tm(null,a,n,d,i));else{if(n!=null){var _=n.$$typeof;if(_===R){a.tag=11,a=Oy(null,a,n,d,i);break e}else if(_===z){a.tag=14,a=zy(null,a,n,d,i);break e}}throw a=B(n)||n,Error(o(306,a,""))}}return a;case 0:return Tm(n,a,a.type,a.pendingProps,i);case 1:return d=a.type,_=ao(d,a.pendingProps),Uy(n,a,d,_,i);case 3:e:{if(ae(a,a.stateNode.containerInfo),n===null)throw Error(o(387));d=a.pendingProps;var w=a.memoizedState;_=w.element,sm(n,a),ki(a,d,null,i);var A=a.memoizedState;if(d=A.cache,ar(a,xn,d),d!==w.cache&&Wp(a,[xn],i,!0),wi(),d=A.element,w.isDehydrated)if(w={element:d,isDehydrated:!1,cache:A.cache},a.updateQueue.baseState=w,a.memoizedState=w,a.flags&256){a=Hy(n,a,d,i);break e}else if(d!==_){_=Ns(Error(o(424)),a),xi(_),a=Hy(n,a,d,i);break e}else{switch(n=a.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(Jt=Ms(n.firstChild),Dn=a,Nt=!0,nr=null,Ts=!0,i=Lv(a,null,d,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(Qr(),d===_){a=Ea(n,a,i);break e}Pn(n,a,d,i)}a=a.child}return a;case 26:return Lu(n,a),n===null?(i=n1(a.type,null,a.pendingProps,null))?a.memoizedState=i:Nt||(i=a.type,n=a.pendingProps,d=Ju(ee.current).createElement(i),d[$t]=a,d[zn]=n,In(d,i,n),Nn(d),a.stateNode=d):a.memoizedState=n1(a.type,n.memoizedProps,a.pendingProps,n.memoizedState),null;case 27:return Me(a),n===null&&Nt&&(d=a.stateNode=J0(a.type,a.pendingProps,ee.current),Dn=a,Ts=!0,_=Jt,xr(a.type)?(gh=_,Jt=Ms(d.firstChild)):Jt=_),Pn(n,a,a.pendingProps.children,i),Lu(n,a),n===null&&(a.flags|=4194304),a.child;case 5:return n===null&&Nt&&((_=d=Jt)&&(d=GR(d,a.type,a.pendingProps,Ts),d!==null?(a.stateNode=d,Dn=a,Jt=Ms(d.firstChild),Ts=!1,_=!0):_=!1),_||sr(a)),Me(a),_=a.type,w=a.pendingProps,A=n!==null?n.memoizedProps:null,d=w.children,dh(_,w)?d=null:A!==null&&dh(_,A)&&(a.flags|=32),a.memoizedState!==null&&(_=um(n,a,lR,null,null,i),$i._currentValue=_),Lu(n,a),Pn(n,a,d,i),a.child;case 6:return n===null&&Nt&&((n=i=Jt)&&(i=YR(i,a.pendingProps,Ts),i!==null?(a.stateNode=i,Dn=a,Jt=null,n=!0):n=!1),n||sr(a)),null;case 13:return Vy(n,a,i);case 4:return ae(a,a.stateNode.containerInfo),d=a.pendingProps,n===null?a.child=no(a,null,d,i):Pn(n,a,d,i),a.child;case 11:return Oy(n,a,a.type,a.pendingProps,i);case 7:return Pn(n,a,a.pendingProps,i),a.child;case 8:return Pn(n,a,a.pendingProps.children,i),a.child;case 12:return Pn(n,a,a.pendingProps.children,i),a.child;case 10:return d=a.pendingProps,ar(a,a.type,d.value),Pn(n,a,d.children,i),a.child;case 9:return _=a.type._context,d=a.pendingProps.children,Zr(a),_=Ln(_),d=d(_),a.flags|=1,Pn(n,a,d,i),a.child;case 14:return zy(n,a,a.type,a.pendingProps,i);case 15:return Dy(n,a,a.type,a.pendingProps,i);case 19:return $y(n,a,i);case 31:return hR(n,a,i);case 22:return Ly(n,a,i,a.pendingProps);case 24:return Zr(a),d=Ln(xn),n===null?(_=em(),_===null&&(_=Ft,w=Zp(),_.pooledCache=w,w.refCount++,w!==null&&(_.pooledCacheLanes|=i),_=w),a.memoizedState={parent:d,cache:_},nm(a),ar(a,xn,_)):((n.lanes&i)!==0&&(sm(n,a),ki(a,null,null,i),wi()),_=n.memoizedState,w=a.memoizedState,_.parent!==d?(_={parent:d,cache:d},a.memoizedState=_,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=_),ar(a,xn,d)):(d=w.cache,ar(a,xn,d),d!==_.cache&&Wp(a,[xn],i,!0))),Pn(n,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(o(156,a.tag))}function Ra(n){n.flags|=4}function Im(n,a,i,d,_){if((a=(n.mode&32)!==0)&&(a=!1),a){if(n.flags|=16777216,(_&335544128)===_)if(n.stateNode.complete)n.flags|=8192;else if(b0())n.flags|=8192;else throw to=yu,tm}else n.flags&=-16777217}function Gy(n,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!l1(a))if(b0())n.flags|=8192;else throw to=yu,tm}function Iu(n,a){a!==null&&(n.flags|=4),n.flags&16384&&(a=n.tag!==22?fs():536870912,n.lanes|=a,dl|=a)}function Ti(n,a){if(!Nt)switch(n.tailMode){case"hidden":a=n.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?n.tail=null:i.sibling=null;break;case"collapsed":i=n.tail;for(var d=null;i!==null;)i.alternate!==null&&(d=i),i=i.sibling;d===null?a||n.tail===null?n.tail=null:n.tail.sibling=null:d.sibling=null}}function en(n){var a=n.alternate!==null&&n.alternate.child===n.child,i=0,d=0;if(a)for(var _=n.child;_!==null;)i|=_.lanes|_.childLanes,d|=_.subtreeFlags&65011712,d|=_.flags&65011712,_.return=n,_=_.sibling;else for(_=n.child;_!==null;)i|=_.lanes|_.childLanes,d|=_.subtreeFlags,d|=_.flags,_.return=n,_=_.sibling;return n.subtreeFlags|=d,n.childLanes=i,a}function xR(n,a,i){var d=a.pendingProps;switch(Gp(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return en(a),null;case 1:return en(a),null;case 3:return i=a.stateNode,d=null,n!==null&&(d=n.memoizedState.cache),a.memoizedState.cache!==d&&(a.flags|=2048),Sa(xn),pe(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(Zo(a)?Ra(a):n===null||n.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Kp())),en(a),null;case 26:var _=a.type,w=a.memoizedState;return n===null?(Ra(a),w!==null?(en(a),Gy(a,w)):(en(a),Im(a,_,null,d,i))):w?w!==n.memoizedState?(Ra(a),en(a),Gy(a,w)):(en(a),a.flags&=-16777217):(n=n.memoizedProps,n!==d&&Ra(a),en(a),Im(a,_,n,d,i)),null;case 27:if(ue(a),i=ee.current,_=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==d&&Ra(a);else{if(!d){if(a.stateNode===null)throw Error(o(166));return en(a),null}n=te.current,Zo(a)?Sv(a):(n=J0(_,d,i),a.stateNode=n,Ra(a))}return en(a),null;case 5:if(ue(a),_=a.type,n!==null&&a.stateNode!=null)n.memoizedProps!==d&&Ra(a);else{if(!d){if(a.stateNode===null)throw Error(o(166));return en(a),null}if(w=te.current,Zo(a))Sv(a);else{var A=Ju(ee.current);switch(w){case 1:w=A.createElementNS("http://www.w3.org/2000/svg",_);break;case 2:w=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;default:switch(_){case"svg":w=A.createElementNS("http://www.w3.org/2000/svg",_);break;case"math":w=A.createElementNS("http://www.w3.org/1998/Math/MathML",_);break;case"script":w=A.createElement("div"),w.innerHTML="<script><\/script>",w=w.removeChild(w.firstChild);break;case"select":w=typeof d.is=="string"?A.createElement("select",{is:d.is}):A.createElement("select"),d.multiple?w.multiple=!0:d.size&&(w.size=d.size);break;default:w=typeof d.is=="string"?A.createElement(_,{is:d.is}):A.createElement(_)}}w[$t]=a,w[zn]=d;e:for(A=a.child;A!==null;){if(A.tag===5||A.tag===6)w.appendChild(A.stateNode);else if(A.tag!==4&&A.tag!==27&&A.child!==null){A.child.return=A,A=A.child;continue}if(A===a)break e;for(;A.sibling===null;){if(A.return===null||A.return===a)break e;A=A.return}A.sibling.return=A.return,A=A.sibling}a.stateNode=w;e:switch(In(w,_,d),_){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&Ra(a)}}return en(a),Im(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,i),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==d&&Ra(a);else{if(typeof d!="string"&&a.stateNode===null)throw Error(o(166));if(n=ee.current,Zo(a)){if(n=a.stateNode,i=a.memoizedProps,d=null,_=Dn,_!==null)switch(_.tag){case 27:case 5:d=_.memoizedProps}n[$t]=a,n=!!(n.nodeValue===i||d!==null&&d.suppressHydrationWarning===!0||V0(n.nodeValue,i)),n||sr(a,!0)}else n=Ju(n).createTextNode(d),n[$t]=a,a.stateNode=n}return en(a),null;case 31:if(i=a.memoizedState,n===null||n.memoizedState!==null){if(d=Zo(a),i!==null){if(n===null){if(!d)throw Error(o(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[$t]=a}else Qr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;en(a),n=!1}else i=Kp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return a.flags&256?(gs(a),a):(gs(a),null);if((a.flags&128)!==0)throw Error(o(558))}return en(a),null;case 13:if(d=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(_=Zo(a),d!==null&&d.dehydrated!==null){if(n===null){if(!_)throw Error(o(318));if(_=a.memoizedState,_=_!==null?_.dehydrated:null,!_)throw Error(o(317));_[$t]=a}else Qr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;en(a),_=!1}else _=Kp(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=_),_=!0;if(!_)return a.flags&256?(gs(a),a):(gs(a),null)}return gs(a),(a.flags&128)!==0?(a.lanes=i,a):(i=d!==null,n=n!==null&&n.memoizedState!==null,i&&(d=a.child,_=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(_=d.alternate.memoizedState.cachePool.pool),w=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(w=d.memoizedState.cachePool.pool),w!==_&&(d.flags|=2048)),i!==n&&i&&(a.child.flags|=8192),Iu(a,a.updateQueue),en(a),null);case 4:return pe(),n===null&&oh(a.stateNode.containerInfo),en(a),null;case 10:return Sa(a.type),en(a),null;case 19:if(G(hn),d=a.memoizedState,d===null)return en(a),null;if(_=(a.flags&128)!==0,w=d.rendering,w===null)if(_)Ti(d,!1);else{if(un!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(w=Su(n),w!==null){for(a.flags|=128,Ti(d,!1),n=w.updateQueue,a.updateQueue=n,Iu(a,n),a.subtreeFlags=0,n=i,i=a.child;i!==null;)vv(i,n),i=i.sibling;return Z(hn,hn.current&1|2),Nt&&wa(a,d.treeForkCount),a.child}n=n.sibling}d.tail!==null&&le()>qu&&(a.flags|=128,_=!0,Ti(d,!1),a.lanes=4194304)}else{if(!_)if(n=Su(w),n!==null){if(a.flags|=128,_=!0,n=n.updateQueue,a.updateQueue=n,Iu(a,n),Ti(d,!0),d.tail===null&&d.tailMode==="hidden"&&!w.alternate&&!Nt)return en(a),null}else 2*le()-d.renderingStartTime>qu&&i!==536870912&&(a.flags|=128,_=!0,Ti(d,!1),a.lanes=4194304);d.isBackwards?(w.sibling=a.child,a.child=w):(n=d.last,n!==null?n.sibling=w:a.child=w,d.last=w)}return d.tail!==null?(n=d.tail,d.rendering=n,d.tail=n.sibling,d.renderingStartTime=le(),n.sibling=null,i=hn.current,Z(hn,_?i&1|2:i&1),Nt&&wa(a,d.treeForkCount),n):(en(a),null);case 22:case 23:return gs(a),lm(),d=a.memoizedState!==null,n!==null?n.memoizedState!==null!==d&&(a.flags|=8192):d&&(a.flags|=8192),d?(i&536870912)!==0&&(a.flags&128)===0&&(en(a),a.subtreeFlags&6&&(a.flags|=8192)):en(a),i=a.updateQueue,i!==null&&Iu(a,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),d=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(d=a.memoizedState.cachePool.pool),d!==i&&(a.flags|=2048),n!==null&&G(Jr),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),Sa(xn),en(a),null;case 25:return null;case 30:return null}throw Error(o(156,a.tag))}function bR(n,a){switch(Gp(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Sa(xn),pe(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return ue(a),null;case 31:if(a.memoizedState!==null){if(gs(a),a.alternate===null)throw Error(o(340));Qr()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(gs(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(o(340));Qr()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return G(hn),null;case 4:return pe(),null;case 10:return Sa(a.type),null;case 22:case 23:return gs(a),lm(),n!==null&&G(Jr),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Sa(xn),null;case 25:return null;default:return null}}function Yy(n,a){switch(Gp(a),a.tag){case 3:Sa(xn),pe();break;case 26:case 27:case 5:ue(a);break;case 4:pe();break;case 31:a.memoizedState!==null&&gs(a);break;case 13:gs(a);break;case 19:G(hn);break;case 10:Sa(a.type);break;case 22:case 23:gs(a),lm(),n!==null&&G(Jr);break;case 24:Sa(xn)}}function Ai(n,a){try{var i=a.updateQueue,d=i!==null?i.lastEffect:null;if(d!==null){var _=d.next;i=_;do{if((i.tag&n)===n){d=void 0;var w=i.create,A=i.inst;d=w(),A.destroy=d}i=i.next}while(i!==_)}}catch(V){Lt(a,a.return,V)}}function ur(n,a,i){try{var d=a.updateQueue,_=d!==null?d.lastEffect:null;if(_!==null){var w=_.next;d=w;do{if((d.tag&n)===n){var A=d.inst,V=A.destroy;if(V!==void 0){A.destroy=void 0,_=a;var Q=i,re=V;try{re()}catch(ge){Lt(_,Q,ge)}}}d=d.next}while(d!==w)}}catch(ge){Lt(a,a.return,ge)}}function Ky(n){var a=n.updateQueue;if(a!==null){var i=n.stateNode;try{Iv(a,i)}catch(d){Lt(n,n.return,d)}}}function Xy(n,a,i){i.props=ao(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(d){Lt(n,a,d)}}function Mi(n,a){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var d=n.stateNode;break;case 30:d=n.stateNode;break;default:d=n.stateNode}typeof i=="function"?n.refCleanup=i(d):i.current=d}}catch(_){Lt(n,a,_)}}function Zs(n,a){var i=n.ref,d=n.refCleanup;if(i!==null)if(typeof d=="function")try{d()}catch(_){Lt(n,a,_)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(_){Lt(n,a,_)}else i.current=null}function Qy(n){var a=n.type,i=n.memoizedProps,d=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&d.focus();break e;case"img":i.src?d.src=i.src:i.srcSet&&(d.srcset=i.srcSet)}}catch(_){Lt(n,n.return,_)}}function Bm(n,a,i){try{var d=n.stateNode;UR(d,n.type,i,a),d[zn]=a}catch(_){Lt(n,n.return,_)}}function Wy(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&xr(n.type)||n.tag===4}function Um(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Wy(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&xr(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Hm(n,a,i){var d=n.tag;if(d===5||d===6)n=n.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(n,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(n),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=va));else if(d!==4&&(d===27&&xr(n.type)&&(i=n.stateNode,a=null),n=n.child,n!==null))for(Hm(n,a,i),n=n.sibling;n!==null;)Hm(n,a,i),n=n.sibling}function Bu(n,a,i){var d=n.tag;if(d===5||d===6)n=n.stateNode,a?i.insertBefore(n,a):i.appendChild(n);else if(d!==4&&(d===27&&xr(n.type)&&(i=n.stateNode),n=n.child,n!==null))for(Bu(n,a,i),n=n.sibling;n!==null;)Bu(n,a,i),n=n.sibling}function Zy(n){var a=n.stateNode,i=n.memoizedProps;try{for(var d=n.type,_=a.attributes;_.length;)a.removeAttributeNode(_[0]);In(a,d,i),a[$t]=n,a[zn]=i}catch(w){Lt(n,n.return,w)}}var Ta=!1,vn=!1,Vm=!1,Jy=typeof WeakSet=="function"?WeakSet:Set,En=null;function _R(n,a){if(n=n.containerInfo,ch=od,n=dv(n),Dp(n)){if("selectionStart"in n)var i={start:n.selectionStart,end:n.selectionEnd};else e:{i=(i=n.ownerDocument)&&i.defaultView||window;var d=i.getSelection&&i.getSelection();if(d&&d.rangeCount!==0){i=d.anchorNode;var _=d.anchorOffset,w=d.focusNode;d=d.focusOffset;try{i.nodeType,w.nodeType}catch{i=null;break e}var A=0,V=-1,Q=-1,re=0,ge=0,ye=n,oe=null;t:for(;;){for(var fe;ye!==i||_!==0&&ye.nodeType!==3||(V=A+_),ye!==w||d!==0&&ye.nodeType!==3||(Q=A+d),ye.nodeType===3&&(A+=ye.nodeValue.length),(fe=ye.firstChild)!==null;)oe=ye,ye=fe;for(;;){if(ye===n)break t;if(oe===i&&++re===_&&(V=A),oe===w&&++ge===d&&(Q=A),(fe=ye.nextSibling)!==null)break;ye=oe,oe=ye.parentNode}ye=fe}i=V===-1||Q===-1?null:{start:V,end:Q}}else i=null}i=i||{start:0,end:0}}else i=null;for(uh={focusedElem:n,selectionRange:i},od=!1,En=a;En!==null;)if(a=En,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,En=n;else for(;En!==null;){switch(a=En,w=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(i=0;i<n.length;i++)_=n[i],_.ref.impl=_.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&w!==null){n=void 0,i=a,_=w.memoizedProps,w=w.memoizedState,d=i.stateNode;try{var Ve=ao(i.type,_);n=d.getSnapshotBeforeUpdate(Ve,w),d.__reactInternalSnapshotBeforeUpdate=n}catch(st){Lt(i,i.return,st)}}break;case 3:if((n&1024)!==0){if(n=a.stateNode.containerInfo,i=n.nodeType,i===9)ph(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":ph(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(o(163))}if(n=a.sibling,n!==null){n.return=a.return,En=n;break}En=a.return}}function e0(n,a,i){var d=i.flags;switch(i.tag){case 0:case 11:case 15:Ma(n,i),d&4&&Ai(5,i);break;case 1:if(Ma(n,i),d&4)if(n=i.stateNode,a===null)try{n.componentDidMount()}catch(A){Lt(i,i.return,A)}else{var _=ao(i.type,a.memoizedProps);a=a.memoizedState;try{n.componentDidUpdate(_,a,n.__reactInternalSnapshotBeforeUpdate)}catch(A){Lt(i,i.return,A)}}d&64&&Ky(i),d&512&&Mi(i,i.return);break;case 3:if(Ma(n,i),d&64&&(n=i.updateQueue,n!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{Iv(n,a)}catch(A){Lt(i,i.return,A)}}break;case 27:a===null&&d&4&&Zy(i);case 26:case 5:Ma(n,i),a===null&&d&4&&Qy(i),d&512&&Mi(i,i.return);break;case 12:Ma(n,i);break;case 31:Ma(n,i),d&4&&s0(n,i);break;case 13:Ma(n,i),d&4&&a0(n,i),d&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=ER.bind(null,i),KR(n,i))));break;case 22:if(d=i.memoizedState!==null||Ta,!d){a=a!==null&&a.memoizedState!==null||vn,_=Ta;var w=vn;Ta=d,(vn=a)&&!w?Oa(n,i,(i.subtreeFlags&8772)!==0):Ma(n,i),Ta=_,vn=w}break;case 30:break;default:Ma(n,i)}}function t0(n){var a=n.alternate;a!==null&&(n.alternate=null,t0(a)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(a=n.stateNode,a!==null&&bp(a)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var nn=null,ns=!1;function Aa(n,a,i){for(i=i.child;i!==null;)n0(n,a,i),i=i.sibling}function n0(n,a,i){if(Rt&&typeof Rt.onCommitFiberUnmount=="function")try{Rt.onCommitFiberUnmount(lt,i)}catch{}switch(i.tag){case 26:vn||Zs(i,a),Aa(n,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:vn||Zs(i,a);var d=nn,_=ns;xr(i.type)&&(nn=i.stateNode,ns=!1),Aa(n,a,i),Hi(i.stateNode),nn=d,ns=_;break;case 5:vn||Zs(i,a);case 6:if(d=nn,_=ns,nn=null,Aa(n,a,i),nn=d,ns=_,nn!==null)if(ns)try{(nn.nodeType===9?nn.body:nn.nodeName==="HTML"?nn.ownerDocument.body:nn).removeChild(i.stateNode)}catch(w){Lt(i,a,w)}else try{nn.removeChild(i.stateNode)}catch(w){Lt(i,a,w)}break;case 18:nn!==null&&(ns?(n=nn,K0(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),_l(n)):K0(nn,i.stateNode));break;case 4:d=nn,_=ns,nn=i.stateNode.containerInfo,ns=!0,Aa(n,a,i),nn=d,ns=_;break;case 0:case 11:case 14:case 15:ur(2,i,a),vn||ur(4,i,a),Aa(n,a,i);break;case 1:vn||(Zs(i,a),d=i.stateNode,typeof d.componentWillUnmount=="function"&&Xy(i,a,d)),Aa(n,a,i);break;case 21:Aa(n,a,i);break;case 22:vn=(d=vn)||i.memoizedState!==null,Aa(n,a,i),vn=d;break;default:Aa(n,a,i)}}function s0(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{_l(n)}catch(i){Lt(a,a.return,i)}}}function a0(n,a){if(a.memoizedState===null&&(n=a.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{_l(n)}catch(i){Lt(a,a.return,i)}}function vR(n){switch(n.tag){case 31:case 13:case 19:var a=n.stateNode;return a===null&&(a=n.stateNode=new Jy),a;case 22:return n=n.stateNode,a=n._retryCache,a===null&&(a=n._retryCache=new Jy),a;default:throw Error(o(435,n.tag))}}function Uu(n,a){var i=vR(n);a.forEach(function(d){if(!i.has(d)){i.add(d);var _=RR.bind(null,n,d);d.then(_,_)}})}function ss(n,a){var i=a.deletions;if(i!==null)for(var d=0;d<i.length;d++){var _=i[d],w=n,A=a,V=A;e:for(;V!==null;){switch(V.tag){case 27:if(xr(V.type)){nn=V.stateNode,ns=!1;break e}break;case 5:nn=V.stateNode,ns=!1;break e;case 3:case 4:nn=V.stateNode.containerInfo,ns=!0;break e}V=V.return}if(nn===null)throw Error(o(160));n0(w,A,_),nn=null,ns=!1,w=_.alternate,w!==null&&(w.return=null),_.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)r0(a,n),a=a.sibling}var Us=null;function r0(n,a){var i=n.alternate,d=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:ss(a,n),as(n),d&4&&(ur(3,n,n.return),Ai(3,n),ur(5,n,n.return));break;case 1:ss(a,n),as(n),d&512&&(vn||i===null||Zs(i,i.return)),d&64&&Ta&&(n=n.updateQueue,n!==null&&(d=n.callbacks,d!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?d:i.concat(d))));break;case 26:var _=Us;if(ss(a,n),as(n),d&512&&(vn||i===null||Zs(i,i.return)),d&4){var w=i!==null?i.memoizedState:null;if(d=n.memoizedState,i===null)if(d===null)if(n.stateNode===null){e:{d=n.type,i=n.memoizedProps,_=_.ownerDocument||_;t:switch(d){case"title":w=_.getElementsByTagName("title")[0],(!w||w[ri]||w[$t]||w.namespaceURI==="http://www.w3.org/2000/svg"||w.hasAttribute("itemprop"))&&(w=_.createElement(d),_.head.insertBefore(w,_.querySelector("head > title"))),In(w,d,i),w[$t]=n,Nn(w),d=w;break e;case"link":var A=r1("link","href",_).get(d+(i.href||""));if(A){for(var V=0;V<A.length;V++)if(w=A[V],w.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&w.getAttribute("rel")===(i.rel==null?null:i.rel)&&w.getAttribute("title")===(i.title==null?null:i.title)&&w.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){A.splice(V,1);break t}}w=_.createElement(d),In(w,d,i),_.head.appendChild(w);break;case"meta":if(A=r1("meta","content",_).get(d+(i.content||""))){for(V=0;V<A.length;V++)if(w=A[V],w.getAttribute("content")===(i.content==null?null:""+i.content)&&w.getAttribute("name")===(i.name==null?null:i.name)&&w.getAttribute("property")===(i.property==null?null:i.property)&&w.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&w.getAttribute("charset")===(i.charSet==null?null:i.charSet)){A.splice(V,1);break t}}w=_.createElement(d),In(w,d,i),_.head.appendChild(w);break;default:throw Error(o(468,d))}w[$t]=n,Nn(w),d=w}n.stateNode=d}else o1(_,n.type,n.stateNode);else n.stateNode=a1(_,d,n.memoizedProps);else w!==d?(w===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):w.count--,d===null?o1(_,n.type,n.stateNode):a1(_,d,n.memoizedProps)):d===null&&n.stateNode!==null&&Bm(n,n.memoizedProps,i.memoizedProps)}break;case 27:ss(a,n),as(n),d&512&&(vn||i===null||Zs(i,i.return)),i!==null&&d&4&&Bm(n,n.memoizedProps,i.memoizedProps);break;case 5:if(ss(a,n),as(n),d&512&&(vn||i===null||Zs(i,i.return)),n.flags&32){_=n.stateNode;try{Vo(_,"")}catch(Ve){Lt(n,n.return,Ve)}}d&4&&n.stateNode!=null&&(_=n.memoizedProps,Bm(n,_,i!==null?i.memoizedProps:_)),d&1024&&(Vm=!0);break;case 6:if(ss(a,n),as(n),d&4){if(n.stateNode===null)throw Error(o(162));d=n.memoizedProps,i=n.stateNode;try{i.nodeValue=d}catch(Ve){Lt(n,n.return,Ve)}}break;case 3:if(nd=null,_=Us,Us=ed(a.containerInfo),ss(a,n),Us=_,as(n),d&4&&i!==null&&i.memoizedState.isDehydrated)try{_l(a.containerInfo)}catch(Ve){Lt(n,n.return,Ve)}Vm&&(Vm=!1,o0(n));break;case 4:d=Us,Us=ed(n.stateNode.containerInfo),ss(a,n),as(n),Us=d;break;case 12:ss(a,n),as(n);break;case 31:ss(a,n),as(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Uu(n,d)));break;case 13:ss(a,n),as(n),n.child.flags&8192&&n.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(Vu=le()),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Uu(n,d)));break;case 22:_=n.memoizedState!==null;var Q=i!==null&&i.memoizedState!==null,re=Ta,ge=vn;if(Ta=re||_,vn=ge||Q,ss(a,n),vn=ge,Ta=re,as(n),d&8192)e:for(a=n.stateNode,a._visibility=_?a._visibility&-2:a._visibility|1,_&&(i===null||Q||Ta||vn||ro(n)),i=null,a=n;;){if(a.tag===5||a.tag===26){if(i===null){Q=i=a;try{if(w=Q.stateNode,_)A=w.style,typeof A.setProperty=="function"?A.setProperty("display","none","important"):A.display="none";else{V=Q.stateNode;var ye=Q.memoizedProps.style,oe=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;V.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Ve){Lt(Q,Q.return,Ve)}}}else if(a.tag===6){if(i===null){Q=a;try{Q.stateNode.nodeValue=_?"":Q.memoizedProps}catch(Ve){Lt(Q,Q.return,Ve)}}}else if(a.tag===18){if(i===null){Q=a;try{var fe=Q.stateNode;_?X0(fe,!0):X0(Q.stateNode,!1)}catch(Ve){Lt(Q,Q.return,Ve)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===n)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===n)break e;for(;a.sibling===null;){if(a.return===null||a.return===n)break e;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}d&4&&(d=n.updateQueue,d!==null&&(i=d.retryQueue,i!==null&&(d.retryQueue=null,Uu(n,i))));break;case 19:ss(a,n),as(n),d&4&&(d=n.updateQueue,d!==null&&(n.updateQueue=null,Uu(n,d)));break;case 30:break;case 21:break;default:ss(a,n),as(n)}}function as(n){var a=n.flags;if(a&2){try{for(var i,d=n.return;d!==null;){if(Wy(d)){i=d;break}d=d.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var _=i.stateNode,w=Um(n);Bu(n,w,_);break;case 5:var A=i.stateNode;i.flags&32&&(Vo(A,""),i.flags&=-33);var V=Um(n);Bu(n,V,A);break;case 3:case 4:var Q=i.stateNode.containerInfo,re=Um(n);Hm(n,re,Q);break;default:throw Error(o(161))}}catch(ge){Lt(n,n.return,ge)}n.flags&=-3}a&4096&&(n.flags&=-4097)}function o0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var a=n;o0(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),n=n.sibling}}function Ma(n,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)e0(n,a.alternate,a),a=a.sibling}function ro(n){for(n=n.child;n!==null;){var a=n;switch(a.tag){case 0:case 11:case 14:case 15:ur(4,a,a.return),ro(a);break;case 1:Zs(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&Xy(a,a.return,i),ro(a);break;case 27:Hi(a.stateNode);case 26:case 5:Zs(a,a.return),ro(a);break;case 22:a.memoizedState===null&&ro(a);break;case 30:ro(a);break;default:ro(a)}n=n.sibling}}function Oa(n,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var d=a.alternate,_=n,w=a,A=w.flags;switch(w.tag){case 0:case 11:case 15:Oa(_,w,i),Ai(4,w);break;case 1:if(Oa(_,w,i),d=w,_=d.stateNode,typeof _.componentDidMount=="function")try{_.componentDidMount()}catch(re){Lt(d,d.return,re)}if(d=w,_=d.updateQueue,_!==null){var V=d.stateNode;try{var Q=_.shared.hiddenCallbacks;if(Q!==null)for(_.shared.hiddenCallbacks=null,_=0;_<Q.length;_++)Pv(Q[_],V)}catch(re){Lt(d,d.return,re)}}i&&A&64&&Ky(w),Mi(w,w.return);break;case 27:Zy(w);case 26:case 5:Oa(_,w,i),i&&d===null&&A&4&&Qy(w),Mi(w,w.return);break;case 12:Oa(_,w,i);break;case 31:Oa(_,w,i),i&&A&4&&s0(_,w);break;case 13:Oa(_,w,i),i&&A&4&&a0(_,w);break;case 22:w.memoizedState===null&&Oa(_,w,i),Mi(w,w.return);break;case 30:break;default:Oa(_,w,i)}a=a.sibling}}function qm(n,a){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(n=a.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&bi(i))}function $m(n,a){n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&bi(n))}function Hs(n,a,i,d){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)l0(n,a,i,d),a=a.sibling}function l0(n,a,i,d){var _=a.flags;switch(a.tag){case 0:case 11:case 15:Hs(n,a,i,d),_&2048&&Ai(9,a);break;case 1:Hs(n,a,i,d);break;case 3:Hs(n,a,i,d),_&2048&&(n=null,a.alternate!==null&&(n=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==n&&(a.refCount++,n!=null&&bi(n)));break;case 12:if(_&2048){Hs(n,a,i,d),n=a.stateNode;try{var w=a.memoizedProps,A=w.id,V=w.onPostCommit;typeof V=="function"&&V(A,a.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Q){Lt(a,a.return,Q)}}else Hs(n,a,i,d);break;case 31:Hs(n,a,i,d);break;case 13:Hs(n,a,i,d);break;case 23:break;case 22:w=a.stateNode,A=a.alternate,a.memoizedState!==null?w._visibility&2?Hs(n,a,i,d):Oi(n,a):w._visibility&2?Hs(n,a,i,d):(w._visibility|=2,il(n,a,i,d,(a.subtreeFlags&10256)!==0||!1)),_&2048&&qm(A,a);break;case 24:Hs(n,a,i,d),_&2048&&$m(a.alternate,a);break;default:Hs(n,a,i,d)}}function il(n,a,i,d,_){for(_=_&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var w=n,A=a,V=i,Q=d,re=A.flags;switch(A.tag){case 0:case 11:case 15:il(w,A,V,Q,_),Ai(8,A);break;case 23:break;case 22:var ge=A.stateNode;A.memoizedState!==null?ge._visibility&2?il(w,A,V,Q,_):Oi(w,A):(ge._visibility|=2,il(w,A,V,Q,_)),_&&re&2048&&qm(A.alternate,A);break;case 24:il(w,A,V,Q,_),_&&re&2048&&$m(A.alternate,A);break;default:il(w,A,V,Q,_)}a=a.sibling}}function Oi(n,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=n,d=a,_=d.flags;switch(d.tag){case 22:Oi(i,d),_&2048&&qm(d.alternate,d);break;case 24:Oi(i,d),_&2048&&$m(d.alternate,d);break;default:Oi(i,d)}a=a.sibling}}var zi=8192;function cl(n,a,i){if(n.subtreeFlags&zi)for(n=n.child;n!==null;)i0(n,a,i),n=n.sibling}function i0(n,a,i){switch(n.tag){case 26:cl(n,a,i),n.flags&zi&&n.memoizedState!==null&&oT(i,Us,n.memoizedState,n.memoizedProps);break;case 5:cl(n,a,i);break;case 3:case 4:var d=Us;Us=ed(n.stateNode.containerInfo),cl(n,a,i),Us=d;break;case 22:n.memoizedState===null&&(d=n.alternate,d!==null&&d.memoizedState!==null?(d=zi,zi=16777216,cl(n,a,i),zi=d):cl(n,a,i));break;default:cl(n,a,i)}}function c0(n){var a=n.alternate;if(a!==null&&(n=a.child,n!==null)){a.child=null;do a=n.sibling,n.sibling=null,n=a;while(n!==null)}}function Di(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var d=a[i];En=d,d0(d,n)}c0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)u0(n),n=n.sibling}function u0(n){switch(n.tag){case 0:case 11:case 15:Di(n),n.flags&2048&&ur(9,n,n.return);break;case 3:Di(n);break;case 12:Di(n);break;case 22:var a=n.stateNode;n.memoizedState!==null&&a._visibility&2&&(n.return===null||n.return.tag!==13)?(a._visibility&=-3,Hu(n)):Di(n);break;default:Di(n)}}function Hu(n){var a=n.deletions;if((n.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var d=a[i];En=d,d0(d,n)}c0(n)}for(n=n.child;n!==null;){switch(a=n,a.tag){case 0:case 11:case 15:ur(8,a,a.return),Hu(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,Hu(a));break;default:Hu(a)}n=n.sibling}}function d0(n,a){for(;En!==null;){var i=En;switch(i.tag){case 0:case 11:case 15:ur(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var d=i.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:bi(i.memoizedState.cache)}if(d=i.child,d!==null)d.return=i,En=d;else e:for(i=n;En!==null;){d=En;var _=d.sibling,w=d.return;if(t0(d),d===i){En=null;break e}if(_!==null){_.return=w,En=_;break e}En=w}}}var yR={getCacheForType:function(n){var a=Ln(xn),i=a.data.get(n);return i===void 0&&(i=n(),a.data.set(n,i)),i},cacheSignal:function(){return Ln(xn).controller.signal}},jR=typeof WeakMap=="function"?WeakMap:Map,zt=0,Ft=null,yt=null,wt=0,Dt=0,xs=null,dr=!1,ul=!1,Fm=!1,za=0,un=0,fr=0,oo=0,Gm=0,bs=0,dl=0,Li=null,rs=null,Ym=!1,Vu=0,f0=0,qu=1/0,$u=null,pr=null,jn=0,mr=null,fl=null,Da=0,Km=0,Xm=null,p0=null,Pi=0,Qm=null;function _s(){return(zt&2)!==0&&wt!==0?wt&-wt:q.T!==null?nh():mn()}function m0(){if(bs===0)if((wt&536870912)===0||Nt){var n=Ot;Ot<<=1,(Ot&3932160)===0&&(Ot=262144),bs=n}else bs=536870912;return n=hs.current,n!==null&&(n.flags|=32),bs}function os(n,a,i){(n===Ft&&(Dt===2||Dt===9)||n.cancelPendingCommit!==null)&&(pl(n,0),hr(n,wt,bs,!1)),pn(n,i),((zt&2)===0||n!==Ft)&&(n===Ft&&((zt&2)===0&&(oo|=i),un===4&&hr(n,wt,bs,!1)),Js(n))}function h0(n,a,i){if((zt&6)!==0)throw Error(o(327));var d=!i&&(a&127)===0&&(a&n.expiredLanes)===0||fn(n,a),_=d?SR(n,a):Zm(n,a,!0),w=d;do{if(_===0){ul&&!d&&hr(n,a,0,!1);break}else{if(i=n.current.alternate,w&&!wR(i)){_=Zm(n,a,!1),w=!1;continue}if(_===2){if(w=a,n.errorRecoveryDisabledLanes&w)var A=0;else A=n.pendingLanes&-536870913,A=A!==0?A:A&536870912?536870912:0;if(A!==0){a=A;e:{var V=n;_=Li;var Q=V.current.memoizedState.isDehydrated;if(Q&&(pl(V,A).flags|=256),A=Zm(V,A,!1),A!==2){if(Fm&&!Q){V.errorRecoveryDisabledLanes|=w,oo|=w,_=4;break e}w=rs,rs=_,w!==null&&(rs===null?rs=w:rs.push.apply(rs,w))}_=A}if(w=!1,_!==2)continue}}if(_===1){pl(n,0),hr(n,a,0,!0);break}e:{switch(d=n,w=_,w){case 0:case 1:throw Error(o(345));case 4:if((a&4194048)!==a)break;case 6:hr(d,a,bs,!dr);break e;case 2:rs=null;break;case 3:case 5:break;default:throw Error(o(329))}if((a&62914560)===a&&(_=Vu+300-le(),10<_)){if(hr(d,a,bs,!dr),Zt(d,0,!0)!==0)break e;Da=a,d.timeoutHandle=G0(g0.bind(null,d,i,rs,$u,Ym,a,bs,oo,dl,dr,w,"Throttled",-0,0),_);break e}g0(d,i,rs,$u,Ym,a,bs,oo,dl,dr,w,null,-0,0)}}break}while(!0);Js(n)}function g0(n,a,i,d,_,w,A,V,Q,re,ge,ye,oe,fe){if(n.timeoutHandle=-1,ye=a.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:va},i0(a,w,ye);var Ve=(w&62914560)===w?Vu-le():(w&4194048)===w?f0-le():0;if(Ve=lT(ye,Ve),Ve!==null){Da=w,n.cancelPendingCommit=Ve(k0.bind(null,n,a,w,i,d,_,A,V,Q,ge,ye,null,oe,fe)),hr(n,w,A,!re);return}}k0(n,a,w,i,d,_,A,V,Q)}function wR(n){for(var a=n;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var d=0;d<i.length;d++){var _=i[d],w=_.getSnapshot;_=_.value;try{if(!ps(w(),_))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===n)break;for(;a.sibling===null;){if(a.return===null||a.return===n)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function hr(n,a,i,d){a&=~Gm,a&=~oo,n.suspendedLanes|=a,n.pingedLanes&=~a,d&&(n.warmLanes|=a),d=n.expirationTimes;for(var _=a;0<_;){var w=31-Le(_),A=1<<w;d[w]=-1,_&=~A}i!==0&&xa(n,i,a)}function Fu(){return(zt&6)===0?(Ii(0),!1):!0}function Wm(){if(yt!==null){if(Dt===0)var n=yt.return;else n=yt,ka=Wr=null,pm(n),sl=null,vi=0,n=yt;for(;n!==null;)Yy(n.alternate,n),n=n.return;yt=null}}function pl(n,a){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,qR(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Da=0,Wm(),Ft=n,yt=i=ja(n.current,null),wt=a,Dt=0,xs=null,dr=!1,ul=fn(n,a),Fm=!1,dl=bs=Gm=oo=fr=un=0,rs=Li=null,Ym=!1,(a&8)!==0&&(a|=a&32);var d=n.entangledLanes;if(d!==0)for(n=n.entanglements,d&=a;0<d;){var _=31-Le(d),w=1<<_;a|=n[_],d&=~w}return za=a,fu(),i}function x0(n,a){dt=null,q.H=Ei,a===nl||a===vu?(a=Ov(),Dt=3):a===tm?(a=Ov(),Dt=4):Dt=a===Rm?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,xs=a,yt===null&&(un=1,zu(n,Ns(a,n.current)))}function b0(){var n=hs.current;return n===null?!0:(wt&4194048)===wt?As===null:(wt&62914560)===wt||(wt&536870912)!==0?n===As:!1}function _0(){var n=q.H;return q.H=Ei,n===null?Ei:n}function v0(){var n=q.A;return q.A=yR,n}function Gu(){un=4,dr||(wt&4194048)!==wt&&hs.current!==null||(ul=!0),(fr&134217727)===0&&(oo&134217727)===0||Ft===null||hr(Ft,wt,bs,!1)}function Zm(n,a,i){var d=zt;zt|=2;var _=_0(),w=v0();(Ft!==n||wt!==a)&&($u=null,pl(n,a)),a=!1;var A=un;e:do try{if(Dt!==0&&yt!==null){var V=yt,Q=xs;switch(Dt){case 8:Wm(),A=6;break e;case 3:case 2:case 9:case 6:hs.current===null&&(a=!0);var re=Dt;if(Dt=0,xs=null,ml(n,V,Q,re),i&&ul){A=0;break e}break;default:re=Dt,Dt=0,xs=null,ml(n,V,Q,re)}}kR(),A=un;break}catch(ge){x0(n,ge)}while(!0);return a&&n.shellSuspendCounter++,ka=Wr=null,zt=d,q.H=_,q.A=w,yt===null&&(Ft=null,wt=0,fu()),A}function kR(){for(;yt!==null;)y0(yt)}function SR(n,a){var i=zt;zt|=2;var d=_0(),_=v0();Ft!==n||wt!==a?($u=null,qu=le()+500,pl(n,a)):ul=fn(n,a);e:do try{if(Dt!==0&&yt!==null){a=yt;var w=xs;t:switch(Dt){case 1:Dt=0,xs=null,ml(n,a,w,1);break;case 2:case 9:if(Av(w)){Dt=0,xs=null,j0(a);break}a=function(){Dt!==2&&Dt!==9||Ft!==n||(Dt=7),Js(n)},w.then(a,a);break e;case 3:Dt=7;break e;case 4:Dt=5;break e;case 7:Av(w)?(Dt=0,xs=null,j0(a)):(Dt=0,xs=null,ml(n,a,w,7));break;case 5:var A=null;switch(yt.tag){case 26:A=yt.memoizedState;case 5:case 27:var V=yt;if(A?l1(A):V.stateNode.complete){Dt=0,xs=null;var Q=V.sibling;if(Q!==null)yt=Q;else{var re=V.return;re!==null?(yt=re,Yu(re)):yt=null}break t}}Dt=0,xs=null,ml(n,a,w,5);break;case 6:Dt=0,xs=null,ml(n,a,w,6);break;case 8:Wm(),un=6;break e;default:throw Error(o(462))}}CR();break}catch(ge){x0(n,ge)}while(!0);return ka=Wr=null,q.H=d,q.A=_,zt=i,yt!==null?0:(Ft=null,wt=0,fu(),un)}function CR(){for(;yt!==null&&!Pe();)y0(yt)}function y0(n){var a=Fy(n.alternate,n,za);n.memoizedProps=n.pendingProps,a===null?Yu(n):yt=a}function j0(n){var a=n,i=a.alternate;switch(a.tag){case 15:case 0:a=By(i,a,a.pendingProps,a.type,void 0,wt);break;case 11:a=By(i,a,a.pendingProps,a.type.render,a.ref,wt);break;case 5:pm(a);default:Yy(i,a),a=yt=vv(a,za),a=Fy(i,a,za)}n.memoizedProps=n.pendingProps,a===null?Yu(n):yt=a}function ml(n,a,i,d){ka=Wr=null,pm(a),sl=null,vi=0;var _=a.return;try{if(mR(n,_,a,i,wt)){un=1,zu(n,Ns(i,n.current)),yt=null;return}}catch(w){if(_!==null)throw yt=_,w;un=1,zu(n,Ns(i,n.current)),yt=null;return}a.flags&32768?(Nt||d===1?n=!0:ul||(wt&536870912)!==0?n=!1:(dr=n=!0,(d===2||d===9||d===3||d===6)&&(d=hs.current,d!==null&&d.tag===13&&(d.flags|=16384))),w0(a,n)):Yu(a)}function Yu(n){var a=n;do{if((a.flags&32768)!==0){w0(a,dr);return}n=a.return;var i=xR(a.alternate,a,za);if(i!==null){yt=i;return}if(a=a.sibling,a!==null){yt=a;return}yt=a=n}while(a!==null);un===0&&(un=5)}function w0(n,a){do{var i=bR(n.alternate,n);if(i!==null){i.flags&=32767,yt=i;return}if(i=n.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(n=n.sibling,n!==null)){yt=n;return}yt=n=i}while(n!==null);un=6,yt=null}function k0(n,a,i,d,_,w,A,V,Q){n.cancelPendingCommit=null;do Ku();while(jn!==0);if((zt&6)!==0)throw Error(o(327));if(a!==null){if(a===n.current)throw Error(o(177));if(w=a.lanes|a.childLanes,w|=Up,ws(n,i,w,A,V,Q),n===Ft&&(yt=Ft=null,wt=0),fl=a,mr=n,Da=i,Km=w,Xm=_,p0=d,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,TR(Oe,function(){return R0(),null})):(n.callbackNode=null,n.callbackPriority=0),d=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||d){d=q.T,q.T=null,_=X.p,X.p=2,A=zt,zt|=4;try{_R(n,a,i)}finally{zt=A,X.p=_,q.T=d}}jn=1,S0(),C0(),N0()}}function S0(){if(jn===1){jn=0;var n=mr,a=fl,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=q.T,q.T=null;var d=X.p;X.p=2;var _=zt;zt|=4;try{r0(a,n);var w=uh,A=dv(n.containerInfo),V=w.focusedElem,Q=w.selectionRange;if(A!==V&&V&&V.ownerDocument&&uv(V.ownerDocument.documentElement,V)){if(Q!==null&&Dp(V)){var re=Q.start,ge=Q.end;if(ge===void 0&&(ge=re),"selectionStart"in V)V.selectionStart=re,V.selectionEnd=Math.min(ge,V.value.length);else{var ye=V.ownerDocument||document,oe=ye&&ye.defaultView||window;if(oe.getSelection){var fe=oe.getSelection(),Ve=V.textContent.length,st=Math.min(Q.start,Ve),Ut=Q.end===void 0?st:Math.min(Q.end,Ve);!fe.extend&&st>Ut&&(A=Ut,Ut=st,st=A);var J=cv(V,st),W=cv(V,Ut);if(J&&W&&(fe.rangeCount!==1||fe.anchorNode!==J.node||fe.anchorOffset!==J.offset||fe.focusNode!==W.node||fe.focusOffset!==W.offset)){var se=ye.createRange();se.setStart(J.node,J.offset),fe.removeAllRanges(),st>Ut?(fe.addRange(se),fe.extend(W.node,W.offset)):(se.setEnd(W.node,W.offset),fe.addRange(se))}}}}for(ye=[],fe=V;fe=fe.parentNode;)fe.nodeType===1&&ye.push({element:fe,left:fe.scrollLeft,top:fe.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<ye.length;V++){var be=ye[V];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}od=!!ch,uh=ch=null}finally{zt=_,X.p=d,q.T=i}}n.current=a,jn=2}}function C0(){if(jn===2){jn=0;var n=mr,a=fl,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=q.T,q.T=null;var d=X.p;X.p=2;var _=zt;zt|=4;try{e0(n,a.alternate,a)}finally{zt=_,X.p=d,q.T=i}}jn=3}}function N0(){if(jn===4||jn===3){jn=0,Ie();var n=mr,a=fl,i=Da,d=p0;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?jn=5:(jn=0,fl=mr=null,E0(n,n.pendingLanes));var _=n.pendingLanes;if(_===0&&(pr=null),Pt(i),a=a.stateNode,Rt&&typeof Rt.onCommitFiberRoot=="function")try{Rt.onCommitFiberRoot(lt,a,void 0,(a.current.flags&128)===128)}catch{}if(d!==null){a=q.T,_=X.p,X.p=2,q.T=null;try{for(var w=n.onRecoverableError,A=0;A<d.length;A++){var V=d[A];w(V.value,{componentStack:V.stack})}}finally{q.T=a,X.p=_}}(Da&3)!==0&&Ku(),Js(n),_=n.pendingLanes,(i&261930)!==0&&(_&42)!==0?n===Qm?Pi++:(Pi=0,Qm=n):Pi=0,Ii(0)}}function E0(n,a){(n.pooledCacheLanes&=a)===0&&(a=n.pooledCache,a!=null&&(n.pooledCache=null,bi(a)))}function Ku(){return S0(),C0(),N0(),R0()}function R0(){if(jn!==5)return!1;var n=mr,a=Km;Km=0;var i=Pt(Da),d=q.T,_=X.p;try{X.p=32>i?32:i,q.T=null,i=Xm,Xm=null;var w=mr,A=Da;if(jn=0,fl=mr=null,Da=0,(zt&6)!==0)throw Error(o(331));var V=zt;if(zt|=4,u0(w.current),l0(w,w.current,A,i),zt=V,Ii(0,!1),Rt&&typeof Rt.onPostCommitFiberRoot=="function")try{Rt.onPostCommitFiberRoot(lt,w)}catch{}return!0}finally{X.p=_,q.T=d,E0(n,a)}}function T0(n,a,i){a=Ns(i,a),a=Em(n.stateNode,a,2),n=lr(n,a,2),n!==null&&(pn(n,2),Js(n))}function Lt(n,a,i){if(n.tag===3)T0(n,n,i);else for(;a!==null;){if(a.tag===3){T0(a,n,i);break}else if(a.tag===1){var d=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(pr===null||!pr.has(d))){n=Ns(i,n),i=Ay(2),d=lr(a,i,2),d!==null&&(My(i,d,a,n),pn(d,2),Js(d));break}}a=a.return}}function Jm(n,a,i){var d=n.pingCache;if(d===null){d=n.pingCache=new jR;var _=new Set;d.set(a,_)}else _=d.get(a),_===void 0&&(_=new Set,d.set(a,_));_.has(i)||(Fm=!0,_.add(i),n=NR.bind(null,n,a,i),a.then(n,n))}function NR(n,a,i){var d=n.pingCache;d!==null&&d.delete(a),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Ft===n&&(wt&i)===i&&(un===4||un===3&&(wt&62914560)===wt&&300>le()-Vu?(zt&2)===0&&pl(n,0):Gm|=i,dl===wt&&(dl=0)),Js(n)}function A0(n,a){a===0&&(a=fs()),n=Kr(n,a),n!==null&&(pn(n,a),Js(n))}function ER(n){var a=n.memoizedState,i=0;a!==null&&(i=a.retryLane),A0(n,i)}function RR(n,a){var i=0;switch(n.tag){case 31:case 13:var d=n.stateNode,_=n.memoizedState;_!==null&&(i=_.retryLane);break;case 19:d=n.stateNode;break;case 22:d=n.stateNode._retryCache;break;default:throw Error(o(314))}d!==null&&d.delete(a),A0(n,i)}function TR(n,a){return Ce(n,a)}var Xu=null,hl=null,eh=!1,Qu=!1,th=!1,gr=0;function Js(n){n!==hl&&n.next===null&&(hl===null?Xu=hl=n:hl=hl.next=n),Qu=!0,eh||(eh=!0,MR())}function Ii(n,a){if(!th&&Qu){th=!0;do for(var i=!1,d=Xu;d!==null;){if(n!==0){var _=d.pendingLanes;if(_===0)var w=0;else{var A=d.suspendedLanes,V=d.pingedLanes;w=(1<<31-Le(42|n)+1)-1,w&=_&~(A&~V),w=w&201326741?w&201326741|1:w?w|2:0}w!==0&&(i=!0,D0(d,w))}else w=wt,w=Zt(d,d===Ft?w:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(w&3)===0||fn(d,w)||(i=!0,D0(d,w));d=d.next}while(i);th=!1}}function AR(){M0()}function M0(){Qu=eh=!1;var n=0;gr!==0&&VR()&&(n=gr);for(var a=le(),i=null,d=Xu;d!==null;){var _=d.next,w=O0(d,a);w===0?(d.next=null,i===null?Xu=_:i.next=_,_===null&&(hl=i)):(i=d,(n!==0||(w&3)!==0)&&(Qu=!0)),d=_}jn!==0&&jn!==5||Ii(n),gr!==0&&(gr=0)}function O0(n,a){for(var i=n.suspendedLanes,d=n.pingedLanes,_=n.expirationTimes,w=n.pendingLanes&-62914561;0<w;){var A=31-Le(w),V=1<<A,Q=_[A];Q===-1?((V&i)===0||(V&d)!==0)&&(_[A]=es(V,a)):Q<=a&&(n.expiredLanes|=V),w&=~V}if(a=Ft,i=wt,i=Zt(n,n===a?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d=n.callbackNode,i===0||n===a&&(Dt===2||Dt===9)||n.cancelPendingCommit!==null)return d!==null&&d!==null&&De(d),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||fn(n,i)){if(a=i&-i,a===n.callbackPriority)return a;switch(d!==null&&De(d),Pt(i)){case 2:case 8:i=Ne;break;case 32:i=Oe;break;case 268435456:i=at;break;default:i=Oe}return d=z0.bind(null,n),i=Ce(i,d),n.callbackPriority=a,n.callbackNode=i,a}return d!==null&&d!==null&&De(d),n.callbackPriority=2,n.callbackNode=null,2}function z0(n,a){if(jn!==0&&jn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(Ku()&&n.callbackNode!==i)return null;var d=wt;return d=Zt(n,n===Ft?d:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),d===0?null:(h0(n,d,a),O0(n,le()),n.callbackNode!=null&&n.callbackNode===i?z0.bind(null,n):null)}function D0(n,a){if(Ku())return null;h0(n,a,!0)}function MR(){$R(function(){(zt&6)!==0?Ce(qe,AR):M0()})}function nh(){if(gr===0){var n=el;n===0&&(n=ft,ft<<=1,(ft&261888)===0&&(ft=256)),gr=n}return gr}function L0(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:au(""+n)}function P0(n,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,n.id&&i.setAttribute("form",n.id),a.parentNode.insertBefore(i,a),n=new FormData(n),i.parentNode.removeChild(i),n}function OR(n,a,i,d,_){if(a==="submit"&&i&&i.stateNode===_){var w=L0((_[zn]||null).action),A=d.submitter;A&&(a=(a=A[zn]||null)?L0(a.formAction):A.getAttribute("formAction"),a!==null&&(w=a,A=null));var V=new iu("action","action",null,d,_);n.push({event:V,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(gr!==0){var Q=A?P0(_,A):new FormData(_);jm(i,{pending:!0,data:Q,method:_.method,action:w},null,Q)}}else typeof w=="function"&&(V.preventDefault(),Q=A?P0(_,A):new FormData(_),jm(i,{pending:!0,data:Q,method:_.method,action:w},w,Q))},currentTarget:_}]})}}for(var sh=0;sh<Bp.length;sh++){var ah=Bp[sh],zR=ah.toLowerCase(),DR=ah[0].toUpperCase()+ah.slice(1);Bs(zR,"on"+DR)}Bs(mv,"onAnimationEnd"),Bs(hv,"onAnimationIteration"),Bs(gv,"onAnimationStart"),Bs("dblclick","onDoubleClick"),Bs("focusin","onFocus"),Bs("focusout","onBlur"),Bs(WE,"onTransitionRun"),Bs(ZE,"onTransitionStart"),Bs(JE,"onTransitionCancel"),Bs(xv,"onTransitionEnd"),Uo("onMouseEnter",["mouseout","mouseover"]),Uo("onMouseLeave",["mouseout","mouseover"]),Uo("onPointerEnter",["pointerout","pointerover"]),Uo("onPointerLeave",["pointerout","pointerover"]),$r("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$r("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$r("onBeforeInput",["compositionend","keypress","textInput","paste"]),$r("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$r("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$r("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Bi="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(" "),LR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Bi));function I0(n,a){a=(a&4)!==0;for(var i=0;i<n.length;i++){var d=n[i],_=d.event;d=d.listeners;e:{var w=void 0;if(a)for(var A=d.length-1;0<=A;A--){var V=d[A],Q=V.instance,re=V.currentTarget;if(V=V.listener,Q!==w&&_.isPropagationStopped())break e;w=V,_.currentTarget=re;try{w(_)}catch(ge){du(ge)}_.currentTarget=null,w=Q}else for(A=0;A<d.length;A++){if(V=d[A],Q=V.instance,re=V.currentTarget,V=V.listener,Q!==w&&_.isPropagationStopped())break e;w=V,_.currentTarget=re;try{w(_)}catch(ge){du(ge)}_.currentTarget=null,w=Q}}}}function jt(n,a){var i=a[ai];i===void 0&&(i=a[ai]=new Set);var d=n+"__bubble";i.has(d)||(B0(a,n,2,!1),i.add(d))}function rh(n,a,i){var d=0;a&&(d|=4),B0(i,n,d,a)}var Wu="_reactListening"+Math.random().toString(36).slice(2);function oh(n){if(!n[Wu]){n[Wu]=!0,M_.forEach(function(i){i!=="selectionchange"&&(LR.has(i)||rh(i,!1,n),rh(i,!0,n))});var a=n.nodeType===9?n:n.ownerDocument;a===null||a[Wu]||(a[Wu]=!0,rh("selectionchange",!1,a))}}function B0(n,a,i,d){switch(m1(a)){case 2:var _=uT;break;case 8:_=dT;break;default:_=yh}i=_.bind(null,a,i,n),_=void 0,!Cp||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(_=!0),d?_!==void 0?n.addEventListener(a,i,{capture:!0,passive:_}):n.addEventListener(a,i,!0):_!==void 0?n.addEventListener(a,i,{passive:_}):n.addEventListener(a,i,!1)}function lh(n,a,i,d,_){var w=d;if((a&1)===0&&(a&2)===0&&d!==null)e:for(;;){if(d===null)return;var A=d.tag;if(A===3||A===4){var V=d.stateNode.containerInfo;if(V===_)break;if(A===4)for(A=d.return;A!==null;){var Q=A.tag;if((Q===3||Q===4)&&A.stateNode.containerInfo===_)return;A=A.return}for(;V!==null;){if(A=Po(V),A===null)return;if(Q=A.tag,Q===5||Q===6||Q===26||Q===27){d=w=A;continue e}V=V.parentNode}}d=d.return}$_(function(){var re=w,ge=kp(i),ye=[];e:{var oe=bv.get(n);if(oe!==void 0){var fe=iu,Ve=n;switch(n){case"keypress":if(ou(i)===0)break e;case"keydown":case"keyup":fe=RE;break;case"focusin":Ve="focus",fe=Tp;break;case"focusout":Ve="blur",fe=Tp;break;case"beforeblur":case"afterblur":fe=Tp;break;case"click":if(i.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":fe=Y_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":fe=xE;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":fe=ME;break;case mv:case hv:case gv:fe=vE;break;case xv:fe=zE;break;case"scroll":case"scrollend":fe=hE;break;case"wheel":fe=LE;break;case"copy":case"cut":case"paste":fe=jE;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":fe=X_;break;case"toggle":case"beforetoggle":fe=IE}var st=(a&4)!==0,Ut=!st&&(n==="scroll"||n==="scrollend"),J=st?oe!==null?oe+"Capture":null:oe;st=[];for(var W=re,se;W!==null;){var be=W;if(se=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||se===null||J===null||(be=li(W,J),be!=null&&st.push(Ui(W,be,se))),Ut)break;W=W.return}0<st.length&&(oe=new fe(oe,Ve,null,i,ge),ye.push({event:oe,listeners:st}))}}if((a&7)===0){e:{if(oe=n==="mouseover"||n==="pointerover",fe=n==="mouseout"||n==="pointerout",oe&&i!==wp&&(Ve=i.relatedTarget||i.fromElement)&&(Po(Ve)||Ve[Xs]))break e;if((fe||oe)&&(oe=ge.window===ge?ge:(oe=ge.ownerDocument)?oe.defaultView||oe.parentWindow:window,fe?(Ve=i.relatedTarget||i.toElement,fe=re,Ve=Ve?Po(Ve):null,Ve!==null&&(Ut=c(Ve),st=Ve.tag,Ve!==Ut||st!==5&&st!==27&&st!==6)&&(Ve=null)):(fe=null,Ve=re),fe!==Ve)){if(st=Y_,be="onMouseLeave",J="onMouseEnter",W="mouse",(n==="pointerout"||n==="pointerover")&&(st=X_,be="onPointerLeave",J="onPointerEnter",W="pointer"),Ut=fe==null?oe:oi(fe),se=Ve==null?oe:oi(Ve),oe=new st(be,W+"leave",fe,i,ge),oe.target=Ut,oe.relatedTarget=se,be=null,Po(ge)===re&&(st=new st(J,W+"enter",Ve,i,ge),st.target=se,st.relatedTarget=Ut,be=st),Ut=be,fe&&Ve)t:{for(st=PR,J=fe,W=Ve,se=0,be=J;be;be=st(be))se++;be=0;for(var Ze=W;Ze;Ze=st(Ze))be++;for(;0<se-be;)J=st(J),se--;for(;0<be-se;)W=st(W),be--;for(;se--;){if(J===W||W!==null&&J===W.alternate){st=J;break t}J=st(J),W=st(W)}st=null}else st=null;fe!==null&&U0(ye,oe,fe,st,!1),Ve!==null&&Ut!==null&&U0(ye,Ut,Ve,st,!0)}}e:{if(oe=re?oi(re):window,fe=oe.nodeName&&oe.nodeName.toLowerCase(),fe==="select"||fe==="input"&&oe.type==="file")var Tt=sv;else if(tv(oe))if(av)Tt=KE;else{Tt=GE;var Fe=FE}else fe=oe.nodeName,!fe||fe.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?re&&jp(re.elementType)&&(Tt=sv):Tt=YE;if(Tt&&(Tt=Tt(n,re))){nv(ye,Tt,i,ge);break e}Fe&&Fe(n,oe,re),n==="focusout"&&re&&oe.type==="number"&&re.memoizedProps.value!=null&&yp(oe,"number",oe.value)}switch(Fe=re?oi(re):window,n){case"focusin":(tv(Fe)||Fe.contentEditable==="true")&&(Go=Fe,Lp=re,hi=null);break;case"focusout":hi=Lp=Go=null;break;case"mousedown":Pp=!0;break;case"contextmenu":case"mouseup":case"dragend":Pp=!1,fv(ye,i,ge);break;case"selectionchange":if(QE)break;case"keydown":case"keyup":fv(ye,i,ge)}var pt;if(Mp)e:{switch(n){case"compositionstart":var kt="onCompositionStart";break e;case"compositionend":kt="onCompositionEnd";break e;case"compositionupdate":kt="onCompositionUpdate";break e}kt=void 0}else Fo?J_(n,i)&&(kt="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(kt="onCompositionStart");kt&&(Q_&&i.locale!=="ko"&&(Fo||kt!=="onCompositionStart"?kt==="onCompositionEnd"&&Fo&&(pt=F_()):(er=ge,Np="value"in er?er.value:er.textContent,Fo=!0)),Fe=Zu(re,kt),0<Fe.length&&(kt=new K_(kt,n,null,i,ge),ye.push({event:kt,listeners:Fe}),pt?kt.data=pt:(pt=ev(i),pt!==null&&(kt.data=pt)))),(pt=UE?HE(n,i):VE(n,i))&&(kt=Zu(re,"onBeforeInput"),0<kt.length&&(Fe=new K_("onBeforeInput","beforeinput",null,i,ge),ye.push({event:Fe,listeners:kt}),Fe.data=pt)),OR(ye,n,re,i,ge)}I0(ye,a)})}function Ui(n,a,i){return{instance:n,listener:a,currentTarget:i}}function Zu(n,a){for(var i=a+"Capture",d=[];n!==null;){var _=n,w=_.stateNode;if(_=_.tag,_!==5&&_!==26&&_!==27||w===null||(_=li(n,i),_!=null&&d.unshift(Ui(n,_,w)),_=li(n,a),_!=null&&d.push(Ui(n,_,w))),n.tag===3)return d;n=n.return}return[]}function PR(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function U0(n,a,i,d,_){for(var w=a._reactName,A=[];i!==null&&i!==d;){var V=i,Q=V.alternate,re=V.stateNode;if(V=V.tag,Q!==null&&Q===d)break;V!==5&&V!==26&&V!==27||re===null||(Q=re,_?(re=li(i,w),re!=null&&A.unshift(Ui(i,re,Q))):_||(re=li(i,w),re!=null&&A.push(Ui(i,re,Q)))),i=i.return}A.length!==0&&n.push({event:a,listeners:A})}var IR=/\r\n?/g,BR=/\u0000|\uFFFD/g;function H0(n){return(typeof n=="string"?n:""+n).replace(IR,`
49
- `).replace(BR,"")}function V0(n,a){return a=H0(a),H0(n)===a}function Bt(n,a,i,d,_,w){switch(i){case"children":typeof d=="string"?a==="body"||a==="textarea"&&d===""||Vo(n,d):(typeof d=="number"||typeof d=="bigint")&&a!=="body"&&Vo(n,""+d);break;case"className":nu(n,"class",d);break;case"tabIndex":nu(n,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":nu(n,i,d);break;case"style":V_(n,d,w);break;case"data":if(a!=="object"){nu(n,"data",d);break}case"src":case"href":if(d===""&&(a!=="a"||i!=="href")){n.removeAttribute(i);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(i);break}d=au(""+d),n.setAttribute(i,d);break;case"action":case"formAction":if(typeof d=="function"){n.setAttribute(i,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof w=="function"&&(i==="formAction"?(a!=="input"&&Bt(n,a,"name",_.name,_,null),Bt(n,a,"formEncType",_.formEncType,_,null),Bt(n,a,"formMethod",_.formMethod,_,null),Bt(n,a,"formTarget",_.formTarget,_,null)):(Bt(n,a,"encType",_.encType,_,null),Bt(n,a,"method",_.method,_,null),Bt(n,a,"target",_.target,_,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){n.removeAttribute(i);break}d=au(""+d),n.setAttribute(i,d);break;case"onClick":d!=null&&(n.onclick=va);break;case"onScroll":d!=null&&jt("scroll",n);break;case"onScrollEnd":d!=null&&jt("scrollend",n);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(o(61));if(i=d.__html,i!=null){if(_.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"multiple":n.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":n.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){n.removeAttribute("xlink:href");break}i=au(""+d),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",i);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,""+d):n.removeAttribute(i);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":d===!0?n.setAttribute(i,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?n.setAttribute(i,d):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?n.setAttribute(i,d):n.removeAttribute(i);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?n.removeAttribute(i):n.setAttribute(i,d);break;case"popover":jt("beforetoggle",n),jt("toggle",n),tu(n,"popover",d);break;case"xlinkActuate":_a(n,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":_a(n,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":_a(n,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":_a(n,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":_a(n,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":_a(n,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":_a(n,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":_a(n,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":_a(n,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":tu(n,"is",d);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=pE.get(i)||i,tu(n,i,d))}}function ih(n,a,i,d,_,w){switch(i){case"style":V_(n,d,w);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(o(61));if(i=d.__html,i!=null){if(_.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"children":typeof d=="string"?Vo(n,d):(typeof d=="number"||typeof d=="bigint")&&Vo(n,""+d);break;case"onScroll":d!=null&&jt("scroll",n);break;case"onScrollEnd":d!=null&&jt("scrollend",n);break;case"onClick":d!=null&&(n.onclick=va);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!O_.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(_=i.endsWith("Capture"),a=i.slice(2,_?i.length-7:void 0),w=n[zn]||null,w=w!=null?w[i]:null,typeof w=="function"&&n.removeEventListener(a,w,_),typeof d=="function")){typeof w!="function"&&w!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(a,d,_);break e}i in n?n[i]=d:d===!0?n.setAttribute(i,""):tu(n,i,d)}}}function In(n,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":jt("error",n),jt("load",n);var d=!1,_=!1,w;for(w in i)if(i.hasOwnProperty(w)){var A=i[w];if(A!=null)switch(w){case"src":d=!0;break;case"srcSet":_=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:Bt(n,a,w,A,i,null)}}_&&Bt(n,a,"srcSet",i.srcSet,i,null),d&&Bt(n,a,"src",i.src,i,null);return;case"input":jt("invalid",n);var V=w=A=_=null,Q=null,re=null;for(d in i)if(i.hasOwnProperty(d)){var ge=i[d];if(ge!=null)switch(d){case"name":_=ge;break;case"type":A=ge;break;case"checked":Q=ge;break;case"defaultChecked":re=ge;break;case"value":w=ge;break;case"defaultValue":V=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(o(137,a));break;default:Bt(n,a,d,ge,i,null)}}I_(n,w,V,Q,re,A,_,!1);return;case"select":jt("invalid",n),d=A=w=null;for(_ in i)if(i.hasOwnProperty(_)&&(V=i[_],V!=null))switch(_){case"value":w=V;break;case"defaultValue":A=V;break;case"multiple":d=V;default:Bt(n,a,_,V,i,null)}a=w,i=A,n.multiple=!!d,a!=null?Ho(n,!!d,a,!1):i!=null&&Ho(n,!!d,i,!0);return;case"textarea":jt("invalid",n),w=_=d=null;for(A in i)if(i.hasOwnProperty(A)&&(V=i[A],V!=null))switch(A){case"value":d=V;break;case"defaultValue":_=V;break;case"children":w=V;break;case"dangerouslySetInnerHTML":if(V!=null)throw Error(o(91));break;default:Bt(n,a,A,V,i,null)}U_(n,d,_,w);return;case"option":for(Q in i)if(i.hasOwnProperty(Q)&&(d=i[Q],d!=null))switch(Q){case"selected":n.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Bt(n,a,Q,d,i,null)}return;case"dialog":jt("beforetoggle",n),jt("toggle",n),jt("cancel",n),jt("close",n);break;case"iframe":case"object":jt("load",n);break;case"video":case"audio":for(d=0;d<Bi.length;d++)jt(Bi[d],n);break;case"image":jt("error",n),jt("load",n);break;case"details":jt("toggle",n);break;case"embed":case"source":case"link":jt("error",n),jt("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(re in i)if(i.hasOwnProperty(re)&&(d=i[re],d!=null))switch(re){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:Bt(n,a,re,d,i,null)}return;default:if(jp(a)){for(ge in i)i.hasOwnProperty(ge)&&(d=i[ge],d!==void 0&&ih(n,a,ge,d,i,void 0));return}}for(V in i)i.hasOwnProperty(V)&&(d=i[V],d!=null&&Bt(n,a,V,d,i,null))}function UR(n,a,i,d){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var _=null,w=null,A=null,V=null,Q=null,re=null,ge=null;for(fe in i){var ye=i[fe];if(i.hasOwnProperty(fe)&&ye!=null)switch(fe){case"checked":break;case"value":break;case"defaultValue":Q=ye;default:d.hasOwnProperty(fe)||Bt(n,a,fe,null,d,ye)}}for(var oe in d){var fe=d[oe];if(ye=i[oe],d.hasOwnProperty(oe)&&(fe!=null||ye!=null))switch(oe){case"type":w=fe;break;case"name":_=fe;break;case"checked":re=fe;break;case"defaultChecked":ge=fe;break;case"value":A=fe;break;case"defaultValue":V=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(o(137,a));break;default:fe!==ye&&Bt(n,a,oe,fe,d,ye)}}vp(n,A,V,Q,re,ge,w,_);return;case"select":fe=A=V=oe=null;for(w in i)if(Q=i[w],i.hasOwnProperty(w)&&Q!=null)switch(w){case"value":break;case"multiple":fe=Q;default:d.hasOwnProperty(w)||Bt(n,a,w,null,d,Q)}for(_ in d)if(w=d[_],Q=i[_],d.hasOwnProperty(_)&&(w!=null||Q!=null))switch(_){case"value":oe=w;break;case"defaultValue":V=w;break;case"multiple":A=w;default:w!==Q&&Bt(n,a,_,w,d,Q)}a=V,i=A,d=fe,oe!=null?Ho(n,!!i,oe,!1):!!d!=!!i&&(a!=null?Ho(n,!!i,a,!0):Ho(n,!!i,i?[]:"",!1));return;case"textarea":fe=oe=null;for(V in i)if(_=i[V],i.hasOwnProperty(V)&&_!=null&&!d.hasOwnProperty(V))switch(V){case"value":break;case"children":break;default:Bt(n,a,V,null,d,_)}for(A in d)if(_=d[A],w=i[A],d.hasOwnProperty(A)&&(_!=null||w!=null))switch(A){case"value":oe=_;break;case"defaultValue":fe=_;break;case"children":break;case"dangerouslySetInnerHTML":if(_!=null)throw Error(o(91));break;default:_!==w&&Bt(n,a,A,_,d,w)}B_(n,oe,fe);return;case"option":for(var Ve in i)if(oe=i[Ve],i.hasOwnProperty(Ve)&&oe!=null&&!d.hasOwnProperty(Ve))switch(Ve){case"selected":n.selected=!1;break;default:Bt(n,a,Ve,null,d,oe)}for(Q in d)if(oe=d[Q],fe=i[Q],d.hasOwnProperty(Q)&&oe!==fe&&(oe!=null||fe!=null))switch(Q){case"selected":n.selected=oe&&typeof oe!="function"&&typeof oe!="symbol";break;default:Bt(n,a,Q,oe,d,fe)}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 st in i)oe=i[st],i.hasOwnProperty(st)&&oe!=null&&!d.hasOwnProperty(st)&&Bt(n,a,st,null,d,oe);for(re in d)if(oe=d[re],fe=i[re],d.hasOwnProperty(re)&&oe!==fe&&(oe!=null||fe!=null))switch(re){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(o(137,a));break;default:Bt(n,a,re,oe,d,fe)}return;default:if(jp(a)){for(var Ut in i)oe=i[Ut],i.hasOwnProperty(Ut)&&oe!==void 0&&!d.hasOwnProperty(Ut)&&ih(n,a,Ut,void 0,d,oe);for(ge in d)oe=d[ge],fe=i[ge],!d.hasOwnProperty(ge)||oe===fe||oe===void 0&&fe===void 0||ih(n,a,ge,oe,d,fe);return}}for(var J in i)oe=i[J],i.hasOwnProperty(J)&&oe!=null&&!d.hasOwnProperty(J)&&Bt(n,a,J,null,d,oe);for(ye in d)oe=d[ye],fe=i[ye],!d.hasOwnProperty(ye)||oe===fe||oe==null&&fe==null||Bt(n,a,ye,oe,d,fe)}function q0(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function HR(){if(typeof performance.getEntriesByType=="function"){for(var n=0,a=0,i=performance.getEntriesByType("resource"),d=0;d<i.length;d++){var _=i[d],w=_.transferSize,A=_.initiatorType,V=_.duration;if(w&&V&&q0(A)){for(A=0,V=_.responseEnd,d+=1;d<i.length;d++){var Q=i[d],re=Q.startTime;if(re>V)break;var ge=Q.transferSize,ye=Q.initiatorType;ge&&q0(ye)&&(Q=Q.responseEnd,A+=ge*(Q<V?1:(V-re)/(Q-re)))}if(--d,a+=8*(w+A)/(_.duration/1e3),n++,10<n)break}}if(0<n)return a/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var ch=null,uh=null;function Ju(n){return n.nodeType===9?n:n.ownerDocument}function $0(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function F0(n,a){if(n===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&a==="foreignObject"?0:n}function dh(n,a){return n==="textarea"||n==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var fh=null;function VR(){var n=window.event;return n&&n.type==="popstate"?n===fh?!1:(fh=n,!0):(fh=null,!1)}var G0=typeof setTimeout=="function"?setTimeout:void 0,qR=typeof clearTimeout=="function"?clearTimeout:void 0,Y0=typeof Promise=="function"?Promise:void 0,$R=typeof queueMicrotask=="function"?queueMicrotask:typeof Y0<"u"?function(n){return Y0.resolve(null).then(n).catch(FR)}:G0;function FR(n){setTimeout(function(){throw n})}function xr(n){return n==="head"}function K0(n,a){var i=a,d=0;do{var _=i.nextSibling;if(n.removeChild(i),_&&_.nodeType===8)if(i=_.data,i==="/$"||i==="/&"){if(d===0){n.removeChild(_),_l(a);return}d--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")d++;else if(i==="html")Hi(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,Hi(i);for(var w=i.firstChild;w;){var A=w.nextSibling,V=w.nodeName;w[ri]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&w.rel.toLowerCase()==="stylesheet"||i.removeChild(w),w=A}}else i==="body"&&Hi(n.ownerDocument.body);i=_}while(i);_l(a)}function X0(n,a){var i=n;n=0;do{var d=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),d&&d.nodeType===8)if(i=d.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=d}while(i)}function ph(n){var a=n.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":ph(i),bp(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function GR(n,a,i,d){for(;n.nodeType===1;){var _=i;if(n.nodeName.toLowerCase()!==a.toLowerCase()){if(!d&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(d){if(!n[ri])switch(a){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(w=n.getAttribute("rel"),w==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(w!==_.rel||n.getAttribute("href")!==(_.href==null||_.href===""?null:_.href)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin)||n.getAttribute("title")!==(_.title==null?null:_.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(w=n.getAttribute("src"),(w!==(_.src==null?null:_.src)||n.getAttribute("type")!==(_.type==null?null:_.type)||n.getAttribute("crossorigin")!==(_.crossOrigin==null?null:_.crossOrigin))&&w&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(a==="input"&&n.type==="hidden"){var w=_.name==null?null:""+_.name;if(_.type==="hidden"&&n.getAttribute("name")===w)return n}else return n;if(n=Ms(n.nextSibling),n===null)break}return null}function YR(n,a,i){if(a==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Ms(n.nextSibling),n===null))return null;return n}function Q0(n,a){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!a||(n=Ms(n.nextSibling),n===null))return null;return n}function mh(n){return n.data==="$?"||n.data==="$~"}function hh(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function KR(n,a){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=a;else if(n.data!=="$?"||i.readyState!=="loading")a();else{var d=function(){a(),i.removeEventListener("DOMContentLoaded",d)};i.addEventListener("DOMContentLoaded",d),n._reactRetry=d}}function Ms(n){for(;n!=null;n=n.nextSibling){var a=n.nodeType;if(a===1||a===3)break;if(a===8){if(a=n.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return n}var gh=null;function W0(n){n=n.nextSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(a===0)return Ms(n.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}n=n.nextSibling}return null}function Z0(n){n=n.previousSibling;for(var a=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return n;a--}else i!=="/$"&&i!=="/&"||a++}n=n.previousSibling}return null}function J0(n,a,i){switch(a=Ju(i),n){case"html":if(n=a.documentElement,!n)throw Error(o(452));return n;case"head":if(n=a.head,!n)throw Error(o(453));return n;case"body":if(n=a.body,!n)throw Error(o(454));return n;default:throw Error(o(451))}}function Hi(n){for(var a=n.attributes;a.length;)n.removeAttributeNode(a[0]);bp(n)}var Os=new Map,e1=new Set;function ed(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var La=X.d;X.d={f:XR,r:QR,D:WR,C:ZR,L:JR,m:eT,X:nT,S:tT,M:sT};function XR(){var n=La.f(),a=Fu();return n||a}function QR(n){var a=Io(n);a!==null&&a.tag===5&&a.type==="form"?xy(a):La.r(n)}var gl=typeof document>"u"?null:document;function t1(n,a,i){var d=gl;if(d&&typeof a=="string"&&a){var _=Ss(a);_='link[rel="'+n+'"][href="'+_+'"]',typeof i=="string"&&(_+='[crossorigin="'+i+'"]'),e1.has(_)||(e1.add(_),n={rel:n,crossOrigin:i,href:a},d.querySelector(_)===null&&(a=d.createElement("link"),In(a,"link",n),Nn(a),d.head.appendChild(a)))}}function WR(n){La.D(n),t1("dns-prefetch",n,null)}function ZR(n,a){La.C(n,a),t1("preconnect",n,a)}function JR(n,a,i){La.L(n,a,i);var d=gl;if(d&&n&&a){var _='link[rel="preload"][as="'+Ss(a)+'"]';a==="image"&&i&&i.imageSrcSet?(_+='[imagesrcset="'+Ss(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(_+='[imagesizes="'+Ss(i.imageSizes)+'"]')):_+='[href="'+Ss(n)+'"]';var w=_;switch(a){case"style":w=xl(n);break;case"script":w=bl(n)}Os.has(w)||(n=b({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:n,as:a},i),Os.set(w,n),d.querySelector(_)!==null||a==="style"&&d.querySelector(Vi(w))||a==="script"&&d.querySelector(qi(w))||(a=d.createElement("link"),In(a,"link",n),Nn(a),d.head.appendChild(a)))}}function eT(n,a){La.m(n,a);var i=gl;if(i&&n){var d=a&&typeof a.as=="string"?a.as:"script",_='link[rel="modulepreload"][as="'+Ss(d)+'"][href="'+Ss(n)+'"]',w=_;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":w=bl(n)}if(!Os.has(w)&&(n=b({rel:"modulepreload",href:n},a),Os.set(w,n),i.querySelector(_)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(qi(w)))return}d=i.createElement("link"),In(d,"link",n),Nn(d),i.head.appendChild(d)}}}function tT(n,a,i){La.S(n,a,i);var d=gl;if(d&&n){var _=Bo(d).hoistableStyles,w=xl(n);a=a||"default";var A=_.get(w);if(!A){var V={loading:0,preload:null};if(A=d.querySelector(Vi(w)))V.loading=5;else{n=b({rel:"stylesheet",href:n,"data-precedence":a},i),(i=Os.get(w))&&xh(n,i);var Q=A=d.createElement("link");Nn(Q),In(Q,"link",n),Q._p=new Promise(function(re,ge){Q.onload=re,Q.onerror=ge}),Q.addEventListener("load",function(){V.loading|=1}),Q.addEventListener("error",function(){V.loading|=2}),V.loading|=4,td(A,a,d)}A={type:"stylesheet",instance:A,count:1,state:V},_.set(w,A)}}}function nT(n,a){La.X(n,a);var i=gl;if(i&&n){var d=Bo(i).hoistableScripts,_=bl(n),w=d.get(_);w||(w=i.querySelector(qi(_)),w||(n=b({src:n,async:!0},a),(a=Os.get(_))&&bh(n,a),w=i.createElement("script"),Nn(w),In(w,"link",n),i.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},d.set(_,w))}}function sT(n,a){La.M(n,a);var i=gl;if(i&&n){var d=Bo(i).hoistableScripts,_=bl(n),w=d.get(_);w||(w=i.querySelector(qi(_)),w||(n=b({src:n,async:!0,type:"module"},a),(a=Os.get(_))&&bh(n,a),w=i.createElement("script"),Nn(w),In(w,"link",n),i.head.appendChild(w)),w={type:"script",instance:w,count:1,state:null},d.set(_,w))}}function n1(n,a,i,d){var _=(_=ee.current)?ed(_):null;if(!_)throw Error(o(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=xl(i.href),i=Bo(_).hoistableStyles,d=i.get(a),d||(d={type:"style",instance:null,count:0,state:null},i.set(a,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=xl(i.href);var w=Bo(_).hoistableStyles,A=w.get(n);if(A||(_=_.ownerDocument||_,A={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},w.set(n,A),(w=_.querySelector(Vi(n)))&&!w._p&&(A.instance=w,A.state.loading=5),Os.has(n)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Os.set(n,i),w||aT(_,n,i,A.state))),a&&d===null)throw Error(o(528,""));return A}if(a&&d!==null)throw Error(o(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=bl(i),i=Bo(_).hoistableScripts,d=i.get(a),d||(d={type:"script",instance:null,count:0,state:null},i.set(a,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function xl(n){return'href="'+Ss(n)+'"'}function Vi(n){return'link[rel="stylesheet"]['+n+"]"}function s1(n){return b({},n,{"data-precedence":n.precedence,precedence:null})}function aT(n,a,i,d){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?d.loading=1:(a=n.createElement("link"),d.preload=a,a.addEventListener("load",function(){return d.loading|=1}),a.addEventListener("error",function(){return d.loading|=2}),In(a,"link",i),Nn(a),n.head.appendChild(a))}function bl(n){return'[src="'+Ss(n)+'"]'}function qi(n){return"script[async]"+n}function a1(n,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var d=n.querySelector('style[data-href~="'+Ss(i.href)+'"]');if(d)return a.instance=d,Nn(d),d;var _=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return d=(n.ownerDocument||n).createElement("style"),Nn(d),In(d,"style",_),td(d,i.precedence,n),a.instance=d;case"stylesheet":_=xl(i.href);var w=n.querySelector(Vi(_));if(w)return a.state.loading|=4,a.instance=w,Nn(w),w;d=s1(i),(_=Os.get(_))&&xh(d,_),w=(n.ownerDocument||n).createElement("link"),Nn(w);var A=w;return A._p=new Promise(function(V,Q){A.onload=V,A.onerror=Q}),In(w,"link",d),a.state.loading|=4,td(w,i.precedence,n),a.instance=w;case"script":return w=bl(i.src),(_=n.querySelector(qi(w)))?(a.instance=_,Nn(_),_):(d=i,(_=Os.get(w))&&(d=b({},i),bh(d,_)),n=n.ownerDocument||n,_=n.createElement("script"),Nn(_),In(_,"link",d),n.head.appendChild(_),a.instance=_);case"void":return null;default:throw Error(o(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(d=a.instance,a.state.loading|=4,td(d,i.precedence,n));return a.instance}function td(n,a,i){for(var d=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),_=d.length?d[d.length-1]:null,w=_,A=0;A<d.length;A++){var V=d[A];if(V.dataset.precedence===a)w=V;else if(w!==_)break}w?w.parentNode.insertBefore(n,w.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(n,a.firstChild))}function xh(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.title==null&&(n.title=a.title)}function bh(n,a){n.crossOrigin==null&&(n.crossOrigin=a.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=a.referrerPolicy),n.integrity==null&&(n.integrity=a.integrity)}var nd=null;function r1(n,a,i){if(nd===null){var d=new Map,_=nd=new Map;_.set(i,d)}else _=nd,d=_.get(i),d||(d=new Map,_.set(i,d));if(d.has(n))return d;for(d.set(n,null),i=i.getElementsByTagName(n),_=0;_<i.length;_++){var w=i[_];if(!(w[ri]||w[$t]||n==="link"&&w.getAttribute("rel")==="stylesheet")&&w.namespaceURI!=="http://www.w3.org/2000/svg"){var A=w.getAttribute(a)||"";A=n+A;var V=d.get(A);V?V.push(w):d.set(A,[w])}}return d}function o1(n,a,i){n=n.ownerDocument||n,n.head.insertBefore(i,a==="title"?n.querySelector("head > title"):null)}function rT(n,a,i){if(i===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function l1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function oT(n,a,i,d){if(i.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var _=xl(d.href),w=a.querySelector(Vi(_));if(w){a=w._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=sd.bind(n),a.then(n,n)),i.state.loading|=4,i.instance=w,Nn(w);return}w=a.ownerDocument||a,d=s1(d),(_=Os.get(_))&&xh(d,_),w=w.createElement("link"),Nn(w);var A=w;A._p=new Promise(function(V,Q){A.onload=V,A.onerror=Q}),In(w,"link",d),i.instance=w}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=sd.bind(n),a.addEventListener("load",i),a.addEventListener("error",i))}}var _h=0;function lT(n,a){return n.stylesheets&&n.count===0&&rd(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var d=setTimeout(function(){if(n.stylesheets&&rd(n,n.stylesheets),n.unsuspend){var w=n.unsuspend;n.unsuspend=null,w()}},6e4+a);0<n.imgBytes&&_h===0&&(_h=62500*HR());var _=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&rd(n,n.stylesheets),n.unsuspend)){var w=n.unsuspend;n.unsuspend=null,w()}},(n.imgBytes>_h?50:800)+a);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(d),clearTimeout(_)}}:null}function sd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)rd(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var ad=null;function rd(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,ad=new Map,a.forEach(iT,n),ad=null,sd.call(n))}function iT(n,a){if(!(a.state.loading&4)){var i=ad.get(n);if(i)var d=i.get(null);else{i=new Map,ad.set(n,i);for(var _=n.querySelectorAll("link[data-precedence],style[data-precedence]"),w=0;w<_.length;w++){var A=_[w];(A.nodeName==="LINK"||A.getAttribute("media")!=="not all")&&(i.set(A.dataset.precedence,A),d=A)}d&&i.set(null,d)}_=a.instance,A=_.getAttribute("data-precedence"),w=i.get(A)||d,w===d&&i.set(null,_),i.set(A,_),this.count++,d=sd.bind(this),_.addEventListener("load",d),_.addEventListener("error",d),w?w.parentNode.insertBefore(_,w.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(_,n.firstChild)),a.state.loading|=4}}var $i={$$typeof:N,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function cT(n,a,i,d,_,w,A,V,Q){this.tag=1,this.containerInfo=n,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=js(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=js(0),this.hiddenUpdates=js(null),this.identifierPrefix=d,this.onUncaughtError=_,this.onCaughtError=w,this.onRecoverableError=A,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function i1(n,a,i,d,_,w,A,V,Q,re,ge,ye){return n=new cT(n,a,i,A,Q,re,ge,ye,V),a=1,w===!0&&(a|=24),w=ms(3,null,null,a),n.current=w,w.stateNode=n,a=Zp(),a.refCount++,n.pooledCache=a,a.refCount++,w.memoizedState={element:d,isDehydrated:i,cache:a},nm(w),n}function c1(n){return n?(n=Xo,n):Xo}function u1(n,a,i,d,_,w){_=c1(_),d.context===null?d.context=_:d.pendingContext=_,d=or(a),d.payload={element:i},w=w===void 0?null:w,w!==null&&(d.callback=w),i=lr(n,d,a),i!==null&&(os(i,n,a),ji(i,n,a))}function d1(n,a){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<a?i:a}}function vh(n,a){d1(n,a),(n=n.alternate)&&d1(n,a)}function f1(n){if(n.tag===13||n.tag===31){var a=Kr(n,67108864);a!==null&&os(a,n,67108864),vh(n,67108864)}}function p1(n){if(n.tag===13||n.tag===31){var a=_s();a=ut(a);var i=Kr(n,a);i!==null&&os(i,n,a),vh(n,a)}}var od=!0;function uT(n,a,i,d){var _=q.T;q.T=null;var w=X.p;try{X.p=2,yh(n,a,i,d)}finally{X.p=w,q.T=_}}function dT(n,a,i,d){var _=q.T;q.T=null;var w=X.p;try{X.p=8,yh(n,a,i,d)}finally{X.p=w,q.T=_}}function yh(n,a,i,d){if(od){var _=jh(d);if(_===null)lh(n,a,d,ld,i),h1(n,d);else if(pT(_,n,a,i,d))d.stopPropagation();else if(h1(n,d),a&4&&-1<fT.indexOf(n)){for(;_!==null;){var w=Io(_);if(w!==null)switch(w.tag){case 3:if(w=w.stateNode,w.current.memoizedState.isDehydrated){var A=Yt(w.pendingLanes);if(A!==0){var V=w;for(V.pendingLanes|=2,V.entangledLanes|=2;A;){var Q=1<<31-Le(A);V.entanglements[1]|=Q,A&=~Q}Js(w),(zt&6)===0&&(qu=le()+500,Ii(0))}}break;case 31:case 13:V=Kr(w,2),V!==null&&os(V,w,2),Fu(),vh(w,2)}if(w=jh(d),w===null&&lh(n,a,d,ld,i),w===_)break;_=w}_!==null&&d.stopPropagation()}else lh(n,a,d,null,i)}}function jh(n){return n=kp(n),wh(n)}var ld=null;function wh(n){if(ld=null,n=Po(n),n!==null){var a=c(n);if(a===null)n=null;else{var i=a.tag;if(i===13){if(n=u(a),n!==null)return n;n=null}else if(i===31){if(n=p(a),n!==null)return n;n=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;n=null}else a!==n&&(n=null)}}return ld=n,null}function m1(n){switch(n){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(_e()){case qe:return 2;case Ne:return 8;case Oe:case et:return 32;case at:return 268435456;default:return 32}default:return 32}}var kh=!1,br=null,_r=null,vr=null,Fi=new Map,Gi=new Map,yr=[],fT="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 h1(n,a){switch(n){case"focusin":case"focusout":br=null;break;case"dragenter":case"dragleave":_r=null;break;case"mouseover":case"mouseout":vr=null;break;case"pointerover":case"pointerout":Fi.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gi.delete(a.pointerId)}}function Yi(n,a,i,d,_,w){return n===null||n.nativeEvent!==w?(n={blockedOn:a,domEventName:i,eventSystemFlags:d,nativeEvent:w,targetContainers:[_]},a!==null&&(a=Io(a),a!==null&&f1(a)),n):(n.eventSystemFlags|=d,a=n.targetContainers,_!==null&&a.indexOf(_)===-1&&a.push(_),n)}function pT(n,a,i,d,_){switch(a){case"focusin":return br=Yi(br,n,a,i,d,_),!0;case"dragenter":return _r=Yi(_r,n,a,i,d,_),!0;case"mouseover":return vr=Yi(vr,n,a,i,d,_),!0;case"pointerover":var w=_.pointerId;return Fi.set(w,Yi(Fi.get(w)||null,n,a,i,d,_)),!0;case"gotpointercapture":return w=_.pointerId,Gi.set(w,Yi(Gi.get(w)||null,n,a,i,d,_)),!0}return!1}function g1(n){var a=Po(n.target);if(a!==null){var i=c(a);if(i!==null){if(a=i.tag,a===13){if(a=u(i),a!==null){n.blockedOn=a,Cn(n.priority,function(){p1(i)});return}}else if(a===31){if(a=p(i),a!==null){n.blockedOn=a,Cn(n.priority,function(){p1(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function id(n){if(n.blockedOn!==null)return!1;for(var a=n.targetContainers;0<a.length;){var i=jh(n.nativeEvent);if(i===null){i=n.nativeEvent;var d=new i.constructor(i.type,i);wp=d,i.target.dispatchEvent(d),wp=null}else return a=Io(i),a!==null&&f1(a),n.blockedOn=i,!1;a.shift()}return!0}function x1(n,a,i){id(n)&&i.delete(a)}function mT(){kh=!1,br!==null&&id(br)&&(br=null),_r!==null&&id(_r)&&(_r=null),vr!==null&&id(vr)&&(vr=null),Fi.forEach(x1),Gi.forEach(x1)}function cd(n,a){n.blockedOn===a&&(n.blockedOn=null,kh||(kh=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,mT)))}var ud=null;function b1(n){ud!==n&&(ud=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){ud===n&&(ud=null);for(var a=0;a<n.length;a+=3){var i=n[a],d=n[a+1],_=n[a+2];if(typeof d!="function"){if(wh(d||i)===null)continue;break}var w=Io(i);w!==null&&(n.splice(a,3),a-=3,jm(w,{pending:!0,data:_,method:i.method,action:d},d,_))}}))}function _l(n){function a(Q){return cd(Q,n)}br!==null&&cd(br,n),_r!==null&&cd(_r,n),vr!==null&&cd(vr,n),Fi.forEach(a),Gi.forEach(a);for(var i=0;i<yr.length;i++){var d=yr[i];d.blockedOn===n&&(d.blockedOn=null)}for(;0<yr.length&&(i=yr[0],i.blockedOn===null);)g1(i),i.blockedOn===null&&yr.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(d=0;d<i.length;d+=3){var _=i[d],w=i[d+1],A=_[zn]||null;if(typeof w=="function")A||b1(i);else if(A){var V=null;if(w&&w.hasAttribute("formAction")){if(_=w,A=w[zn]||null)V=A.formAction;else if(wh(_)!==null)continue}else V=A.action;typeof V=="function"?i[d+1]=V:(i.splice(d,3),d-=3),b1(i)}}}function _1(){function n(w){w.canIntercept&&w.info==="react-transition"&&w.intercept({handler:function(){return new Promise(function(A){return _=A})},focusReset:"manual",scroll:"manual"})}function a(){_!==null&&(_(),_=null),d||setTimeout(i,20)}function i(){if(!d&&!navigation.transition){var w=navigation.currentEntry;w&&w.url!=null&&navigation.navigate(w.url,{state:w.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,_=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){d=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),_!==null&&(_(),_=null)}}}function Sh(n){this._internalRoot=n}dd.prototype.render=Sh.prototype.render=function(n){var a=this._internalRoot;if(a===null)throw Error(o(409));var i=a.current,d=_s();u1(i,d,n,a,null,null)},dd.prototype.unmount=Sh.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var a=n.containerInfo;u1(n.current,2,null,n,null,null),Fu(),a[Xs]=null}};function dd(n){this._internalRoot=n}dd.prototype.unstable_scheduleHydration=function(n){if(n){var a=mn();n={blockedOn:null,target:n,priority:a};for(var i=0;i<yr.length&&a!==0&&a<yr[i].priority;i++);yr.splice(i,0,n),i===0&&g1(n)}};var v1=t.version;if(v1!=="19.2.7")throw Error(o(527,v1,"19.2.7"));X.findDOMNode=function(n){var a=n._reactInternals;if(a===void 0)throw typeof n.render=="function"?Error(o(188)):(n=Object.keys(n).join(","),Error(o(268,n)));return n=h(a),n=n!==null?g(n):null,n=n===null?null:n.stateNode,n};var hT={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fd.isDisabled&&fd.supportsFiber)try{lt=fd.inject(hT),Rt=fd}catch{}}return Xi.createRoot=function(n,a){if(!l(n))throw Error(o(299));var i=!1,d="",_=Ny,w=Ey,A=Ry;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(_=a.onUncaughtError),a.onCaughtError!==void 0&&(w=a.onCaughtError),a.onRecoverableError!==void 0&&(A=a.onRecoverableError)),a=i1(n,1,!1,null,null,i,d,null,_,w,A,_1),n[Xs]=a.current,oh(n),new Sh(a)},Xi.hydrateRoot=function(n,a,i){if(!l(n))throw Error(o(299));var d=!1,_="",w=Ny,A=Ey,V=Ry,Q=null;return i!=null&&(i.unstable_strictMode===!0&&(d=!0),i.identifierPrefix!==void 0&&(_=i.identifierPrefix),i.onUncaughtError!==void 0&&(w=i.onUncaughtError),i.onCaughtError!==void 0&&(A=i.onCaughtError),i.onRecoverableError!==void 0&&(V=i.onRecoverableError),i.formState!==void 0&&(Q=i.formState)),a=i1(n,1,!0,a,i??null,d,_,Q,w,A,V,_1),a.context=c1(null),i=a.current,d=_s(),d=ut(d),_=or(d),_.callback=null,lr(i,_,d),i=d,a.current.lanes=i,pn(a,i),Js(a),n[Xs]=a.current,oh(n),new dd(a)},Xi.version="19.2.7",Xi}var T1;function CT(){if(T1)return Eh.exports;T1=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(),Eh.exports=ST(),Eh.exports}var NT=CT();const ET=Dx(NT);/**
50
- * react-router v7.18.1
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 Lx=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,yk=/^[\\/]{2}/;function RT(e,t){return t+e.replace(/\\/g,"/")}var A1="popstate";function M1(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function TT(e={}){function t(o,l){let c=l.state?.masked,{pathname:u,search:p,hash:m}=c||o.location;return $g("",{pathname:u,search:p,hash:m},l.state&&l.state.usr||null,l.state&&l.state.key||"default",c?{pathname:o.location.pathname,search:o.location.search,hash:o.location.hash}:void 0)}function s(o,l){return typeof l=="string"?l:Ec(l)}return MT(t,s,null,e)}function sn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Ls(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function AT(){return Math.random().toString(36).substring(2,10)}function O1(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 $g(e,t,s=null,o,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ql(t):t,state:s,key:t&&t.key||o||AT(),mask:l}}function Ec({pathname:e="/",search:t="",hash:s=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function Ql(e){let t={};if(e){let s=e.indexOf("#");s>=0&&(t.hash=e.substring(s),e=e.substring(0,s));let o=e.indexOf("?");o>=0&&(t.search=e.substring(o),e=e.substring(0,o)),e&&(t.pathname=e)}return t}function MT(e,t,s,o={}){let{window:l=document.defaultView,v5Compat:c=!1}=o,u=l.history,p="POP",m=null,h=g();h==null&&(h=0,u.replaceState({...u.state,idx:h},""));function g(){return(u.state||{idx:null}).idx}function b(){p="POP";let j=g(),C=j==null?null:j-h;h=j,m&&m({action:p,location:y.location,delta:C})}function v(j,C){p="PUSH";let S=M1(j)?j:$g(y.location,j,C);h=g()+1;let N=O1(S,h),R=y.createHref(S.mask||S);try{u.pushState(N,"",R)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;l.location.assign(R)}c&&m&&m({action:p,location:y.location,delta:1})}function k(j,C){p="REPLACE";let S=M1(j)?j:$g(y.location,j,C);h=g();let N=O1(S,h),R=y.createHref(S.mask||S);u.replaceState(N,"",R),c&&m&&m({action:p,location:y.location,delta:0})}function E(j){return OT(l,j)}let y={get action(){return p},get location(){return e(l,u)},listen(j){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(A1,b),m=j,()=>{l.removeEventListener(A1,b),m=null}},createHref(j){return t(l,j)},createURL:E,encodeLocation(j){let C=E(j);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:v,replace:k,go(j){return u.go(j)}};return y}function OT(e,t,s=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),sn(o,"No window.location.(origin|href) available to create URL");let l=typeof t=="string"?t:Ec(t);return l=l.replace(/ $/,"%20"),!s&&yk.test(l)&&(l=o+l),new URL(l,o)}function jk(e,t,s="/"){return zT(e,t,s,!1)}function zT(e,t,s,o,l){let c=typeof t=="string"?Ql(t):t,u=$a(c.pathname||"/",s);if(u==null)return null;let p=DT(e),m=null,h=GT(u);for(let g=0;m==null&&g<p.length;++g)m=FT(p[g],h,o);return m}function DT(e){let t=wk(e);return LT(t),t}function wk(e,t=[],s=[],o="",l=!1){let c=(u,p,m=l,h)=>{let g={relativePath:h===void 0?u.path||"":h,caseSensitive:u.caseSensitive===!0,childrenIndex:p,route:u};if(g.relativePath.startsWith("/")){if(!g.relativePath.startsWith(o)&&m)return;sn(g.relativePath.startsWith(o),`Absolute route path "${g.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),g.relativePath=g.relativePath.slice(o.length)}let b=qs([o,g.relativePath]),v=s.concat(g);u.children&&u.children.length>0&&(sn(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),wk(u.children,t,v,b,m)),!(u.path==null&&!u.index)&&t.push({path:b,score:qT(b,u.index),routesMeta:v.map((k,E)=>{let[y,j]=Ck(k.relativePath,k.caseSensitive,E===v.length-1);return{...k,matcher:y,compiledParams:j}})})};return e.forEach((u,p)=>{if(u.path===""||!u.path?.includes("?"))c(u,p);else for(let m of kk(u.path))c(u,p,!0,m)}),t}function kk(e){let t=e.split("/");if(t.length===0)return[];let[s,...o]=t,l=s.endsWith("?"),c=s.replace(/\?$/,"");if(o.length===0)return l?[c,""]:[c];let u=kk(o.join("/")),p=[];return p.push(...u.map(m=>m===""?c:[c,m].join("/"))),l&&p.push(...u),p.map(m=>e.startsWith("/")&&m===""?"/":m)}function LT(e){e.sort((t,s)=>t.score!==s.score?s.score-t.score:$T(t.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var PT=/^:[\w-]+$/,IT=3,BT=2,UT=1,HT=10,VT=-2,z1=e=>e==="*";function qT(e,t){let s=e.split("/"),o=s.length;return s.some(z1)&&(o+=VT),t&&(o+=BT),s.filter(l=>!z1(l)).reduce((l,c)=>l+(PT.test(c)?IT:c===""?UT:HT),o)}function $T(e,t){return e.length===t.length&&e.slice(0,-1).every((o,l)=>o===t[l])?e[e.length-1]-t[t.length-1]:0}function FT(e,t,s=!1){let{routesMeta:o}=e,l={},c="/",u=[];for(let p=0;p<o.length;++p){let m=o[p],h=p===o.length-1,g=c==="/"?t:t.slice(c.length)||"/",b={path:m.relativePath,caseSensitive:m.caseSensitive,end:h},v=m.matcher&&m.compiledParams?Sk(b,g,m.matcher,m.compiledParams):Yd(b,g),k=m.route;if(!v&&h&&s&&!o[o.length-1].route.index&&(v=Yd({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},g)),!v)return null;Object.assign(l,v.params),u.push({params:l,pathname:qs([c,v.pathname]),pathnameBase:XT(qs([c,v.pathnameBase])),route:k}),v.pathnameBase!=="/"&&(c=qs([c,v.pathnameBase]))}return u}function Yd(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,o]=Ck(e.path,e.caseSensitive,e.end);return Sk(e,t,s,o)}function Sk(e,t,s,o){let l=t.match(s);if(!l)return null;let c=l[0],u=c.replace(/(.)\/+$/,"$1"),p=l.slice(1);return{params:o.reduce((h,{paramName:g,isOptional:b},v)=>{if(g==="*"){let E=p[v]||"";u=c.slice(0,c.length-E.length).replace(/(.)\/+$/,"$1")}const k=p[v];return b&&!k?h[g]=void 0:h[g]=(k||"").replace(/%2F/g,"/"),h},{}),pathname:c,pathnameBase:u,pattern:e}}function Ck(e,t=!1,s=!0){Ls(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let o=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,p,m,h,g)=>{if(o.push({paramName:p,isOptional:m!=null}),m){let b=g.charAt(h+u.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),o]}function GT(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Ls(!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 $a(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let s=t.endsWith("/")?t.length-1:t.length,o=e.charAt(s);return o&&o!=="/"?null:e.slice(s)||"/"}function YT(e,t="/"){let{pathname:s,search:o="",hash:l=""}=typeof e=="string"?Ql(e):e,c;return s?(s=Nk(s),s.startsWith("/")?c=D1(s.substring(1),"/"):c=D1(s,t)):c=t,{pathname:c,search:QT(o),hash:WT(l)}}function D1(e,t){let s=Kd(t).split("/");return e.split("/").forEach(l=>{l===".."?s.length>1&&s.pop():l!=="."&&s.push(l)}),s.length>1?s.join("/"):"/"}function Mh(e,t,s,o){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function KT(e){return e.filter((t,s)=>s===0||t.route.path&&t.route.path.length>0)}function Px(e){let t=KT(e);return t.map((s,o)=>o===t.length-1?s.pathname:s.pathnameBase)}function Cf(e,t,s,o=!1){let l;typeof e=="string"?l=Ql(e):(l={...e},sn(!l.pathname||!l.pathname.includes("?"),Mh("?","pathname","search",l)),sn(!l.pathname||!l.pathname.includes("#"),Mh("#","pathname","hash",l)),sn(!l.search||!l.search.includes("#"),Mh("#","search","hash",l)));let c=e===""||l.pathname==="",u=c?"/":l.pathname,p;if(u==null)p=s;else{let b=t.length-1;if(!o&&u.startsWith("..")){let v=u.split("/");for(;v[0]==="..";)v.shift(),b-=1;l.pathname=v.join("/")}p=b>=0?t[b]:"/"}let m=YT(l,p),h=u&&u!=="/"&&u.endsWith("/"),g=(c||u===".")&&s.endsWith("/");return!m.pathname.endsWith("/")&&(h||g)&&(m.pathname+="/"),m}var Nk=e=>e.replace(/[\\/]{2,}/g,"/"),qs=e=>Nk(e.join("/")),Kd=e=>e.replace(/\/+$/,""),XT=e=>Kd(e).replace(/^\/*/,"/"),QT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,WT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,ZT=class{constructor(e,t,s,o=!1){this.status=e,this.statusText=t||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function JT(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function eA(e){let t=e.map(s=>s.route.path).filter(Boolean);return qs(t)||"/"}var Ek=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Rk(e,t){let s=e;if(typeof s!="string"||!Lx.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,l=!1;if(Ek)try{let c=new URL(window.location.href),u=yk.test(s)?new URL(RT(s,c.protocol)):new URL(s),p=$a(u.pathname,t);u.origin===c.origin&&p!=null?s=p+u.search+u.hash:l=!0}catch{Ls(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:l,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Tk=["POST","PUT","PATCH","DELETE"];new Set(Tk);var tA=["GET",...Tk];new Set(tA);var nA=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function sA(e){try{return nA.includes(new URL(e).protocol)}catch{return!1}}var Wl=x.createContext(null);Wl.displayName="DataRouter";var Nf=x.createContext(null);Nf.displayName="DataRouterState";var Ak=x.createContext(!1);function aA(){return x.useContext(Ak)}var Mk=x.createContext({isTransitioning:!1});Mk.displayName="ViewTransition";var rA=x.createContext(new Map);rA.displayName="Fetchers";var oA=x.createContext(null);oA.displayName="Await";var ys=x.createContext(null);ys.displayName="Navigation";var Vc=x.createContext(null);Vc.displayName="Location";var Fs=x.createContext({outlet:null,matches:[],isDataRoute:!1});Fs.displayName="Route";var Ix=x.createContext(null);Ix.displayName="RouteError";var Ok="REACT_ROUTER_ERROR",lA="REDIRECT",iA="ROUTE_ERROR_RESPONSE";function cA(e){if(e.startsWith(`${Ok}:${lA}:{`))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 uA(e){if(e.startsWith(`${Ok}:${iA}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new ZT(t.status,t.statusText,t.data)}catch{}}function dA(e,{relative:t}={}){sn(Zl(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=x.useContext(ys),{hash:l,pathname:c,search:u}=qc(e,{relative:t}),p=c;return s!=="/"&&(p=c==="/"?s:qs([s,c])),o.createHref({pathname:p,search:u,hash:l})}function Zl(){return x.useContext(Vc)!=null}function Zn(){return sn(Zl(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Vc).location}var zk="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Dk(e){x.useContext(ys).static||x.useLayoutEffect(e)}function Yn(){let{isDataRoute:e}=x.useContext(Fs);return e?kA():fA()}function fA(){sn(Zl(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Wl),{basename:t,navigator:s}=x.useContext(ys),{matches:o}=x.useContext(Fs),{pathname:l}=Zn(),c=JSON.stringify(Px(o)),u=x.useRef(!1);return Dk(()=>{u.current=!0}),x.useCallback((m,h={})=>{if(Ls(u.current,zk),!u.current)return;if(typeof m=="number"){s.go(m);return}let g=Cf(m,JSON.parse(c),l,h.relative==="path");e==null&&t!=="/"&&(g.pathname=g.pathname==="/"?t:qs([t,g.pathname])),(h.replace?s.replace:s.push)(g,h.state,h)},[t,s,c,l,e])}x.createContext(null);function Lk(){let{matches:e}=x.useContext(Fs);return e[e.length-1]?.params??{}}function qc(e,{relative:t}={}){let{matches:s}=x.useContext(Fs),{pathname:o}=Zn(),l=JSON.stringify(Px(s));return x.useMemo(()=>Cf(e,JSON.parse(l),o,t==="path"),[e,l,o,t])}function pA(e,t){return Pk(e,t)}function Pk(e,t,s){sn(Zl(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(ys),{matches:l}=x.useContext(Fs),c=l[l.length-1],u=c?c.params:{},p=c?c.pathname:"/",m=c?c.pathnameBase:"/",h=c&&c.route;{let j=h&&h.path||"";Bk(p,!h||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${j}">) 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="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let g=Zn(),b;if(t){let j=typeof t=="string"?Ql(t):t;sn(m==="/"||j.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 "${j.pathname}" was given in the \`location\` prop.`),b=j}else b=g;let v=b.pathname||"/",k=v;if(m!=="/"){let j=m.replace(/^\//,"").split("/");k="/"+v.replace(/^\//,"").split("/").slice(j.length).join("/")}let E=s&&s.state.matches.length?s.state.matches.map(j=>Object.assign(j,{route:s.manifest[j.route.id]||j.route})):jk(e,{pathname:k});Ls(h||E!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Ls(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=bA(E&&E.map(j=>Object.assign({},j,{params:Object.assign({},u,j.params),pathname:qs([m,o.encodeLocation?o.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?m:qs([m,o.encodeLocation?o.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),l,s);return t&&y?x.createElement(Vc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},y):y}function mA(){let e=wA(),t=JT(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:o},c={padding:"2px 4px",backgroundColor:o},u=null;return console.error("Error handled by React Router default ErrorBoundary:",e),u=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:c},"ErrorBoundary")," or"," ",x.createElement("code",{style:c},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),s?x.createElement("pre",{style:l},s):null,u)}var hA=x.createElement(mA,null),Ik=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const s=uA(e.digest);s&&(e=s)}let t=e!==void 0?x.createElement(Fs.Provider,{value:this.props.routeContext},x.createElement(Ix.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(gA,{error:e},t):t}};Ik.contextType=Ak;var Oh=new WeakMap;function gA({children:e,error:t}){let{basename:s}=x.useContext(ys);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=cA(t.digest);if(o){let l=Oh.get(t);if(l)throw l;let c=Rk(o.location,s),u=c.absoluteURL||c.to;if(sA(u))throw new Error("Invalid redirect location");if(Ek&&!Oh.get(t))if(c.isExternal||o.reloadDocument)window.location.href=u;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:o.replace}));throw Oh.set(t,p),p}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${u}`})}}return e}function xA({routeContext:e,match:t,children:s}){let o=x.useContext(Wl);return o&&o.static&&o.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(Fs.Provider,{value:e},s)}function bA(e,t=[],s){let o=s?.state;if(e==null){if(!o)return null;if(o.errors)e=o.matches;else if(t.length===0&&!o.initialized&&o.matches.length>0)e=o.matches;else return null}let l=e,c=o?.errors;if(c!=null){let g=l.findIndex(b=>b.route.id&&c?.[b.route.id]!==void 0);sn(g>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),l=l.slice(0,Math.min(l.length,g+1))}let u=!1,p=-1;if(s&&o){u=o.renderFallback;for(let g=0;g<l.length;g++){let b=l[g];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=g),b.route.id){let{loaderData:v,errors:k}=o,E=b.route.loader&&!v.hasOwnProperty(b.route.id)&&(!k||k[b.route.id]===void 0);if(b.route.lazy||E){s.isStatic&&(u=!0),p>=0?l=l.slice(0,p+1):l=[l[0]];break}}}}let m=s?.onError,h=o&&m?(g,b)=>{m(g,{location:o.location,params:o.matches?.[0]?.params??{},pattern:eA(o.matches),errorInfo:b})}:void 0;return l.reduceRight((g,b,v)=>{let k,E=!1,y=null,j=null;o&&(k=c&&b.route.id?c[b.route.id]:void 0,y=b.route.errorElement||hA,u&&(p<0&&v===0?(Bk("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),E=!0,j=null):p===v&&(E=!0,j=b.route.hydrateFallbackElement||null)));let C=t.concat(l.slice(0,v+1)),S=()=>{let N;return k?N=y:E?N=j:b.route.Component?N=x.createElement(b.route.Component,null):b.route.element?N=b.route.element:N=g,x.createElement(xA,{match:b,routeContext:{outlet:g,matches:C,isDataRoute:o!=null},children:N})};return o&&(b.route.ErrorBoundary||b.route.errorElement||v===0)?x.createElement(Ik,{location:o.location,revalidation:o.revalidation,component:y,error:k,children:S(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:h}):S()},null)}function Bx(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function _A(e){let t=x.useContext(Wl);return sn(t,Bx(e)),t}function vA(e){let t=x.useContext(Nf);return sn(t,Bx(e)),t}function yA(e){let t=x.useContext(Fs);return sn(t,Bx(e)),t}function Ux(e){let t=yA(e),s=t.matches[t.matches.length-1];return sn(s.route.id,`${e} can only be used on routes that contain a unique "id"`),s.route.id}function jA(){return Ux("useRouteId")}function wA(){let e=x.useContext(Ix),t=vA("useRouteError"),s=Ux("useRouteError");return e!==void 0?e:t.errors?.[s]}function kA(){let{router:e}=_A("useNavigate"),t=Ux("useNavigate"),s=x.useRef(!1);return Dk(()=>{s.current=!0}),x.useCallback(async(l,c={})=>{Ls(s.current,zk),s.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...c}))},[e,t])}var L1={};function Bk(e,t,s){!t&&!L1[e]&&(L1[e]=!0,Ls(!1,s))}x.memo(SA);function SA({routes:e,manifest:t,future:s,state:o,isStatic:l,onError:c}){return Pk(e,void 0,{manifest:t,state:o,isStatic:l,onError:c})}function CA({to:e,replace:t,state:s,relative:o}){sn(Zl(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=x.useContext(ys);Ls(!l,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:c}=x.useContext(Fs),{pathname:u}=Zn(),p=Yn(),m=Cf(e,Px(c),u,o==="path"),h=JSON.stringify(m);return x.useEffect(()=>{p(JSON.parse(h),{replace:t,state:s,relative:o})},[p,h,o,t,s]),null}function Kt(e){sn(!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 NA({basename:e="/",children:t=null,location:s,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:u}){sn(!Zl(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let p=e.replace(/^\/*/,"/"),m=x.useMemo(()=>({basename:p,navigator:l,static:c,useTransitions:u,future:{}}),[p,l,c,u]);typeof s=="string"&&(s=Ql(s));let{pathname:h="/",search:g="",hash:b="",state:v=null,key:k="default",mask:E}=s,y=x.useMemo(()=>{let j=$a(h,p);return j==null?null:{location:{pathname:j,search:g,hash:b,state:v,key:k,mask:E},navigationType:o}},[p,h,g,b,v,k,o,E]);return Ls(y!=null,`<Router basename="${p}"> is not able to match the URL "${h}${g}${b}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:x.createElement(ys.Provider,{value:m},x.createElement(Vc.Provider,{children:t,value:y}))}function Uk({children:e,location:t}){return pA(Fg(e),t)}function Fg(e,t=[]){let s=[];return x.Children.forEach(e,(o,l)=>{if(!x.isValidElement(o))return;let c=[...t,l];if(o.type===x.Fragment){s.push.apply(s,Fg(o.props.children,c));return}sn(o.type===Kt,`[${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>`),sn(!o.props.index||!o.props.children,"An index route cannot have child routes.");let u={id:o.props.id||c.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(u.children=Fg(o.props.children,c)),s.push(u)}),s}var Bd="get",Ud="application/x-www-form-urlencoded";function Ef(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function EA(e){return Ef(e)&&e.tagName.toLowerCase()==="button"}function RA(e){return Ef(e)&&e.tagName.toLowerCase()==="form"}function TA(e){return Ef(e)&&e.tagName.toLowerCase()==="input"}function AA(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function MA(e,t){return e.button===0&&(!t||t==="_self")&&!AA(e)}function Gg(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,s)=>{let o=e[s];return t.concat(Array.isArray(o)?o.map(l=>[s,l]):[[s,o]])},[]))}function OA(e,t){let s=Gg(e);return t&&t.forEach((o,l)=>{s.has(l)||t.getAll(l).forEach(c=>{s.append(l,c)})}),s}var pd=null;function zA(){if(pd===null)try{new FormData(document.createElement("form"),0),pd=!1}catch{pd=!0}return pd}var DA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function zh(e){return e!=null&&!DA.has(e)?(Ls(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Ud}"`),null):e}function LA(e,t){let s,o,l,c,u;if(RA(e)){let p=e.getAttribute("action");o=p?$a(p,t):null,s=e.getAttribute("method")||Bd,l=zh(e.getAttribute("enctype"))||Ud,c=new FormData(e)}else if(EA(e)||TA(e)&&(e.type==="submit"||e.type==="image")){let p=e.form;if(p==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=e.getAttribute("formaction")||p.getAttribute("action");if(o=m?$a(m,t):null,s=e.getAttribute("formmethod")||p.getAttribute("method")||Bd,l=zh(e.getAttribute("formenctype"))||zh(p.getAttribute("enctype"))||Ud,c=new FormData(p,e),!zA()){let{name:h,type:g,value:b}=e;if(g==="image"){let v=h?`${h}.`:"";c.append(`${v}x`,"0"),c.append(`${v}y`,"0")}else h&&c.append(h,b)}}else{if(Ef(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=Bd,o=null,l=Ud,u=e}return c&&l==="text/plain"&&(u=c,c=void 0),{action:o,method:s.toLowerCase(),encType:l,formData:c,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function Hx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Hk(e,t,s,o){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return s?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${o}`:l.pathname=`${l.pathname}.${o}`:l.pathname==="/"?l.pathname=`_root.${o}`:t&&$a(l.pathname,t)==="/"?l.pathname=`${Kd(t)}/_root.${o}`:l.pathname=`${Kd(l.pathname)}.${o}`,l}async function PA(e,t){if(e.id in t)return t[e.id];try{let s=await import(e.module);return t[e.id]=s,s}catch(s){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function IA(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 BA(e,t,s){let o=await Promise.all(e.map(async l=>{let c=t.routes[l.route.id];if(c){let u=await PA(c,s);return u.links?u.links():[]}return[]}));return qA(o.flat(1).filter(IA).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function P1(e,t,s,o,l,c){let u=(m,h)=>s[h]?m.route.id!==s[h].route.id:!0,p=(m,h)=>s[h].pathname!==m.pathname||s[h].route.path?.endsWith("*")&&s[h].params["*"]!==m.params["*"];return c==="assets"?t.filter((m,h)=>u(m,h)||p(m,h)):c==="data"?t.filter((m,h)=>{let g=o.routes[m.route.id];if(!g||!g.hasLoader)return!1;if(u(m,h)||p(m,h))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:s[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function UA(e,t,{includeHydrateFallback:s}={}){return HA(e.map(o=>{let l=t.routes[o.route.id];if(!l)return[];let c=[l.module];return l.clientActionModule&&(c=c.concat(l.clientActionModule)),l.clientLoaderModule&&(c=c.concat(l.clientLoaderModule)),s&&l.hydrateFallbackModule&&(c=c.concat(l.hydrateFallbackModule)),l.imports&&(c=c.concat(l.imports)),c}).flat(1))}function HA(e){return[...new Set(e)]}function VA(e){let t={},s=Object.keys(e).sort();for(let o of s)t[o]=e[o];return t}function qA(e,t){let s=new Set;return new Set(t),e.reduce((o,l)=>{let c=JSON.stringify(VA(l));return s.has(c)||(s.add(c),o.push({key:c,link:l})),o},[])}function Vx(){let e=x.useContext(Wl);return Hx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function $A(){let e=x.useContext(Nf);return Hx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var qx=x.createContext(void 0);qx.displayName="FrameworkContext";function Rf(){let e=x.useContext(qx);return Hx(e,"You must render this element inside a <HydratedRouter> element"),e}function FA(e,t){let s=x.useContext(qx),[o,l]=x.useState(!1),[c,u]=x.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:h,onMouseLeave:g,onTouchStart:b}=t,v=x.useRef(null);x.useEffect(()=>{if(e==="render"&&u(!0),e==="viewport"){let y=C=>{C.forEach(S=>{u(S.isIntersecting)})},j=new IntersectionObserver(y,{threshold:.5});return v.current&&j.observe(v.current),()=>{j.disconnect()}}},[e]),x.useEffect(()=>{if(o){let y=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(y)}}},[o]);let k=()=>{l(!0)},E=()=>{l(!1),u(!1)};return s?e!=="intent"?[c,v,{}]:[c,v,{onFocus:Qi(p,k),onBlur:Qi(m,E),onMouseEnter:Qi(h,k),onMouseLeave:Qi(g,E),onTouchStart:Qi(b,k)}]:[!1,v,{}]}function Qi(e,t){return s=>{e&&e(s),s.defaultPrevented||t(s)}}function GA({page:e,...t}){let s=aA(),{nonce:o}=Rf(),{router:l}=Vx(),c=x.useMemo(()=>jk(l.routes,e,l.basename),[l.routes,e,l.basename]);return c?(t.nonce==null&&o&&(t={...t,nonce:o}),s?x.createElement(KA,{page:e,matches:c,...t}):x.createElement(XA,{page:e,matches:c,...t})):null}function YA(e){let{manifest:t,routeModules:s}=Rf(),[o,l]=x.useState([]);return x.useEffect(()=>{let c=!1;return BA(e,t,s).then(u=>{c||l(u)}),()=>{c=!0}},[e,t,s]),o}function KA({page:e,matches:t,...s}){let o=Zn(),{future:l}=Rf(),{basename:c}=Vx(),u=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let p=Hk(e,c,l.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,h=[];for(let g of t)typeof g.route.shouldRevalidate=="function"?m=!0:h.push(g.route.id);return m&&h.length>0&&p.searchParams.set("_routes",h.join(",")),[p.pathname+p.search]},[c,l.v8_trailingSlashAwareDataRequests,e,o,t]);return x.createElement(x.Fragment,null,u.map(p=>x.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...s})))}function XA({page:e,matches:t,...s}){let o=Zn(),{future:l,manifest:c,routeModules:u}=Rf(),{basename:p}=Vx(),{loaderData:m,matches:h}=$A(),g=x.useMemo(()=>P1(e,t,h,c,o,"data"),[e,t,h,c,o]),b=x.useMemo(()=>P1(e,t,h,c,o,"assets"),[e,t,h,c,o]),v=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let y=new Set,j=!1;if(t.forEach(S=>{let N=c.routes[S.route.id];!N||!N.hasLoader||(!g.some(R=>R.route.id===S.route.id)&&S.route.id in m&&u[S.route.id]?.shouldRevalidate||N.hasClientLoader?j=!0:y.add(S.route.id))}),y.size===0)return[];let C=Hk(e,p,l.v8_trailingSlashAwareDataRequests,"data");return j&&y.size>0&&C.searchParams.set("_routes",t.filter(S=>y.has(S.route.id)).map(S=>S.route.id).join(",")),[C.pathname+C.search]},[p,l.v8_trailingSlashAwareDataRequests,m,o,c,g,t,e,u]),k=x.useMemo(()=>UA(b,c),[b,c]),E=YA(b);return x.createElement(x.Fragment,null,v.map(y=>x.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...s})),k.map(y=>x.createElement("link",{key:y,rel:"modulepreload",href:y,...s})),E.map(({key:y,link:j})=>x.createElement("link",{key:y,nonce:s.nonce,...j,crossOrigin:j.crossOrigin??s.crossOrigin})))}function QA(...e){return t=>{e.forEach(s=>{typeof s=="function"?s(t):s!=null&&(s.current=t)})}}var WA=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{WA&&(window.__reactRouterVersion="7.18.1")}catch{}function ZA({basename:e,children:t,useTransitions:s,window:o}){let l=x.useRef();l.current==null&&(l.current=TT({window:o,v5Compat:!0}));let c=l.current,[u,p]=x.useState({action:c.action,location:c.location}),m=x.useCallback(h=>{s===!1?p(h):x.startTransition(()=>p(h))},[s]);return x.useLayoutEffect(()=>c.listen(m),[c,m]),x.createElement(NA,{basename:e,children:t,location:u.location,navigationType:u.action,navigator:c,useTransitions:s})}var Tf=x.forwardRef(function({onClick:t,discover:s="render",prefetch:o="none",relative:l,reloadDocument:c,replace:u,mask:p,state:m,target:h,to:g,preventScrollReset:b,viewTransition:v,defaultShouldRevalidate:k,...E},y){let{basename:j,navigator:C,useTransitions:S}=x.useContext(ys),N=typeof g=="string"&&Lx.test(g),R=Rk(g,j);g=R.to;let M=dA(g,{relative:l}),T=Zn(),z=null;if(p){let $=Cf(p,[],T.mask?T.mask.pathname:"/",!0);j!=="/"&&($.pathname=$.pathname==="/"?j:qs([j,$.pathname])),z=C.createHref($)}let[D,U,L]=FA(o,E),H=tM(g,{replace:u,mask:p,state:m,target:h,preventScrollReset:b,relative:l,viewTransition:v,defaultShouldRevalidate:k,useTransitions:S});function O($){t&&t($),$.defaultPrevented||H($)}let P=!(R.isExternal||c),B=x.createElement("a",{...E,...L,href:(P?z:void 0)||R.absoluteURL||M,onClick:P?O:t,ref:QA(y,U),target:h,"data-discover":!N&&s==="render"?"true":void 0});return D&&!N?x.createElement(x.Fragment,null,B,x.createElement(GA,{page:M})):B});Tf.displayName="Link";var Vk=x.forwardRef(function({"aria-current":t="page",caseSensitive:s=!1,className:o="",end:l=!1,style:c,to:u,viewTransition:p,children:m,...h},g){let b=qc(u,{relative:h.relative}),v=Zn(),k=x.useContext(Nf),{navigator:E,basename:y}=x.useContext(ys),j=k!=null&&oM(b)&&p===!0,C=E.encodeLocation?E.encodeLocation(b).pathname:b.pathname,S=v.pathname,N=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;s||(S=S.toLowerCase(),N=N?N.toLowerCase():null,C=C.toLowerCase()),N&&y&&(N=$a(N,y)||N);const R=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let M=S===C||!l&&S.startsWith(C)&&S.charAt(R)==="/",T=N!=null&&(N===C||!l&&N.startsWith(C)&&N.charAt(C.length)==="/"),z={isActive:M,isPending:T,isTransitioning:j},D=M?t:void 0,U;typeof o=="function"?U=o(z):U=[o,M?"active":null,T?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let L=typeof c=="function"?c(z):c;return x.createElement(Tf,{...h,"aria-current":D,className:U,ref:g,style:L,to:u,viewTransition:p},typeof m=="function"?m(z):m)});Vk.displayName="NavLink";var JA=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:s,reloadDocument:o,replace:l,state:c,method:u=Bd,action:p,onSubmit:m,relative:h,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v,...k},E)=>{let{useTransitions:y}=x.useContext(ys),j=aM(),C=rM(p,{relative:h}),S=u.toLowerCase()==="get"?"get":"post",N=typeof p=="string"&&Lx.test(p),R=M=>{if(m&&m(M),M.defaultPrevented)return;M.preventDefault();let T=M.nativeEvent.submitter,z=T?.getAttribute("formmethod")||u,D=()=>j(T||M.currentTarget,{fetcherKey:t,method:z,navigate:s,replace:l,state:c,relative:h,preventScrollReset:g,viewTransition:b,defaultShouldRevalidate:v});y&&s!==!1?x.startTransition(()=>D()):D()};return x.createElement("form",{ref:E,method:S,action:C,onSubmit:o?m:R,...k,"data-discover":!N&&e==="render"?"true":void 0})});JA.displayName="Form";function eM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function qk(e){let t=x.useContext(Wl);return sn(t,eM(e)),t}function tM(e,{target:t,replace:s,mask:o,state:l,preventScrollReset:c,relative:u,viewTransition:p,defaultShouldRevalidate:m,useTransitions:h}={}){let g=Yn(),b=Zn(),v=qc(e,{relative:u});return x.useCallback(k=>{if(MA(k,t)){k.preventDefault();let E=s!==void 0?s:Ec(b)===Ec(v),y=()=>g(e,{replace:E,mask:o,state:l,preventScrollReset:c,relative:u,viewTransition:p,defaultShouldRevalidate:m});h?x.startTransition(()=>y()):y()}},[b,g,v,s,o,l,t,e,c,u,p,m,h])}function $c(e){Ls(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(Gg(e)),s=x.useRef(!1),o=Zn(),l=x.useMemo(()=>OA(o.search,s.current?null:t.current),[o.search]),c=Yn(),u=x.useCallback((p,m)=>{const h=Gg(typeof p=="function"?p(new URLSearchParams(l)):p);s.current=!0,c("?"+h,m)},[c,l]);return[l,u]}var nM=0,sM=()=>`__${String(++nM)}__`;function aM(){let{router:e}=qk("useSubmit"),{basename:t}=x.useContext(ys),s=jA(),o=e.fetch,l=e.navigate;return x.useCallback(async(c,u={})=>{let{action:p,method:m,encType:h,formData:g,body:b}=LA(c,t);if(u.navigate===!1){let v=u.fetcherKey||sM();await o(v,s,u.action||p,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:b,formMethod:u.method||m,formEncType:u.encType||h,flushSync:u.flushSync})}else await l(u.action||p,{defaultShouldRevalidate:u.defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:g,body:b,formMethod:u.method||m,formEncType:u.encType||h,replace:u.replace,state:u.state,fromRouteId:s,flushSync:u.flushSync,viewTransition:u.viewTransition})},[o,l,t,s])}function rM(e,{relative:t}={}){let{basename:s}=x.useContext(ys),o=x.useContext(Fs);sn(o,"useFormAction must be used inside a RouteContext");let[l]=o.matches.slice(-1),c={...qc(e||".",{relative:t})},u=Zn();if(e==null){c.search=u.search;let p=new URLSearchParams(c.search),m=p.getAll("index");if(m.some(g=>g==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let g=p.toString();c.search=g?`?${g}`:""}}return(!e||e===".")&&l.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(c.pathname=c.pathname==="/"?s:qs([s,c.pathname])),Ec(c)}function oM(e,{relative:t}={}){let s=x.useContext(Mk);sn(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=qk("useViewTransitionState"),l=qc(e,{relative:t});if(!s.isTransitioning)return!1;let c=$a(s.currentLocation.pathname,o)||s.currentLocation.pathname,u=$a(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Yd(l.pathname,u)!=null||Yd(l.pathname,c)!=null}var Ps=vk();/**
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 lM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),$k=(...e)=>e.filter((t,s,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===s).join(" ").trim();/**
66
- * @license lucide-react v0.469.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */var iM={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 cM=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:u,...p},m)=>x.createElement("svg",{ref:m,...iM,width:t,height:t,stroke:e,strokeWidth:o?Number(s)*24/Number(t):s,className:$k("lucide",l),...p},[...u.map(([h,g])=>x.createElement(h,g)),...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 Se=(e,t)=>{const s=x.forwardRef(({className:o,...l},c)=>x.createElement(cM,{ref:c,iconNode:t,className:$k(`lucide-${lM(e)}`,o),...l}));return s.displayName=`${e}`,s};/**
81
- * @license lucide-react v0.469.0 - ISC
82
- *
83
- * This source code is licensed under the ISC license.
84
- * See the LICENSE file in the root directory of this source tree.
85
- */const Fk=Se("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 Gk=Se("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 uM=Se("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
96
- * @license lucide-react v0.469.0 - ISC
97
- *
98
- * This source code is licensed under the ISC license.
99
- * See the LICENSE file in the root directory of this source tree.
100
- */const Yk=Se("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 Kk=Se("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 dM=Se("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
111
- * @license lucide-react v0.469.0 - ISC
112
- *
113
- * This source code is licensed under the ISC license.
114
- * See the LICENSE file in the root directory of this source tree.
115
- */const fM=Se("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 pM=Se("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 on=Se("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 mM=Se("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 hM=Se("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 Xd=Se("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 xo=Se("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
146
- * @license lucide-react v0.469.0 - ISC
147
- *
148
- * This source code is licensed under the ISC license.
149
- * See the LICENSE file in the root directory of this source tree.
150
- */const pa=Se("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
151
- * @license lucide-react v0.469.0 - ISC
152
- *
153
- * This source code is licensed under the ISC license.
154
- * See the LICENSE file in the root directory of this source tree.
155
- */const gM=Se("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
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 Jl=Se("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
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 Xk=Se("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
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 xM=Se("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
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 Qk=Se("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
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 bM=Se("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"}]]);/**
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 _M=Se("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
186
- * @license lucide-react v0.469.0 - ISC
187
- *
188
- * This source code is licensed under the ISC license.
189
- * See the LICENSE file in the root directory of this source tree.
190
- */const vM=Se("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
191
- * @license lucide-react v0.469.0 - ISC
192
- *
193
- * This source code is licensed under the ISC license.
194
- * See the LICENSE file in the root directory of this source tree.
195
- */const yM=Se("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
196
- * @license lucide-react v0.469.0 - ISC
197
- *
198
- * This source code is licensed under the ISC license.
199
- * See the LICENSE file in the root directory of this source tree.
200
- */const jM=Se("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"}]]);/**
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 Rc=Se("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"}]]);/**
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 wM=Se("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
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 kM=Se("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
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 $x=Se("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
221
- * @license lucide-react v0.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 Fa=Se("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"}]]);/**
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 Wk=Se("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"}]]);/**
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 SM=Se("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"}]]);/**
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 CM=Se("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"}]]);/**
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 Af=Se("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"}]]);/**
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 Qd=Se("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"}]]);/**
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 Wd=Se("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"}]]);/**
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 NM=Se("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"}]]);/**
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 EM=Se("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"}]]);/**
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 RM=Se("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"}]]);/**
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 TM=Se("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"}]]);/**
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 AM=Se("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"}]]);/**
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 Zk=Se("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"}]]);/**
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 MM=Se("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"}]]);/**
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 Jk=Se("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"}]]);/**
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 Mf=Se("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"}]]);/**
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 eS=Se("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"}]]);/**
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 OM=Se("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"}]]);/**
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 zM=Se("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"}]]);/**
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 Of=Se("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
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 DM=Se("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"}]]);/**
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 Fx=Se("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"}]]);/**
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 LM=Se("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"}]]);/**
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 PM=Se("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"}]]);/**
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 IM=Se("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"}]]);/**
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 Pl=Se("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"}]]);/**
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 BM=Se("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"}]]);/**
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 UM=Se("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"}]]);/**
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 HM=Se("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
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 Yg=Se("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"}]]);/**
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 VM=Se("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"}]]);/**
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 qM=Se("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"}]]);/**
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 $M=Se("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"}]]);/**
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 FM=Se("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"}]]);/**
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 GM=Se("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"}]]);/**
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 zf=Se("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 tS=Se("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"}]]);/**
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 Gx=Se("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"}]]);/**
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 Zd=Se("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"}]]);/**
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 nS=Se("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"}]]);/**
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 Yx=Se("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"}]]);/**
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 YM=Se("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
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 KM=Se("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"}]]);/**
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 sS=Se("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
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 XM=Se("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
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 To=Se("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"}]]);/**
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 Kx=Se("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 QM=Se("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"}]]);/**
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 an=Se("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 Kg=Se("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"}]]);/**
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 WM=Se("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"}]]);/**
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 ua=Se("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"}]]);/**
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 Df=Se("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"}]]);/**
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 Lf=Se("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"}]]);/**
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 Jd=Se("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"}]]);/**
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 vc=Se("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 Gs=Se("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"}]]);/**
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 aS=Se("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"}]]);/**
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 ZM=Se("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"}]]);/**
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 Tc=Se("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"}]]);/**
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 JM=Se("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
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 Za=Se("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"}]]);/**
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 e3=Se("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"}]]);/**
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 rS=Se("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
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 t3=Se("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"}]]);/**
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 Ga=Se("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
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 n3=Se("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"}]]);/**
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 Gn=Se("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"}]]);/**
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 oS=Se("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"}]]);/**
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 s3=Se("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"}]]);/**
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 Xx=Se("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"}]]);/**
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 a3=Se("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"}]]);/**
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 r3=Se("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"}]]);/**
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 ei=Se("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"}]]);/**
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 Ys=Se("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
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 Il=Se("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"}]]),Pf={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},An={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},Qx=["total","automatico","permiso"],I1=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],o3={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 l3(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches}function Dh(e){return e==="system"?l3()?"dark":"light":e}function B1(){if(typeof window>"u")return"dark";const e=localStorage.getItem(An.theme);return e==="light"||e==="dark"||e==="system"?e:"dark"}const lS=x.createContext(null);function i3({children:e}){const[t,s]=x.useState(B1),[o,l]=x.useState(()=>Dh(B1()));x.useEffect(()=>{const p=()=>{const m=Dh(t);l(m),document.documentElement.classList.toggle("dark",m==="dark")};p();try{localStorage.setItem(An.theme,t)}catch{}if(t==="system"&&typeof window.matchMedia=="function"){const m=window.matchMedia("(prefers-color-scheme: dark)");return m.addEventListener("change",p),()=>m.removeEventListener("change",p)}},[t]);const c=x.useCallback(()=>{s(p=>Dh(p)==="dark"?"light":"dark")},[]),u=x.useMemo(()=>({theme:o,preference:t,toggle:c,set:s}),[o,t,c]);return r.jsx(lS.Provider,{value:u,children:e})}function Wx(){const e=x.useContext(lS);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const c3=1367/458,u3=735/1016;function d3({size:e=32,title:t="APX",variant:s="icon"}){const{theme:o}=Wx(),l=o3[s][o];if(s==="full"){const c=e,u=Math.round(e*c3);return r.jsx("img",{src:l,alt:t,width:u,height:c,className:"block object-contain",draggable:!1})}if(s==="vertical"){const c=e,u=Math.round(e/u3);return r.jsx("img",{src:l,alt:t,width:c,height:u,className:"block object-contain",draggable:!1})}return r.jsx("img",{src:l,alt:t,width:e,height:e,className:"block object-contain",draggable:!1})}function iS(e){var t,s,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(t=0;t<l;t++)e[t]&&(s=iS(e[t]))&&(o&&(o+=" "),o+=s)}else for(s in e)e[s]&&(o&&(o+=" "),o+=s);return o}function Ac(){for(var e,t,s=0,o="",l=arguments.length;s<l;s++)(e=arguments[s])&&(t=iS(e))&&(o&&(o+=" "),o+=t);return o}const Zx="-",f3=e=>{const t=m3(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:u=>{const p=u.split(Zx);return p[0]===""&&p.length!==1&&p.shift(),cS(p,t)||p3(u)},getConflictingClassGroupIds:(u,p)=>{const m=s[u]||[];return p&&o[u]?[...m,...o[u]]:m}}},cS=(e,t)=>{if(e.length===0)return t.classGroupId;const s=e[0],o=t.nextPart.get(s),l=o?cS(e.slice(1),o):void 0;if(l)return l;if(t.validators.length===0)return;const c=e.join(Zx);return t.validators.find(({validator:u})=>u(c))?.classGroupId},U1=/^\[(.+)\]$/,p3=e=>{if(U1.test(e)){const t=U1.exec(e)[1],s=t?.substring(0,t.indexOf(":"));if(s)return"arbitrary.."+s}},m3=e=>{const{theme:t,prefix:s}=e,o={nextPart:new Map,validators:[]};return g3(Object.entries(e.classGroups),s).forEach(([c,u])=>{Xg(u,o,c,t)}),o},Xg=(e,t,s,o)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?t:H1(t,l);c.classGroupId=s;return}if(typeof l=="function"){if(h3(l)){Xg(l(o),t,s,o);return}t.validators.push({validator:l,classGroupId:s});return}Object.entries(l).forEach(([c,u])=>{Xg(u,H1(t,c),s,o)})})},H1=(e,t)=>{let s=e;return t.split(Zx).forEach(o=>{s.nextPart.has(o)||s.nextPart.set(o,{nextPart:new Map,validators:[]}),s=s.nextPart.get(o)}),s},h3=e=>e.isThemeGetter,g3=(e,t)=>t?e.map(([s,o])=>{const l=o.map(c=>typeof c=="string"?t+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([u,p])=>[t+u,p])):c);return[s,l]}):e,x3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,s=new Map,o=new Map;const l=(c,u)=>{s.set(c,u),t++,t>e&&(t=0,o=s,s=new Map)};return{get(c){let u=s.get(c);if(u!==void 0)return u;if((u=o.get(c))!==void 0)return l(c,u),u},set(c,u){s.has(c)?s.set(c,u):l(c,u)}}},uS="!",b3=e=>{const{separator:t,experimentalParseClassName:s}=e,o=t.length===1,l=t[0],c=t.length,u=p=>{const m=[];let h=0,g=0,b;for(let j=0;j<p.length;j++){let C=p[j];if(h===0){if(C===l&&(o||p.slice(j,j+c)===t)){m.push(p.slice(g,j)),g=j+c;continue}if(C==="/"){b=j;continue}}C==="["?h++:C==="]"&&h--}const v=m.length===0?p:p.substring(g),k=v.startsWith(uS),E=k?v.substring(1):v,y=b&&b>g?b-g:void 0;return{modifiers:m,hasImportantModifier:k,baseClassName:E,maybePostfixModifierPosition:y}};return s?p=>s({className:p,parseClassName:u}):u},_3=e=>{if(e.length<=1)return e;const t=[];let s=[];return e.forEach(o=>{o[0]==="["?(t.push(...s.sort(),o),s=[]):s.push(o)}),t.push(...s.sort()),t},v3=e=>({cache:x3(e.cacheSize),parseClassName:b3(e),...f3(e)}),y3=/\s+/,j3=(e,t)=>{const{parseClassName:s,getClassGroupId:o,getConflictingClassGroupIds:l}=t,c=[],u=e.trim().split(y3);let p="";for(let m=u.length-1;m>=0;m-=1){const h=u[m],{modifiers:g,hasImportantModifier:b,baseClassName:v,maybePostfixModifierPosition:k}=s(h);let E=!!k,y=o(E?v.substring(0,k):v);if(!y){if(!E){p=h+(p.length>0?" "+p:p);continue}if(y=o(v),!y){p=h+(p.length>0?" "+p:p);continue}E=!1}const j=_3(g).join(":"),C=b?j+uS:j,S=C+y;if(c.includes(S))continue;c.push(S);const N=l(y,E);for(let R=0;R<N.length;++R){const M=N[R];c.push(C+M)}p=h+(p.length>0?" "+p:p)}return p};function w3(){let e=0,t,s,o="";for(;e<arguments.length;)(t=arguments[e++])&&(s=dS(t))&&(o&&(o+=" "),o+=s);return o}const dS=e=>{if(typeof e=="string")return e;let t,s="";for(let o=0;o<e.length;o++)e[o]&&(t=dS(e[o]))&&(s&&(s+=" "),s+=t);return s};function k3(e,...t){let s,o,l,c=u;function u(m){const h=t.reduce((g,b)=>b(g),e());return s=v3(h),o=s.cache.get,l=s.cache.set,c=p,p(m)}function p(m){const h=o(m);if(h)return h;const g=j3(m,s);return l(m,g),g}return function(){return c(w3.apply(null,arguments))}}const tn=e=>{const t=s=>s[e]||[];return t.isThemeGetter=!0,t},fS=/^\[(?:([a-z-]+):)?(.+)\]$/i,S3=/^\d+\/\d+$/,C3=new Set(["px","full","screen"]),N3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,E3=/\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$/,R3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,T3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,A3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Pa=e=>Rl(e)||C3.has(e)||S3.test(e),wr=e=>ti(e,"length",B3),Rl=e=>!!e&&!Number.isNaN(Number(e)),Lh=e=>ti(e,"number",Rl),Wi=e=>!!e&&Number.isInteger(Number(e)),M3=e=>e.endsWith("%")&&Rl(e.slice(0,-1)),mt=e=>fS.test(e),kr=e=>N3.test(e),O3=new Set(["length","size","percentage"]),z3=e=>ti(e,O3,pS),D3=e=>ti(e,"position",pS),L3=new Set(["image","url"]),P3=e=>ti(e,L3,H3),I3=e=>ti(e,"",U3),Zi=()=>!0,ti=(e,t,s)=>{const o=fS.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):s(o[2]):!1},B3=e=>E3.test(e)&&!R3.test(e),pS=()=>!1,U3=e=>T3.test(e),H3=e=>A3.test(e),V3=()=>{const e=tn("colors"),t=tn("spacing"),s=tn("blur"),o=tn("brightness"),l=tn("borderColor"),c=tn("borderRadius"),u=tn("borderSpacing"),p=tn("borderWidth"),m=tn("contrast"),h=tn("grayscale"),g=tn("hueRotate"),b=tn("invert"),v=tn("gap"),k=tn("gradientColorStops"),E=tn("gradientColorStopPositions"),y=tn("inset"),j=tn("margin"),C=tn("opacity"),S=tn("padding"),N=tn("saturate"),R=tn("scale"),M=tn("sepia"),T=tn("skew"),z=tn("space"),D=tn("translate"),U=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto",mt,t],O=()=>[mt,t],P=()=>["",Pa,wr],B=()=>["auto",Rl,mt],$=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Y=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",mt],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Rl,mt];return{cacheSize:500,separator:":",theme:{colors:[Zi],spacing:[Pa,wr],blur:["none","",kr,mt],brightness:I(),borderColor:[e],borderRadius:["none","","full",kr,mt],borderSpacing:O(),borderWidth:P(),contrast:I(),grayscale:F(),hueRotate:I(),invert:F(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[M3,wr],inset:H(),margin:H(),opacity:I(),padding:O(),saturate:I(),scale:I(),sepia:F(),skew:I(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",mt]}],container:["container"],columns:[{columns:[kr]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"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:[...$(),mt]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],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",Wi,mt]}],basis:[{basis:H()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",mt]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",Wi,mt]}],"grid-cols":[{"grid-cols":[Zi]}],"col-start-end":[{col:["auto",{span:["full",Wi,mt]},mt]}],"col-start":[{"col-start":B()}],"col-end":[{"col-end":B()}],"grid-rows":[{"grid-rows":[Zi]}],"row-start-end":[{row:["auto",{span:[Wi,mt]},mt]}],"row-start":[{"row-start":B()}],"row-end":[{"row-end":B()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",mt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",mt]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...Y()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Y(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Y(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[S]}],px:[{px:[S]}],py:[{py:[S]}],ps:[{ps:[S]}],pe:[{pe:[S]}],pt:[{pt:[S]}],pr:[{pr:[S]}],pb:[{pb:[S]}],pl:[{pl:[S]}],m:[{m:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"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",mt,t]}],"min-w":[{"min-w":[mt,t,"min","max","fit"]}],"max-w":[{"max-w":[mt,t,"none","full","min","max","fit","prose",{screen:[kr]},kr]}],h:[{h:[mt,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[mt,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[mt,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[mt,t,"auto","min","max","fit"]}],"font-size":[{text:["base",kr,wr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Lh]}],"font-family":[{font:[Zi]}],"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",mt]}],"line-clamp":[{"line-clamp":["none",Rl,Lh]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Pa,mt]}],"list-image":[{"list-image":["none",mt]}],"list-style-type":[{list:["none","disc","decimal",mt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[C]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[C]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Pa,wr]}],"underline-offset":[{"underline-offset":["auto",Pa,mt]}],"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:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",mt]}],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",mt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[C]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...$(),D3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",z3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},P3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[E]}],"gradient-via-pos":[{via:[E]}],"gradient-to-pos":[{to:[E]}],"gradient-from":[{from:[k]}],"gradient-via":[{via:[k]}],"gradient-to":[{to:[k]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"border-w":[{border:[p]}],"border-w-x":[{"border-x":[p]}],"border-w-y":[{"border-y":[p]}],"border-w-s":[{"border-s":[p]}],"border-w-e":[{"border-e":[p]}],"border-w-t":[{"border-t":[p]}],"border-w-r":[{"border-r":[p]}],"border-w-b":[{"border-b":[p]}],"border-w-l":[{"border-l":[p]}],"border-opacity":[{"border-opacity":[C]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[p]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[p]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[C]}],"divide-style":[{divide:q()}],"border-color":[{border:[l]}],"border-color-x":[{"border-x":[l]}],"border-color-y":[{"border-y":[l]}],"border-color-s":[{"border-s":[l]}],"border-color-e":[{"border-e":[l]}],"border-color-t":[{"border-t":[l]}],"border-color-r":[{"border-r":[l]}],"border-color-b":[{"border-b":[l]}],"border-color-l":[{"border-l":[l]}],"divide-color":[{divide:[l]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[Pa,mt]}],"outline-w":[{outline:[Pa,wr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:P()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[C]}],"ring-offset-w":[{"ring-offset":[Pa,wr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",kr,I3]}],"shadow-color":[{shadow:[Zi]}],opacity:[{opacity:[C]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[o]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",kr,mt]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[b]}],saturate:[{saturate:[N]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[C]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[u]}],"border-spacing-x":[{"border-spacing-x":[u]}],"border-spacing-y":[{"border-spacing-y":[u]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",mt]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",mt]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",mt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[Wi,mt]}],"translate-x":[{"translate-x":[D]}],"translate-y":[{"translate-y":[D]}],"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",mt]}],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",mt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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",mt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Pa,wr,Lh]}],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"]}}},mS=k3(V3);function Te(...e){return mS(Ac(e))}const V1={};function Wn(e,t){const s=x.useRef(V1);return s.current===V1&&(s.current=e(t)),s}const Qg=[];let Wg;function q3(){return Wg}function $3(e){Qg.push(e)}function Jx(e){const t=(s,o)=>{const l=Wn(F3).current;let c;try{Wg=l;for(const u of Qg)u.before(l);c=e(s,o);for(const u of Qg)u.after(l);l.didInitialize=!0}finally{Wg=void 0}return c};return t.displayName=e.displayName||e.name,t}function hS(e){return x.forwardRef(Jx(e))}function F3(){return{didInitialize:!1}}const G3=()=>{},ze=typeof document<"u"?x.useLayoutEffect:G3;function Y3(e,t){return function(o,...l){const c=new URL(e);return c.searchParams.set("code",o.toString()),l.forEach(u=>c.searchParams.append("args[]",u)),`${t} error #${o}; visit ${c} for the full message.`}}const rn=Y3("https://base-ui.com/production-error","Base UI"),gS=x.createContext(void 0);function Fc(e){const t=x.useContext(gS);if(t===void 0&&!e)throw new Error(rn(72));return t}const K3=[];function eb(e){x.useEffect(e,K3)}const Ji=0;class $s{static create(){return new $s}currentId=Ji;start(t,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Ji,s()},t)}isStarted(){return this.currentId!==Ji}clear=()=>{this.currentId!==Ji&&(clearTimeout(this.currentId),this.currentId=Ji)};disposeEffect=()=>this.clear}function kn(){const e=Wn($s.create).current;return eb(e.disposeEffect),e}function X3(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:Q3,platform:W3,maxTouchPoints:Z3}=X3(),If=Q3.toLowerCase(),Mc=W3.toLowerCase(),Bf=/^i(os$|p)/.test(Mc)||Mc==="macintel"&&Z3>1,q1="android",Zg=Mc===q1||If.includes(q1),tb=!Bf&&Mc.startsWith("mac");Mc.startsWith("win");const J3=tb||Bf,Lr=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!Lr&&If.includes("firefox");!Lr&&If.includes("chrom");const e5=J3,nb=/jsdom|happydom/.test(If);function ta(e){e.preventDefault(),e.stopPropagation()}function t5(e){return"nativeEvent"in e}function sb(e){return e.pointerType===""&&e.isTrusted?!0:Zg&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function xS(e){return nb?!1:!Zg&&e.width===0&&e.height===0||Zg&&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 bo(e,t){const s=["mouse","pen"];return t||s.push("",void 0),s.includes(e)}function n5(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function Uf(){return typeof window<"u"}function Hn(e){return ab(e)?(e.nodeName||"").toLowerCase():"#document"}function Xt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ma(e){var t;return(t=(ab(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ab(e){return Uf()?e instanceof Node||e instanceof Xt(e).Node:!1}function gt(e){return Uf()?e instanceof Element||e instanceof Xt(e).Element:!1}function qt(e){return Uf()?e instanceof HTMLElement||e instanceof Xt(e).HTMLElement:!1}function Bl(e){return!Uf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Xt(e).ShadowRoot}function Pr(e){const{overflow:t,overflowX:s,overflowY:o,display:l}=ds(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+s)&&l!=="inline"&&l!=="contents"}function s5(e){return/^(table|td|th)$/.test(Hn(e))}function Hf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const a5=/transform|translate|scale|rotate|perspective|filter/,r5=/paint|layout|strict|content/,lo=e=>!!e&&e!=="none";let Ph;function rb(e){const t=gt(e)?ds(e):e;return lo(t.transform)||lo(t.translate)||lo(t.scale)||lo(t.rotate)||lo(t.perspective)||!ob()&&(lo(t.backdropFilter)||lo(t.filter))||a5.test(t.willChange||"")||r5.test(t.contain||"")}function o5(e){let t=da(e);for(;qt(t)&&!la(t);){if(rb(t))return t;if(Hf(t))return null;t=da(t)}return null}function ob(){return Ph==null&&(Ph=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ph}function la(e){return/^(html|body|#document)$/.test(Hn(e))}function ds(e){return Xt(e).getComputedStyle(e)}function Vf(e){return gt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function da(e){if(Hn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Bl(e)&&e.host||ma(e);return Bl(t)?t.host:t}function bS(e){const t=da(e);return la(t)?e.ownerDocument?e.ownerDocument.body:e.body:qt(t)&&Pr(t)?t:bS(t)}function Oc(e,t,s){var o;t===void 0&&(t=[]),s===void 0&&(s=!0);const l=bS(e),c=l===((o=e.ownerDocument)==null?void 0:o.body),u=Xt(l);if(c){const p=Jg(u);return t.concat(u,u.visualViewport||[],Pr(l)?l:[],p&&s?Oc(p):[])}else return t.concat(l,Oc(l,[],s))}function Jg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const ex="data-base-ui-focusable",_S="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",qf="ArrowLeft",$f="ArrowRight",vS="ArrowUp",lb="ArrowDown";function qn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function Qe(e,t){if(!e||!t)return!1;const s=t.getRootNode?.();if(e.contains(t))return!0;if(s&&Bl(s)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Un(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ef(e,t){if(!gt(e))return!1;const s=e;if(t.hasElement(s))return!s.hasAttribute("data-trigger-disabled");for(const[,o]of t.entries())if(Qe(o,s))return!o.hasAttribute("data-trigger-disabled");return!1}function Ih(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const s=e;return s.target!=null&&t.contains(s.target)}function l5(e){return e.matches("html,body")}function Ff(e){return qt(e)&&e.matches(_S)}function i5(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${_S}`)!=null}function tx(e){return e?e.getAttribute("role")==="combobox"&&Ff(e):!1}function c5(e){if(!e||nb)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function tf(e){return e?e.hasAttribute(ex)?e:e.querySelector(`[${ex}]`)||e:null}function u5(e,t){return t!=null&&!bo(t)?0:typeof e=="function"?e():e}function Ul(e,t,s){const o=u5(e,s);return typeof o=="number"?o:o?.[t]}function $1(e){return typeof e=="function"?e():e}function yS(e,t){return t||e==="click"||e==="mousedown"}function d5(e){return e?.includes("mouse")&&e!=="mousedown"}function Rn(){}const Ya=Object.freeze([]),Gt=Object.freeze({}),fa="none",ni="trigger-press",Tn="trigger-hover",Tl="trigger-focus",Gf="outside-press",Al="item-press",f5="close-press",_o="focus-out",Yf="escape-key",nx="list-navigation",jS="cancel-open",dc="sibling-open",wS="disabled",F1="missing",G1="initial",ib="imperative-action",p5="window-resize";function nt(e,t,s,o){let l=!1,c=!1;const u=o??Gt;return{reason:e,event:t??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:s,...u}}const kS=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new $s,currentIdRef:{current:null},currentContextRef:{current:null}});function m5(e,t){e.current=t.current}function h5(e){const{children:t,delay:s,timeoutMs:o=0}=e,l=x.useRef(s),c=x.useRef(s),u=x.useRef(null),p=x.useRef(null),m=kn();return ze(()=>{if(c.current=s,!u.current){l.current=s;return}l.current={open:Ul(l.current,"open"),close:Ul(s,"close")}},[s,u,l,c]),r.jsx(kS.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:u,timeoutMs:o,currentContextRef:p,timeout:m}),[o,m]),children:t})}function g5(e,t={open:!1}){const{open:s}=t,o="rootStore"in e?e.rootStore:e,l=o.useState("floatingId"),c=x.useContext(kS),{currentIdRef:u,delayRef:p,timeoutMs:m,initialDelayRef:h,currentContextRef:g,hasProvider:b,timeout:v}=c,[k,E]=x.useState(!1),y=x.useRef(s),j=x.useRef(!1);return ze(()=>{y.current=s},[s]),ze(()=>()=>{j.current=!0},[]),ze(()=>{function C(){j.current||E(!1),g.current?.setIsInstantPhase(!1),u.current=null,g.current=null,p.current=h.current,v.clear()}if(u.current&&!s&&u.current===l){if(E(!1),m){const S=l;return v.start(m,()=>{o.select("open")||u.current&&u.current!==S||C()}),()=>{(y.current||u.current!==S)&&v.clear()}}C()}},[s,l,u,p,m,h,g,v,o]),ze(()=>{if(!s)return;const C=g.current,S=u.current;v.clear(),g.current={onOpenChange:o.setOpen,setIsInstantPhase:E},u.current=l,p.current={open:0,close:Ul(h.current,"close")},S!==null&&S!==l?(E(!0),C?.setIsInstantPhase(!0),C?.onOpenChange(!1,nt(fa))):(E(!1),C?.setIsInstantPhase(!1))},[s,l,o,u,p,h,g,v]),ze(()=>()=>{if(u.current===l){if(g.current=null,!y.current)return;u.current=null,m5(p,h),v.clear()}},[g,u,p,l,h,v]),x.useMemo(()=>({hasProvider:b,delayRef:p,isInstantPhase:k}),[b,p,k])}function xt(e,t,s,o){return e.addEventListener(t,s,o),()=>{e.removeEventListener(t,s,o)}}function ia(...e){return()=>{for(let t=0;t<e.length;t+=1){const s=e[t];s&&s()}}}function Ka(e,t,s,o){const l=Wn(SS).current;return b5(l,e,t,s,o)&&CS(l,[e,t,s,o]),l.callback}function x5(e){const t=Wn(SS).current;return _5(t,e)&&CS(t,e),t.callback}function SS(){return{callback:null,cleanup:null,refs:[]}}function b5(e,t,s,o,l){return e.refs[0]!==t||e.refs[1]!==s||e.refs[2]!==o||e.refs[3]!==l}function _5(e,t){return e.refs.length!==t.length||e.refs.some((s,o)=>s!==t[o])}function CS(e,t){if(e.refs=t,t.every(s=>s==null)){e.callback=null;return}e.callback=s=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),s!=null){const o=Array(t.length).fill(null);for(let l=0;l<t.length;l+=1){const c=t[l];if(c!=null)switch(typeof c){case"function":{const u=c(s);typeof u=="function"&&(o[l]=u);break}case"object":{c.current=s;break}}}e.cleanup=()=>{for(let l=0;l<t.length;l+=1){const c=t[l];if(c!=null)switch(typeof c){case"function":{const u=o[l];typeof u=="function"?u():c(null);break}case"object":{c.current=null;break}}}}}}}function dn(e){const t=Wn(v5,e).current;return t.next=e,ze(t.effect),t}function v5(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const cb={...yT},Bh=cb.useInsertionEffect,y5=Bh&&Bh!==cb.useLayoutEffect?Bh:e=>e();function Ue(e){const t=Wn(j5).current;return t.next=e,y5(t.effect),t.trampoline}function j5(){const e={next:void 0,callback:w5,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function w5(){}const md=null;class k5{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const s=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let l=0;l<s.length;l+=1)s[l]?.(t)};request(t){const s=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),s}cancel(t){const s=t-this.startId;s<0||s>=this.callbacks.length||(this.callbacks[s]=null,this.callbacksCount-=1)}}const hd=new k5;class sa{static create(){return new sa}static request(t){return hd.request(t)}static cancel(t){return hd.cancel(t)}currentId=md;request(t){this.cancel(),this.currentId=hd.request(()=>{this.currentId=md,t()})}cancel=()=>{this.currentId!==md&&(hd.cancel(this.currentId),this.currentId=md)};disposeEffect=()=>this.cancel}function Hl(){const e=Wn(sa.create).current;return eb(e.disposeEffect),e}function ht(e){return e?.ownerDocument||document}const NS={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},ub={...NS,position:"fixed",top:0,left:0},ES={...NS,position:"absolute"},Vl=x.forwardRef(function(t,s){const[o,l]=x.useState();ze(()=>{e5&&Lr&&l("button")},[]);const c={tabIndex:0,role:o};return r.jsx("span",{...t,ref:s,style:ub,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),S5=["top","right","bottom","left"],ql=Math.min,vs=Math.max,nf=Math.round,gd=Math.floor,ca=e=>({x:e,y:e}),C5={left:"right",right:"left",bottom:"top",top:"bottom"};function sx(e,t,s){return vs(e,ql(t,s))}function Xa(e,t){return typeof e=="function"?e(t):e}function cs(e){return e.split("-")[0]}function Ir(e){return e.split("-")[1]}function db(e){return e==="x"?"y":"x"}function fb(e){return e==="y"?"height":"width"}function zs(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function pb(e){return db(zs(e))}function N5(e,t,s){s===void 0&&(s=!1);const o=Ir(e),l=pb(e),c=fb(l);let u=l==="x"?o===(s?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(u=sf(u)),[u,sf(u)]}function E5(e){const t=sf(e);return[ax(e),t,ax(t)]}function ax(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Y1=["left","right"],K1=["right","left"],R5=["top","bottom"],T5=["bottom","top"];function A5(e,t,s){switch(e){case"top":case"bottom":return s?t?K1:Y1:t?Y1:K1;case"left":case"right":return t?R5:T5;default:return[]}}function M5(e,t,s,o){const l=Ir(e);let c=A5(cs(e),s==="start",o);return l&&(c=c.map(u=>u+"-"+l),t&&(c=c.concat(c.map(ax)))),c}function sf(e){const t=cs(e);return C5[t]+e.slice(t.length)}function O5(e){return{top:0,right:0,bottom:0,left:0,...e}}function RS(e){return typeof e!="number"?O5(e):{top:e,right:e,bottom:e,left:e}}function zc(e){const{x:t,y:s,width:o,height:l}=e;return{width:o,height:l,top:s,left:t,right:t+o,bottom:s+l,x:t,y:s}}function yc(e,t){return t<0||t>=e.length}function Hd(e,t){return Va(e.current,{disabledIndices:t})}function rx(e,t){return Va(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Va(e,{startingIndex:t=-1,decrement:s=!1,disabledIndices:o,amount:l=1}={}){let c=t;do c+=s?-l:l;while(c>=0&&c<=e.length-1&&af(e,c,o));return c}function af(e,t,s){if(typeof s=="function"?s(t):s?.includes(t)??!1)return!0;const l=e[t];return l?Kf(l)?!s&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!0:!1}function z5(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Kf(e,t=e?ds(e):null){return!e||!e.isConnected||!t||z5(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const D5='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function L5(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const s=e.getRootNode();return Bl(s)?s.host:null}function ox(e){for(const t of Array.from(e.children))if(Hn(t)==="summary")return t;return null}function P5(e,t){const s=ox(t);return!!s&&(e===s||Qe(s,e))}function TS(e){const t=e?Hn(e):"";return e!=null&&e.matches(D5)&&(t!=="summary"||e.parentElement!=null&&Hn(e.parentElement)==="details"&&ox(e.parentElement)===e)&&(t!=="details"||ox(e)==null)&&(t!=="input"||e.type!=="hidden")}function AS(e){if(!TS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=L5(t)){const s=t!==e,o=Hn(t)==="slot";if(t.hasAttribute("inert")||s&&Hn(t)==="details"&&!t.open&&!P5(e,t)||t.hasAttribute("hidden")||!o&&!I5(t,s))return!1}return!0}function I5(e,t){const s=ds(e);return t?s.display!=="none":Kf(e,s)}function MS(e){const t=e.tabIndex;if(t<0){const s=Hn(e);if(s==="details"||s==="audio"||s==="video"||qt(e)&&e.isContentEditable)return 0}return t}function Uh(e){if(Hn(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function B5(e,t){const s=Uh(e);if(!s)return!0;const o=t.find(l=>{const c=Uh(l);return c?.name===s.name&&c.form===s.form&&c.checked});return o?o===s:t.find(l=>{const c=Uh(l);return c?.name===s.name&&c.form===s.form})===s}function OS(e){if(qt(e)&&Hn(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return qt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function zS(e,t){OS(e).forEach(s=>{TS(s)&&t.push(s),zS(s,t)})}function DS(e,t,s){OS(e).forEach(o=>{qt(o)&&o.matches(t)&&s.push(o),DS(o,t,s)})}function mb(e){return AS(e)&&MS(e)>=0}function LS(e){const t=[];return zS(e,t),t.filter(AS)}function Gc(e){const t=LS(e);return t.filter(s=>MS(s)>=0&&B5(s,t))}function PS(e,t){const s=Gc(e),o=s.length;if(o===0)return;const l=qn(ht(e)),c=s.indexOf(l),u=c===-1?t===1?0:o-1:c+t;return s[u]}function hb(e){return PS(ht(e).body,1)||e}function IS(e){return PS(ht(e).body,-1)||e}function BS(e,t){if(!e)return null;const s=Gc(ht(e).body),o=s.length;if(o===0)return null;const l=s.indexOf(e);if(l===-1)return null;const c=(l+t+o)%o;return s[c]}function U5(e){return BS(e,1)}function H5(e){return BS(e,-1)}function Ml(e,t){const s=t||e.currentTarget,o=e.relatedTarget;return!o||!Qe(s,o)}function V5(e){Gc(e).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function X1(e){const t=[];DS(e,"[data-tabindex]",t),t.forEach(s=>{const o=s.dataset.tabindex;delete s.dataset.tabindex,o?s.setAttribute("tabindex",o):s.removeAttribute("tabindex")})}function zr(e,t,s=!0){return e.filter(l=>l.parentId===t).flatMap(l=>[...!s||l.context?.open?[l]:[],...zr(e,l.id,s)])}function Q1(e,t){let s=[],o=e.find(l=>l.id===t)?.parentId;for(;o;){const l=e.find(c=>c.id===o);o=l?.parentId,l&&(s=s.concat(l))}return s}function Dc(e){return`data-base-ui-${e}`}let xd=0;function Vd(e,t={}){const{preventScroll:s=!1,sync:o=!1,shouldFocus:l}=t;cancelAnimationFrame(xd);function c(){l&&!l()||e?.focus({preventScroll:s})}if(o)return c(),Rn;const u=requestAnimationFrame(c);return xd=u,()=>{xd===u&&(cancelAnimationFrame(u),xd=0)}}const Hh={inert:new WeakMap,"aria-hidden":new WeakMap},W1="data-base-ui-inert",lx={inert:new WeakSet,"aria-hidden":new WeakSet};let ec=new WeakMap,Vh=0;function q5(e){return lx[e]}function US(e){return e?Bl(e)?e.host:US(e.parentNode):null}const Z1=(e,t)=>t.map(s=>{if(e.contains(s))return s;const o=US(s);return e.contains(o)?o:null}).filter(s=>s!=null),J1=e=>{const t=new Set;return e.forEach(s=>{let o=s;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},ej=(e,t,s)=>{const o=[],l=c=>{!c||s.has(c)||Array.from(c.children).forEach(u=>{Hn(u)!=="script"&&(t.has(u)?l(u):o.push(u))})};return l(e),o};function $5(e,t,s,o,{mark:l=!0}){let c=null;o?c="inert":s&&(c="aria-hidden");let u=null,p=null;const m=Z1(t,e),h=l?ej(t,J1(m),new Set(m)):[],g=[],b=[];if(c){const v=Hh[c],k=q5(c);p=k,u=v;const E=Z1(t,Array.from(t.querySelectorAll("[aria-live]"))),y=m.concat(E);ej(t,J1(y),new Set(y)).forEach(C=>{const S=C.getAttribute(c),N=S!==null&&S!=="false",R=(v.get(C)||0)+1;v.set(C,R),g.push(C),R===1&&N&&k.add(C),N||C.setAttribute(c,c==="inert"?"":"true")})}return l&&h.forEach(v=>{const k=(ec.get(v)||0)+1;ec.set(v,k),b.push(v),k===1&&v.setAttribute(W1,"")}),Vh+=1,()=>{u&&g.forEach(v=>{const E=(u.get(v)||0)-1;u.set(v,E),E||(!p?.has(v)&&c&&v.removeAttribute(c),p?.delete(v))}),l&&b.forEach(v=>{const k=(ec.get(v)||0)-1;ec.set(v,k),k||v.removeAttribute(W1)}),Vh-=1,Vh||(Hh.inert=new WeakMap,Hh["aria-hidden"]=new WeakMap,lx.inert=new WeakSet,lx["aria-hidden"]=new WeakSet,ec=new WeakMap)}}function tj(e,t={}){const{ariaHidden:s=!1,inert:o=!1,mark:l=!0}=t,c=ht(e[0]).body;return $5(e,c,s,o,{mark:l})}let nj=0;function F5(e,t="mui"){const[s,o]=x.useState(e),l=e||s;return x.useEffect(()=>{s==null&&(nj+=1,o(`${t}-${nj}`))},[s,t]),l}const sj=cb.useId;function vo(e,t){if(sj!==void 0){const s=sj();return e??(t?`${t}-${s}`:s)}return F5(e,t)}const G5=parseInt(x.version,10);function gb(e){return G5>=e}function aj(e){if(!x.isValidElement(e))return null;const t=e,s=t.props;return(gb(19)?s?.ref:t.ref)??null}function ix(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Y5(e,t){const s={};for(const o in e){const l=e[o];if(t?.hasOwnProperty(o)){const c=t[o](l);c!=null&&Object.assign(s,c);continue}l===!0?s[`data-${o.toLowerCase()}`]="":l&&(s[`data-${o.toLowerCase()}`]=l.toString())}return s}function K5(e,t){return typeof e=="function"?e(t):e}function X5(e,t){return typeof e=="function"?e(t):e}const xb={};function Fn(e,t,s,o,l){if(!s&&!o&&!l&&!e)return rf(t);let c=rf(e);return t&&(c=fc(c,t)),s&&(c=fc(c,s)),o&&(c=fc(c,o)),l&&(c=fc(c,l)),c}function Q5(e){if(e.length===0)return xb;if(e.length===1)return rf(e[0]);let t=rf(e[0]);for(let s=1;s<e.length;s+=1)t=fc(t,e[s]);return t}function rf(e){return bb(e)?{...VS(e,xb)}:W5(e)}function fc(e,t){return bb(t)?VS(t,e):Z5(e,t)}function W5(e){const t={...e};for(const s in t){const o=t[s];HS(s,o)&&(t[s]=qS(o))}return t}function Z5(e,t){if(!t)return e;for(const s in t){const o=t[s];switch(s){case"style":{e[s]=ix(e.style,o);break}case"className":{e[s]=$S(e.className,o);break}default:HS(s,o)?e[s]=J5(e[s],o):e[s]=o}}return e}function HS(e,t){const s=e.charCodeAt(0),o=e.charCodeAt(1),l=e.charCodeAt(2);return s===111&&o===110&&l>=65&&l<=90&&(typeof t=="function"||typeof t>"u")}function bb(e){return typeof e=="function"}function VS(e,t){return bb(e)?e(t):e??xb}function J5(e,t){return t?e?(...s)=>{const o=s[0];if(FS(o)){const c=o;of(c);const u=t(...s);return c.baseUIHandlerPrevented||e?.(...s),u}const l=t(...s);return e?.(...s),l}:qS(t):e}function qS(e){return e&&((...t)=>{const s=t[0];return FS(s)&&of(s),e(...t)})}function of(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function $S(e,t){return t?e?t+" "+e:t:e}function FS(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Et(e,t,s={}){const o=t.render,l=eO(t,s);if(s.enabled===!1)return null;const c=s.state??Gt;return sO(e,o,l,c)}function eO(e,t={}){const{className:s,style:o,render:l}=e,{state:c=Gt,ref:u,props:p,stateAttributesMapping:m,enabled:h=!0}=t,g=h?K5(s,c):void 0,b=h?X5(o,c):void 0,v=h?Y5(c,m):Gt,k=h&&p?tO(p):void 0,E=h?ix(v,k)??{}:Gt;return typeof document<"u"&&(h?Array.isArray(u)?E.ref=x5([E.ref,aj(l),...u]):E.ref=Ka(E.ref,aj(l),u):Ka(null,null)),h?(g!==void 0&&(E.className=$S(E.className,g)),b!==void 0&&(E.style=ix(E.style,b)),E):Gt}function tO(e){return Array.isArray(e)?Q5(e):Fn(void 0,e)}const nO=Symbol.for("react.lazy");function sO(e,t,s,o){if(t){if(typeof t=="function")return t(s,o);const l=Fn(s,t.props);l.ref=s.ref;let c=t;return c?.$$typeof===nO&&(c=x.Children.toArray(t)[0]),x.cloneElement(c,l)}if(e&&typeof e=="string")return aO(e,s);throw new Error(rn(8))}function aO(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 rO=500,oO=500,lO={style:{transition:"none"}},iO="data-base-ui-click-trigger",GS={fallbackAxisSide:"none"},YS={fallbackAxisSide:"end"},cO={clipPath:"inset(50%)",position:"fixed",top:0,left:0},KS=x.createContext(null),XS=()=>x.useContext(KS),uO=Dc("portal");function QS(e={}){const{ref:t,container:s,componentProps:o=Gt,elementProps:l}=e,c=vo(),p=XS()?.portalNode,[m,h]=x.useState(null),[g,b]=x.useState(null),v=Ue(j=>{j!==null&&b(j)}),k=x.useRef(null);ze(()=>{if(s===null){k.current&&(k.current=null,b(null),h(null));return}if(c==null)return;const j=(s&&(ab(s)?s:s.current))??p??document.body;if(j==null){k.current&&(k.current=null,b(null),h(null));return}k.current!==j&&(k.current=j,b(null),h(j))},[s,p,c]);const E=Et("div",o,{ref:[t,v],props:[{id:c,[uO]:""},l]});return{portalNode:g,portalSubtree:m&&E?Ps.createPortal(E,m):null}}const _b=x.forwardRef(function(t,s){const{render:o,className:l,style:c,children:u,container:p,renderGuards:m,...h}=t,{portalNode:g,portalSubtree:b}=QS({container:p,ref:s,componentProps:t,elementProps:h}),v=x.useRef(null),k=x.useRef(null),E=x.useRef(null),y=x.useRef(null),[j,C]=x.useState(null),S=x.useRef(!1),N=j?.modal,R=j?.open,M=typeof m=="boolean"?m:!!j&&!j.modal&&j.open&&!!g;x.useEffect(()=>{if(!g||N)return;function z(D){g&&D.relatedTarget&&Ml(D)&&(D.type==="focusin"?S.current&&(X1(g),S.current=!1):(V5(g),S.current=!0))}return ia(xt(g,"focusin",z,!0),xt(g,"focusout",z,!0))},[g,N]),ze(()=>{!g||R!==!0||!S.current||(X1(g),S.current=!1)},[R,g]);const T=x.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:k,beforeInsideRef:E,afterInsideRef:y,portalNode:g,setFocusManagerState:C}),[g]);return r.jsxs(x.Fragment,{children:[b,r.jsxs(KS.Provider,{value:T,children:[M&&g&&r.jsx(Vl,{"data-type":"outside",ref:v,onFocus:z=>{if(Ml(z,g))E.current?.focus();else{const D=j?j.domReference:null;IS(D)?.focus()}}}),M&&g&&r.jsx("span",{"aria-owns":g.id,style:cO}),g&&Ps.createPortal(u,g),M&&g&&r.jsx(Vl,{"data-type":"outside",ref:k,onFocus:z=>{if(Ml(z,g))y.current?.focus();else{const D=j?j.domReference:null;hb(D)?.focus(),j?.closeOnFocusOut&&j?.onOpenChange(!1,nt(_o,z.nativeEvent))}}})]})]})});function WS(){const e=new Map;return{emit(t,s){e.get(t)?.forEach(o=>o(s))},on(t,s){e.has(t)||e.set(t,new Set),e.get(t).add(s)},off(t,s){e.get(t)?.delete(s)}}}class vb{nodesRef={current:[]};events=WS();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const s=this.nodesRef.current.findIndex(o=>o===t);s!==-1&&this.nodesRef.current.splice(s,1)}}const ZS=x.createContext(null),JS=x.createContext(null),Br=()=>x.useContext(ZS)?.id||null,Ur=e=>{const t=x.useContext(JS);return e??t};function e2(e){const t=vo(),s=Ur(e),o=Br();return ze(()=>{if(!t)return;const l={id:t,parentId:o};return s?.addNode(l),()=>{s?.removeNode(l)}},[s,t,o]),t}function dO(e){const{children:t,id:s}=e,o=Br();return r.jsx(ZS.Provider,{value:x.useMemo(()=>({id:s,parentId:o}),[s,o]),children:t})}function fO(e){const{children:t,externalTree:s}=e,o=Wn(()=>s??new vb).current;return r.jsx(JS.Provider,{value:o,children:t})}function Ua(e){return e==null?e:"current"in e?e.current:e}function pO(e,t){const s=Xt(Un(e));return e instanceof s.KeyboardEvent?"keyboard":e instanceof s.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof s.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const rj=20;let Rr=[];function yb(){Rr=Rr.filter(e=>e.deref()?.isConnected)}function oj(e){yb(),e&&Hn(e)!=="body"&&(Rr.push(new WeakRef(e)),Rr.length>rj&&(Rr=Rr.slice(-rj)))}function lj(){return yb(),Rr[Rr.length-1]?.deref()}function mO(e){return e?mb(e)?e:Gc(e)[0]||e:null}function ij(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const s=LS(e).filter(l=>{const c=l.getAttribute("data-tabindex")||"";return mb(l)||l.hasAttribute("data-tabindex")&&!c.startsWith("-")}),o=e.getAttribute("tabindex");s.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:s,disabled:o=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:u=!1,modal:p=!0,closeOnFocusOut:m=!0,openInteractionType:h="",nextFocusableElement:g,previousFocusableElement:b,beforeContentFocusGuardRef:v,externalTree:k,getInsideElements:E}=e,y="rootStore"in t?t.rootStore:t,j=y.useState("open"),C=y.useState("domReferenceElement"),S=y.useState("floatingElement"),{events:N,dataRef:R}=y.context,M=Ue(()=>R.current.floatingContext?.nodeId),T=l===!1,z=tx(C)&&T,D=dn(l),U=dn(c),L=dn(h),H=dn(j),O=Ur(k),P=XS(),B=x.useRef(!1),$=x.useRef(!1),q=x.useRef(!1),X=x.useRef(null),Y=x.useRef(""),F=x.useRef(""),K=x.useRef(null),I=x.useRef(null),G=Ka(K,v,P?.beforeInsideRef),Z=Ka(I,P?.afterInsideRef),te=kn(),de=kn(),ee=Hl(),ne=P!=null,ae=tf(S),pe=Ue((me=ae)=>me?Gc(me):[]),Me=Ue(()=>E?.().filter(me=>me!=null)??[]);x.useEffect(()=>{if(o||!p)return;function me(je){je.key==="Tab"&&Qe(ae,qn(ht(ae)))&&pe().length===0&&!z&&ta(je)}const ke=ht(ae);return xt(ke,"keydown",me)},[o,ae,p,z,pe]),x.useEffect(()=>{if(o||!j)return;const me=ht(ae);function ke(){q.current=!1}function je(He){const we=Un(He),Re=Me(),ve=Qe(S,we)||Qe(C,we)||Qe(P?.portalNode,we)||Re.some(Ce=>Ce===we||Qe(Ce,we));q.current=!ve,F.current=He.pointerType||"keyboard",we?.closest(`[${iO}]`)&&($.current=!0,de.start(0,()=>{$.current=!1}))}function Be(){F.current="keyboard"}return ia(xt(me,"pointerdown",je,!0),xt(me,"pointerup",ke,!0),xt(me,"pointercancel",ke,!0),xt(me,"keydown",Be,!0),ke)},[o,S,C,ae,j,P,de,Me]),x.useEffect(()=>{if(o||!m)return;const me=ht(ae);function ke(){$.current=!0,de.start(0,()=>{$.current=!1})}function je(Re){const ve=Un(Re);mb(ve)&&(X.current=ve)}function Be(Re){const ve=Re.relatedTarget,Ce=Re.currentTarget,De=Un(Re);p&&ve==null&&De!=null&&Qe(S,De)&&oj(De),queueMicrotask(()=>{const Pe=M(),Ie=y.context.triggerElements,le=Me(),_e=ve?.hasAttribute(Dc("focus-guard"))&&[K.current,I.current,P?.beforeInsideRef.current,P?.afterInsideRef.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,Ua(b),Ua(g)].includes(ve),qe=!(Qe(C,ve)||Qe(S,ve)||Qe(ve,S)||Qe(P?.portalNode,ve)||le.some(Ne=>Ne===ve||Qe(Ne,ve))||ve!=null&&Ie.hasElement(ve)||Ie.hasMatchingElement(Ne=>Qe(Ne,ve))||_e||O&&(zr(O.nodesRef.current,Pe).find(Ne=>Qe(Ne.context?.elements.floating,ve)||Qe(Ne.context?.elements.domReference,ve))||Q1(O.nodesRef.current,Pe).find(Ne=>[Ne.context?.elements.floating,tf(Ne.context?.elements.floating)].includes(ve)||Ne.context?.elements.domReference===ve)));if(Ce===C&&ae&&ij(ae),u&&Ce!==C&&!Kf(De)&&qn(me)===me.body){if(qt(ae)&&(ae.focus(),u==="popup")){ee.request(()=>{ae.focus()});return}const Ne=pe(),Oe=X.current,et=(Oe&&Ne.includes(Oe)?Oe:null)||Ne[Ne.length-1]||ae;qt(et)&&et.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(z||!p)&&ve&&qe&&!$.current&&(z||ve!==lj())&&(B.current=!0,y.setOpen(!1,nt(_o,Re)))})}function He(){q.current||(R.current.insideReactTree=!0,te.start(0,()=>{R.current.insideReactTree=!1}))}const we=qt(C)?C:null;if(!(!S&&!we))return ia(we&&xt(we,"focusout",Be),we&&xt(we,"pointerdown",ke),S&&xt(S,"focusin",je),S&&xt(S,"focusout",Be),S&&P&&xt(S,"focusout",He,!0))},[o,C,S,ae,p,O,P,y,m,u,pe,z,M,R,te,de,ee,g,b,Me]),x.useEffect(()=>{if(o||!S||!j)return;const me=Array.from(P?.portalNode?.querySelectorAll(`[${Dc("portal")}]`)||[]),je=(O?Q1(O.nodesRef.current,M()):[]).find(Ce=>tx(Ce.context?.elements.domReference||null))?.context?.elements.domReference,He=[...[S,...me,K.current,I.current,P?.beforeOutsideRef.current,P?.afterOutsideRef.current,...Me()],je,Ua(b),Ua(g),z?C:null].filter(Ce=>Ce!=null),we=tj(He,{ariaHidden:p||z,mark:!1}),Re=[S,...me].filter(Ce=>Ce!=null),ve=tj(Re);return()=>{ve(),we()}},[j,o,C,S,p,P,z,O,M,g,b,Me]),ze(()=>{if(!j||o||!qt(ae))return;const me=ht(ae),ke=qn(me);queueMicrotask(()=>{const je=D.current,Be=typeof je=="function"?je(L.current||""):je;if(Be===void 0||Be===!1||Qe(ae,ke))return;let we=null;const Re=()=>(we==null&&(we=pe(ae)),we[0]||ae);let ve;Be===!0||Be===null?ve=Re():ve=Ua(Be),ve=ve||Re();const Ce=Qe(ae,qn(me));Vd(ve,{preventScroll:ve===ae,shouldFocus(){if(!H.current)return!1;if(Ce)return!0;const De=qn(me);return!(De!==ve&&Qe(ae,De))}})})},[o,j,ae,pe,D,L,H]),ze(()=>{if(o||!ae)return;const me=ht(ae),ke=qn(me),je=L.current==null;oj(ke);function Be(we){if(we.open||(Y.current=pO(we.nativeEvent,F.current)),we.reason===Tn&&we.nativeEvent.type==="mouseleave"&&(B.current=!0),we.reason===Gf)if(we.nested)B.current=!1;else if(sb(we.nativeEvent)||xS(we.nativeEvent))B.current=!1;else{let Re=!1;ht(ae).createElement("div").focus({get preventScroll(){return Re=!0,!1}}),Re?B.current=!1:B.current=!0}}N.on("openchange",Be);function He(){const we=U.current;let Re=typeof we=="function"?we(Y.current):we;if(Re===void 0||Re===!1)return null;Re===null&&(Re=!0);const ve=C?.isConnected?C:null,Ce=ke?.isConnected&&Hn(ke)!=="body"?ke:null;let De=je?Ce||ve:ve||Ce;return De||(De=lj()||null),typeof Re=="boolean"?De:Ua(Re)||De||null}return()=>{N.off("openchange",Be);const we=qn(me),Re=Me(),ve=Qe(S,we)||Re.some(Pe=>Pe===we||Qe(Pe,we))||O&&zr(O.nodesRef.current,M(),!1).some(Pe=>Qe(Pe.context?.elements.floating,we)),Ce=U.current,De=He();queueMicrotask(()=>{const Pe=mO(De),Ie=typeof Ce!="boolean";Ce&&!B.current&&qt(Pe)&&(!(!Ie&&Pe!==we&&we!==me.body)||ve)&&Pe.focus({preventScroll:!0}),B.current=!1})}},[o,S,ae,U,L,N,O,C,M,Me]),ze(()=>{if(!Lr||j||!S)return;const me=qn(ht(S));!qt(me)||!Ff(me)||Qe(S,me)&&me.blur()},[j,S]),ze(()=>{if(!(o||!P))return P.setFocusManagerState({modal:p,closeOnFocusOut:m,open:j,onOpenChange:y.setOpen,domReference:C}),()=>{P.setFocusManagerState(null)}},[o,P,p,j,y,m,C]),ze(()=>{if(!(o||!ae))return ij(ae),()=>{queueMicrotask(yb)}},[o,ae]);const ue=!o&&(p?!z:!0)&&(ne||p);return r.jsxs(x.Fragment,{children:[ue&&r.jsx(Vl,{"data-type":"inside",ref:G,onFocus:me=>{if(p){const ke=pe();Vd(ke[ke.length-1])}else P?.portalNode&&(B.current=!1,Ml(me,P.portalNode)?hb(C)?.focus():Ua(b??P.beforeOutsideRef)?.focus())}}),s,ue&&r.jsx(Vl,{"data-type":"inside",ref:Z,onFocus:me=>{p?Vd(pe()[0]):P?.portalNode&&(m&&(B.current=!0),Ml(me,P.portalNode)?IS(C)?.focus():Ua(g??P.afterOutsideRef)?.focus())}})]})}function t2(e,t={}){const{enabled:s=!0,event:o="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:p=0,reason:m=ni}=t,h="rootStore"in e?e.rootStore:e,g=h.context.dataRef,b=x.useRef(void 0),v=Hl(),k=kn(),E=x.useMemo(()=>{function y(C,S,N,R){const M=nt(m,S,N);C&&R==="touch"&&p>0?k.start(p,()=>{h.setOpen(!0,M)}):h.setOpen(C,M)}function j(C,S,N){const R=g.current.openEvent,M=h.select("domReferenceElement")!==S;return C&&M||!C||!l?!0:R&&u?!N(R.type):!1}return{onPointerDown(C){b.current=C.pointerType},onMouseDown(C){const S=b.current,N=C.nativeEvent,R=h.select("open");if(C.button!==0||o==="click"||bo(S,!0)&&c)return;const M=j(R,C.currentTarget,D=>D==="click"||D==="mousedown"),T=Un(N);if(Ff(T)){y(M,N,T,S);return}const z=C.currentTarget;v.request(()=>{y(M,N,z,S)})},onClick(C){if(o==="mousedown-only")return;const S=b.current;if(o==="mousedown"&&S){b.current=void 0;return}if(bo(S,!0)&&c)return;const N=h.select("open"),R=j(N,C.currentTarget,M=>M==="click"||M==="mousedown"||M==="keydown"||M==="keyup");y(R,C.nativeEvent,C.currentTarget,S)},onKeyDown(){b.current=void 0}}},[g,o,c,m,h,u,l,v,k,p]);return x.useMemo(()=>s?{reference:E}:Gt,[s,E])}function hO(e,t){let s=null,o=null,l=!1;return{contextElement:e||void 0,getBoundingClientRect(){const c=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},u=t.axis==="x"||t.axis==="both",p=t.axis==="y"||t.axis==="both",m=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let h=c.width,g=c.height,b=c.x,v=c.y;return s==null&&t.x&&u&&(s=c.x-t.x),o==null&&t.y&&p&&(o=c.y-t.y),b-=s||0,v-=o||0,h=0,g=0,!l||m?(h=t.axis==="y"?c.width:0,g=t.axis==="x"?c.height:0,b=u&&t.x!=null?t.x:b,v=p&&t.y!=null?t.y:v):l&&!m&&(g=t.axis==="x"?c.height:g,h=t.axis==="y"?c.width:h),l=!0,{width:h,height:g,x:b,y:v,top:v,right:b+h,bottom:v+g,left:b}}}}function cj(e){return e!=null&&e.clientX!=null}function gO(e,t={}){const{enabled:s=!0,axis:o="both"}=t,l="rootStore"in e?e.rootStore:e,c=l.useState("open"),u=l.useState("floatingElement"),p=l.useState("domReferenceElement"),m=l.context.dataRef,h=x.useRef(!1),g=x.useRef(null),[b,v]=x.useState(),[k,E]=x.useState([]),y=Ue(R=>{l.set("positionReference",R)}),j=Ue((R,M,T)=>{h.current||m.current.openEvent&&!cj(m.current.openEvent)||l.set("positionReference",hO(T??p,{x:R,y:M,axis:o,dataRef:m,pointerType:b}))}),C=Ue(R=>{c?g.current||(j(R.clientX,R.clientY,R.currentTarget),E([])):j(R.clientX,R.clientY,R.currentTarget)}),S=bo(b)?u:c;x.useEffect(()=>{if(!s){y(p);return}if(!S)return;function R(){g.current?.(),g.current=null}const M=Xt(u);function T(z){const D=Un(z);Qe(u,D)?R():j(z.clientX,z.clientY)}return!m.current.openEvent||cj(m.current.openEvent)?g.current=xt(M,"mousemove",T):y(p),R},[S,s,u,m,p,l,j,y,k]),x.useEffect(()=>()=>{l.set("positionReference",null)},[l]),x.useEffect(()=>{s&&!u&&(h.current=!1)},[s,u]),x.useEffect(()=>{!s&&c&&(h.current=!0)},[s,c]);const N=x.useMemo(()=>{function R(M){v(M.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:C,onMouseEnter:C}},[C]);return x.useMemo(()=>s?{reference:N,trigger:N}:{},[s,N])}function xO(){return!1}function bO(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Xf(e,t={}){const{enabled:s=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:u=xO,bubbles:p,externalTree:m}=t,h="rootStore"in e?e.rootStore:e,g=h.useState("open"),b=h.useState("floatingElement"),{dataRef:v}=h.context,k=Ur(m),E=Ue(typeof l=="function"?l:()=>!1),y=typeof l=="function"?E:l,j=y!==!1,C=Ue(()=>c),{escapeKey:S,outsidePress:N}=bO(p),R=x.useRef(!1),M=x.useRef(!1),T=x.useRef(!1),z=x.useRef(!1),D=x.useRef(""),U=x.useRef(null),L=kn(),H=kn(),O=Ue(()=>{H.clear(),v.current.insideReactTree=!1}),P=Ue(G=>{const Z=v.current.floatingContext?.nodeId;return(k?zr(k.nodesRef.current,Z):[]).some(de=>de.context?.open&&!de.context.dataRef.current[G])}),B=Ue(G=>Ih(G,h.select("floatingElement"))||Ih(G,h.select("domReferenceElement"))),$=Ue(G=>{u()&&h.setOpen(!1,nt(ni,G.nativeEvent))}),q=Ue(G=>{if(!g||!s||!o||G.key!=="Escape"||z.current||!S&&P("__escapeKeyBubbles"))return;const Z=t5(G)?G.nativeEvent:G,te=nt(Yf,Z);h.setOpen(!1,te),te.isCanceled||G.preventDefault(),!S&&!te.isPropagationAllowed&&G.stopPropagation()}),X=Ue(()=>{v.current.insideReactTree=!0,H.start(0,O)}),Y=Ue(G=>{if(!g||!s||G.button!==0)return;const Z=Un(G.nativeEvent);Qe(h.select("floatingElement"),Z)&&(R.current||(R.current=!0,M.current=!1))}),F=Ue(G=>{!g||!s||(G.defaultPrevented||G.nativeEvent.defaultPrevented)&&R.current&&(M.current=!0)});x.useEffect(()=>{if(!g||!s)return;v.current.__escapeKeyBubbles=S,v.current.__outsidePressBubbles=N;const G=new $s,Z=new $s;function te(){G.clear(),z.current=!0}function de(){G.start(Lr?5:0,()=>{z.current=!1})}function ee(){T.current=!0,Z.start(0,()=>{T.current=!1})}function ne(){R.current=!1,M.current=!1}function ae(){const le=D.current,_e=le==="pen"||!le?"mouse":le,qe=C(),Ne=typeof qe=="function"?qe():qe;return typeof Ne=="string"?Ne:Ne[_e]}function pe(le){const _e=ae();return _e==="intentional"&&le.type!=="click"||_e==="sloppy"&&le.type==="click"}function Me(le){const _e=v.current.floatingContext?.nodeId,qe=k&&zr(k.nodesRef.current,_e).some(Ne=>Ih(le,Ne.context?.elements.floating));return B(le)||qe}function ue(le){if(pe(le)){le.type!=="click"&&!B(le)&&(Z.clear(),T.current=!1),O();return}if(v.current.insideReactTree){O();return}const _e=Un(le),qe=`[${Dc("inert")}]`,Ne=gt(_e)?_e.getRootNode():null,Oe=Array.from((Bl(Ne)?Ne:ht(h.select("floatingElement"))).querySelectorAll(qe)),et=h.context.triggerElements;if(_e&&(et.hasElement(_e)||et.hasMatchingElement(vt=>Qe(vt,_e))))return;let at=gt(_e)?_e:null;for(;at&&!la(at);){const vt=da(at);if(la(vt)||!gt(vt))break;at=vt}if(!(Oe.length&&gt(_e)&&!l5(_e)&&!Qe(_e,h.select("floatingElement"))&&Oe.every(vt=>!Qe(at,vt)))){if(qt(_e)&&!("touches"in le)){const vt=la(_e),Mt=ds(_e),lt=/auto|scroll/,Rt=vt||lt.test(Mt.overflowX),xe=vt||lt.test(Mt.overflowY),Le=Rt&&_e.clientWidth>0&&_e.scrollWidth>_e.clientWidth,Ke=xe&&_e.clientHeight>0&&_e.scrollHeight>_e.clientHeight,it=Mt.direction==="rtl",Xe=Ke&&(it?le.offsetX<=_e.offsetWidth-_e.clientWidth:le.offsetX>_e.clientWidth),ft=Le&&le.offsetY>_e.clientHeight;if(Xe||ft)return}if(!Me(le)){if(ae()==="intentional"&&T.current){Z.clear(),T.current=!1;return}typeof y=="function"&&!y(le)||P("__outsidePressBubbles")||(h.setOpen(!1,nt(Gf,le)),O())}}}function me(le){ae()!=="sloppy"||le.pointerType==="touch"||!h.select("open")||!s||B(le)||ue(le)}function ke(le){if(ae()!=="sloppy"||!h.select("open")||!s||B(le))return;const _e=le.touches[0];_e&&(U.current={startTime:Date.now(),startX:_e.clientX,startY:_e.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},L.start(1e3,()=>{U.current&&(U.current.dismissOnTouchEnd=!1,U.current.dismissOnMouseDown=!1)}))}function je(le,_e){const qe=Un(le);if(!qe)return;const Ne=xt(qe,le.type,()=>{_e(le),Ne()})}function Be(le){D.current="touch",je(le,ke)}function He(le){L.clear(),le.type==="pointerdown"&&(D.current=le.pointerType),!(le.type==="mousedown"&&U.current&&!U.current.dismissOnMouseDown)&&je(le,_e=>{_e.type==="pointerdown"?me(_e):ue(_e)})}function we(le){if(!R.current)return;const _e=M.current;if(ne(),ae()==="intentional"){if(le.type==="pointercancel"){_e&&ee();return}if(!Me(le)){if(_e){ee();return}typeof y=="function"&&!y(le)||(Z.clear(),T.current=!0,O())}}}function Re(le){if(ae()!=="sloppy"||!U.current||B(le))return;const _e=le.touches[0];if(!_e)return;const qe=Math.abs(_e.clientX-U.current.startX),Ne=Math.abs(_e.clientY-U.current.startY),Oe=Math.sqrt(qe*qe+Ne*Ne);Oe>5&&(U.current.dismissOnTouchEnd=!0),Oe>10&&(ue(le),L.clear(),U.current=null)}function ve(le){je(le,Re)}function Ce(le){ae()!=="sloppy"||!U.current||B(le)||(U.current.dismissOnTouchEnd&&ue(le),L.clear(),U.current=null)}function De(le){je(le,Ce)}const Pe=ht(b),Ie=ia(o&&ia(xt(Pe,"keydown",q),xt(Pe,"compositionstart",te),xt(Pe,"compositionend",de)),j&&ia(xt(Pe,"click",He,!0),xt(Pe,"pointerdown",He,!0),xt(Pe,"pointerup",we,!0),xt(Pe,"pointercancel",we,!0),xt(Pe,"mousedown",He,!0),xt(Pe,"mouseup",we,!0),xt(Pe,"touchstart",Be,!0),xt(Pe,"touchmove",ve,!0),xt(Pe,"touchend",De,!0)));return()=>{Ie(),G.clear(),Z.clear(),ne(),T.current=!1}},[v,b,o,j,y,g,s,S,N,q,O,C,P,B,k,h,L]),x.useEffect(O,[y,O]);const K=x.useMemo(()=>({onKeyDown:q,onPointerDown:$,onClick:$}),[q,$]),I=x.useMemo(()=>({onKeyDown:q,onPointerDown:F,onMouseDown:F,onClickCapture:X,onMouseDownCapture(G){X(),Y(G)},onPointerDownCapture(G){X(),Y(G)},onMouseUpCapture:X,onTouchEndCapture:X,onTouchMoveCapture:X}),[q,X,Y,F]);return x.useMemo(()=>s?{reference:K,floating:I,trigger:K}:{},[s,K,I])}function uj(e,t,s){let{reference:o,floating:l}=e;const c=zs(t),u=pb(t),p=fb(u),m=cs(t),h=c==="y",g=o.x+o.width/2-l.width/2,b=o.y+o.height/2-l.height/2,v=o[p]/2-l[p]/2;let k;switch(m){case"top":k={x:g,y:o.y-l.height};break;case"bottom":k={x:g,y:o.y+o.height};break;case"right":k={x:o.x+o.width,y:b};break;case"left":k={x:o.x-l.width,y:b};break;default:k={x:o.x,y:o.y}}switch(Ir(t)){case"start":k[u]-=v*(s&&h?-1:1);break;case"end":k[u]+=v*(s&&h?-1:1);break}return k}async function _O(e,t){var s;t===void 0&&(t={});const{x:o,y:l,platform:c,rects:u,elements:p,strategy:m}=e,{boundary:h="clippingAncestors",rootBoundary:g="viewport",elementContext:b="floating",altBoundary:v=!1,padding:k=0}=Xa(t,e),E=RS(k),j=p[v?b==="floating"?"reference":"floating":b],C=zc(await c.getClippingRect({element:(s=await(c.isElement==null?void 0:c.isElement(j)))==null||s?j:j.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(p.floating)),boundary:h,rootBoundary:g,strategy:m})),S=b==="floating"?{x:o,y:l,width:u.floating.width,height:u.floating.height}:u.reference,N=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p.floating)),R=await(c.isElement==null?void 0:c.isElement(N))?await(c.getScale==null?void 0:c.getScale(N))||{x:1,y:1}:{x:1,y:1},M=zc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:S,offsetParent:N,strategy:m}):S);return{top:(C.top-M.top+E.top)/R.y,bottom:(M.bottom-C.bottom+E.bottom)/R.y,left:(C.left-M.left+E.left)/R.x,right:(M.right-C.right+E.right)/R.x}}const vO=50,yO=async(e,t,s)=>{const{placement:o="bottom",strategy:l="absolute",middleware:c=[],platform:u}=s,p=u.detectOverflow?u:{...u,detectOverflow:_O},m=await(u.isRTL==null?void 0:u.isRTL(t));let h=await u.getElementRects({reference:e,floating:t,strategy:l}),{x:g,y:b}=uj(h,o,m),v=o,k=0;const E={};for(let y=0;y<c.length;y++){const j=c[y];if(!j)continue;const{name:C,fn:S}=j,{x:N,y:R,data:M,reset:T}=await S({x:g,y:b,initialPlacement:o,placement:v,strategy:l,middlewareData:E,rects:h,platform:p,elements:{reference:e,floating:t}});g=N??g,b=R??b,E[C]={...E[C],...M},T&&k<vO&&(k++,typeof T=="object"&&(T.placement&&(v=T.placement),T.rects&&(h=T.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:l}):T.rects),{x:g,y:b}=uj(h,v,m)),y=-1)}return{x:g,y:b,placement:v,strategy:l,middlewareData:E}},jO=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var s,o;const{placement:l,middlewareData:c,rects:u,initialPlacement:p,platform:m,elements:h}=t,{mainAxis:g=!0,crossAxis:b=!0,fallbackPlacements:v,fallbackStrategy:k="bestFit",fallbackAxisSideDirection:E="none",flipAlignment:y=!0,...j}=Xa(e,t);if((s=c.arrow)!=null&&s.alignmentOffset)return{};const C=cs(l),S=zs(p),N=cs(p)===p,R=await(m.isRTL==null?void 0:m.isRTL(h.floating)),M=v||(N||!y?[sf(p)]:E5(p)),T=E!=="none";!v&&T&&M.push(...M5(p,y,E,R));const z=[p,...M],D=await m.detectOverflow(t,j),U=[];let L=((o=c.flip)==null?void 0:o.overflows)||[];if(g&&U.push(D[C]),b){const B=N5(l,u,R);U.push(D[B[0]],D[B[1]])}if(L=[...L,{placement:l,overflows:U}],!U.every(B=>B<=0)){var H,O;const B=(((H=c.flip)==null?void 0:H.index)||0)+1,$=z[B];if($&&(!(b==="alignment"?S!==zs($):!1)||L.every(Y=>zs(Y.placement)===S?Y.overflows[0]>0:!0)))return{data:{index:B,overflows:L},reset:{placement:$}};let q=(O=L.filter(X=>X.overflows[0]<=0).sort((X,Y)=>X.overflows[1]-Y.overflows[1])[0])==null?void 0:O.placement;if(!q)switch(k){case"bestFit":{var P;const X=(P=L.filter(Y=>{if(T){const F=zs(Y.placement);return F===S||F==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(F=>F>0).reduce((F,K)=>F+K,0)]).sort((Y,F)=>Y[1]-F[1])[0])==null?void 0:P[0];X&&(q=X);break}case"initialPlacement":q=p;break}if(l!==q)return{reset:{placement:q}}}return{}}}};function dj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function fj(e){return S5.some(t=>e[t]>=0)}const wO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:s,platform:o}=t,{strategy:l="referenceHidden",...c}=Xa(e,t);switch(l){case"referenceHidden":{const u=await o.detectOverflow(t,{...c,elementContext:"reference"}),p=dj(u,s.reference);return{data:{referenceHiddenOffsets:p,referenceHidden:fj(p)}}}case"escaped":{const u=await o.detectOverflow(t,{...c,altBoundary:!0}),p=dj(u,s.floating);return{data:{escapedOffsets:p,escaped:fj(p)}}}default:return{}}}}},n2=new Set(["left","top"]);async function kO(e,t){const{placement:s,platform:o,elements:l}=e,c=await(o.isRTL==null?void 0:o.isRTL(l.floating)),u=cs(s),p=Ir(s),m=zs(s)==="y",h=n2.has(u)?-1:1,g=c&&m?-1:1,b=Xa(t,e);let{mainAxis:v,crossAxis:k,alignmentAxis:E}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return p&&typeof E=="number"&&(k=p==="end"?E*-1:E),m?{x:k*g,y:v*h}:{x:v*h,y:k*g}}const SO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var s,o;const{x:l,y:c,placement:u,middlewareData:p}=t,m=await kO(t,e);return u===((s=p.offset)==null?void 0:s.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:l+m.x,y:c+m.y,data:{...m,placement:u}}}}},CO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:s,y:o,placement:l,platform:c}=t,{mainAxis:u=!0,crossAxis:p=!1,limiter:m={fn:C=>{let{x:S,y:N}=C;return{x:S,y:N}}},...h}=Xa(e,t),g={x:s,y:o},b=await c.detectOverflow(t,h),v=zs(cs(l)),k=db(v);let E=g[k],y=g[v];if(u){const C=k==="y"?"top":"left",S=k==="y"?"bottom":"right",N=E+b[C],R=E-b[S];E=sx(N,E,R)}if(p){const C=v==="y"?"top":"left",S=v==="y"?"bottom":"right",N=y+b[C],R=y-b[S];y=sx(N,y,R)}const j=m.fn({...t,[k]:E,[v]:y});return{...j,data:{x:j.x-s,y:j.y-o,enabled:{[k]:u,[v]:p}}}}}},NO=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:s,y:o,placement:l,rects:c,middlewareData:u}=t,{offset:p=0,mainAxis:m=!0,crossAxis:h=!0}=Xa(e,t),g={x:s,y:o},b=zs(l),v=db(b);let k=g[v],E=g[b];const y=Xa(p,t),j=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(m){const N=v==="y"?"height":"width",R=c.reference[v]-c.floating[N]+j.mainAxis,M=c.reference[v]+c.reference[N]-j.mainAxis;k<R?k=R:k>M&&(k=M)}if(h){var C,S;const N=v==="y"?"width":"height",R=n2.has(cs(l)),M=c.reference[b]-c.floating[N]+(R&&((C=u.offset)==null?void 0:C[b])||0)+(R?0:j.crossAxis),T=c.reference[b]+c.reference[N]+(R?0:((S=u.offset)==null?void 0:S[b])||0)-(R?j.crossAxis:0);E<M?E=M:E>T&&(E=T)}return{[v]:k,[b]:E}}}},EO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var s,o;const{placement:l,rects:c,platform:u,elements:p}=t,{apply:m=()=>{},...h}=Xa(e,t),g=await u.detectOverflow(t,h),b=cs(l),v=Ir(l),k=zs(l)==="y",{width:E,height:y}=c.floating;let j,C;b==="top"||b==="bottom"?(j=b,C=v===(await(u.isRTL==null?void 0:u.isRTL(p.floating))?"start":"end")?"left":"right"):(C=b,j=v==="end"?"top":"bottom");const S=y-g.top-g.bottom,N=E-g.left-g.right,R=ql(y-g[j],S),M=ql(E-g[C],N),T=!t.middlewareData.shift;let z=R,D=M;if((s=t.middlewareData.shift)!=null&&s.enabled.x&&(D=N),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(z=S),T&&!v){const L=vs(g.left,0),H=vs(g.right,0),O=vs(g.top,0),P=vs(g.bottom,0);k?D=E-2*(L!==0||H!==0?L+H:vs(g.left,g.right)):z=y-2*(O!==0||P!==0?O+P:vs(g.top,g.bottom))}await m({...t,availableWidth:D,availableHeight:z});const U=await u.getDimensions(p.floating);return E!==U.width||y!==U.height?{reset:{rects:!0}}:{}}}};function s2(e){const t=ds(e);let s=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const l=qt(e),c=l?e.offsetWidth:s,u=l?e.offsetHeight:o,p=nf(s)!==c||nf(o)!==u;return p&&(s=c,o=u),{width:s,height:o,$:p}}function wb(e){return gt(e)?e:e.contextElement}function Ol(e){const t=wb(e);if(!qt(t))return ca(1);const s=t.getBoundingClientRect(),{width:o,height:l,$:c}=s2(t);let u=(c?nf(s.width):s.width)/o,p=(c?nf(s.height):s.height)/l;return(!u||!Number.isFinite(u))&&(u=1),(!p||!Number.isFinite(p))&&(p=1),{x:u,y:p}}const RO=ca(0);function a2(e){const t=Xt(e);return!ob()||!t.visualViewport?RO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function TO(e,t,s){return t===void 0&&(t=!1),!s||t&&s!==Xt(e)?!1:t}function yo(e,t,s,o){t===void 0&&(t=!1),s===void 0&&(s=!1);const l=e.getBoundingClientRect(),c=wb(e);let u=ca(1);t&&(o?gt(o)&&(u=Ol(o)):u=Ol(e));const p=TO(c,s,o)?a2(c):ca(0);let m=(l.left+p.x)/u.x,h=(l.top+p.y)/u.y,g=l.width/u.x,b=l.height/u.y;if(c){const v=Xt(c),k=o&&gt(o)?Xt(o):o;let E=v,y=Jg(E);for(;y&&o&&k!==E;){const j=Ol(y),C=y.getBoundingClientRect(),S=ds(y),N=C.left+(y.clientLeft+parseFloat(S.paddingLeft))*j.x,R=C.top+(y.clientTop+parseFloat(S.paddingTop))*j.y;m*=j.x,h*=j.y,g*=j.x,b*=j.y,m+=N,h+=R,E=Xt(y),y=Jg(E)}}return zc({width:g,height:b,x:m,y:h})}function Qf(e,t){const s=Vf(e).scrollLeft;return t?t.left+s:yo(ma(e)).left+s}function r2(e,t){const s=e.getBoundingClientRect(),o=s.left+t.scrollLeft-Qf(e,s),l=s.top+t.scrollTop;return{x:o,y:l}}function AO(e){let{elements:t,rect:s,offsetParent:o,strategy:l}=e;const c=l==="fixed",u=ma(o),p=t?Hf(t.floating):!1;if(o===u||p&&c)return s;let m={scrollLeft:0,scrollTop:0},h=ca(1);const g=ca(0),b=qt(o);if((b||!b&&!c)&&((Hn(o)!=="body"||Pr(u))&&(m=Vf(o)),b)){const k=yo(o);h=Ol(o),g.x=k.x+o.clientLeft,g.y=k.y+o.clientTop}const v=u&&!b&&!c?r2(u,m):ca(0);return{width:s.width*h.x,height:s.height*h.y,x:s.x*h.x-m.scrollLeft*h.x+g.x+v.x,y:s.y*h.y-m.scrollTop*h.y+g.y+v.y}}function MO(e){return Array.from(e.getClientRects())}function OO(e){const t=ma(e),s=Vf(e),o=e.ownerDocument.body,l=vs(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),c=vs(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let u=-s.scrollLeft+Qf(e);const p=-s.scrollTop;return ds(o).direction==="rtl"&&(u+=vs(t.clientWidth,o.clientWidth)-l),{width:l,height:c,x:u,y:p}}const pj=25;function zO(e,t){const s=Xt(e),o=ma(e),l=s.visualViewport;let c=o.clientWidth,u=o.clientHeight,p=0,m=0;if(l){c=l.width,u=l.height;const g=ob();(!g||g&&t==="fixed")&&(p=l.offsetLeft,m=l.offsetTop)}const h=Qf(o);if(h<=0){const g=o.ownerDocument,b=g.body,v=getComputedStyle(b),k=g.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,E=Math.abs(o.clientWidth-b.clientWidth-k);E<=pj&&(c-=E)}else h<=pj&&(c+=h);return{width:c,height:u,x:p,y:m}}function DO(e,t){const s=yo(e,!0,t==="fixed"),o=s.top+e.clientTop,l=s.left+e.clientLeft,c=qt(e)?Ol(e):ca(1),u=e.clientWidth*c.x,p=e.clientHeight*c.y,m=l*c.x,h=o*c.y;return{width:u,height:p,x:m,y:h}}function mj(e,t,s){let o;if(t==="viewport")o=zO(e,s);else if(t==="document")o=OO(ma(e));else if(gt(t))o=DO(t,s);else{const l=a2(e);o={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return zc(o)}function o2(e,t){const s=da(e);return s===t||!gt(s)||la(s)?!1:ds(s).position==="fixed"||o2(s,t)}function LO(e,t){const s=t.get(e);if(s)return s;let o=Oc(e,[],!1).filter(p=>gt(p)&&Hn(p)!=="body"),l=null;const c=ds(e).position==="fixed";let u=c?da(e):e;for(;gt(u)&&!la(u);){const p=ds(u),m=rb(u);!m&&p.position==="fixed"&&(l=null),(c?!m&&!l:!m&&p.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Pr(u)&&!m&&o2(e,u))?o=o.filter(g=>g!==u):l=p,u=da(u)}return t.set(e,o),o}function PO(e){let{element:t,boundary:s,rootBoundary:o,strategy:l}=e;const u=[...s==="clippingAncestors"?Hf(t)?[]:LO(t,this._c):[].concat(s),o],p=mj(t,u[0],l);let m=p.top,h=p.right,g=p.bottom,b=p.left;for(let v=1;v<u.length;v++){const k=mj(t,u[v],l);m=vs(k.top,m),h=ql(k.right,h),g=ql(k.bottom,g),b=vs(k.left,b)}return{width:h-b,height:g-m,x:b,y:m}}function IO(e){const{width:t,height:s}=s2(e);return{width:t,height:s}}function BO(e,t,s){const o=qt(t),l=ma(t),c=s==="fixed",u=yo(e,!0,c,t);let p={scrollLeft:0,scrollTop:0};const m=ca(0);function h(){m.x=Qf(l)}if(o||!o&&!c)if((Hn(t)!=="body"||Pr(l))&&(p=Vf(t)),o){const k=yo(t,!0,c,t);m.x=k.x+t.clientLeft,m.y=k.y+t.clientTop}else l&&h();c&&!o&&l&&h();const g=l&&!o&&!c?r2(l,p):ca(0),b=u.left+p.scrollLeft-m.x-g.x,v=u.top+p.scrollTop-m.y-g.y;return{x:b,y:v,width:u.width,height:u.height}}function qh(e){return ds(e).position==="static"}function hj(e,t){if(!qt(e)||ds(e).position==="fixed")return null;if(t)return t(e);let s=e.offsetParent;return ma(e)===s&&(s=s.ownerDocument.body),s}function l2(e,t){const s=Xt(e);if(Hf(e))return s;if(!qt(e)){let l=da(e);for(;l&&!la(l);){if(gt(l)&&!qh(l))return l;l=da(l)}return s}let o=hj(e,t);for(;o&&s5(o)&&qh(o);)o=hj(o,t);return o&&la(o)&&qh(o)&&!rb(o)?s:o||o5(e)||s}const UO=async function(e){const t=this.getOffsetParent||l2,s=this.getDimensions,o=await s(e.floating);return{reference:BO(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function HO(e){return ds(e).direction==="rtl"}const i2={convertOffsetParentRelativeRectToViewportRelativeRect:AO,getDocumentElement:ma,getClippingRect:PO,getOffsetParent:l2,getElementRects:UO,getClientRects:MO,getDimensions:IO,getScale:Ol,isElement:gt,isRTL:HO};function c2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function VO(e,t){let s=null,o;const l=ma(e);function c(){var p;clearTimeout(o),(p=s)==null||p.disconnect(),s=null}function u(p,m){p===void 0&&(p=!1),m===void 0&&(m=1),c();const h=e.getBoundingClientRect(),{left:g,top:b,width:v,height:k}=h;if(p||t(),!v||!k)return;const E=gd(b),y=gd(l.clientWidth-(g+v)),j=gd(l.clientHeight-(b+k)),C=gd(g),N={rootMargin:-E+"px "+-y+"px "+-j+"px "+-C+"px",threshold:vs(0,ql(1,m))||1};let R=!0;function M(T){const z=T[0].intersectionRatio;if(z!==m){if(!R)return u();z?u(!1,z):o=setTimeout(()=>{u(!1,1e-7)},1e3)}z===1&&!c2(h,e.getBoundingClientRect())&&u(),R=!1}try{s=new IntersectionObserver(M,{...N,root:l.ownerDocument})}catch{s=new IntersectionObserver(M,N)}s.observe(e)}return u(!0),c}function gj(e,t,s,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,h=wb(e),g=l||c?[...h?Oc(h):[],...t?Oc(t):[]]:[];g.forEach(C=>{l&&C.addEventListener("scroll",s,{passive:!0}),c&&C.addEventListener("resize",s)});const b=h&&p?VO(h,s):null;let v=-1,k=null;u&&(k=new ResizeObserver(C=>{let[S]=C;S&&S.target===h&&k&&t&&(k.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var N;(N=k)==null||N.observe(t)})),s()}),h&&!m&&k.observe(h),t&&k.observe(t));let E,y=m?yo(e):null;m&&j();function j(){const C=yo(e);y&&!c2(y,C)&&s(),y=C,E=requestAnimationFrame(j)}return s(),()=>{var C;g.forEach(S=>{l&&S.removeEventListener("scroll",s),c&&S.removeEventListener("resize",s)}),b?.(),(C=k)==null||C.disconnect(),k=null,m&&cancelAnimationFrame(E)}}const qO=SO,$O=CO,FO=jO,GO=EO,YO=wO,KO=NO,XO=(e,t,s)=>{const o=new Map,l={platform:i2,...s},c={...l.platform,_c:o};return yO(e,t,{...l,platform:c})};var QO=typeof document<"u",WO=function(){},qd=QO?x.useLayoutEffect:WO;function lf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let s,o,l;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==t.length)return!1;for(o=s;o--!==0;)if(!lf(e[o],t[o]))return!1;return!0}if(l=Object.keys(e),s=l.length,s!==Object.keys(t).length)return!1;for(o=s;o--!==0;)if(!{}.hasOwnProperty.call(t,l[o]))return!1;for(o=s;o--!==0;){const c=l[o];if(!(c==="_owner"&&e.$$typeof)&&!lf(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function u2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function xj(e,t){const s=u2(e);return Math.round(t*s)/s}function $h(e){const t=x.useRef(e);return qd(()=>{t.current=e}),t}function ZO(e){e===void 0&&(e={});const{placement:t="bottom",strategy:s="absolute",middleware:o=[],platform:l,elements:{reference:c,floating:u}={},transform:p=!0,whileElementsMounted:m,open:h}=e,[g,b]=x.useState({x:0,y:0,strategy:s,placement:t,middlewareData:{},isPositioned:!1}),[v,k]=x.useState(o);lf(v,o)||k(o);const[E,y]=x.useState(null),[j,C]=x.useState(null),S=x.useCallback(Y=>{Y!==T.current&&(T.current=Y,y(Y))},[]),N=x.useCallback(Y=>{Y!==z.current&&(z.current=Y,C(Y))},[]),R=c||E,M=u||j,T=x.useRef(null),z=x.useRef(null),D=x.useRef(g),U=m!=null,L=$h(m),H=$h(l),O=$h(h),P=x.useCallback(()=>{if(!T.current||!z.current)return;const Y={placement:t,strategy:s,middleware:v};H.current&&(Y.platform=H.current),XO(T.current,z.current,Y).then(F=>{const K={...F,isPositioned:O.current!==!1};B.current&&!lf(D.current,K)&&(D.current=K,Ps.flushSync(()=>{b(K)}))})},[v,t,s,H,O]);qd(()=>{h===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,b(Y=>({...Y,isPositioned:!1})))},[h]);const B=x.useRef(!1);qd(()=>(B.current=!0,()=>{B.current=!1}),[]),qd(()=>{if(R&&(T.current=R),M&&(z.current=M),R&&M){if(L.current)return L.current(R,M,P);P()}},[R,M,P,L,U]);const $=x.useMemo(()=>({reference:T,floating:z,setReference:S,setFloating:N}),[S,N]),q=x.useMemo(()=>({reference:R,floating:M}),[R,M]),X=x.useMemo(()=>{const Y={position:s,left:0,top:0};if(!q.floating)return Y;const F=xj(q.floating,g.x),K=xj(q.floating,g.y);return p?{...Y,transform:"translate("+F+"px, "+K+"px)",...u2(q.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:F,top:K}},[s,p,q.floating,g.x,g.y]);return x.useMemo(()=>({...g,update:P,refs:$,elements:q,floatingStyles:X}),[g,P,$,q,X])}const JO=(e,t)=>{const s=qO(e);return{name:s.name,fn:s.fn,options:[e,t]}},e4=(e,t)=>{const s=$O(e);return{name:s.name,fn:s.fn,options:[e,t]}},t4=(e,t)=>({fn:KO(e).fn,options:[e,t]}),n4=(e,t)=>{const s=FO(e);return{name:s.name,fn:s.fn,options:[e,t]}},s4=(e,t)=>{const s=GO(e);return{name:s.name,fn:s.fn,options:[e,t]}},a4=(e,t)=>{const s=YO(e);return{name:s.name,fn:s.fn,options:[e,t]}};function kb(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const Ae=(e,t,s,o,l,c,...u)=>{if(u.length>0)throw new Error(rn(1));let p;if(e)p=e;else throw new Error("Missing arguments");return p};var Fh={exports:{}},Gh={};/**
601
- * @license React
602
- * use-sync-external-store-shim.production.js
603
- *
604
- * Copyright (c) Meta Platforms, Inc. and affiliates.
605
- *
606
- * This source code is licensed under the MIT license found in the
607
- * LICENSE file in the root directory of this source tree.
608
- */var bj;function r4(){if(bj)return Gh;bj=1;var e=Uc();function t(b,v){return b===v&&(b!==0||1/b===1/v)||b!==b&&v!==v}var s=typeof Object.is=="function"?Object.is:t,o=e.useState,l=e.useEffect,c=e.useLayoutEffect,u=e.useDebugValue;function p(b,v){var k=v(),E=o({inst:{value:k,getSnapshot:v}}),y=E[0].inst,j=E[1];return c(function(){y.value=k,y.getSnapshot=v,m(y)&&j({inst:y})},[b,k,v]),l(function(){return m(y)&&j({inst:y}),b(function(){m(y)&&j({inst:y})})},[b]),u(k),k}function m(b){var v=b.getSnapshot;b=b.value;try{var k=v();return!s(b,k)}catch{return!0}}function h(b,v){return v()}var g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:p;return Gh.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:g,Gh}var _j;function d2(){return _j||(_j=1,Fh.exports=r4()),Fh.exports}var cf=d2(),Yh={exports:{}},Kh={};/**
609
- * @license React
610
- * use-sync-external-store-shim/with-selector.production.js
611
- *
612
- * Copyright (c) Meta Platforms, Inc. and affiliates.
613
- *
614
- * This source code is licensed under the MIT license found in the
615
- * LICENSE file in the root directory of this source tree.
616
- */var vj;function o4(){if(vj)return Kh;vj=1;var e=Uc(),t=d2();function s(h,g){return h===g&&(h!==0||1/h===1/g)||h!==h&&g!==g}var o=typeof Object.is=="function"?Object.is:s,l=t.useSyncExternalStore,c=e.useRef,u=e.useEffect,p=e.useMemo,m=e.useDebugValue;return Kh.useSyncExternalStoreWithSelector=function(h,g,b,v,k){var E=c(null);if(E.current===null){var y={hasValue:!1,value:null};E.current=y}else y=E.current;E=p(function(){function C(T){if(!S){if(S=!0,N=T,T=v(T),k!==void 0&&y.hasValue){var z=y.value;if(k(z,T))return R=z}return R=T}if(z=R,o(N,T))return z;var D=v(T);return k!==void 0&&k(z,D)?(N=T,z):(N=T,R=D)}var S=!1,N,R,M=b===void 0?null:b;return[function(){return C(g())},M===null?void 0:function(){return C(M())}]},[g,b,v,k]);var j=l(h,E[0],E[1]);return u(function(){y.hasValue=!0,y.value=j},[j]),m(j),j},Kh}var yj;function l4(){return yj||(yj=1,Yh.exports=o4()),Yh.exports}var i4=l4();const c4=gb(19),u4=c4?f4:p4;function tt(e,t,s,o,l){return u4(e,t,s,o,l)}function d4(e,t,s,o,l){const c=x.useCallback(()=>t(e.getSnapshot(),s,o,l),[e,t,s,o,l]);return cf.useSyncExternalStore(e.subscribe,c,c)}$3({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let s=0;s<e.syncHooks.length;s+=1){const o=e.syncHooks[s],l=o.selector(o.store.state,o.a1,o.a2,o.a3);Object.is(o.value,l)||(t=!0,o.value=l)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const s=new Set;for(const l of e.syncHooks)s.add(l.store);const o=[];for(const l of s)o.push(l.subscribe(t));return()=>{for(const l of o)l()}}),cf.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function f4(e,t,s,o,l){const c=q3();if(!c)return d4(e,t,s,o,l);const u=c.syncIndex;c.syncIndex+=1;let p;return c.didInitialize?(p=c.syncHooks[u],(p.store!==e||p.selector!==t||!Object.is(p.a1,s)||!Object.is(p.a2,o)||!Object.is(p.a3,l))&&(p.store!==e&&(c.didChangeStore=!0),p.store=e,p.selector=t,p.a1=s,p.a2=o,p.a3=l,p.value=t(e.getSnapshot(),s,o,l))):(p={store:e,selector:t,a1:s,a2:o,a3:l,value:t(e.getSnapshot(),s,o,l)},c.syncHooks.push(p)),p.value}function p4(e,t,s,o,l){return i4.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,s,o,l))}class f2{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const s=this.updateTick;for(const o of this.listeners){if(s!==this.updateTick)return;o(t)}}update(t){for(const s in t)if(!Object.is(this.state[s],t[s])){this.setState({...this.state,...t});return}}set(t,s){Object.is(this.state[t],s)||this.setState({...this.state,[t]:s})}notifyAll(){const t={...this.state};this.setState(t)}use(t,s,o,l){return tt(this,t,s,o,l)}}class Wf extends f2{constructor(t,s={},o){super(t),this.context=s,this.selectors=o}useSyncedValue(t,s){x.useDebugValue(t);const o=this;ze(()=>{o.state[t]!==s&&o.set(t,s)},[o,t,s])}useSyncedValueWithCleanup(t,s){const o=this;ze(()=>(o.state[t]!==s&&o.set(t,s),()=>{o.set(t,void 0)}),[o,t,s])}useSyncedValues(t){const s=this,o=Object.values(t);ze(()=>{s.update(t)},[s,...o])}useControlledProp(t,s){x.useDebugValue(t);const o=this,l=s!==void 0;ze(()=>{l&&!Object.is(o.state[t],s)&&o.setState({...o.state,[t]:s})},[o,t,s,l])}select(t,s,o,l){const c=this.selectors[t];return c(this.state,s,o,l)}useState(t,s,o,l){return x.useDebugValue(t),tt(this,this.selectors[t],s,o,l)}useContextCallback(t,s){x.useDebugValue(t);const o=Ue(s??Rn);this.context[t]=o}useStateSetter(t){const s=x.useRef(void 0);return s.current===void 0&&(s.current=o=>{this.set(t,o)}),s.current}observe(t,s){let o;typeof t=="function"?o=t:o=this.selectors[t];let l=o(this.state);return s(l,l,this),this.subscribe(c=>{const u=o(c);if(!Object.is(l,u)){const p=l;l=u,s(u,p,this)}})}}const m4={open:Ae(e=>e.open),transitionStatus:Ae(e=>e.transitionStatus),domReferenceElement:Ae(e=>e.domReferenceElement),referenceElement:Ae(e=>e.positionReference??e.referenceElement),floatingElement:Ae(e=>e.floatingElement),floatingId:Ae(e=>e.floatingId)};class Zf extends Wf{constructor(t){const{syncOnly:s,nested:o,onOpenChange:l,triggerElements:c,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:l,dataRef:{current:{}},events:WS(),nested:o,triggerElements:c},m4),this.syncOnly=s}syncOpenEvent=(t,s)=>{(!t||!this.state.open||s!=null&&n5(s))&&(this.context.dataRef.current.openEvent=t?s:void 0)};dispatchOpenChange=(t,s)=>{this.syncOpenEvent(t,s.event);const o={open:t,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",o)};setOpen=(t,s)=>{if(this.syncOnly){this.context.onOpenChange?.(t,s);return}this.dispatchOpenChange(t,s),this.context.onOpenChange?.(t,s)}}function p2(e){const{popupStore:t,treatPopupAsFloatingElement:s=!1,floatingRootContext:o,floatingId:l,nested:c,onOpenChange:u}=e,p=t.useState("open"),m=t.useState("activeTriggerElement"),h=t.useState(s?"popupElement":"positionerElement"),g=t.context.triggerElements,b=u,v=x.useRef(null);o===void 0&&v.current===null&&(v.current=new Zf({open:p,transitionStatus:void 0,referenceElement:m,floatingElement:h,triggerElements:g,onOpenChange:b,floatingId:l,syncOnly:!0,nested:c}));const k=o??v.current;return t.useSyncedValue("floatingId",l),ze(()=>{const E={open:p,floatingId:l,referenceElement:m,floatingElement:h};gt(m)&&(E.domReferenceElement=m),k.state.positionReference===k.state.referenceElement&&(E.positionReference=m),k.update(E)},[p,l,m,h,k]),k.context.onOpenChange=b,k.context.nested=c,k}function si(e,t=!1,s=!1){const[o,l]=x.useState(e&&t?"idle":void 0),[c,u]=x.useState(e);return e&&!c&&(u(!0),l("starting")),!e&&c&&o!=="ending"&&!s&&l("ending"),!e&&!c&&o==="ending"&&l(void 0),ze(()=>{if(!e&&c&&o!=="ending"&&s){const p=sa.request(()=>{l("ending")});return()=>{sa.cancel(p)}}},[e,c,o,s]),ze(()=>{if(!e||t)return;const p=sa.request(()=>{l(void 0)});return()=>{sa.cancel(p)}},[t,e]),ze(()=>{if(!e||!t)return;e&&c&&o!=="idle"&&l("starting");const p=sa.request(()=>{l("idle")});return()=>{sa.cancel(p)}},[t,e,c,o]),{mounted:c,setMounted:u,transitionStatus:o}}let jo=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const h4={[jo.startingStyle]:""},g4={[jo.endingStyle]:""},Ja={transitionStatus(e){return e==="starting"?h4:e==="ending"?g4:null}};function m2(e,t=!1,s=!0){const o=Hl();return Ue((l,c=null)=>{o.cancel();const u=Ua(e);if(u==null)return;const p=u,m=()=>{Ps.flushSync(l)};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){l();return}function h(){Promise.all(p.getAnimations().map(g=>g.finished)).then(()=>{c?.aborted||m()}).catch(()=>{if(s){c?.aborted||m();return}const g=p.getAnimations();!c?.aborted&&g.length>0&&g.some(b=>b.pending||b.playState!=="finished")&&h()})}if(t){const g=jo.startingStyle;if(!p.hasAttribute(g)){o.request(h);return}const b=new MutationObserver(()=>{p.hasAttribute(g)||(b.disconnect(),h())});b.observe(p,{attributes:!0,attributeFilter:[g]}),c?.addEventListener("abort",()=>b.disconnect(),{once:!0});return}o.request(h)})}function ha(e){const{enabled:t=!0,open:s,ref:o,onComplete:l}=e,c=Ue(l),u=m2(o,s,!1);x.useEffect(()=>{if(!t)return;const p=new AbortController;return u(c,p.signal),()=>{p.abort()}},[t,s,c,u])}const Jf={tabIndex:-1,[ex]:""};function x4(e){return t=>t==="touch"?e.current:!0}function h2(e,t,s=!1){const o=vo(),l=Br()!=null,c=x.useRef(null);e===void 0&&c.current===null&&(c.current=t(o,l));const u=e??c.current;return p2({popupStore:u,treatPopupAsFloatingElement:s,floatingRootContext:u.state.floatingRootContext,floatingId:o,nested:l,onOpenChange:u.setOpen}),{store:u,internalStore:c.current}}function b4(e,t){const s=x.useRef(null),o=x.useRef(null);return x.useCallback(l=>{if(e===void 0)return;let c=!1;if(s.current!==null){const u=s.current,p=o.current,m=t.context.triggerElements.getById(u);p&&m===p&&(t.context.triggerElements.delete(u),c=!0),s.current=null,o.current=null}if(l!==null&&(s.current=e,o.current=l,t.context.triggerElements.add(e,l),c=!0),c){const u=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==u&&t.set("triggerCount",u)}},[t,e])}function Sb(e,t,s,o=!1){t?e.preventUnmountingOnClose=!1:o&&(e.preventUnmountingOnClose=!0);const l=s?.id??null;(l||t)&&(e.activeTriggerId=l,e.activeTriggerElement=s??null)}function g2(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function _4(e,t,s,o={}){const l=s.reason,c=l===Tn,u=t&&l===Tl,p=!t&&(l===ni||l===Yf),m=g2(s);if(e.context.onOpenChange?.(t,s),s.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,s);const h=()=>{const g={...o.extraState,open:t};u?g.instantType="focus":p?g.instantType="dismiss":c&&(g.instantType=void 0),Sb(g,t,s.trigger,m()),e.update(g)};c?Ps.flushSync(h):h()}function x2(e,t,s,o){kb(()=>{t===void 0&&e.state.open===!1&&s&&(e.state={...e.state,open:!0,activeTriggerId:o,preventUnmountingOnClose:!1})})}function b2(e,t,s,o){const l=s.useState("isMountedByTrigger",e),c=b4(e,s),u=Ue(p=>{if(c(p),!p)return;const m=s.select("open"),h=s.select("activeTriggerId");if(h===e){s.update({activeTriggerElement:p,...m?o:null});return}h==null&&m&&s.update({activeTriggerId:e,activeTriggerElement:p,...o})});return ze(()=>{l&&s.update({activeTriggerElement:t.current,...o})},[l,s,t,...Object.values(o)]),{registerTrigger:u,isMountedByThisTrigger:l}}function Cb(e,t={}){const{closeOnActiveTriggerUnmount:s=!1}=t,o=e.useState("open"),l=e.useState("triggerCount");ze(()=>{if(!o){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const c=e.context.triggerElements.size,u={};e.state.triggerCount!==c&&(u.triggerCount=c);const p=e.select("activeTriggerId");let m=null;if(p){const h=e.context.triggerElements.getById(p);h?h!==e.state.activeTriggerElement&&(u.activeTriggerElement=h):m=p}if(!m&&!p&&c===1){const h=e.context.triggerElements.entries().next();if(!h.done){const[g,b]=h.value;u.activeTriggerId=g,u.activeTriggerElement=b}}(u.triggerCount!==void 0||u.activeTriggerId!==void 0||u.activeTriggerElement!==void 0)&&e.update(u),m&&s&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===m&&!e.context.triggerElements.getById(m)){const h=nt(fa);e.setOpen(!1,h),h.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,l,s])}function Nb(e,t,s){const{mounted:o,setMounted:l,transitionStatus:c}=si(e),u=t.useState("preventUnmountingOnClose"),p=e?!1:u;t.useSyncedValues({mounted:o,transitionStatus:c,preventUnmountingOnClose:p});const m=Ue(()=>{l(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),s?.(),t.context.onOpenChangeComplete?.(!1)});return ha({enabled:o&&!e&&!p,open:e,ref:t.context.popupRef,onComplete(){e||m()}}),{forceUnmount:m,transitionStatus:c}}function Eb(e,t){e.useSyncedValues(t),ze(()=>()=>{e.update({activeTriggerProps:Gt,inactiveTriggerProps:Gt,popupProps:Gt})},[e])}function v4(e,t){ze(()=>{!t&&e.state.openMethod!==null&&e.set("openMethod",null)},[t,e]),ze(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Yc{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,s){const o=this.idMap.get(t);o!==s&&(o!==void 0&&this.elementsSet.delete(o),this.elementsSet.add(s),this.idMap.set(t,s))}delete(t){const s=this.idMap.get(t);s&&(this.elementsSet.delete(s),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const s of this.elementsSet)if(t(s))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function y4(){return new Zf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Yc,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function Rb(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:y4(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Gt,inactiveTriggerProps:Gt,popupProps:Gt}}function _2(e,t,s=!1){return new Zf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:s,onOpenChange:void 0})}const jc=Ae(e=>e.triggerIdProp??e.activeTriggerId),Tb=Ae(e=>e.openProp??e.open),jj=Ae(e=>(e.popupElement?.id??e.floatingId)||void 0);function v2(e,t){return t!==void 0&&Tb(e)&&jc(e)===t}function j4(e,t){return v2(e,t)?!0:t!==void 0&&Tb(e)&&jc(e)==null&&e.triggerCount===1}const Ab={open:Tb,mounted:Ae(e=>e.mounted),transitionStatus:Ae(e=>e.transitionStatus),floatingRootContext:Ae(e=>e.floatingRootContext),triggerCount:Ae(e=>e.triggerCount),preventUnmountingOnClose:Ae(e=>e.preventUnmountingOnClose),payload:Ae(e=>e.payload),activeTriggerId:jc,activeTriggerElement:Ae(e=>e.mounted?e.activeTriggerElement:null),popupId:jj,isTriggerActive:Ae((e,t)=>t!==void 0&&jc(e)===t),isOpenedByTrigger:Ae((e,t)=>v2(e,t)),isMountedByTrigger:Ae((e,t)=>t!==void 0&&jc(e)===t&&e.mounted),triggerProps:Ae((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Ae((e,t)=>j4(e,t)?jj(e):void 0),popupProps:Ae(e=>e.popupProps),popupElement:Ae(e=>e.popupElement),positionerElement:Ae(e=>e.positionerElement)};function y2(e){const{open:t=!1,onOpenChange:s,elements:o={}}=e,l=vo(),c=Br()!=null,u=Wn(()=>new Zf({open:t,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Yc,floatingId:l,syncOnly:!1,nested:c})).current;return ze(()=>{const p={open:t,floatingId:l};o.reference!==void 0&&(p.referenceElement=o.reference,p.domReferenceElement=gt(o.reference)?o.reference:null),o.floating!==void 0&&(p.floatingElement=o.floating),u.update(p)},[t,l,o.reference,o.floating,u]),u.context.onOpenChange=s,u.context.nested=c,u}function w4(e={}){const{nodeId:t,externalTree:s}=e,o=y2(e),l=e.rootContext||o,c=l.useState("referenceElement"),u=l.useState("floatingElement"),p=l.useState("domReferenceElement"),m=l.useState("open"),h=l.useState("floatingId"),[g,b]=x.useState(null),[v,k]=x.useState(void 0),[E,y]=x.useState(void 0),j=x.useRef(null),C=Ur(s),S=x.useMemo(()=>({reference:c,floating:u,domReference:p}),[c,u,p]),N=ZO({...e,elements:{...S,...g&&{reference:g}}}),R=gt(v)?v:null,M=E===void 0?l.state.floatingElement:E;l.useSyncedValue("referenceElement",v??null),l.useSyncedValue("domReferenceElement",v===void 0?p:R),l.useSyncedValue("floatingElement",M);const T=x.useCallback(O=>{const P=gt(O)?{getBoundingClientRect:()=>O.getBoundingClientRect(),getClientRects:()=>O.getClientRects(),contextElement:O}:O;b(P),N.refs.setReference(P)},[N.refs]),z=x.useCallback(O=>{(gt(O)||O===null)&&(j.current=O,k(O)),(gt(N.refs.reference.current)||N.refs.reference.current===null||O!==null&&!gt(O))&&N.refs.setReference(O)},[N.refs,k]),D=x.useCallback(O=>{y(O),N.refs.setFloating(O)},[N.refs]),U=x.useMemo(()=>({...N.refs,setReference:z,setFloating:D,setPositionReference:T,domReference:j}),[N.refs,z,D,T]),L=x.useMemo(()=>({...N.elements,domReference:p}),[N.elements,p]),H=x.useMemo(()=>({...N,dataRef:l.context.dataRef,open:m,onOpenChange:l.setOpen,events:l.context.events,floatingId:h,refs:U,elements:L,nodeId:t,rootStore:l}),[N,U,L,t,l,m,h]);return ze(()=>{p&&(j.current=p)},[p]),ze(()=>{l.context.dataRef.current.floatingContext=H;const O=C?.nodesRef.current.find(P=>P.id===t);O&&(O.context=H)}),x.useMemo(()=>({...N,context:H,refs:U,elements:L,rootStore:l}),[N,U,L,H,l])}const Xh=tb&&Lr;function j2(e,t={}){const{enabled:s=!0,delay:o}=t,l="rootStore"in e?e.rootStore:e,{events:c,dataRef:u}=l.context,p=x.useRef(!1),m=x.useRef(null),h=x.useRef(!0),g=kn();x.useEffect(()=>{const v=l.select("domReferenceElement");if(!s)return;const k=Xt(v);function E(){const C=l.select("domReferenceElement");!l.select("open")&&qt(C)&&C===qn(ht(C))&&(p.current=!0)}function y(){h.current=!0}function j(){h.current=!1}return ia(xt(k,"blur",E),Xh&&xt(k,"keydown",y,!0),Xh&&xt(k,"pointerdown",j,!0))},[l,s]),x.useEffect(()=>{if(!s)return;function v(k){if(k.reason===ni||k.reason===Yf){const E=l.select("domReferenceElement");gt(E)&&(m.current=E,p.current=!0)}}return c.on("openchange",v),()=>{c.off("openchange",v)}},[c,s,l]);const b=x.useMemo(()=>{function v(){p.current=!1,m.current=null}return{onMouseLeave(){v()},onFocus(k){const E=k.currentTarget;if(p.current){if(m.current===E)return;v()}const y=Un(k.nativeEvent);if(gt(y)){if(Xh&&!k.relatedTarget){if(!h.current&&!Ff(y))return}else if(!c5(y))return}const j=ef(k.relatedTarget,l.context.triggerElements),{nativeEvent:C,currentTarget:S}=k,N=typeof o=="function"?o():o;if(l.select("open")&&j||N===0||N===void 0){l.setOpen(!0,nt(Tl,C,S));return}g.start(N,()=>{p.current||l.setOpen(!0,nt(Tl,C,S))})},onBlur(k){v();const E=k.relatedTarget,y=k.nativeEvent,j=gt(E)&&E.hasAttribute(Dc("focus-guard"))&&E.getAttribute("data-type")==="outside";g.start(0,()=>{const C=l.select("domReferenceElement"),S=qn(ht(C));!E&&S===C||Qe(u.current.floatingContext?.refs.floating.current,S)||Qe(C,S)||j||ef(E??S,l.context.triggerElements)||l.setOpen(!1,nt(Tl,y))})}}},[u,o,l,g]);return x.useMemo(()=>s?{reference:b,trigger:b}:{},[s,b])}class Mb{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 $s,this.restTimeout=new $s,this.handleCloseOptions=void 0}static create(){return new Mb}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const uf=new WeakMap;function df(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&uf.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),uf.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function w2(e,t){const{scopeElement:s,referenceElement:o,floatingElement:l}=t,c=uf.get(s);c&&c!==e&&df(c),df(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=s,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=l,uf.set(s,e),s.style.pointerEvents="none",o.style.pointerEvents="auto",l.style.pointerEvents="auto"}function Ob(e){const t=e.context.dataRef.current,s=Wn(()=>t.hoverInteractionState??Mb.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=s),eb(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function k2(e,t={}){const{enabled:s=!0,closeDelay:o=0,nodeId:l}=t,c="rootStore"in e?e.rootStore:e,u=c.useState("open"),p=c.useState("floatingElement"),m=c.useState("domReferenceElement"),{dataRef:h}=c.context,g=Ur(),b=Br(),v=Ob(c),k=kn(),E=Ue(()=>yS(h.current.openEvent?.type,v.interactedInside)),y=Ue(()=>d5(h.current.openEvent?.type)),j=Ue(()=>{df(v)});ze(()=>{u||(v.pointerType=void 0,v.restTimeoutPending=!1,v.interactedInside=!1,j())},[u,v,j]),x.useEffect(()=>j,[j]),ze(()=>{if(s&&u&&v.handleCloseOptions?.blockPointerEvents&&y()&&gt(m)&&p){const C=m,S=p,N=ht(p),R=g?.nodesRef.current.find(D=>D.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const M=v.pointerEventsScopeElement!==S?v.pointerEventsScopeElement:null,T=R!==S?R:null,z=v.handleCloseOptions?.getScope?.()??M??T??C.closest("[data-rootownerid]")??N.body;return w2(v,{scopeElement:z,referenceElement:C,floatingElement:S}),()=>{j()}}},[s,u,m,p,v,y,g,b,j]),x.useEffect(()=>{if(!s)return;function C(){return!!(g&&b&&zr(g.nodesRef.current,b).length>0)}function S(D){const U=Ul(o,"close",v.pointerType),L=()=>{c.setOpen(!1,nt(Tn,D)),g?.events.emit("floating.closed",D)};U?v.openChangeTimeout.start(U,L):(v.openChangeTimeout.clear(),L())}function N(D){const U=Un(D);if(!i5(U)){v.interactedInside=!1;return}v.interactedInside=U?.closest("[aria-haspopup]")!=null}function R(){v.openChangeTimeout.clear(),k.clear(),g?.events.off("floating.closed",T),j()}function M(D){if(C()&&g){g.events.on("floating.closed",T);return}if(ef(D.relatedTarget,c.context.triggerElements))return;const U=h.current.floatingContext?.nodeId??l,L=D.relatedTarget;if(!(g&&U&&gt(L)&&zr(g.nodesRef.current,U,!1).some(O=>Qe(O.context?.elements.floating,L)))){if(v.handler){v.handler(D);return}j(),y()&&!E()&&S(D)}}function T(D){!g||!b||C()||k.start(0,()=>{g.events.off("floating.closed",T),c.setOpen(!1,nt(Tn,D)),g.events.emit("floating.closed",D)})}const z=p;return ia(z&&xt(z,"mouseenter",R),z&&xt(z,"mouseleave",M),z&&xt(z,"pointerdown",N,!0),()=>{g?.events.off("floating.closed",T)})},[s,p,c,h,o,l,y,E,j,v,g,b,k])}const k4={current:null};function S2(e,t={}){const{enabled:s=!0,delay:o=0,handleClose:l=null,mouseOnly:c=!1,restMs:u=0,move:p=!0,triggerElementRef:m=k4,externalTree:h,isActiveTrigger:g=!0,getHandleCloseContext:b,isClosing:v,shouldOpen:k}=t,E="rootStore"in e?e.rootStore:e,{dataRef:y,events:j}=E.context,C=Ur(h),S=Ob(E),N=x.useRef(!1),R=dn(l),M=dn(o),T=dn(u),z=dn(s),D=dn(k),U=dn(v),L=Ue(()=>yS(y.current.openEvent?.type,S.interactedInside)),H=Ue(()=>D.current?.()!==!1),O=Ue(($,q,X)=>{const Y=E.context.triggerElements;if(Y.hasElement(q))return!$||!Qe($,q);if(!gt(X))return!1;const F=X;return Y.hasMatchingElement(K=>Qe(K,F))&&(!$||!Qe($,F))}),P=Ue(()=>{if(!S.handler)return;ht(E.select("domReferenceElement")).removeEventListener("mousemove",S.handler),S.handler=void 0}),B=Ue(()=>{df(S)});return g&&(S.handleCloseOptions=R.current?.__options),x.useEffect(()=>P,[P]),x.useEffect(()=>{if(!s)return;function $(q){q.open?N.current=!1:(N.current=q.reason===Tn,P(),S.openChangeTimeout.clear(),S.restTimeout.clear(),S.blockMouseMove=!0,S.restTimeoutPending=!1)}return j.on("openchange",$),()=>{j.off("openchange",$)}},[s,j,S,P]),x.useEffect(()=>{if(!s)return;function $(F,K=!0){const I=Ul(M.current,"close",S.pointerType);I?S.openChangeTimeout.start(I,()=>{E.setOpen(!1,nt(Tn,F)),C?.events.emit("floating.closed",F)}):K&&(S.openChangeTimeout.clear(),E.setOpen(!1,nt(Tn,F)),C?.events.emit("floating.closed",F))}const q=m.current??(g?E.select("domReferenceElement"):null);if(!gt(q))return;function X(F){if(S.openChangeTimeout.clear(),S.blockMouseMove=!1,c&&!bo(S.pointerType))return;const K=$1(T.current),I=Ul(M.current,"open",S.pointerType),G=Un(F),Z=F.currentTarget??null,te=E.select("domReferenceElement");let de=Z;if(gt(G)&&!E.context.triggerElements.hasElement(G)){for(const je of E.context.triggerElements.elements())if(Qe(je,G)){de=je;break}}gt(Z)&&gt(te)&&!E.context.triggerElements.hasElement(Z)&&Qe(Z,te)&&(de=te);const ee=de==null?!1:O(te,de,G),ne=E.select("open"),ae=U.current?.()??E.select("transitionStatus")==="ending",pe=!ne&&ae&&N.current,Me=!ee&&gt(de)&&gt(te)&&Qe(te,de)&&pe,ue=K>0&&!I,me=ee&&(ne||pe)||Me,ke=!ne||ee;if(me){H()&&E.setOpen(!0,nt(Tn,F,de));return}ue||(I?S.openChangeTimeout.start(I,()=>{ke&&H()&&E.setOpen(!0,nt(Tn,F,de))}):ke&&H()&&E.setOpen(!0,nt(Tn,F,de)))}function Y(F){if(L()){B();return}P();const K=E.select("domReferenceElement"),I=ht(K);S.restTimeout.clear(),S.restTimeoutPending=!1;const G=y.current.floatingContext??b?.();if(ef(F.relatedTarget,E.context.triggerElements))return;if(R.current&&G){E.select("open")||S.openChangeTimeout.clear();const te=m.current;S.handler=R.current({...G,tree:C,x:F.clientX,y:F.clientY,onClose(){B(),P(),z.current&&!L()&&te===E.select("domReferenceElement")&&$(F,!0)}}),I.addEventListener("mousemove",S.handler),S.handler(F);return}(S.pointerType==="touch"?!Qe(E.select("floatingElement"),F.relatedTarget):!0)&&$(F)}return p?ia(xt(q,"mousemove",X,{once:!0}),xt(q,"mouseenter",X),xt(q,"mouseleave",Y)):ia(xt(q,"mouseenter",X),xt(q,"mouseleave",Y))},[P,B,y,M,E,s,R,S,g,O,L,c,p,T,m,C,z,b,U,H]),x.useMemo(()=>{if(!s)return;function $(q){S.pointerType=q.pointerType}return{onPointerDown:$,onPointerEnter:$,onMouseMove(q){const{nativeEvent:X}=q,Y=q.currentTarget,F=E.select("domReferenceElement"),K=E.select("open"),I=O(F,Y,q.target);if(c&&!bo(S.pointerType))return;if(K&&I&&S.handleCloseOptions?.blockPointerEvents){const te=E.select("floatingElement");if(te){const de=S.handleCloseOptions?.getScope?.()??Y.ownerDocument.body;w2(S,{scopeElement:de,referenceElement:Y,floatingElement:te})}}const G=$1(T.current);if(K&&!I||G===0||!I&&S.restTimeoutPending&&q.movementX**2+q.movementY**2<2)return;S.restTimeout.clear();function Z(){if(S.restTimeoutPending=!1,L())return;const te=E.select("open");!S.blockMouseMove&&(!te||I)&&H()&&E.setOpen(!0,nt(Tn,X,Y))}S.pointerType==="touch"?Ps.flushSync(()=>{Z()}):I&&K?Z():(S.restTimeoutPending=!0,S.restTimeout.start(G,Z))}}},[s,S,L,O,c,E,T,H])}const S4="Escape";function ep(e,t,s){switch(e){case"vertical":return t;case"horizontal":return s;default:return t||s}}function bd(e,t){return ep(t,e===vS||e===lb,e===qf||e===$f)}function Qh(e,t,s){return ep(t,e===lb,s?e===qf:e===$f)||e==="Enter"||e===" "||e===""}function C4(e,t,s){return ep(t,s?e===qf:e===$f,e===lb)}function N4(e,t,s,o){const l=s?e===$f:e===qf,c=e===vS;return t==="both"||t==="horizontal"&&o?e===S4:ep(t,l,c)}function C2(e,t){const{listRef:s,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:u=null,allowEscape:p=!1,loopFocus:m=!1,nested:h=!1,rtl:g=!1,virtual:b=!1,focusItemOnOpen:v="auto",focusItemOnHover:k=!0,openOnArrowKeyDown:E=!0,disabledIndices:y=void 0,orientation:j="vertical",parentOrientation:C,id:S,resetOnPointerLeave:N=!0,externalTree:R,grid:M}=t,T=M!=null,z="rootStore"in e?e.rootStore:e,D=z.useState("open"),U=z.useState("floatingElement"),L=z.useState("domReferenceElement"),H=z.context.dataRef,O=tf(U),P=tx(L),B=dn(O),$=Br(),q=Ur(R),X=x.useRef(v),Y=x.useRef(u??-1),F=x.useRef(null),K=x.useRef(!0),I=Ue(le=>{l(Y.current===-1?null:Y.current,le)}),G=x.useRef(!!U),Z=x.useRef(D),te=x.useRef(!1),de=x.useRef(!1),ee=x.useRef(null),ne=dn(y),ae=dn(D),pe=dn(u),Me=dn(N),ue=Hl(),me=Hl(),ke=Ue(()=>{function le(Oe){b?q?.events.emit("virtualfocus",Oe):ee.current=Vd(Oe,{sync:te.current,preventScroll:!0})}const _e=s.current[Y.current],qe=de.current;_e&&le(_e),(te.current?Oe=>Oe():Oe=>ue.request(Oe))(()=>{const Oe=s.current[Y.current]||_e;if(!Oe)return;_e||le(Oe),ve&&(qe||!K.current)&&Oe.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ze(()=>{H.current.orientation=j},[H,j]),ze(()=>{c&&(D&&U?(Y.current=u??-1,X.current&&u!=null&&(de.current=!0,I())):G.current&&(Y.current=-1,I()))},[c,D,U,u,I]),ze(()=>{if(c){if(!D){te.current=!1;return}if(U)if(o==null){if(te.current=!1,pe.current!=null)return;if(G.current&&(Y.current=-1,ke()),(!Z.current||!G.current)&&X.current&&(F.current!=null||X.current===!0&&F.current==null)){let le=0;const _e=()=>{s.current[0]==null?(le<2&&(le?Ne=>me.request(Ne):queueMicrotask)(_e),le+=1):(Y.current=F.current==null||Qh(F.current,j,g)||h?Hd(s):rx(s),F.current=null,I())};_e()}}else yc(s.current,o)||(Y.current=o,ke(),de.current=!1)}},[c,D,U,o,pe,h,s,j,g,I,ke,me]),ze(()=>{if(!c||U||!q||b||!G.current)return;const le=q.nodesRef.current,_e=le.find(Oe=>Oe.id===$)?.context?.elements.floating,qe=qn(ht(L??_e??null)),Ne=le.some(Oe=>Oe.context&&Qe(Oe.context.elements.floating,qe));_e&&!Ne&&K.current&&_e.focus({preventScroll:!0})},[c,U,L,q,$,b]),ze(()=>{Z.current=D,G.current=!!U}),ze(()=>{D||(F.current=null,X.current=v)},[D,v]);const je=o!=null,Be=Ue(le=>{if(!ae.current)return;const _e=s.current.indexOf(le.currentTarget);_e!==-1&&(Y.current!==_e||o!==_e)&&(Y.current=_e,I(le))}),He=Ue(()=>C??q?.nodesRef.current.find(le=>le.id===$)?.context?.dataRef?.current.orientation),we=Ue(()=>Hd(s,ne.current)),Re=Ue(le=>{if(K.current=!1,te.current=!0,le.which===229||!ae.current&&le.currentTarget===B.current)return;if(h&&N4(le.key,j,g,T)){bd(le.key,He())||ta(le),z.setOpen(!1,nt(nx,le.nativeEvent)),qt(L)&&(b?q?.events.emit("virtualfocus",L):L.focus());return}const _e=Y.current,qe=Hd(s,y),Ne=rx(s,y);if(P||(le.key==="Home"&&(ta(le),Y.current=qe,I(le)),le.key==="End"&&(ta(le),Y.current=Ne,I(le))),M!=null){const Oe=M(le,Y.current,s,j,m,g,y,qe,Ne);if(Oe!=null&&(Y.current=Oe,I(le)),j==="both")return}if(bd(le.key,j)){if(ta(le),D&&!b&&qn(le.currentTarget.ownerDocument)===le.currentTarget){Y.current=Qh(le.key,j,g)?qe:Ne,I(le);return}Qh(le.key,j,g)?m?_e>=Ne?p&&_e!==s.current.length?Y.current=-1:(te.current=!1,Y.current=qe):Y.current=Va(s.current,{startingIndex:_e,disabledIndices:y}):Y.current=Math.min(Ne,Va(s.current,{startingIndex:_e,disabledIndices:y})):m?_e<=qe?p&&_e!==-1?Y.current=s.current.length:(te.current=!1,Y.current=Ne):Y.current=Va(s.current,{startingIndex:_e,decrement:!0,disabledIndices:y}):Y.current=Math.max(qe,Va(s.current,{startingIndex:_e,decrement:!0,disabledIndices:y})),yc(s.current,Y.current)&&(Y.current=-1),I(le)}}),ve=x.useMemo(()=>({onFocus(_e){te.current=!0,Be(_e)},onClick:({currentTarget:_e})=>_e.focus({preventScroll:!0}),onMouseMove(_e){te.current=!0,de.current=!1,k&&Be(_e)},onPointerLeave(_e){if(!ae.current||!K.current||_e.pointerType==="touch")return;te.current=!0;const qe=_e.relatedTarget;if(!(!k||s.current.includes(qe))&&Me.current&&(ee.current?.(),ee.current=null,Y.current=-1,I(_e),!b)){const Ne=B.current,Oe=qn(ht(Ne));Ne&&Qe(Ne,Oe)&&Ne.focus({preventScroll:!0})}}}),[Be,ae,B,k,s,I,Me,b]),Ce=x.useMemo(()=>b&&D&&je&&{"aria-activedescendant":`${S}-${o}`},[b,D,je,S,o]),De=x.useMemo(()=>({"aria-orientation":j==="both"?void 0:j,...P?{}:Ce,onKeyDown(le){if(le.key==="Tab"&&le.shiftKey&&D&&!b){const _e=Un(le.nativeEvent);if(_e&&!Qe(B.current,_e))return;ta(le),z.setOpen(!1,nt(_o,le.nativeEvent)),qt(L)&&L.focus();return}Re(le)},onPointerMove(){K.current=!0}}),[Ce,Re,B,j,P,z,D,b,L]),Pe=x.useMemo(()=>{function le(Ne){z.setOpen(!0,nt(nx,Ne.nativeEvent,Ne.currentTarget))}function _e(Ne){v==="auto"&&sb(Ne.nativeEvent)&&(X.current=!b)}function qe(Ne){X.current=v,v==="auto"&&xS(Ne.nativeEvent)&&(X.current=!0)}return{onKeyDown(Ne){const Oe=z.select("open");K.current=!1;const et=Ne.key.startsWith("Arrow"),at=C4(Ne.key,He(),g),vt=bd(Ne.key,j),Mt=(h?at:vt)||Ne.key==="Enter"||Ne.key.trim()==="";if(b&&Oe)return Re(Ne);if(!(!Oe&&!E&&et)){if(Mt){const lt=bd(Ne.key,He());F.current=h&&lt?null:Ne.key}if(h){at&&(ta(Ne),Oe?(Y.current=we(),I(Ne)):le(Ne));return}vt&&(pe.current!=null&&(Y.current=pe.current),ta(Ne),!Oe&&E?le(Ne):Re(Ne),Oe&&I(Ne))}},onFocus(Ne){z.select("open")&&!b&&(Y.current=-1,I(Ne))},onPointerDown:qe,onPointerEnter:qe,onMouseDown:_e,onClick:_e}},[Re,v,we,h,I,z,E,j,He,g,pe,b]),Ie=x.useMemo(()=>({...Ce,...Pe}),[Ce,Pe]);return x.useMemo(()=>c?{reference:Ie,floating:De,item:ve,trigger:Pe}:{},[c,Ie,De,Pe,ve])}function N2(e,t){const{listRef:s,elementsRef:o,activeIndex:l,onMatch:c,disabledIndices:u,onTyping:p,enabled:m=!0,resetMs:h=750,selectedIndex:g=null}=t,b="rootStore"in e?e.rootStore:e,v=b.useState("open"),k=kn(),E=x.useRef(""),y=x.useRef(g??l??-1),j=x.useRef(null),C=Ue(R=>{function M(B){const $=o?.current[B];return!$||Kf($)}function T(B){return M(B)?u==null||!af(Ya,B,u):!1}function z(B,$,q=0){if(B.length===0)return-1;const X=(q%B.length+B.length)%B.length,Y=$.toLowerCase();for(let F=0;F<B.length;F+=1){const K=(X+F)%B.length;if(!(!B[K]?.toLowerCase().startsWith(Y)||!T(K)))return K}return-1}const D=s.current;if(E.current.length>0&&R.key===" "&&(ta(R),p?.(!0)),E.current.length>0&&E.current[0]!==" "&&z(D,E.current)===-1&&R.key!==" "&&p?.(!1),D==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;v&&R.key!==" "&&(ta(R),p?.(!0));const U=E.current==="";U&&(y.current=g??l??-1),D.every((B,$)=>B&&T($)?B[0]?.toLowerCase()!==B[1]?.toLowerCase():!0)&&E.current===R.key&&(E.current="",y.current=j.current),E.current+=R.key,k.start(h,()=>{E.current="",y.current=j.current,p?.(!1)});const O=((U?g??l??-1:y.current)??0)+1,P=z(D,E.current,O);P!==-1?(c?.(P),j.current=P):R.key!==" "&&(E.current="",p?.(!1))}),S=Ue(R=>{const M=R.relatedTarget,T=b.select("domReferenceElement"),z=b.select("floatingElement");Qe(T,M)||Qe(z,M)||(k.clear(),E.current="",y.current=j.current,p?.(!1))});ze(()=>{!v&&g!==null||(k.clear(),j.current=null,E.current!==""&&(E.current=""))},[v,g,k]),ze(()=>{v&&E.current===""&&(y.current=g??l??-1)},[v,g,l]);const N=x.useMemo(()=>({onKeyDown:C,onBlur:S}),[C,S]);return x.useMemo(()=>m?{reference:N,floating:N}:{},[m,N])}const wj=.1,E4=wj*wj,Ht=.5;function _d(e,t,s,o,l,c){return o>=t!=c>=t&&e<=(l-s)*(t-o)/(c-o)+s}function vd(e,t,s,o,l,c,u,p,m,h){let g=!1;return _d(e,t,s,o,l,c)&&(g=!g),_d(e,t,l,c,u,p)&&(g=!g),_d(e,t,u,p,m,h)&&(g=!g),_d(e,t,m,h,s,o)&&(g=!g),g}function R4(e,t,s){return e>=s.x&&e<=s.x+s.width&&t>=s.y&&t<=s.y+s.height}function yd(e,t,s,o,l,c){const u=Math.min(s,l),p=Math.max(s,l),m=Math.min(o,c),h=Math.max(o,c);return e>=u&&e<=p&&t>=m&&t<=h}function E2(e={}){const{blockPointerEvents:t=!1}=e,s=new $s,o=({x:l,y:c,placement:u,elements:p,onClose:m,nodeId:h,tree:g})=>{const b=u?.split("-")[0];let v=!1,k=null,E=null,y=typeof performance<"u"?performance.now():0;function j(S,N){const R=performance.now(),M=R-y;if(k===null||E===null||M===0)return k=S,E=N,y=R,!1;const T=S-k,z=N-E,D=T*T+z*z,U=M*M*E4;return k=S,E=N,y=R,D<U}function C(){s.clear(),m()}return function(N){s.clear();const R=p.domReference,M=p.floating;if(!R||!M||b==null||l==null||c==null)return;const{clientX:T,clientY:z}=N,D=Un(N),U=N.type==="mouseleave",L=Qe(M,D),H=Qe(R,D);if(L&&(v=!0,!U))return;if(H&&(v=!1,!U)){v=!0;return}if(U&&gt(N.relatedTarget)&&Qe(M,N.relatedTarget))return;function O(){return!!(g&&zr(g.nodesRef.current,h).length>0)}function P(){O()||C()}if(O())return;const B=R.getBoundingClientRect(),$=M.getBoundingClientRect(),q=l>$.right-$.width/2,X=c>$.bottom-$.height/2,Y=$.width>B.width,F=$.height>B.height,K=(Y?B:$).left,I=(Y?B:$).right,G=(F?B:$).top,Z=(F?B:$).bottom;if(b==="top"&&c>=B.bottom-1||b==="bottom"&&c<=B.top+1||b==="left"&&l>=B.right-1||b==="right"&&l<=B.left+1){P();return}let te=!1;switch(b){case"top":te=yd(T,z,K,B.top+1,I,$.bottom-1);break;case"bottom":te=yd(T,z,K,$.top+1,I,B.bottom-1);break;case"left":te=yd(T,z,$.right-1,Z,B.left+1,G);break;case"right":te=yd(T,z,B.right-1,Z,$.left+1,G);break}if(te)return;if(v&&!R4(T,z,B)){P();return}if(!U&&j(T,z)){P();return}let de=!1;switch(b){case"top":{const ee=Y?Ht/2:Ht*4,ne=Y||q?l+ee:l-ee,ae=Y?l-ee:q?l+ee:l-ee,pe=c+Ht+1,Me=q||Y?$.bottom-Ht:$.top,ue=q?Y?$.bottom-Ht:$.top:$.bottom-Ht;de=vd(T,z,ne,pe,ae,pe,$.left,Me,$.right,ue);break}case"bottom":{const ee=Y?Ht/2:Ht*4,ne=Y||q?l+ee:l-ee,ae=Y?l-ee:q?l+ee:l-ee,pe=c-Ht,Me=q||Y?$.top+Ht:$.bottom,ue=q?Y?$.top+Ht:$.bottom:$.top+Ht;de=vd(T,z,ne,pe,ae,pe,$.left,Me,$.right,ue);break}case"left":{const ee=F?Ht/2:Ht*4,ne=F||X?c+ee:c-ee,ae=F?c-ee:X?c+ee:c-ee,pe=l+Ht+1,Me=X||F?$.right-Ht:$.left,ue=X?F?$.right-Ht:$.left:$.right-Ht;de=vd(T,z,Me,$.top,ue,$.bottom,pe,ne,pe,ae);break}case"right":{const ee=F?Ht/2:Ht*4,ne=F||X?c+ee:c-ee,ae=F?c-ee:X?c+ee:c-ee,pe=l-Ht,Me=X||F?$.left+Ht:$.right,ue=X?F?$.left+Ht:$.right:$.left+Ht;de=vd(T,z,pe,ne,pe,ae,Me,$.top,ue,$.bottom);break}}de?v||s.start(40,P):P()}};return o.__options={...e,blockPointerEvents:t},o}const T4={...Ab,disabled:Ae(e=>e.disabled),instantType:Ae(e=>e.instantType),isInstantPhase:Ae(e=>e.isInstantPhase),trackCursorAxis:Ae(e=>e.trackCursorAxis),disableHoverablePopup:Ae(e=>e.disableHoverablePopup),lastOpenChangeReason:Ae(e=>e.openChangeReason),closeOnClick:Ae(e=>e.closeOnClick),closeDelay:Ae(e=>e.closeDelay),hasViewport:Ae(e=>e.hasViewport)};class zb extends Wf{constructor(t,s,o=!1){const l=new Yc,c={...A4(),...t};c.floatingRootContext=_2(l,s,o),super(c,{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:l},T4)}setOpen=(t,s)=>{_4(this,t,s,{extraState:{openChangeReason:s.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,nt(ni,t))}static useStore(t,s){return h2(t,(l,c)=>new zb(s,l,c)).store}}function A4(){return{...Rb(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const M4=Jx(function(t){const{disabled:s=!1,defaultOpen:o=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:u="none",actionsRef:p,onOpenChange:m,onOpenChangeComplete:h,handle:g,triggerId:b,defaultTriggerId:v=null,children:k}=t,E=zb.useStore(g?.store,{open:o,openProp:l,activeTriggerId:v,triggerIdProp:b});x2(E,l,o,v),E.useControlledProp("openProp",l),E.useControlledProp("triggerIdProp",b),E.useContextCallback("onOpenChange",m),E.useContextCallback("onOpenChangeComplete",h);const y=E.useState("open"),j=!s&&y,C=E.useState("activeTriggerId"),S=E.useState("mounted"),N=E.useState("payload");E.useSyncedValues({trackCursorAxis:u,disableHoverablePopup:c}),E.useSyncedValue("disabled",s),Cb(E,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:M}=Nb(j,E),T=E.useState("isInstantPhase"),z=E.useState("instantType"),D=E.useState("lastOpenChangeReason"),U=x.useRef(null);ze(()=>{y&&s&&E.setOpen(!1,nt(wS))},[y,s,E]),ze(()=>{M==="ending"&&D===fa||M!=="ending"&&T?(z!=="delay"&&(U.current=z),E.set("instantType","delay")):U.current!==null&&(E.set("instantType",U.current),U.current=null)},[M,T,D,z,E]),ze(()=>{j&&C==null&&E.set("payload",void 0)},[E,C,j]);const L=x.useCallback(()=>{E.setOpen(!1,nt(ib))},[E]);x.useImperativeHandle(p,()=>({unmount:R,close:L}),[R,L]);const H=j||S||!s&&u!=="none";return r.jsxs(gS.Provider,{value:E,children:[H&&r.jsx(O4,{store:E,disabled:s,trackCursorAxis:u}),typeof k=="function"?k({payload:N}):k]})});function O4({store:e,disabled:t,trackCursorAxis:s}){const o=e.useState("floatingRootContext"),l=Xf(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=gO(o,{enabled:!t&&s!=="none",axis:s==="none"?void 0:s}),u=x.useMemo(()=>Fn(c.reference,l.reference),[c.reference,l.reference]),p=x.useMemo(()=>Fn(c.trigger,l.trigger),[c.trigger,l.trigger]),m=x.useMemo(()=>Fn(Jf,c.floating,l.floating),[c.floating,l.floating]);return Eb(e,{activeTriggerProps:u,inactiveTriggerProps:p,popupProps:m}),null}let mo=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=jo.startingStyle]="startingStyle",e[e.endingStyle=jo.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),ff=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const z4={[ff.popupOpen]:""},D4={[ff.popupOpen]:"",[ff.pressed]:""},L4={[mo.open]:""},P4={[mo.closed]:""},I4={[mo.anchorHidden]:""},R2={open(e){return e?z4:null}},cx={open(e){return e?D4:null}},Ao={open(e){return e?L4:P4},anchorHidden(e){return e?I4:null}};function Ks(e){return vo(e,"base-ui")}const T2=x.createContext(void 0);function B4(){return x.useContext(T2)}let U4=(function(e){return e[e.popupOpen=ff.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const H4=600,A2="data-base-ui-tooltip-trigger";function kj(e){if("composedPath"in e){const s=e.composedPath();for(let o=0;o<s.length;o+=1){const l=s[o];if(gt(l))return l}}const t=e.target;return gt(t)?t:null}function V4(e){let t=e;for(;t;){if(t.hasAttribute(A2))return t;const s=t.parentElement;if(s){t=s;continue}const o=t.getRootNode();t="host"in o&&gt(o.host)?o.host:null}return null}const q4=hS(function(t,s){const{render:o,className:l,style:c,handle:u,payload:p,disabled:m,delay:h,closeOnClick:g=!0,closeDelay:b,id:v,...k}=t,E=Fc(!0),y=u?.store??E;if(!y)throw new Error(rn(82));const j=Ks(v),C=y.useState("isTriggerActive",j),S=y.useState("isOpenedByTrigger",j),N=y.useState("floatingRootContext"),R=x.useRef(null),M=h??H4,T=b??0,{registerTrigger:z,isMountedByThisTrigger:D}=b2(j,R,y,{payload:p,closeOnClick:g,closeDelay:T}),U=B4(),{delayRef:L,isInstantPhase:H,hasProvider:O}=g5(N,{open:S}),P=Ob(N);y.useSyncedValue("isInstantPhase",H);const B=y.useState("disabled"),$=m??B,q=dn($),X=y.useState("trackCursorAxis"),Y=y.useState("disableHoverablePopup"),F=x.useRef(!1),K=kn(),I=x.useRef(void 0);function G(){const me=U?.delay,ke=typeof L.current=="object"?L.current.open:void 0;let je=M;return O&&(ke!==0?je=h??me??M:je=0),je}function Z(me){const ke=R.current;if(!ke||!me)return!1;const je=V4(me);return je!==null&&je!==ke&&Qe(ke,je)}function te(me){const ke=Z(me);return F.current=ke,ke&&(P.openChangeTimeout.clear(),P.restTimeout.clear(),P.restTimeoutPending=!1,K.clear()),ke}const de=S2(N,{enabled:!$,mouseOnly:!0,move:!1,handleClose:!Y&&X!=="both"?E2():null,restMs:G,delay(){const me=typeof L.current=="object"?L.current.close:void 0;let ke=T;return b==null&&O&&(ke=me),{close:ke}},triggerElementRef:R,isActiveTrigger:C,isClosing:()=>y.select("transitionStatus")==="ending",shouldOpen(){return!F.current}}),ee=j2(N,{enabled:!$}).reference,ne=me=>{const ke=F.current,je=kj(me),Be=te(je),He=R.current,we=He&&je&&Qe(He,je);if(Be&&y.select("open")&&y.select("lastOpenChangeReason")===Tn){y.setOpen(!1,nt(Tn,me));return}if(ke&&!Be&&we&&!q.current&&!y.select("open")&&He&&bo(I.current)){const Re=()=>{!F.current&&!q.current&&!y.select("open")&&y.setOpen(!0,nt(Tn,me,He))},ve=G();ve===0?(K.clear(),Re()):K.start(ve,Re)}},ae=y.useState("triggerProps",D);return Et("button",t,{state:{open:S},ref:[s,z,R],props:[de,ee,D||X!=="none"?ae:void 0,{onMouseOver(me){ne(me.nativeEvent)},onFocus(me){Z(kj(me.nativeEvent))&&me.preventBaseUIHandler()},onMouseLeave(){F.current=!1,K.clear(),I.current=void 0},onPointerEnter(me){I.current=me.pointerType},onPointerDown(me){I.current=me.pointerType,y.set("closeOnClick",g),g&&!y.select("open")&&y.cancelPendingOpen(me.nativeEvent)},onClick(me){g&&!y.select("open")&&y.cancelPendingOpen(me.nativeEvent)},id:j,[U4.triggerDisabled]:$?"":void 0,[A2]:$?void 0:""},k],stateAttributesMapping:R2})}),M2=x.createContext(void 0);function $4(){const e=x.useContext(M2);if(e===void 0)throw new Error(rn(70));return e}const F4=x.forwardRef(function(t,s){const{children:o,container:l,className:c,render:u,style:p,...m}=t,{portalNode:h,portalSubtree:g}=QS({container:l,ref:s,componentProps:t,elementProps:m});return!g&&!h?null:r.jsxs(x.Fragment,{children:[g,h&&Ps.createPortal(o,h)]})}),G4=x.forwardRef(function(t,s){const{keepMounted:o=!1,...l}=t;return Fc().useState("mounted")||o?r.jsx(M2.Provider,{value:o,children:r.jsx(F4,{ref:s,...l})}):null}),O2=x.createContext(void 0);function z2(){const e=x.useContext(O2);if(e===void 0)throw new Error(rn(71));return e}const Y4=x.createContext(void 0);function tp(){return x.useContext(Y4)?.direction??"ltr"}const K4=e=>({name:"arrow",options:e,async fn(t){const{x:s,y:o,placement:l,rects:c,platform:u,elements:p,middlewareData:m}=t,{element:h,padding:g=0,offsetParent:b="real"}=Xa(e,t)||{};if(h==null)return{};const v=RS(g),k={x:s,y:o},E=pb(l),y=fb(E),j=await u.getDimensions(h),C=E==="y",S=C?"top":"left",N=C?"bottom":"right",R=C?"clientHeight":"clientWidth",M=c.reference[y]+c.reference[E]-k[E]-c.floating[y],T=k[E]-c.reference[E],z=b==="real"?await u.getOffsetParent?.(h):p.floating;let D=p.floating[R]||c.floating[y];(!D||!await u.isElement?.(z))&&(D=p.floating[R]||c.floating[y]);const U=M/2-T/2,L=D/2-j[y]/2-1,H=Math.min(v[S],L),O=Math.min(v[N],L),P=H,B=D-j[y]-O,$=D/2-j[y]/2+U,q=sx(P,$,B),X=!m.arrow&&Ir(l)!=null&&$!==q&&c.reference[y]/2-($<P?H:O)-j[y]/2<0,Y=X?$<P?$-P:$-B:0;return{[E]:k[E]+Y,data:{[E]:q,centerOffset:$-q-Y,...X&&{alignmentOffset:Y}},reset:X}}}),X4=(e,t)=>({...K4(e),options:[e,t]}),Q4=a4().fn,W4={name:"hide",async fn(e){const{width:t,height:s,x:o,y:l}=e.rects.reference,c=t===0&&s===0&&o===0&&l===0;return{data:{referenceHidden:(await Q4(e)).data?.referenceHidden||c}}}},$d={sideX:"left",sideY:"top"},D2={name:"adaptiveOrigin",async fn(e){const{x:t,y:s,rects:{floating:o},elements:{floating:l},platform:c,strategy:u,placement:p}=e,m=Xt(l),h=m.getComputedStyle(l);if(!(h.transitionDuration!=="0s"&&h.transitionDuration!==""))return{x:t,y:s,data:$d};const b=await c.getOffsetParent?.(l);let v={width:0,height:0};if(u==="fixed"&&m?.visualViewport)v={width:m.visualViewport.width,height:m.visualViewport.height};else if(b===m){const S=ht(l);v={width:S.documentElement.clientWidth,height:S.documentElement.clientHeight}}else await c.isElement?.(b)&&(v=await c.getDimensions(b));const k=cs(p);let E=t,y=s;k==="left"&&(E=v.width-(t+o.width)),k==="top"&&(y=v.height-(s+o.height));const j=k==="left"?"right":$d.sideX,C=k==="top"?"bottom":$d.sideY;return{x:E,y,data:{sideX:j,sideY:C}}}};function L2(e,t,s){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?s?"inline-start":"inline-end":"right",bottom:"bottom",left:o?s?"inline-end":"inline-start":"left"}[t]}function Sj(e,t,s){const{rects:o,placement:l}=e;return{side:L2(t,cs(l),s),align:Ir(l)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function Db(e){const{anchor:t,positionMethod:s="absolute",side:o="bottom",sideOffset:l=0,align:c="center",alignOffset:u=0,collisionBoundary:p,collisionPadding:m=5,sticky:h=!1,arrowPadding:g=5,disableAnchorTracking:b=!1,inline:v,keepMounted:k=!1,floatingRootContext:E,mounted:y,collisionAvoidance:j,shiftCrossAxis:C=!1,nodeId:S,adaptiveOrigin:N,lazyFlip:R=!1,externalTree:M}=e,[T,z]=x.useState(null);!y&&T!==null&&z(null);const D=j.side||"flip",U=j.align||"flip",L=j.fallbackAxisSide||"end",H=typeof t=="function"?t:void 0,O=Ue(H),P=H?O:t,B=dn(t),$=dn(y),X=tp()==="rtl",Y=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":X?"left":"right","inline-start":X?"right":"left"}[o],F=c==="center"?Y:`${Y}-${c}`;let K=m;const I=1,G=o==="bottom"?I:0,Z=o==="top"?I:0,te=o==="right"?I:0,de=o==="left"?I:0;typeof K=="number"?K={top:K+G,right:K+de,bottom:K+Z,left:K+te}:K&&(K={top:(K.top||0)+G,right:(K.right||0)+de,bottom:(K.bottom||0)+Z,left:(K.left||0)+te});const ee={boundary:p==="clipping-ancestors"?"clippingAncestors":p,padding:K},ne=x.useRef(null),ae=dn(l),pe=dn(u),Me=typeof l!="function"?l:0,ue=typeof u!="function"?u:0,me=[];v&&me.push(v),me.push(JO(Xe=>{const ft=Sj(Xe,o,X),Ot=typeof ae.current=="function"?ae.current(ft):ae.current,Wt=typeof pe.current=="function"?pe.current(ft):pe.current;return{mainAxis:Ot,crossAxis:Wt,alignmentAxis:Wt}},[Me,ue,X,o]));const ke=U==="none"&&D!=="shift",je=!ke&&(h||C||D==="shift"),Be=D==="none"?null:n4({...ee,padding:{top:K.top+I,right:K.right+I,bottom:K.bottom+I,left:K.left+I},mainAxis:!C&&D==="flip",crossAxis:U==="flip"?"alignment":!1,fallbackAxisSideDirection:L}),He=ke?null:e4(Xe=>{const ft=ht(Xe.elements.floating).documentElement;return{...ee,rootBoundary:C?{x:0,y:0,width:ft.clientWidth,height:ft.clientHeight}:void 0,mainAxis:U!=="none",crossAxis:je,limiter:h||C?void 0:t4(Ot=>{if(!ne.current)return{};const{width:Wt,height:Yt}=ne.current.getBoundingClientRect(),Zt=zs(cs(Ot.placement)),fn=Zt==="y"?Wt:Yt,es=Zt==="y"?K.left+K.right:K.top+K.bottom;return{offset:fn/2+es/2}})}},[ee,h,C,K,U]);D==="shift"||U==="shift"||c==="center"?me.push(He,Be):me.push(Be,He),me.push(s4({...ee,apply({elements:{floating:Xe},availableWidth:ft,availableHeight:Ot,rects:Wt}){if(!$.current)return;const Yt=Xe.style;Yt.setProperty("--available-width",`${ft}px`),Yt.setProperty("--available-height",`${Ot}px`);const Zt=Xt(Xe).devicePixelRatio||1,{x:fn,y:es,width:fs,height:js}=Wt.reference,pn=(Math.round((fn+fs)*Zt)-Math.round(fn*Zt))/Zt,ws=(Math.round((es+js)*Zt)-Math.round(es*Zt))/Zt;Yt.setProperty("--anchor-width",`${pn}px`),Yt.setProperty("--anchor-height",`${ws}px`)}}),X4(Xe=>({element:ne.current||ht(Xe.elements.floating).createElement("div"),padding:g,offsetParent:"floating"}),[g]),{name:"transformOrigin",fn(Xe){const{elements:ft,middlewareData:Ot,placement:Wt,rects:Yt,y:Zt}=Xe,fn=cs(Wt),es=zs(fn),fs=ne.current,js=Ot.arrow?.x||0,pn=Ot.arrow?.y||0,ws=fs?.clientWidth||0,xa=fs?.clientHeight||0,Is=js+ws/2,ba=pn+xa/2,ut=Math.abs(Ot.shift?.y||0),Pt=Yt.reference.height/2,mn=typeof l=="function"?l(Sj(Xe,o,X)):l,Cn=ut>mn,yn={top:`${Is}px calc(100% + ${mn}px)`,bottom:`${Is}px ${-mn}px`,left:`calc(100% + ${mn}px) ${ba}px`,right:`${-mn}px ${ba}px`}[fn],$t=`${Is}px ${Yt.reference.y+Pt-Zt}px`;return ft.floating.style.setProperty("--transform-origin",je&&es==="y"&&Cn?$t:yn),{}}},W4,N),ze(()=>{!y&&E&&E.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,E]);const we=x.useMemo(()=>({elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:Re,elements:ve,x:Ce,y:De,middlewareData:Pe,update:Ie,placement:le,context:_e,isPositioned:qe,floatingStyles:Ne}=w4({rootContext:E,open:k?y:void 0,placement:F,middleware:me,strategy:s,whileElementsMounted:k?void 0:(...Xe)=>gj(...Xe,we),nodeId:S,externalTree:M}),{sideX:Oe,sideY:et}=Pe.adaptiveOrigin||$d,at=qe?s:"fixed",vt=x.useMemo(()=>{const Xe=N?{position:at,[Oe]:Ce,[et]:De}:{position:at,...Ne};return qe||(Xe.opacity=0),Xe},[N,at,Oe,Ce,et,De,Ne,qe]),Mt=x.useRef(null);ze(()=>{if(!y)return;const Xe=B.current,ft=typeof Xe=="function"?Xe():Xe,Wt=(Cj(ft)?ft.current:ft)||null||null;Wt!==Mt.current&&(Re.setPositionReference(Wt),Mt.current=Wt)},[y,Re,P,B]),x.useEffect(()=>{if(!y)return;const Xe=B.current;typeof Xe!="function"&&Cj(Xe)&&Xe.current!==Mt.current&&(Re.setPositionReference(Xe.current),Mt.current=Xe.current)},[y,Re,P,B]),x.useEffect(()=>{if(k&&y&&ve.reference&&ve.floating)return gj(ve.reference,ve.floating,Ie,we)},[k,y,ve,Ie,we]);const lt=cs(le),Rt=L2(o,lt,X),xe=Ir(le)||"center",Le=!!Pe.hide?.referenceHidden;ze(()=>{R&&y&&qe&&z(lt)},[R,y,qe,lt]);const Ke=x.useMemo(()=>({position:"absolute",top:Pe.arrow?.y,left:Pe.arrow?.x}),[Pe.arrow]),it=Pe.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:vt,arrowStyles:Ke,arrowRef:ne,arrowUncentered:it,side:Rt,align:xe,physicalSide:lt,anchorHidden:Le,refs:Re,context:_e,isPositioned:qe,update:Ie}),[vt,Ke,ne,it,Rt,xe,lt,Le,Re,_e,qe,Ie])}function Cj(e){return e!=null&&"current"in e}function np(e){return e==="starting"?lO:Gt}function Lb(e,t,{styles:s,transitionStatus:o,props:l,refs:c,hidden:u,inert:p=!1}){const m={...s};return p&&(m.pointerEvents="none"),Et("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:u,style:m},np(o),l],stateAttributesMapping:Ao})}const Z4=x.forwardRef(function(t,s){const{render:o,className:l,anchor:c,positionMethod:u="absolute",side:p="top",align:m="center",sideOffset:h=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v=5,arrowPadding:k=5,sticky:E=!1,disableAnchorTracking:y=!1,collisionAvoidance:j=YS,style:C,...S}=t,N=Fc(),R=$4(),M=N.useState("open"),T=N.useState("mounted"),z=N.useState("trackCursorAxis"),D=N.useState("disableHoverablePopup"),U=N.useState("floatingRootContext"),L=N.useState("instantType"),H=N.useState("transitionStatus"),O=N.useState("hasViewport"),P=Db({anchor:c,positionMethod:u,floatingRootContext:U,mounted:T,side:p,sideOffset:h,align:m,alignOffset:g,collisionBoundary:b,collisionPadding:v,sticky:E,arrowPadding:k,disableAnchorTracking:y,keepMounted:R,collisionAvoidance:j,adaptiveOrigin:O?D2:void 0}),B=x.useMemo(()=>({open:M,side:P.side,align:P.align,anchorHidden:P.anchorHidden,instant:z!=="none"?"tracking-cursor":L}),[M,P.side,P.align,P.anchorHidden,z,L]),$=Lb(t,B,{styles:P.positionerStyles,transitionStatus:H,props:S,refs:[s,N.useStateSetter("positionerElement")],hidden:!T,inert:!M||z==="both"||D});return r.jsx(O2.Provider,{value:P,children:$})}),J4={...Ao,...Ja},ez=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,p=Fc(),{side:m,align:h}=z2(),g=p.useState("open"),b=p.useState("instantType"),v=p.useState("transitionStatus"),k=p.useState("popupProps"),E=p.useState("floatingRootContext"),y=p.useState("disabled"),j=p.useState("closeDelay");ha({open:g,ref:p.context.popupRef,onComplete(){g&&p.context.onOpenChangeComplete?.(!0)}}),k2(E,{enabled:!y,closeDelay:j});const C=p.useStateSetter("popupElement");return Et("div",t,{state:{open:g,side:m,align:h,instant:b,transitionStatus:v},ref:[s,p.context.popupRef,C],props:[k,np(v),u],stateAttributesMapping:J4})}),tz=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,p=Fc(),{arrowRef:m,side:h,align:g,arrowUncentered:b,arrowStyles:v}=z2(),k=p.useState("open"),E=p.useState("instantType");return Et("div",t,{state:{open:k,side:h,align:g,uncentered:b,instant:E},ref:[s,m],props:[{style:v,"aria-hidden":!0},u],stateAttributesMapping:Ao})}),nz=function(t){const{delay:s,closeDelay:o,timeout:l=400}=t,c=x.useMemo(()=>({delay:s,closeDelay:o}),[s,o]),u=x.useMemo(()=>({open:s,close:o}),[s,o]);return r.jsx(T2.Provider,{value:c,children:r.jsx(h5,{delay:u,timeoutMs:l,children:t.children})})};function sp(e){return gb(19)?e:e?"true":void 0}function sz(e){const[t,s]=x.useState({current:e,previous:null});return e!==t.current&&s({current:e,previous:t.current}),t.previous}function Ct(...e){return mS(Ac(e))}function az({delay:e=0,...t}){return r.jsx(nz,{"data-slot":"tooltip-provider",delay:e,...t})}function Pb({...e}){return r.jsx(M4,{"data-slot":"tooltip",...e})}function Ib({...e}){return r.jsx(q4,{"data-slot":"tooltip-trigger",...e})}function Bb({className:e,side:t="top",sideOffset:s=4,align:o="center",alignOffset:l=0,children:c,...u}){return r.jsx(G4,{children:r.jsx(Z4,{align:o,alignOffset:l,side:t,sideOffset:s,className:"isolate z-50",children:r.jsxs(ez,{"data-slot":"tooltip-content",className:Ct("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...u,children:[c,r.jsx(tz,{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 vl({label:e,active:t,onClick:s,isAdd:o,isSettings:l,isDefault:c,icon:u,title:p,testId:m}){const h=e.trim()||"·",{initials:g,subLabel:b}=P2(h),v=o||l?"indigo":I2(h),k=b&&!o&&!l&&!c;return r.jsxs(Pb,{children:[r.jsx(Ib,{render:r.jsxs("button",{type:"button",onClick:s,"data-testid":m,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[r.jsx("span",{className:Te("flex size-10 items-center justify-center rounded-xl text-sm font-bold transition-all",t&&"ring-2 ring-foreground ring-offset-2 ring-offset-card",o&&"border border-dashed border-muted-fg/50 bg-transparent text-muted-fg hover:bg-accent/60 hover:text-foreground",l&&"bg-muted text-muted-fg hover:bg-accent hover:text-foreground",c&&"overflow-hidden bg-muted",!o&&!l&&!c&&t&&iz(v),!o&&!l&&!c&&!t&&lz(v)),children:u??g}),k&&r.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:b})]})}),r.jsx(Bb,{side:"right",children:p||e})]})}function P2(e){const t=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!t)return{initials:"·",subLabel:null};const s=t.split(" ");if(s.length>=2)return{initials:(s[0][0]+s[1][0]).toUpperCase(),subLabel:rz(t)};const o=s[0];return o.length<=4?{initials:o[0].toUpperCase(),subLabel:o}:{initials:o[0].toUpperCase(),subLabel:o.slice(0,4)+"…"}}function rz(e){return e.length>6?e.slice(0,5)+"…":e}function I2(e){let t=0;for(let s=0;s<e.length;s++)t=t*31+e.charCodeAt(s)|0;return I1[Math.abs(t)%I1.length]}const B2={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"},oz={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 lz(e){return B2[e]}function iz(e){return oz[e]}function cz(e){const{initials:t}=P2(e);return{initials:t,idleClass:B2[I2(e)]}}function Ge({content:e,side:t="top",children:s}){return e?r.jsxs(Pb,{children:[r.jsx(Ib,{render:s}),r.jsx(Bb,{side:t,children:e})]}):s}const U2=x.createContext(void 0);function Ub(e){const t=x.useContext(U2);if(t===void 0&&!e)throw new Error(rn(33));return t}const H2=x.createContext(void 0);function Hr(e){const t=x.useContext(H2);if(t===void 0&&!e)throw new Error(rn(36));return t}const uz=x.createContext(void 0);function ap(e=!0){const t=x.useContext(uz);if(t===void 0&&!e)throw new Error(rn(25));return t}function $l({controlled:e,default:t,name:s,state:o="value"}){const{current:l}=x.useRef(e!==void 0),[c,u]=x.useState(t),p=l?e:c,m=x.useCallback(h=>{l||u(h)},[]);return[p,m]}const V2=x.createContext(void 0);function Hb(e=!1){const t=x.useContext(V2);if(t===void 0&&!e)throw new Error(rn(16));return t}function dz(e){const{focusableWhenDisabled:t,disabled:s,composite:o=!1,tabIndex:l=0,isNativeButton:c}=e,u=o&&t!==!1,p=o&&t===!1;return{props:x.useMemo(()=>{const h={onKeyDown(g){s&&t&&g.key!=="Tab"&&g.preventDefault()}};return o||(h.tabIndex=l,!c&&s&&(h.tabIndex=t?l:-1)),(c&&(t||u)||!c&&s)&&(h["aria-disabled"]=s),c&&(!t||p)&&(h.disabled=s),h},[o,s,t,u,p,c,l])}}function Vr(e={}){const{disabled:t=!1,focusableWhenDisabled:s,tabIndex:o=0,native:l=!0,composite:c}=e,u=x.useRef(null),p=Hb(!0),m=c??p!==void 0,{props:h}=dz({focusableWhenDisabled:s,disabled:t,composite:m,tabIndex:o,isNativeButton:l}),g=x.useCallback(()=>{const k=u.current;Wh(k)&&m&&t&&h.disabled===void 0&&k.disabled&&(k.disabled=!1)},[t,h.disabled,m]);ze(g,[g]);const b=x.useCallback((k={})=>{const{onClick:E,onMouseDown:y,onKeyUp:j,onKeyDown:C,onPointerDown:S,...N}=k;return Fn({onClick(R){if(t){R.preventDefault();return}E?.(R)},onMouseDown(R){t||y?.(R)},onKeyDown(R){if(t||(of(R),C?.(R),R.baseUIHandlerPrevented))return;const M=R.target===R.currentTarget,T=R.currentTarget,z=Wh(T),D=!l&&fz(T),U=M&&(l?z:!D),L=R.key==="Enter",H=R.key===" ",O=T.getAttribute("role"),P=O?.startsWith("menuitem")||O==="option"||O==="gridcell";if(M&&m&&H){if(R.defaultPrevented&&P)return;R.preventDefault(),D||l&&z?(T.click(),R.preventBaseUIHandler()):U&&(E?.(R),R.preventBaseUIHandler());return}U&&(!l&&(H||L)&&R.preventDefault(),!l&&L&&E?.(R))},onKeyUp(R){if(!t){if(of(R),j?.(R),R.target===R.currentTarget&&l&&m&&Wh(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!l&&!m&&R.key===" "&&E?.(R)}},onPointerDown(R){if(t){R.preventDefault();return}S?.(R)}},l?{type:"button"}:{role:"button"},h,N)},[t,h,m,l]),v=Ue(k=>{u.current=k,g()});return{getButtonProps:b,buttonRef:v}}function Wh(e){return qt(e)&&e.tagName==="BUTTON"}function fz(e){return!!(e?.tagName==="A"&&e?.href)}function pz(e){const{closeOnClick:t,highlighted:s,id:o,nodeId:l,store:c,typingRef:u,itemRef:p,itemMetadata:m}=e,{events:h}=c.useState("floatingTreeRoot"),g=c.useState("open"),b=ap(!0),v=b!==void 0;return x.useMemo(()=>({id:o,role:"menuitem",tabIndex:g&&s?0:-1,onKeyDown(k){k.key===" "&&u?.current&&k.preventDefault()},onMouseMove(k){l&&h.emit("itemhover",{nodeId:l,target:k.currentTarget})},onClick(k){t&&h.emit("close",{domEvent:k,reason:Al})},onMouseUp(k){if(b){const E=b.initialCursorPointRef.current;if(b.initialCursorPointRef.current=null,v&&E&&Math.abs(k.clientX-E.x)<=1&&Math.abs(k.clientY-E.y)<=1||v&&!tb&&k.button===2)return}p.current&&c.context.allowMouseUpTriggerRef.current&&(!v||k.button===2)&&(!m||m.type==="regular-item")&&p.current.click()}}),[t,s,o,h,l,g,c,u,p,b,v,m])}const q2={type:"regular-item"};function $2(e){const{closeOnClick:t,disabled:s=!1,highlighted:o,id:l,store:c,typingRef:u=c.context.typingRef,nativeButton:p,itemMetadata:m,nodeId:h}=e,g=c.useState("disabled"),b=s||g,v=x.useRef(null),{getButtonProps:k,buttonRef:E}=Vr({disabled:b,focusableWhenDisabled:!0,native:p,composite:!0}),y=pz({closeOnClick:t,highlighted:o,id:l,nodeId:h,store:c,typingRef:u,itemRef:v,itemMetadata:m}),j=x.useCallback(S=>Fn(y,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},S,k),[y,k,m]),C=Ka(v,E);return x.useMemo(()=>({getItemProps:j,itemRef:C}),[j,C])}const F2=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function mz(){return x.useContext(F2)}let G2=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Kc(e={}){const{label:t,metadata:s,textRef:o,indexGuessBehavior:l,index:c}=e,{register:u,unregister:p,subscribeMapChange:m,elementsRef:h,labelsRef:g,nextIndexRef:b}=mz(),v=x.useRef(-1),[k,E]=x.useState(c??(l===G2.GuessFromOrder?()=>{if(v.current===-1){const C=b.current;b.current+=1,v.current=C}return v.current}:-1)),y=x.useRef(null),j=x.useCallback(C=>{if(y.current=C,k!==-1&&C!==null&&(h.current[k]=C,g)){const S=t!==void 0;g.current[k]=S?t:o?.current?.textContent??C.textContent}},[k,h,g,t,o]);return ze(()=>{if(c!=null)return;const C=y.current;if(C)return u(C,s),()=>{p(C)}},[c,u,p,s]),ze(()=>{if(c==null)return m(C=>{const S=y.current?C.get(y.current)?.index:null;S!=null&&E(S)})},[c,m,E]),{ref:j,index:k}}let Nj=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const Y2={checked(e){return e?{[Nj.checked]:""}:{[Nj.unchecked]:""}},...Ja},hz=x.createContext(void 0),gz=x.forwardRef(function(t,s){const{render:o,className:l,id:c,label:u,nativeButton:p=!1,disabled:m=!1,closeOnClick:h=!0,style:g,...b}=t,v=Kc({label:u}),k=Ub(!0),E=Ks(c),{store:y}=Hr(),j=y.useState("isActive",v.index),C=y.useState("itemProps"),{getItemProps:S,itemRef:N}=$2({closeOnClick:h,disabled:m,highlighted:j,id:E,store:y,nativeButton:p,nodeId:k?.context.nodeId,itemMetadata:q2});return Et("div",t,{state:{disabled:m,highlighted:j},props:[C,b,S],ref:[N,s,v.ref]})}),xz=x.createContext(void 0);function K2(e){return x.useContext(xz)}const wc="ArrowUp",kc="ArrowDown",pf="ArrowLeft",mf="ArrowRight",rp="Home",op="End",X2=new Set([pf,mf]),bz=new Set([pf,mf,rp,op]),Q2=new Set([wc,kc]),_z=new Set([wc,kc,rp,op]),W2=new Set([...X2,...Q2]),lp=new Set([...W2,rp,op]),vz="Shift",yz="Control",jz="Alt",wz="Meta",kz=new Set([vz,yz,jz,wz]);function Sz(e){return qt(e)&&e.tagName==="INPUT"}function Ej(e){return!!(Sz(e)&&e.selectionStart!=null||qt(e)&&e.tagName==="TEXTAREA")}function Rj(e,t,s,o){if(!e||!t||!t.scrollTo)return;let l=e.scrollLeft,c=e.scrollTop;const u=e.clientWidth<e.scrollWidth,p=e.clientHeight<e.scrollHeight;if(u&&o!=="vertical"){const m=Tj(e,t,"left"),h=jd(e),g=jd(t);s==="ltr"&&(m+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-h.scrollPaddingRight?l=m+t.offsetWidth+g.scrollMarginRight-e.clientWidth+h.scrollPaddingRight:m-g.scrollMarginLeft<e.scrollLeft+h.scrollPaddingLeft&&(l=m-g.scrollMarginLeft-h.scrollPaddingLeft)),s==="rtl"&&(m-g.scrollMarginRight<e.scrollLeft+h.scrollPaddingLeft?l=m-g.scrollMarginLeft-h.scrollPaddingLeft:m+t.offsetWidth+g.scrollMarginRight>e.scrollLeft+e.clientWidth-h.scrollPaddingRight&&(l=m+t.offsetWidth+g.scrollMarginRight-e.clientWidth+h.scrollPaddingRight))}if(p&&o!=="horizontal"){const m=Tj(e,t,"top"),h=jd(e),g=jd(t);m-g.scrollMarginTop<e.scrollTop+h.scrollPaddingTop?c=m-g.scrollMarginTop-h.scrollPaddingTop:m+t.offsetHeight+g.scrollMarginBottom>e.scrollTop+e.clientHeight-h.scrollPaddingBottom&&(c=m+t.offsetHeight+g.scrollMarginBottom-e.clientHeight+h.scrollPaddingBottom)}e.scrollTo({left:l,top:c,behavior:"auto"})}function Tj(e,t,s){const o=s==="left"?"offsetLeft":"offsetTop";let l=0;for(;t.offsetParent&&(l+=t[o],t.offsetParent!==e);)t=t.offsetParent;return l}function jd(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 Cz={...Ao,...Ja},Nz=x.forwardRef(function(t,s){const{render:o,className:l,style:c,finalFocus:u,...p}=t,{store:m}=Hr(),{side:h,align:g}=Ub(),b=K2()!=null,v=m.useState("open"),k=m.useState("transitionStatus"),E=m.useState("popupProps"),y=m.useState("mounted"),j=m.useState("instantType"),C=m.useState("activeTriggerElement"),S=m.useState("parent"),N=m.useState("lastOpenChangeReason"),R=m.useState("rootId"),M=m.useState("floatingRootContext"),T=m.useState("floatingTreeRoot"),z=m.useState("closeDelay"),D=m.useState("activeTriggerElement"),U=m.useState("hoverEnabled"),L=m.useState("disabled"),H=m.useState("openMethod"),O=S.type==="context-menu";ha({open:v,ref:m.context.popupRef,onComplete(){v&&m.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function X(Y){m.setOpen(!1,nt(Y.reason,Y.domEvent))}return T.events.on("close",X),()=>{T.events.off("close",X)}},[T.events,m]),k2(M,{enabled:U&&!L&&!O&&S.type!=="menubar",closeDelay:z});const P=x.useCallback(X=>{m.set("popupElement",X)},[m]),B={transitionStatus:k,side:h,align:g,open:v,nested:S.type==="menu",instant:j},$=Et("div",t,{state:B,ref:[s,m.context.popupRef,P],stateAttributesMapping:Cz,props:[E,{onKeyDown(X){b&&lp.has(X.key)&&X.stopPropagation()}},np(k),p,{"data-rootownerid":R}]});let q=S.type===void 0||O;return(C||S.type==="menubar"&&N!==Gf)&&(q=!0),r.jsx(jb,{context:M,openInteractionType:H,modal:O,disabled:!y,returnFocus:u===void 0?q:u,initialFocus:S.type!=="menu",restoreFocus:!0,externalTree:S.type!=="menubar"?T:void 0,previousFocusableElement:D,nextFocusableElement:S.type===void 0?m.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:S.type===void 0?m.context.beforeContentFocusGuardRef:void 0,children:$})}),Z2=x.createContext(void 0);function Ez(){const e=x.useContext(Z2);if(e===void 0)throw new Error(rn(32));return e}const Rz=x.forwardRef(function(t,s){const{keepMounted:o=!1,...l}=t,{store:c}=Hr();return c.useState("mounted")||o?r.jsx(Z2.Provider,{value:o,children:r.jsx(_b,{ref:s,...l})}):null});function ip(e){const{children:t,elementsRef:s,labelsRef:o,onMapChange:l}=e,c=Ue(l),u=x.useRef(0),p=Wn(Az).current,m=Wn(Tz).current,[h,g]=x.useState(0),b=x.useRef(h),v=Ue((C,S)=>{m.set(C,S??null),b.current+=1,g(b.current)}),k=Ue(C=>{m.delete(C),b.current+=1,g(b.current)}),E=x.useMemo(()=>{const C=new Map;return Array.from(m.keys()).filter(N=>N.isConnected).sort(Mz).forEach((N,R)=>{const M=m.get(N)??{};C.set(N,{...M,index:R})}),C},[m,h]);ze(()=>{if(typeof MutationObserver!="function"||E.size===0)return;const C=new MutationObserver(S=>{const N=new Set,R=M=>N.has(M)?N.delete(M):N.add(M);S.forEach(M=>{M.removedNodes.forEach(R),M.addedNodes.forEach(R)}),N.size===0&&(b.current+=1,g(b.current))});return E.forEach((S,N)=>{N.parentElement&&C.observe(N.parentElement,{childList:!0})}),()=>{C.disconnect()}},[E]),ze(()=>{b.current===h&&(s.current.length!==E.size&&(s.current.length=E.size),o&&o.current.length!==E.size&&(o.current.length=E.size),u.current=E.size),c(E)},[c,E,s,o,h]),ze(()=>()=>{s.current=[]},[s]),ze(()=>()=>{o&&(o.current=[])},[o]);const y=Ue(C=>(p.add(C),()=>{p.delete(C)}));ze(()=>{p.forEach(C=>C(E))},[p,E]);const j=x.useMemo(()=>({register:v,unregister:k,subscribeMapChange:y,elementsRef:s,labelsRef:o,nextIndexRef:u}),[v,k,y,s,o,u]);return r.jsx(F2.Provider,{value:j,children:t})}function Tz(){return new Map}function Az(){return new Set}function Mz(e,t){const s=e.compareDocumentPosition(t);return s&Node.DOCUMENT_POSITION_FOLLOWING||s&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Vb=x.forwardRef(function(t,s){const{cutout:o,...l}=t;let c;if(o){const u=o.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${u.left}px ${u.top}px,${u.left}px ${u.bottom}px,${u.right}px ${u.bottom}px,${u.right}px ${u.top}px,${u.left}px ${u.top}px)`}return r.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});let Aj={},Mj={},Oj="";function Oz(e){if(typeof document>"u")return!1;const t=ht(e);return Xt(t).innerWidth-t.documentElement.clientWidth>0}function zz(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const s=ht(e),o=s.documentElement,l=s.body,c=Pr(o)?o:l,u=c.style.overflowY,p=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",c.style.overflowY="scroll";const m=c.offsetWidth;c.style.overflowY="hidden";const h=c.offsetWidth;return c.style.overflowY=u,o.style.scrollbarGutter=p,m===h}function Dz(e){const t=ht(e),s=t.documentElement,o=t.body,l=Pr(s)?s:o,c={overflowY:l.style.overflowY,overflowX:l.style.overflowX};return Object.assign(l.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(l.style,c)}}function Lz(e){const t=ht(e),s=t.documentElement,o=t.body,l=Xt(s);let c=0,u=0,p=!1;const m=sa.create();if(Lr&&(l.visualViewport?.scale??1)!==1)return()=>{};function h(){const k=l.getComputedStyle(s),E=l.getComputedStyle(o),C=(k.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=s.scrollTop,u=s.scrollLeft,Aj={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},Oj=s.style.scrollBehavior,Mj={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 S=s.scrollHeight>s.clientHeight,N=s.scrollWidth>s.clientWidth,R=k.overflowY==="scroll"||E.overflowY==="scroll",M=k.overflowX==="scroll"||E.overflowX==="scroll",T=Math.max(0,l.innerWidth-o.clientWidth),z=Math.max(0,l.innerHeight-o.clientHeight),D=parseFloat(E.marginTop)+parseFloat(E.marginBottom),U=parseFloat(E.marginLeft)+parseFloat(E.marginRight),L=Pr(s)?s:o;if(p=zz(e),p){s.style.scrollbarGutter=C,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(S||R)&&(s.style.overflowY="scroll"),(N||M)&&(s.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:D||z?`calc(100dvh - ${D+z}px)`:"100dvh",width:U||T?`calc(100vw - ${U+T}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=c,o.scrollLeft=u,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function g(){Object.assign(s.style,Aj),Object.assign(o.style,Mj),p||(s.scrollTop=c,s.scrollLeft=u,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=Oj)}function b(){g(),m.request(h)}h();const v=xt(l,"resize",b);return()=>{m.cancel(),g(),typeof l.removeEventListener=="function"&&v()}}class Pz{lockCount=0;restore=null;timeoutLock=$s.create();timeoutUnlock=$s.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const o=ht(t).documentElement,l=Xt(o).getComputedStyle(o).overflowY;if(l==="hidden"||l==="clip"){this.restore=Rn;return}const c=Bf||!Oz(t);this.restore=c?Dz(t):Lz(t)}}const Iz=new Pz;function J2(e=!0,t=null){ze(()=>{if(e)return Iz.acquire(t)},[e,t])}const Bz=20;function eC(e,t,s,o){const[l,c]=x.useState(!1);ze(()=>{if(!e||!t||s==null){c(!1);return}const u=ht(s).documentElement.clientWidth,p=s.offsetWidth;c(u>0&&p>0&&p>=u-Bz)},[e,t,s]),J2(e&&(!t||l),o)}const Uz=x.forwardRef(function(t,s){const{anchor:o,positionMethod:l="absolute",className:c,render:u,side:p,align:m,sideOffset:h=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v=5,arrowPadding:k=5,sticky:E=!1,disableAnchorTracking:y=!1,collisionAvoidance:j=GS,style:C,...S}=t,{store:N}=Hr(),R=Ez(),M=ap(!0),T=N.useState("parent"),z=N.useState("floatingRootContext"),D=N.useState("floatingTreeRoot"),U=N.useState("mounted"),L=N.useState("open"),H=N.useState("modal"),O=N.useState("openMethod"),P=N.useState("activeTriggerElement"),B=N.useState("transitionStatus"),$=N.useState("positionerElement"),q=N.useState("instantType"),X=N.useState("hasViewport"),Y=N.useState("lastOpenChangeReason"),F=N.useState("floatingNodeId"),K=N.useState("floatingParentNodeId"),I=z.useState("domReferenceElement"),G=x.useRef(null),Z=m2($,!1,!1);let te=o,de=h,ee=g,ne=m,ae=j;T.type==="context-menu"&&(te=o??T.context?.anchor,ne=ne??"start",!p&&ne!=="center"&&(ee=t.alignOffset??2,de=t.sideOffset??-5));let pe=p,Me=ne;T.type==="menu"?(pe=pe??"inline-end",Me=Me??"start",ae=t.collisionAvoidance??YS):T.type==="menubar"&&(pe=pe??(T.context.orientation==="vertical"?"inline-end":"bottom"),Me=Me??"start");const ue=T.type==="context-menu",me=Db({anchor:te,floatingRootContext:z,positionMethod:M?"fixed":l,mounted:U,side:pe,sideOffset:de,align:Me,alignOffset:ee,arrowPadding:ue?0:k,collisionBoundary:b,collisionPadding:v,sticky:E,nodeId:F,keepMounted:R,disableAnchorTracking:y,collisionAvoidance:ae,shiftCrossAxis:ue&&!("side"in ae&&ae.side==="flip"),externalTree:D,adaptiveOrigin:X?D2:void 0});x.useEffect(()=>{function Ce(De){De.open&&(De.parentNodeId===F&&N.set("hoverEnabled",!1),De.nodeId!==F&&De.parentNodeId===N.select("floatingParentNodeId")&&N.setOpen(!1,nt(dc)))}return D.events.on("menuopenchange",Ce),()=>{D.events.off("menuopenchange",Ce)}},[N,D.events,F]),x.useEffect(()=>{if(N.select("floatingParentNodeId")==null)return;function Ce(De){if(De.open||De.nodeId!==N.select("floatingParentNodeId"))return;const Pe=De.reason??dc;N.setOpen(!1,nt(Pe))}return D.events.on("menuopenchange",Ce),()=>{D.events.off("menuopenchange",Ce)}},[D.events,N]);const ke=kn();x.useEffect(()=>{L||ke.clear()},[L,ke]),x.useEffect(()=>{function Ce(De){if(!(!L||De.nodeId!==N.select("floatingParentNodeId")))if(De.target&&P&&P!==De.target){const Pe=N.select("closeDelay");Pe>0?ke.isStarted()||ke.start(Pe,()=>{N.setOpen(!1,nt(dc))}):N.setOpen(!1,nt(dc))}else ke.clear()}return D.events.on("itemhover",Ce),()=>{D.events.off("itemhover",Ce)}},[D.events,L,P,N,ke]),x.useEffect(()=>{const Ce={open:L,nodeId:F,parentNodeId:K,reason:N.select("lastOpenChangeReason")};D.events.emit("menuopenchange",Ce)},[D.events,L,N,F,K]),ze(()=>{const Ce=I,De=G.current;if(Ce&&(G.current=Ce),De&&Ce&&Ce!==De){N.set("instantType",void 0);const Pe=new AbortController;return Z(()=>{N.set("instantType","trigger-change")},Pe.signal),()=>{Pe.abort()}}},[I,Z,N]);const je={open:L,side:me.side,align:me.align,anchorHidden:me.anchorHidden,nested:T.type==="menu",instant:q},Be=T.type==="menubar"&&T.context.modal;eC(L&&(Be||H&&Y!==Tn),O==="touch",$,P);const we=Lb(t,je,{styles:me.positionerStyles,transitionStatus:B,props:S,refs:[s,N.useStateSetter("positionerElement")],hidden:!U,inert:!L}),Re=U&&T.type!=="menu"&&(T.type!=="menubar"&&H&&Y!==Tn||T.type==="menubar"&&T.context.modal);let ve=null;return T.type==="menubar"?ve=T.context.contentElement:T.type===void 0&&(ve=P),r.jsxs(U2.Provider,{value:me,children:[Re&&r.jsx(Vb,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:sp(!L),cutout:ve}),r.jsx(dO,{id:F,children:r.jsx(ip,{elementsRef:N.context.itemDomElements,labelsRef:N.context.itemLabels,children:we})})]})}),tC=x.createContext(void 0);function Hz(){const e=x.useContext(tC);if(e===void 0)throw new Error(rn(34));return e}const Vz=x.memo(x.forwardRef(function(t,s){const{render:o,className:l,value:c,defaultValue:u,onValueChange:p,disabled:m=!1,style:h,"aria-labelledby":g,...b}=t,[v,k]=x.useState(void 0),[E,y]=$l({controlled:c,default:u,name:"MenuRadioGroup"}),j=Ue((R,M)=>{p?.(R,M),!M.isCanceled&&y(R)}),S=Et("div",t,{state:{disabled:m},ref:s,props:{role:"group","aria-labelledby":g??v,"aria-disabled":m||void 0,...b}}),N=x.useMemo(()=>({value:E,setValue:j,disabled:m}),[E,j,m]);return r.jsx(hz.Provider,{value:k,children:r.jsx(tC.Provider,{value:N,children:S})})})),nC=x.createContext(void 0);function qz(){const e=x.useContext(nC);if(e===void 0)throw new Error(rn(35));return e}const $z=x.forwardRef(function(t,s){const{render:o,className:l,id:c,label:u,nativeButton:p=!1,disabled:m=!1,closeOnClick:h=!1,value:g,style:b,...v}=t,k=Kc({label:u}),E=Ub(!0),y=Ks(c),{store:j}=Hr(),C=j.useState("isActive",k.index),S=j.useState("itemProps"),{value:N,setValue:R,disabled:M}=Hz(),T=M||m,z=N===g,{getItemProps:D,itemRef:U}=$2({closeOnClick:h,disabled:T,highlighted:C,id:y,store:j,nativeButton:p,nodeId:E?.context.nodeId,itemMetadata:q2}),L=x.useMemo(()=>({disabled:T,highlighted:C,checked:z}),[T,C,z]);function H(P){const B=nt(Al,P.nativeEvent,void 0,{preventUnmountOnClose(){}});R(g,B)}const O=Et("div",t,{state:L,stateAttributesMapping:Y2,props:[S,{role:"menuitemradio","aria-checked":z,onClick:H},v,D],ref:[U,s,k.ref]});return r.jsx(nC.Provider,{value:L,children:O})}),Fz=x.forwardRef(function(t,s){const{render:o,className:l,style:c,keepMounted:u=!1,...p}=t,m=qz(),h=x.useRef(null),{transitionStatus:g,setMounted:b}=si(m.checked);ha({open:m.checked,ref:h,onComplete(){m.checked||b(!1)}});const v={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:g};return Et("span",t,{state:v,stateAttributesMapping:Y2,ref:[s,h],props:{"aria-hidden":!0,...p},enabled:u||m.checked})}),Gz=x.createContext(null);function sC(e){return x.useContext(Gz)}function Yz(e){const t=x.useRef(""),s=x.useCallback(l=>{l.defaultPrevented||(t.current=l.pointerType,e(l,l.pointerType))},[e]);return{onClick:x.useCallback(l=>{if(l.detail===0){e(l,"keyboard");return}"pointerType"in l?e(l,l.pointerType):e(l,t.current),t.current=""},[e]),onPointerDown:s}}function qb(e,t){const s=x.useRef(e),o=Ue(t);ze(()=>{s.current!==e&&o(s.current)},[e,o]),ze(()=>{s.current=e},[e])}function Kz(e,t){const s=Ue((c,u)=>{(typeof e=="function"?e():e)||t(u||(Bf?"touch":""))}),{onClick:o,onPointerDown:l}=Yz(s);return x.useMemo(()=>({onClick:o,onPointerDown:l}),[o,l])}function aC(e){const[t,s]=x.useState(null),o=Kz(e,s);return qb(e,l=>{l&&!e&&s(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const Xz={...Ab,disabled:Ae(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Ae(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),openMethod:Ae(e=>e.openMethod),allowMouseEnter:Ae(e=>e.allowMouseEnter),highlightItemOnHover:Ae(e=>e.highlightItemOnHover),stickIfOpen:Ae(e=>e.stickIfOpen),parent:Ae(e=>e.parent),rootId:Ae(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Ae(e=>e.activeIndex),isActive:Ae((e,t)=>e.activeIndex===t),hoverEnabled:Ae(e=>e.hoverEnabled),instantType:Ae(e=>e.instantType),lastOpenChangeReason:Ae(e=>e.openChangeReason),floatingTreeRoot:Ae(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Ae(e=>e.floatingNodeId),floatingParentNodeId:Ae(e=>e.floatingParentNodeId),itemProps:Ae(e=>e.itemProps),closeDelay:Ae(e=>e.closeDelay),hasViewport:Ae(e=>e.hasViewport),keyboardEventRelay:Ae(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class $b extends Wf{constructor(t){super({...Qz(),...t},{positionerRef:x.createRef(),popupRef:x.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:x.createRef(),beforeContentFocusGuardRef:x.createRef(),onOpenChangeComplete:void 0,triggerElements:new Yc},Xz),this.unsubscribeParentListener=this.observe("parent",s=>{if(this.unsubscribeParentListener?.(),s.type==="menu"){let o=s.store.select("rootId"),l=s.store.select("floatingTreeRoot"),c=s.store.select("keyboardEventRelay");this.unsubscribeParentListener=s.store.subscribe(()=>{const u=s.store.select("rootId"),p=s.store.select("floatingTreeRoot"),m=s.store.select("keyboardEventRelay");o===u&&l===p&&c===m||(o=u,l=p,c=m,this.notifyAll())}),this.context.allowMouseUpTriggerRef=s.store.context.allowMouseUpTriggerRef;return}s.type!==void 0&&(this.context.allowMouseUpTriggerRef=s.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,s){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:s})}static useStore(t,s){const o=Wn(()=>new $b(s)).current;return t??o}unsubscribeParentListener=null}function Qz(){return{...Rb(),disabled:!1,modal:!0,openMethod:null,allowMouseEnter:!1,highlightItemOnHover:!0,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new vb,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Gt,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const Wz=x.createContext(void 0);function Zz(){return x.useContext(Wz)}const Jz=Jx(function(t){const{children:s,open:o,onOpenChange:l,onOpenChangeComplete:c,defaultOpen:u=!1,disabled:p=!1,modal:m,loopFocus:h=!0,orientation:g="vertical",actionsRef:b,closeParentOnEsc:v=!1,handle:k,triggerId:E,defaultTriggerId:y=null,highlightItemOnHover:j=!0}=t,C=ap(!0),S=Hr(!0),N=sC(!0),R=Zz(),M=x.useMemo(()=>R&&S?{type:"menu",store:S.store}:N?{type:"menubar",context:N}:C&&!S?{type:"context-menu",context:C}:{type:void 0},[C,S,N,R]),T=$b.useStore(k?.store,{open:u,openProp:o,activeTriggerId:y,triggerIdProp:E,parent:M});x2(T,o,u,y),T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",E),T.useContextCallback("onOpenChangeComplete",c);const z=vo(),D=vo(),U=T.useState("floatingTreeRoot"),L=e2(U),H=Br(),O=T.useState("open"),P=T.useState("activeTriggerElement"),B=T.useState("positionerElement"),$=T.useState("hoverEnabled"),q=T.useState("disabled"),X=T.useState("lastOpenChangeReason"),Y=T.useState("parent"),F=T.useState("activeIndex"),K=T.useState("payload"),I=T.useState("floatingParentNodeId"),G=x.useRef(null),Z=x.useRef(Y.type!=="context-menu"),te=kn(),de=x.useRef(!0),ee=kn(),ne=I!=null,{openMethod:ae,triggerProps:pe}=aC(O);T.useSyncedValues({disabled:p,highlightItemOnHover:j,modal:Y.type===void 0?m:void 0,openMethod:ae,rootId:z}),Cb(T);const{forceUnmount:Me}=Nb(O,T,()=>{T.update({allowMouseEnter:!1,stickIfOpen:!0})});ze(()=>{C&&!S?T.update({parent:{type:"context-menu",context:C},floatingNodeId:L,floatingParentNodeId:H}):S&&T.update({floatingNodeId:L,floatingParentNodeId:H})},[C,S,L,H,T]),x.useEffect(()=>{if(O||(G.current=null),Y.type==="context-menu"){if(!O){te.clear(),Z.current=!1;return}te.start(500,()=>{Z.current=!0})}},[te,O,Y.type]),ze(()=>{!O&&!$&&T.set("hoverEnabled",!0)},[O,$,T]);const ue=Ue((Oe,et)=>{const at=et.reason;if(O===Oe&&et.trigger===P&&X===at)return;const vt=g2(et);if(!Oe&&et.trigger==null&&(et.trigger=P??void 0),l?.(Oe,et),et.isCanceled)return;T.state.floatingRootContext.dispatchOpenChange(Oe,et);const Mt=et.event;if(Oe===!1&&Mt?.type==="click"&&Mt.pointerType==="touch"&&!de.current)return;Oe&&at===Tl?(de.current=!1,ee.start(300,()=>{de.current=!0})):(de.current=!0,ee.clear());const lt=(at===ni||at===Al)&&Mt.detail===0&&Mt?.isTrusted,Rt=!Oe&&(at===Yf||at==null),xe={open:Oe,openChangeReason:at};G.current=et.event??null,Sb(xe,Oe,et.trigger,vt()),T.update(xe),Y.type==="menubar"&&(at===Tl||at===_o||at===Tn||at===nx||at===dc)?T.set("instantType","group"):lt||Rt?T.set("instantType",lt?"click":"dismiss"):T.set("instantType",void 0)}),me=p2({popupStore:T,floatingId:D,nested:H!=null,onOpenChange:ue}),ke=me.context.events;x.useEffect(()=>{const Oe=({open:et,eventDetails:at})=>ue(et,at);return ke.on("setOpen",Oe),()=>{ke?.off("setOpen",Oe)}},[ke,ue]);const je=x.useCallback(()=>{T.setOpen(!1,nt(ib))},[T]);x.useImperativeHandle(b,()=>({unmount:Me,close:je}),[Me,je]);let Be;Y.type==="context-menu"&&(Be=Y.context),x.useImperativeHandle(Be?.positionerRef,()=>B,[B]),x.useImperativeHandle(Be?.actionsRef,()=>({setOpen:ue}),[ue]);const He=Xf(me,{enabled:!q,bubbles:{escapeKey:v&&Y.type==="menu"},outsidePress(){return Y.type!=="context-menu"||G.current?.type==="contextmenu"?!0:Z.current},externalTree:ne?U:void 0}),we=tp(),Re=x.useCallback(Oe=>{T.select("activeIndex")!==Oe&&T.set("activeIndex",Oe)},[T]),ve=C2(me,{enabled:!q,listRef:T.context.itemDomElements,activeIndex:F,nested:Y.type!==void 0,loopFocus:h,orientation:g,parentOrientation:Y.type==="menubar"?Y.context.orientation:void 0,rtl:we==="rtl",disabledIndices:Ya,onNavigate:Re,openOnArrowKeyDown:Y.type!=="context-menu",externalTree:ne?U:void 0,focusItemOnHover:j}),Ce=x.useCallback(Oe=>{T.context.typingRef.current=Oe},[T]),De=N2(me,{enabled:!q,listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:F,resetMs:rO,onMatch:Oe=>{O&&Oe!==F&&T.set("activeIndex",Oe)},onTyping:Ce}),Pe=x.useMemo(()=>{const Oe=Fn(De.reference,ve.reference,He.reference,{onMouseMove(){T.set("allowMouseEnter",!0)}},pe);return Oe["aria-haspopup"]="menu",Oe["aria-expanded"]=O,Oe},[T,De.reference,ve.reference,He.reference,pe,O]),Ie=x.useMemo(()=>{const Oe=Fn(ve.trigger,He.trigger,pe);return Oe["aria-haspopup"]="menu",Oe["aria-expanded"]=!1,Oe},[ve.trigger,He.trigger,pe]),le=x.useMemo(()=>Fn(Jf,{id:D,role:"menu","aria-labelledby":P?.id,onMouseMove(){T.set("allowMouseEnter",!0),Y.type==="menu"&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(Oe){const et=T.select("keyboardEventRelay");et&&!Oe.isPropagationStopped()&&et(Oe)}},De.floating,ve.floating,He.floating),[P,D,Y.type,T,De.floating,ve.floating,He.floating]),_e=ve.item??Gt;Eb(T,{floatingRootContext:me,activeTriggerProps:Pe,inactiveTriggerProps:Ie,popupProps:le,itemProps:_e});const qe=x.useMemo(()=>({store:T,parent:M}),[T,M]),Ne=r.jsx(H2.Provider,{value:qe,children:typeof s=="function"?s({payload:K}):s});return Y.type===void 0||Y.type==="context-menu"?r.jsx(fO,{externalTree:U,children:Ne}):Ne});function rC(e){const t=e.getBoundingClientRect(),s=Xt(e);if(nb)return t;const o=s.getComputedStyle(e,"::before"),l=s.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return t;const u=parseFloat(o.width)||0,p=parseFloat(o.height)||0,m=parseFloat(l.width)||0,h=parseFloat(l.height)||0,g=Math.max(t.width,u,m),b=Math.max(t.height,p,h),v=g-t.width,k=b-t.height;return{left:t.left-v/2,right:t.right+v/2,top:t.top-k/2,bottom:t.bottom+k/2}}function oC(e={}){const{highlightItemOnHover:t,highlightedIndex:s,onHighlightedIndexChange:o}=Hb(),{ref:l,index:c}=Kc(e),u=s===c,p=x.useRef(null),m=Ka(l,p);return{compositeProps:{tabIndex:u?0:-1,onFocus(){o(c)},onMouseMove(){const g=p.current;if(!t||!g)return;const b=g.hasAttribute("disabled")||g.ariaDisabled==="true";!u&&!b&&g.focus()}},compositeRef:m,index:c}}function eD(e){const{render:t,className:s,style:o,state:l=Gt,props:c=Ya,refs:u=Ya,metadata:p,stateAttributesMapping:m,tag:h="div",...g}=e,{compositeProps:b,compositeRef:v}=oC({metadata:p});return Et(h,e,{state:l,ref:[...u,v],props:[b,...c,g],stateAttributesMapping:m})}function lC(e){if(qt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!la(e))return lC(da(e))}function tD(e,t){const s=x.useRef(null);function o(c){Ps.flushSync(()=>{e.setOpen(!1,nt(_o,c.nativeEvent,c.currentTarget))}),H5(s.current)?.focus()}function l(c){const u=e.select("positionerElement");if(u&&Ml(c,u))e.context.beforeContentFocusGuardRef.current?.focus();else{Ps.flushSync(()=>{e.setOpen(!1,nt(_o,c.nativeEvent,c.currentTarget))});let p=U5(e.context.triggerFocusTargetRef.current||t.current);for(;p!==null&&Qe(u,p);){const m=p;if(p=hb(p),p===m)break}p?.focus()}}return{preFocusGuardRef:s,handlePreFocusGuardFocus:o,handleFocusTargetFocus:l}}function nD(e){const{enabled:t=!0,mouseDownAction:s,open:o}=e,l=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:c=>{(s==="open"&&!o||s==="close"&&o)&&(l.current=!0,ht(c.currentTarget).addEventListener("click",()=>{l.current=!1},{once:!0}))},onClick:c=>{l.current&&(l.current=!1,c.preventBaseUIHandler())}}:Gt,[t,s,o])}const wd=2,sD=hS(function(t,s){const{render:o,className:l,style:c,disabled:u=!1,nativeButton:p=!0,id:m,openOnHover:h,delay:g=100,closeDelay:b=0,handle:v,payload:k,...E}=t,y=Hr(!0),j=v?.store??y?.store;if(!j)throw new Error(rn(85));const C=Ks(m),S=j.useState("isTriggerActive",C),N=j.useState("floatingRootContext"),R=j.useState("isOpenedByTrigger",C),M=j.useState("triggerPopupId",C),T=x.useRef(null),z=rD(),D=Hb(!0),U=Ur(),L=x.useMemo(()=>U??new vb,[U]),H=e2(L),O=Br(),{registerTrigger:P,isMountedByThisTrigger:B}=b2(C,T,j,{payload:k,closeDelay:b,parent:z,floatingTreeRoot:L,floatingNodeId:H,floatingParentNodeId:O,keyboardEventRelay:D?.relayKeyboardEvent}),$=z.type==="menubar",q=j.useState("disabled"),X=u||q||$&&z.context.disabled,{getButtonProps:Y,buttonRef:F}=Vr({disabled:X,native:p});x.useEffect(()=>{!R&&z.type===void 0&&(j.context.allowMouseUpTriggerRef.current=!1)},[j,R,z.type]);const K=x.useRef(null),I=kn(),G=Ue(ve=>{if(!K.current)return;I.clear(),j.context.allowMouseUpTriggerRef.current=!1;const Ce=ve.target;if(Qe(K.current,Ce)||Qe(j.select("positionerElement"),Ce)||Ce===K.current||Ce!=null&&lC(Ce)===j.select("rootId"))return;const De=rC(K.current);ve.clientX>=De.left-wd&&ve.clientX<=De.right+wd&&ve.clientY>=De.top-wd&&ve.clientY<=De.bottom+wd||L.events.emit("close",{domEvent:ve,reason:jS})});x.useEffect(()=>{R&&j.select("lastOpenChangeReason")===Tn&&ht(K.current).addEventListener("mouseup",G,{once:!0})},[R,G,j]);const Z=$&&z.context.hasSubmenuOpen,de=S2(N,{enabled:(h??Z)&&!X&&z.type!=="context-menu"&&(!$||Z&&!B),handleClose:E2({blockPointerEvents:!$}),mouseOnly:!0,move:!1,restMs:z.type===void 0?g:void 0,delay:{close:b},triggerElementRef:T,externalTree:L,isActiveTrigger:S,isClosing:()=>j.select("transitionStatus")==="ending"}),ee=aD(R,j.select("lastOpenChangeReason")),ne=t2(N,{enabled:!X&&z.type!=="context-menu",event:R&&$?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:z.type===void 0?ee:!1}),ae=j2(N,{enabled:!X&&Z}),pe=nD({open:R,enabled:$,mouseDownAction:"open"}),Me=x.useMemo(()=>Fn(ae.reference,ne.reference),[ae.reference,ne.reference]),ue=j.useState("triggerProps",B),{preFocusGuardRef:me,handlePreFocusGuardFocus:ke,handleFocusTargetFocus:je}=tD(j,T),Be={disabled:X,open:R},He=[K,s,F,P,T],we=[Me,de??Gt,ue,{"aria-haspopup":"menu","aria-controls":M,id:C,onMouseDown:ve=>{if(j.select("open"))return;I.start(200,()=>{j.context.allowMouseUpTriggerRef.current=!0}),ht(ve.currentTarget).addEventListener("mouseup",G,{once:!0})}},$?{role:"menuitem"}:{},pe,E,Y],Re=Et("button",t,{enabled:!$,stateAttributesMapping:cx,state:Be,ref:He,props:we});return $?r.jsx(eD,{tag:"button",render:o,className:l,style:c,state:Be,refs:He,props:we,stateAttributesMapping:cx}):R?r.jsxs(x.Fragment,{children:[r.jsx(Vl,{ref:me,onFocus:ke},`${C}-pre-focus-guard`),r.jsx(x.Fragment,{children:Re},C),r.jsx(Vl,{ref:j.context.triggerFocusTargetRef,onFocus:je},`${C}-post-focus-guard`)]}):r.jsx(x.Fragment,{children:Re},C)});function aD(e,t){const s=kn(),[o,l]=x.useState(!1);return ze(()=>{e&&t==="trigger-hover"?(l(!0),s.start(oO,()=>{l(!1)})):e||(s.clear(),l(!1))},[e,t,s]),o}function rD(){const e=ap(!0),t=Hr(!0),s=sC();return x.useMemo(()=>s?{type:"menubar",context:s}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,s])}function iC(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function cC({...e}){return r.jsx(Jz,{"data-slot":"dropdown-menu",...e})}function uC({...e}){return r.jsx(sD,{"data-slot":"dropdown-menu-trigger",...e})}function dC({align:e="start",alignOffset:t=0,side:s="bottom",sideOffset:o=4,className:l,...c}){return r.jsx(Rz,{children:r.jsx(Uz,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:s,sideOffset:o,children:r.jsx(Nz,{"data-slot":"dropdown-menu-content",className:Ct("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",l),...c})})})}function oD({className:e,inset:t,variant:s="default",...o}){return r.jsx(gz,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":s,className:Ct("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 lD({...e}){return r.jsx(Vz,{"data-slot":"dropdown-menu-radio-group",...e})}function iD({className:e,children:t,inset:s,...o}){return r.jsxs($z,{"data-slot":"dropdown-menu-radio-item","data-inset":s,className:Ct("relative flex cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground focus:**:text-accent-foreground data-inset:pl-7 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[r.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:r.jsx(Fz,{children:r.jsx(xo,{})})}),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",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."},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",engines:"Engines & modelos",telegram:"Telegram",devices:"Dispositivos",advanced:"Avanzado"},identity:{title:"Identidad",subtitle:"Datos del usuario. Configuración del agente va en Super-agente.",agent_name:"Nombre del agente",owner_name:"Tu nombre",personality:"Personalidad",owner_context:"Contexto del dueño",owner_context_hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",language:"Idioma preferido",timezone:"Timezone (IANA)",timezone_hint:"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"},sections:{workspace:"Workspace",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"abrir"},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:{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",logs_title:"Logs · {name}",logs_empty:"Sin logs todavía. Arrancá el MCP llamando un tool o probando.",logs_events:"Eventos recientes",logs_stderr:"stderr (últimos 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"elegí un MCP",logs_panel_hint:"Click un MCP de la lista para ver lo que está pasando en vivo.",logs_panel_idle:"Sin actividad. Apretá Probar para arrancarlo.",name_required:"Nombre requerido",removed:"eliminado",added:"MCP agregado.",updated:"MCP actualizado."},vars:{title:"Variables",subtitle_project:"Reemplazan ${var.NOMBRE} al cargar MCPs y plantillas. Las del proyecto ganan sobre las globales. Se guardan fuera del repo (~/.apx/, chmod 0600).",subtitle_base:"Variables globales — disponibles para todos los proyectos. Se guardan en ~/.apx/vars.json (chmod 0600).",empty:"Sin variables todavía.",new:"Variable",new_title:"Nueva variable",edit_title:"Editar variable",new_desc:"Se referencia como ${var.NOMBRE} en cualquier campo que soporte interpolación.",reveal_all:"Mostrar valores",reveal:"Mostrar",hide:"Ocultar",filter_label:"Mostrar:",filter_all:"Todas",filter_project:"Sólo proyecto",filter_global:"Sólo globales",scope_label:"Scope",scope_project:"proyecto",scope_project_desc:"Sólo este proyecto. Pisa la global con mismo nombre.",scope_global:"global",scope_global_desc:"Disponible en todos los proyectos.",name_label:"Nombre",name_hint:"Mayúsculas, dígitos y _. P. ej.: MY_API_KEY, GITHUB_TOKEN.",value_label:"Valor",value_hint:"Se guarda en disco con permisos 0600. Nunca se commitea.",value_edit_ph:"(dejá vacío para no cambiarlo… aún no soportado, pegá el valor de nuevo)",add_btn:"Agregar",save_btn:"Guardar",edit_btn:"Editar",delete_btn:"Borrar",delete_confirm:"¿Borrar {name} ({scope})?",removed:"Variable eliminada.",added:"Variable agregada.",updated:"Variable actualizada.",name_required:"Nombre requerido.",value_required:"Valor requerido."},threads:{title:"Chats",subtitle:"Conversaciones por agent (vacío = ningún log persistido todavía).",no_agents:"No hay agents. Las conversaciones requieren un agent configurado.",pick:"Elegí un agent para ver sus conversaciones.",empty:"No hay conversaciones para {slug}.",conversation_title:"Conversación {id}",messages:"mensajes",via:"via"},config:{title:"Config rápida",subtitle:"Override del proyecto. Se escribe en {path}.",model:"super_agent.model",model_hint:"ej. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug del agent que atiende por defecto en este proyecto.",use_global:"(usa global)",saved:"Guardado.",nothing:"Nada para guardar.",raw_title:"Config (JSON crudo)",raw_subtitle:"Pegá el objeto entero — equivale a PUT del archivo.",raw_save:"Reemplazar config",raw_done:"Config sobrescrita.",effective:"Effective config (read-only)",effective_sub:"Lo que ve realmente el daemon (global ⊕ override).",section_title:"Config proyecto",section_desc:"APC metadata y overrides separados. General APX vive en Settings > Config.",effective_read:"Lectura: global APX + override proyecto.",save_project:".apc/project.json guardado.",save_override:".apc/config.json guardado.",save_fields_success:"Overrides guardados.",save_meta_success:"Project metadata guardado.",no_data:"Sin datos."},telegram:{title:"Canal de Telegram (override)",subtitle:"Si seteás un canal acá, los mensajes generados por este proyecto se mandan ahí en lugar del default.",use_default:"Usar el canal default",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override guardado.",cleared:"Override eliminado — vuelve al default.",override_active:"override activo",channel_badge:"Canal {name}",no_override:"Sin override. Los mensajes de este proyecto van al canal default.",respond_engine:"Responder con engine",route_agent:"route_to_agent",route_hint:"Slug del agent que atiende (vacío = super-agent).",bot_hint_none:"Si vacío, hereda del default."},memories:{project_title:"Memoria del proyecto",project_desc:"Hechos durables a nivel proyecto. .apc/memory.md — la leen los agentes y el super-agente.",project_ph:`# Memoria del proyecto
617
-
618
- Hechos estables que cualquier agente debería saber…`,agents_title:"Memorias de agentes",agents_desc:"Memoria individual por agente. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"Sin agentes en este proyecto.",saved:"Memoria guardada.",empty:"(memoria vacía)",chars:"chars · Markdown",save_btn:"Guardar"}},base:{title:"Base",subtitle:"Espacio general · super-agente",nav_general:"General",nav_activity:"Actividad",nav_system:"Sistema",workspaces_title:"Workspaces",workspaces_desc:"Todos los proyectos registrados en APX.",workspaces_new:"Nuevo proyecto",workspaces_empty:"Sin proyectos. Agregá uno con el botón de arriba.",sessions_title:"Sessions",sessions_desc:"Sesiones de todos los engines (apx · claude · codex), más nuevas primero.",sessions_all:"Todos los engines",sessions_empty:"Sin sesiones.",sessions_error:"No pude leer las sesiones: {msg}",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",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.'},engines_panel:{title:"Proveedores",new_btn:"Nuevo proveedor",description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",empty:"Sin providers. Agregá uno con el botón de arriba.",add_card:"Agregar provider",saved:"Provider guardado.",saved_json:"Provider guardado (JSON).",deleted:"Provider borrado.",delete_confirm:"¿Borrar provider {name}?"},providers_modal:{new_title:"Nuevo proveedor",edit_title:"Editar {name}",description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",list_models_hint:"Listar los modelos reales del proveedor",toggle_active:"Activo · click para desactivar",toggle_inactive:"Inactivo · click para activar",delete:"Borrar",custom:"Custom",json_mode:"JSON",form_mode:"Volver al formulario",json_label:"Config del provider (JSON)",json_hint:"Se guarda como engines.{slug} en config.json",json_help:"Debe ser un objeto JSON válido con al menos engine. El slug se toma del formulario.",name_label:"Nombre",name_ph:"Mi provider",engine_label:"Motor (engine)",base_url_label:"URL base (base_url)",base_url_hint:"Se completa sola al elegir un proveedor.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Dejá en blanco para mantener la actual.",api_key_hint_env:"Se guarda como secreto. Env sugerida: {env}",api_key_hint:"Se guarda como secreto.",api_key_set:"…{suffix} (ya seteada)",model_label:"Modelo por defecto",load_models:"Cargar modelos",max_tokens_label:"Máx. tokens (max_tokens)",temperature_label:"Temperatura: {value}",pricing_summary:"Análisis de tokens / pricing (opcional)",context_limit_label:"Límite de contexto (tokens)",price_input:"$ entrada / 1M",price_output:"$ salida / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Límites de contexto por modelo (JSON)",active_label:"Activo (los agentes pueden usarlo)",err_slug_required:"Slug requerido.",err_slug_required_form:"Slug requerido (en el formulario).",err_slug_exists:'Ya existe un provider "{slug}".',err_model_limits_json:"Límites de contexto por modelo: JSON inválido.",err_json_invalid:"JSON inválido: revisá la sintaxis.",err_json_object:"El JSON debe ser un objeto con la config del provider.",err_engine_missing:'Falta "engine" (ej. "anthropic", "ollama").',err_save:"Error al guardar.",err_no_models:"Sin modelos. ¿Key/URL correctas?",err_list_models:"No se pudo listar modelos."},providers_card:{active:"Activo",off:"Off",model:"Modelo",base_url:"Base URL",api_key:"API key",key_set:"✓ seteada",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copiar",stop:"Detener",send:"Enviar",pick_model:"Elegir modelo (o Auto)",insert_variable:"Insertar variable"},sidebar_ui:{toggle:"Mostrar/ocultar sidebar"},models_ui:{invalid_hint:"Modelo/proveedor no disponible"},global_config:{title:"Config APX"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (ya seteada)",api_key_keep_hint:"Dejá en blanco para mantener la actual.",api_key_secret_hint:"Se guarda como secreto. Env: {env}",api_key_reuse_hint:"Si lo dejás vacío, reusa {engine}. Env: {env}",err_save:"Error al guardar.",model_label:"Modelo",voice_label:"Voz",format_label:"Formato",output_format_label:"Formato de salida",voice_id_label:"Voice ID",voice_id_hint:"Voice id de ElevenLabs (vacío = default).",gemini_model_hint:"El TTS de Gemini todavía está en preview.",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_ui:{model_router_default:"modelo: default del router",slug_kebab_hint:"kebab-case, ej. reviewer, my-agent, content-writer",comma_separated:"separadas por coma",body_hint:"markdown — extiende el system prompt del agente",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorador",type_none:"— sin tipo —",type_orchestrator:"Orquestador",type_orchestrator_desc:"Coordina el equipo y delega.",type_specialist:"Especialista",type_specialist_desc:"Experto en el dominio; corre tareas.",type_assistant:"Asistente",type_assistant_desc:"Ayudante conversacional.",type_worker:"Worker",type_worker_desc:"Corre tareas autónomas.",type_monitor:"Monitor",type_monitor_desc:"Vigila el estado y reporta.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definición (frontmatter + system prompt).",memory_durable_desc:"hechos durables que el agente recuerda.",running:"running",paused:"pausada",last_error:"última: error",field_tick:"Tick",field_next_tick:"Próximo tick",field_last_tick:"Último tick",field_last_run:"Última corrida",tools_label:"Tools",kind_agent:"agente",kind_memory:"memoria",kind_thread:"thread",kind_task:"task",kind_routine:"rutina",kind_hierarchy:"jerarquía",nodes_drag_hint:"{n} nodos · arrastrá para reordenar",kind_exec_agent:"Agente del proyecto",kind_exec_agent_desc:"Corre un agente del proyecto con un prompt. Vos elegís cuál.",kind_super_agent:"Super-agente",kind_super_agent_desc:"Llama al super-agente APX con un prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Manda un mensaje fijo a un canal de Telegram. Sin modelo ni agente.",kind_shell:"Shell",kind_shell_desc:"Corre un comando shell. Sin prompt ni pre/post — el comando es la acción.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"No hace nada salvo escribir una línea en los logs cada vez que corre. Sirve para confirmar que el scheduler está vivo. Si no sabés si lo necesitás, no lo uses.",unit_seconds:"segundos",unit_minutes:"minutos",unit_hours:"horas",unit_days:"días",every_n_unit:"cada {n} {unit}",every_v:"cada {v}",preset_every_10m:"cada 10 min",preset_hourly:"cada hora",preset_daily_9am:"diario 9am",preset_weekdays_9am:"días hábiles 9am",preset_manual:"Manual",var_pre_output_prompt:"Salida de texto de los pre-commands. Se reemplaza dentro del prompt/texto antes de enviarlo. Útil para inyectar datos frescos (clima, una API) en la instrucción.",var_llm_output:"Respuesta final del agente o super-agente. Disponible en los post-commands como variable de entorno. Ej: reenviarla por Telegram.",var_status:"Resultado de la acción: ok o error. Disponible en los post-commands para decidir qué hacer después.",var_skipped:"Vale 1 si la acción se salteó (por skip_prompt_on), 0 si corrió. Disponible en los post-commands.",var_pre_output:"Salida completa de los pre-commands, como variable de entorno en los post-commands (hasta 32k).",var_pre_output_file:"Ruta a un archivo temporal con la salida de los pre-commands. Para salidas grandes que no convienen como variable.",var_pre_exit:"Código de salida del último pre-command (0 = ok). Disponible en los post-commands.",var_routine:"Nombre de esta rutina. Disponible como variable de entorno en los comandos.",summary_runs_agent:'Corre el agente "{agent}"',summary_runs_agent_none:"Corre un agente (todavía no elegiste cuál)",summary_super_agent:"Llama al super-agente",summary_telegram:'Manda Telegram a "{channel}"',summary_runs_cmd:"Corre: {cmd}",summary_shell:"Corre un comando shell",summary_heartbeat:"Deja un heartbeat en los logs",action_agent_answers:'El agente "{agent}" responde el prompt',action_agent_pick_answers:"El agente (elegí uno) responde el prompt",action_super_answers:"El super-agente responde el prompt",action_telegram_channel:'Manda Telegram al canal "{channel}"',action_runs_shell:"Corre el comando shell",step_pre:"Pre",step_post:"Post",last_label:"última:",tg_chat_id_ph:"(usa el del canal)",tg_text_ph:"mensaje a enviar",hb_message_ph:"sigo vivo",arg_placeholder:"--flag o valor",remove_arg:"quitar arg",super_agent_label:"{persona} (super-agente)",super_agent_badge:"super-agente"},modules_ui:{desktop_pos_left:"Izquierda",desktop_pos_center:"Centro",desktop_pos_right:"Derecha",desktop_theme_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"},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."}},uD={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",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."},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",engines:"Engines & models",telegram:"Telegram",devices:"Devices",advanced:"Advanced"},identity:{title:"Identity",subtitle:"User data. Agent configuration goes in Super-agent.",agent_name:"Agent name",owner_name:"Your name",personality:"Personality",owner_context:"Owner context",owner_context_hint:"Who you are, what you work on, what the agent should know about you.",language:"Preferred language",timezone:"Timezone (IANA)",timezone_hint:"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"},sections:{workspace:"Workspace",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"open"},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:{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",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."},telegram:{title:"Telegram channel (override)",subtitle:"If you set a channel here, messages from this project go there instead of the default.",use_default:"Use default channel",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override saved.",cleared:"Override removed — falls back to default.",override_active:"override active",channel_badge:"Channel {name}",no_override:"No override. Messages from this project go to the default channel.",respond_engine:"Respond with engine",route_agent:"route_to_agent",route_hint:"Slug of the agent that handles messages (empty = super-agent).",bot_hint_none:"If empty, inherits from default."},memories:{project_title:"Project memory",project_desc:"Durable facts at the project level. .apc/memory.md — read by agents and the super-agent.",project_ph:`# Project Memory
619
-
620
- Stable facts that any agent should know…`,agents_title:"Agent memories",agents_desc:"Individual memory per agent. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"No agents in this project.",saved:"Memory saved.",empty:"(empty memory)",chars:"chars · Markdown",save_btn:"Save"}},base:{title:"Base",subtitle:"General workspace · super-agent",nav_general:"General",nav_activity:"Activity",nav_system:"System",workspaces_title:"Workspaces",workspaces_desc:"All projects registered in APX.",workspaces_new:"New project",workspaces_empty:"No projects. Add one with the button above.",sessions_title:"Sessions",sessions_desc:"Sessions from all engines (apx · claude · codex), newest first.",sessions_all:"All engines",sessions_empty:"No sessions.",sessions_error:"Could not read sessions: {msg}",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",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.'},engines_panel:{title:"Providers",new_btn:"New provider",description:"LLM providers (API). Each provider uses an engine/adapter (openai, ollama, …) with its key and URL.",empty:"No providers. Add one with the button above.",add_card:"Add provider",saved:"Provider saved.",saved_json:"Provider saved (JSON).",deleted:"Provider deleted.",delete_confirm:"Delete provider {name}?"},providers_modal:{new_title:"New provider",edit_title:"Edit {name}",description:"LLM provider. The engine defines which adapter it uses (openai, ollama, …).",list_models_hint:"List the provider's actual models",toggle_active:"Active · click to deactivate",toggle_inactive:"Inactive · click to activate",delete:"Delete",custom:"Custom",json_mode:"JSON",form_mode:"Back to form",json_label:"Provider config (JSON)",json_hint:"Saved as engines.{slug} in config.json",json_help:"Must be a valid JSON object with at least engine. The slug is taken from the form.",name_label:"Name",name_ph:"My provider",engine_label:"Engine",base_url_label:"Base URL (base_url)",base_url_hint:"Auto-filled when you pick a provider.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Leave blank to keep the current one.",api_key_hint_env:"Stored as a secret. Suggested env: {env}",api_key_hint:"Stored as a secret.",api_key_set:"…{suffix} (already set)",model_label:"Default model",load_models:"Load models",max_tokens_label:"Max tokens (max_tokens)",temperature_label:"Temperature: {value}",pricing_summary:"Token analysis / pricing (optional)",context_limit_label:"Context limit (tokens)",price_input:"$ input / 1M",price_output:"$ output / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Per-model context limits (JSON)",active_label:"Active (agents can use it)",err_slug_required:"Slug required.",err_slug_required_form:"Slug required (in the form).",err_slug_exists:'A provider "{slug}" already exists.',err_model_limits_json:"Per-model context limits: invalid JSON.",err_json_invalid:"Invalid JSON: check the syntax.",err_json_object:"The JSON must be an object with the provider config.",err_engine_missing:'Missing "engine" (e.g. "anthropic", "ollama").',err_save:"Error saving.",err_no_models:"No models. Correct key/URL?",err_list_models:"Could not list models."},providers_card:{active:"Active",off:"Off",model:"Model",base_url:"Base URL",api_key:"API key",key_set:"✓ set",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copy",stop:"Stop",send:"Send",pick_model:"Pick model (or Auto)",insert_variable:"Insert variable"},sidebar_ui:{toggle:"Toggle sidebar"},models_ui:{invalid_hint:"Model/provider unavailable"},global_config:{title:"APX config"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (already set)",api_key_keep_hint:"Leave blank to keep the current one.",api_key_secret_hint:"Stored as a secret. Env: {env}",api_key_reuse_hint:"Reuses {engine} if left blank. Env: {env}",err_save:"Error while saving.",model_label:"Model",voice_label:"Voice",format_label:"Format",output_format_label:"Output format",voice_id_label:"Voice ID",voice_id_hint:"ElevenLabs voice id (empty = default).",gemini_model_hint:"Gemini TTS is still in preview.",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_ui:{model_router_default:"model: router default",slug_kebab_hint:"kebab-case, e.g. reviewer, my-agent, content-writer",comma_separated:"comma-separated",body_hint:"markdown — extends the agent's system prompt",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorer",type_none:"— no type —",type_orchestrator:"Orchestrator",type_orchestrator_desc:"Coordinates the team and delegates.",type_specialist:"Specialist",type_specialist_desc:"Domain expert; runs tasks.",type_assistant:"Assistant",type_assistant_desc:"Conversational helper.",type_worker:"Worker",type_worker_desc:"Runs autonomous tasks.",type_monitor:"Monitor",type_monitor_desc:"Watches state and reports.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definition (frontmatter + system prompt).",memory_durable_desc:"durable facts the agent remembers.",running:"running",paused:"paused",last_error:"last: error",field_tick:"Tick",field_next_tick:"Next tick",field_last_tick:"Last tick",field_last_run:"Last run",tools_label:"Tools",kind_agent:"agent",kind_memory:"memory",kind_thread:"thread",kind_task:"task",kind_routine:"routine",kind_hierarchy:"hierarchy",nodes_drag_hint:"{n} nodes · drag to rearrange",kind_exec_agent:"Project agent",kind_exec_agent_desc:"Runs a project agent with a prompt. You pick which one.",kind_super_agent:"Super-agent",kind_super_agent_desc:"Calls the APX super-agent with a prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Sends a fixed message to a Telegram channel. No model or agent.",kind_shell:"Shell",kind_shell_desc:"Runs a shell command. No prompt or pre/post — the command is the action.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"Does nothing except write a line to the logs each time it runs. Useful to confirm the scheduler is alive. If you don't know whether you need it, don't use it.",unit_seconds:"seconds",unit_minutes:"minutes",unit_hours:"hours",unit_days:"days",every_n_unit:"every {n} {unit}",every_v:"every {v}",preset_every_10m:"every 10 min",preset_hourly:"hourly",preset_daily_9am:"daily 9am",preset_weekdays_9am:"weekdays 9am",preset_manual:"Manual",var_pre_output_prompt:"Text output of the pre-commands. Replaced inside the prompt/text before it is sent. Use it to inject fresh data (weather, an API) into the instruction.",var_llm_output:"Final answer from the agent or super-agent. Available in the post-commands as an env var — e.g. forward it via Telegram.",var_status:"Action result: ok or error. Available in the post-commands to branch on what happened.",var_skipped:"1 if the action was skipped (via skip_prompt_on), 0 if it ran. Available in the post-commands.",var_pre_output:"Full pre-commands output, as an env var in the post-commands (up to 32k).",var_pre_output_file:"Path to a temp file with the pre-commands output. For large outputs not suited to an env var.",var_pre_exit:"Exit code of the last pre-command (0 = ok). Available in the post-commands.",var_routine:"Name of this routine. Available as an env var in the commands.",summary_runs_agent:'Runs the agent "{agent}"',summary_runs_agent_none:"Runs an agent (none chosen yet)",summary_super_agent:"Calls the super-agent",summary_telegram:'Sends Telegram to "{channel}"',summary_runs_cmd:"Runs: {cmd}",summary_shell:"Runs a shell command",summary_heartbeat:"Leaves a heartbeat in the logs",action_agent_answers:'Agent "{agent}" answers the prompt',action_agent_pick_answers:"Agent (pick one) answers the prompt",action_super_answers:"The super-agent answers the prompt",action_telegram_channel:'Sends Telegram to channel "{channel}"',action_runs_shell:"Runs the shell command",step_pre:"Pre",step_post:"Post",last_label:"last:",tg_chat_id_ph:"(uses the channel's)",tg_text_ph:"message to send",hb_message_ph:"still alive",arg_placeholder:"--flag or value",remove_arg:"remove arg",super_agent_label:"{persona} (super-agent)",super_agent_badge:"super-agent"},modules_ui:{desktop_pos_left:"Left",desktop_pos_center:"Center",desktop_pos_right:"Right",desktop_theme_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"},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."}},Fb={es:cD,en:uD};function dD(){try{const e=localStorage.getItem(An.language);if(e&&e in Fb)return e}catch{}return"en"}let cp=dD();function fC(e){cp=e;try{localStorage.setItem(An.language,e)}catch{}}const pC=[{value:"es",label:"Español"},{value:"en",label:"English"}];function Gb(){return cp}function fD(e){const t=Fb[cp],s=e.split(".");let o=t;for(const l of s)if(o&&typeof o=="object"&&l in o)o=o[l];else return;return typeof o=="string"?o:void 0}function pD(e,t){return t?e.replace(/\{(\w+)\}/g,(s,o)=>o in t?String(t[o]):`{${o}}`):e}function mD(e){const t=fD(e);if(t!==void 0)return t;if(cp!=="es"){const s=Fb.es,o=e.split(".");let l=s;for(const c of o)if(l&&typeof l=="object"&&c in l)l=l[c];else return;return typeof l=="string"?l:void 0}}function f(e,t){const s=mD(e);return s===void 0?e:pD(s,t)}function Yb(e){const[t,s]=x.useState(!1);x.useEffect(()=>{try{s(localStorage.getItem(e)==="true")}catch{}},[e]);const o=x.useCallback(()=>s(l=>{const c=!l;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:t,toggle:o}}function hD({collapsed:e,onToggle:t}){return r.jsx(Ge,{content:f(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),side:"bottom",children:r.jsx("button",{type:"button",onClick:t,"aria-label":f(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(sS,{className:Te("size-4 transition-transform",e&&"rotate-180")})})})}function gD({sections:e,active:t,onChange:s,collapsed:o=!1}){return r.jsx("nav",{className:Te("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((l,c)=>r.jsxs("div",{className:Te("w-full",c>0&&"mt-2"),children:[!o&&l.title&&r.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:l.title}),r.jsx("div",{className:"space-y-0.5",children:l.items.map(({key:u,label:p,icon:m,badge:h})=>{const g=t===u,b=r.jsxs("button",{type:"button",onClick:()=>s(u),"data-testid":`tabnav-${u||"index"}`,className:Te("flex cursor-pointer items-center rounded-lg transition-colors",o?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",g?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[r.jsx(m,{className:"size-4 shrink-0"}),!o&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"flex-1 truncate text-left text-xs",children:p}),h!==void 0&&r.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:h})]})]});return o?r.jsx(Ge,{content:p,side:"right",children:b},u):r.jsx(x.Fragment,{children:b},u)})})]},c))})}const mC=0,hC=1,gC=2,zj=3;var Dj=Object.prototype.hasOwnProperty;function ux(e,t){var s,o;if(e===t)return!0;if(e&&t&&(s=e.constructor)===t.constructor){if(s===Date)return e.getTime()===t.getTime();if(s===RegExp)return e.toString()===t.toString();if(s===Array){if((o=e.length)===t.length)for(;o--&&ux(e[o],t[o]););return o===-1}if(!s||typeof e=="object"){o=0;for(s in e)if(Dj.call(e,s)&&++o&&!Dj.call(t,s)||!(s in t)||!ux(e[s],t[s]))return!1;return Object.keys(t).length===o}}return e!==e&&t!==t}const Ha=new WeakMap,qa=()=>{},Bn=qa(),dx=Object,St=e=>e===Bn,aa=e=>typeof e=="function",Dr=(e,t)=>({...e,...t}),xC=e=>aa(e.then),Zh={},kd={},Kb="undefined",Xc=typeof window!=Kb,fx=typeof document!=Kb,xD=Xc&&"Deno"in window,bD=()=>Xc&&typeof window.requestAnimationFrame!=Kb,bC=(e,t)=>{const s=Ha.get(e);return[()=>!St(t)&&e.get(t)||Zh,o=>{if(!St(t)){const l=e.get(t);t in kd||(kd[t]=l),s[5](t,Dr(l,o),l||Zh)}},s[6],()=>!St(t)&&t in kd?kd[t]:!St(t)&&e.get(t)||Zh]};let px=!0;const _D=()=>px,[mx,hx]=Xc&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[qa,qa],vD=()=>{const e=fx&&document.visibilityState;return St(e)||e!=="hidden"},yD=e=>(fx&&document.addEventListener("visibilitychange",e),mx("focus",e),()=>{fx&&document.removeEventListener("visibilitychange",e),hx("focus",e)}),jD=e=>{const t=()=>{px=!0,e()},s=()=>{px=!1};return mx("online",t),mx("offline",s),()=>{hx("online",t),hx("offline",s)}},wD={isOnline:_D,isVisible:vD},kD={initFocus:yD,initReconnect:jD},Lj=!Hc.useId,zl=!Xc||xD,SD=e=>bD()?window.requestAnimationFrame(e):setTimeout(e,1),Jh=zl?x.useEffect:x.useLayoutEffect,eg=typeof navigator<"u"&&navigator.connection,Pj=!zl&&eg&&(["slow-2g","2g"].includes(eg.effectiveType)||eg.saveData),Sd=new WeakMap,CD=e=>dx.prototype.toString.call(e),tg=(e,t)=>e===`[object ${t}]`;let ND=0;const gx=e=>{const t=typeof e,s=CD(e),o=tg(s,"Date"),l=tg(s,"RegExp"),c=tg(s,"Object");let u,p;if(dx(e)===e&&!o&&!l){if(u=Sd.get(e),u)return u;if(u=++ND+"~",Sd.set(e,u),Array.isArray(e)){for(u="@",p=0;p<e.length;p++)u+=gx(e[p])+",";Sd.set(e,u)}if(c){u="#";const m=dx.keys(e).sort();for(;!St(p=m.pop());)St(e[p])||(u+=p+":"+gx(e[p])+",");Sd.set(e,u)}}else u=o?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return u},Xb=e=>{if(aa(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?gx(e):"",[e,t]};let ED=0;const xx=()=>++ED;async function _C(...e){const[t,s,o,l]=e,c=Dr({populateCache:!0,throwOnError:!0},typeof l=="boolean"?{revalidate:l}:l||{});let u=c.populateCache;const p=c.rollbackOnError;let m=c.optimisticData;const h=v=>typeof p=="function"?p(v):p!==!1,g=c.throwOnError;if(aa(s)){const v=s,k=[],E=t.keys();for(const y of E)!/^\$(inf|sub)\$/.test(y)&&v(t.get(y)._k)&&k.push(y);return Promise.all(k.map(b))}return b(s);async function b(v){const[k]=Xb(v);if(!k)return;const[E,y]=bC(t,k),[j,C,S,N]=Ha.get(t),R=()=>{const B=j[k];return(aa(c.revalidate)?c.revalidate(E().data,v):c.revalidate!==!1)&&(delete S[k],delete N[k],B&&B[0])?B[0](gC).then(()=>E().data):E().data};if(e.length<3)return R();let M=o,T,z=!1;const D=xx();C[k]=[D,0];const U=!St(m),L=E(),H=L.data,O=L._c,P=St(O)?H:O;if(U&&(m=aa(m)?m(P,H):m,y({data:m,_c:P})),aa(M))try{M=M(P)}catch(B){T=B,z=!0}if(M&&xC(M))if(M=await M.catch(B=>{T=B,z=!0}),D!==C[k][0]){if(z)throw T;return M}else z&&U&&h(T)&&(u=!0,y({data:P,_c:Bn}));if(u&&!z)if(aa(u)){const B=u(M,P);y({data:B,error:Bn,_c:Bn})}else y({data:M,error:Bn,_c:Bn});if(C[k][1]=xx(),Promise.resolve(R()).then(()=>{y({_c:Bn})}),z){if(g)throw T;return}return M}}const Ij=(e,t)=>{for(const s in e)e[s][0]&&e[s][0](t)},RD=(e,t)=>{if(!Ha.has(e)){const s=Dr(kD,t),o=Object.create(null),l=_C.bind(Bn,e);let c=qa;const u=Object.create(null),p=(g,b)=>{const v=u[g]||[];return u[g]=v,v.push(b),()=>{const k=v.indexOf(b);k>=0&&(v[k]=v[v.length-1],v.pop())}},m=(g,b,v)=>{e.set(g,b);const k=u[g];if(k)for(const E of k)E(b,v)},h=()=>{if(!Ha.has(e)&&(Ha.set(e,[o,Object.create(null),Object.create(null),Object.create(null),l,m,p]),!zl)){const g=s.initFocus(setTimeout.bind(Bn,Ij.bind(Bn,o,mC))),b=s.initReconnect(setTimeout.bind(Bn,Ij.bind(Bn,o,hC)));c=()=>{g&&g(),b&&b(),Ha.delete(e)}}};return h(),[e,l,h,c]}return[e,Ha.get(e)[4]]},TD=(e,t,s,o,l)=>{const c=s.errorRetryCount,u=l.retryCount,p=~~((Math.random()+.5)*(1<<(u<8?u:8)))*s.errorRetryInterval;!St(c)&&u>c||setTimeout(o,p,l)},AD=ux,[vC,hf]=RD(new Map),MD=Dr({onLoadingSlow:qa,onSuccess:qa,onError:qa,onErrorRetry:TD,onDiscarded:qa,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:Pj?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:Pj?5e3:3e3,compare:AD,isPaused:()=>!1,cache:vC,mutate:hf,fallback:{}},wD),OD=(e,t)=>{const s=Dr(e,t);if(t){const{use:o,fallback:l}=e,{use:c,fallback:u}=t;o&&c&&(s.use=o.concat(c)),l&&u&&(s.fallback=Dr(l,u))}return s},zD=x.createContext({}),DD="$inf$",yC=Xc&&window.__SWR_DEVTOOLS_USE__,LD=yC?window.__SWR_DEVTOOLS_USE__:[],PD=()=>{yC&&(window.__SWR_DEVTOOLS_REACT__=Hc)},ID=e=>aa(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],jC=()=>{const e=x.useContext(zD);return x.useMemo(()=>Dr(MD,e),[e])},BD=e=>(t,s,o)=>e(t,s&&((...c)=>{const[u]=Xb(t),[,,,p]=Ha.get(vC);if(u.startsWith(DD))return s(...c);const m=p[u];return St(m)?s(...c):(delete p[u],m)}),o),UD=LD.concat(BD),HD=e=>function(...s){const o=jC(),[l,c,u]=ID(s),p=OD(o,u);let m=e;const{use:h}=p,g=(h||[]).concat(UD);for(let b=g.length;b--;)m=g[b](m);return m(l,c||p.fetcher||null,p)},VD=(e,t,s)=>{const o=t[e]||(t[e]=[]);return o.push(s),()=>{const l=o.indexOf(s);l>=0&&(o[l]=o[o.length-1],o.pop())}};PD();const ng=Hc.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}}),sg={dedupe:!0},gf=Promise.resolve(Bn);gf.status="fulfilled";gf.value=Bn;const qD=()=>qa,$D=(e,t,s)=>{const{cache:o,compare:l,suspense:c,fallbackData:u,revalidateOnMount:p,revalidateIfStale:m,refreshInterval:h,refreshWhenHidden:g,refreshWhenOffline:b,keepPreviousData:v,strictServerPrefetchWarning:k}=s,[E,y,j,C]=Ha.get(o),[S,N]=Xb(e),R=x.useRef(!1),M=x.useRef(!1),T=x.useRef(S),z=x.useRef(t),D=x.useRef(s),U=()=>D.current,L=()=>U().isVisible()&&U().isOnline(),[H,O,P,B]=bC(o,S),$=x.useRef({}).current,q=St(u)?St(s.fallback)?Bn:s.fallback[S]:u,X=(we,Re)=>{for(const ve in $){const Ce=ve;if(Ce==="data"){if(!l(we[Ce],Re[Ce])&&(!St(we[Ce])||!l(ee,Re[Ce])))return!1}else if(Re[Ce]!==we[Ce])return!1}return!0},Y=!R.current,F=x.useMemo(()=>{const we=H(),Re=B(),ve=Ie=>{const le=Dr(Ie);return delete le._k,(()=>{if(!S||!t||U().isPaused())return!1;if(Y&&!St(p))return p;const qe=St(q)?le.data:q;return St(qe)||m})()?{isValidating:!0,isLoading:!0,...le}:le},Ce=ve(we),De=we===Re?Ce:ve(Re);let Pe=Ce;return[()=>{const Ie=ve(H());return X(Ie,Pe)?(Pe.data=Ie.data,Pe.isLoading=Ie.isLoading,Pe.isValidating=Ie.isValidating,Pe.error=Ie.error,Pe):(Pe=Ie,Ie)},()=>De]},[o,S]),K=cf.useSyncExternalStore(x.useCallback(we=>P(S,(Re,ve)=>{X(ve,Re)||we()}),[o,S]),F[0],F[1]),I=E[S]&&E[S].length>0,G=K.data,Z=St(G)?q&&xC(q)?ng(q):q:G,te=K.error,de=x.useRef(Z),ee=v?St(G)?St(de.current)?Z:de.current:G:Z,ne=S&&St(Z),ae=x.useRef(null);!zl&&cf.useSyncExternalStore(qD,()=>(ae.current=!1,ae),()=>(ae.current=!0,ae));const pe=ae.current;k&&pe&&!c&&ne&&console.warn(`Missing pre-initiated data for serialized key "${S}" 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 Me=!S||!t||U().isPaused()||I&&!St(te)?!1:Y&&!St(p)?p:c?St(Z)?!1:m:St(Z)||m,ue=Y&&Me,me=St(K.isValidating)?ue:K.isValidating,ke=St(K.isLoading)?ue:K.isLoading,je=x.useCallback(async we=>{const Re=z.current;if(!S||!Re||M.current||U().isPaused())return!1;let ve,Ce,De=!0;const Pe=we||{},Ie=!j[S]||!Pe.dedupe,le=()=>Lj?!M.current&&S===T.current&&R.current:S===T.current,_e={isValidating:!1,isLoading:!1},qe=()=>{O(_e)},Ne=()=>{const et=j[S];et&&et[1]===Ce&&delete j[S]},Oe={isValidating:!0};St(H().data)&&(Oe.isLoading=!0);try{if(Ie&&(O(Oe),s.loadingTimeout&&St(H().data)&&setTimeout(()=>{De&&le()&&U().onLoadingSlow(S,s)},s.loadingTimeout),j[S]=[Re(N),xx()]),[ve,Ce]=j[S],ve=await ve,Ie&&setTimeout(Ne,s.dedupingInterval),!j[S]||j[S][1]!==Ce)return Ie&&le()&&U().onDiscarded(S),!1;_e.error=Bn;const et=y[S];if(!St(et)&&(Ce<=et[0]||Ce<=et[1]||et[1]===0))return qe(),Ie&&le()&&U().onDiscarded(S),!1;const at=H().data;_e.data=l(at,ve)?at:ve,Ie&&le()&&U().onSuccess(ve,S,s)}catch(et){Ne();const at=U(),{shouldRetryOnError:vt}=at;at.isPaused()||(_e.error=et,Ie&&le()&&(at.onError(et,S,at),(vt===!0||aa(vt)&&vt(et))&&(!U().revalidateOnFocus||!U().revalidateOnReconnect||L())&&at.onErrorRetry(et,S,at,Mt=>{const lt=E[S];lt&&lt[0]&&lt[0](zj,Mt)},{retryCount:(Pe.retryCount||0)+1,dedupe:!0})))}return De=!1,qe(),!0},[S,o]),Be=x.useCallback((...we)=>_C(o,T.current,...we),[]);if(Jh(()=>{z.current=t,D.current=s,St(G)||(de.current=G)}),Jh(()=>{if(!S)return;const we=je.bind(Bn,sg);let Re=0;U().revalidateOnFocus&&(Re=Date.now()+U().focusThrottleInterval);const Ce=VD(S,E,(De,Pe={})=>{if(De==mC){const Ie=Date.now();U().revalidateOnFocus&&Ie>Re&&L()&&(Re=Ie+U().focusThrottleInterval,we())}else if(De==hC)U().revalidateOnReconnect&&L()&&we();else{if(De==gC)return je();if(De==zj)return je(Pe)}});return M.current=!1,T.current=S,R.current=!0,O({_k:N}),Me&&(j[S]||(St(Z)||zl?we():SD(we))),()=>{M.current=!0,Ce()}},[S]),Jh(()=>{let we;function Re(){const Ce=aa(h)?h(H().data):h;Ce&&we!==-1&&(we=setTimeout(ve,Ce))}function ve(){!H().error&&(g||U().isVisible())&&(b||U().isOnline())?je(sg).then(Re):Re()}return Re(),()=>{we&&(clearTimeout(we),we=-1)}},[h,g,b,S]),x.useDebugValue(ee),c){if(!Lj&&zl&&ne)throw new Error("Fallback data is required when using Suspense in SSR.");ne&&(z.current=t,D.current=s,M.current=!1);const we=C[S],Re=!St(we)&&ne?Be(we):gf;if(ng(Re),!St(te)&&ne)throw te;const ve=ne?je(sg):gf;!St(ee)&&ne&&(ve.status="fulfilled",ve.value=!0),ng(ve)}return{mutate:Be,get data(){return $.data=!0,ee},get error(){return $.error=!0,te},get isValidating(){return $.isValidating=!0,me},get isLoading(){return $.isLoading=!0,ke}}},We=HD($D);let Fl=null;function po(e){Fl=e}function Qb(){return Fl}class Qc extends Error{status;body;constructor(t,s,o){super(s),this.status=t,this.body=o}}async function tc(e,t,s,o={}){const l={"content-type":"application/json",...Fl?{authorization:`Bearer ${Fl}`}:{},...o.headers||{}},c=await fetch(t,{...o,method:e,headers:l,body:s!==void 0?JSON.stringify(s):void 0});if(!c.ok){let u="",p=null;try{p=await c.json(),u=p?.error||JSON.stringify(p)}catch{u=await c.text()}throw new Qc(c.status,`${e} ${t} → ${c.status}: ${u}`,p)}if(c.status!==204)return await c.json()}function Cl(e){const t=e;if(Array.isArray(e))return{items:e,total:e.length};if(t&&Array.isArray(t.data)){const s=t.data;return{items:s,total:typeof t.meta?.total=="number"?t.meta.total:s.length}}if(t&&Array.isArray(t.sessions)){const s=t.sessions;return{items:s,total:s.length}}return{items:[],total:0}}const he={get:e=>tc("GET",e),post:(e,t)=>tc("POST",e,t),put:(e,t)=>tc("PUT",e,t),patch:(e,t)=>tc("PATCH",e,t),del:e=>tc("DELETE",e)};async function wC(e,t,s,o){const l=await fetch(e,{method:"POST",signal:o,headers:{"content-type":"application/json",...Fl?{authorization:`Bearer ${Fl}`}:{}},body:JSON.stringify(t)});if(!l.ok||!l.body){const m=await l.text().catch(()=>"");throw new Qc(l.status,`POST ${e} → ${l.status}: ${m||"stream failed"}`)}const c=l.body.getReader(),u=new TextDecoder("utf-8");let p="";for(;;){const{value:m,done:h}=await c.read();if(h)break;p+=u.decode(m,{stream:!0});let g=p.indexOf(`
621
- `);for(;g>=0;){const b=p.slice(0,g).trim();if(p=p.slice(g+1),b)try{s(JSON.parse(b))}catch{}g=p.indexOf(`
622
- `)}}if(p.trim())try{s(JSON.parse(p.trim()))}catch{}}const FD={get:()=>he.get("/health")},ls={list:()=>he.get("/projects"),register:e=>he.post("/projects",{path:e}),remove:e=>he.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>he.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>he.get(`/projects/${e}/config`),set:(e,t)=>he.patch(`/projects/${e}/config`,{set:t}),unset:(e,t)=>he.patch(`/projects/${e}/config`,{unset:t}),put:(e,t)=>he.put(`/projects/${e}/config`,t)},apcProject:{set:(e,t,s)=>he.patch(`/projects/${e}/apc-project`,{set:t,unset:s}),put:(e,t)=>he.put(`/projects/${e}/apc-project`,t)},memory:{get:e=>he.get(`/projects/${e}/memory`),put:(e,t)=>he.put(`/projects/${e}/memory`,{body:t})}},ln={list:e=>he.get(`/projects/${e}/agents`),get:(e,t)=>he.get(`/projects/${e}/agents/${t}`),create:(e,t)=>he.post(`/projects/${e}/agents`,t),update:(e,t,s)=>he.patch(`/projects/${e}/agents/${encodeURIComponent(t)}`,s),remove:(e,t)=>he.del(`/projects/${e}/agents/${encodeURIComponent(t)}`),chat:(e,t,s)=>he.post(`/projects/${e}/agents/${encodeURIComponent(t)}/chat`,s),memory:{get:(e,t)=>he.get(`/projects/${e}/agents/${t}/memory`),put:(e,t,s)=>he.put(`/projects/${e}/agents/${t}/memory`,{body:s})},vault:e=>he.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,t={},s="")=>he.post("/agents/vault",{slug:e,fields:t,body:s}),vaultPatch:(e,t)=>he.patch(`/agents/vault/${encodeURIComponent(e)}`,t),vaultRemove:e=>he.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>he.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,t)=>he.post(`/projects/${e}/agents/import`,{slug:t})},wo={list:(e,t)=>he.get(`/projects/${e}/agents/${t}/conversations`),get:(e,t,s)=>he.get(`/projects/${e}/agents/${t}/conversations/${s}`),threads:e=>he.get(`/projects/${e}/super-agent/threads`),thread:(e,t,s)=>he.get(`/projects/${e}/super-agent/threads/${t}/${s}`),remove:(e,t,s)=>he.del(`/projects/${e}/agents/${t}/conversations/${s}`),removeThread:(e,t,s)=>he.del(`/projects/${e}/super-agent/threads/${t}/${s}`),compact:(e,t,s)=>he.post(s?`/projects/${e}/agents/${t}/conversations/${s}/compact`:`/projects/${e}/agents/${t}/compact`,{})},Cr={list:e=>he.get(`/projects/${e}/routines`),get:(e,t)=>he.get(`/projects/${e}/routines/${t}`),run:(e,t)=>he.post(`/projects/${e}/routines/${t}/run`),enable:(e,t)=>he.post(`/projects/${e}/routines/${t}/enable`),disable:(e,t)=>he.post(`/projects/${e}/routines/${t}/disable`),upsert:(e,t)=>he.post(`/projects/${e}/routines`,t),remove:(e,t)=>he.del(`/projects/${e}/routines/${encodeURIComponent(t)}`)},Nr={list:(e,t="open")=>he.get(`/projects/${e}/tasks?state=${t}`).then(s=>Cl(s).items),global:(e="open")=>he.get(`/tasks?state=${e}`).then(t=>Cl(t).items),listPage:(e,{state:t,limit:s,offset:o})=>he.get(`/projects/${e}/tasks?state=${t}&limit=${s}&offset=${o}`).then(l=>Cl(l)),globalPage:({state:e,limit:t,offset:s})=>he.get(`/tasks?state=${e}&limit=${t}&offset=${s}`).then(o=>Cl(o)),add:(e,t)=>he.post(`/projects/${e}/tasks`,t),done:(e,t)=>he.post(`/projects/${e}/tasks/${t}/done`),drop:(e,t)=>he.post(`/projects/${e}/tasks/${t}/drop`),reopen:(e,t)=>he.post(`/projects/${e}/tasks/${t}/reopen`)},Er={list:e=>he.get(`/projects/${e}/mcps`),check:e=>he.get(`/projects/${e}/mcps/check`),add:(e,t,s)=>he.post(`/projects/${e}/mcps?scope=${t}`,s),remove:(e,t,s="shared")=>he.del(`/projects/${e}/mcps/${encodeURIComponent(t)}?scope=${s}`),test:(e,t)=>he.post(`/projects/${e}/mcps/${encodeURIComponent(t)}/test`,{}),logs:(e,t)=>he.get(`/projects/${e}/mcps/${encodeURIComponent(t)}/logs`)},Lc={list:(e,t={})=>he.get(`/projects/${e}/vars${t.reveal?"?reveal=1":""}`),get:(e,t,s={})=>he.get(`/projects/${e}/vars/${encodeURIComponent(t)}${s.reveal?"?reveal=1":""}`),upsert:(e,t)=>he.post(`/projects/${e}/vars`,t),remove:(e,t,s="project")=>he.del(`/projects/${e}/vars/${encodeURIComponent(t)}?scope=${s}`)},ag=e=>{const t=new URLSearchParams;for(const[o,l]of Object.entries(e))l!==void 0&&l!==""&&t.set(o,String(l));const s=t.toString();return s?`?${s}`:""},xf={global:(e={})=>he.get(`/messages/global${ag(e)}`),project:(e,t={})=>he.get(`/projects/${e}/messages${ag(t)}`),search:(e,t,s=50)=>he.get(`/projects/${e}/messages/search${ag({q:t,limit:s})}`)},GD={global:e=>he.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`).then(t=>({sessions:Cl(t).items})),page:({engine:e,q:t,deep:s,limit:o,offset:l})=>{const c=new URLSearchParams({limit:String(o),offset:String(l)});return e&&c.set("engine",e),t?.trim()&&c.set("q",t.trim()),s&&c.set("deep","1"),he.get(`/sessions?${c.toString()}`).then(u=>Cl(u))}},YD={list:()=>he.get("/tools")},Mn={channels:{list:()=>he.get("/telegram/channels"),upsert:e=>he.post("/telegram/channels",e),patch:(e,t)=>he.patch(`/telegram/channels/${e}`,t),remove:e=>he.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>he.get("/telegram/contacts"),patch:(e,t)=>he.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,t),remove:e=>he.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>he.get("/telegram/roles"),set:(e,t)=>he.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:t}),remove:e=>he.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>he.get("/telegram/status"),start:()=>he.post("/telegram/start"),stop:()=>he.post("/telegram/stop"),send:e=>he.post("/telegram/send",e)},bf={list:()=>he.get("/engines"),models:e=>he.post("/engines/models",e)},Gl={reload:()=>he.post("/admin/reload"),shutdown:()=>he.post("/admin/shutdown"),config:{get:()=>he.get("/admin/config"),patch:e=>he.patch("/admin/config",e)},superAgent:()=>he.get("/admin/super-agent"),logs:(e="errors",t=200)=>he.get(`/admin/logs?file=${e}&limit=${t}`)},Yl={list:()=>he.get("/pair/list"),revoke:e=>he.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>he.post("/pair/init",{}),status:e=>he.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>he.post("/pair/confirm",e)},Bj={get:()=>he.get("/identity"),patch:e=>he.patch("/identity",e)},kC={send:(e,t)=>he.post(`/projects/${e}/super-agent/chat`,t),stream:(e,t,s,o)=>wC(`/projects/${e}/super-agent/chat/stream`,t,s,o),summarize:e=>he.post("/super-agent/summarize",e)},Uj={dirs:e=>he.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`),pickDir:e=>he.get(`/admin/fs/pick-dir${e?`?prompt=${encodeURIComponent(e)}`:""}`)},KD=["alloy","echo","fable","onyx","nova","shimmer"],XD=["Kore","Puck","Charon","Fenrir","Aoede"],QD=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],WD=["tts-1","tts-1-hd"],ZD=["happy","sad","excited","angry","calm","whisper","shout","laugh","cry","narrator","neutral"],JD=["tiny","base","small","medium","large-v2","large-v3","large-v3-turbo"],_f={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 eL(e){const t=Qb(),s=await fetch(`/voice/tts?path=${encodeURIComponent(e)}`,{headers:t?{authorization:`Bearer ${t}`}:{}});if(!s.ok){const l=await s.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${s.status}): ${l.slice(0,160)}`)}const o=await s.blob();return URL.createObjectURL(o)}const vf={providers:()=>he.get("/tts/providers"),sttHardware:()=>he.get("/transcribe/hardware"),sttModels:e=>he.get(`/transcribe/models?backend=${e}`),say:e=>he.post("/tts/say",e),turn:e=>he.post("/voice/turn",e)},SC={manifest:()=>he.get("/deck/manifest"),setWidget:(e,t)=>he.patch(`/deck/widgets/${encodeURIComponent(e)}`,t),exec:e=>he.post("/deck/exec",e)},io=e=>`/projects/${e}/code/sessions`,Ia={sessions:{list:e=>he.get(io(e)).then(t=>t.sessions),get:(e,t)=>he.get(`${io(e)}/${t}`),create:(e,t={})=>he.post(io(e),t),update:(e,t,s)=>he.patch(`${io(e)}/${t}`,s),remove:(e,t)=>he.del(`${io(e)}/${t}`)},changes:(e,t)=>he.get(`${io(e)}/${t}/changes`),stream:(e,t,s,o,l)=>wC(`${io(e)}/${t}/chat/stream`,s,o,l)},Tr={list:e=>he.get(`/projects/${encodeURIComponent(e)}/artifacts`),read:(e,t)=>he.get(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),run:(e,t,s=[])=>he.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/run`,{args:s}),remove:(e,t)=>he.del(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),write:(e,t,s)=>he.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{content:s}),rename:(e,t,s)=>he.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{newName:s})},pc={list:e=>he.get(e?`/skills?project_path=${encodeURIComponent(e)}`:"/skills"),inspector:()=>he.get("/skills/inspector"),updateInspector:e=>he.put("/skills/inspector",e),index:(e={})=>he.post("/skills/index",e),inspect:(e,t)=>he.post("/skills/inspect",{prompt:e,project_path:t})};function Wc(){const{data:e,error:t,isLoading:s,mutate:o}=We("/projects",()=>ls.list(),{refreshInterval:Pf.projects});return{projects:(e||[]).slice().sort((c,u)=>{const p=Number(c.id),m=Number(u.id);return p===0&&m!==0?-1:m===0&&p!==0?1:p-m}),error:t,isLoading:s,mutate:o}}function Wb(e){const{projects:t,isLoading:s,mutate:o}=Wc();return{project:t.find(c=>String(c.id)===e)??null,isLoading:s,mutate:o}}function Zb(){const{data:e,error:t,isLoading:s,mutate:o}=We("/identity",()=>Bj.get());return{identity:e||{},error:t,isLoading:s,mutate:o,save:async c=>{const u=await Bj.patch(c);return await o(u,{revalidate:!1}),u}}}function up(){const{identity:e}=Zb();return e?.agent_name?.trim()||"APX"}function tL(){return[{id:"desktop",label:f("nav.modules.desktop"),href:"/m/desktop",icon:Yx},{id:"code",label:f("nav.modules.code"),href:"/m/code",icon:Ga}]}function nL(e,t,s){const[o,l]=x.useState(t);return x.useLayoutEffect(()=>{const c=e.current;if(!c||!s)return;const u=()=>{const m=getComputedStyle(c),h=(parseFloat(m.paddingTop)||0)+(parseFloat(m.paddingBottom)||0),g=c.clientHeight-h;if(g<=0)return;const b=parseFloat(m.rowGap)||12,k=(c.querySelector("[data-rail-probe]")?.offsetHeight??56)+b,y=Math.max(0,Math.floor((g+b)/k))-1;l(y>=t?t:Math.max(0,y-1))};u();const p=new ResizeObserver(u);return p.observe(c),()=>p.disconnect()},[e,t,s]),s?Math.min(o,t):t}function Hj({projects:e,label:t,sublabel:s,icon:o,tooltip:l,header:c,active:u,testId:p,onSelect:m,isActive:h}){return r.jsxs(cC,{children:[r.jsxs(uC,{"data-testid":p,title:l,"aria-label":l,className:"group flex w-full cursor-pointer flex-col items-center gap-1",children:[r.jsx("span",{className:Te("flex size-10 items-center justify-center rounded-xl text-xs font-bold transition-all","bg-muted/40 text-muted-fg hover:bg-accent hover:text-foreground",u&&"ring-2 ring-foreground ring-offset-2 ring-offset-card"),children:o??t}),s&&r.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:s})]}),r.jsxs(dC,{side:"right",align:"start",sideOffset:8,className:"max-h-[70vh] w-64",children:[r.jsx("div",{className:"px-1.5 py-1 text-xs font-medium text-muted-foreground",children:c}),e.map(g=>{const b=g.name||g.path.split("/").pop()||String(g.id),v=`/p/${g.id}`,{initials:k,idleClass:E}=cz(b);return r.jsxs(oD,{"data-testid":`project-menu-item-${g.id}`,onClick:()=>m(v),className:Te(h(v)&&"bg-accent/60 text-foreground"),children:[r.jsx("span",{className:Te("flex size-6 shrink-0 items-center justify-center rounded-md text-[10px] font-bold",E),children:k}),r.jsx("span",{className:"truncate",children:b})]},g.id)})]})]})}function sL({onSelect:e,onOpenRoby:t,onOpenAddProject:s}){const{projects:o,isLoading:l}=Wc(),c=Zn(),u=tL(),p=up(),m=x.useRef(null),{collapsed:h,toggle:g}=Yb(An.sidebarCollapsed+".projects"),b=S=>c.pathname===S||c.pathname.startsWith(`${S}/`),v=o.find(S=>String(S.id)==="0"),k=o.filter(S=>String(S.id)!=="0").sort((S,N)=>Number(N.id)-Number(S.id)),E=nL(m,k.length,!h&&k.length>0),y=k.slice(0,E),j=k.slice(E),C=j.some(S=>b(`/p/${S.id}`));return r.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-hidden bg-transparent py-3",children:[r.jsx(Ge,{content:f("nav.apx_admin"),side:"right",children:r.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:r.jsx(d3,{size:36})})}),l&&r.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),v&&r.jsx(vl,{label:f("base.title"),testId:"project-avatar-0",title:f("base.subtitle"),active:b("/p/0"),isDefault:!0,icon:r.jsx("img",{src:"/modules/superagent.png",alt:f("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),u.map(S=>r.jsx(vl,{label:S.label,testId:`module-avatar-${S.id}`,title:S.label,active:b(S.href),icon:r.jsx(S.icon,{size:18}),onClick:()=>e(S.href)},S.id)),r.jsxs("div",{className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3",children:[k.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),r.jsx(Ge,{content:f(h?"nav.expand_projects":"nav.collapse_projects"),side:"right",children:r.jsx("button",{type:"button",onClick:g,"data-testid":"nav-toggle-projects","aria-label":f(h?"nav.expand_projects":"nav.collapse_projects"),"aria-expanded":!h,className:"flex h-5 w-8 cursor-pointer items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(pa,{className:Te("size-3.5 transition-transform",h&&"-rotate-90")})})})]}),r.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:[k.length>0&&h&&r.jsx(Hj,{projects:k,icon:r.jsx(zM,{size:18}),sublabel:String(k.length),tooltip:f("nav.all_projects"),header:f("nav.all_projects"),active:k.some(S=>b(`/p/${S.id}`)),testId:"nav-projects-folder",onSelect:e,isActive:b}),k.length>0&&!h&&r.jsxs(r.Fragment,{children:[r.jsx("div",{"data-rail-probe":!0,"aria-hidden":!0,className:"invisible absolute w-full",children:r.jsx(vl,{label:"Ag",active:!1,onClick:()=>{}})}),y.map(S=>{const N=S.name||S.path.split("/").pop()||String(S.id),R=`/p/${S.id}`;return r.jsx("div",{"data-rail-item":!0,className:"w-full",children:r.jsx(vl,{label:N,testId:`project-avatar-${S.id}`,title:`${N} — ${S.path}`,active:b(R),onClick:()=>e(R)})},S.id)}),j.length>0&&r.jsx(Hj,{projects:j,label:`+${j.length}`,tooltip:f("nav.more_projects",{count:j.length}),header:f("nav.more_projects",{count:j.length}),active:C,testId:"nav-projects-overflow",onSelect:e,isActive:b})]}),r.jsx(vl,{label:f("nav.add_project"),isAdd:!0,testId:"nav-add-project",icon:r.jsx(an,{size:18}),active:!1,onClick:()=>s?s():e("/?action=add-project"),title:f("nav.add_project")})]})]}),r.jsx(vl,{label:f("nav.settings"),isSettings:!0,testId:"nav-settings",icon:r.jsx(Tc,{size:16}),active:c.pathname==="/settings"||c.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:f("nav.settings")}),r.jsx(Ge,{content:f("settings_ui.documentation"),side:"right",children:r.jsx("a",{href:"https://agentprojectcontext.github.io/apx/docs/",target:"_blank",rel:"noopener noreferrer","data-testid":"nav-docs","aria-label":f("settings_ui.documentation"),className:"flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(pM,{size:18})})}),r.jsx(Ge,{content:f("superagent.talk",{persona:p}),side:"right",children:r.jsx("button",{type:"button",onClick:t,"data-testid":"nav-roby","aria-label":f("superagent.talk",{persona:p}),className:"flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(on,{size:18})})})]})}function CC(e){switch(e){case"personal":return f("settings_ui.kind_personal");case"company":return f("settings_ui.kind_company");case"app":return f("settings_ui.kind_app");case"software":return f("settings_ui.kind_software");case"default":return f("settings_ui.kind_default");case"other":return f("settings_ui.kind_other");default:return f("nav.project")}}function Ye({title:e,description:t,action:s,className:o,children:l,fullHeight:c}){return r.jsxs("section",{className:Te("rounded-xl border border-border bg-card p-5",c&&"flex h-full min-h-0 flex-col",o),children:[r.jsxs("header",{className:Te("mb-4 flex items-start justify-between gap-4",c&&"shrink-0"),children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),t&&r.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:t})]}),s]}),r.jsx("div",{className:Te(c&&"flex min-h-0 flex-1 flex-col"),children:l})]})}function Vj({children:e}){return r.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-fg",children:e})}function Zc({ok:e}){return r.jsx("span",{className:Te("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const aL=x.forwardRef(function(t,s){const{render:o,className:l,disabled:c=!1,focusableWhenDisabled:u=!1,nativeButton:p=!0,style:m,...h}=t,{getButtonProps:g,buttonRef:b}=Vr({disabled:c,focusableWhenDisabled:u,native:p});return Et("button",t,{state:{disabled:c},ref:[s,b],props:[h,g]})}),qj=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,$j=Ac,Jb=(e,t)=>s=>{var o;if(t?.variants==null)return $j(e,s?.class,s?.className);const{variants:l,defaultVariants:c}=t,u=Object.keys(l).map(h=>{const g=s?.[h],b=c?.[h];if(g===null)return null;const v=qj(g)||qj(b);return l[h][v]}),p=s&&Object.entries(s).reduce((h,g)=>{let[b,v]=g;return v===void 0||(h[b]=v),h},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((h,g)=>{let{class:b,className:v,...k}=g;return Object.entries(k).every(E=>{let[y,j]=E;return Array.isArray(j)?j.includes({...c,...p}[y]):{...c,...p}[y]===j})?[...h,b,v]:h},[]);return $j(e,u,m,s?.class,s?.className)},rL=Jb("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 Qa({className:e,variant:t="default",size:s="default",...o}){return r.jsx(aL,{"data-slot":"button",className:Ct(rL({variant:t,size:s,className:e})),...o})}let Fj=(function(e){return e.disabled="data-disabled",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const oL={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},mc={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},lL={disabled:!1,...mc},e_={valid(e){return e===null?null:e?{[Fj.valid]:""}:{[Fj.invalid]:""}}},iL={invalid:void 0,name:void 0,validityData:{state:oL,errors:[],error:"",value:"",initialValue:null},setValidityData:Rn,disabled:void 0,touched:mc.touched,setTouched:Rn,dirty:mc.dirty,setDirty:Rn,filled:mc.filled,setFilled:Rn,focused:mc.focused,setFocused:Rn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:lL,markedDirtyRef:{current:!1},registerFieldControl:Rn,validation:{getValidationProps:(e,t=Gt)=>t,inputRef:{current:null},registerInput:Rn,commit:async()=>{},change:Rn}},cL=x.createContext(iL);function Jc(e=!0){const t=x.useContext(cL);if(t.setValidityData===Rn&&!e)throw new Error(rn(28));return t}const uL=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Rn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function t_(){return x.useContext(uL)}const dL=x.createContext({controlId:void 0,registerControlId:Rn,labelId:void 0,setLabelId:Rn,messageIds:[],setMessageIds:Rn,getDescriptionProps:e=>e});function dp(){return x.useContext(dL)}function fL(e,t,s,o=!0,l){const[c,u]=x.useState(),p=Ks(l?`${l}-label`:void 0),m=e??t??c;return ze(()=>{const h=e||t||!o?void 0:pL(s.current,p);c!==h&&u(h)}),m}function pL(e,t){const s=mL(e);if(s)return!s.id&&t&&(s.id=t),s.id||void 0}function mL(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const s=e.id;if(s){const l=e.nextElementSibling;if(l&&l.htmlFor===s)return l}const o=e.labels;return o&&o[0]}function fp(e={}){const{id:t,implicit:s=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=dp(),u=Ks(t),p=s?l:void 0,m=Wn(()=>Symbol("labelable-control")),h=x.useRef(!1),g=x.useRef(t!=null),b=Ue(()=>{!h.current||c===Rn||(h.current=!1,c(m.current,void 0))});return ze(()=>{if(c===Rn)return;let v;if(s){const k=o?.current;gt(k)&&k.closest("label")!=null?v=t??null:v=p??u}else if(t!=null)g.current=!0,v=t;else if(g.current)v=u;else{b();return}if(v===void 0){b();return}h.current=!0,c(m.current,v)},[t,o,p,c,s,u,m,b]),x.useEffect(()=>b,[b]),l??u}function n_(e,t,s,o,l=!0,c){const{registerFieldControl:u}=Jc(),p=x.useRef(null);p.current||(p.current=Symbol()),ze(()=>{const m=p.current;return!m||!l?void 0:(u(m,{controlRef:e,getValue:o,id:t,name:c,value:s}),()=>{u(m,void 0)})},[e,l,o,t,c,u,s])}const hL=x.forwardRef(function(t,s){const{render:o,className:l,id:c,name:u,value:p,disabled:m=!1,onValueChange:h,defaultValue:g,autoFocus:b=!1,style:v,...k}=t,{state:E,name:y,disabled:j,setTouched:C,setDirty:S,validityData:N,setFocused:R,setFilled:M,validationMode:T,validation:z}=Jc(),{clearErrors:D}=t_(),U=j||m,L=y??u,H={...E,disabled:U},{labelId:O}=dp(),P=fp({id:c});ze(()=>{const K=p!=null;z.inputRef.current?.value||K&&p!==""?M(!0):K&&p===""&&M(!1)},[z.inputRef,M,p]);const B=x.useRef(null);ze(()=>{b&&B.current===qn(ht(B.current))&&R(!0)},[b,R]);const[$]=$l({controlled:p,default:g,name:"FieldControl",state:"value"}),q=p!==void 0,X=q?$:void 0,Y=Ue(()=>z.inputRef.current?.value);return n_(z.inputRef,P,X,Y,!U,u),Et("input",t,{ref:[s,B],state:H,props:[{id:P,disabled:U,name:L,ref:z.inputRef,"aria-labelledby":O,autoFocus:b,...q?{value:X}:{defaultValue:g},onChange(K){const I=K.currentTarget.value;h?.(I,nt(fa,K.nativeEvent)),S(I!==N.initialValue),M(I!==""),K.nativeEvent.defaultPrevented||(D(L),z.change(I))},onFocus(){R(!0)},onBlur(K){C(!0),R(!1),T==="onBlur"&&z.commit(K.currentTarget.value)},onKeyDown(K){K.currentTarget.tagName==="INPUT"&&K.key==="Enter"&&(C(!0),z.commit(K.currentTarget.value))}},k,K=>z.getValidationProps(U,K)],stateAttributesMapping:e_})}),gL=x.forwardRef(function(t,s){return r.jsx(hL,{ref:s,...t})});function xL({className:e,type:t,...s}){return r.jsx(gL,{type:t,"data-slot":"input",className:Ct("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...s})}function bL({className:e,...t}){return r.jsx("textarea",{"data-slot":"textarea",className:Ct("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 _L(e){return Et(e.defaultTagName??"div",e,e)}const vL=Jb("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 yL({className:e,variant:t="default",render:s,...o}){return _L({defaultTagName:"span",props:Fn({className:Ct(vL({variant:t}),e)},o),render:s,state:{slot:"badge",variant:t}})}const NC=x.createContext(void 0);function jL(){const e=x.useContext(NC);if(e===void 0)throw new Error(rn(63));return e}let Gj=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.readonly="data-readonly",e.required="data-required",e.valid="data-valid",e.invalid="data-invalid",e.touched="data-touched",e.dirty="data-dirty",e.filled="data-filled",e.focused="data-focused",e})({});const EC={...e_,checked(e){return e?{[Gj.checked]:""}:{[Gj.unchecked]:""}}},wL=x.forwardRef(function(t,s){const{checked:o,className:l,defaultChecked:c,"aria-labelledby":u,form:p,id:m,inputRef:h,name:g,nativeButton:b=!1,onCheckedChange:v,readOnly:k=!1,required:E=!1,disabled:y=!1,render:j,uncheckedValue:C,value:S,style:N,...R}=t,{clearErrors:M}=t_(),{state:T,setTouched:z,setDirty:D,validityData:U,setFilled:L,setFocused:H,validationMode:O,disabled:P,name:B,validation:$}=Jc(),{labelId:q}=dp(),X=P||y,Y=B??g,F=x.useRef(null),K=Ka(F,h,$.inputRef),I=x.useRef(null),G=Ks(),Z=fp({id:m,implicit:!1,controlRef:I}),te=b?void 0:Z,[de,ee]=$l({controlled:o,default:!!c,name:"Switch",state:"checked"});n_(I,G,de,void 0,!X,g),ze(()=>{F.current&&L(F.current.checked)},[F,L]),qb(de,()=>{M(Y),D(de!==U.initialValue),L(de),$.change(de)});const{getButtonProps:ne,buttonRef:ae}=Vr({disabled:X,native:b}),pe=fL(u,q,F,!b,te),Me={id:b?Z:G,role:"switch","aria-checked":de,"aria-readonly":k||void 0,"aria-required":E||void 0,"aria-labelledby":pe,onFocus(){X||H(!0)},onBlur(){const je=F.current;!je||X||(z(!0),H(!1),O==="onBlur"&&$.commit(je.checked))},onClick(je){if(k||X)return;je.preventDefault();const Be=F.current;Be&&Be.dispatchEvent(new(Xt(Be)).PointerEvent("click",{bubbles:!0,shiftKey:je.shiftKey,ctrlKey:je.ctrlKey,altKey:je.altKey,metaKey:je.metaKey}))}},ue=Fn({checked:de,disabled:X,form:p,id:te,name:Y,required:E,style:Y?ES:ub,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:K,onChange(je){if(je.nativeEvent.defaultPrevented)return;if(k){je.preventDefault();return}const Be=je.currentTarget.checked,He=nt(fa,je.nativeEvent);v?.(Be,He),!He.isCanceled&&ee(Be)},onFocus(){I.current?.focus()}},je=>$.getValidationProps(X,je),S!==void 0?{value:S}:Gt),me=x.useMemo(()=>({...T,checked:de,disabled:X,readOnly:k,required:E}),[T,de,X,k,E]),ke=Et("span",t,{state:me,ref:[s,I,ae],props:[Me,R,ne,je=>$.getValidationProps(X,je)],stateAttributesMapping:EC});return r.jsxs(NC.Provider,{value:me,children:[ke,!de&&Y&&C!==void 0&&r.jsx("input",{type:"hidden",form:p,name:Y,value:C,disabled:X}),r.jsx("input",{...ue,suppressHydrationWarning:!0})]})}),kL=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,p=jL();return Et("span",t,{state:p,ref:s,stateAttributesMapping:EC,props:u})});function SL({className:e,size:t="default",...s}){return r.jsx(wL,{"data-slot":"switch","data-size":t,className:Ct("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...s,children:r.jsx(kL,{"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 CL({className:e,...t}){return r.jsx(zf,{role:"status","aria-label":"Loading",className:Ct("size-4 animate-spin",e),...t})}const RC=x.createContext(!1),TC=x.createContext(void 0);function Mo(e){const t=x.useContext(TC);if(e===!1&&t===void 0)throw new Error(rn(27));return t}const NL={...Ao,...Ja},AC=x.forwardRef(function(t,s){const{render:o,className:l,style:c,forceRender:u=!1,...p}=t,{store:m}=Mo(),h=m.useState("open"),g=m.useState("nested"),b=m.useState("mounted"),v=m.useState("transitionStatus");return Et("div",t,{state:{open:h,transitionStatus:v},ref:[m.context.backdropRef,s],stateAttributesMapping:NL,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:u||!g})}),pp=x.forwardRef(function(t,s){const{render:o,className:l,style:c,disabled:u=!1,nativeButton:p=!0,...m}=t,{store:h}=Mo(),g=h.useState("open"),{getButtonProps:b,buttonRef:v}=Vr({disabled:u,native:p}),k={disabled:u};function E(y){g&&h.setOpen(!1,nt(f5,y.nativeEvent))}return Et("button",t,{state:k,ref:[s,v],props:[{onClick:E},m,b]})}),MC=x.forwardRef(function(t,s){const{render:o,className:l,style:c,id:u,...p}=t,{store:m}=Mo(),h=Ks(u);return m.useSyncedValueWithCleanup("descriptionElementId",h),Et("p",t,{ref:s,props:[{id:h},p]})});let EL=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),RL=(function(e){return e[e.open=mo.open]="open",e[e.closed=mo.closed]="closed",e[e.startingStyle=mo.startingStyle]="startingStyle",e[e.endingStyle=mo.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const OC=x.createContext(void 0);function TL(){const e=x.useContext(OC);if(e===void 0)throw new Error(rn(26));return e}const AL={...Ao,...Ja,nestedDialogOpen(e){return e?{[RL.nestedDialogOpen]:""}:null}},zC=x.forwardRef(function(t,s){const{render:o,className:l,style:c,finalFocus:u,initialFocus:p,...m}=t,{store:h}=Mo(),g=h.useState("descriptionElementId"),b=h.useState("disablePointerDismissal"),v=h.useState("floatingRootContext"),k=h.useState("popupProps"),E=h.useState("modal"),y=h.useState("mounted"),j=h.useState("nested"),C=h.useState("nestedOpenDialogCount"),S=h.useState("open"),N=h.useState("openMethod"),R=h.useState("titleElementId"),M=h.useState("transitionStatus"),T=h.useState("role"),z=v.useState("floatingId"),D=m.id??z;TL(),ha({open:S,ref:h.context.popupRef,onComplete(){S&&h.context.onOpenChangeComplete?.(!0)}});const U=p===void 0?x4(h.context.popupRef):p,L=C>0,H=h.useStateSetter("popupElement"),P=Et("div",t,{state:{open:S,nested:j,transitionStatus:M,nestedDialogOpen:L},props:[k,{id:D,"aria-labelledby":R??void 0,"aria-describedby":g??void 0,role:T,...Jf,hidden:!y,onKeyDown(B){lp.has(B.key)&&B.stopPropagation()},style:{[EL.nestedDialogs]:C}},m],ref:[s,h.context.popupRef,H],stateAttributesMapping:AL});return r.jsx(jb,{context:v,openInteractionType:N,disabled:!y,closeOnFocusOut:!b,initialFocus:U,returnFocus:u,modal:E!==!1,restoreFocus:"popup",children:P})}),DC=x.forwardRef(function(t,s){const{keepMounted:o=!1,...l}=t,{store:c}=Mo(),u=c.useState("mounted"),p=c.useState("modal"),m=c.useState("open");return u||o?r.jsx(OC.Provider,{value:o,children:r.jsxs(_b,{ref:s,...l,children:[u&&p===!0&&r.jsx(Vb,{ref:c.context.internalBackdropRef,inert:sp(!m)}),t.children]})}):null});function ML(e){const{store:t,actionsRef:s}=e,o=t.useState("open");v4(t,o),Cb(t);const{forceUnmount:l}=Nb(o,t),c=x.useCallback(()=>{t.setOpen(!1,nt(ib))},[t]);x.useImperativeHandle(s,()=>({unmount:l,close:c}),[l,c])}function OL({store:e,parentContext:t,isDrawer:s}){const o=e.useState("open"),l=e.useState("disablePointerDismissal"),c=e.useState("modal"),u=e.useState("popupElement"),p=e.useState("floatingRootContext"),[m,h]=x.useState(0),[g,b]=x.useState(0),v=m===0,k=Xf(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(C){if(!e.context.outsidePressEnabledRef.current||"button"in C&&C.button!==0||"touches"in C&&C.touches.length!==1)return!1;const S=Un(C);return v&&!l?c&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===S||e.context.backdropRef.current===S||Qe(S,u)&&!S?.hasAttribute("data-base-ui-portal"):!0:!1},escapeKey:v});J2(o&&c===!0,u),e.useContextCallback("onNestedDialogOpen",(C,S)=>{h(C),b(S)}),e.useContextCallback("onNestedDialogClose",()=>{h(0),b(0)}),x.useEffect(()=>(t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(m+1,g+(s?1:0)),t?.onNestedDialogClose&&!o&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&o&&t.onNestedDialogClose()}),[s,o,m,g,t]);const E=k.reference??Gt,y=k.trigger??Gt,j=k.floating??Gt;return Eb(e,{activeTriggerProps:E,inactiveTriggerProps:y,popupProps:j,nestedOpenDialogCount:m,nestedOpenDrawerCount:g}),null}const zL={...Ab,modal:Ae(e=>e.modal),nested:Ae(e=>e.nested),nestedOpenDialogCount:Ae(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Ae(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Ae(e=>e.disablePointerDismissal),openMethod:Ae(e=>e.openMethod),descriptionElementId:Ae(e=>e.descriptionElementId),titleElementId:Ae(e=>e.titleElementId),viewportElement:Ae(e=>e.viewportElement),role:Ae(e=>e.role)};class s_ extends Wf{constructor(t,s,o=!1){const l=new Yc,c=DL(t);c.floatingRootContext=_2(l,s,o),super(c,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:l,onOpenChange:void 0,onOpenChangeComplete:void 0},zL)}setOpen=(t,s)=>{if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&s.trigger==null&&this.state.activeTriggerId!=null&&(s.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,s);const o={open:t};Sb(o,t,s.trigger),this.update(o)};static useStore(t,s){return h2(t,(l,c)=>new s_(s,l,c),!0).store}}function DL(e={}){return{...Rb(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:"dialog",...e}}function LL(e,t="dialog"){const{children:s,open:o,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:u,disablePointerDismissal:p=!1,modal:m=!0,actionsRef:h,handle:g,triggerId:b,defaultTriggerId:v=null}=e,k=t==="drawer",E=t==="alert-dialog",y=E?!0:m,j=E||p,C=E?"alertdialog":"dialog",S=Mo(!0),R={modal:y,disablePointerDismissal:j,nested:!!S,role:C},M=s_.useStore(g?.store,{open:l,openProp:o,activeTriggerId:v,triggerIdProp:b,...R});kb(()=>{const H=o===void 0&&M.state.open===!1&&l===!0?{open:!0,activeTriggerId:v}:null;E?M.update(H?{...R,...H}:R):H&&M.update(H)}),M.useControlledProp("openProp",o),M.useControlledProp("triggerIdProp",b),M.useSyncedValues(R),M.useContextCallback("onOpenChange",c),M.useContextCallback("onOpenChangeComplete",u);const T=M.useState("open"),z=M.useState("mounted"),D=M.useState("payload");ML({store:M,actionsRef:h});const U=T||z,L=x.useMemo(()=>({store:M}),[M]);return r.jsx(RC.Provider,{value:!1,children:r.jsxs(TC.Provider,{value:L,children:[U&&r.jsx(OL,{store:M,parentContext:S?.store.context,isDrawer:k}),typeof s=="function"?s({payload:D}):s]})})}function LC(e){const t=x.useContext(RC)?"drawer":"dialog";return LL(e,t)}const PC=x.forwardRef(function(t,s){const{render:o,className:l,style:c,id:u,...p}=t,{store:m}=Mo(),h=Ks(u);return m.useSyncedValueWithCleanup("titleElementId",h),Et("h2",t,{ref:s,props:[{id:h},p]})});function bx({...e}){return r.jsx(LC,{"data-slot":"dialog",...e})}function PL({...e}){return r.jsx(DC,{"data-slot":"dialog-portal",...e})}function IL({...e}){return r.jsx(pp,{"data-slot":"dialog-close",...e})}function BL({className:e,...t}){return r.jsx(AC,{"data-slot":"dialog-overlay",className:Ct("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:s=!0,...o}){return r.jsxs(PL,{children:[r.jsx(BL,{}),r.jsxs(zC,{"data-slot":"dialog-content",className:Ct("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...o,children:[t,s&&r.jsxs(pp,{"data-slot":"dialog-close",render:r.jsx(Qa,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[r.jsx(Ys,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function vx({className:e,...t}){return r.jsx("div",{"data-slot":"dialog-header",className:Ct("flex flex-col gap-2",e),...t})}function Yj({className:e,showCloseButton:t=!1,children:s,...o}){return r.jsxs("div",{"data-slot":"dialog-footer",className:Ct("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...o,children:[s,t&&r.jsx(pp,{render:r.jsx(Qa,{variant:"outline"}),children:"Close"})]})}function yx({className:e,...t}){return r.jsx(PC,{"data-slot":"dialog-title",className:Ct("font-heading text-base leading-none font-medium",e),...t})}function UL({className:e,...t}){return r.jsx(MC,{"data-slot":"dialog-description",className:Ct("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const HL={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},VL={sm:"sm",md:"default"};function ce({variant:e="secondary",size:t="md",loading:s,className:o,children:l,disabled:c,type:u="button",...p}){return r.jsxs(Qa,{type:u,variant:HL[e],size:VL[t],disabled:c||s,className:o,...p,children:[s?r.jsx(us,{size:14}):null,l]})}function Ee(e){return r.jsx(xL,{...e})}function On(e){return r.jsx(bL,{...e})}function qL(e){return r.jsx("select",{...e,className:Te("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 ie({label:e,hint:t,badge:s,children:o}){return r.jsxs("div",{className:"block space-y-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,s&&r.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:s})]}),o,t&&r.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:t})]})}function Qt({checked:e,onChange:t,label:s,disabled:o}){return r.jsxs("label",{className:Te("inline-flex items-center gap-2",o&&"opacity-50"),children:[r.jsx(SL,{checked:e,onCheckedChange:t,disabled:o}),s&&r.jsx("span",{className:"text-sm",children:s})]})}function $e({children:e,tone:t="muted",className:s}){const o=t==="danger"?"destructive":t==="muted"?"secondary":"outline",l={muted:"",danger:"",success:"text-emerald-400 border-emerald-500/30",warning:"text-amber-400 border-amber-500/30",info:"text-sky-400 border-sky-500/30"};return r.jsx(yL,{variant:o,className:Te("rounded-md",l[t],s),children:e})}function Sn({open:e,onClose:t,title:s,description:o,children:l,footer:c,size:u="md"}){const p={sm:"sm:max-w-md",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl"};return r.jsx(bx,{open:e,onOpenChange:m=>{m||t()},children:r.jsxs(_x,{className:Te("flex max-h-[88vh] w-full flex-col gap-0 p-0",p[u]),children:[(s||o)&&r.jsxs(vx,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[s&&r.jsx(yx,{children:s}),o&&r.jsx(UL,{children:o})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:l}),c&&r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function us({size:e=14}){return r.jsx(CL,{style:{width:e,height:e}})}function bt({children:e}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/20 px-4 py-6 text-center text-sm text-muted-foreground",children:e})}function rt({label:e="Cargando…"}){return r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(us,{})," ",e]})}const IC=x.createContext(null);let $L=1;function FL({children:e}){const[t,s]=x.useState([]),o=x.useCallback((c,u)=>{const p=$L++;s(m=>[...m,{id:p,kind:c,message:u}]),setTimeout(()=>{s(m=>m.filter(h=>h.id!==p))},4500)},[]),l=x.useMemo(()=>({show:o,success:c=>o("success",c),error:c=>o("error",c),info:c=>o("info",c)}),[o]);return x.useEffect(()=>(window.__apxToast=l,()=>{delete window.__apxToast}),[l]),r.jsxs(IC.Provider,{value:l,children:[e,r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[100] flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2",children:t.map(c=>r.jsx("div",{className:Te("pointer-events-auto overflow-hidden rounded-lg border bg-card px-3 py-2 text-sm shadow-lg",c.kind==="success"&&"border-emerald-500/40",c.kind==="error"&&"border-destructive/60",c.kind==="info"&&"border-border"),children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:Te("mt-1 size-2 shrink-0 rounded-full",c.kind==="success"&&"bg-emerald-500",c.kind==="error"&&"bg-destructive",c.kind==="info"&&"bg-sky-500")}),r.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function ot(){const e=x.useContext(IC);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function BC(){const{data:e,error:t,isLoading:s}=We("/health",()=>FD.get(),{refreshInterval:Pf.health});return{health:e,error:t,isLoading:s,isUp:!t&&!!e}}function GL(){const{data:e,error:t,isLoading:s,mutate:o}=We("/engines",()=>bf.list());return{engines:e?.engines||[],error:t,isLoading:s,mutate:o}}function YL(){const{data:e,error:t,isLoading:s,mutate:o}=We("/telegram/status",()=>Mn.status(),{refreshInterval:Pf.telegramStatus});return{status:e,error:t,isLoading:s,mutate:o}}function a_(){const{data:e,error:t,isLoading:s,mutate:o}=We("/telegram/channels",()=>Mn.channels.list());return{channels:e?.channels||[],error:t,isLoading:s,mutate:o}}function r_(){const{data:e,error:t,isLoading:s,mutate:o}=We("/telegram/contacts",()=>Mn.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:t,isLoading:s,mutate:o}}function is(e){return typeof e=="string"&&e.startsWith("*** set ***")}function Mr(e,t="(no seteada)"){return is(e)?e:t}function ko(e){if(typeof e!="string")return null;const t=e.match(/\(\.\.\.([^)]+)\)/);return t?t[1]:null}function UC({channel:e,onClose:t,onSaved:s}){const o=ot(),[l,c]=x.useState(!1),[u,p]=x.useState({name:""});x.useEffect(()=>{p(e?{...e,bot_token:""}:{name:""})},[e?.name]);const m=async()=>{if(!u.name?.trim()){o.error(f("telegram_channel_dialog.name_required"));return}c(!0);try{e&&e.name!==""&&e?.name===u.name?await Mn.channels.patch(e.name,u):await Mn.channels.upsert(u),o.success(f("telegram_channel_dialog.saved")),s()}catch(h){o.error(h.message)}finally{c(!1)}};return r.jsx(Sn,{open:!!e,onClose:t,title:e?.name?f("telegram_channel_dialog.edit_title",{name:e.name}):f("telegram_channel_dialog.new_title"),description:f("telegram_ui.channel_dialog_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:l,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:m,loading:l,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ie,{label:f("telegram_channel_dialog.name_label"),children:r.jsx(Ee,{value:u.name,onChange:h=>p({...u,name:h.target.value}),disabled:!!e?.name})}),r.jsx(ie,{label:f("telegram_channel_dialog.token_label"),hint:e?.bot_token?Mr(e.bot_token):f("telegram_ui.bot_token_hint"),children:r.jsx(Ee,{type:"password",value:u.bot_token||"",onChange:h=>p({...u,bot_token:h.target.value}),placeholder:e?.bot_token?Mr(e.bot_token):""})}),r.jsx(ie,{label:f("telegram_channel_dialog.chat_id"),children:r.jsx(Ee,{value:u.chat_id||"",onChange:h=>p({...u,chat_id:h.target.value})})}),r.jsx(ie,{label:f("telegram_channel_dialog.project_label"),hint:f("telegram_channel_dialog.project_hint"),children:r.jsx(Ee,{value:u.project||"",onChange:h=>p({...u,project:h.target.value})})}),r.jsx(ie,{label:f("telegram_channel_dialog.route_label"),hint:f("telegram_channel_dialog.route_hint"),children:r.jsx(Ee,{value:u.route_to_agent||"",onChange:h=>p({...u,route_to_agent:h.target.value})})}),r.jsx(ie,{label:f("telegram_channel_dialog.owner_label"),hint:f("telegram_channel_dialog.owner_hint"),children:r.jsx(Ee,{value:u.owner_user_id!=null?String(u.owner_user_id):"",onChange:h=>{const g=h.target.value.trim();p({...u,owner_user_id:g===""?void 0:/^\d+$/.test(g)?Number(g):g})},placeholder:"889721252"})}),r.jsx(Qt,{checked:!!u.respond_with_engine,onChange:h=>p({...u,respond_with_engine:h}),label:f("telegram_channel_dialog.respond_label")})]})})}function HC({channel:e,onClose:t}){const s=ot(),[o,l]=x.useState(f("admin.telegram_default_message")),[c,u]=x.useState(!1),p=async()=>{if(!(!o.trim()||!e)){u(!0);try{await Mn.send({text:o,channel:e.name}),s.success(f("telegram_ui.message_sent")),t()}catch(m){s.error(m.message)}finally{u(!1)}}};return r.jsx(Sn,{open:!!e,onClose:t,title:e?f("telegram_send_dialog.title",{name:e.name}):"",description:e?f("telegram_ui.send_chat_id",{id:e.chat_id||"—"}):"",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:c,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:p,loading:c,children:f("chat_ui.send")})]}),children:r.jsx(ie,{label:f("telegram_ui.message_label"),children:r.jsx(On,{rows:4,value:o,onChange:m=>l(m.target.value)})})})}function VC({bare:e=!1}){const t=ot(),{contacts:s,roles:o,channelOwners:l,isLoading:c,mutate:u}=r_(),p=new Set(l.filter(v=>v.owner_user_id!=null).map(v=>String(v.owner_user_id))),m=Array.from(new Set(["owner","guest",...Object.keys(o)])),h=async(v,k)=>{try{await Mn.contacts.patch(v.user_id,{role:k}),t.success(f("telegram_ui.role_assigned",{name:v.name||v.user_id,role:k})),u()}catch(E){t.error(E.message)}},g=async v=>{if(confirm(f("telegram_contacts.delete_confirm",{name:v.name||String(v.user_id)})))try{await Mn.contacts.remove(v.user_id),t.success(f("telegram_contacts.removed")),u()}catch(k){t.error(k.message)}},b=r.jsxs(r.Fragment,{children:[c&&r.jsx(rt,{}),!c&&s.length===0&&r.jsx(bt,{children:f("telegram_contacts.empty")}),s.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:s.map(v=>{const k=p.has(String(v.user_id)),E=k?"owner":v.role||"guest";return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:v.name||"—"}),v.username&&r.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",v.username]}),k&&r.jsx($e,{tone:"success",children:f("telegram_contacts.owner_badge")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ge,{content:f(k?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:r.jsx(qL,{value:E,disabled:k,onChange:y=>h(v,y.target.value),children:m.map(y=>r.jsx("option",{value:y,children:y},y))})}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>g(v),children:f("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["user_id: ",String(v.user_id)]}),r.jsxs("span",{children:[f("telegram_contacts.last_seen")," ",v.last_seen?v.last_seen.slice(0,10):"—"]}),r.jsx("span",{children:KL(o[E])})]})]},String(v.user_id))})})]});return e?b:r.jsx(Ye,{title:f("telegram_contacts.title"),description:f("telegram_contacts.desc"),children:b})}function KL(e){return!e||e.tools===void 0?"":e.tools==="*"?f("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${f("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:f("telegram_contacts.tools_none"):""}function XL(){const e=Yn(),[t,s]=$c(),o=ot(),{health:l,isUp:c}=BC(),{projects:u,isLoading:p,mutate:m}=Wc(),{engines:h,isLoading:g}=GL(),{status:b,mutate:v}=YL(),{channels:k,isLoading:E,mutate:y}=a_(),[j,C]=x.useState(null),[S,N]=x.useState(null),R=async()=>{try{await Gl.reload(),o.success(f("admin.reload_success"))}catch(D){o.error(D.message)}},M=async()=>{try{b?.enabled?(await Mn.stop(),o.info(f("admin.telegram_polling_stopped"))):(await Mn.start(),o.success(f("admin.telegram_polling_started"))),v()}catch(D){o.error(D.message)}},T=async D=>{if(confirm(f("telegram_channels.delete_confirm",{name:D})))try{await Mn.channels.remove(D),o.success(f("admin.telegram_channel_removed")),y()}catch(U){o.error(U.message)}},z=async(D,U)=>{if(confirm(f("admin.unregister_confirm",{label:U})))try{await ls.remove(D),o.success(f("project.unregistered")),m()}catch(L){o.error(L.message)}};return r.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[r.jsxs("header",{className:"flex items-end justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:f("admin.title")}),r.jsx("p",{className:"text-sm text-muted-fg",children:f("admin.subtitle")})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ge,{content:f("daemon.reload_hint"),children:r.jsxs(ce,{size:"sm",onClick:R,children:[f("common.reload")," config"]})}),r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>{const D=new URLSearchParams(t);D.set("action","add-project"),s(D)},children:[r.jsx(an,{size:14})," ",f("nav.project")]})]})]}),r.jsx(Ye,{title:f("daemon.version"),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(rg,{label:f("daemon.version"),value:l?.version||"—"}),r.jsx(rg,{label:f("daemon.uptime"),value:l?`${l.uptime_s}s`:"—"}),r.jsx(rg,{label:f("daemon.status"),value:f(c?"daemon.running":"daemon.down"),ok:c})]})}),r.jsxs(Ye,{title:f("admin.engines_title"),description:f("admin.engines_subtitle"),children:[g&&r.jsx(rt,{}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:h.map(D=>r.jsx($e,{tone:"info",children:D},D))})]}),r.jsxs(Ye,{title:f("admin.telegram_title"),description:f("admin.telegram_subtitle"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qt,{checked:!!b?.enabled,onChange:M,label:b?.enabled?f("admin.telegram_polling_on"):f("admin.telegram_polling_off")}),r.jsxs(ce,{size:"sm",onClick:()=>C({name:""}),children:[r.jsx(an,{size:14})," ",f("admin.telegram_add_channel")]})]}),children:[E&&r.jsx(rt,{}),k.length===0&&r.jsx(bt,{children:f("common.none_yet")}),r.jsx("ul",{className:"space-y-2 text-sm",children:k.map(D=>r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:D.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[D.project&&r.jsxs($e,{tone:"success",children:["project = ",D.project]}),r.jsxs(ce,{size:"sm",variant:"ghost",onClick:()=>N(D),children:[r.jsx(Gs,{size:13})," ",f("admin.telegram_send_test")]}),r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>C(D),children:f("common.edit")}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>T(D.name),children:f("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",D.chat_id||"—"]}),r.jsxs("span",{children:["route_to_agent: ",D.route_to_agent||"default APX"]}),r.jsxs("span",{children:["engine: ",D.respond_with_engine?f("admin.engine_badge"):f("admin.engine_badge_no")]})]})]},D.name))})]}),r.jsx(VC,{}),r.jsxs(Ye,{title:f("admin.projects_title"),description:f("admin.projects_subtitle"),children:[p&&r.jsx(rt,{}),r.jsx("ul",{className:"divide-y divide-border",children:u.map(D=>r.jsxs("li",{className:"flex items-center gap-3 py-2",children:[r.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",D.id]}),r.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${D.id}`),children:[r.jsx("span",{className:"font-medium",children:D.name||D.path.split("/").pop()}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:D.path})]}),r.jsxs($e,{children:[D.agents??0," ",f("admin.agents_badge")]}),Number(D.id)!==0&&r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>z(String(D.id),D.name||D.path),children:f("admin.unregister")})]},D.id))})]}),r.jsx(UC,{channel:j,onClose:()=>C(null),onSaved:()=>{C(null),y()}}),r.jsx(HC,{channel:S,onClose:()=>N(null)})]})}function rg({label:e,value:t,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(Zc,{ok:s}),r.jsx("span",{children:t})]})]})}const qC=x.createContext(null),$C=x.createContext(null),FC=x.createContext(""),GC=x.createContext(null),YC=x.createContext(null),KC=x.createContext(null);function QL({children:e}){const[t,s]=x.useState(null),[o,l]=x.useState(""),[c,u]=x.useState(null);return r.jsx($C.Provider,{value:s,children:r.jsx(qC.Provider,{value:t,children:r.jsx(GC.Provider,{value:l,children:r.jsx(FC.Provider,{value:o,children:r.jsx(KC.Provider,{value:u,children:r.jsx(YC.Provider,{value:c,children:e})})})})})})}function WL(){return x.useContext(qC)}function ZL(e,t){const s=x.useContext($C);x.useEffect(()=>(s?.({collapsed:e,toggle:t}),()=>s?.(null)),[e,t,s])}function JL(){return x.useContext(FC)}function eP(e){const t=x.useContext(GC);x.useEffect(()=>(t?.(e),()=>t?.("")),[e,t])}function tP(){return x.useContext(YC)}function nP(e){const t=x.useContext(KC);x.useEffect(()=>(t?.(e),()=>t?.(null)),[e,t])}function XC({sections:e,active:t,onChange:s,collapsed:o,onToggleCollapse:l,actions:c,contentClassName:u,testId:p,children:m}){return ZL(o,l),r.jsxs("div",{className:"flex h-full",children:[r.jsx(gD,{sections:e,active:t,onChange:s,collapsed:o}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[c?r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 px-6 pt-3",children:c}):null,r.jsx("div",{className:Te("flex-1 min-h-0 overflow-y-auto",u),"data-testid":p,children:m})]})]})}const Kj={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 QC({mood:e="happy",className:t}){const s=Kj[e]??Kj.happy,[o,l]=s.eyes,c="text-emerald-700 dark:text-emerald-600/70";return r.jsxs("div",{"aria-hidden":!0,className:Ct("select-none whitespace-pre font-mono leading-none text-emerald-400",t),children:[s.top&&r.jsx("div",{children:r.jsx("span",{className:c,children:` ${s.top}`})}),r.jsx("div",{children:" ▄███████▄"}),r.jsxs("div",{children:[" █ ",r.jsx("span",{className:c,children:"██"})," ",r.jsx("span",{className:c,children:"██"})," █"]}),r.jsx("div",{children:` █ ${o} ${l} █`}),r.jsx("div",{children:` █ ${s.mouth} █`}),r.jsx("div",{children:" ▀███████▀"})]})}function WC({mood:e="confused",title:t,titleClassName:s,message:o,action:l,className:c,testId:u}){return r.jsx("div",{className:Ct("grid h-full place-items-center p-8",c),"data-testid":u,children:r.jsxs("div",{className:"flex flex-col items-center text-center",children:[r.jsx(QC,{mood:e,className:"mb-6 text-sm"}),t!=null&&r.jsx("div",{className:Ct("font-mono font-semibold leading-none tracking-tight text-foreground",s),children:t}),o!=null&&r.jsx("p",{className:"mt-4 max-w-sm text-sm text-muted-fg",children:o}),l&&r.jsx("div",{className:"mt-6",children:l})]})})}function Xj({pid:e}){const t=We(`/projects/${e}/tasks?state=open`,()=>Nr.list(e)),s=We(`/projects/${e}/routines`,()=>Cr.list(e)),o=We(`/projects/${e}/agents`,()=>ln.list(e)),l=We(`/projects/${e}/mcps`,()=>Er.list(e)),c=We(`/projects/${e}/artifacts`,()=>Tr.list(e));return r.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[r.jsx(yl,{title:f("project.overview.tasks_open"),value:t.data?.length??"…",href:`/p/${e}/tasks`,icon:Il}),r.jsx(yl,{title:f("project.overview.routines"),value:s.data?.length??"…",href:`/p/${e}/routines`,icon:Pl}),r.jsx(yl,{title:f("project.overview.agents"),value:o.data?.length??"…",href:`/p/${e}/agents`,icon:on}),r.jsx(yl,{title:f("project.overview.mcps"),value:l.data?.length??"…",href:`/p/${e}/mcps`,icon:Kg}),r.jsx(yl,{title:f("project.overview.artifacts"),value:c.data?.length??"…",href:`/p/${e}/artifacts`,icon:Qd}),r.jsx(yl,{title:f("project.overview.chat"),value:f("project.overview.chat_value"),href:`/p/${e}/chat`,icon:Zd})]})}function yl({title:e,value:t,href:s,icon:o}){return r.jsxs(Vk,{to:s,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[r.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:r.jsx(o,{size:20})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"text-2xl font-semibold",children:t})]})]})}function sP(){const e=Yn(),{projects:t,isLoading:s}=Wc();return r.jsxs(Ye,{title:f("base.workspaces_title"),description:f("base.workspaces_desc"),action:r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[r.jsx(an,{size:14})," ",f("base.workspaces_new")]}),children:[s&&r.jsx(rt,{}),!s&&t.length===0&&r.jsx(bt,{children:f("base.workspaces_empty")}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:t.map(o=>{const l=String(o.id)==="0",c=l?f("base.title"):o.name||o.path.split("/").pop()||String(o.id);return r.jsxs("button",{type:"button",onClick:()=>e(`/p/${o.id}`),className:"flex cursor-pointer flex-col gap-2 rounded-xl border border-border bg-card p-4 text-left transition-colors hover:border-muted-fg/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Jk,{className:"size-4 text-muted-fg"}),r.jsx("span",{className:"truncate text-sm font-semibold",children:c}),r.jsx($e,{tone:l?"success":"info",children:l?f("base.title"):CC(o.kind)})]}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}const ZC=x.createContext(null),JC=x.createContext(null);function ga(){const e=x.useContext(ZC);if(e===null)throw new Error(rn(60));return e}function eN(){const e=x.useContext(JC);if(e===null)throw new Error(rn(61));return e}const aP=(e,t)=>Object.is(e,t);function So(e,t,s){return e==null||t==null?Object.is(e,t):s(e,t)}function rP(e,t,s){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:So(t,o,s))}function Sc(e,t,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:So(o,t,s))}function oP(e,t,s){return e.filter(o=>!So(t,o,s))}function jx(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function tN(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function lP(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(tN(t)){for(const s of t)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of t)if(s&&s.value==null&&s.label!=null)return!0;return!1}function nN(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 jx(e)}function uo(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?jx(e.value):jx(e)}function sN(e,t,s){function o(){return nN(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const l=t,c=tN(l)?l.flatMap(u=>u.items):l;if(e==null||typeof e!="object"){const u=c.find(p=>p.value===e);return u&&u.label!=null?u.label:o()}if("value"in e){const u=c.find(p=>p&&p.value===e.value);if(u&&u.label!=null)return u.label}}return o()}function iP(e,t,s){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(r.jsx(x.Fragment,{children:sN(l,t,s)},c)),o),[])}const Je={id:Ae(e=>e.id),labelId:Ae(e=>e.labelId),modal:Ae(e=>e.modal),multiple:Ae(e=>e.multiple),items:Ae(e=>e.items),itemToStringLabel:Ae(e=>e.itemToStringLabel),itemToStringValue:Ae(e=>e.itemToStringValue),isItemEqualToValue:Ae(e=>e.isItemEqualToValue),value:Ae(e=>e.value),hasSelectedValue:Ae(e=>{const{value:t,multiple:s,itemToStringValue:o}=e;return t==null?!1:s&&Array.isArray(t)?t.length>0:uo(t,o)!==""}),hasNullItemLabel:Ae((e,t)=>t?lP(e.items):!1),open:Ae(e=>e.open),mounted:Ae(e=>e.mounted),forceMount:Ae(e=>e.forceMount),transitionStatus:Ae(e=>e.transitionStatus),openMethod:Ae(e=>e.openMethod),activeIndex:Ae(e=>e.activeIndex),selectedIndex:Ae(e=>e.selectedIndex),isActive:Ae((e,t)=>e.activeIndex===t),isSelected:Ae((e,t)=>{const s=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(l=>So(t,l,s)):So(t,o,s)}),isSelectedByFocus:Ae((e,t)=>e.selectedIndex===t),popupProps:Ae(e=>e.popupProps),triggerProps:Ae(e=>e.triggerProps),triggerElement:Ae(e=>e.triggerElement),positionerElement:Ae(e=>e.positionerElement),listElement:Ae(e=>e.listElement),popupSide:Ae(e=>e.popupSide),scrollUpArrowVisible:Ae(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Ae(e=>e.scrollDownArrowVisible),hasScrollArrows:Ae(e=>e.hasScrollArrows)};function cP(e,t,s=(o,l)=>o===l){return e.length===t.length&&e.every((o,l)=>s(o,t[l]))}function hc(e,t=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,s))}const Vs=1;function o_(e,t){return Math.max(0,e-t)}function yf(e,t){if(t<=0)return 0;const s=hc(e,0,t),o=s,l=t-s,c=o<=Vs,u=l<=Vs;return c&&u?o<=l?0:t:c?0:u?t:s}function uP(e){const{id:t,value:s,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:u=!1,onOpenChange:p,name:m,form:h,autoComplete:g,disabled:b=!1,readOnly:v=!1,required:k=!1,modal:E=!0,actionsRef:y,inputRef:j,onOpenChangeComplete:C,items:S,multiple:N=!1,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:T=aP,highlightItemOnHover:z=!0,children:D}=e,{clearErrors:U}=t_(),{setDirty:L,setTouched:H,setFocused:O,validityData:P,setFilled:B,name:$,disabled:q,validation:X,validationMode:Y}=Jc(),F=fp({id:t}),K=q||b,I=$??m,[G,Z]=$l({controlled:s,default:N?o??Ya:o,name:"Select",state:"value"}),[te,de]=$l({controlled:c,default:u,name:"Select",state:"open"}),ee=x.useRef([]),ne=x.useRef([]),ae=x.useRef(null),pe=x.useRef(null),Me=x.useRef(0),ue=x.useRef(null),me=x.useRef([]),ke=x.useRef(!1),je=x.useRef(null),Be=x.useRef(null),He=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),we=x.useRef(!1),{mounted:Re,setMounted:ve,transitionStatus:Ce}=si(te),{openMethod:De,triggerProps:Pe}=aC(te),Ie=Wn(()=>new f2({id:F,labelId:void 0,modal:E,multiple:N,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:T,value:G,open:te,mounted:Re,transitionStatus:Ce,items:S,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,le=tt(Ie,Je.activeIndex),_e=tt(Ie,Je.selectedIndex),qe=tt(Ie,Je.triggerElement),Ne=tt(Ie,Je.positionerElement),Oe=sz(De),et=De??Oe??null,at=x.useMemo(()=>N?"":uo(G,M),[N,G,M]),vt=x.useMemo(()=>N&&Array.isArray(G)?G.map(ut=>uo(ut,M)):uo(G,M),[N,G,M]),Mt=dn(Ie.state.triggerElement),lt=Ue(()=>vt);n_(Mt,F,G,lt,!K,m);const Rt=x.useRef(G),xe=N?Array.isArray(G)&&G.length>0:G!=null&&uo(G,M)!=="";ze(()=>{G!==Rt.current&&Ie.set("forceMount",!0)},[Ie,G]),ze(()=>{B(xe)},[xe,B]),ze(function(){const Pt=me.current;let mn;if(N){const Cn=Array.isArray(G)?G:[];if(Cn.length===0)mn=null;else{const yn=Cn[Cn.length-1],$t=Sc(Pt,yn,T);mn=$t===-1?null:$t}}else{const Cn=Sc(Pt,G,T);mn=Cn===-1?null:Cn}mn===null&&(Be.current=null),!te&&Ie.set("selectedIndex",mn)},[xe,N,te,G,me,T,Ie,Be]);function Le(ut){const Pt=P.initialValue;return Array.isArray(ut)&&Array.isArray(Pt)?!cP(ut,Pt,(mn,Cn)=>So(mn,Cn,T)):ut!==Pt}qb(G,()=>{U(I),L(Le(G)),X.change(G)});const Ke=Ue((ut,Pt)=>{p?.(ut,Pt),!Pt.isCanceled&&(de(ut),!ut&&(Pt.reason===_o||Pt.reason===Gf)&&(H(!0),O(!1),Y==="onBlur"&&X.commit(G)))}),it=Ue(()=>{ve(!1),Ie.update({activeIndex:null,openMethod:null}),C?.(!1)});ha({enabled:!y,open:te,ref:ae,onComplete(){te||it()}}),x.useImperativeHandle(y,()=>({unmount:it}),[it]);const Xe=Ue((ut,Pt)=>{l?.(ut,Pt),!Pt.isCanceled&&Z(ut)}),ft=Ue(()=>{const ut=Ie.state.listElement||ae.current;if(!ut)return;const Pt=o_(ut.scrollHeight,ut.clientHeight),mn=yf(ut.scrollTop,Pt),Cn=mn>0,yn=mn<Pt;Ie.state.scrollUpArrowVisible!==Cn&&Ie.set("scrollUpArrowVisible",Cn),Ie.state.scrollDownArrowVisible!==yn&&Ie.set("scrollDownArrowVisible",yn)}),Ot=y2({open:te,onOpenChange:Ke,elements:{reference:qe,floating:Ne}}),Wt=t2(Ot,{enabled:!v&&!K,event:"mousedown"}),Yt=Xf(Ot),Zt=C2(Ot,{enabled:!v&&!K,listRef:ee,activeIndex:le,selectedIndex:_e,disabledIndices:Ya,onNavigate(ut){ut===null&&!te||Ie.set("activeIndex",ut)},focusItemOnHover:z}),fn=N2(Ot,{enabled:!v&&!K&&(te||!N),listRef:ne,activeIndex:le,selectedIndex:_e,disabledIndices:ut=>iC(ee.current[ut]),onMatch(ut){te?Ie.set("activeIndex",ut):Xe(me.current[ut],nt("none"))},onTyping(ut){ke.current=ut}}),es=x.useMemo(()=>{const ut=Fn(fn.reference,Zt.reference,Yt.reference,Wt.reference,Pe);return F&&(ut.id=F),ut},[Wt.reference,fn.reference,Zt.reference,Yt.reference,Pe,F]),fs=x.useMemo(()=>Fn(Jf,fn.floating,Zt.floating,Yt.floating),[fn.floating,Zt.floating,Yt.floating]),js=Zt.item??Gt;kb(()=>{Ie.update({popupProps:fs,triggerProps:es})}),ze(()=>{Ie.update({id:F,modal:E,multiple:N,value:G,open:te,mounted:Re,transitionStatus:Ce,popupProps:fs,triggerProps:es,items:S,itemToStringLabel:R,itemToStringValue:M,isItemEqualToValue:T,openMethod:et})},[Ie,F,E,N,G,te,Re,Ce,fs,es,S,R,M,T,et]);const pn=x.useMemo(()=>({store:Ie,name:I,required:k,disabled:K,readOnly:v,multiple:N,highlightItemOnHover:z,setValue:Xe,setOpen:Ke,listRef:ee,popupRef:ae,scrollHandlerRef:pe,handleScrollArrowVisibility:ft,scrollArrowsMountedCountRef:Me,itemProps:js,valueRef:ue,valuesRef:me,labelsRef:ne,typingRef:ke,selectionRef:He,firstItemTextRef:je,selectedItemTextRef:Be,validation:X,onOpenChangeComplete:C,alignItemWithTriggerActiveRef:we,initialValueRef:Rt}),[Ie,I,k,K,v,N,z,Xe,Ke,js,X,C,ft]),ws=Ka(j,X.inputRef),xa=N&&Array.isArray(G)&&G.length>0,Is=N?void 0:I,ba=x.useMemo(()=>!N||!Array.isArray(G)||!I?null:G.map(ut=>{const Pt=uo(ut,M);return r.jsx("input",{type:"hidden",form:h,name:I,value:Pt,disabled:K},Pt)}),[N,G,h,I,M,K]);return r.jsx(ZC.Provider,{value:pn,children:r.jsxs(JC.Provider,{value:Ot,children:[D,r.jsx("input",{...X.getValidationProps(K,{onFocus(){Ie.state.triggerElement?.focus({focusVisible:!0})},onChange(ut){if(ut.nativeEvent.defaultPrevented||K||v)return;const Pt=ut.currentTarget.value,mn=nt(fa,ut.nativeEvent);function Cn(){if(N)return;const yn=Pt.toLowerCase();let $t=me.current.findIndex(Xs=>uo(Xs,M).toLowerCase()===yn||nN(Xs,R).toLowerCase()===yn);$t===-1&&($t=me.current.findIndex((Xs,ai)=>{const eu=ne.current[ai];return eu!=null&&eu.toLowerCase()===yn}));const zn=$t===-1?void 0:me.current[$t];zn!=null&&Xe(zn,mn)}Ie.set("forceMount",!0),queueMicrotask(Cn)}}),id:F&&Is==null?`${F}-hidden-input`:void 0,form:h,name:Is,autoComplete:g,value:at,disabled:K,required:k&&!xa,readOnly:v,ref:ws,style:I?ES:ub,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ba]})})}function dP(e,t){return e??t}const Cd=2,fP=400,pP={...cx,...e_,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},mP=x.forwardRef(function(t,s){const{render:o,className:l,id:c,disabled:u=!1,nativeButton:p=!0,style:m,...h}=t,{setTouched:g,setFocused:b,validationMode:v,state:k,disabled:E}=Jc(),{labelId:y}=dp(),{store:j,setOpen:C,selectionRef:S,validation:N,readOnly:R,required:M,alignItemWithTriggerActiveRef:T,disabled:z}=ga(),D=E||z||u,U=tt(j,Je.open),L=tt(j,Je.mounted),H=tt(j,Je.value),O=tt(j,Je.triggerProps),P=tt(j,Je.positionerElement),B=tt(j,Je.listElement),$=tt(j,Je.popupSide),q=tt(j,Je.id),X=tt(j,Je.labelId),Y=tt(j,Je.hasSelectedValue),F=L&&P?$:null,K=c??q,I=dP(y,X);fp({id:K});const G=dn(P),Z=x.useRef(null),{getButtonProps:te,buttonRef:de}=Vr({disabled:D,native:p}),ee=Ue(ke=>{j.set("triggerElement",ke)}),ne=kn(),ae=kn(),pe=kn();x.useEffect(()=>{if(U)return pe.start(fP,()=>{S.current.allowUnselectedMouseUp=!0,S.current.allowSelectedMouseUp=!0}),()=>{pe.clear()};S.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ae.clear()},[U,S,ae,pe]);const Me=Fn(O,{id:K,role:"combobox","aria-expanded":U?"true":"false","aria-haspopup":"listbox","aria-controls":U?B?.id??tf(P)?.id:void 0,"aria-labelledby":I,"aria-readonly":R||void 0,"aria-required":M||void 0,tabIndex:D?-1:0,onFocus(ke){b(!0),U&&T.current&&C(!1,nt(fa,ke.nativeEvent)),ne.start(0,()=>{j.set("forceMount",!0)})},onBlur(ke){Qe(P,ke.relatedTarget)||(g(!0),b(!1),v==="onBlur"&&N.commit(H))},onMouseDown(ke){if(U)return;const je=ht(ke.currentTarget);function Be(He){if(!Z.current)return;const we=He.target;if(Qe(Z.current,we)||Qe(G.current,we))return;const Re=rC(Z.current);He.clientX>=Re.left-Cd&&He.clientX<=Re.right+Cd&&He.clientY>=Re.top-Cd&&He.clientY<=Re.bottom+Cd||C(!1,nt(jS,He))}ae.start(0,()=>{je.addEventListener("mouseup",Be,{once:!0})})}},h,te),ue=N.getValidationProps(D,Me);ue.role="combobox";const me={...k,open:U,disabled:D,value:H,readOnly:R,popupSide:F,placeholder:!Y};return Et("button",t,{ref:[s,Z,de,ee],state:me,stateAttributesMapping:pP,props:ue})}),hP={value:()=>null},gP=x.forwardRef(function(t,s){const{className:o,render:l,children:c,placeholder:u,style:p,...m}=t,{store:h,valueRef:g}=ga(),b=tt(h,Je.value),v=tt(h,Je.items),k=tt(h,Je.itemToStringLabel),E=tt(h,Je.hasSelectedValue),y=!E&&u!=null&&c==null,j=tt(h,Je.hasNullItemLabel,y),C={value:b,placeholder:!E};let S=null;return typeof c=="function"?S=c(b):c!=null?S=c:!E&&u!=null&&!j?S=u:Array.isArray(b)?S=iP(b,v,k):S=sN(b,v,k),Et("span",t,{state:C,ref:[s,g],props:[{children:S},m],stateAttributesMapping:hP})}),xP=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,{store:p}=ga(),h={open:tt(p,Je.open)};return Et("span",t,{state:h,ref:s,props:[{"aria-hidden":!0,children:"▼"},u],stateAttributesMapping:R2})}),bP=x.createContext(void 0),_P=x.forwardRef(function(t,s){const{store:o}=ga(),l=tt(o,Je.mounted),c=tt(o,Je.forceMount);return l||c?r.jsx(bP.Provider,{value:!0,children:r.jsx(_b,{ref:s,...t})}):null}),aN=x.createContext(void 0);function l_(){const e=x.useContext(aN);if(!e)throw new Error(rn(59));return e}function jf(e,t){e&&Object.assign(e.style,t)}const rN={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},vP={position:"fixed"},yP=x.forwardRef(function(t,s){const{anchor:o,positionMethod:l="absolute",className:c,render:u,side:p="bottom",align:m="center",sideOffset:h=0,alignOffset:g=0,collisionBoundary:b="clipping-ancestors",collisionPadding:v,arrowPadding:k=5,sticky:E=!1,disableAnchorTracking:y,alignItemWithTrigger:j=!0,collisionAvoidance:C=GS,style:S,...N}=t,{store:R,listRef:M,labelsRef:T,alignItemWithTriggerActiveRef:z,selectedItemTextRef:D,valuesRef:U,initialValueRef:L,popupRef:H,setValue:O}=ga(),P=eN(),B=tt(R,Je.open),$=tt(R,Je.mounted),q=tt(R,Je.modal),X=tt(R,Je.value),Y=tt(R,Je.openMethod),F=tt(R,Je.positionerElement),K=tt(R,Je.triggerElement),I=tt(R,Je.isItemEqualToValue),G=tt(R,Je.transitionStatus),Z=x.useRef(null),te=x.useRef(null),[de,ee]=x.useState(j),ne=$&&de&&Y!=="touch";!$&&de!==j&&ee(j),ze(()=>{$||(Je.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),Je.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,$]),x.useImperativeHandle(z,()=>ne),eC((ne||q)&&B,Y==="touch",F,K);const ae=Db({anchor:o,floatingRootContext:P,positionMethod:l,mounted:$,side:p,sideOffset:h,align:m,alignOffset:g,arrowPadding:k,collisionBoundary:b,collisionPadding:v,sticky:E,disableAnchorTracking:y??ne,collisionAvoidance:C,keepMounted:!0}),pe=ne?"none":ae.side,Me=ne?vP:ae.positionerStyles,ue={open:B,side:pe,align:ae.align,anchorHidden:ae.anchorHidden};ze(()=>{R.set("popupSide",ae.side)},[R,ae.side]);const me=Ue(we=>{R.set("positionerElement",we)}),ke=Lb(t,ue,{styles:Me,transitionStatus:G,props:N,refs:[s,me],hidden:!$,inert:!B}),je=x.useRef(0),Be=Ue(we=>{if(we.size===0&&je.current===0||U.current.length===0)return;const Re=je.current;if(je.current=we.size,we.size===Re)return;const ve=nt(fa);if(Re!==0&&!R.state.multiple&&X!==null&&Sc(U.current,X,I)===-1){const De=L.current,Ie=De!=null&&Sc(U.current,De,I)!==-1?De:null;O(Ie,ve),Ie===null&&(R.set("selectedIndex",null),D.current=null)}if(Re!==0&&R.state.multiple&&Array.isArray(X)){const Ce=Pe=>Sc(U.current,Pe,I)!==-1,De=X.filter(Pe=>Ce(Pe));(De.length!==X.length||De.some(Pe=>!rP(X,Pe,I)))&&(O(De,ve),De.length===0&&(R.set("selectedIndex",null),D.current=null))}if(B&&ne){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ce={height:""};jf(F,Ce),jf(H.current,Ce)}}),He=x.useMemo(()=>({...ae,side:pe,alignItemWithTriggerActive:ne,setControlledAlignItemWithTrigger:ee,scrollUpArrowRef:Z,scrollDownArrowRef:te}),[ae,pe,ne,ee]);return r.jsx(ip,{elementsRef:M,labelsRef:T,onMapChange:Be,children:r.jsxs(aN.Provider,{value:He,children:[$&&q&&r.jsx(Vb,{inert:sp(!B),cutout:K}),ke]})})}),Nd="base-ui-disable-scrollbar",wx={className:Nd,getElement(e){return r.jsx("style",{nonce:e,href:Nd,precedence:"base-ui:low",children:`.${Nd}{scrollbar-width:none}.${Nd}::-webkit-scrollbar{display:none}`})}},jP=x.createContext(void 0),wP={disableStyleElements:!1};function kP(){return x.useContext(jP)??wP}const SP={...Ao,...Ja},CP=x.forwardRef(function(t,s){const{render:o,className:l,style:c,finalFocus:u,...p}=t,{store:m,popupRef:h,onOpenChangeComplete:g,setOpen:b,valueRef:v,firstItemTextRef:k,selectedItemTextRef:E,multiple:y,handleScrollArrowVisibility:j,scrollHandlerRef:C,listRef:S,highlightItemOnHover:N}=ga(),{side:R,align:M,alignItemWithTriggerActive:T,isPositioned:z,setControlledAlignItemWithTrigger:D}=l_(),U=K2()!=null,L=eN(),H=tp(),{nonce:O,disableStyleElements:P}=kP(),B=tt(m,Je.id),$=tt(m,Je.open),q=tt(m,Je.openMethod),X=tt(m,Je.mounted),Y=tt(m,Je.popupProps),F=tt(m,Je.transitionStatus),K=tt(m,Je.triggerElement),I=tt(m,Je.positionerElement),G=tt(m,Je.listElement),Z=x.useRef(!1),te=x.useRef(!1),de=x.useRef({}),ee=Hl(),ne=Ue(ue=>{if(!I||!h.current||!te.current)return;if(Z.current||!T){j();return}const me=I.style.top==="0px",ke=I.style.bottom==="0px";if(!me&&!ke){j();return}const je=Wj(I),Be=gc(I.getBoundingClientRect().height,"y",je),He=ht(I),we=Xt(I),Re=we.getComputedStyle(I),ve=parseFloat(Re.marginTop),Ce=parseFloat(Re.marginBottom),De=Qj(we.getComputedStyle(h.current)),Pe=Math.min(He.documentElement.clientHeight-ve-Ce,De),Ie=ue.scrollTop,le=Ed(ue);let _e=0,qe=null,Ne=!1,Oe=!1;const et=lt=>{I.style.height=`${lt}px`},at=(lt,Rt)=>{const xe=hc(lt,0,Pe-Be);xe>0&&et(Be+xe),ue.scrollTop=Rt,Pe-(Be+xe)<=Vs&&(Z.current=!0),j()},vt=me?le-Ie:Ie,Mt=Math.min(Be+vt,Pe);if(_e=Mt,vt<=Vs){at(vt,me?le:0);return}if(Pe-Mt>Vs)me?Oe=!0:qe=0;else if(Ne=!0,ke&&Ie<le){const lt=Be+vt-Pe;qe=Ie-(vt-lt)}if(_e=Math.ceil(_e),_e!==0&&et(_e),Oe||qe!=null){const lt=Ed(ue),Rt=Oe?lt:hc(qe,0,lt);Math.abs(ue.scrollTop-Rt)>Vs&&(ue.scrollTop=Rt)}(Ne||_e>=Pe-Vs)&&(Z.current=!0),j()});x.useImperativeHandle(C,()=>ne,[ne]),ha({open:$,ref:h,onComplete(){$&&g?.(!0)}});const ae={open:$,transitionStatus:F,side:R,align:M};ze(()=>{!I||!h.current||Object.keys(de.current).length||(de.current={top:I.style.top||"0",left:I.style.left||"0",right:I.style.right,height:I.style.height,bottom:I.style.bottom,minHeight:I.style.minHeight,maxHeight:I.style.maxHeight,marginTop:I.style.marginTop,marginBottom:I.style.marginBottom})},[h,I]),ze(()=>{$||T||(te.current=!1,Z.current=!1,jf(I,de.current))},[$,T,I,h]),ze(()=>{const ue=h.current;if(!$||!K||!I||!ue||T&&!z||m.state.transitionStatus==="ending")return;if(!T){te.current=!0,ee.request(j),ue.style.removeProperty("--transform-origin");return}const me=NP(ue);ue.style.removeProperty("--transform-origin");try{let ke=E.current;ke?.isConnected||(ke=!Je.hasSelectedValue(m.state)&&k.current?.isConnected?k.current:null);const je=v.current,Be=Xt(I),He=Be.getComputedStyle(I),we=Be.getComputedStyle(ue),Re=ht(K),ve=Wj(K),Ce=Rd(K.getBoundingClientRect(),ve),De=Rd(I.getBoundingClientRect(),ve),Pe=Ce.height,Ie=G||ue,le=Ie.scrollHeight,_e=parseFloat(we.borderBottomWidth),qe=parseFloat(He.marginTop)||10,Ne=parseFloat(He.marginBottom)||10,Oe=parseFloat(He.minHeight)||100,et=Qj(we),at=5,vt=5,Mt=20,lt=Re.documentElement.clientHeight-qe-Ne,Rt=Re.documentElement.clientWidth,xe=lt-Ce.bottom+Pe;let Le,Ke=H==="rtl"?Ce.right-De.width:Ce.left,it=0;if(ke&&je){const pn=Rd(je.getBoundingClientRect(),ve);Le=Rd(ke.getBoundingClientRect(),ve),Ke=De.left+(H==="rtl"?pn.right-Le.right:pn.left-Le.left);const ws=pn.top-Ce.top+pn.height/2;it=Le.top-De.top+Le.height/2-ws}const Xe=xe+it+Ne+_e;let ft=Math.min(lt,Xe);const Ot=lt-qe-Ne,Wt=Xe-ft,Yt=Rt-vt;I.style.left=`${hc(Ke,at,Yt-De.width)}px`,I.style.height=`${ft}px`,I.style.maxHeight="none",I.style.marginTop=`${qe}px`,I.style.marginBottom=`${Ne}px`,ue.style.height="100%";const Zt=Ed(Ie),fn=Wt>=Zt-Vs;fn&&(ft=Math.min(lt,De.height)-(Wt-Zt));const es=Ce.top<Mt||Ce.bottom>lt-Mt||Math.ceil(ft)+Vs<Math.min(le,Oe),fs=(Be.visualViewport?.scale??1)!==1&&Lr;if(es||fs){te.current=!0,jf(I,de.current),D(!1);return}const js=Math.max(Oe,ft);if(fn){const pn=Math.max(0,lt-Xe);I.style.top=De.height>=Ot?"0":`${pn}px`,I.style.height=`${ft}px`,Ie.scrollTop=Ed(Ie)}else I.style.bottom="0",Ie.scrollTop=Wt;if(Le){const pn=De.top,ws=De.height,xa=Le.top+Le.height/2,Is=ws>0?(xa-pn)/ws*100:50,ba=hc(Is,0,100);ue.style.setProperty("--transform-origin",`50% ${ba}%`)}(js===lt||ft>=et)&&(Z.current=!0),j(),N&&m.state.selectedIndex===null&&m.state.activeIndex===null&&S.current[0]!=null&&m.set("activeIndex",0),te.current=!0}finally{me()}},[m,$,I,K,v,k,E,h,j,T,D,ee,G,S,N,H,z]),x.useEffect(()=>{if(!T||!I||!$)return;const ue=Xt(I);function me(ke){b(!1,nt(p5,ke))}return xt(ue,"resize",me)},[b,T,I,$]);const pe={...G?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${B}-list`},onKeyDown(ue){U&&lp.has(ue.key)&&ue.stopPropagation()},onScroll(ue){G||ne(ue.currentTarget)},...T&&{style:G?{height:"100%"}:rN}},Me=Et("div",t,{ref:[s,h],state:ae,stateAttributesMapping:SP,props:[Y,pe,np(F),{className:!G&&T?wx.className:void 0},p]});return r.jsxs(x.Fragment,{children:[!P&&wx.getElement(O),r.jsx(jb,{context:L,modal:!1,disabled:!X,openInteractionType:q,returnFocus:u,restoreFocus:!0,children:Me})]})});function Qj(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Ed(e){return o_(e.scrollHeight,e.clientHeight)}function Wj(e){return i2.getScale(e)}function gc(e,t,s){return e/s[t]}function Rd(e,t){return zc({x:gc(e.x,"x",t),y:gc(e.y,"y",t),width:gc(e.width,"x",t),height:gc(e.height,"y",t)})}const Zj=[["transform","none"],["scale","1"],["translate","0 0"]];function NP(e){const{style:t}=e,s={};for(const[o,l]of Zj)s[o]=t.getPropertyValue(o),t.setProperty(o,l,"important");return()=>{for(const[o]of Zj){const l=s[o];l?t.setProperty(o,l):t.removeProperty(o)}}}const EP=x.forwardRef(function(t,s){const{render:o,className:l,style:c,...u}=t,{store:p,scrollHandlerRef:m}=ga(),{alignItemWithTriggerActive:h}=l_(),g=tt(p,Je.hasScrollArrows),b=tt(p,Je.openMethod),v=tt(p,Je.multiple),E={id:`${tt(p,Je.id)}-list`,role:"listbox","aria-multiselectable":v||void 0,onScroll(j){m.current?.(j.currentTarget)},...h&&{style:rN},className:g&&b!=="touch"?wx.className:void 0},y=Ue(j=>{p.set("listElement",j)});return Et("div",t,{ref:[s,y],props:[E,u]})}),oN=x.createContext(void 0);function i_(){const e=x.useContext(oN);if(!e)throw new Error(rn(57));return e}const RP=x.memo(x.forwardRef(function(t,s){const{render:o,className:l,style:c,value:u=null,label:p,disabled:m=!1,nativeButton:h=!1,...g}=t,b=x.useRef(null),v=Kc({label:p,textRef:b,indexGuessBehavior:G2.GuessFromOrder}),{store:k,itemProps:E,setOpen:y,setValue:j,selectionRef:C,typingRef:S,valuesRef:N,multiple:R,selectedItemTextRef:M,disabled:T,readOnly:z}=ga(),D=tt(k,Je.isActive,v.index),U=tt(k,Je.open),L=tt(k,Je.isSelected,u),H=tt(k,Je.isSelectedByFocus,v.index),O=tt(k,Je.isItemEqualToValue),P=v.index,B=P!==-1,$=x.useRef(null);ze(()=>{if(!B)return;const ne=N.current;return ne[P]=u,()=>{delete ne[P]}},[B,P,u,N]),ze(()=>{if(!B)return;const ne=k.state.value;let ae=ne;R&&Array.isArray(ne)&&(ae=ne.length>0?ne[ne.length-1]:void 0),ae!==void 0&&So(u,ae,O)&&(k.set("selectedIndex",P),b.current&&(M.current=b.current))},[B,P,R,O,k,u,M]);const q=x.useRef(null),X=x.useRef("mouse"),Y=x.useRef(!1),{getButtonProps:F,buttonRef:K}=Vr({disabled:m,focusableWhenDisabled:!0,native:h,composite:!0}),I={disabled:m,selected:L,highlighted:D};function G(ne){if(T||z)return;const ae=k.state.value;if(R){const pe=Array.isArray(ae)?ae:[],Me=L?oP(pe,u,O):[...pe,u];j(Me,nt(Al,ne))}else j(u,nt(Al,ne)),y(!1,nt(Al,ne))}function Z(){C.current.dragY=0}const te={role:"option","aria-selected":L,tabIndex:U&&D?0:-1,onKeyDown(ne){q.current=ne.key,k.set("activeIndex",P),ne.key===" "&&S.current&&ne.preventDefault()},onClick(ne){const ae=ne.type==="click"&&X.current!=="touch",pe=ne.nativeEvent.pointerType,Me=ae&&sb(ne.nativeEvent)&&(pe!==void 0||D),ue=ae&&!Me&&!Y.current;Y.current=!1,!(ne.type==="keydown"&&q.current===null)&&(m||ne.type==="keydown"&&q.current===" "&&S.current||ue||(q.current=null,G(ne.nativeEvent)))},onPointerEnter(ne){X.current=ne.pointerType},onPointerMove(ne){if(ne.pointerType==="mouse"&&ne.buttons===1){const ae=C.current;ae.dragY+=ne.movementY,ae.dragY**2>=64&&(ae.allowUnselectedMouseUp=!0)}},onPointerDown(ne){X.current=ne.pointerType,Y.current=!0,Z()},onMouseUp(){if(Z(),m||X.current==="touch"||Y.current)return;const ne=!C.current.allowSelectedMouseUp&&L,ae=!C.current.allowUnselectedMouseUp&&!L;ne||ae||(Y.current=!0,$.current?.click(),Y.current=!1)}},de=Et("div",t,{ref:[K,s,v.ref,$],state:I,props:[E,te,g,F]}),ee=x.useMemo(()=>({selected:L,index:P,textRef:b,selectedByFocus:H,hasRegistered:B}),[L,P,b,H,B]);return r.jsx(oN.Provider,{value:ee,children:de})})),TP=x.forwardRef(function(t,s){const o=t.keepMounted??!1,{selected:l}=i_();return o||l?r.jsx(AP,{...t,ref:s}):null}),AP=x.memo(x.forwardRef((e,t)=>{const{render:s,className:o,style:l,keepMounted:c,...u}=e,{selected:p}=i_(),m=x.useRef(null),{transitionStatus:h,setMounted:g}=si(p),v=Et("span",e,{ref:[t,m],state:{selected:p,transitionStatus:h},props:[{"aria-hidden":!0,children:"✔️"},u],stateAttributesMapping:Ja});return ha({open:p,ref:m,onComplete(){p||g(!1)}}),v})),MP=x.memo(x.forwardRef(function(t,s){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:u}=i_(),{firstItemTextRef:p,selectedItemTextRef:m}=ga(),{render:h,className:g,style:b,...v}=t,k=x.useCallback(y=>{y&&(u&&o===0&&(p.current=y),u&&c&&(m.current=y))},[p,m,o,c,u]);return Et("div",t,{ref:[k,s,l],props:v})})),lN=x.forwardRef(function(t,s){const{render:o,className:l,style:c,direction:u,keepMounted:p=!1,...m}=t,h=u==="up",{store:g,popupRef:b,listRef:v,handleScrollArrowVisibility:k,scrollArrowsMountedCountRef:E}=ga(),{side:y,scrollDownArrowRef:j,scrollUpArrowRef:C}=l_(),S=h?Je.scrollUpArrowVisible:Je.scrollDownArrowVisible,N=tt(g,S),R=tt(g,Je.openMethod),M=N&&R!=="touch",T=kn(),z=h?C:j,{mounted:D,transitionStatus:U,setMounted:L}=si(M);ze(()=>(E.current+=1,g.state.hasScrollArrows||g.set("hasScrollArrows",!0),()=>{E.current=Math.max(0,E.current-1),E.current===0&&g.state.hasScrollArrows&&g.set("hasScrollArrows",!1)}),[g,E]),ha({open:M,ref:z,onComplete(){M||L(!1)}});const P=Et("div",t,{ref:[s,z],state:{direction:u,visible:M,side:y,transitionStatus:U},props:[{"aria-hidden":!0,children:h?"▲":"▼",style:{position:"absolute"},onMouseMove($){if($.movementX===0&&$.movementY===0||T.isStarted())return;g.set("activeIndex",null);function q(){const X=g.state.listElement??b.current;if(!X)return;g.set("activeIndex",null),k();const Y=o_(X.scrollHeight,X.clientHeight),F=yf(X.scrollTop,Y),K=F===(h?0:Y),I=v.current;if(F!==X.scrollTop&&(X.scrollTop=F),I.length===0&&g.set(h?"scrollUpArrowVisible":"scrollDownArrowVisible",!K),K){T.clear();return}if(I.length>0){const G=z.current?.offsetHeight||0;X.scrollTop=OP(I,h,F,X.clientHeight,G,Y)}T.start(40,q)}T.start(40,q)},onMouseLeave(){T.clear()}},m],stateAttributesMapping:Ja});return D||p?P:null});function OP(e,t,s,o,l,c){if(t){let g=0;const b=s+l-Vs;for(let E=0;E<e.length;E+=1){const y=e[E];if(y&&y.offsetTop>=b){g=E;break}}const v=Math.max(0,g-1),k=e[v];return v<g&&k?yf(k.offsetTop-l,c):0}let u=e.length-1;const p=s+o-l+Vs;for(let g=0;g<e.length;g+=1){const b=e[g];if(b&&b.offsetTop+b.offsetHeight>p){u=Math.max(0,g-1);break}}const m=Math.min(e.length-1,u+1),h=e[m];return m>u&&h?yf(h.offsetTop+h.offsetHeight-o+l,c):c}const zP=x.forwardRef(function(t,s){return r.jsx(lN,{...t,ref:s,direction:"down"})}),DP=x.forwardRef(function(t,s){return r.jsx(lN,{...t,ref:s,direction:"up"})}),LP=uP;function PP({className:e,...t}){return r.jsx(gP,{"data-slot":"select-value",className:Ct("flex flex-1 text-left",e),...t})}function IP({className:e,size:t="default",children:s,...o}){return r.jsxs(mP,{"data-slot":"select-trigger","data-size":t,className:Ct("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,r.jsx(xP,{render:r.jsx(pa,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function BP({className:e,children:t,side:s="bottom",sideOffset:o=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:u=!0,...p}){return r.jsx(_P,{children:r.jsx(yP,{side:s,sideOffset:o,align:l,alignOffset:c,alignItemWithTrigger:u,className:"isolate z-50",children:r.jsxs(CP,{"data-slot":"select-content","data-align-trigger":u,className:Ct("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...p,children:[r.jsx(HP,{}),r.jsx(EP,{children:t}),r.jsx(VP,{})]})})})}function UP({className:e,children:t,...s}){return r.jsxs(RP,{"data-slot":"select-item",className:Ct("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[r.jsx(MP,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:t}),r.jsx(TP,{render:r.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:r.jsx(xo,{className:"pointer-events-none"})})]})}function HP({className:e,...t}){return r.jsx(DP,{"data-slot":"select-scroll-up-button",className:Ct("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:r.jsx(Xk,{})})}function VP({className:e,...t}){return r.jsx(zP,{"data-slot":"select-scroll-down-button",className:Ct("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:r.jsx(pa,{})})}function _t({value:e,onChange:t,options:s,placeholder:o="— elegir —",disabled:l,className:c,showIcon:u=!1}){return r.jsxs(LP,{value:e,onValueChange:p=>t(p??""),disabled:l,children:[r.jsx(IP,{className:Te("h-9 w-full",c),children:r.jsx(PP,{placeholder:o,children:p=>{const m=s.find(g=>g.value===p),h=u?m?.icon:void 0;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[h&&r.jsx(h,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:m?.label??p})]})}})}),r.jsx(BP,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:s.map(p=>{const m=p.icon;return r.jsx(UP,{value:p.value,disabled:p.disabled,children:r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m?r.jsx(m,{className:"size-4 shrink-0 text-muted-fg"}):null,p.description?r.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[r.jsx("span",{className:"truncate font-medium",children:p.label}),r.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:p.description})]}):r.jsx("span",{className:"truncate",children:p.label})]})},p.value)})})]})}const Jj=320;function qP(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 $P(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function FP({m:e}){const[t,s]=x.useState(!1),o=(e.body?.length||0)>Jj,l=!o||t?e.body:`${e.body.slice(0,Jj)}…`;return r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?r.jsx(Gk,{size:14,className:"text-blue-400"}):r.jsx(Kk,{size:14,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:qP(e.ts)}),r.jsx($e,{tone:"info",children:e.channel}),e.type&&r.jsx($e,{children:e.type}),r.jsx("span",{className:"font-medium text-foreground",children:$P(e)})]}),e.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:l}),o&&r.jsx("button",{type:"button",onClick:()=>s(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:f(t?"logs.show_less":"logs.show_more")})]})]})}function GP(){const[e,t]=x.useState(!1),s=We(e?"/admin/logs?errors":null,()=>Gl.logs("errors",200)),o=s.data?.entries||[];return r.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:l=>t(l.target.open),children:[r.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[f("logs.daemon_errors"),o.length?` · ${o.length}`:""]}),r.jsxs("div",{className:"border-t border-border p-3",children:[s.isLoading&&r.jsx(rt,{}),e&&!s.isLoading&&o.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:f("logs.no_errors")}),r.jsx("ul",{className:"space-y-1",children:o.map((l,c)=>r.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof l.ts=="string"&&r.jsx("span",{className:"font-mono",children:new Date(l.ts).toLocaleString()}),typeof l.level=="string"&&r.jsx("span",{className:"text-destructive",children:l.level})]}),r.jsx("p",{className:"whitespace-pre-wrap break-words font-mono",children:String(l.msg??l.message??l.error??l.raw??JSON.stringify(l)).slice(0,500)})]},c))})]})]})}function YP({pid:e}){const t=!e||String(e)==="0",[s,o]=x.useState(""),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,h]=x.useState(""),g=s.trim()||void 0,b=t?`/messages/global?channel=${g??""}`:`/projects/${e}/messages?channel=${g??""}`,v=We(b,()=>t?xf.global({channel:g,limit:300}):xf.project(e,{channel:g,limit:300})),k=x.useMemo(()=>[...v.data||[]].sort((j,C)=>(C.ts||"").localeCompare(j.ts||"")),[v.data]),E=x.useMemo(()=>Array.from(new Set(k.map(j=>j.type).filter(Boolean))),[k]),y=x.useMemo(()=>k.filter(j=>!(l&&j.direction!==l||u&&j.type!==u||m&&!(j.body||"").toLowerCase().includes(m.toLowerCase()))),[k,l,u,m]);return r.jsxs(Ye,{title:f("logs.title"),description:f(t?"logs.desc_global":"logs.desc_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ee,{placeholder:f("logs.filter_channel"),value:s,onChange:j=>o(j.target.value),className:"w-44"}),r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>v.mutate(),children:r.jsx(ua,{size:13})})]}),children:[t&&r.jsx(GP,{}),r.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"w-36",children:r.jsx(_t,{value:l,onChange:c,placeholder:f("logs.filter_dir"),options:[{value:"",label:f("logs.all_directions")},{value:"in",label:f("logs.in")},{value:"out",label:f("logs.out")}]})}),r.jsx("div",{className:"w-40",children:r.jsx(_t,{value:u,onChange:p,placeholder:f("logs.filter_type"),options:[{value:"",label:f("logs.all_types")},...E.map(j=>({value:j,label:j}))]})}),r.jsx(Ee,{placeholder:f("logs.search_text"),value:m,onChange:j=>h(j.target.value),className:"w-56"}),r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[y.length," ",f("logs.count_of")," ",k.length]})]}),v.isLoading&&r.jsx(rt,{}),v.error&&r.jsx(bt,{children:f("logs.error",{msg:v.error.message})}),!v.isLoading&&!v.error&&y.length===0&&r.jsx(bt,{children:g?f("logs.no_activity_ch",{ch:g}):f("logs.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:y.map((j,C)=>r.jsx(FP,{m:j},`${j.ts}-${C}`))})]})}function iN({value:e,onChange:t,options:s,placeholder:o=f("shared_ui.model_combobox_ph"),invalid:l,invalidHint:c,className:u}){const[p,m]=x.useState(!1),[h,g]=x.useState(e),b=x.useRef(null),v=x.useRef(null),[k,E]=x.useState(null);x.useEffect(()=>{g(e)},[e]),x.useLayoutEffect(()=>{if(!p)return;const N=()=>{const R=b.current;if(!R)return;const M=R.getBoundingClientRect();E({top:M.bottom+4,left:M.left,width:M.width})};return N(),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[p]),x.useEffect(()=>{if(!p)return;const N=R=>{const M=R.target;b.current?.contains(M)||v.current?.contains(M)||m(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[p]);const y=h.trim().toLowerCase(),C=y&&!(h===e)?s.filter(N=>N.toLowerCase().includes(y)):s,S=N=>{t(N),g(N),m(!1)};return r.jsxs("div",{ref:b,className:Te("relative",u),children:[r.jsxs("div",{className:Te("flex items-center gap-1 rounded-lg border bg-background px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring",l?"border-amber-500/60":"border-border"),children:[l&&r.jsx(Ge,{content:c||f("models_ui.invalid_hint"),children:r.jsx("span",{children:r.jsx(oS,{className:"size-3.5 shrink-0 text-amber-400"})})}),r.jsx("input",{value:h,placeholder:o,onChange:N=>{g(N.target.value),t(N.target.value),m(!0)},onFocus:()=>m(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),r.jsx("button",{type:"button",tabIndex:-1,onClick:()=>m(N=>!N),className:"shrink-0 text-muted-fg hover:text-foreground",children:r.jsx(pa,{className:"size-4"})})]}),p&&C.length>0&&k&&Ps.createPortal(r.jsx("ul",{ref:v,style:{position:"fixed",top:k.top,left:k.left,width:k.width},className:"z-[1000] max-h-56 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:C.map(N=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:R=>{R.preventDefault(),S(N)},className:Te("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",N===e&&"bg-accent/50"),children:r.jsx("span",{className:"truncate font-mono text-xs",children:N})})},N))}),document.body)]})}function qr(){const{data:e,error:t,isLoading:s,mutate:o}=We("/admin/config",()=>Gl.config.get()),l=async(c,u)=>{const p=await Gl.config.patch({set:c,unset:u});return await o({config:p.config},{revalidate:!1}),p.config};return{config:e?.config||{},error:t,isLoading:s,mutate:o,patch:l}}function cN(){const{data:e,error:t,isLoading:s,mutate:o}=We("/admin/super-agent",()=>Gl.superAgent());return{superAgent:e,error:t,isLoading:s,mutate:o}}const KP={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"},XP={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"},Cc=[{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 og(e,t){return t&&t in e?e[t]:e.custom}const wf={anthropic:Za,openai:on,gemini:DM,groq:Il,openrouter:Fx,ollama:aS,azure:yM,mock:Zk,custom:ei},ho={anthropic:{base_url:"",default_model:"claude-sonnet-4.6",api_key_env:"ANTHROPIC_API_KEY",known_models:["claude-opus-4.8","claude-opus-4.7","claude-opus-4.6","claude-sonnet-4.6","claude-sonnet-4.5","claude-haiku-4.5"]},openai:{base_url:"https://api.openai.com/v1",default_model:"gpt-4o-mini",api_key_env:"OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","o3-mini"]},gemini:{base_url:"https://generativelanguage.googleapis.com/v1beta/openai",default_model:"gemini-2.5-flash",api_key_env:"GEMINI_API_KEY",known_models:["gemini-3.5-pro","gemini-3.5-flash","gemini-3.1-pro","gemini-3.1-flash","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"]},groq:{base_url:"https://api.groq.com/openai/v1",default_model:"llama-3.3-70b-versatile",api_key_env:"GROQ_API_KEY",known_models:["llama-3.3-70b-versatile","llama-3.1-8b-instant","meta-llama/llama-4-scout-17b-16e-instruct","openai/gpt-oss-120b","openai/gpt-oss-20b","groq/compound","groq/compound-mini","qwen/qwen3-32b","whisper-large-v3-turbo"]},openrouter:{base_url:"https://openrouter.ai/api/v1",default_model:"openrouter/auto",api_key_env:"OPENROUTER_API_KEY",known_models:["openrouter/auto","openrouter/free","deepseek/deepseek-r1:free","meta-llama/llama-3.3-70b-instruct:free","google/gemini-2.0-flash-exp:free","qwen/qwen3-235b-a22b:free","anthropic/claude-sonnet-4.5","openai/gpt-4o-mini"]},ollama:{base_url:"http://127.0.0.1:11434",default_model:"gemma2:9b",api_key_env:"",known_models:[]},azure:{base_url:"",default_model:"gpt-4o-mini",api_key_env:"AZURE_OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini"]},mock:{base_url:"",default_model:"mock",api_key_env:"",known_models:["mock"]},custom:{base_url:"",default_model:"",api_key_env:"",known_models:[]}};function uN(e){const t=e.indexOf(":");return t<0?{provider:e,model:""}:{provider:e.slice(0,t),model:e.slice(t+1)}}function lg({value:e,onChange:t,providers:s}){const{provider:o,model:l}=uN(e),c=s.find(g=>g.slug===o),u=!!o&&!c,p=x.useMemo(()=>{const g=c?ho[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...g]))},[c]),m=g=>{const b=s.find(k=>k.slug===g),v=b?.default_model||ho[b?.engine]?.default_model||"";t(v?`${g}:${v}`:`${g}:`)},h=g=>t(`${o}:${g}`);return r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(_t,{value:o,onChange:m,placeholder:u?f("router_panel.provider_not_found",{name:o}):f("router_panel.provider_ph"),options:s.map(g=>({value:g.slug,label:g.slug,icon:wf[g.engine]}))}),r.jsx(iN,{value:l,onChange:h,options:p,invalid:u,invalidHint:f("router_panel.provider_not_configured",{name:o})})]})}function QP(){const e=ot(),{superAgent:t,isLoading:s,mutate:o}=cN(),{config:l,patch:c}=qr(),[u,p]=x.useState(""),[m,h]=x.useState([]),[g,b]=x.useState(""),[v,k]=x.useState(null),[E,y]=x.useState(!1),[j,C]=x.useState({model:"",fallback:[]});x.useEffect(()=>{if(!t)return;const L=t.model_fallback?.models||[],H=Array.isArray(L)?L:[];p(t.model||""),h(H),C({model:t.model||"",fallback:H})},[t]);const S=x.useMemo(()=>{const L=l.engines||{};return Object.entries(L).map(([H,O])=>({slug:H,engine:O?.engine||H,default_model:O?.default_model||ho[O?.engine||H]?.default_model}))},[l.engines]),N=L=>{const{provider:H}=uN(L);return S.some(O=>O.slug===H)};if(s||!t)return r.jsx(rt,{});const R=u!==j.model||JSON.stringify(m)!==JSON.stringify(j.fallback),M=async()=>{y(!0);try{await c({"super_agent.model":u,"super_agent.model_fallback.enabled":m.length>0,"super_agent.model_fallback.models":m}),e.success(f("router_panel.saved_toast")),C({model:u,fallback:m}),o()}catch(L){e.error(L.message)}finally{y(!1)}},T=()=>{const L=g.trim().replace(/:$/,"");!L||!L.includes(":")||m.includes(L)||(h([...m,L]),b(""))},z=(L,H)=>{const O=[...m];O[L]=H,h(O)},D=L=>{h(m.filter((H,O)=>O!==L)),v===L&&k(null)},U=(L,H)=>{const O=L+H;if(O<0||O>=m.length)return;const P=[...m];[P[L],P[O]]=[P[O],P[L]],h(P)};return r.jsx(Ye,{title:f("router_panel.title"),description:f("router_panel.description"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs($e,{tone:"success",children:[r.jsx(Fx,{size:11})," ",f("router_panel.badge_default")]}),r.jsx("span",{className:`font-mono text-xs ${!N(u)&&u?"text-amber-400":""}`,children:u||"—"}),m.map(L=>r.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[r.jsx(Yk,{size:12}),r.jsx("span",{className:`font-mono text-xs ${N(L)?"":"text-amber-400"}`,children:L})]},L))]}),S.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:f("router_panel.no_providers")}):r.jsx(ie,{label:f("router_panel.active_model_label"),hint:f("router_panel.active_model_hint"),children:r.jsx(lg,{value:u,onChange:p,providers:S})}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("div",{className:"text-sm font-medium",children:f("router_panel.fallback_title")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("router_panel.fallback_desc")})]}),r.jsxs("ul",{className:"mb-3 space-y-1",children:[m.map((L,H)=>{const O=!N(L),P=v===H;return r.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"w-6 text-muted-fg",children:["#",H+1]}),P?r.jsx("div",{className:"flex-1",children:r.jsx(lg,{value:L,onChange:B=>z(H,B),providers:S})}):r.jsxs("button",{type:"button",onClick:()=>k(H),className:"flex flex-1 items-center gap-1.5 text-left",children:[O&&r.jsx(oS,{size:12,className:"text-amber-400"}),r.jsx("span",{className:`font-mono ${O?"text-amber-400":""}`,children:L})]}),P?r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>k(null),children:f("router_panel.done")}):r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>k(H),children:r.jsx(To,{size:12})}),r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>U(H,-1),disabled:H===0,children:"↑"}),r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>U(H,1),disabled:H===m.length-1,children:"↓"}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>D(H),children:r.jsx(Gn,{size:12})})]})},`${H}-${L}`)}),m.length===0&&r.jsx("li",{className:"text-xs text-muted-fg",children:f("router_panel.fallback_empty")})]}),S.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs text-muted-fg",children:f("router_panel.add_to_chain")}),r.jsx(lg,{value:g,onChange:b,providers:S}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:T,disabled:!g.includes(":")||g.endsWith(":"),children:[r.jsx(an,{size:13})," ",f("router_panel.add_to_chain")]})]})]}),r.jsx(ce,{variant:"primary",loading:E,disabled:!R,onClick:M,children:f(R?"router_panel.save":"router_panel.saved")})]})})}function WP({provider:e,onEdit:t,onDelete:s,onToggle:o}){const l=og(KP,e.engine),c=og(XP,e.engine),u=og(wf,e.engine),p=Cc.find(b=>b.value===e.engine)?.label||e.engine,m=typeof e.api_key=="string"&&e.api_key.length>0,h=ko(e.api_key),g=e.is_active!==!1;return r.jsxs("div",{className:"group flex h-full cursor-pointer flex-col gap-3 rounded-xl border border-border bg-card p-4 transition-colors hover:border-muted-fg/50",onClick:t,children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:Te("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",l),children:r.jsx(u,{className:"size-5 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),r.jsxs("span",{className:Te("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[r.jsx(u,{className:"size-3"})," ",p]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx(Ge,{content:f(g?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:r.jsxs("button",{type:"button",onClick:b=>{b.stopPropagation(),o()},className:Te("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",g?"border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10":"border-border text-muted-fg hover:text-foreground"),children:[r.jsx("span",{className:Te("size-1.5 rounded-full",g?"bg-emerald-400":"bg-muted-fg/40")}),f(g?"providers_card.active":"providers_card.off")]})}),r.jsx(Ge,{content:f("providers_modal.delete"),children:r.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),s()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:r.jsx(Gn,{className:"size-3.5"})})})]})]}),r.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[r.jsx(nc,{label:f("providers_card.model"),value:e.default_model||"—",mono:!0}),e.base_url&&r.jsx(nc,{label:f("providers_card.base_url"),value:e.base_url,mono:!0,truncate:!0}),r.jsx(nc,{label:f("providers_card.api_key"),value:m?h?`…${h}`:f("providers_card.key_set"):"—",mono:!!h}),e.default_temperature!==void 0&&r.jsx(nc,{label:f("providers_card.temp"),value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&r.jsx(nc,{label:f("providers_card.price_io"),value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function nc({label:e,value:t,mono:s,truncate:o}){return r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:e}),r.jsx("span",{className:Te("text-foreground",s&&"font-mono",o&&"max-w-[180px] truncate"),children:t})]})}const ew={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:""},ZP=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function sc(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Td(e){if(e==null)return"";const t=Number(e);return Number.isFinite(t)?String(t):""}function JP(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:Td(e.pricing?.input_per_million),p_output:Td(e.pricing?.output_per_million),p_cache_read:Td(e.pricing?.cache_read_per_million),p_cache_write:Td(e.pricing?.cache_write_per_million)}}function e6({open:e,initial:t,existingSlugs:s,onClose:o,onSave:l}){const c=!!t,[u,p]=x.useState(ew),[m,h]=x.useState(!1),[g,b]=x.useState(null),[v,k]=x.useState([]),[E,y]=x.useState(!1),[j,C]=x.useState(null),[S,N]=x.useState(!1),[R,M]=x.useState("");x.useEffect(()=>{if(!e)return;const F=t?JP(t):ew;p(F),b(null),C(null),N(!1);const K=ho[F.engine];k(K?.known_models||[])},[e,t]);const T=F=>p(K=>({...K,...F})),z=F=>{const K=ho[F];T({engine:F,name:F==="custom"?u.name:Cc.find(I=>I.value===F)?.label||F,slug:F==="custom"?u.slug:F,base_url:K.base_url,default_model:K.default_model}),k(K.known_models),C(null)},D=F=>{const K=ho[F];T({engine:F,base_url:u.base_url||K.base_url,default_model:u.default_model||K.default_model}),k(K.known_models)},U=async()=>{y(!0),C(null);try{const F=await bf.models({engine:u.engine,slug:u.slug||sc(u.name),base_url:u.base_url||void 0,api_key:u.api_key_value||void 0});if(F.error){C(F.error);return}k(F.models),F.models.length===0&&C(f("providers_modal.err_no_models"))}catch(F){C(F.message||f("providers_modal.err_list_models"))}finally{y(!1)}},L=x.useMemo(()=>u.default_model&&!v.includes(u.default_model)?[u.default_model,...v]:v,[v,u.default_model]),H=()=>{const F=(u.slug||sc(u.name)).trim();if(!F)return b(f("providers_modal.err_slug_required")),null;if(!c&&s.includes(F))return b(f("providers_modal.err_slug_exists",{slug:F})),null;let K;if(u.model_context_limits_json.trim())try{const Z=JSON.parse(u.model_context_limits_json);if(!Z||typeof Z!="object"||Array.isArray(Z))throw new Error;K=Z}catch{return b(f("providers_modal.err_model_limits_json")),null}const G=[u.p_input,u.p_output,u.p_cache_read,u.p_cache_write].map(Z=>Z.trim()).some(Boolean)?{input_per_million:Number(u.p_input||0),output_per_million:Number(u.p_output||0),cache_read_per_million:Number(u.p_cache_read||0),cache_write_per_million:Number(u.p_cache_write||0)}:void 0;return{provider:{slug:F,name:u.name.trim()||F,engine:u.engine,base_url:u.base_url.trim()||void 0,default_model:u.default_model.trim()||void 0,default_temperature:u.default_temperature,default_max_tokens:u.default_max_tokens,is_active:u.is_active,context_limit_tokens:u.context_limit_tokens||void 0,model_context_limits:K,pricing:G},modelLimits:K}},O=()=>{const F=H();if(!F)return;const{provider:K}=F,I={name:K.name,engine:K.engine,is_active:K.is_active!==!1,default_temperature:K.default_temperature,default_max_tokens:K.default_max_tokens};K.base_url&&(I.base_url=K.base_url),K.default_model&&(I.default_model=K.default_model),K.context_limit_tokens&&(I.context_limit_tokens=K.context_limit_tokens),K.model_context_limits&&(I.model_context_limits=K.model_context_limits),K.pricing&&(I.pricing=K.pricing),u.api_key_value.trim()&&(I.api_key=u.api_key_value.trim()),M(JSON.stringify(I,null,2)),b(null),N(!0)},P=async()=>{h(!0),b(null);try{if(S){const K=(u.slug||sc(u.name)).trim();if(!K){b(f("providers_modal.err_slug_required_form"));return}let I;try{I=JSON.parse(R)}catch{b(f("providers_modal.err_json_invalid"));return}if(!I||typeof I!="object"||Array.isArray(I)){b(f("providers_modal.err_json_object"));return}const G=I;if(!G.engine||typeof G.engine!="string"){b(f("providers_modal.err_engine_missing"));return}const Z={slug:K,name:typeof G.name=="string"?G.name:K,engine:String(G.engine),base_url:typeof G.base_url=="string"?G.base_url:void 0,default_model:typeof G.default_model=="string"?G.default_model:void 0,is_active:G.is_active!==!1};await l({provider:Z,raw:G,originalSlug:t?.slug}),o();return}const F=H();if(!F)return;await l({provider:F.provider,apiKeyValue:u.api_key_value.trim()||void 0,originalSlug:t?.slug}),o()}catch(F){b(F.message||f("providers_modal.err_save"))}finally{h(!1)}},B=c&&is(t?.api_key),$=ko(t?.api_key),q=B?f("providers_modal.api_key_set",{suffix:$??""}):"sk-…",X=u.engine==="ollama",Y=ho[u.engine]?.api_key_env;return r.jsx(Sn,{open:e,onClose:o,title:c?f("providers_modal.edit_title",{name:t?.name||t?.slug||""}):f("providers_modal.new_title"),description:f("providers_modal.description"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:o,disabled:m,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:P,loading:m,children:f(c?"common.save":"common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[c?r.jsx("span",{}):r.jsx("div",{className:"flex flex-wrap gap-1.5",children:ZP.map(F=>{const K=wf[F],I=F==="custom"?f("providers_modal.custom"):Cc.find(Z=>Z.value===F)?.label||F,G=u.engine===F;return r.jsxs("button",{type:"button",onClick:()=>z(F),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${G?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:border-muted-fg/60 hover:text-foreground"}`,children:[r.jsx(K,{className:"size-3.5"})," ",I]},F)})}),r.jsxs("button",{type:"button",onClick:()=>S?N(!1):O(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${S?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[r.jsx(hM,{className:"size-3.5"})," ",f(S?"providers_modal.form_mode":"providers_modal.json_mode")]})]}),S?r.jsxs("div",{className:"space-y-2",children:[r.jsx(ie,{label:f("providers_modal.json_label"),hint:f("providers_modal.json_hint",{slug:u.slug||sc(u.name)||"<slug>"}),children:r.jsx(On,{rows:14,className:"font-mono text-xs",value:R,onChange:F=>M(F.target.value),spellCheck:!1})}),r.jsx("p",{className:"text-[11px] text-muted-fg",children:f("providers_modal.json_help")})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("providers_modal.name_label"),children:r.jsx(Ee,{value:u.name,onChange:F=>T({name:F.target.value,slug:c?u.slug:sc(F.target.value)}),placeholder:f("providers_modal.name_ph")})}),r.jsx(ie,{label:f("providers_modal.engine_label"),children:r.jsx(_t,{value:u.engine,onChange:F=>D(F),options:Cc.map(F=>({value:F.value,label:F.label,icon:wf[F.value]}))})})]}),r.jsx(ie,{label:f("providers_modal.base_url_label"),hint:f("providers_modal.base_url_hint"),children:r.jsx(Ee,{value:u.base_url,onChange:F=>T({base_url:F.target.value}),placeholder:f("providers_modal.base_url_ph")})}),!X&&r.jsx(ie,{label:f("providers_modal.api_key_label"),hint:B?f("providers_modal.api_key_hint_existing"):Y?f("providers_modal.api_key_hint_env",{env:Y}):f("providers_modal.api_key_hint"),children:r.jsx(Ee,{type:"password",autoComplete:"new-password",value:u.api_key_value,onChange:F=>T({api_key_value:F.target.value}),placeholder:q})}),r.jsx(ie,{label:f("providers_modal.model_label"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(iN,{value:u.default_model,onChange:F=>T({default_model:F}),options:L,className:"flex-1"}),r.jsx(Ge,{content:f("providers_modal.list_models_hint"),children:r.jsxs(ce,{size:"sm",variant:"secondary",onClick:U,disabled:E,"aria-label":f("providers_modal.list_models_hint"),children:[E?r.jsx(zf,{className:"size-3.5 animate-spin"}):r.jsx(ua,{className:"size-3.5"}),f("providers_modal.load_models")]})})]}),j&&r.jsx("p",{className:"text-[11px] text-amber-400",children:j})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("providers_modal.max_tokens_label"),children:r.jsx(Ee,{type:"number",min:256,step:256,value:u.default_max_tokens,onChange:F=>T({default_max_tokens:parseInt(F.target.value)||4096})})}),r.jsx(ie,{label:f("providers_modal.temperature_label",{value:u.default_temperature.toFixed(1)}),children:r.jsx("input",{type:"range",min:0,max:2,step:.1,value:u.default_temperature,onChange:F=>T({default_temperature:parseFloat(F.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),r.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[r.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:f("providers_modal.pricing_summary")}),r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsx(ie,{label:f("providers_modal.context_limit_label"),children:r.jsx(Ee,{type:"number",min:0,step:1024,value:u.context_limit_tokens,onChange:F=>T({context_limit_tokens:parseInt(F.target.value)||0})})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("providers_modal.price_input"),children:r.jsx(Ee,{type:"number",min:0,step:1e-4,value:u.p_input,onChange:F=>T({p_input:F.target.value}),placeholder:"0.15"})}),r.jsx(ie,{label:f("providers_modal.price_output"),children:r.jsx(Ee,{type:"number",min:0,step:1e-4,value:u.p_output,onChange:F=>T({p_output:F.target.value}),placeholder:"0.60"})}),r.jsx(ie,{label:f("providers_modal.price_cache_read"),children:r.jsx(Ee,{type:"number",min:0,step:1e-4,value:u.p_cache_read,onChange:F=>T({p_cache_read:F.target.value}),placeholder:"0.03"})}),r.jsx(ie,{label:f("providers_modal.price_cache_write"),children:r.jsx(Ee,{type:"number",min:0,step:1e-4,value:u.p_cache_write,onChange:F=>T({p_cache_write:F.target.value}),placeholder:"0.00"})})]}),r.jsx(ie,{label:f("providers_modal.model_limits_label"),hint:'{"gpt-4o-mini":128000}',children:r.jsx(On,{rows:3,className:"font-mono text-xs",value:u.model_context_limits_json,onChange:F=>T({model_context_limits_json:F.target.value})})})]})]}),r.jsx(Qt,{checked:u.is_active,onChange:F=>T({is_active:F}),label:f("providers_modal.active_label")})]}),g&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:g})]})})}const t6=new Set(Cc.map(e=>e.value));function n6(e,t){const s=typeof t.engine=="string"&&t.engine||(t6.has(e)?e:"custom");return{slug:e,name:typeof t.name=="string"?t.name:void 0,engine:s,base_url:typeof t.base_url=="string"?t.base_url:void 0,api_key:typeof t.api_key=="string"?t.api_key:void 0,default_model:typeof t.default_model=="string"?t.default_model:void 0,default_temperature:typeof t.default_temperature=="number"?t.default_temperature:void 0,default_max_tokens:typeof t.default_max_tokens=="number"?t.default_max_tokens:void 0,is_active:typeof t.is_active=="boolean"?t.is_active:void 0,context_limit_tokens:typeof t.context_limit_tokens=="number"?t.context_limit_tokens:void 0,model_context_limits:t.model_context_limits||void 0,pricing:t.pricing||void 0}}function s6(){const e=ot(),{config:t,isLoading:s,patch:o,mutate:l}=qr(),[c,u]=x.useState(!1),[p,m]=x.useState(null);if(s)return r.jsx(rt,{});const h=t.engines||{},g=Object.entries(h).map(([C,S])=>n6(C,S||{})),b=g.map(C=>C.slug),v=()=>{m(null),u(!0)},k=C=>{m(C),u(!0)},E=async({provider:C,apiKeyValue:S,raw:N})=>{if(N){await o({[`engines.${C.slug}`]:N}),e.success(f("engines_panel.saved_json")),l();return}const R=`engines.${C.slug}`,M={[`${R}.name`]:C.name,[`${R}.engine`]:C.engine,[`${R}.is_active`]:C.is_active!==!1,[`${R}.default_temperature`]:C.default_temperature,[`${R}.default_max_tokens`]:C.default_max_tokens},T=[],z=(D,U)=>{U===void 0||U===""?T.push(`${R}.${D}`):M[`${R}.${D}`]=U};z("base_url",C.base_url),z("default_model",C.default_model),z("context_limit_tokens",C.context_limit_tokens),z("pricing",C.pricing),z("model_context_limits",C.model_context_limits),S&&(M[`${R}.api_key`]=S),await o(M,T),e.success(f("engines_panel.saved")),l()},y=async C=>{try{await o({[`engines.${C.slug}.is_active`]:C.is_active===!1}),l()}catch(S){e.error(S.message)}},j=async C=>{if(confirm(f("engines_panel.delete_confirm",{name:C.name||C.slug})))try{await o(void 0,[`engines.${C.slug}`]),e.success(f("engines_panel.deleted")),l()}catch(S){e.error(S.message)}};return r.jsxs(Ye,{title:f("engines_panel.title"),description:f("engines_panel.description"),action:r.jsxs(ce,{size:"sm",variant:"primary",onClick:v,children:[r.jsx(an,{size:14})," ",f("engines_panel.new_btn")]}),children:[g.length===0?r.jsx(bt,{children:f("engines_panel.empty")}):r.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[g.map(C=>r.jsx(WP,{provider:C,onEdit:()=>k(C),onDelete:()=>j(C),onToggle:()=>y(C)},C.slug)),r.jsxs("button",{type:"button",onClick:v,className:"flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border text-muted-fg transition-colors hover:border-muted-fg/60 hover:text-foreground",children:[r.jsx(an,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:f("engines_panel.add_card")})]})]}),r.jsx(e6,{open:c,initial:p,existingSlugs:b,onClose:()=>{u(!1),m(null)},onSave:E})]})}function dN(){return r.jsxs("div",{className:"space-y-6",children:[r.jsx(QP,{}),r.jsx(s6,{})]})}function a6(){const e=ot(),[t,s]=x.useState(!1),l=We(t?"/agents/vault?include_removed=1":"/agents/vault",()=>ln.vault({includeRemoved:t})),c=l.data||[],[u,p]=x.useState(null),m=async g=>{const b=g.source!=="user",v=b?f("base.defaults_tombstone_msg",{slug:g.slug}):f("base.defaults_delete_msg",{slug:g.slug});if(confirm(v))try{await ln.vaultRemove(g.slug),e.success(f(b?"base.defaults_hidden":"base.defaults_deleted")),l.mutate()}catch(k){e.error(k.message)}},h=async g=>{try{await ln.vaultRestore(g),e.success(f("base.defaults_restored")),l.mutate()}catch(b){e.error(b.message)}};return r.jsxs(Ye,{title:f("base.defaults_title"),description:f("base.defaults_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qt,{checked:t,onChange:s,label:f("base.defaults_show_removed")}),r.jsxs(ce,{size:"sm",onClick:()=>p("new"),children:[r.jsx(an,{size:14})," ",f("base.defaults_new")]})]}),children:[l.isLoading&&r.jsx(rt,{}),!l.isLoading&&c.length===0&&r.jsx(bt,{children:f("base.defaults_empty")}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(g=>{const b=t&&g.tombstoned;return r.jsxs("div",{className:`flex flex-col gap-2 rounded-xl border bg-card p-4 ${b?"border-dashed border-border opacity-60":"border-border"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-slate-600 to-gray-600",children:g.is_master?r.jsx(Fa,{className:"size-4 text-white"}):r.jsx(on,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:g.slug}),r.jsx(r6,{source:g.source})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?r.jsx(ig,{label:f("base.defaults_restore"),onClick:()=>h(g.slug),variant:"secondary",children:r.jsx(Df,{size:13})}):r.jsxs(r.Fragment,{children:[r.jsx(ig,{label:f("base.defaults_edit"),onClick:()=>p(g),variant:"ghost",children:r.jsx(To,{size:13})}),r.jsx(ig,{label:g.source==="user"?f("base.defaults_delete"):f("base.defaults_hide"),onClick:()=>m(g),variant:"ghost-destructive",children:r.jsx(Gn,{size:13})})]})})]}),g.model?r.jsx($e,{tone:"info",children:g.model}):r.jsx("span",{className:"text-[10px] text-muted-fg",children:f("agents_ui.model_router_default")}),g.description&&r.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:g.description}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[g.role&&r.jsx($e,{children:g.role}),g.skills?.map(v=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(Za,{size:9})," ",v]},v)),g.tools?.map(v=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(ei,{size:9})," ",v]},v))]})]},g.slug)})}),u!==null&&r.jsx(o6,{agent:u==="new"?null:u,onClose:()=>p(null),onSaved:()=>{p(null),l.mutate()}})]})}function r6({source:e}){return e==="user"?r.jsx($e,{tone:"success",children:f("agents_ui.source_user")}):e==="user-override"?r.jsx($e,{tone:"warning",children:f("agents_ui.source_override")}):r.jsx($e,{tone:"muted",children:f("agents_ui.source_bundled")})}function ig({label:e,onClick:t,variant:s="ghost",children:o}){const l="inline-flex size-7 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",c={ghost:"text-muted-fg hover:bg-accent hover:text-accent-fg","ghost-destructive":"text-muted-fg hover:bg-destructive/15 hover:text-destructive",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"};return r.jsxs(Pb,{children:[r.jsx(Ib,{render:r.jsx("button",{type:"button",onClick:t,"aria-label":e,className:`${l} ${c[s]}`,children:o})}),r.jsx(Bb,{children:e})]})}function o6({agent:e,onClose:t,onSaved:s}){const o=ot(),[l,c]=x.useState(!1),u=!e,[p,m]=x.useState(e?.slug??""),[h,g]=x.useState(e?.role??""),[b,v]=x.useState(e?.model??""),[k,E]=x.useState(e?.description??""),[y,j]=x.useState(e?.language??"es"),[C,S]=x.useState((e?.skills??[]).join(", ")),[N,R]=x.useState((e?.tools??[]).join(", ")),[M,T]=x.useState(!!e?.is_master),[z,D]=x.useState(e?.body??""),U=async()=>{const L={role:h||void 0,model:b||void 0,description:k||void 0,language:y||void 0,skills:C,tools:N,is_master:M};c(!0);try{if(u){if(!/^[a-z][a-z0-9_-]*$/.test(p))throw new Error(f("base.defaults_slug_invalid"));await ln.vaultCreate(p,L,z),o.success(f("base.defaults_created",{slug:p}))}else await ln.vaultPatch(e.slug,{fields:L,body:z}),o.success(f("base.defaults_saved",{slug:e.slug}));s()}catch(H){o.error(H.message)}finally{c(!1)}};return r.jsx(Sn,{open:!0,onClose:t,title:u?f("base.defaults_new_title"):f("base.defaults_edit_title",{slug:e.slug}),description:u?f("base.defaults_new_desc"):e.source==="bundled"?f("base.defaults_bundled_desc"):f("base.defaults_user_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:l,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:U,loading:l,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[u&&r.jsx(ie,{label:"slug",hint:f("agents_ui.slug_kebab_hint"),children:r.jsx(Ee,{autoFocus:!0,value:p,onChange:L=>m(L.target.value),placeholder:"reviewer"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:"role",children:r.jsx(Ee,{value:h,onChange:L=>g(L.target.value),placeholder:"Code reviewer"})}),r.jsx(ie,{label:"model",children:r.jsx(Ee,{value:b,onChange:L=>v(L.target.value),placeholder:"openrouter:..."})}),r.jsx(ie,{label:"language",children:r.jsx(Ee,{value:y,onChange:L=>j(L.target.value),placeholder:"es"})}),r.jsx(ie,{label:"is_master",children:r.jsx("div",{className:"flex h-9 items-center",children:r.jsx(Qt,{checked:M,onChange:T,label:f("base.defaults_master_label")})})})]}),r.jsx(ie,{label:"description",children:r.jsx(Ee,{value:k,onChange:L=>E(L.target.value)})}),r.jsx(ie,{label:"skills",hint:f("agents_ui.comma_separated"),children:r.jsx(Ee,{value:C,onChange:L=>S(L.target.value),placeholder:"code-review, git"})}),r.jsx(ie,{label:"tools",hint:f("agents_ui.comma_separated"),children:r.jsx(Ee,{value:N,onChange:L=>R(L.target.value),placeholder:"read, write, run"})}),r.jsx(ie,{label:"body",hint:f("agents_ui.body_hint"),children:r.jsx(On,{value:z,onChange:L=>D(L.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const l6=20,tw=[10,20,50,100];function c_({key:e,fetchPage:t,resetKey:s,initialPageSize:o=l6,swr:l}){const[c,u]=x.useState(1),[p,m]=x.useState(o);x.useEffect(()=>{u(1)},[s]);const h=(c-1)*p,g=We(e==null?null:[e,p,h],()=>t(p,h),{keepPreviousData:!0,...l}),b=g.data?.total??0,v=Math.max(1,Math.ceil(b/p)),k=Math.min(c,v);x.useEffect(()=>{c!==k&&u(k)},[c,k]);const E=b===0?0:h,y=Math.min(h+p,b);return{items:g.data?.items??[],isLoading:g.isLoading,error:g.error,mutate:g.mutate,page:k,pageCount:v,total:b,start:E,end:y,pageSize:p,setPage:u,setPageSize:j=>{m(j),u(1)}}}function i6({page:e,pageCount:t,total:s,start:o,end:l,pageSize:c,onPage:u,onPageSize:p}){return s<=tw[0]?null:r.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3 text-xs text-muted-fg",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"tabular-nums",children:f("common.pager_range",{from:o+1,to:l,total:s})}),r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx("span",{children:f("common.pager_per_page")}),r.jsx("div",{className:"w-[4.5rem]",children:r.jsx(_t,{value:String(c),onChange:m=>p(Number(m)),options:tw.map(m=>({value:String(m),label:String(m)}))})})]})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ce,{size:"sm",variant:"ghost",disabled:e<=1,onClick:()=>u(e-1),"aria-label":f("common.pager_prev"),children:r.jsx(gM,{size:14})}),r.jsx("span",{className:"px-1 tabular-nums",children:f("common.pager_page",{page:e,total:t})}),r.jsx(ce,{size:"sm",variant:"ghost",disabled:e>=t,onClick:()=>u(e+1),"aria-label":f("common.pager_next"),children:r.jsx(Jl,{size:14})})]})]})}function u_({paged:e,fullHeight:t,className:s,children:o}){const l=r.jsx(i6,{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?r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[r.jsx("div",{className:Te("min-h-0 flex-1 overflow-y-auto",s),children:o}),r.jsx("div",{className:"shrink-0",children:l})]}):r.jsxs("div",{className:s,children:[o,l]})}const c6={apx:"success",claude:"info",codex:"warning"};function u6(){const e=ot(),t=up(),[s,o]=x.useState(""),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,h]=x.useState(!1);x.useEffect(()=>{const j=setTimeout(()=>p(l.trim()),350);return()=>clearTimeout(j)},[l]);const g=c_({key:`/sessions?engine=${s}&q=${u}&deep=${m?1:0}`,fetchPage:(j,C)=>GD.page({engine:s||void 0,q:u||void 0,deep:m,limit:j,offset:C}),resetKey:`${s}|${u}|${m?1:0}`}),b=()=>{c(""),p(""),o(""),h(!1)},v=async j=>{try{await navigator.clipboard.writeText(`apx session resume ${j.id} --continue`),e.success(f("base.sessions_cmd_copied"))}catch{e.error(f("base.sessions_copy_failed"))}},k=j=>{const C=`Continue this session: ${j.id} (engine: ${j.engine}${j.title?`, title: "${j.title}"`:""}${j.cwd?`, folder: ${j.cwd}`:""}). With these instructions: `;window.dispatchEvent(new CustomEvent("apx:roby-prompt",{detail:{prompt:C}}))},E=async j=>{if(!j.cwd){e.error(f("base.sessions_no_folder"));return}try{await SC.exec({kind:"open_path",target:j.cwd})}catch(C){e.error(f("base.sessions_folder_failed",{msg:C.message}))}},y=async j=>{const C=j.path||j.cwd;if(!C){e.error(f("base.sessions_no_path"));return}try{await navigator.clipboard.writeText(C),e.success(f("base.sessions_path_copied"))}catch{e.error(f("base.sessions_copy_failed"))}};return r.jsxs(Ye,{fullHeight:!0,title:f("base.sessions_title"),description:f("base.sessions_desc"),action:r.jsx(Ge,{content:f("base.sessions_refresh"),children:r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>g.mutate(),children:r.jsx(ua,{size:13})})}),children:[r.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(vc,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-fg"}),r.jsx(Ee,{className:"pl-8",placeholder:f("base.sessions_search_ph"),value:l,onChange:j=>c(j.target.value)})]}),r.jsx(Ge,{content:f("base.sessions_deep_tip"),children:r.jsx(ce,{size:"sm",variant:m?"primary":"secondary",onClick:()=>h(j=>!j),children:f("base.sessions_deep")})}),r.jsx("div",{className:"w-36",children:r.jsx(_t,{value:s,onChange:o,options:[{value:"",label:f("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),r.jsx(Ge,{content:f("base.sessions_clear"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:b,children:r.jsx(Ys,{size:14})})})]}),g.isLoading&&r.jsx(rt,{}),g.error&&r.jsx(bt,{children:f("base.sessions_error",{msg:g.error.message})}),!g.isLoading&&!g.error&&g.total===0&&r.jsx(bt,{children:u?f("base.sessions_no_match",{q:u}):f("base.sessions_empty")}),r.jsx(u_,{paged:g,fullHeight:!0,children:r.jsx("ul",{className:"space-y-1 text-sm",children:g.items.map((j,C)=>r.jsxs("li",{className:"group flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx($e,{tone:c6[j.engine]||"muted",children:j.engine}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate",children:j.title||j.id}),r.jsxs("div",{className:"flex items-center gap-2 font-mono text-[10px] text-muted-fg",children:[r.jsx("span",{className:"shrink-0",children:j.id}),j.cwd&&r.jsxs("span",{className:"truncate",children:["· ",j.cwd]})]})]}),j.mtime>0&&r.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(j.mtime).toLocaleString()}),r.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-60 transition-opacity group-hover:opacity-100",children:[r.jsx(Ge,{content:f("base.sessions_act_cmd"),children:r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("base.sessions_act_cmd"),onClick:()=>v(j),children:r.jsx(Ga,{size:13})})}),r.jsx(Ge,{content:f("base.sessions_act_ask",{name:t}),children:r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("base.sessions_act_ask",{name:t}),onClick:()=>k(j),children:r.jsx(on,{size:13})})}),r.jsx(Ge,{content:f("base.sessions_act_folder"),children:r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("base.sessions_act_folder"),onClick:()=>E(j),children:r.jsx(Mf,{size:13})})}),r.jsx(Ge,{content:f("base.sessions_act_path"),children:r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("base.sessions_act_path"),onClick:()=>y(j),children:r.jsx(Rc,{size:13})})})]})]},`${j.engine}-${j.id}-${C}`))})})]})}function d6(){const e=Yn(),[t,s]=x.useState("open"),o=c_({key:`/tasks?state=${t}`,fetchPage:(l,c)=>Nr.globalPage({state:t,limit:l,offset:c}),resetKey:t});return r.jsxs(Ye,{fullHeight:!0,title:f("project.global_tasks.title"),description:f("project.global_tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(l=>r.jsx(ce,{size:"sm",variant:t===l?"primary":"ghost",onClick:()=>s(l),children:l},l))}),children:[o.isLoading&&r.jsx(rt,{}),!o.isLoading&&o.total===0&&r.jsx(bt,{children:f("project.global_tasks.empty")}),r.jsx(u_,{paged:o,fullHeight:!0,children:r.jsx("ul",{className:"space-y-2 text-sm",children:o.items.map(l=>r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("button",{type:"button",onClick:()=>e(`/p/${l.project_id}/tasks`),title:f("project.global_tasks.go_project"),children:r.jsx($e,{tone:"info",children:(l.project_name||"").split("/").pop()||l.project_id})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"font-medium",children:l.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{children:l.state}),l.agent&&r.jsxs($e,{tone:"muted",children:["@",l.agent]}),l.tags?.map(c=>r.jsxs("span",{children:["#",c]},c)),l.due&&r.jsxs("span",{children:[f("project.global_tasks.due")," ",l.due]})]})]})]},`${l.project_id}-${l.id}`))})})]})}const fN=x.createContext(void 0);function d_(){const e=x.useContext(fN);if(e===void 0)throw new Error(rn(64));return e}let f6=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const mp={tabActivationDirection:e=>({[f6.activationDirection]:e})},p6=x.forwardRef(function(t,s){const{className:o,defaultValue:l=0,onValueChange:c,orientation:u="horizontal",render:p,value:m,style:h,...g}=t,b=t.defaultValue!==void 0,v=x.useRef([]),[k,E]=x.useState(()=>new Map),[y,j]=$l({controlled:m,default:l,name:"Tabs",state:"value"}),C=m!==void 0,[S,N]=x.useState(()=>new Map),R=x.useRef(void 0),M=x.useCallback(pe=>{if(pe===void 0)return null;for(const[Me,ue]of S.entries())if(ue!=null&&pe===(ue.value??ue.index))return Me;return null},[S]),[T,z]=x.useState(()=>({previousValue:y,tabActivationDirection:"none"})),{previousValue:D,tabActivationDirection:U}=T;let L=U,H=!1;D!==y&&(L=nw(D,y,u,S),H=D!=null&&y!=null&&M(y)==null);const O=H?D:y,P=D!==O||U!==L;ze(()=>{P&&z({previousValue:O,tabActivationDirection:L})},[O,P,L]);const B=Ue((pe,Me)=>{const ue=nw(y,pe,u,S);Me.activationDirection=ue,c?.(pe,Me),!Me.isCanceled&&j(pe)}),$=Ue((pe,Me)=>{c?.(pe,nt(Me,void 0,void 0,{activationDirection:"none"}))}),q=Ue((pe,Me)=>{E(ue=>{if(ue.get(pe)===Me)return ue;const me=new Map(ue);return me.set(pe,Me),me})}),X=Ue((pe,Me)=>{E(ue=>{if(!ue.has(pe)||ue.get(pe)!==Me)return ue;const me=new Map(ue);return me.delete(pe),me})}),Y=x.useCallback(pe=>k.get(pe),[k]),F=x.useCallback(pe=>{for(const Me of S.values())if(pe===Me?.value)return Me?.id},[S]),K=x.useMemo(()=>({getTabElementBySelectedValue:M,getTabIdByPanelValue:F,getTabPanelIdByValue:Y,onValueChange:B,orientation:u,registerMountedTabPanel:q,setTabMap:N,unregisterMountedTabPanel:X,tabActivationDirection:L,value:y}),[M,F,Y,B,u,q,N,X,L,y]),I=x.useMemo(()=>{for(const pe of S.values())if(pe!=null&&pe.value===y)return pe},[S,y]),G=x.useMemo(()=>{for(const pe of S.values())if(pe!=null&&!pe.disabled)return pe.value},[S]),Z=x.useRef(!b),te=x.useRef(l),de=x.useRef(b),ee=x.useRef(!1);ze(()=>{if(C)return;function pe(ke,je){j(ke),z(Be=>Be.previousValue===ke&&Be.tabActivationDirection==="none"?Be:{previousValue:ke,tabActivationDirection:"none"}),$(ke,je),Z.current=!1}if(S.size===0){ee.current&&y!==null&&!R.current?.isConnected&&pe(null,F1);return}ee.current=!0,R.current=S.keys().next().value;const Me=I?.disabled,ue=I==null&&y!==null;if(!Me&&y===te.current&&(de.current=!1),de.current&&Me&&y===te.current)return;const me=Z.current;if(Me||ue){const ke=G??null;if(y===ke){Z.current=!1;return}let je=F1;me?je=G1:Me&&(je=wS),pe(ke,je);return}me&&I!=null&&($(y,G1),Z.current=!1)},[G,C,$,I,j,S,y]);const ae=Et("div",t,{state:{orientation:u,tabActivationDirection:L},ref:s,props:g,stateAttributesMapping:mp});return r.jsx(fN.Provider,{value:K,children:r.jsx(ip,{elementsRef:v,children:ae})})});function nw(e,t,s,o){if(e==null||t==null)return"none";let l=null,c=null;for(const[m,h]of o.entries()){if(h==null)continue;const g=h.value??h.index;if(e===g&&(l=m),t===g&&(c=m),l!=null&&c!=null)break}if(l==null||c==null)return l!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?s==="horizontal"?t>e?"right":"left":t>e?"down":"up":"none";const u=l.getBoundingClientRect(),p=c.getBoundingClientRect();if(s==="horizontal"){if(p.left<u.left)return"left";if(p.left>u.left)return"right"}else{if(p.top<u.top)return"up";if(p.top>u.top)return"down"}return"none"}const pN="data-composite-item-active",mN=x.createContext(void 0);function m6(){const e=x.useContext(mN);if(e===void 0)throw new Error(rn(65));return e}const h6=x.forwardRef(function(t,s){const{className:o,disabled:l=!1,render:c,value:u,id:p,nativeButton:m=!0,style:h,...g}=t,{value:b,getTabPanelIdByValue:v,orientation:k,tabActivationDirection:E}=d_(),{activateOnFocus:y,highlightedTabIndex:j,onTabActivation:C,registerTabResizeObserverElement:S,setHighlightedTabIndex:N,tabsListElement:R}=m6(),M=Ks(p),T=x.useMemo(()=>({disabled:l,id:M,value:u}),[l,M,u]),{compositeProps:z,compositeRef:D,index:U}=oC({metadata:T}),L=u===b,H=x.useRef(!1),O=x.useRef(null);ze(()=>{const Z=O.current;if(Z)return S(Z)},[S]),ze(()=>{if(H.current){H.current=!1;return}if(!(L&&U>-1&&j!==U))return;const Z=R;if(Z!=null){const te=qn(ht(Z));if(te&&Qe(Z,te))return}l||N(U)},[L,U,j,N,l,R]);const{getButtonProps:P,buttonRef:B}=Vr({disabled:l,native:m,focusableWhenDisabled:!0}),$=v(u),q=x.useRef(!1),X=x.useRef(!1);function Y(Z){L||l||C(u,nt(fa,Z.nativeEvent,void 0,{activationDirection:"none"}))}function F(Z){L||(U>-1&&!l&&N(U),!l&&y&&(!q.current||q.current&&X.current)&&C(u,nt(fa,Z.nativeEvent,void 0,{activationDirection:"none"})))}function K(Z){if(L||l)return;q.current=!0;function te(){q.current=!1,X.current=!1}(!Z.button||Z.button===0)&&(X.current=!0,ht(Z.currentTarget).addEventListener("pointerup",te,{once:!0}))}return Et("button",t,{state:{disabled:l,active:L,orientation:k,tabActivationDirection:E},ref:[s,B,D,O],props:[z,{role:"tab","aria-controls":$,"aria-selected":L,id:M,onClick:Y,onFocus:F,onPointerDown:K,[pN]:L?"":void 0,onKeyDownCapture(){H.current=!0}},g,P],stateAttributesMapping:mp})});let g6=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=jo.startingStyle]="startingStyle",e[e.endingStyle=jo.endingStyle]="endingStyle",e})({});const x6={...mp,...Ja},b6=x.forwardRef(function(t,s){const{className:o,value:l,render:c,keepMounted:u=!1,style:p,...m}=t,{value:h,getTabIdByPanelValue:g,orientation:b,tabActivationDirection:v,registerMountedTabPanel:k,unregisterMountedTabPanel:E}=d_(),y=Ks(),j=x.useMemo(()=>({id:y,value:l}),[y,l]),{ref:C,index:S}=Kc({metadata:j}),N=l===h,{mounted:R,transitionStatus:M,setMounted:T}=si(N),z=!R,D=g(l),U={hidden:z,orientation:b,tabActivationDirection:v,transitionStatus:M},L=x.useRef(null),H=Et("div",t,{state:U,ref:[s,C,L],props:[{"aria-labelledby":D,hidden:z,id:y,role:"tabpanel",tabIndex:N?0:-1,inert:sp(!N),[g6.index]:S},m],stateAttributesMapping:x6});return ha({open:N,ref:L,onComplete(){N||T(!1)}}),ze(()=>{if(!(z&&!u)&&y!=null)return k(l,y),()=>{E(l,y)}},[z,u,l,y,k,E]),u||R?H:null}),_6=[];function v6(e){const{loopFocus:t=!0,orientation:s="both",grid:o,onLoop:l,direction:c,highlightedIndex:u,onHighlightedIndexChange:p,rootRef:m,enableHomeAndEndKeys:h=!1,stopEventPropagation:g=!1,disabledIndices:b,modifierKeys:v=_6}=e,[k,E]=x.useState(0),y=o!=null,j=x.useRef(null),C=Ka(j,m),S=x.useRef([]),N=x.useRef(!1),R=u??k,M=Ue((L,H=!1)=>{if((p??E)(L),H){const O=S.current[L];Rj(j.current,O,c,s)}}),T=Ue(L=>{if(L.size===0||N.current)return;N.current=!0;const H=Array.from(L.keys()),O=H.find(B=>B?.hasAttribute(pN))??null,P=O?H.indexOf(O):-1;if(P!==-1)M(P);else if(af(H,R,b)){const B=Va(H,{disabledIndices:b});yc(H,B)||M(B)}Rj(j.current,O,c,s)});ze(()=>{if(b==null||u!=null||!N.current)return;const L=S.current;if(af(L,R,b)){const H=Va(L,{disabledIndices:b});yc(L,H)||M(H)}},[b,u,R,S,M]);const z=Ue((L,H,O)=>l?l(L,H,O,S):O),D=Ue(L=>{const H=h?lp:W2;if(!H.has(L.key)||y6(L,v)||!j.current)return;const P=c==="rtl",B=P?pf:mf,$={horizontal:B,vertical:kc,both:B}[s],q=P?mf:pf,X={horizontal:q,vertical:wc,both:q}[s],Y=Un(L.nativeEvent);if(Y!=null&&Ej(Y)&&!iC(Y)){const de=Y.selectionStart,ee=Y.selectionEnd,ne=Y.value??"";if(de==null||L.shiftKey||de!==ee||L.key!==X&&de<ne.length||L.key!==$&&de>0)return}let F=R;const K=Hd(S,b),I=rx(S,b);o!=null&&(F=o({disabledIndices:b,elementsRef:S,event:L,highlightedIndex:R,loopFocus:t,maxIndex:I,minIndex:K,onLoop:z,orientation:s,rtl:P}));const G={horizontal:[B],vertical:[kc],both:[B,kc]}[s],Z={horizontal:[q],vertical:[wc],both:[q,wc]}[s],te=y?H:{horizontal:h?bz:X2,vertical:h?_z:Q2,both:H}[s];h&&(L.key===rp?F=K:L.key===op&&(F=I)),F===R&&(G.includes(L.key)||Z.includes(L.key))&&(t&&F===I&&G.includes(L.key)?(F=K,l&&(F=l(L,R,F,S))):t&&F===K&&Z.includes(L.key)?(F=I,l&&(F=l(L,R,F,S))):F=Va(S.current,{startingIndex:F,decrement:Z.includes(L.key),disabledIndices:b})),F!==R&&!yc(S.current,F)&&(g&&L.stopPropagation(),te.has(L.key)&&L.preventDefault(),M(F,!0),queueMicrotask(()=>{S.current[F]?.focus()}))});return{props:{ref:C,onFocus(L){const H=j.current,O=Un(L.nativeEvent);!H||O==null||!Ej(O)||O.setSelectionRange(0,O.value.length??0)},onKeyDown:D},highlightedIndex:R,onHighlightedIndexChange:M,elementsRef:S,disabledIndices:b,onMapChange:T,relayKeyboardEvent:D}}function y6(e,t){for(const s of kz.values())if(!t.includes(s)&&e.getModifierState(s))return!0;return!1}function j6(e){const{render:t,className:s,style:o,refs:l=Ya,props:c=Ya,state:u=Gt,stateAttributesMapping:p,highlightedIndex:m,onHighlightedIndexChange:h,orientation:g,grid:b,loopFocus:v,onLoop:k,enableHomeAndEndKeys:E,onMapChange:y,stopEventPropagation:j=!0,rootRef:C,disabledIndices:S,modifierKeys:N,highlightItemOnHover:R=!1,tag:M="div",...T}=e,z=tp(),{props:D,highlightedIndex:U,onHighlightedIndexChange:L,elementsRef:H,onMapChange:O,relayKeyboardEvent:P}=v6({grid:b,loopFocus:v,onLoop:k,orientation:g,highlightedIndex:m,onHighlightedIndexChange:h,rootRef:C,stopEventPropagation:j,enableHomeAndEndKeys:E,direction:z,disabledIndices:S,modifierKeys:N}),B=Et(M,e,{state:u,ref:l,props:[D,...c,T],stateAttributesMapping:p}),$=x.useMemo(()=>({highlightedIndex:U,onHighlightedIndexChange:L,highlightItemOnHover:R,relayKeyboardEvent:P}),[U,L,R,P]);return r.jsx(V2.Provider,{value:$,children:r.jsx(ip,{elementsRef:H,onMapChange:q=>{y?.(q),O(q)},children:B})})}const w6=x.forwardRef(function(t,s){const{activateOnFocus:o=!1,className:l,loopFocus:c=!0,render:u,style:p,...m}=t,{onValueChange:h,orientation:g,value:b,setTabMap:v,tabActivationDirection:k}=d_(),[E,y]=x.useState(0),[j,C]=x.useState(null),S=x.useRef(new Set),N=x.useRef(new Set),R=x.useRef(null);ze(()=>{if(typeof ResizeObserver>"u")return;const H=new ResizeObserver(()=>{S.current.forEach(O=>{O()})});return R.current=H,j&&H.observe(j),N.current.forEach(O=>{H.observe(O)}),()=>{H.disconnect(),R.current=null}},[j]);const M=Ue(H=>(S.current.add(H),()=>{S.current.delete(H)})),T=Ue(H=>(N.current.add(H),R.current?.observe(H),()=>{N.current.delete(H),R.current?.unobserve(H)})),z=Ue((H,O)=>{H!==b&&h(H,O)}),D={orientation:g,tabActivationDirection:k},U={"aria-orientation":g==="vertical"?"vertical":void 0,role:"tablist"},L=x.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:E,registerIndicatorUpdateListener:M,registerTabResizeObserverElement:T,onTabActivation:z,setHighlightedTabIndex:y,tabsListElement:j}),[o,E,M,T,z,y,j]);return r.jsx(mN.Provider,{value:L,children:r.jsx(j6,{render:u,className:l,style:p,state:D,refs:[s,C],props:[U,m],stateAttributesMapping:mp,highlightedIndex:E,enableHomeAndEndKeys:!0,loopFocus:c,orientation:g,onHighlightedIndexChange:y,onMapChange:v,disabledIndices:Ya})})});function hp({className:e,...t}){return r.jsx(p6,{"data-slot":"tabs",className:Ct("flex flex-col gap-4",e),...t})}const k6=Jb("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 gp({className:e,variant:t="default",...s}){return r.jsx(w6,{"data-slot":"tabs-list","data-variant":t,className:Ct(k6({variant:t}),e),...s})}function ra({className:e,...t}){return r.jsx(h6,{"data-slot":"tabs-trigger",className:Ct("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 Ds({className:e,...t}){return r.jsx(b6,{"data-slot":"tabs-content",className:Ct("text-sm outline-none",e),...t})}function sw(e,t){let s=e;for(const o of t.split(".")){if(!s||typeof s!="object"||Array.isArray(s))return;s=s[o]}return s}function f_(e,t=""){const s={};for(const[o,l]of Object.entries(e)){const c=t?`${t}.${o}`:o;l&&typeof l=="object"&&!Array.isArray(l)?Object.assign(s,f_(l,c)):s[c]=l}return s}function S6(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("JSON debe ser objeto.");return t}function kx({sections:e,source:t,placeholderSource:s,jsonTitle:o,jsonDescription:l,saveLabel:c=f("common.save"),onSaveFields:u,onSaveJson:p,busy:m}){const h=e[0]?.key||"json",[g,b]=x.useState({}),[v,k]=x.useState(""),[E,y]=x.useState("");x.useEffect(()=>{const N={};for(const R of e.flatMap(M=>M.fields))N[R.path]=sw(t,R.path)??"";b(N),k(JSON.stringify(t||{},null,2)),y("")},[t,e]);const j=x.useMemo(()=>new Set(e.flatMap(N=>N.fields.map(R=>R.path))),[e]),C=async()=>{const N={},R=[];for(const M of e.flatMap(T=>T.fields)){const T=g[M.path];if(!is(T)){if(T===""||T===void 0||T===null){R.push(M.path);continue}if(M.kind==="number"){const z=Number(T);Number.isFinite(z)&&(N[M.path]=z)}else N[M.path]=T}}await u(N,R.filter(M=>j.has(M)))},S=async()=>{y("");try{await p(S6(v))}catch(N){y(N.message)}};return r.jsxs(hp,{defaultValue:h,className:"space-y-4",children:[r.jsxs(gp,{className:"flex flex-wrap",children:[e.map(N=>r.jsx(ra,{value:N.key,children:N.label},N.key)),r.jsx(ra,{value:"json",children:"JSON"})]}),e.map(N=>r.jsx(Ds,{value:N.key,children:r.jsxs("div",{className:"space-y-4",children:[N.description&&r.jsx("p",{className:"text-sm text-muted-fg",children:N.description}),r.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:N.fields.map(R=>r.jsx(C6,{field:R,value:g[R.path],inherited:sw(s,R.path),onChange:M=>b(T=>({...T,[R.path]:M}))},R.path))}),r.jsx(ce,{variant:"primary",loading:m,onClick:C,children:c})]})},N.key)),r.jsx(Ds,{value:"json",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium",children:o}),l&&r.jsx("p",{className:"text-xs text-muted-fg",children:l})]}),r.jsx(On,{rows:18,className:"font-mono text-xs",value:v,onChange:N=>k(N.target.value)}),E&&r.jsx("p",{className:"text-xs text-destructive",children:E}),r.jsx(ce,{variant:"primary",loading:m,onClick:S,children:f("settings_ui.save_json")})]})})]})}function C6({field:e,value:t,inherited:s,onChange:o}){const l=e.placeholder||aw(s)||(is(t)?Mr(t):""),c=e.hint||(s!==void 0?`Heredado: ${aw(s)}`:void 0);return e.kind==="boolean"?r.jsx("div",{className:"flex items-end pb-1",children:r.jsx(Qt,{checked:t===!0,onChange:o,label:e.label})}):r.jsx(ie,{label:e.label,hint:c,children:e.kind==="select"?r.jsx(_t,{value:String(t||""),onChange:o,placeholder:l||"(sin override)",options:[{value:"",label:l||"(sin override)"},...(e.options||[]).map(u=>({value:String(u.value),label:u.label}))]}):e.kind==="textarea"?r.jsx(On,{rows:4,value:String(t||""),placeholder:l,onChange:u=>o(u.target.value)}):r.jsx(Ee,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(is(t)?"":t||""),placeholder:e.kind==="password"&&is(t)?Mr(t):e.kind==="password"&&is(s)?Mr(s):l,onChange:u=>o(u.target.value)})})}function aw(e){return e==null||e===""?"":is(e)?Mr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function N6(){return[{key:"routing",label:f("settings_ui.cfg_overrides_label"),description:f("settings_ui.cfg_overrides_desc"),fields:[{path:"route_to_agent",label:f("settings_ui.cfg_route_to_agent"),placeholder:"master"},{path:"super_agent.model",label:f("settings_ui.cfg_super_agent_model")},{path:"super_agent.permission_mode",label:f("settings_ui.cfg_permission_mode"),kind:"select",options:Qx.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:f("settings_ui.cfg_extra_prompt"),kind:"textarea"}]},{key:"telegram",label:f("settings_ui.cfg_telegram_label"),fields:[{path:"telegram.route_to_agent",label:f("settings_ui.cfg_route_to_agent")},{path:"telegram.chat_id",label:f("settings_ui.cfg_chat_id")},{path:"telegram.bot_token",label:f("settings_ui.cfg_bot_token"),kind:"password"},{path:"telegram.respond_with_engine",label:f("settings_ui.cfg_respond_with_engine"),kind:"boolean"}]},{key:"engines",label:f("settings_ui.cfg_engines_label"),fields:[{path:"engines.ollama.base_url",label:f("settings_ui.cfg_ollama_url")},{path:"engines.anthropic.api_key",label:f("settings_ui.cfg_anthropic_key"),kind:"password"},{path:"engines.openai.api_key",label:f("settings_ui.cfg_openai_key"),kind:"password"},{path:"engines.groq.api_key",label:f("settings_ui.cfg_groq_key"),kind:"password"},{path:"engines.openrouter.api_key",label:f("settings_ui.cfg_openrouter_key"),kind:"password"},{path:"engines.gemini.api_key",label:f("settings_ui.cfg_gemini_key"),kind:"password"}]}]}function E6(){return[{key:"identity",label:f("settings_ui.cfg_project_label"),description:f("settings_ui.cfg_project_desc"),fields:[{path:"name",label:f("settings_ui.cfg_name")},{path:"version",label:f("settings_ui.cfg_version")},{path:"apf",label:f("settings_ui.cfg_apc_spec")},{path:"apx",label:f("settings_ui.cfg_apx_install")},{path:"apx_id",label:f("settings_ui.cfg_apx_storage_id")}]}]}function R6({pid:e}){const t=ot(),s=Yn(),{project:o,mutate:l}=Wb(e),c=We(`/projects/${e}/config`,()=>ls.config.show(e)),u=String(e)==="0";if(c.isLoading)return r.jsx(rt,{});if(!c.data)return r.jsx(bt,{children:f("project.config.no_data")});const p=async h=>{await ls.apcProject.put(e,h),t.success(f("project.config.save_project")),c.mutate()},m=async h=>{await ls.config.put(e,h),t.success(f("project.config.save_override")),c.mutate()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ye,{title:f("project.config.section_title"),description:f("project.config.section_desc"),children:r.jsxs(hp,{defaultValue:"override",className:"space-y-4",children:[r.jsxs(gp,{children:[r.jsx(ra,{value:"override",children:"Override"}),r.jsx(ra,{value:"project",children:"APC project"}),r.jsx(ra,{value:"effective",children:"Effective"})]}),r.jsx(Ds,{value:"override",children:r.jsx(kx,{sections:N6(),source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,jsonDescription:".apc/config.json. Overrides del proyecto.",onSaveFields:async(h,g)=>{await ls.config.set(e,h),g.length&&await ls.config.unset(e,g),t.success(f("project.config.save_fields_success")),c.mutate()},onSaveJson:m})}),r.jsx(Ds,{value:"project",children:r.jsx(kx,{sections:E6(),source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(h,g)=>{await ls.apcProject.set(e,A6(h),g),t.success(f("project.config.save_meta_success")),c.mutate()},onSaveJson:p})}),r.jsx(Ds,{value:"effective",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.config.effective_read")}),r.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg border border-border bg-muted/40 p-3 text-xs",children:JSON.stringify(c.data.effective,null,2)})]})})]})}),!u&&o?r.jsx(T6,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{l(),s("/")}}):null]})}function T6({pid:e,label:t,onRebuilt:s,onUnregistered:o}){const l=ot(),[c,u]=x.useState(null),[p,m]=x.useState(null),h=async()=>{u("rebuild");try{await ls.rebuild(e),l.success(f("project.rebuild_done")),s()}catch(b){l.error(b.message)}finally{u(null),m(null)}},g=async()=>{u("unregister");try{await ls.remove(e),l.success(f("project.unregistered")),o()}catch(b){l.error(b.message)}finally{u(null),m(null)}};return r.jsxs(r.Fragment,{children:[r.jsx(Ye,{title:f("project.danger.title"),description:f("project.danger.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("project.rebuild")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.danger.rebuild_desc")})]}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:()=>m("rebuild"),children:[r.jsx(ua,{size:13})," ",f("project.rebuild")]})]}),r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-red-500/40 bg-red-500/5 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("admin.unregister")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.danger.unregister_desc")})]}),r.jsxs(ce,{size:"sm",variant:"destructive",onClick:()=>m("unregister"),children:[r.jsx(Gn,{size:13})," ",f("admin.unregister")]})]})]})}),r.jsx(Sn,{open:p==="rebuild",onClose:()=>c?null:m(null),title:f("project.danger.rebuild_confirm_title"),description:f("project.danger.rebuild_confirm_desc",{label:t}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:h,loading:c==="rebuild",children:f("project.rebuild")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.danger.rebuild_long")})}),r.jsx(Sn,{open:p==="unregister",onClose:()=>c?null:m(null),title:f("project.danger.unregister_confirm_title"),description:f("project.unregister_confirm",{label:t}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:f("common.cancel")}),r.jsx(ce,{variant:"destructive",onClick:g,loading:c==="unregister",children:f("admin.unregister")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.danger.unregister_long")})})]})}function A6(e){const t={};for(const[s,o]of Object.entries(f_(e)))is(o)||(t[s]=o);return t}const M6=["","es","en","pt","fr","it","de"],rw=e=>e.split(",").map(t=>t.trim()).filter(Boolean);function hN(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:Fa}:{gradient:"from-slate-600 to-gray-600",Icon:on}}function O6(e){const t=e.filter(u=>u.is_master),s=t.length===1?t[0]:null,o=u=>u.parent?u.parent:s&&!u.is_master&&u.slug!==s.slug?s.slug:null,l=new Map,c=[];for(const u of e){const p=o(u);p&&e.some(m=>m.slug===p)?(l.has(p)||l.set(p,[]),l.get(p).push(u)):c.push(u)}return{roots:c,childrenByParent:l}}function z6({pid:e}){const t=Yn();ot();const s=We(`/projects/${e}/agents`,()=>ln.list(e)),[o,l]=x.useState("hierarchy"),[c,u]=x.useState(!1),[p,m]=x.useState(!1),h=s.data||[],g=E=>t(`/p/${e}/agents/${E}`),b=E=>t(E?`/p/${e}/chat?agent=${E}`:`/p/${e}/chat`),{roots:v,childrenByParent:k}=x.useMemo(()=>O6(h),[h]);return r.jsxs(Ye,{title:f("project.agents.title"),description:f("project.agents.subtitle_full"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[r.jsxs("button",{onClick:()=>l("hierarchy"),className:Te("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(Fx,{size:13})," ",f("project.agents.hierarchy")]}),r.jsxs("button",{onClick:()=>l("list"),className:Te("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(GM,{size:13})," ",f("project.agents.list_view")]})]}),r.jsxs(ce,{size:"sm",variant:"ghost",onClick:()=>m(!0),children:[r.jsx(s3,{size:13})," ",f("project.agents.import")]}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:()=>b(),children:[r.jsx(Gs,{size:13})," ",f("project.agents.chat")]}),r.jsxs(ce,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>u(!0),children:[r.jsx(an,{size:14})," ",f("project.agents.new")]})]}),children:[s.isLoading&&r.jsx(rt,{}),!s.isLoading&&h.length===0&&r.jsx(bt,{children:f("project.agents.empty_text")}),!s.isLoading&&h.length>0&&(o==="hierarchy"?r.jsx(L6,{roots:v,childrenByParent:k,onOpen:g,onChat:b}):r.jsx(P6,{agents:h,onOpen:g,onChat:b})),r.jsx(I6,{open:c,pid:e,agents:h,onClose:()=>u(!1),onCreated:()=>{u(!1),s.mutate()}}),r.jsx(D6,{open:p,pid:e,existing:h.map(E=>E.slug),onClose:()=>m(!1),onImported:()=>s.mutate()})]})}function D6({open:e,onClose:t,onImported:s,pid:o,existing:l}){const c=ot(),u=We(e?"/agents/vault":null,()=>ln.vault()),[p,m]=x.useState(""),h=u.data||[],g=async b=>{m(b);try{await ln.import(o,b),c.success(f("project.agents.import_success",{slug:b})),s()}catch(v){c.error(v.message)}finally{m("")}};return r.jsxs(Sn,{open:e,onClose:t,title:f("project.agents.import_title"),description:f("project.agents.import_desc"),size:"lg",footer:r.jsx(ce,{variant:"ghost",onClick:t,children:f("common.close")}),children:[u.isLoading&&r.jsx(rt,{}),!u.isLoading&&h.length===0&&r.jsx(bt,{children:f("project.agents.import_empty")}),r.jsx("ul",{className:"space-y-2",children:h.map(b=>{const v=l.includes(b.slug);return r.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[r.jsx(on,{size:16,className:"shrink-0 text-muted-fg"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:b.slug}),b.is_master&&r.jsxs($e,{tone:"success",children:[r.jsx(Fa,{size:9})," ",f("project.agents.orchestrator")]}),b.model&&r.jsx($e,{tone:"info",children:b.model})]}),b.description&&r.jsx("p",{className:"truncate text-xs text-muted-fg",children:b.description})]}),r.jsx(ce,{size:"sm",variant:"primary",disabled:v||p===b.slug,loading:p===b.slug,onClick:()=>g(b.slug),children:f(v?"project.agents.import_already":"project.agents.import_btn")})]},b.slug)})})]})}function L6({roots:e,childrenByParent:t,onOpen:s,onChat:o}){return r.jsx("div",{className:"space-y-8",children:e.map(l=>{const c=t.get(l.slug)||[];return r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(cg,{agent:l,onOpen:s,onChat:o,wide:!0}),c.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-5 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4 border-t border-border pt-5",children:c.map(u=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(cg,{agent:u,onOpen:s,onChat:o}),(t.get(u.slug)||[]).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(t.get(u.slug)||[]).map(p=>r.jsx(cg,{agent:p,onOpen:s,onChat:o,compact:!0},p.slug))})]})]},u.slug))})]})]},l.slug)})})}function cg({agent:e,onOpen:t,onChat:s,wide:o,compact:l}){const{gradient:c,Icon:u}=hN(e);return r.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:Te("cursor-pointer rounded-xl border border-border bg-card p-3 transition-colors hover:border-muted-fg/50",o?"w-64":l?"w-44":"w-52"),onClick:()=>t(e.slug),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:Te("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:r.jsx(u,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&r.jsxs($e,{tone:"success",children:[r.jsx(Fa,{size:9})," ",f("project.agents.orchestrator")]}),e.role&&r.jsx($e,{children:e.role}),e.model&&!l&&r.jsx($e,{tone:"info",children:e.model})]}),r.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-border pt-2 text-xs text-muted-fg",onClick:p=>p.stopPropagation(),children:[r.jsxs("button",{onClick:()=>t(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(Af,{size:12})," ",f("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Gs,{size:12})," ",f("project.agents.chat")]})]})]})}function P6({agents:e,onOpen:t,onChat:s}){const o=[...e].sort((l,c)=>+!!c.is_master-+!!l.is_master||l.slug.localeCompare(c.slug));return r.jsx("div",{className:"space-y-2",children:o.map(l=>{const{gradient:c,Icon:u}=hN(l);return r.jsxs("div",{"data-testid":`agent-card-${l.slug}`,className:"flex cursor-pointer items-center gap-4 rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>t(l.slug),children:[r.jsx("div",{className:Te("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:r.jsx(u,{className:"size-4 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-semibold",children:l.slug}),l.is_master&&r.jsxs($e,{tone:"success",children:[r.jsx(Fa,{size:10})," ",f("project.agents.orchestrator")]}),l.role&&r.jsx($e,{children:l.role}),l.model&&r.jsx($e,{tone:"info",children:l.model}),l.parent&&r.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",l.parent]})]}),l.description&&r.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:l.description}),r.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[l.skills?.map(p=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(Za,{size:9})," ",p]},p)),l.tools?.map(p=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(ei,{size:9})," ",p]},p))]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:p=>p.stopPropagation(),children:[r.jsxs("button",{onClick:()=>t(l.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(Af,{size:12})," ",f("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(l.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Gs,{size:12})," ",f("project.agents.chat")]})]})]},l.slug)})})}function I6({open:e,onClose:t,onCreated:s,pid:o,agents:l}){const c=ot(),[u,p]=x.useState(""),[m,h]=x.useState(""),[g,b]=x.useState(""),[v,k]=x.useState(""),[E,y]=x.useState(""),[j,C]=x.useState(""),[S,N]=x.useState(""),[R,M]=x.useState(!1),[T,z]=x.useState(""),[D,U]=x.useState(!1),L=()=>{p(""),h(""),b(""),k(""),y(""),C(""),N(""),M(!1),z("")},H=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(u)){c.error(f("project.agents.slug_invalid"));return}U(!0);try{await ln.create(o,{slug:u,role:m||void 0,model:g||void 0,language:v||void 0,description:E||void 0,skills:rw(j),tools:rw(S),is_master:R,parent:T||void 0}),c.success(f("project.agents.create_success",{slug:u})),s(),L()}catch(O){c.error(O?.message||f("project.agents.create_error"))}finally{U(!1)}};return r.jsx(Sn,{open:e,onClose:t,title:f("project.agents.new_title"),description:f("project.agents.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:D,children:f("common.cancel")}),r.jsx(ce,{variant:"primary","data-testid":"agent-create-submit",onClick:H,loading:D,children:f("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("project.agents.slug_label"),children:r.jsx(Ee,{autoFocus:!0,"data-testid":"agent-slug",value:u,onChange:O=>p(O.target.value),placeholder:f("project.agents.slug_ph")})}),r.jsx(ie,{label:f("project.agents.role_label"),children:r.jsx(Ee,{value:m,onChange:O=>h(O.target.value),placeholder:f("project.agents.role_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("project.agents.model_label"),hint:f("project.agents.model_hint"),children:r.jsx(Ee,{value:g,onChange:O=>b(O.target.value)})}),r.jsx(ie,{label:f("project.agents.lang_label"),children:r.jsx(_t,{value:v,onChange:k,options:M6.map(O=>({value:O,label:O||"—"}))})})]}),r.jsx(ie,{label:f("project.agents.desc_label"),children:r.jsx(On,{rows:2,value:E,onChange:O=>y(O.target.value),placeholder:f("project.agents.desc_ph")})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("project.agents.skills_label"),children:r.jsx(Ee,{value:j,onChange:O=>C(O.target.value),placeholder:f("project.agents.skills_ph")})}),r.jsx(ie,{label:f("project.agents.tools_label"),children:r.jsx(Ee,{value:S,onChange:O=>N(O.target.value),placeholder:f("project.agents.tools_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[r.jsx(ie,{label:f("project.agents.parent_label"),hint:f("project.agents.parent_hint"),children:r.jsx(_t,{value:T,onChange:z,placeholder:f("project.agents.none_parent"),options:[{value:"",label:f("project.agents.none_parent")},...l.filter(O=>O.slug!==u).map(O=>({value:O.slug,label:O.slug}))]})}),r.jsx(Qt,{checked:R,onChange:M,label:f("project.agents.master_label")})]})]})})}function Ad(e){return e.split(`
623
- `).map(t=>t.trim()).filter(Boolean)}function Pc(){return{exec_agent:{label:f("agents_ui.kind_exec_agent"),desc:f("agents_ui.kind_exec_agent_desc"),icon:on},super_agent:{label:f("agents_ui.kind_super_agent"),desc:f("agents_ui.kind_super_agent_desc"),icon:Fa},telegram:{label:f("agents_ui.kind_telegram"),desc:f("agents_ui.kind_telegram_desc"),icon:Gs},shell:{label:f("agents_ui.kind_shell"),desc:f("agents_ui.kind_shell_desc"),icon:Ga},heartbeat:{label:f("agents_ui.kind_heartbeat"),desc:f("agents_ui.kind_heartbeat_desc"),icon:Pl}}}function B6(e){const t=Pc();return Object.keys(t).filter(s=>s!=="heartbeat"||e==="heartbeat").map(s=>({value:s,label:t[s].label,description:t[s].desc,icon:t[s].icon}))}function p_(e){if(!e)return"—";if(e.startsWith("every:")){const t=e.slice(6),s=t.match(/^(\d+)(s|m|h|d)$/);if(s){const o=s[1],l={s:f("agents_ui.unit_seconds"),m:f("agents_ui.unit_minutes"),h:f("agents_ui.unit_hours"),d:f("agents_ui.unit_days")}[s[2]]||s[2];return f("agents_ui.every_n_unit",{n:o,unit:l})}return f("agents_ui.every_v",{v:t})}return e.startsWith("once:")?`once · ${new Date(e.slice(5)).toLocaleString()}`:e.startsWith("cron ")?`cron · ${e.slice(5)}`:e}function U6(){return[{label:f("agents_ui.preset_every_10m"),value:"every:10m"},{label:f("agents_ui.preset_hourly"),value:"every:1h"},{label:f("agents_ui.preset_daily_9am"),value:"cron 0 9 * * *"},{label:f("agents_ui.preset_weekdays_9am"),value:"cron 0 9 * * 1-5"}]}function gN(){return[{v:"{{pre_output}}",where:"prompt",desc:f("agents_ui.var_pre_output_prompt")},{v:"$APX_LLM_OUTPUT",where:"post",desc:f("agents_ui.var_llm_output")},{v:"$APX_STATUS",where:"post",desc:f("agents_ui.var_status")},{v:"$APX_SKIPPED",where:"post",desc:f("agents_ui.var_skipped")},{v:"$APX_PRE_OUTPUT",where:"post",desc:f("agents_ui.var_pre_output")},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:f("agents_ui.var_pre_output_file")},{v:"$APX_PRE_EXIT",where:"post",desc:f("agents_ui.var_pre_exit")},{v:"$APX_ROUTINE",where:"pre/post",desc:f("agents_ui.var_routine")}]}function ac(e){return gN().filter(t=>e==="pre"?t.where.includes("pre"):e==="prompt"?t.where==="prompt":t.where==="post"||t.where==="pre/post")}function H6({routines:e,selectedName:t,onSelect:s}){return r.jsxs("aside",{className:"flex h-full min-h-0 flex-col border-r border-border",children:[r.jsx("div",{className:"shrink-0 px-3 py-2.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:f("project.routines.list_title")}),r.jsx("ul",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto p-2 pt-0",children:e.map(o=>{const l=Pc()[o.kind],c=l?.icon||Il,u=o.name===t;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(o.name),"aria-current":u,className:Te("w-full rounded-lg border px-2.5 py-2 text-left transition-colors",u?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Te("flex size-6 shrink-0 items-center justify-center rounded-md",o.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:r.jsx(c,{size:13})}),r.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:o.name}),!o.enabled&&r.jsx("span",{className:"shrink-0 text-[10px] text-muted-fg",children:f("project.routines.paused")}),r.jsx(Zc,{ok:o.last_status==="ok"?!0:o.last_status==="error"?!1:null})]}),r.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 pl-8 text-[10px] text-muted-fg",children:[r.jsx("span",{className:"truncate",children:l?.label||o.kind}),r.jsxs("span",{className:"shrink-0",children:["⏱ ",p_(o.schedule)]})]})]})},o.name)})})]})}function V6({title:e,body:t,mono:s}){return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:Te("max-h-44 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 text-xs",s&&"font-mono"),children:t.trim()?t:r.jsx("span",{className:"text-muted-fg",children:f("project.routines.block_empty")})})]})}function xN(e){const t=e.meta||{};return t.skipped?"skipped":t.status==="error"?"error":"ok"}function bN(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 _N({st:e}){return e==="ok"?r.jsx(xo,{size:13,className:"shrink-0 text-emerald-500"}):e==="error"?r.jsx(Ys,{size:13,className:"shrink-0 text-destructive"}):r.jsx(fM,{size:13,className:"shrink-0 text-amber-500"})}function vN(e){return f(e==="ok"?"project.routines.status_ok":e==="error"?"project.routines.status_error":"project.routines.status_skipped")}function ug({title:e,children:t}){return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),t]})}const dg="whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 font-mono text-[11px]";function q6({m:e,onClose:t}){const s=xN(e),o=e.meta||{},l=o.result||{},c=o.flow||null,u=String(l.reply??l.text??l.stdout??""),p=String(l.error??l.stderr??""),m=String(l.note??""),h=r.jsx("span",{className:"text-muted-fg",children:f("project.routines.block_empty")});return r.jsxs("div",{className:"flex min-h-0 flex-col border-l border-border",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-4 py-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[r.jsx(_N,{st:s}),r.jsx("span",{className:Te("font-medium",s==="ok"&&"text-emerald-500",s==="error"&&"text-destructive",s==="skipped"&&"text-amber-500"),children:vN(s)}),r.jsx("span",{className:"font-mono text-muted-fg",children:bN(e.ts)})]}),r.jsx("button",{type:"button",onClick:t,"aria-label":f("project.routines.runs_close"),className:"rounded-md p-1 text-muted-fg hover:bg-muted hover:text-foreground",children:r.jsx(Ys,{size:14})})]}),r.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 pb-4 text-xs",children:[e.body&&r.jsx("div",{className:"text-muted-fg",children:e.body}),c?.pre&&r.jsx(ug,{title:f("project.routines.block_pre"),children:c.pre.output?.trim()?r.jsx("pre",{className:dg,children:c.pre.output}):h}),r.jsx(ug,{title:f("project.routines.runs_output"),children:u?r.jsx("pre",{className:dg,children:u}):p?r.jsx("pre",{className:"whitespace-pre-wrap break-words rounded-lg bg-destructive/10 px-3 py-2 font-mono text-[11px] text-destructive",children:p}):m?r.jsx("div",{className:"text-muted-fg",children:m}):h}),c?.post&&c.post.length>0&&r.jsx(ug,{title:f("project.routines.block_post"),children:r.jsx("div",{className:"space-y-1.5",children:c.post.map((g,b)=>r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"font-mono text-[10px] text-muted-fg",children:["$ ",g.cmd," ",r.jsxs("span",{className:"opacity-70",children:["· exit ",g.exit]})]}),(g.stdout||g.stderr)&&r.jsx("pre",{className:dg,children:g.stdout||g.stderr})]},b))})})]})]})}function $6({pid:e,name:t,running:s}){const o=We(`/projects/${e}/routines/${t}/runs`,async()=>(await xf.project(e,{channel:"routine",limit:200})).filter(h=>h.meta?.routine===t&&(h.actor_id==="apx:routine"||h.type==="system"))),l=(o.data||[]).slice(0,50),[c,u]=x.useState(null),p=c&&l.find(m=>m.ts===c)||null;return r.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border-t border-border",children:[r.jsx("div",{className:"shrink-0 px-4 pb-1.5 pt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:f("project.routines.runs_title")}),r.jsxs("div",{className:Te("grid min-h-0 flex-1 overflow-hidden",p?"grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]":"grid-cols-1"),children:[r.jsxs("div",{className:"min-h-0 overflow-y-auto px-4 pb-4",children:[o.isLoading&&r.jsx(rt,{}),!o.isLoading&&l.length===0&&r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.routines.runs_empty")}),r.jsxs("ul",{className:"space-y-1",children:[s&&r.jsx("li",{children:r.jsxs("div",{className:"flex w-full items-center gap-2 rounded-md border border-primary/40 bg-primary/5 px-3 py-1.5 text-xs",children:[r.jsx(us,{size:12}),r.jsx("span",{className:"text-muted-fg",children:f("project.routines.running")})]})}),l.map((m,h)=>{const g=xN(m),b=c===m.ts;return r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>u(b?null:m.ts),"aria-current":b,className:Te("flex w-full items-center gap-2 rounded-md border px-3 py-1.5 text-left text-xs transition-colors",b?"border-primary/50 bg-primary/10":"border-border bg-muted/30 hover:border-muted-fg/40"),children:[r.jsx(_N,{st:g}),r.jsx("span",{className:"font-mono text-muted-fg",children:bN(m.ts)}),r.jsx("span",{className:Te("font-medium",g==="ok"&&"text-emerald-500",g==="error"&&"text-destructive",g==="skipped"&&"text-amber-500"),children:vN(g)})]})},`${m.ts}-${h}`)})]})]}),p&&r.jsx(q6,{m:p,onClose:()=>u(null)})]})]})}function F6({pid:e,routine:t,onEdit:s,onRun:o,onToggle:l,onDelete:c,running:u}){const p=Pc()[t.kind],m=p?.icon||Il,h=t.spec||{},g=t.pre_commands||[],b=t.post_commands||[],v=[];return g.length&&v.push({title:f("project.routines.block_pre"),body:g.join(`
624
- `),mono:!0}),t.kind==="exec_agent"||t.kind==="super_agent"?v.push({title:f("project.routines.block_prompt"),body:String(h.prompt||"")}):t.kind==="telegram"?v.push({title:f("project.routines.block_text"),body:String(h.text||"")}):t.kind==="shell"?v.push({title:f("project.routines.block_command"),body:String(h.command||""),mono:!0}):t.kind==="heartbeat"&&v.push({title:f("project.routines.block_text"),body:String(h.message||"")}),b.length&&v.push({title:f("project.routines.block_post"),body:b.join(`
625
- `),mono:!0}),r.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[r.jsxs("div",{className:"min-h-0 shrink space-y-4 overflow-y-auto p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("span",{className:Te("flex size-7 shrink-0 items-center justify-center rounded-lg",t.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:r.jsx(m,{size:14})}),r.jsx("h3",{className:"truncate text-base font-semibold",children:t.name}),r.jsx($e,{tone:t.kind==="shell"?"warning":"info",children:p?.label||t.kind})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r.jsx(Qt,{checked:t.enabled,onChange:l}),r.jsx(Ge,{content:f("common.run"),children:r.jsx(ce,{size:"sm",variant:"secondary",onClick:o,loading:u,children:r.jsx(Kx,{size:13})})}),r.jsx(Ge,{content:f("project.routines.edit_hint"),children:r.jsxs(ce,{size:"sm",variant:"secondary",onClick:s,children:[r.jsx(To,{size:13})," ",f("project.routines.edit_btn")]})}),r.jsx(Ge,{content:f("common.delete"),children:r.jsx(ce,{size:"sm",variant:"destructive",onClick:c,children:r.jsx(Gn,{size:13})})})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[r.jsxs("span",{children:["⏱ ",p_(t.schedule)]}),t.next_run_at&&r.jsxs("span",{children:[f("project.routines.next_run")," ",new Date(t.next_run_at).toLocaleString()]}),t.last_run_at&&r.jsxs("span",{children:[f("project.routines.last_run")," ",new Date(t.last_run_at).toLocaleString()]}),r.jsxs("span",{className:Te(t.last_status==="ok"&&"text-emerald-500",t.last_status==="error"&&"text-destructive"),children:[f("agents_ui.last_label")," ",t.last_status||"—"]})]}),t.last_error&&r.jsx("div",{className:"rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:t.last_error}),r.jsx("div",{className:"space-y-3",children:v.map(k=>r.jsx(V6,{title:k.title,body:k.body,mono:k.mono},k.title))})]}),r.jsx($6,{pid:e,name:t.name,running:u})]})}function jl({label:e,hint:t,value:s,onChange:o,vars:l,rows:c=3,mono:u,placeholder:p}){const m=x.useRef(null),h=g=>{const b=m.current?.querySelector("textarea");if(!b){o(s?`${s}${g}`:g);return}const v=b.selectionStart??s.length,k=b.selectionEnd??s.length,E=s.slice(0,v)+g+s.slice(k);o(E),requestAnimationFrame(()=>{b.focus();const y=v+g.length;b.setSelectionRange(y,y)})};return r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:e}),t&&r.jsx("div",{className:"text-[11px] text-muted-foreground/70",children:t}),r.jsxs("div",{ref:m,className:"space-y-1.5",children:[r.jsx(On,{rows:c,className:Te(u&&"font-mono text-xs"),value:s,onChange:g=>o(g.target.value),placeholder:p}),l.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(g=>r.jsx("button",{type:"button",onClick:()=>h(g.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:g.v},g.v))})]})]})}function G6(){return r.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[r.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:f("project.routines.vars_title")}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:gN().map(e=>r.jsx(Ge,{content:r.jsx("span",{className:"block max-w-[240px] whitespace-normal leading-snug",children:e.desc}),children:r.jsxs("span",{className:"inline-flex cursor-help items-center gap-1 rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:[e.v,r.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",e.where]})]})},e.v))})]})}function Y6({draft:e,onClose:t,onSaved:s,pid:o}){const l=ot(),c=We(e?`/projects/${o}/agents`:null,()=>ln.list(o)),[u,p]=x.useState(!1),[m,h]=x.useState(""),[g,b]=x.useState("super_agent"),[v,k]=x.useState("every:10m"),[E,y]=x.useState(!0),[j,C]=x.useState(""),[S,N]=x.useState(""),[R,M]=x.useState("default"),[T,z]=x.useState(""),[D,U]=x.useState(""),[L,H]=x.useState(""),[O,P]=x.useState("heartbeat"),[B,$]=x.useState(""),[q,X]=x.useState(""),[Y,F]=x.useState(""),K=We(e&&g==="telegram"?"/telegram/channels":null,()=>Mn.channels.list());x.useEffect(()=>{if(!e)return;const ue=e.spec&&typeof e.spec=="object"?e.spec:{};h(e.name||""),b(e.kind||"super_agent"),k(e.schedule||"every:10m"),y(e.enabled??!0),C(ue.agent||""),N(ue.prompt||""),M(ue.channel||"default"),z(ue.chat_id?String(ue.chat_id):""),U(ue.text||""),H(ue.command||""),P(ue.channel||"heartbeat"),$(ue.message||""),X((e.pre_commands||[]).join(`
626
- `)),F((e.post_commands||[]).join(`
627
- `))},[e]);const I=g==="exec_agent"||g==="super_agent"||g==="telegram",G=()=>{switch(g){case"exec_agent":return{agent:j,prompt:S};case"super_agent":return{prompt:S};case"telegram":return{channel:R,...T?{chat_id:T}:{},text:D};case"shell":return{command:L};case"heartbeat":return{channel:O,message:B}}},Z=async()=>{if(!m){l.error(f("project.routines.name_required"));return}p(!0);try{await Cr.upsert(o,{name:m,kind:g,schedule:v,enabled:E,spec:G(),pre_commands:I?Ad(q):[],post_commands:I?Ad(Y):[]}),l.success(f("project.routines.saved")),s()}catch(ue){l.error(ue?.message||f("project.routines.save_error"))}finally{p(!1)}},te=(()=>{const ue=K.data?.channels||[],me=["default",...ue.map(je=>je.name)];R&&!me.includes(R)&&me.push(R);const ke=new Set;return me.filter(je=>ke.has(je)?!1:(ke.add(je),!0)).map(je=>{const Be=ue.find(we=>we.name===je),He=Be?.project?`proyecto ${Be.project}`:Be?.chat_id?`chat ${Be.chat_id}`:void 0;return{value:je,label:je,description:He}})})(),de=I?Ad(q):[],ee=I?Ad(Y):[],ne=(()=>{switch(g){case"exec_agent":return j?f("agents_ui.action_agent_answers",{agent:j}):f("agents_ui.action_agent_pick_answers");case"super_agent":return f("agents_ui.action_super_answers");case"telegram":return f("agents_ui.action_telegram_channel",{channel:R});case"shell":return L?f("agents_ui.summary_runs_cmd",{cmd:L.slice(0,48)}):f("agents_ui.action_runs_shell");case"heartbeat":return f("agents_ui.summary_heartbeat")}})(),ae=g==="telegram"?D:g==="shell"?L:g==="heartbeat"?B:S,pe=Pc()[g].icon,Me=[...de.map((ue,me)=>({id:`pre-${me}`,icon:Ga,label:f("agents_ui.step_pre"),detail:ue,action:!1})),{id:"action",icon:pe,label:ne,detail:ae?ae.slice(0,90):f("project.routines.block_empty"),action:!0},...ee.map((ue,me)=>({id:`post-${me}`,icon:Ga,label:f("agents_ui.step_post"),detail:ue,action:!1}))];return r.jsx(Sn,{open:!!e,onClose:t,title:e?.name?f("project.routines.edit_title",{name:e.name}):f("project.routines.new_title"),description:f("project.routines.dialog_desc"),size:"xl",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:u,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:Z,loading:u,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[r.jsx(Qt,{checked:E,onChange:y,label:f("project.routines.enabled_label")}),r.jsx("span",{className:"text-[11px] text-muted-fg",children:f(E?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),r.jsx(ie,{label:f("project.routines.name_field"),hint:e?.name?f("project.routines.name_no_edit"):void 0,children:r.jsx(Ee,{value:m,disabled:!!e?.name,onChange:ue=>h(ue.target.value),placeholder:"resumen-diario"})}),r.jsx(ie,{label:f("project.routines.kind_field"),children:r.jsx(_t,{value:g,onChange:ue=>b(ue),options:B6(g)})}),r.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:Pc()[g].desc}),g==="exec_agent"&&r.jsx(ie,{label:f("project.routines.agent_field"),hint:f("project.routines.agent_hint"),children:r.jsx(_t,{value:j,onChange:C,placeholder:c.isLoading?f("project.routines.agent_loading"):f("project.routines.agent_pick"),options:(c.data||[]).map(ue=>({value:ue.slug,label:ue.slug,description:[ue.role,ue.model].filter(Boolean).join(" · ")||void 0}))})}),r.jsx(ie,{label:f("project.routines.schedule_field"),hint:f("project.routines.schedule_hint"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap gap-1",children:[U6().map(ue=>r.jsx("button",{type:"button",onClick:()=>k(ue.value),className:Te("rounded-md border px-2 py-0.5 text-[11px]",v===ue.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:ue.label},ue.value)),r.jsx("button",{type:"button",onClick:()=>k("manual"),className:Te("rounded-md border px-2 py-0.5 text-[11px]",v==="manual"?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:f("agents_ui.preset_manual")})]}),r.jsx(Ee,{value:v,onChange:ue=>k(ue.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})}),r.jsx(G6,{})]}),r.jsxs("div",{className:"space-y-3",children:[I&&r.jsx(jl,{label:f("project.routines.pre_field"),hint:f("project.routines.pre_hint"),rows:2,mono:!0,value:q,onChange:X,vars:ac("pre"),placeholder:"curl -s https://wttr.in/Bariloche"}),g==="exec_agent"&&r.jsx(jl,{label:f("project.routines.prompt_exec"),rows:4,value:S,onChange:N,vars:ac("prompt"),placeholder:f("project.routines.prompt_exec_ph")}),g==="super_agent"&&r.jsx(jl,{label:f("project.routines.prompt_super"),rows:4,value:S,onChange:N,vars:ac("prompt"),placeholder:f("project.routines.prompt_super_ph")}),g==="telegram"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("project.routines.tg_channel"),children:r.jsx(_t,{value:R,onChange:M,options:te})}),r.jsx(ie,{label:f("project.routines.tg_chat_id"),children:r.jsx(Ee,{value:T,onChange:ue=>z(ue.target.value),placeholder:f("agents_ui.tg_chat_id_ph")})})]}),r.jsx(jl,{label:f("project.routines.tg_text"),hint:f("project.routines.tg_text_hint"),rows:6,value:D,onChange:U,vars:ac("prompt"),placeholder:f("agents_ui.tg_text_ph")})]}),g==="shell"&&r.jsx(jl,{label:f("project.routines.shell_field"),hint:f("project.routines.shell_hint"),rows:11,mono:!0,value:L,onChange:H,vars:[],placeholder:"cd /repo && git pull && npm test"}),g==="heartbeat"&&r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("project.routines.hb_channel"),children:r.jsx(Ee,{value:O,onChange:ue=>P(ue.target.value),placeholder:"heartbeat"})}),r.jsx(ie,{label:f("project.routines.hb_message"),children:r.jsx(Ee,{value:B,onChange:ue=>$(ue.target.value),placeholder:f("agents_ui.hb_message_ph")})})]}),I&&r.jsx(jl,{label:f("project.routines.post_field"),hint:f("project.routines.post_hint"),rows:2,mono:!0,value:Y,onChange:F,vars:ac("post"),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})]})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[f("project.routines.what_happens")," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",p_(v)]})]}),r.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:Me.map((ue,me)=>r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsxs("div",{className:Te("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",ue.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[r.jsxs("div",{className:Te("flex items-center gap-1.5 text-[11px] font-medium",ue.action?"text-emerald-400":"text-muted-fg"),children:[r.jsx(ue.icon,{size:12})," ",ue.label]}),ue.detail&&r.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:ue.detail})]}),me<Me.length-1&&r.jsx(Yk,{size:14,className:"shrink-0 self-center text-muted-fg"})]},ue.id))})]})]})})}function K6({pid:e}){const t=ot(),s=We(`/projects/${e}/routines`,()=>Cr.list(e)),[o,l]=$c(),[c,u]=x.useState(null),[p,m]=x.useState(null),[h,g]=x.useState(!1),[b,v]=x.useState(null),[k,E]=x.useState(null),y=s.data||[],j=o.get("r_id"),C=y.find(T=>T.name===j)||null,S=T=>l(z=>{const D=new URLSearchParams(z);return T?D.set("r_id",T):D.delete("r_id"),D},{replace:!0});x.useEffect(()=>{y.length!==0&&(j&&y.some(T=>T.name===j)||S(y[0].name))},[y,j]);const N=async T=>{try{await(T.enabled?Cr.disable:Cr.enable)(e,T.name),s.mutate()}catch(z){t.error(z?.message||f("project.routines.toggle_error"))}},R=async()=>{if(!b)return;const T=b;v(null),E(T.name);try{await Cr.run(e,T.name),t.success(f("project.routines.run_success",{name:T.name})),await Promise.all([s.mutate(),hf(`/projects/${e}/routines/${T.name}/runs`)])}catch(z){t.error(z?.message||f("project.routines.run_error"))}finally{E(null)}},M=async()=>{if(p){g(!0);try{await Cr.remove(e,p.name),t.success(f("project.routines.delete_success")),j===p.name&&S(null),m(null),s.mutate()}catch(T){t.error(T?.message||f("project.routines.delete_error"))}finally{g(!1)}}};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[r.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:f("project.routines.title")}),r.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:f("project.routines.subtitle")})]}),r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>u({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[r.jsx(an,{size:14})," ",f("project.routines.new_btn")]})]}),s.isLoading&&r.jsx(rt,{}),!s.isLoading&&y.length===0&&r.jsx(bt,{children:f("project.routines.empty")}),y.length>0&&r.jsxs("div",{className:"grid min-h-0 flex-1 grid-rows-[minmax(0,1fr)] grid-cols-[minmax(200px,260px)_1fr] overflow-hidden rounded-xl border border-border bg-card/40",children:[r.jsx(H6,{routines:y,selectedName:C?.name??null,onSelect:S}),r.jsx("div",{className:"min-h-0 min-w-0 overflow-hidden",children:C?r.jsx(F6,{pid:e,routine:C,onEdit:()=>u({...C}),onRun:()=>v(C),onToggle:()=>N(C),onDelete:()=>m(C),running:k===C.name},C.name):r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.routines.detail_empty")})})})]}),r.jsx(Y6,{draft:c,onClose:()=>u(null),onSaved:()=>{u(null),s.mutate()},pid:e}),r.jsx(Sn,{open:!!p,onClose:()=>h?null:m(null),title:f("project.routines.delete_confirm",{name:p?.name||""}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:()=>m(null),disabled:h,children:f("common.cancel")}),r.jsx(ce,{variant:"destructive",onClick:M,loading:h,children:f("common.delete")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.routines.delete_confirm_body")})}),r.jsx(Sn,{open:!!b,onClose:()=>v(null),title:f("project.routines.run_confirm",{name:b?.name||""}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:()=>v(null),children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:R,children:f("common.run")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.routines.run_confirm_body")})})]})}function X6({pid:e}){const[t,s]=x.useState("open"),o=ot(),l=c_({key:`/projects/${e}/tasks?state=${t}`,fetchPage:(b,v)=>Nr.listPage(e,{state:t,limit:b,offset:v}),resetKey:t,swr:{dedupingInterval:0,revalidateOnFocus:!0}}),[c,u]=x.useState(""),[p,m]=x.useState(!1),h=async()=>{if(c.trim()){m(!0);try{await Nr.add(e,{title:c.trim()}),u(""),o.success(f("project.tasks.created")),l.mutate()}catch(b){o.error(b?.message||f("project.tasks.create_error"))}finally{m(!1)}}},g=async(b,v)=>{try{await b(),o.success(v),l.mutate()}catch(k){o.error(k?.message||f("common.error_generic"))}};return r.jsxs(Ye,{fullHeight:!0,title:f("project.tasks.title"),description:f("project.tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(b=>r.jsx(ce,{size:"sm","data-testid":`task-filter-${b}`,variant:t===b?"primary":"ghost",onClick:()=>s(b),children:b},b))}),children:[r.jsxs("div",{className:"mb-4 flex shrink-0 items-end gap-2",children:[r.jsx(ie,{label:f("project.tasks.add_label"),children:r.jsx(Ee,{"data-testid":"task-input",placeholder:f("project.tasks.add_placeholder"),value:c,onChange:b=>u(b.target.value),onKeyDown:b=>{b.key==="Enter"&&h()}})}),r.jsxs(ce,{variant:"primary","data-testid":"task-add",onClick:h,loading:p,children:[r.jsx(an,{size:14})," ",f("project.tasks.add")]})]}),l.isLoading&&r.jsx(rt,{}),!l.isLoading&&l.total===0&&r.jsxs(bt,{children:[t==="open"?f("project.tasks.empty_open"):f("project.tasks.empty",{state:t})," ",r.jsx("code",{children:'apx task add "…"'})]}),r.jsx(u_,{paged:l,fullHeight:!0,children:r.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:l.items.map(b=>r.jsxs("li",{"data-testid":`task-${b.id}`,className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 font-mono text-[10px] text-muted-fg",children:b.id}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium",children:b.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[b.tags?.map(v=>r.jsxs($e,{children:["#",v]},v)),b.agent&&r.jsxs($e,{tone:"info",children:["@",b.agent]}),b.source&&r.jsxs("span",{children:[f("project.tasks.via")," ",b.source]}),b.due&&r.jsxs("span",{children:[f("project.tasks.due")," ",b.due]})]})]}),r.jsxs("div",{className:"flex gap-1",children:[t==="open"&&r.jsxs(r.Fragment,{children:[r.jsx(ce,{size:"sm",variant:"secondary","aria-label":f("project.tasks.aria_done"),"data-testid":`task-done-${b.id}`,onClick:()=>g(()=>Nr.done(e,b.id),f("project.tasks.done")),children:r.jsx(xo,{size:13})}),r.jsx(ce,{size:"sm",variant:"destructive","aria-label":f("project.tasks.aria_drop"),"data-testid":`task-drop-${b.id}`,onClick:()=>g(()=>Nr.drop(e,b.id),f("project.tasks.drop")),children:r.jsx(Gn,{size:13})})]}),t!=="open"&&r.jsx(ce,{size:"sm",variant:"ghost","aria-label":f("project.tasks.aria_reopen"),"data-testid":`task-reopen-${b.id}`,onClick:()=>g(()=>Nr.reopen(e,b.id),f("project.tasks.reopen")),children:r.jsx(Df,{size:13})})]})]},b.id))})})]})}const Q6="\\$\\{var\\.([^}\\s]+)\\}";function yN(e="g"){return new RegExp(Q6,e)}function jN(e){return yN("").test(e)}function W6(e){const t=[];let s=0;for(const o of e.matchAll(yN("g"))){const l=o.index??0;l>s&&t.push({type:"text",value:e.slice(s,l)}),t.push({type:"var",value:o[1]}),s=l+o[0].length}return s<e.length&&t.push({type:"text",value:e.slice(s)}),t}function fg(e){let t="";for(const s of Array.from(e.childNodes))if(s.nodeType===Node.TEXT_NODE)t+=s.textContent??"";else if(s instanceof HTMLElement){const o=s.dataset.varName;o?t+=`\${var.${o}}`:s.tagName==="BR"?t+="":t+=s.textContent??""}return t.replace(/[\u200B-\u200F\u202A-\u202E\u2060\uFEFF]/g,"").replace(/\u00A0/g," ")}function ow(e,t){e.replaceChildren();const s=W6(t);for(const o of s)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(wN(o.value));(s.length===0||s[s.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function wN(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 Z6(e,t){e.deleteContents(),e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(e)}function J6(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!1);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(t)}const m_=x.forwardRef(function({value:t,onChange:s,placeholder:o,className:l,varNames:c=[],onCreateVar:u},p){const m=x.useRef(null),h=x.useRef(null),g=x.useRef(null),[b,v]=x.useState(!1),[k,E]=x.useState(""),y=x.useRef(t);x.useEffect(()=>{const T=m.current;T&&(t===y.current&&T.childNodes.length>0||(ow(T,t),y.current=t))},[t]);const j=x.useCallback(()=>{const T=m.current;if(!T)return;const z=fg(T);y.current=z,z!==t&&s(z)},[s,t]),C=x.useCallback(()=>{const T=m.current;if(!T)return;const z=fg(T);if(jN(z)&&tI(T)){const D=nI(T);ow(T,z),D!=null&&sI(T,D)}y.current=fg(T),y.current!==t&&s(y.current)},[s,t]),S=x.useCallback(()=>{const T=window.getSelection();if(!T||T.rangeCount===0)return;const z=T.getRangeAt(0),D=m.current;D&&D.contains(z.startContainer)&&(g.current=z.cloneRange())},[]),N=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 D=z.getRangeAt(0);if(!D.collapsed)return;const{startContainer:U,startOffset:L}=D;if(U.nodeType===Node.TEXT_NODE&&L===0){const H=U.previousSibling;if(H instanceof HTMLElement&&H.dataset.varName){T.preventDefault(),H.remove(),j();return}}else if(U===m.current){const H=U.childNodes[L-1];if(H instanceof HTMLElement&&H.dataset.varName){T.preventDefault(),H.remove(),j();return}}}},[j]),R=x.useCallback(T=>{const z=m.current;if(!z)return;const D=g.current;z.focus();let U;D&&z.contains(D.startContainer)?U=D:(U=document.createRange(),U.selectNodeContents(z),U.collapse(!1)),Z6(U,wN(T)),g.current=null,j()},[j]);x.useImperativeHandle(p,()=>({insertVar:R,focus:()=>m.current?.focus()}),[R]);const M=c.filter(T=>T.toLowerCase().includes(k.toLowerCase()));return r.jsxs("div",{className:Te("group flex items-stretch w-full min-w-0 rounded-lg border border-input bg-transparent dark:bg-input/30 transition-colors","focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50",l),children:[r.jsxs("div",{className:"relative flex-1 min-w-0",children:[r.jsx("div",{ref:m,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:C,onKeyDown:N,onBlur:j,onFocus:S,onMouseUp:S,onKeyUp:S,className:Te("h-8 w-full whitespace-nowrap overflow-x-auto px-2.5 py-1 text-sm rounded-l-lg","focus:outline-none font-mono leading-7","[&_*]:align-baseline"),"data-placeholder":o||"",style:{caretColor:"currentColor"}}),t===""&&o&&r.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 select-none text-sm text-muted-foreground font-mono",children:o})]}),r.jsxs("div",{ref:h,className:"relative flex",children:[r.jsx(Ge,{content:f("chat_ui.insert_variable"),children:r.jsx("button",{type:"button",onMouseDown:T=>{T.preventDefault(),S()},onClick:()=>v(T=>!T),"aria-label":f("chat_ui.insert_variable"),className:Te("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:r.jsx(an,{size:14})})}),b&&r.jsx(eI,{anchorRef:h,query:k,onQuery:E,varNames:M,onPick:T=>{R(T),v(!1),E("")},onClose:()=>{v(!1),E("")},onCreateVar:u})]})]})});function eI({anchorRef:e,query:t,onQuery:s,varNames:o,onPick:l,onClose:c,onCreateVar:u}){const p=x.useRef(null),m=x.useRef(null),[h,g]=x.useState(null),b=x.useCallback(()=>{const v=e.current;if(!v)return;const k=v.getBoundingClientRect(),E=256,y=4,j=8,C=window.innerWidth-E-j,S=Math.max(j,Math.min(k.right-E,C)),N=k.bottom+y,R=p.current?.offsetHeight??260,M=N+R<=window.innerHeight-j?N:Math.max(j,k.top-R-y);g({left:S,top:M,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 v(k){const E=k.target;p.current?.contains(E)||e.current?.contains(E)||c()}return document.addEventListener("mousedown",v),()=>document.removeEventListener("mousedown",v)},[e,c]),h?Ps.createPortal(r.jsxs("div",{ref:p,style:h,className:"fixed z-[1000] rounded-md border border-border bg-popover shadow-lg",children:[r.jsx("div",{className:"border-b border-border p-2",children:r.jsx("input",{ref:m,value:t,onChange:v=>s(v.target.value),placeholder:f("shared_ui.search_variable_ph"),className:"w-full rounded bg-muted/40 px-2 py-1 text-xs font-mono outline-none"})}),r.jsxs("ul",{className:"max-h-44 overflow-auto p-1 text-xs",children:[o.length===0&&r.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:f("shared_ui.no_matches")}),o.map(v=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:k=>k.preventDefault(),onClick:()=>l(v),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:v})},v))]}),u&&r.jsx("div",{className:"border-t border-border p-1",children:r.jsxs("button",{type:"button",onMouseDown:v=>v.preventDefault(),onClick:()=>{u(),c()},className:"flex w-full items-center gap-1 rounded px-2 py-1.5 text-left text-xs hover:bg-muted/60",children:[r.jsx(an,{size:12})," ",f("shared_ui.create_variable")]})})]}),document.body):null}function tI(e){for(const t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE&&jN(t.textContent??""))return!0;return!1}function nI(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const s=t.getRangeAt(0);if(!e.contains(s.startContainer))return null;const o=s.cloneRange();return o.selectNodeContents(e),o.setEnd(s.startContainer,s.startOffset),o.toString().length}function sI(e,t){const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=t,l=s.nextNode();for(;l;){const c=(l.textContent??"").length;if(o<=c){const u=document.createRange();u.setStart(l,o),u.collapse(!0);const p=window.getSelection();p?.removeAllRanges(),p?.addRange(u);return}o-=c,l=s.nextNode()}J6(e)}function lw(e){return e?Object.entries(e).map(([t,s])=>({key:t,value:String(s)})):[]}function iw(e){const t={};for(const s of e)s.key.trim()&&(t[s.key.trim()]=s.value);return t}function cw({rows:e,onChange:t,keyPlaceholder:s=f("shared_ui.kv_key_ph"),valuePlaceholder:o=f("shared_ui.kv_value_ph"),varNames:l,onCreateVar:c,emptyLabel:u}){const p=(g,b)=>{const v=e.slice();v[g]={...v[g],...b},t(v)},m=g=>t(e.filter((b,v)=>v!==g)),h=()=>t([...e,{key:"",value:""}]);return r.jsxs("div",{className:"space-y-2",children:[e.length===0&&u&&r.jsx("p",{className:"text-[11px] text-muted-foreground",children:u}),e.map((g,b)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ee,{value:g.key,onChange:v=>p(b,{key:v.target.value}),placeholder:s,className:"w-40 font-mono text-xs"}),r.jsx("div",{className:"flex-1",children:r.jsx(m_,{value:g.value,onChange:v=>p(b,{value:v}),placeholder:o,varNames:l,onCreateVar:c})}),r.jsx(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(b),"aria-label":f("shared_ui.remove_row"),children:r.jsx(Gn,{size:13})})]},b)),r.jsxs(ce,{type:"button",size:"sm",variant:"ghost",onClick:h,children:[r.jsx(an,{size:12})," ",f("shared_ui.add_row")]})]})}const aI={apc:"info",runtime:"success",global:"muted"};function Sx(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function pg(e){return e==="runtime"?f("project.mcps.source_runtime"):e==="apc"?f("project.mcps.source_apc"):e==="claude"?f("project.mcps.source_claude"):e==="codex"?f("project.mcps.source_codex"):e==="cursor"?f("project.mcps.source_cursor"):e==="vscode"?f("project.mcps.source_vscode"):e==="roo"?f("project.mcps.source_roo"):e==="gemini"?f("project.mcps.source_gemini"):e==="global"?f("project.mcps.scope_global"):e}function rI({pid:e}){const t=ot(),s=We(`/projects/${e}/mcps`,()=>Er.list(e)),o=We(`/projects/${e}/mcps/check`,()=>Er.check(e)),l=We(`/projects/${e}/vars`,()=>Lc.list(e)),[c,u]=x.useState(null),[p,m]=x.useState(null),[h,g]=x.useState(null),b=x.useMemo(()=>l.data?Object.keys(l.data.effective).sort():[],[l.data]),v=async(y,j)=>{if(confirm(f("project.mcps.delete_confirm",{name:y,scope:j})))try{await Er.remove(e,y,j),t.success(f("project.mcps.removed")),s.mutate(),p===y&&m(null)}catch(C){t.error(C?.message||f("common.error_generic"))}},k=async y=>{try{await Er.add(e,Sx(y.source),{name:y.name,enabled:!y.enabled}),s.mutate()}catch(j){t.error(j?.message||f("common.error_generic"))}},E=async y=>{m(y),g({name:y,busy:!0});try{const j=await Er.test(e,y);g({name:y,result:j})}catch(j){g({name:y,result:{ok:!1,error:j?.message||"error"}})}};return r.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[r.jsx("div",{className:"lg:col-span-3",children:r.jsxs(Ye,{title:f("project.mcps.title"),description:f("project.mcps.subtitle"),action:r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>u({kind:"new"}),children:[r.jsx(an,{size:14})," ",f("project.mcps.new")]}),children:[o.data?.conflicts?.length?r.jsxs("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:[r.jsx("div",{className:"font-medium",children:f("project.mcps.conflicts",{names:o.data.conflicts.map(y=>y.name).join(", ")})}),r.jsx("ul",{className:"mt-1 space-y-1 text-muted-fg",children:o.data.conflicts.map(y=>r.jsxs("li",{className:"flex gap-2",children:[r.jsx("span",{"aria-hidden":"true",children:"•"}),r.jsx("span",{children:f("project.mcps.conflict_detail",{name:y.name,winner:pg(y.winner),loser:pg(y.loser)})})]},`${y.name}-${y.winner}-${y.loser}`))})]}):null,s.isLoading&&r.jsx(rt,{}),!s.isLoading&&(s.data?.length??0)===0&&r.jsx(bt,{children:f("project.mcps.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(y=>{const j=y.source==="apc"||y.source==="runtime"||y.source==="global",C=Sx(y.source),S=p===y.name;return r.jsxs("li",{className:"rounded-md border px-3 py-2 transition-colors "+(S?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>m(y.name),role:"button",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("span",{className:"font-medium",children:y.name}),r.jsx($e,{tone:aI[y.source]??"muted",children:pg(y.source)}),r.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(y.transport||"stdio").toUpperCase()}),r.jsx("div",{onClick:N=>N.stopPropagation(),children:r.jsx(Qt,{checked:y.enabled!==!1,onChange:()=>k(y),label:""})}),r.jsx(Ge,{content:f("project.mcps.test_btn"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:N=>{N.stopPropagation(),E(y.name)},"aria-label":f("project.mcps.test_btn"),children:r.jsx(Zk,{size:13})})}),r.jsx(Ge,{content:f("project.mcps.logs_btn"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:N=>{N.stopPropagation(),m(y.name)},"aria-label":f("project.mcps.logs_btn"),children:r.jsx(Jd,{size:13})})}),j&&r.jsx(Ge,{content:f("project.mcps.edit_btn"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:N=>{N.stopPropagation(),u({kind:"edit",entry:y})},"aria-label":f("project.mcps.edit_btn"),children:r.jsx(To,{size:13})})}),j&&r.jsx(ce,{size:"sm",variant:"destructive",onClick:N=>{N.stopPropagation(),v(y.name,C)},children:r.jsx(Gn,{size:13})})]}),h?.name===y.name&&r.jsx(oI,{result:h.result,busy:!!h.busy,onClose:()=>g(null)})]},`${y.source}-${y.name}`)})}),c&&r.jsx(iI,{mode:c,pid:e,varNames:b,onClose:()=>u(null),onSaved:()=>{u(null),s.mutate()},onVarsChanged:()=>l.mutate()})]})}),r.jsx("div",{className:"lg:col-span-1",children:r.jsx(lI,{pid:e,mcpName:p,runningTest:!!h?.busy})})]})}function oI({result:e,busy:t,onClose:s}){return r.jsxs("div",{className:"mt-2 rounded border border-border/60 bg-background/40 p-2 text-xs",children:[r.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[t&&r.jsx("span",{className:"text-muted-fg",children:f("project.mcps.testing")}),!t&&e?.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-emerald-400",children:[r.jsx(Qk,{size:12})," ",f("project.mcps.test_ok",{n:String(e.tool_count??0)})]}),!t&&e&&!e.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[r.jsx(bM,{size:12})," ",e.error]}),r.jsx("button",{className:"ml-auto text-muted-fg hover:text-fg",onClick:s,children:"×"})]}),!t&&e?.ok&&e.tools&&e.tools.length>0&&r.jsxs("ul",{className:"space-y-0.5 font-mono",children:[e.tools.slice(0,10).map(o=>r.jsxs("li",{className:"truncate",children:[r.jsx("span",{className:"text-primary",children:o.name}),o.description&&r.jsxs("span",{className:"ml-2 text-muted-fg",children:["— ",o.description]})]},o.name)),e.tools.length>10&&r.jsxs("li",{className:"text-muted-fg",children:["… +",e.tools.length-10]})]})]})}function lI({pid:e,mcpName:t,runningTest:s}){const[o,l]=x.useState(null),[c,u]=x.useState(null),p=x.useRef(null);x.useEffect(()=>{if(!t){l(null),u(null);return}p.current!==t&&(l(null),u(null),p.current=t);let h=!1;const g=async()=>{try{const k=await Er.logs(e,t);h||(l(k),u(null))}catch(k){h||u(k?.message||"error")}};g();const v=setInterval(g,s?1200:4e3);return()=>{h=!0,clearInterval(v)}},[e,t,s]);const m=x.useRef(null);return x.useEffect(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[o?.events?.length,o?.stderr_tail]),r.jsxs("div",{className:"sticky top-3 flex h-[calc(100vh-7rem)] min-h-[24rem] flex-col rounded-xl border border-border bg-card",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs",children:[r.jsx(Ga,{size:13,className:"text-muted-fg"}),r.jsx("span",{className:"font-medium",children:f("project.mcps.logs_panel_title")}),t?r.jsx($e,{tone:"info",children:t}):r.jsxs("span",{className:"text-muted-fg",children:["— ",f("project.mcps.logs_panel_pick")]})]}),r.jsxs("div",{ref:m,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!t&&r.jsx("p",{className:"text-muted-fg",children:f("project.mcps.logs_panel_hint")}),t&&c&&r.jsx("p",{className:"text-red-400",children:c}),t&&!c&&o&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"mb-2 text-muted-fg",children:[o.transport.toUpperCase(),o.url?` · ${o.url}`:o.command?` · ${o.command}`:"",o.last_error?` · last_error: ${o.last_error}`:""]}),o.note&&r.jsx("p",{className:"text-muted-fg",children:o.note}),(!o.events||o.events.length===0)&&!o.stderr_tail&&!o.note&&r.jsx("p",{className:"text-muted-fg",children:f("project.mcps.logs_panel_idle")}),o.events?.map((h,g)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:h.ts.slice(11,19)}),r.jsx("span",{className:h.level==="error"?"text-red-400":h.level==="stderr"?"text-amber-400":"text-emerald-400",children:h.level}),r.jsx("span",{className:"flex-1 break-all",children:h.msg})]},g)),o.stderr_tail&&r.jsxs("div",{className:"mt-2 border-t border-border/60 pt-2",children:[r.jsx("div",{className:"mb-1 text-muted-fg",children:"stderr"}),r.jsx("pre",{className:"whitespace-pre-wrap break-all text-amber-300/80",children:o.stderr_tail})]})]})]})]})}function iI({mode:e,pid:t,varNames:s,onClose:o,onSaved:l,onVarsChanged:c}){const u=ot(),p=e.kind==="edit",m=p?e.entry:null,[h,g]=x.useState(!1),[b,v]=x.useState(m?Sx(m.source):"runtime"),[k,E]=x.useState(m?.name||""),[y,j]=x.useState(m?.transport==="http"||m?.url?"http":"stdio"),[C,S]=x.useState(m?.command||""),[N,R]=x.useState(m?.args&&m.args.length?m.args:[""]),[M,T]=x.useState(lw(m?.env)),[z,D]=x.useState(m?.url||""),[U,L]=x.useState(lw(m?.headers)),[H,O]=x.useState(m?.enabled!==!1),[P,B]=x.useState(!1),$=async()=>{if(!k.trim()){u.error(f("project.mcps.name_required"));return}g(!0);try{const q=N.map(Y=>Y.trim()).filter(Boolean),X=y==="stdio"?{name:k.trim(),command:C.trim(),args:q.length?q:void 0,env:M.length?iw(M):void 0,enabled:H}:{name:k.trim(),url:z.trim(),headers:U.length?iw(U):void 0,enabled:H};await Er.add(t,b,X),u.success(f(p?"project.mcps.updated":"project.mcps.added")),l()}catch(q){u.error(q?.message||f("common.error_generic"))}finally{g(!1)}};return r.jsxs(r.Fragment,{children:[r.jsx(Sn,{open:!0,onClose:()=>h?null:o(),title:f(p?"project.mcps.edit_title":"project.mcps.new_title"),description:p?m?.name:f("project.mcps.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:o,disabled:h,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:$,loading:h,children:f(p?"project.mcps.save_btn":"project.mcps.add_btn")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("project.mcps.scope_label"),children:r.jsx(_t,{value:b,onChange:q=>v(q),options:[{value:"runtime",label:f("project.mcps.scope_runtime"),description:f("project.mcps.scope_runtime_desc")},{value:"shared",label:f("project.mcps.scope_shared"),description:f("project.mcps.scope_shared_desc")},{value:"global",label:f("project.mcps.scope_global"),description:f("project.mcps.scope_global_desc")}]})}),r.jsx(ie,{label:f("project.mcps.transport_label"),children:r.jsx(_t,{value:y,onChange:q=>j(q),options:[{value:"stdio",label:f("project.mcps.transport_stdio"),description:f("project.mcps.transport_stdio_desc")},{value:"http",label:f("project.mcps.transport_http"),description:f("project.mcps.transport_http_desc")}]})})]}),r.jsx(ie,{label:f("project.mcps.name_label"),children:r.jsx(Ee,{value:k,onChange:q=>E(q.target.value),placeholder:f("project.mcps.name_ph"),disabled:p})}),y==="stdio"?r.jsxs(r.Fragment,{children:[r.jsx(ie,{label:f("project.mcps.cmd_label"),children:r.jsx(Ee,{value:C,onChange:q=>S(q.target.value),placeholder:f("project.mcps.cmd_ph")})}),r.jsx(ie,{label:f("project.mcps.args_label"),hint:f("project.mcps.args_hint_tokens"),children:r.jsx(cI,{args:N,onChange:R,varNames:s,onCreateVar:()=>B(!0)})}),r.jsx(ie,{label:f("project.mcps.env_label"),hint:f("project.mcps.env_hint_tokens"),children:r.jsx(cw,{rows:M,onChange:T,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:s,onCreateVar:()=>B(!0),emptyLabel:f("project.mcps.env_empty")})})]}):r.jsxs(r.Fragment,{children:[r.jsx(ie,{label:f("project.mcps.url_label"),children:r.jsx(m_,{value:z,onChange:D,placeholder:f("project.mcps.url_ph"),varNames:s,onCreateVar:()=>B(!0)})}),r.jsx(ie,{label:f("project.mcps.headers_label"),hint:f("project.mcps.headers_hint"),children:r.jsx(cw,{rows:U,onChange:L,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:s,onCreateVar:()=>B(!0),emptyLabel:f("project.mcps.headers_empty")})})]}),r.jsx(Qt,{checked:H,onChange:O,label:f("project.mcps.enabled_label")})]})}),P&&r.jsx(uI,{pid:t,onClose:()=>B(!1),onCreated:()=>{B(!1),c()}})]})}function cI({args:e,onChange:t,varNames:s,onCreateVar:o}){const l=(p,m)=>{const h=e.slice();h[p]=m,t(h)},c=p=>t(e.filter((m,h)=>h!==p)),u=()=>t([...e,""]);return r.jsxs("div",{className:"space-y-2",children:[e.map((p,m)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:"flex-1",children:r.jsx(m_,{value:p,onChange:h=>l(m,h),placeholder:f("agents_ui.arg_placeholder"),varNames:s,onCreateVar:o})}),r.jsx(ce,{type:"button",size:"sm",variant:"ghost",onClick:()=>c(m),"aria-label":f("agents_ui.remove_arg"),children:r.jsx(Gn,{size:13})})]},m)),r.jsxs(ce,{type:"button",size:"sm",variant:"ghost",onClick:u,children:[r.jsx(an,{size:12})," ",f("project.mcps.add_arg")]})]})}function uI({pid:e,onClose:t,onCreated:s}){const o=ot(),l=String(e)==="0",[c,u]=x.useState(""),[p,m]=x.useState(""),[h,g]=x.useState(!1),[b,v]=x.useState(l?"global":"project"),k=async()=>{if(!c.trim()){o.error(f("project.vars.name_required"));return}if(!p){o.error(f("project.vars.value_required"));return}g(!0);try{await Lc.upsert(e,{name:c.trim(),value:p,scope:b}),o.success(f("project.vars.added")),s()}catch(E){o.error(E?.message||f("common.error_generic"))}finally{g(!1)}};return r.jsx(Sn,{open:!0,onClose:()=>h?null:t(),title:f("project.vars.new_title"),description:f("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:h,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:k,loading:h,children:f("project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ie,{label:f("project.vars.scope_label"),children:r.jsx(_t,{value:b,onChange:E=>v(E),options:[...l?[]:[{value:"project",label:f("project.vars.scope_project"),description:f("project.vars.scope_project_desc")}],{value:"global",label:f("project.vars.scope_global"),description:f("project.vars.scope_global_desc")}]})}),r.jsx(ie,{label:f("project.vars.name_label"),hint:f("project.vars.name_hint"),children:r.jsx(Ee,{value:c,onChange:E=>u(E.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),r.jsx(ie,{label:f("project.vars.value_label"),hint:f("project.vars.value_hint"),children:r.jsx(Ee,{type:"password",value:p,onChange:E=>m(E.target.value),className:"font-mono text-xs"})})]})})}function dI({pid:e}){const t=ot(),s=String(e)==="0",[o,l]=x.useState(s?"global":"all"),[c,u]=x.useState(!1),p=We(`/projects/${e}/vars?reveal=${c?1:0}`,()=>Lc.list(e,{reveal:c})),[m,h]=x.useState(null),g=x.useMemo(()=>{if(!p.data)return[];const v=[],k=p.data.project||{},E=p.data.global||{};for(const[y,j]of Object.entries(k))v.push({name:y,scope:"project",masked:j});for(const[y,j]of Object.entries(E))k[y]===void 0&&v.push({name:y,scope:"global",masked:j});return v.filter(y=>o==="all"?!0:y.scope===o).sort((y,j)=>y.name.localeCompare(j.name))},[p.data,o]),b=async(v,k)=>{if(confirm(f("project.vars.delete_confirm",{name:v,scope:k})))try{await Lc.remove(e,v,k),t.success(f("project.vars.removed")),p.mutate()}catch(E){t.error(E?.message||f("common.error_generic"))}};return r.jsxs(Ye,{title:f("project.vars.title"),description:f(s?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qt,{checked:c,onChange:u,label:f("project.vars.reveal_all")}),r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>h({}),children:[r.jsx(an,{size:14})," ",f("project.vars.new")]})]}),children:[!s&&r.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[r.jsx("span",{className:"text-muted-fg",children:f("project.vars.filter_label")}),r.jsx(mg,{active:o==="all",onClick:()=>l("all"),children:f("project.vars.filter_all")}),r.jsx(mg,{active:o==="project",onClick:()=>l("project"),children:f("project.vars.filter_project")}),r.jsx(mg,{active:o==="global",onClick:()=>l("global"),children:f("project.vars.filter_global")})]}),p.isLoading&&r.jsx(rt,{}),!p.isLoading&&g.length===0&&r.jsx(bt,{children:f("project.vars.empty")}),g.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:g.map(v=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-mono text-xs font-medium",children:v.name}),r.jsx($e,{tone:v.scope==="project"?"info":"muted",children:v.scope==="project"?f("project.vars.scope_project"):f("project.vars.scope_global")}),r.jsx("span",{className:"ml-2 font-mono text-xs text-muted-fg",children:v.masked}),r.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>h({name:v.name,scope:v.scope}),"aria-label":f("project.vars.edit_btn"),children:r.jsx(To,{size:13})}),!(s&&v.scope==="project")&&r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>b(v.name,v.scope),"aria-label":f("project.vars.delete_btn"),children:r.jsx(Gn,{size:13})})]})]},`${v.scope}-${v.name}`))}),r.jsx(fI,{open:m!==null,initial:m||void 0,onClose:()=>h(null),pid:e,isBase:s,onSaved:()=>{h(null),p.mutate()}})]})}function mg({active:e,onClick:t,children:s}){return r.jsx("button",{type:"button",onClick:t,className:e?"rounded-full border border-primary/50 bg-primary/10 px-2 py-0.5 text-xs":"rounded-full border border-border bg-muted/30 px-2 py-0.5 text-xs hover:bg-muted/60",children:s})}function fI({open:e,onClose:t,pid:s,isBase:o,initial:l,onSaved:c}){const u=ot(),[p,m]=x.useState(!1),[h,g]=x.useState(!1),[b,v]=x.useState(l?.name||""),[k,E]=x.useState(l?.value||""),[y,j]=x.useState(l?.scope||(o?"global":"project")),C=!!l?.name;x.useEffect(()=>{e&&(v(l?.name||""),E(l?.value||""),j(l?.scope||(o?"global":"project")),g(!1))},[e,l?.name,l?.scope,l?.value,o]);const S=async()=>{if(!b.trim()){u.error(f("project.vars.name_required"));return}if(!k){u.error(f("project.vars.value_required"));return}m(!0);try{await Lc.upsert(s,{name:b.trim(),value:k,scope:y}),u.success(f(C?"project.vars.updated":"project.vars.added")),c()}catch(N){u.error(N?.message||f("common.error_generic"))}finally{m(!1)}};return r.jsx(Sn,{open:e,onClose:()=>p?null:t(),title:f(C?"project.vars.edit_title":"project.vars.new_title"),description:f("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:p,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:S,loading:p,children:f(C?"project.vars.save_btn":"project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ie,{label:f("project.vars.scope_label"),children:r.jsx(_t,{value:y,onChange:N=>j(N),options:[...o?[]:[{value:"project",label:f("project.vars.scope_project"),description:f("project.vars.scope_project_desc")}],{value:"global",label:f("project.vars.scope_global"),description:f("project.vars.scope_global_desc")}]})}),r.jsx(ie,{label:f("project.vars.name_label"),hint:f("project.vars.name_hint"),children:r.jsx(Ee,{value:b,onChange:N=>v(N.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:C,autoFocus:!C})}),r.jsx(ie,{label:f("project.vars.value_label"),hint:f("project.vars.value_hint"),children:r.jsxs("div",{className:"relative",children:[r.jsx(Ee,{type:h?"text":"password",value:k,onChange:N=>E(N.target.value),placeholder:C?f("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:C}),r.jsx("button",{type:"button",onClick:()=>g(N=>!N),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":f(h?"project.vars.hide":"project.vars.reveal"),children:h?r.jsx(CM,{size:14}):r.jsx(Af,{size:14})})]})})]})})}function h_({value:e,onValueChange:t,onSubmit:s,onStop:o,busy:l=!1,disabled:c=!1,placeholder:u,autoFocus:p,minRows:m=2,maxRows:h=8,footer:g,className:b}){const v=x.useRef(null);x.useLayoutEffect(()=>{const E=v.current;if(!E)return;const y=()=>{E.style.height="auto",E.offsetHeight;const C=parseFloat(getComputedStyle(E).lineHeight)||20,S=C*m,N=C*h;E.style.height=`${Math.min(Math.max(E.scrollHeight,S),N)}px`,E.style.overflowY=E.scrollHeight>N?"auto":"hidden"};y();const j=requestAnimationFrame(y);return()=>cancelAnimationFrame(j)},[e,m,h]);const k=e.trim().length>0&&!c;return r.jsxs("div",{className:Ct("flex flex-col gap-1.5 rounded-2xl border border-border bg-muted/60 p-2 shadow-sm transition-colors","focus-within:border-foreground/25 focus-within:bg-muted",c&&"opacity-60",b),children:[r.jsx("textarea",{ref:v,rows:m,value:e,autoFocus:p,disabled:c,placeholder:u,onChange:E=>t(E.target.value),onKeyDown:E=>{if(E.key==="Enter"&&!E.shiftKey){if(E.preventDefault(),l||!k)return;s()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),r.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[r.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:g}),l&&o?r.jsx(Ge,{content:f("chat_ui.stop"),children:r.jsx(Qa,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":f("chat_ui.stop"),children:r.jsx(rS,{className:"size-3.5",fill:"currentColor"})})}):r.jsx(Ge,{content:f("chat_ui.send"),children:r.jsx(Qa,{type:"button",size:"icon-sm",variant:"default",onClick:s,disabled:!k,"aria-label":f("chat_ui.send"),children:r.jsx(dM,{className:"size-4"})})})]})]})}function g_({value:e,onChange:t,disabled:s}){const[o,l]=x.useState(!1),[c,u]=x.useState(""),[p,m]=x.useState([]),[h,g]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{if(!o)return;const j=C=>{b.current&&!b.current.contains(C.target)&&l(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[o]),x.useEffect(()=>{if(!o||h)return;let j=!1;return(async()=>{try{const{engines:C}=await bf.list(),S=await Promise.all(C.map(N=>bf.models({engine:N}).then(R=>(R.models||[]).map(M=>M.includes(":")?M:`${N}:${M}`)).catch(()=>[])));if(!j){const N=Array.from(new Set(S.flat())).sort();m(N),g(!0)}}catch{j||g(!0)}})(),()=>{j=!0}},[o,h]);const v=c.trim().toLowerCase(),k=v?p.filter(j=>j.toLowerCase().includes(v)):p,E=e||f("shared_ui.auto"),y=j=>{t(j),l(!1),u("")};return r.jsxs("div",{ref:b,className:"relative",children:[r.jsx(Ge,{content:f("chat_ui.pick_model"),children:r.jsxs("button",{type:"button",disabled:s,onClick:()=>l(j=>!j),"data-testid":"chat-model-picker",className:Te("flex max-w-[200px] items-center gap-1 rounded-md border border-transparent px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors","hover:bg-accent/60 hover:text-foreground",e&&"text-foreground"),"aria-label":f("chat_ui.pick_model"),children:[r.jsx(aS,{className:"size-3 shrink-0"}),r.jsx("span",{className:"truncate font-mono",children:E}),r.jsx(pa,{className:"size-3 shrink-0 opacity-60"})]})}),o&&r.jsxs("div",{className:"absolute bottom-full left-0 z-50 mb-1.5 w-64 rounded-lg border border-border bg-popover p-1.5 shadow-md ring-1 ring-foreground/10",children:[r.jsx("input",{autoFocus:!0,value:c,placeholder:f("shared_ui.model_filter_ph"),onChange:j=>u(j.target.value),onKeyDown:j=>{j.key==="Enter"&&c.trim()&&y(c.trim())},className:"mb-1 w-full rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus:border-foreground/30"}),r.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:j=>{j.preventDefault(),y("")},className:Te("flex w-full items-center justify-between rounded-md px-2 py-1 text-left text-xs hover:bg-accent hover:text-accent-fg",!e&&"bg-accent/50"),children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Ys,{className:"size-3"})," ",f("shared_ui.auto_router")]}),!e&&r.jsx(xo,{className:"size-3"})]})}),!h&&r.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:f("shared_ui.loading_models")}),h&&k.length===0&&c.trim()&&r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:j=>{j.preventDefault(),y(c.trim())},className:"w-full rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",children:f("shared_ui.use_value",{value:c.trim()})})}),k.map(j=>r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:C=>{C.preventDefault(),y(j)},className:Te("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",j===e&&"bg-accent/50"),children:[r.jsx("span",{className:"truncate",children:j}),j===e&&r.jsx(xo,{className:"size-3 shrink-0"})]})},j))]})]})]})}function pI({onSend:e,onStop:t,streaming:s,model:o,onModelChange:l}){const[c,u]=x.useState(""),p=()=>{const m=c.trim();m&&(u(""),e(m))};return r.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:r.jsx(h_,{value:c,onValueChange:u,onSubmit:p,onStop:t,busy:s,placeholder:f("project.chat.placeholder"),maxRows:12,footer:l?r.jsx(g_,{value:o||"",onChange:l,disabled:s}):void 0})})}function mI(){return{read_file:{icon:RM,label:f("shared_ui.tool_read_file")},write_file:{icon:EM,label:f("shared_ui.tool_write_file")},edit_file:{icon:Wd,label:f("shared_ui.tool_edit_file")},list_files:{icon:eS,label:f("shared_ui.tool_list_files")},search_files:{icon:vc,label:f("shared_ui.tool_search_files")},search_messages:{icon:vc,label:f("shared_ui.tool_search_messages")},tail_messages:{icon:vc,label:f("shared_ui.tool_tail_messages")},run_shell:{icon:Ga,label:f("shared_ui.tool_run_shell")},send_telegram:{icon:Gs,label:f("shared_ui.tool_send_telegram")},call_agent:{icon:on,label:f("shared_ui.tool_call_agent")},call_mcp:{icon:QM,label:f("shared_ui.tool_call_mcp")},call_runtime:{icon:on,label:f("shared_ui.tool_call_runtime")},create_task:{icon:FM,label:f("shared_ui.tool_create_task")}}}const kN=new Set(["write_file","edit_file"]);function hI(e){return mI()[e]||{icon:ei,label:e}}function gI(e,t){if(!t)return"";const s=l=>typeof t[l]=="string"?t[l]:void 0,o=s("path")||s("file")||s("pattern")||s("query")||s("command")||s("slug")||s("name")||s("agent");return o?String(o):""}function uw(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function xI({status:e}){return e==="running"?r.jsx(zf,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?r.jsx(Ys,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?r.jsx(kM,{className:"size-3 shrink-0 text-amber-400"}):r.jsx(xo,{className:"size-3 shrink-0 text-emerald-400"})}function bI({part:e}){const[t,s]=x.useState(!1),{icon:o,label:l}=hI(e.tool),c=gI(e.tool,e.args),u=kN.has(e.tool),p=!!e.args||e.result!==void 0;return r.jsxs("div",{className:Te("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[r.jsxs("button",{type:"button",onClick:()=>p&&s(m=>!m),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[p?r.jsx(Jl,{className:Te("size-3 shrink-0 text-muted-foreground transition-transform",t&&"rotate-90")}):r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(o,{className:Te("size-3.5 shrink-0",u?"text-violet-400":"text-muted-foreground")}),r.jsx("span",{className:"shrink-0 font-medium",children:l}),c&&r.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),r.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&r.jsx("span",{className:"text-[10px] text-amber-400",children:f("shared_ui.dedup")}),r.jsx(xI,{status:e.status})]})]}),t&&p&&r.jsxs("div",{className:"space-y-2 border-t border-border/60 px-2.5 py-2",children:[e.args&&Object.keys(e.args).length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:f("shared_ui.args")}),r.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:uw(e.args)})]}),e.result!==void 0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:f("shared_ui.result")}),r.jsx("pre",{className:Te("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 _I(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 vI({part:e,pending:t}){const s=_I(e),o=f(t?"ask_panel.status_waiting":"ask_panel.status_received");return r.jsxs("div",{className:Te("rounded-2xl border px-3 py-2 text-sm shadow-sm",t?"rounded-bl-sm border-amber-500/30 bg-amber-500/5 text-foreground":"rounded-bl-sm border-emerald-500/30 bg-emerald-500/5 text-foreground"),"data-testid":"ask-questions-card","data-state":t?"pending":"answered",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[t?r.jsx(zf,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):r.jsx(Qk,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),r.jsx(tS,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"text-[12px] font-medium",children:o}),s.length>1&&r.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[s.length," preguntas"]})]}),s.length>0&&r.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:s.map((l,c)=>r.jsx("li",{className:"list-disc",children:l},c))})]})}function SN(e){const t=e.split(`
628
- `),s=[];let o=null;for(const l of t)if(l.startsWith("- "))o&&s.push(o),o={question:l.slice(2),answer:"",skipped:!1};else if(l.startsWith(" → ")&&o){const c=l.slice(4);o.answer=c,o.skipped=c==="(omitido)"}else return null;return o&&s.push(o),s.length>0?s:null}function yI({text:e}){const t=SN(e);return t?r.jsx("div",{className:"flex w-full justify-center",children:r.jsxs("div",{className:"w-full max-w-[85%] rounded-2xl border border-border/70 bg-card/40 px-4 py-3 shadow-sm","data-testid":"ask-answers-card",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx(tS,{className:"size-3.5"}),r.jsx("span",{children:f("ask_panel.answers_header")})]}),r.jsx("ul",{className:"space-y-2.5",children:t.map((s,o)=>r.jsxs("li",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:s.question}),r.jsx("div",{className:Te("whitespace-pre-wrap text-[13px] leading-snug",s.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:s.answer})]},o))})]})}):null}function Cx(e){return e.parts.filter(t=>t.kind==="text").map(t=>t.text).join(`
629
-
630
- `).trim()}function jI(e){const t=e.args?.questions;if(!Array.isArray(t)||t.length===0)return null;const s=t.map(o=>{if(typeof o=="string")return`- ${o}`;if(!o||typeof o!="object")return null;const l=o;if(typeof l.question!="string")return null;const u=(Array.isArray(l.options)?l.options:[]).map(p=>typeof p=="string"?p:p&&typeof p=="object"&&typeof p.label=="string"?p.label:"").filter(p=>p).join(", ");return u?`- ${l.question} (opciones: ${u})`:`- ${l.question}`}).filter(o=>!!o);return s.length===0?null:`[ask_questions]
631
- ${s.join(`
632
- `)}`}function wI(e){const t=[];for(const s of e.parts)if(s.kind==="text"&&s.text)t.push(s.text);else if(s.kind==="tool"&&s.tool==="ask_questions"){const o=jI(s);o&&t.push(o)}return t.join(`
633
-
634
- `).trim()}const CN=e=>[{kind:"text",text:e}];function NN(e){if(!e||typeof e!="object")return!1;const t=e;return"error"in t&&!!t.error}function kI(e){const t=[];let s=null,o=0;for(const l of e){const c=l.ts||new Date().toISOString();l.role==="user"?(s=null,t.push({role:"user",parts:CN(l.content),ts:c})):(l.role==="assistant"||l.role==="tool")&&(s||(s={role:"assistant",parts:[],ts:c},t.push(s)),l.role==="tool"?s.parts.push({kind:"tool",id:`hist-${o++}`,tool:l.tool||"tool",args:l.args,result:l.result,status:NN(l.result)?"error":"done"}):l.content&&s.parts.push({kind:"text",text:l.content}))}return t}function x_(e,t){const s=o=>({...e,notes:[...e.notes||[],o]});switch(t.type){case"model_start":return t.model?{...e,model:t.model}:e;case"model_routed":{const o=t.model?{...e,model:t.model}:e;return t.from_fallback?{...o,notes:[...o.notes||[],`routing fell back → ${t.model}`]}:o}case"engine_failed":return s(`engine ${t.model||"?"} failed → ${t.retry_with||"retry"}`);case"model_retry":return s(`retry (${t.reason||"?"})`);case"tools_suppressed":return s(`tools suppressed: ${(t.tools||[]).join(", ")}`);case"skill_inspector":{const o=t.inspector;return!o||!o.loaded?.length&&!o.hinted?.length?e:{...e,inspector:{embedder:o.embedder,loaded:o.loaded||[],hinted:o.hinted||[]}}}case"assistant_text":return t.text?{...e,parts:[...e.parts,{kind:"text",text:t.text}]}:e;case"tool_start":return t.trace?{...e,parts:[...e.parts,{kind:"tool",id:t.trace.id,tool:t.trace.tool,args:t.trace.args,status:"running"}]}:e;case"tool_deduped":return t.trace?{...e,parts:e.parts.map(o=>o.kind==="tool"&&o.id===t.trace.id?{...o,status:"deduped"}:o)}:e;case"tool_result":if(!t.trace)return e;{const o=NN(t.trace.result);return{...e,parts:e.parts.map(l=>l.kind==="tool"&&l.id===t.trace.id?{...l,result:t.trace.result,status:o?"error":l.status==="deduped"?"deduped":"done"}:l)}}case"final":return{...e,pending:!1,usage:t.result?.usage??e.usage,model:e.model??t.result?.name,parts:t.result?.text&&!e.parts.some(o=>o.kind==="text")?[...e.parts,{kind:"text",text:t.result.text}]:e.parts};default:{const o=t.delta||t.content||"";if(!o)return e;const l=[...e.parts],c=l[l.length-1];return c&&c.kind==="text"?l[l.length-1]={...c,text:c.text+o}:l.push({kind:"text",text:o}),{...e,parts:l}}}}function SI(e,t){const[s,o]=x.useState([]),[l,c]=x.useState(!1),[u,p]=x.useState(void 0),m=x.useRef(null),h=x.useRef(void 0),g=x.useRef(0),b=x.useCallback(S=>{o(N=>{const R=[...N],M=R[R.length-1];return M&&M.role==="assistant"&&(R[R.length-1]=S(M)),R})},[]),v=x.useCallback(S=>{if(S.type==="error"){t?.(S.error||f("shared_ui.err_stream"));return}b(N=>x_(N,S))},[b,t]),k=x.useCallback(async(S,N={})=>{const R=S.trim();if(!R||l)return;const M=()=>new Date().toISOString(),T=s.map(D=>({role:D.role,content:wI(D)}));if(o(D=>[...D,{role:"user",parts:CN(R),ts:M()},{role:"assistant",parts:[],ts:M(),pending:!0}]),c(!0),N.agentSlug){try{const D=await ln.chat(e,N.agentSlug,{prompt:R,conversation_id:h.current,model:N.model||void 0,channel:"web"});h.current=D.conversation_id,p(D.conversation_id),b(U=>({...U,pending:!1,model:D.engine,parts:[{kind:"text",text:D.text}]}))}catch(D){t?.(D?.message||f("shared_ui.err_chat_failed")),o(U=>U.filter((L,H)=>H!==U.length-1))}finally{c(!1)}return}const z=new AbortController;m.current=z;try{await kC.stream(e,{prompt:R,previousMessages:T,model:N.model||void 0,channel:"web"},v,z.signal),b(D=>({...D,pending:!1}))}catch(D){z.signal.aborted?b(U=>({...U,pending:!1,parts:[...U.parts,{kind:"text",text:f("code_module.stopped")}]})):(t?.(D?.message||f("shared_ui.err_stream_failed")),o(U=>U.filter((L,H)=>H!==U.length-1)))}finally{c(!1),m.current=null}},[e,s,l,v,b,t]),E=x.useCallback(()=>m.current?.abort(),[]),y=x.useCallback(()=>{l||(g.current++,h.current=void 0,p(void 0),o([]))},[l]),j=x.useCallback(async(S,N)=>{if(l)return;const R=++g.current;o([]);try{const M=await wo.get(e,S,N);if(R!==g.current)return;const T=(M.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()}));h.current=N,p(N),o(T)}catch(M){if(R!==g.current)return;h.current=void 0,p(void 0),o([]),t?.(M?.message||f("shared_ui.err_load_conversation"))}},[e,l,t]),C=x.useCallback(async(S,N)=>{if(l)return;const R=++g.current;o([]);try{const M=await wo.thread(e,S,N);if(R!==g.current)return;const T=kI(M.messages??[]);h.current=void 0,p(void 0),o(T)}catch(M){if(R!==g.current)return;h.current=void 0,p(void 0),o([]),t?.(M?.message||f("shared_ui.err_load_conversation"))}},[e,l,t]);return{msgs:s,send:k,stop:E,clear:y,load:j,loadThread:C,streaming:l,conversationId:u}}function CI({msg:e,isLast:t,isAskAnswer:s,onCopy:o}){const l=e.role==="user",c=Cx(e),u=e.parts.some(p=>p.kind==="tool");if(l&&s){const p=Cx(e);if(SN(p))return r.jsx(yI,{text:p})}return r.jsxs("div",{className:Te("group flex items-start gap-2",l?"justify-end":"justify-start"),children:[!l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(on,{size:14})}),r.jsxs("div",{className:Te("flex min-w-0 flex-col gap-1.5",l?"items-end":"w-full max-w-[85%]"),children:[!l&&e.notes&&e.notes.length>0&&r.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((p,m)=>r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[r.jsx(HM,{size:10})," ",p]},m))}),!l&&e.inspector&&(e.inspector.loaded?.length||e.inspector.hinted?.length)?r.jsx(Ge,{content:f("shared_ui.skill_inspector_title",{embedder:e.inspector.embedder||"RAG"}),children:r.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] text-sky-400/90",children:[r.jsx(Za,{size:10}),e.inspector.loaded?.map(p=>r.jsx("span",{className:"rounded bg-sky-500/15 px-1 py-0.5 font-mono",children:p},`l-${p}`)),e.inspector.hinted?.map(p=>r.jsxs("span",{className:"rounded border border-sky-500/30 px-1 py-0.5 font-mono opacity-70",children:[p,"?"]},`h-${p}`))]})}):null,e.parts.map((p,m)=>p.kind==="tool"?p.tool==="ask_questions"&&!l?r.jsx(vI,{part:p,pending:!!t},`${p.id}-${m}`):r.jsx(bI,{part:p},`${p.id}-${m}`):p.text?r.jsx("div",{className:Te("whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed shadow-sm",l?"rounded-br-sm border border-emerald-500/30 bg-emerald-500/10 text-foreground dark:bg-emerald-500/15":"w-full rounded-bl-sm border border-border bg-card text-foreground"),children:p.text},m):null),!l&&e.pending&&e.parts.length===0&&r.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),r.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[r.jsx("span",{children:NI(e.ts)}),!l&&e.model&&r.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!l&&u&&r.jsxs("span",{children:["· ",f("shared_ui.tools_count",{n:e.parts.filter(p=>p.kind==="tool").length})]}),o&&c&&r.jsx(Ge,{content:f("chat_ui.copy"),children:r.jsxs("button",{type:"button",onClick:()=>o(c),className:"inline-flex items-center gap-1 hover:text-foreground","aria-label":f("chat_ui.copy"),children:[r.jsx(Rc,{size:10})," ",f("chat_ui.copy")]})})]})]}),l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(Xx,{size:14})})]})}function NI(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function b_({msgs:e,onCopy:t}){const s=x.useRef(null);if(x.useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(bt,{children:f("project.chat.empty")})});const o=e.length-1;return r.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((l,c)=>r.jsx(CI,{msg:l,isLast:c===o,isAskAnswer:EI(e,c),onCopy:t},c)),r.jsx("div",{ref:s})]})}function EI(e,t){const s=e[t];if(!s||s.role!=="user")return!1;const o=e[t-1];if(!o||o.role!=="assistant")return!1;for(let l=o.parts.length-1;l>=0;l--){const c=o.parts[l];if(c.kind==="tool")return c.tool==="ask_questions"}return!1}function RI(e){if(!e)return;const t=e.path??e.file??e.filename;return typeof t=="string"?t:void 0}function EN({msgs:e}){const[t,s]=x.useState(!1),{inTok:o,outTok:l,toolCount:c,changed:u,model:p}=x.useMemo(()=>{let h=0,g=0,b=0,v;const k=new Set,E=[];for(const y of e)if(y.role==="assistant"){y.usage&&(h+=y.usage.input_tokens||0,g+=y.usage.output_tokens||0),y.model&&(v=y.model);for(const j of y.parts)if(j.kind==="tool"&&(b+=1,kN.has(j.tool)&&j.status!=="error")){const C=RI(j.args);C&&!k.has(C)&&(k.add(C),E.push({path:C,tool:j.tool}))}}return{inTok:h,outTok:g,toolCount:b,changed:E,model:v}},[e]),m=o+l;return m===0&&c===0?null:r.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[r.jsxs("button",{type:"button",onClick:()=>u.length>0&&s(h=>!h),className:Te("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",u.length>0&&"hover:text-foreground"),children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Of,{size:12})," ",hg(m)," tok",r.jsxs("span",{className:"text-muted-foreground/60",children:["(",hg(o),"↑ / ",hg(l),"↓)"]})]}),c>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ei,{size:12})," ",c," tools"]}),u.length>0&&r.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[r.jsx(Wd,{size:12})," ",u.length," archivos"]}),p&&r.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:p}),u.length>0&&r.jsx(pa,{className:Te("size-3 shrink-0 transition-transform",t&&"rotate-180")})]}),t&&u.length>0&&r.jsx("ul",{className:"max-h-40 space-y-0.5 overflow-y-auto border-t border-border/60 px-4 py-2",children:u.map(h=>r.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[r.jsx(Wd,{size:11,className:"shrink-0 text-violet-400"}),r.jsx("span",{className:"truncate",children:h.path}),r.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:h.tool==="write_file"?"write":"edit"})]},h.path))})]})}function hg(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Sl(){return{picked:new Set,text:"",skipped:!1}}function dw(e,t){const s=[];return e.forEach((o,l)=>{const c=t[l]||Sl();if(c.skipped){s.push(`- ${o.question}
635
- → (omitido)`);return}const u=[];if(o.options&&o.options.length>0){const h=[...c.picked].sort((g,b)=>g-b).map(g=>o.options[g]?.label).filter(Boolean);h.length>0&&u.push(h.join(", "))}const p=c.text.trim();p&&u.push(o.options&&o.options.length>0?`(Otro: ${p})`:p);const m=u.length>0?u.join(" "):"(sin respuesta)";s.push(`- ${o.question}
636
- → ${m}`)}),s.join(`
637
- `)}function RN({turnKey:e,questions:t,onSubmit:s,onDismiss:o,disabled:l}){const c=t.length,[u,p]=x.useState(0),[m,h]=x.useState(()=>t.map(()=>Sl()));x.useEffect(()=>{p(0),h(t.map(()=>Sl()))},[e,t]);const g=t[u],b=m[u]||Sl(),v=!!g?.options&&g.options.length>0,k=!!g?.multiSelect,E=g?.allowText!==!1,y=T=>{h(z=>{const D=[...z],U=D[u]||Sl();return D[u]={...U,...T,skipped:!1},D})},j=T=>{h(z=>{const D=[...z],U=D[u]||Sl(),L=new Set(U.picked);return k?L.has(T)?L.delete(T):L.add(T):(L.clear(),L.add(T)),D[u]={...U,picked:L,skipped:!1},D})},C=x.useMemo(()=>!0,[]),S=u===c-1,N=()=>p(T=>Math.max(0,T-1)),R=()=>{if(S){s(dw(t,m));return}p(T=>Math.min(c-1,T+1))},M=()=>{if(h(T=>{const z=[...T];return z[u]={picked:new Set,text:"",skipped:!0},z}),S){const T=m.map((z,D)=>D===u?{picked:new Set,text:"",skipped:!0}:z);s(dw(t,T))}else p(T=>Math.min(c-1,T+1))};return x.useEffect(()=>{const T=z=>{if(l)return;const D=z.target?.tagName?.toLowerCase(),U=D==="input"||D==="textarea";if(z.key==="Enter"&&(z.metaKey||z.ctrlKey)){z.preventDefault(),R();return}if(!U&&v&&/^[1-9]$/.test(z.key)){const L=parseInt(z.key,10)-1;L<(g?.options?.length||0)&&(z.preventDefault(),j(L))}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)}),!g||c===0?null:r.jsxs("div",{className:Te("mx-3 mb-2 rounded-xl border border-border bg-card/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-card/80",l&&"pointer-events-none opacity-60"),"data-testid":"inline-ask-panel",children:[r.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"mt-0.5 shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-mono font-medium text-amber-700 dark:text-amber-300",children:[u+1,"/",c]}),g.header&&r.jsx("span",{className:"mt-0.5 shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:g.header}),r.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:g.question}),o&&r.jsx("button",{type:"button",onClick:o,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":f("common.close"),children:r.jsx(Ys,{className:"size-3.5"})})]}),r.jsxs("div",{className:"space-y-1 px-2 py-2",children:[v&&g.options.map((T,z)=>{const D=b.picked.has(z);return r.jsxs("button",{type:"button",onClick:()=>j(z),className:Te("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",D?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-xs font-medium",children:T.label}),T.description&&r.jsx("div",{className:"text-[11px] text-muted-foreground",children:T.description})]}),k?r.jsx("span",{className:Te("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",D?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:D&&r.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):r.jsx("span",{className:Te("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",D?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:z+1})]},`${z}:${T.label}`)}),(E||!v)&&r.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[v&&r.jsx("div",{className:"mb-1 text-xs font-medium",children:f("ask_panel.other")}),r.jsx("input",{type:"text",value:b.text,onChange:T=>y({text:T.target.value}),placeholder:f(v?"ask_panel.other_placeholder":"ask_panel.text_placeholder"),className:"w-full rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:border-emerald-500"})]})]}),r.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[r.jsx("button",{type:"button",onClick:N,disabled:u===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:f("ask_panel.back")}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:M,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:f("ask_panel.skip")}),r.jsxs("button",{type:"button",onClick:R,disabled:!C,className:"inline-flex items-center gap-1 rounded bg-emerald-500/15 px-2 py-1 text-[11px] font-medium text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[f(S?"ask_panel.submit":"ask_panel.next"),r.jsx(wM,{className:"size-3 opacity-60"})]})]})]})]})}function TI(e){if(typeof e=="string")return{question:e,options:[],multiSelect:!1,allowText:!0};if(!e||typeof e!="object")return null;const t=e,s=typeof t.question=="string"?t.question:"";if(!s)return null;const l=(Array.isArray(t.options)?t.options:[]).map(c=>{if(typeof c=="string")return{label:c};if(c&&typeof c=="object"&&typeof c.label=="string"){const u=c;return{label:u.label,description:typeof u.description=="string"?u.description:void 0}}return null}).filter(c=>c!==null);return{question:s,header:typeof t.header=="string"?t.header:void 0,options:l,multiSelect:t.multiSelect===!0,allowText:t.allowText!==!1}}function TN(e){if(!e.length)return null;const t=e[e.length-1];if(t.role!=="assistant")return null;let s=null,o=-1;for(let h=t.parts.length-1;h>=0;h--){const g=t.parts[h];if(g.kind==="tool"&&g.tool==="ask_questions"){s=g,o=h;break}}if(!s||o<0)return null;let l=null;if(typeof s.result=="string")try{l=JSON.parse(s.result)}catch{l=null}else s.result&&typeof s.result=="object"&&(l=s.result);const c=[];Array.isArray(s.args?.questions)&&c.push(s.args.questions),l&&Array.isArray(l.questions)&&c.push(l.questions);let u=[];for(const h of c)if(u=h.map(TI).filter(g=>!!g),u.length>0)break;return u.length?{turnKey:`${t.ts||""}#${o}`,questions:u}:null}const Nx={web:{label:"Web",icon:Gx,order:0},telegram:{label:"Telegram",icon:Gs,order:1},desktop:{label:"Desktop",icon:Yx,order:2},voice:{label:"Voice",icon:nS,order:3},a2a:{label:"Agent ↔ Agent",icon:on,order:4},schedule:{label:"Schedule",icon:n3,order:5},other:{label:"Other",icon:Mf,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 AI({pid:e,slug:t,onLoaded:s}){const{data:o}=We(`/projects/${e}/agents/${t}/conversations`,()=>wo.list(e,t),{revalidateOnFocus:!1});return x.useEffect(()=>{s(t,o)},[t,o]),null}function MI({pid:e,agents:t,superAgentSlug:s,superAgentLabel:o,selected:l,onSelect:c,onNewChat:u}){const[p,m]=x.useState(""),[h,g]=x.useState(""),[b,v]=x.useState({}),[k,E]=x.useState({}),[y,j]=x.useState(!1),C=String(e)==="0",S=We(C?`/projects/${e}/super-agent/threads`:null,()=>wo.threads(e),{revalidateOnFocus:!1}),N=(O,P)=>{P&&E(B=>{const $=B[O];return $&&$.length===P.length&&$===P?B:{...B,[O]:P}})},R=x.useMemo(()=>{const O=[];for(const P of t)for(const B of k[P.slug]||[])O.push({...B,agent_slug:B.agent_slug||P.slug});return O},[t,k]),M=x.useMemo(()=>{const O=p.trim().toLowerCase();return R.filter(P=>!(h&&P.agent_slug!==h||O&&!`${P.title||""} ${P.id} ${P.agent_slug}`.toLowerCase().includes(O)))},[R,p,h]),T=x.useMemo(()=>{if(h&&h!==s)return[];const O=p.trim().toLowerCase();return(S.data||[]).filter(P=>O?`${P.title} ${P.id} ${P.channel}`.toLowerCase().includes(O):!0)},[S.data,p,h,s]),z=x.useMemo(()=>{const O=new Map,P=(B,$)=>{const q=O.get(B);q?q.push($):O.set(B,[$])};for(const B of M)P(fw(B.channel),{type:"conv",conv:B,sortTs:B.started_at||""});for(const B of T)P(fw(B.channel),{type:"thread",thread:B,sortTs:B.last_ts||B.started_at||""});return Array.from(O.entries()).map(([B,$])=>({key:B,items:$.sort((q,X)=>new Date(X.sortTs||0).getTime()-new Date(q.sortTs||0).getTime())})).sort((B,$)=>Nx[B.key].order-Nx[$.key].order)},[M,T]),D=x.useMemo(()=>[{slug:s,label:o},...t.map(O=>({slug:O.slug,label:O.slug}))],[t,s,o]),U=x.useMemo(()=>[{value:"",label:f("project.chat.list.all_agents")},{value:s,label:o},...t.map(O=>({value:O.slug,label:O.slug}))],[t,s,o]),L=R.length+(S.data?.length||0),H=Object.keys(k).length>0||t.length===0||!!S.data;return r.jsxs("aside",{className:"flex h-full w-72 shrink-0 flex-col border-r border-border bg-card/30",children:[t.map(O=>r.jsx(AI,{pid:e,slug:O.slug,onLoaded:N},O.slug)),r.jsxs("header",{className:"flex h-[57px] shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"truncate text-sm font-semibold",children:f("project.chat.list.title")}),r.jsx("p",{className:"text-[10px] text-muted-fg",children:f("project.chat.list.count",{n:L})})]}),r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>j(O=>!O),className:"inline-flex items-center gap-1 rounded-md border border-border bg-accent/60 px-2 py-1 text-[11px] font-medium hover:bg-accent",children:[r.jsx(an,{className:"size-3"})," ",f("project.chat.list.new")]}),y&&r.jsxs(r.Fragment,{children:[r.jsx("button",{type:"button","aria-hidden":!0,tabIndex:-1,className:"fixed inset-0 z-10 cursor-default",onClick:()=>j(!1)}),r.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:[r.jsx("p",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-fg",children:f("project.chat.list.pick_agent")}),r.jsx("div",{className:"max-h-64 overflow-y-auto",children:D.map(O=>r.jsxs("button",{type:"button",onClick:()=>{j(!1),u(O.slug)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50",children:[r.jsx(on,{className:"size-3 shrink-0 text-muted-fg"}),r.jsx("span",{className:"truncate",children:O.label})]},`new-${O.slug}`))})]})]})]})]}),r.jsxs("div",{className:"space-y-2 border-b border-border p-2",children:[r.jsx(Ee,{value:p,onChange:O=>m(O.target.value),placeholder:f("project.chat.list.search")}),r.jsx(_t,{value:h,onChange:g,options:U})]}),r.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-2",children:[!H&&r.jsx("div",{className:"px-2 py-1",children:r.jsx(rt,{})}),z.map(O=>r.jsx(OI,{keyName:O.key,count:O.items.length,collapsed:!!b[O.key],onToggle:()=>v(P=>({...P,[O.key]:!P[O.key]})),children:O.items.map(P=>{if(P.type==="thread"){const q=P.thread,X=l.kind==="thread"&&l.channel===q.channel&&l.threadId===q.id;return r.jsx(pw,{title:q.title,subtitle:[q.channel,`${q.messages} msg`].join(" · "),badge:"super",timeAgo:q.last_ts,selected:X,onClick:()=>c({kind:"thread",channel:q.channel,threadId:q.id},{channel:q.channel,createdAt:q.started_at,title:q.title})},`thread-${q.channel}-${q.id}`)}const B=P.conv,$=l.kind==="conv"&&l.agentSlug===B.agent_slug&&l.convId===B.id;return r.jsx(pw,{title:B.title||B.id,subtitle:[B.agent_slug,`${B.messages??0} msg`].filter(Boolean).join(" · "),badge:B.agent_slug,timeAgo:B.started_at,selected:$,onClick:()=>c({kind:"conv",agentSlug:B.agent_slug,convId:B.id},{channel:B.channel,createdAt:B.started_at,title:B.title})},`${B.agent_slug}-${B.id}`)})},O.key)),H&&R.length===0&&T.length===0&&r.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:f("project.chat.list.empty")})]})]})}function OI({keyName:e,count:t,collapsed:s,onToggle:o,children:l}){const c=Nx[e],u=c.icon;return r.jsxs("section",{className:"space-y-1",children:[r.jsxs("button",{type:"button",onClick:o,className:"flex w-full items-center justify-between rounded-md px-2 py-1 text-muted-fg hover:bg-accent/30",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s?r.jsx(Jl,{className:"size-3"}):r.jsx(pa,{className:"size-3"}),r.jsx(u,{className:"size-3"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:c.label})]}),r.jsx("span",{className:"text-[10px]",children:t})]}),!s&&r.jsx("div",{className:"space-y-0.5",children:l})]})}function pw({title:e,subtitle:t,badge:s,timeAgo:o,selected:l,onClick:c}){return r.jsxs("button",{type:"button",onClick:c,className:Ac("w-full rounded-md border px-2.5 py-2 text-left transition-colors",l?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("p",{className:Ac("truncate text-sm",l?"font-semibold":"font-medium"),children:e}),o&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-fg",children:[r.jsx(vM,{className:"size-2.5"}),zI(o)]})]}),r.jsxs("div",{className:"mt-0.5 flex items-center justify-between gap-2 text-[10px] text-muted-fg",children:[r.jsx("span",{className:"truncate",children:t}),s&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-accent/50 px-1.5 py-0.5",children:[r.jsx(Xx,{className:"size-2.5"}),s]})]})]})}function zI(e){if(!e)return"";const t=new Date(e).getTime();if(!Number.isFinite(t))return"";const s=Date.now()-t,o=Math.floor(s/6e4);if(o<1)return"now";if(o<60)return`${o}m`;const l=Math.floor(o/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}const Md="__super_agent__";function DI({pid:e}){const t=ot(),[s,o]=$c(),l=We(`/projects/${e}/agents`,()=>ln.list(e)),[c,u]=x.useState(!1),[p,m]=x.useState(""),[h,g]=x.useState(null),{msgs:b,send:v,stop:k,clear:E,load:y,loadThread:j,streaming:C}=SI(e,ee=>t.error(ee)),S=up(),[N,R]=x.useState(()=>{const ee=s.get("agent"),ne=s.get("conv"),ae=s.get("channel"),pe=s.get("thread");return ae&&pe?{kind:"thread",channel:ae,threadId:pe}:ee&&ne?{kind:"conv",agentSlug:ee,convId:ne}:ee?{kind:"live",agentSlug:ee}:{kind:"live",agentSlug:Md}}),[M,T]=x.useState(void 0),[z,D]=x.useState(!1),[U,L]=x.useState(!1),H=(ee,ne)=>{R(ee),T(ne);const ae=new URLSearchParams;ee.kind==="conv"?(ae.set("agent",ee.agentSlug),ae.set("conv",ee.convId)):ee.kind==="thread"?(ae.set("channel",ee.channel),ae.set("thread",ee.threadId)):ae.set("agent",ee.agentSlug),o(ae,{replace:!0})},O=l.data||[],P=ee=>ee===Md,B=x.useMemo(()=>N.kind==="thread"?void 0:O.find(ee=>ee.slug===N.agentSlug),[O,N]),$=N.kind==="thread"||P(N.agentSlug);x.useEffect(()=>{N.kind==="conv"?y(N.agentSlug,N.convId):N.kind==="thread"?j(N.channel,N.threadId):E()},[N.kind,N.kind==="conv"?N.convId:N.kind==="thread"?`${N.channel}:${N.threadId}`:N.agentSlug]);const q=async ee=>{if($){await v(ee,{model:p||void 0});return}B&&await v(ee,{model:p||void 0,agentSlug:B.slug})},X=async ee=>{try{await navigator.clipboard.writeText(ee),t.info(f("project.chat.copied"))}catch{}},Y=ee=>{H({kind:"live",agentSlug:ee}),E()},F=()=>{const ee=$?Md:B?.slug??N.agentSlug;H({kind:"live",agentSlug:ee}),E()},K=async()=>{L(!0);try{N.kind==="conv"?(await wo.remove(e,N.agentSlug,N.convId),hf(`/projects/${e}/agents/${N.agentSlug}/conversations`)):N.kind==="thread"&&(await wo.removeThread(e,N.channel,N.threadId),hf(`/projects/${e}/super-agent/threads`)),t.success(f("project.chat.deleted")),D(!1),F()}catch(ee){t.error(ee?.message||f("shared_ui.err_chat_failed"))}finally{L(!1)}},I=$?S:B?.slug??N.agentSlug,G=N.kind==="thread"?N.channel:M?.channel||"web",Z=N.kind==="thread"?N.threadId:M?.createdAt,te=N.kind==="live"?f("project.chat.live_title",{agent:I}):M?.title||(N.kind==="thread"?N.threadId:N.convId),de=Z?f("project.chat.meta_created",{date:LI(Z),channel:G}):f("project.chat.meta_new",{channel:G});return l.isLoading?r.jsx(rt,{}):r.jsxs("div",{className:"flex h-full overflow-hidden rounded-xl border border-border bg-card/40",children:[r.jsx(MI,{pid:e,agents:O,superAgentSlug:Md,superAgentLabel:f("agents_ui.super_agent_label",{persona:S}),selected:N,onSelect:H,onNewChat:Y}),r.jsxs("section",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-sm font-semibold",children:te}),r.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:de})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[$?r.jsx($e,{tone:"success",children:f("agents_ui.super_agent_badge")}):r.jsx($e,{tone:"info",children:I}),!O.length&&!$&&r.jsxs(ce,{variant:"primary",size:"sm",onClick:()=>u(!0),children:[r.jsx(an,{size:14})," ",f("project.chat.create_agent")]}),r.jsxs(ce,{variant:"ghost",size:"sm",disabled:C||b.length===0,onClick:F,children:[r.jsx(Df,{size:13})," ",f("project.chat.new_session")]}),(N.kind==="conv"||N.kind==="thread")&&r.jsxs(ce,{variant:"destructive",size:"sm",disabled:C,onClick:()=>D(!0),children:[r.jsx(Gn,{size:13})," ",f("project.chat.delete")]})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length?r.jsx(b_,{msgs:b,onCopy:X}):r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.chat.empty")})})}),r.jsx(EN,{msgs:b}),(()=>{const ee=C?null:TN(b);return!ee||ee.turnKey===h?null:r.jsx(RN,{turnKey:ee.turnKey,questions:ee.questions,onSubmit:ne=>void q(ne),onDismiss:()=>g(ee.turnKey),disabled:C})})(),r.jsx(pI,{onSend:q,onStop:k,streaming:C,model:p,onModelChange:m})]}),r.jsx(PI,{open:c,pid:e,onClose:()=>u(!1),onCreated:()=>{u(!1),l.mutate()}}),r.jsx(Sn,{open:z,onClose:()=>D(!1),title:f("project.chat.delete_confirm_title"),description:f("project.chat.delete_confirm_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:()=>D(!1),disabled:U,children:f("common.cancel")}),r.jsxs(ce,{variant:"destructive",onClick:K,loading:U,children:[r.jsx(Gn,{size:14})," ",f("project.chat.delete")]})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:te})})]})}function LI(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString()}function PI({open:e,onClose:t,onCreated:s,pid:o}){const l=ot(),[c,u]=x.useState(""),[p,m]=x.useState("master"),[h,g]=x.useState(""),[b,v]=x.useState(!0),[k,E]=x.useState(!1),y=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){l.error(f("project.agents.slug_invalid"));return}E(!0);try{await ln.create(o,{slug:c,role:p,model:h||void 0,is_master:b}),l.success(f("project.agents.created",{slug:c})),u(""),m("master"),g(""),v(!0),s()}catch(j){l.error(j.message)}finally{E(!1)}};return r.jsx(Sn,{open:e,onClose:t,title:f("project.chat.create_agent_title"),description:f("project.chat.create_agent_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:k,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:y,loading:k,children:f("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ie,{label:"slug",children:r.jsx(Ee,{autoFocus:!0,value:c,onChange:j=>u(j.target.value),placeholder:"master"})}),r.jsx(ie,{label:f("project.chat.role_label"),children:r.jsx(Ee,{value:p,onChange:j=>m(j.target.value),placeholder:"master"})}),r.jsx(ie,{label:f("project.chat.model_label"),hint:f("project.chat.model_hint"),children:r.jsx(Ee,{value:h,onChange:j=>g(j.target.value)})}),r.jsx(Qt,{checked:b,onChange:v,label:f("project.chat.master_label")})]})})}function II({pid:e}){const t=ot(),{project:s}=Wb(e),{channels:o,isLoading:l,mutate:c}=a_(),u=String(e),p=s?.name||s?.path?.split("/").pop()||u,m=`proj-${u}`,h=o.find(z=>z.project===u||z.project===p||z.name===m),[g,b]=x.useState(!!h),[v,k]=x.useState(""),[E,y]=x.useState(""),[j,C]=x.useState(""),[S,N]=x.useState(!0),[R,M]=x.useState(!1);if(x.useEffect(()=>{h?(b(!0),k(""),y(h.chat_id||""),C(h.route_to_agent||""),N(h.respond_with_engine??!0)):(b(!1),k(""),y(""),C(""),N(!0))},[h?.name,h?.chat_id,h?.route_to_agent]),l)return r.jsx(rt,{});const T=async()=>{M(!0);try{if(!g){h&&(await Mn.channels.remove(h.name),t.success(f("project.telegram.cleared"))),await c();return}const z={name:h?.name||m,project:u,chat_id:E,route_to_agent:j,respond_with_engine:S,...v?{bot_token:v}:{}};h?await Mn.channels.patch(h.name,z):await Mn.channels.upsert(z),t.success(f("project.telegram.saved")),await c(),k("")}catch(z){t.error(z.message)}finally{M(!1)}};return r.jsx(Ye,{title:f("project.telegram.title"),description:f("project.telegram.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qt,{checked:g,onChange:b,label:f(g?"project.telegram.override_active":"project.telegram.use_default")}),h&&r.jsx($e,{tone:"success",children:f("project.telegram.channel_badge",{name:h.name})})]}),g&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("project.telegram.bot_token"),hint:h?.bot_token?`${Mr(h.bot_token)} ${f("telegram_ui.empty_keep")}`:f("project.telegram.bot_hint_none"),children:r.jsx(Ee,{type:"password",value:v,onChange:z=>k(z.target.value),placeholder:h?.bot_token?Mr(h.bot_token):""})}),r.jsx(ie,{label:f("project.telegram.chat_id"),children:r.jsx(Ee,{value:E,onChange:z=>y(z.target.value)})}),r.jsx(ie,{label:f("project.telegram.route_agent"),hint:f("project.telegram.route_hint"),children:r.jsx(Ee,{value:j,onChange:z=>C(z.target.value)})})]}),r.jsx(Qt,{checked:S,onChange:N,label:f("project.telegram.respond_engine")})]}),r.jsx("div",{className:"pt-2",children:r.jsx(ce,{variant:"primary",loading:R,onClick:T,children:f("common.save")})}),!g&&!h&&r.jsx(bt,{children:f("project.telegram.no_override")})]})})}function AN({load:e,save:t,rows:s=10,placeholder:o}){const l=ot(),[c,u]=x.useState(null),[p,m]=x.useState(""),[h,g]=x.useState(!1);if(x.useEffect(()=>{let k=!0;return e().then(E=>{k&&(u(E),m(E))}).catch(()=>{k&&(u(""),m(""))}),()=>{k=!1}},[e]),c===null)return r.jsx(rt,{});const b=p!==c,v=async()=>{g(!0);try{await t(p),u(p),l.success(f("project.memories.saved"))}catch(k){l.error(k.message)}finally{g(!1)}};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(On,{rows:s,className:"font-mono text-xs",value:p,onChange:k=>m(k.target.value),placeholder:o}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[p.length," ",f("project.memories.chars")]}),r.jsxs(ce,{size:"sm",variant:"primary",loading:h,disabled:!b,onClick:v,children:[r.jsx(Lf,{size:12})," ",f("project.memories.save_btn")]})]})]})}function BI({pid:e,agent:t}){const[s,o]=x.useState(!1),l=t.is_master?Fa:on;return r.jsxs("li",{className:"rounded-xl border border-border bg-muted/30",children:[r.jsxs("button",{type:"button",onClick:()=>o(c=>!c),className:"flex w-full items-center gap-3 px-3 py-2 text-left",children:[s?r.jsx(pa,{size:14,className:"text-muted-fg"}):r.jsx(Jl,{size:14,className:"text-muted-fg"}),r.jsx(l,{size:14,className:t.is_master?"text-violet-400":"text-muted-fg"}),r.jsx("span",{className:"text-sm font-medium",children:t.slug}),t.role&&r.jsxs("span",{className:"text-xs text-muted-fg",children:["· ",t.role]})]}),s&&r.jsx("div",{className:"border-t border-border p-3",children:r.jsx(AN,{rows:8,load:()=>ln.memory.get(e,t.slug).then(c=>c.body),save:c=>ln.memory.put(e,t.slug,c).then(()=>{})})})]})}function UI({pid:e}){const t=We(`/projects/${e}/agents`,()=>ln.list(e));return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ye,{title:f("project.memories.project_title"),description:f("project.memories.project_desc"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-1 flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-sky-600 to-indigo-600",children:r.jsx(Xd,{className:"size-4 text-white"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx(AN,{rows:12,load:()=>ls.memory.get(e).then(s=>s.body),save:s=>ls.memory.put(e,s).then(()=>{}),placeholder:f("project.memories.project_ph")})})]})}),r.jsxs(Ye,{title:f("project.memories.agents_title"),description:f("project.memories.agents_desc"),children:[t.isLoading&&r.jsx(rt,{}),!t.isLoading&&(t.data?.length??0)===0&&r.jsx(bt,{children:f("project.memories.no_agents")}),r.jsx("ul",{className:"space-y-2",children:(t.data||[]).map(s=>r.jsx(BI,{pid:e,agent:s},s.slug))})]})]})}function HI({pid:e,entry:t,onDeleted:s,onRenamed:o,onRunInTerminal:l,onEditArtifact:c}){const[u,p]=x.useState(!1),[m,h]=x.useState(null),g=ot(),[b,v]=x.useState(!1),[k,E]=x.useState(t.name),y=x.useRef(null),[j,C]=x.useState(!1),[S,N]=x.useState(!1),[R,M]=x.useState(!1),T=j?["artifact",e,t.name]:null,z=We(T,()=>Tr.read(e,t.name),{revalidateOnFocus:!1}),D=!z.data?.content||z.data.content.startsWith("#!"),U=async B=>{try{await navigator.clipboard.writeText(B),g.info(f("modules_ui.code_copied"))}catch{}},L=async()=>{p(!0),h(null);try{const B=await Tr.run(e,t.name);h(B),B.ok?g.info(f("modules_ui.code_artifact_exit_ok",{ms:B.durationMs??0})):g.error(f("modules_ui.code_artifact_exit_fail",{code:B.exitCode??B.signal??"?",timeout:B.timedOut?f("modules_ui.code_artifact_timeout_suffix"):""}))}catch(B){g.error(B.message)}finally{p(!1)}},H=async()=>{M(!0);try{await Tr.remove(e,t.name),N(!1),s()}catch(B){g.error(B.message)}finally{M(!1)}},O=()=>{E(t.name),v(!0),requestAnimationFrame(()=>y.current?.select())},P=async()=>{const B=k.trim();if(v(!1),!(!B||B===t.name))try{await Tr.rename(e,t.name,B),o()}catch($){g.error($.message)}};return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1.5 text-xs",children:[r.jsx(Qd,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),b?r.jsx("input",{ref:y,value:k,onChange:B=>E(B.target.value),onBlur:()=>void P(),onKeyDown:B=>{B.key==="Enter"&&P(),B.key==="Escape"&&v(!1)},autoFocus:!0,className:"min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 font-mono text-xs outline-none focus:ring-1 focus:ring-ring"}):r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:t.name}),r.jsx(Ge,{content:f("code_module.artifacts_rename"),children:r.jsx("button",{type:"button",onClick:O,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(To,{className:"size-3"})})}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[t.size,"b"]})]}),r.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5",children:[r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted-foreground",children:t.path}),r.jsx(Ge,{content:f("code_module.artifacts_copy_path"),children:r.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:r.jsx(Rc,{className:"size-3"})})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[r.jsxs(bx,{open:j,onOpenChange:C,children:[r.jsx(Ge,{content:f("code_module.artifacts_view"),children:r.jsxs("button",{type:"button",onClick:()=>C(!0),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-blue-500/15 text-blue-700 hover:bg-blue-500/25 dark:text-blue-300",children:[r.jsx(Af,{className:"size-3"}),f("modules_ui.code_artifact_view_short")]})}),r.jsxs(_x,{className:"sm:max-w-lg",children:[r.jsx(vx,{children:r.jsx(yx,{className:"font-mono text-sm",children:t.name})}),z.isLoading?r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(us,{size:16})}):r.jsx("pre",{className:"max-h-96 overflow-auto rounded bg-muted/50 p-3 font-mono text-[11px] leading-tight whitespace-pre-wrap break-all",children:z.data?.content??""}),r.jsx(Yj,{showCloseButton:!0})]})]}),c&&r.jsx(Ge,{content:f("code_module.artifacts_edit"),children:r.jsxs("button",{type:"button",onClick:()=>c(t.name),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-violet-500/15 text-violet-700 hover:bg-violet-500/25 dark:text-violet-300",children:[r.jsx(e3,{className:"size-3"}),f("modules_ui.code_artifact_edit_short")]})}),D&&r.jsx(Ge,{content:f("code_module.artifacts_run"),children:r.jsxs("button",{type:"button",disabled:u,onClick:()=>l?l(`apx artifact run ${t.name}`):void L(),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:[u?r.jsx(us,{size:10}):r.jsx(Kx,{className:"size-3"}),f("code_module.artifacts_run")]})}),r.jsxs(bx,{open:S,onOpenChange:N,children:[r.jsx(Ge,{content:f("code_module.artifacts_delete"),children:r.jsx("button",{type:"button",onClick:()=>N(!0),className:"ml-auto rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:r.jsx(Gn,{className:"size-3"})})}),r.jsxs(_x,{className:"sm:max-w-sm",children:[r.jsx(vx,{children:r.jsxs(yx,{className:"font-mono text-sm",children:[f("code_module.artifacts_delete")," — ",t.name]})}),r.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:f("code_module.artifacts_delete_confirm")}),r.jsxs(Yj,{children:[r.jsx(IL,{render:r.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:f("common.cancel")}),r.jsxs("button",{type:"button",onClick:()=>void H(),disabled:R,className:Te("inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-xs font-medium",R?"bg-muted text-muted-foreground":"bg-rose-500/15 text-rose-700 hover:bg-rose-500/25 dark:text-rose-300"),children:[R&&r.jsx(us,{size:10}),f("code_module.delete")]})]})]})]})]}),r.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[f("code_module.artifacts_run_hint")," ",r.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",t.name]})]}),m&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[r.jsx("span",{className:Te("rounded px-1.5 py-0.5 font-mono",m.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-rose-500/15 text-rose-700 dark:text-rose-300"),children:f("modules_ui.code_artifact_exit_badge",{code:m.exitCode??m.signal??"?"})}),m.timedOut&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:f("modules_ui.code_artifact_timeout")}),m.truncated&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:f("modules_ui.code_artifact_truncated")}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[m.durationMs,"ms"]})]}),m.stdout&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:m.stdout}),m.stderr&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-rose-500/5 p-2 text-[10px] leading-tight text-rose-700 dark:text-rose-300",children:m.stderr})]})]})]})}function MN({pid:e,onRunInTerminal:t,onEditArtifact:s}){const o=We(e?["artifacts",e]:null,()=>Tr.list(e)),l=o.data||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:l.length>0?f("code_module.artifacts_count",{n:l.length}):""}),r.jsx(Ge,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void o.mutate(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o.isLoading?r.jsx(us,{size:12}):r.jsx(ua,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:l.length===0?r.jsx(bt,{children:f("code_module.artifacts_none")}):r.jsx("ul",{className:"space-y-1.5",children:l.map(c=>r.jsx(HI,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:t,onEditArtifact:s},c.name))})})]})}function VI({pid:e}){const t=Yn(),s=o=>{const l=new URLSearchParams({pid:e,...o}).toString();t(`/m/code?${l}`)};return r.jsx(Ye,{title:f("project.artifacts.title"),description:f("project.artifacts.subtitle"),fullHeight:!0,className:"min-h-[24rem]",children:r.jsx(MN,{pid:e,onRunInTerminal:o=>s({cmd:o}),onEditArtifact:o=>s({edit:o})})})}function qI(e,t){var s,o=1;e==null&&(e=0),t==null&&(t=0);function l(){var c,u=s.length,p,m=0,h=0;for(c=0;c<u;++c)p=s[c],m+=p.x,h+=p.y;for(m=(m/u-e)*o,h=(h/u-t)*o,c=0;c<u;++c)p=s[c],p.x-=m,p.y-=h}return l.initialize=function(c){s=c},l.x=function(c){return arguments.length?(e=+c,l):e},l.y=function(c){return arguments.length?(t=+c,l):t},l.strength=function(c){return arguments.length?(o=+c,l):o},l}function $I(e){const t=+this._x.call(null,e),s=+this._y.call(null,e);return ON(this.cover(t,s),t,s,e)}function ON(e,t,s,o){if(isNaN(t)||isNaN(s))return e;var l,c=e._root,u={data:o},p=e._x0,m=e._y0,h=e._x1,g=e._y1,b,v,k,E,y,j,C,S;if(!c)return e._root=u,e;for(;c.length;)if((y=t>=(b=(p+h)/2))?p=b:h=b,(j=s>=(v=(m+g)/2))?m=v:g=v,l=c,!(c=c[C=j<<1|y]))return l[C]=u,e;if(k=+e._x.call(null,c.data),E=+e._y.call(null,c.data),t===k&&s===E)return u.next=c,l?l[C]=u:e._root=u,e;do l=l?l[C]=new Array(4):e._root=new Array(4),(y=t>=(b=(p+h)/2))?p=b:h=b,(j=s>=(v=(m+g)/2))?m=v:g=v;while((C=j<<1|y)===(S=(E>=v)<<1|k>=b));return l[S]=c,l[C]=u,e}function FI(e){var t,s,o=e.length,l,c,u=new Array(o),p=new Array(o),m=1/0,h=1/0,g=-1/0,b=-1/0;for(s=0;s<o;++s)isNaN(l=+this._x.call(null,t=e[s]))||isNaN(c=+this._y.call(null,t))||(u[s]=l,p[s]=c,l<m&&(m=l),l>g&&(g=l),c<h&&(h=c),c>b&&(b=c));if(m>g||h>b)return this;for(this.cover(m,h).cover(g,b),s=0;s<o;++s)ON(this,u[s],p[s],e[s]);return this}function GI(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var s=this._x0,o=this._y0,l=this._x1,c=this._y1;if(isNaN(s))l=(s=Math.floor(e))+1,c=(o=Math.floor(t))+1;else{for(var u=l-s||1,p=this._root,m,h;s>e||e>=l||o>t||t>=c;)switch(h=(t<o)<<1|e<s,m=new Array(4),m[h]=p,p=m,u*=2,h){case 0:l=s+u,c=o+u;break;case 1:s=l-u,c=o+u;break;case 2:l=s+u,o=c-u;break;case 3:s=l-u,o=c-u;break}this._root&&this._root.length&&(this._root=p)}return this._x0=s,this._y0=o,this._x1=l,this._y1=c,this}function YI(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function KI(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 Xn(e,t,s,o,l){this.node=e,this.x0=t,this.y0=s,this.x1=o,this.y1=l}function XI(e,t,s){var o,l=this._x0,c=this._y0,u,p,m,h,g=this._x1,b=this._y1,v=[],k=this._root,E,y;for(k&&v.push(new Xn(k,l,c,g,b)),s==null?s=1/0:(l=e-s,c=t-s,g=e+s,b=t+s,s*=s);E=v.pop();)if(!(!(k=E.node)||(u=E.x0)>g||(p=E.y0)>b||(m=E.x1)<l||(h=E.y1)<c))if(k.length){var j=(u+m)/2,C=(p+h)/2;v.push(new Xn(k[3],j,C,m,h),new Xn(k[2],u,C,j,h),new Xn(k[1],j,p,m,C),new Xn(k[0],u,p,j,C)),(y=(t>=C)<<1|e>=j)&&(E=v[v.length-1],v[v.length-1]=v[v.length-1-y],v[v.length-1-y]=E)}else{var S=e-+this._x.call(null,k.data),N=t-+this._y.call(null,k.data),R=S*S+N*N;if(R<s){var M=Math.sqrt(s=R);l=e-M,c=t-M,g=e+M,b=t+M,o=k.data}}return o}function QI(e){if(isNaN(g=+this._x.call(null,e))||isNaN(b=+this._y.call(null,e)))return this;var t,s=this._root,o,l,c,u=this._x0,p=this._y0,m=this._x1,h=this._y1,g,b,v,k,E,y,j,C;if(!s)return this;if(s.length)for(;;){if((E=g>=(v=(u+m)/2))?u=v:m=v,(y=b>=(k=(p+h)/2))?p=k:h=k,t=s,!(s=s[j=y<<1|E]))return this;if(!s.length)break;(t[j+1&3]||t[j+2&3]||t[j+3&3])&&(o=t,C=j)}for(;s.data!==e;)if(l=s,!(s=s.next))return this;return(c=s.next)&&delete s.next,l?(c?l.next=c:delete l.next,this):t?(c?t[j]=c:delete t[j],(s=t[0]||t[1]||t[2]||t[3])&&s===(t[3]||t[2]||t[1]||t[0])&&!s.length&&(o?o[C]=s:this._root=s),this):(this._root=c,this)}function WI(e){for(var t=0,s=e.length;t<s;++t)this.remove(e[t]);return this}function ZI(){return this._root}function JI(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function e8(e){var t=[],s,o=this._root,l,c,u,p,m;for(o&&t.push(new Xn(o,this._x0,this._y0,this._x1,this._y1));s=t.pop();)if(!e(o=s.node,c=s.x0,u=s.y0,p=s.x1,m=s.y1)&&o.length){var h=(c+p)/2,g=(u+m)/2;(l=o[3])&&t.push(new Xn(l,h,g,p,m)),(l=o[2])&&t.push(new Xn(l,c,g,h,m)),(l=o[1])&&t.push(new Xn(l,h,u,p,g)),(l=o[0])&&t.push(new Xn(l,c,u,h,g))}return this}function t8(e){var t=[],s=[],o;for(this._root&&t.push(new Xn(this._root,this._x0,this._y0,this._x1,this._y1));o=t.pop();){var l=o.node;if(l.length){var c,u=o.x0,p=o.y0,m=o.x1,h=o.y1,g=(u+m)/2,b=(p+h)/2;(c=l[0])&&t.push(new Xn(c,u,p,g,b)),(c=l[1])&&t.push(new Xn(c,g,p,m,b)),(c=l[2])&&t.push(new Xn(c,u,b,g,h)),(c=l[3])&&t.push(new Xn(c,g,b,m,h))}s.push(o)}for(;o=s.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function n8(e){return e[0]}function s8(e){return arguments.length?(this._x=e,this):this._x}function a8(e){return e[1]}function r8(e){return arguments.length?(this._y=e,this):this._y}function __(e,t,s){var o=new v_(t??n8,s??a8,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function v_(e,t,s,o,l,c){this._x=e,this._y=t,this._x0=s,this._y0=o,this._x1=l,this._y1=c,this._root=void 0}function mw(e){for(var t={data:e.data},s=t;e=e.next;)s=s.next={data:e.data};return t}var Jn=__.prototype=v_.prototype;Jn.copy=function(){var e=new v_(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,s,o;if(!t)return e;if(!t.length)return e._root=mw(t),e;for(s=[{source:t,target:e._root=new Array(4)}];t=s.pop();)for(var l=0;l<4;++l)(o=t.source[l])&&(o.length?s.push({source:o,target:t.target[l]=new Array(4)}):t.target[l]=mw(o));return e};Jn.add=$I;Jn.addAll=FI;Jn.cover=GI;Jn.data=YI;Jn.extent=KI;Jn.find=XI;Jn.remove=QI;Jn.removeAll=WI;Jn.root=ZI;Jn.size=JI;Jn.visit=e8;Jn.visitAfter=t8;Jn.x=s8;Jn.y=r8;function go(e){return function(){return e}}function Ar(e){return(e()-.5)*1e-6}function o8(e){return e.x+e.vx}function l8(e){return e.y+e.vy}function i8(e){var t,s,o,l=1,c=1;typeof e!="function"&&(e=go(e==null?1:+e));function u(){for(var h,g=t.length,b,v,k,E,y,j,C=0;C<c;++C)for(b=__(t,o8,l8).visitAfter(p),h=0;h<g;++h)v=t[h],y=s[v.index],j=y*y,k=v.x+v.vx,E=v.y+v.vy,b.visit(S);function S(N,R,M,T,z){var D=N.data,U=N.r,L=y+U;if(D){if(D.index>v.index){var H=k-D.x-D.vx,O=E-D.y-D.vy,P=H*H+O*O;P<L*L&&(H===0&&(H=Ar(o),P+=H*H),O===0&&(O=Ar(o),P+=O*O),P=(L-(P=Math.sqrt(P)))/P*l,v.vx+=(H*=P)*(L=(U*=U)/(j+U)),v.vy+=(O*=P)*L,D.vx-=H*(L=1-L),D.vy-=O*L)}return}return R>k+L||T<k-L||M>E+L||z<E-L}}function p(h){if(h.data)return h.r=s[h.data.index];for(var g=h.r=0;g<4;++g)h[g]&&h[g].r>h.r&&(h.r=h[g].r)}function m(){if(t){var h,g=t.length,b;for(s=new Array(g),h=0;h<g;++h)b=t[h],s[b.index]=+e(b,h,t)}}return u.initialize=function(h,g){t=h,o=g,m()},u.iterations=function(h){return arguments.length?(c=+h,u):c},u.strength=function(h){return arguments.length?(l=+h,u):l},u.radius=function(h){return arguments.length?(e=typeof h=="function"?h:go(+h),m(),u):e},u}function c8(e){return e.index}function hw(e,t){var s=e.get(t);if(!s)throw new Error("node not found: "+t);return s}function u8(e){var t=c8,s=b,o,l=go(30),c,u,p,m,h,g=1;e==null&&(e=[]);function b(j){return 1/Math.min(p[j.source.index],p[j.target.index])}function v(j){for(var C=0,S=e.length;C<g;++C)for(var N=0,R,M,T,z,D,U,L;N<S;++N)R=e[N],M=R.source,T=R.target,z=T.x+T.vx-M.x-M.vx||Ar(h),D=T.y+T.vy-M.y-M.vy||Ar(h),U=Math.sqrt(z*z+D*D),U=(U-c[N])/U*j*o[N],z*=U,D*=U,T.vx-=z*(L=m[N]),T.vy-=D*L,M.vx+=z*(L=1-L),M.vy+=D*L}function k(){if(u){var j,C=u.length,S=e.length,N=new Map(u.map((M,T)=>[t(M,T,u),M])),R;for(j=0,p=new Array(C);j<S;++j)R=e[j],R.index=j,typeof R.source!="object"&&(R.source=hw(N,R.source)),typeof R.target!="object"&&(R.target=hw(N,R.target)),p[R.source.index]=(p[R.source.index]||0)+1,p[R.target.index]=(p[R.target.index]||0)+1;for(j=0,m=new Array(S);j<S;++j)R=e[j],m[j]=p[R.source.index]/(p[R.source.index]+p[R.target.index]);o=new Array(S),E(),c=new Array(S),y()}}function E(){if(u)for(var j=0,C=e.length;j<C;++j)o[j]=+s(e[j],j,e)}function y(){if(u)for(var j=0,C=e.length;j<C;++j)c[j]=+l(e[j],j,e)}return v.initialize=function(j,C){u=j,h=C,k()},v.links=function(j){return arguments.length?(e=j,k(),v):e},v.id=function(j){return arguments.length?(t=j,v):t},v.iterations=function(j){return arguments.length?(g=+j,v):g},v.strength=function(j){return arguments.length?(s=typeof j=="function"?j:go(+j),E(),v):s},v.distance=function(j){return arguments.length?(l=typeof j=="function"?j:go(+j),y(),v):l},v}var d8={value:()=>{}};function zN(){for(var e=0,t=arguments.length,s={},o;e<t;++e){if(!(o=arguments[e]+"")||o in s||/[\s.]/.test(o))throw new Error("illegal type: "+o);s[o]=[]}return new Fd(s)}function Fd(e){this._=e}function f8(e,t){return e.trim().split(/^|\s+/).map(function(s){var o="",l=s.indexOf(".");if(l>=0&&(o=s.slice(l+1),s=s.slice(0,l)),s&&!t.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:o}})}Fd.prototype=zN.prototype={constructor:Fd,on:function(e,t){var s=this._,o=f8(e+"",s),l,c=-1,u=o.length;if(arguments.length<2){for(;++c<u;)if((l=(e=o[c]).type)&&(l=p8(s[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++c<u;)if(l=(e=o[c]).type)s[l]=gw(s[l],e.name,t);else if(t==null)for(l in s)s[l]=gw(s[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var s in t)e[s]=t[s].slice();return new Fd(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var s=new Array(l),o=0,l,c;o<l;++o)s[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(c=this._[e],o=0,l=c.length;o<l;++o)c[o].value.apply(t,s)},apply:function(e,t,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],l=0,c=o.length;l<c;++l)o[l].value.apply(t,s)}};function p8(e,t){for(var s=0,o=e.length,l;s<o;++s)if((l=e[s]).name===t)return l.value}function gw(e,t,s){for(var o=0,l=e.length;o<l;++o)if(e[o].name===t){e[o]=d8,e=e.slice(0,o).concat(e.slice(o+1));break}return s!=null&&e.push({name:t,value:s}),e}var Kl=0,xc=0,rc=0,DN=1e3,kf,bc,Sf=0,Co=0,xp=0,Ic=typeof performance=="object"&&performance.now?performance:Date,LN=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function PN(){return Co||(LN(m8),Co=Ic.now()+xp)}function m8(){Co=0}function Ex(){this._call=this._time=this._next=null}Ex.prototype=IN.prototype={constructor:Ex,restart:function(e,t,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?PN():+s)+(t==null?0:+t),!this._next&&bc!==this&&(bc?bc._next=this:kf=this,bc=this),this._call=e,this._time=s,Rx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Rx())}};function IN(e,t,s){var o=new Ex;return o.restart(e,t,s),o}function h8(){PN(),++Kl;for(var e=kf,t;e;)(t=Co-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Kl}function xw(){Co=(Sf=Ic.now())+xp,Kl=xc=0;try{h8()}finally{Kl=0,x8(),Co=0}}function g8(){var e=Ic.now(),t=e-Sf;t>DN&&(xp-=t,Sf=e)}function x8(){for(var e,t=kf,s,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(s=t._next,t._next=null,t=e?e._next=s:kf=s);bc=e,Rx(o)}function Rx(e){if(!Kl){xc&&(xc=clearTimeout(xc));var t=e-Co;t>24?(e<1/0&&(xc=setTimeout(xw,e-Ic.now()-xp)),rc&&(rc=clearInterval(rc))):(rc||(Sf=Ic.now(),rc=setInterval(g8,DN)),Kl=1,LN(xw))}}const b8=1664525,_8=1013904223,bw=4294967296;function v8(){let e=1;return()=>(e=(b8*e+_8)%bw)/bw}function y8(e){return e.x}function j8(e){return e.y}var w8=10,k8=Math.PI*(3-Math.sqrt(5));function S8(e){var t,s=1,o=.001,l=1-Math.pow(o,1/300),c=0,u=.6,p=new Map,m=IN(b),h=zN("tick","end"),g=v8();e==null&&(e=[]);function b(){v(),h.call("tick",t),s<o&&(m.stop(),h.call("end",t))}function v(y){var j,C=e.length,S;y===void 0&&(y=1);for(var N=0;N<y;++N)for(s+=(c-s)*l,p.forEach(function(R){R(s)}),j=0;j<C;++j)S=e[j],S.fx==null?S.x+=S.vx*=u:(S.x=S.fx,S.vx=0),S.fy==null?S.y+=S.vy*=u:(S.y=S.fy,S.vy=0);return t}function k(){for(var y=0,j=e.length,C;y<j;++y){if(C=e[y],C.index=y,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),isNaN(C.x)||isNaN(C.y)){var S=w8*Math.sqrt(.5+y),N=y*k8;C.x=S*Math.cos(N),C.y=S*Math.sin(N)}(isNaN(C.vx)||isNaN(C.vy))&&(C.vx=C.vy=0)}}function E(y){return y.initialize&&y.initialize(e,g),y}return k(),t={tick:v,restart:function(){return m.restart(b),t},stop:function(){return m.stop(),t},nodes:function(y){return arguments.length?(e=y,k(),p.forEach(E),t):e},alpha:function(y){return arguments.length?(s=+y,t):s},alphaMin:function(y){return arguments.length?(o=+y,t):o},alphaDecay:function(y){return arguments.length?(l=+y,t):+l},alphaTarget:function(y){return arguments.length?(c=+y,t):c},velocityDecay:function(y){return arguments.length?(u=1-y,t):1-u},randomSource:function(y){return arguments.length?(g=y,p.forEach(E),t):g},force:function(y,j){return arguments.length>1?(j==null?p.delete(y):p.set(y,E(j)),t):p.get(y)},find:function(y,j,C){var S=0,N=e.length,R,M,T,z,D;for(C==null?C=1/0:C*=C,S=0;S<N;++S)z=e[S],R=y-z.x,M=j-z.y,T=R*R+M*M,T<C&&(D=z,C=T);return D},on:function(y,j){return arguments.length>1?(h.on(y,j),t):h.on(y)}}}function C8(){var e,t,s,o,l=go(-30),c,u=1,p=1/0,m=.81;function h(k){var E,y=e.length,j=__(e,y8,j8).visitAfter(b);for(o=k,E=0;E<y;++E)t=e[E],j.visit(v)}function g(){if(e){var k,E=e.length,y;for(c=new Array(E),k=0;k<E;++k)y=e[k],c[y.index]=+l(y,k,e)}}function b(k){var E=0,y,j,C=0,S,N,R;if(k.length){for(S=N=R=0;R<4;++R)(y=k[R])&&(j=Math.abs(y.value))&&(E+=y.value,C+=j,S+=j*y.x,N+=j*y.y);k.x=S/C,k.y=N/C}else{y=k,y.x=y.data.x,y.y=y.data.y;do E+=c[y.data.index];while(y=y.next)}k.value=E}function v(k,E,y,j){if(!k.value)return!0;var C=k.x-t.x,S=k.y-t.y,N=j-E,R=C*C+S*S;if(N*N/m<R)return R<p&&(C===0&&(C=Ar(s),R+=C*C),S===0&&(S=Ar(s),R+=S*S),R<u&&(R=Math.sqrt(u*R)),t.vx+=C*k.value*o/R,t.vy+=S*k.value*o/R),!0;if(k.length||R>=p)return;(k.data!==t||k.next)&&(C===0&&(C=Ar(s),R+=C*C),S===0&&(S=Ar(s),R+=S*S),R<u&&(R=Math.sqrt(u*R)));do k.data!==t&&(N=c[k.data.index]*o/R,t.vx+=C*N,t.vy+=S*N);while(k=k.next)}return h.initialize=function(k,E){e=k,s=E,g()},h.strength=function(k){return arguments.length?(l=typeof k=="function"?k:go(+k),g(),h):l},h.distanceMin=function(k){return arguments.length?(u=k*k,h):Math.sqrt(u)},h.distanceMax=function(k){return arguments.length?(p=k*k,h):Math.sqrt(p)},h.theta=function(k){return arguments.length?(m=k*k,h):Math.sqrt(m)},h}const oc={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"};function N8(){return{agent:f("agents_ui.kind_agent"),memory:f("agents_ui.kind_memory"),thread:f("agents_ui.kind_thread"),task:f("agents_ui.kind_task"),routine:f("agents_ui.kind_routine"),agentlink:f("agents_ui.kind_hierarchy")}}const lc=760,ic=460;function E8({center:e,nodes:t}){const s=x.useRef(null),o=x.useRef(null),l=x.useRef([]),c=x.useRef([]),u=x.useRef(null),[,p]=x.useState(0),[m,h]=x.useState(null);x.useEffect(()=>{const j={id:"__center",label:e,kind:"agent",relation:"self",x:lc/2,y:ic/2,fx:lc/2,fy:ic/2},C=[j,...t.map(R=>({...R}))],S=C.slice(1).map(R=>({source:j,target:R}));l.current=C,c.current=S;const N=S8(C).force("link",u8(S).distance(120).strength(.5)).force("charge",C8().strength(-220)).force("center",qI(lc/2,ic/2).strength(.05)).force("collide",i8(26)).on("tick",()=>p(R=>R+1));return o.current=N,()=>{N.stop()}},[e,t]);const g=j=>{const C=s.current.getBoundingClientRect();return{x:(j.clientX-C.left)/C.width*lc,y:(j.clientY-C.top)/C.height*ic}},b=j=>C=>{j.id!=="__center"&&(u.current=j,C.target.setPointerCapture?.(C.pointerId),o.current?.alphaTarget(.3).restart())},v=j=>{const C=u.current;if(!C)return;const{x:S,y:N}=g(j);C.fx=S,C.fy=N},k=()=>{const j=u.current;j&&(j.fx=null,j.fy=null),u.current=null,o.current?.alphaTarget(0)},E=l.current,y=c.current;return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-muted/10",children:r.jsxs("svg",{ref:s,viewBox:`0 0 ${lc} ${ic}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:v,onPointerUp:k,onPointerLeave:k,children:[y.map((j,C)=>r.jsx("line",{x1:j.source.x,y1:j.source.y,x2:j.target.x,y2:j.target.y,stroke:oc[j.target.kind],strokeOpacity:.22,strokeWidth:1.5},C)),E.map(j=>{if(j.id==="__center")return r.jsxs("g",{transform:`translate(${j.x},${j.y})`,children:[r.jsx("circle",{r:22,fill:oc.agent}),r.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},j.id);const C=m?.id===j.id;return r.jsxs("g",{transform:`translate(${j.x},${j.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:b(j),onClick:()=>h(j),children:[r.jsx("circle",{r:C?9:6,fill:oc[j.kind],fillOpacity:C?1:.9,stroke:C?"#fff":"none",strokeWidth:C?2:0}),r.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:j.label.length>22?`${j.label.slice(0,22)}…`:j.label})]},j.id)})]})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[(()=>{const j=N8();return Object.keys(j).filter(C=>C!=="agent").map(C=>r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:oc[C]}})," ",j[C]]},C))})(),r.jsx("span",{className:"ml-auto",children:f("agents_ui.nodes_drag_hint",{n:String(t.length)})})]}),m&&r.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:oc[m.kind]}}),r.jsx("span",{className:"font-medium",children:m.label}),r.jsxs("span",{className:"text-muted-fg",children:["· ",m.relation]})]}),m.detail&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:m.detail})]})]})}function R8(){return[{key:"overview",label:f("agents_ui.tab_explorer"),icon:Of},{key:"memories",label:f("project.nav.memories"),icon:Xd},{key:"records",label:f("project.agent_detail.records_title"),icon:Fk},{key:"sleep",label:f("project.agent_detail.sleep_title"),icon:Pl},{key:"brain",label:f("project.agent_detail.brain_title"),icon:Za},{key:"config",label:f("settings.tabs.advanced"),icon:Tc}]}function T8(){return[{value:"",label:f("agents_ui.type_none")},{value:"orchestrator",label:f("agents_ui.type_orchestrator"),description:f("agents_ui.type_orchestrator_desc")},{value:"specialist",label:f("agents_ui.type_specialist"),description:f("agents_ui.type_specialist_desc")},{value:"assistant",label:f("agents_ui.type_assistant"),description:f("agents_ui.type_assistant_desc")},{value:"worker",label:f("agents_ui.type_worker"),description:f("agents_ui.type_worker_desc")},{value:"monitor",label:f("agents_ui.type_monitor"),description:f("agents_ui.type_monitor_desc")}]}const Tx=e=>e.split(",").map(t=>t.trim()).filter(Boolean),A8=(e,t)=>e.filter(s=>s.spec?.agent===t||t==="super-agent"&&s.kind==="super_agent");function M8(e){return e.split(`
638
- `).map(t=>t.replace(/^[-*#>\s]+/,"").trim()).filter(t=>t.length>2&&!t.startsWith("```")).slice(0,12)}function O8({pid:e}){const{slug:t=""}=Lk(),s=Yn(),[o,l]=x.useState("overview"),c=R8(),u=We(`/projects/${e}/agents/${t}`,()=>ln.get(e,t)),p=We(`/projects/${e}/agents`,()=>ln.list(e)),m=We(`/projects/${e}/routines`,()=>Cr.list(e)),h=We(`/projects/${e}/messages?agent=${t}`,()=>xf.project(e,{agent:t,limit:200})),g=We(`/projects/${e}/agents/${t}/conversations`,()=>wo.list(e,t)),b=We(`/projects/${e}/tasks?all`,()=>Nr.list(e,"all")),v=u.data,k=A8(m.data||[],t),E=(b.data||[]).filter(C=>C.agent===t),y=(p.data||[]).filter(C=>C.parent===t);if(u.isLoading)return r.jsx(rt,{});if(!v)return r.jsx("div",{className:"text-sm text-muted-fg",children:f("project.agent_detail.not_found")});const j=v.is_master?Fa:on;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("button",{onClick:()=>s(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:r.jsx(uM,{size:16})}),r.jsx("div",{className:Te("flex size-11 items-center justify-center rounded-xl bg-gradient-to-br",v.is_master?"from-violet-600 to-indigo-600":"from-slate-600 to-gray-600"),children:r.jsx(j,{className:"size-5 text-white"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("h1",{className:"text-lg font-semibold",children:v.slug}),v.is_master&&r.jsxs($e,{tone:"success",children:[r.jsx(Fa,{size:10})," ",f("project.agents.orchestrator")]}),v.role&&r.jsx($e,{children:v.role}),v.model&&r.jsx($e,{tone:"info",children:v.model}),v.parent&&r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${v.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[f("project.agent_detail.reports_to")," ",v.parent]})]}),v.description&&r.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:v.description})]})]}),r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>s(`/p/${e}/chat?agent=${t}`),children:[r.jsx(Gs,{size:13})," ",f("project.agent_detail.chat_btn",{slug:v.slug})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:C,label:S,icon:N})=>r.jsxs("button",{onClick:()=>l(C),className:Te("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",o===C?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[r.jsx(N,{size:14})," ",S]},C))}),o==="overview"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[r.jsx(Od,{label:f("agents_ui.stat_threads"),value:g.data?.length??0,icon:Zd}),r.jsx(Od,{label:f("agents_ui.stat_records"),value:h.data?.length??0,icon:Fk}),r.jsx(Od,{label:f("agents_ui.stat_tasks"),value:E.length,icon:Of}),r.jsx(Od,{label:f("agents_ui.stat_heartbeats"),value:k.length,icon:Pl})]}),r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(Ye,{title:f("agent_detail_extra.skills_title"),description:"",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.skills?.map(C=>r.jsxs($e,{tone:"info",children:[r.jsx(Za,{size:10})," ",C]},C)),v.tools?.map(C=>r.jsxs($e,{children:[r.jsx(ei,{size:10})," ",C]},C)),!v.skills?.length&&!v.tools?.length&&r.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),r.jsx(Ye,{title:f("project.agent_detail.threads_recent"),description:"",children:r.jsxs("ul",{className:"space-y-1 text-xs",children:[(g.data||[]).slice(0,6).map(C=>r.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[r.jsx("span",{className:"truncate",children:C.title||C.filename}),r.jsxs("span",{className:"shrink-0 text-muted-fg",children:[C.messages??0," ",f("project.agent_detail.msgs_count")]})]},C.id)),!g.data?.length&&r.jsx("li",{className:"text-muted-fg",children:f("project.agent_detail.no_threads")})]})})]}),y.length>0&&r.jsx(Ye,{title:f("project.agent_detail.subagents"),description:f("project.agent_detail.subagents_desc"),children:r.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(C=>r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${C.slug}`),className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-1.5 text-sm hover:border-muted-fg/50",children:[r.jsx(on,{size:14,className:"text-muted-fg"})," ",C.slug]},C.slug))})})]}),o==="memories"&&r.jsx(D8,{pid:e,slug:t,initial:v.memory||"",onSaved:()=>u.mutate()}),o==="records"&&r.jsx(L8,{records:h.data||[],loading:h.isLoading}),o==="sleep"&&r.jsx(P8,{routines:k}),o==="brain"&&r.jsx(B8,{slug:t,memory:v.memory||"",threads:(g.data||[]).map(C=>({id:C.id,label:C.title||C.filename})),tasks:E.map(C=>({id:C.id,label:C.title,detail:C.body||void 0})),routines:k,parent:v.parent||null,children:y.map(C=>C.slug)}),o==="config"&&r.jsx(z8,{pid:e,agent:v,agents:p.data||[],onSaved:()=>{u.mutate(),p.mutate()},onDeleted:()=>{p.mutate(),s(`/p/${e}/agents`)}})]})}function z8({pid:e,agent:t,agents:s,onSaved:o,onDeleted:l}){const c=ot(),[u,p]=x.useState(t.type||""),[m,h]=x.useState(t.area||""),[g,b]=x.useState(t.role||""),[v,k]=x.useState(t.model||""),[E,y]=x.useState(t.parent||""),[j,C]=x.useState(!!t.is_master),[S,N]=x.useState((t.skills||[]).join(", ")),[R,M]=x.useState((t.tools||[]).join(", ")),[T,z]=x.useState(t.description||""),[D,U]=x.useState(t.system||""),[L,H]=x.useState(!1),O=async()=>{H(!0);try{await ln.update(e,t.slug,{type:u||null,area:m||null,role:g||null,model:v||null,parent:E||null,is_master:j||u==="orchestrator",skills:Tx(S),tools:Tx(R),description:T||null,system:D}),c.success(f("project.agent_detail.update_success")),o()}catch(B){c.error(B.message)}finally{H(!1)}},P=async()=>{if(confirm(f("project.agent_detail.delete_confirm",{slug:t.slug})))try{await ln.remove(e,t.slug),c.success(f("project.agent_detail.delete_success")),l()}catch(B){c.error(B.message)}};return r.jsx(Ye,{title:f("project.agent_detail.config_title"),description:`.apc/agents/${t.slug}.md — ${f("agents_ui.config_def_desc")}`,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("project.agent_detail.type_label"),children:r.jsx(_t,{value:u,onChange:p,options:T8()})}),r.jsx(ie,{label:f("project.agent_detail.area_label"),hint:f("project.agent_detail.area_hint"),children:r.jsx(Ee,{value:m,onChange:B=>h(B.target.value),placeholder:f("project.agent_detail.area_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("project.agent_detail.role_label"),children:r.jsx(Ee,{value:g,onChange:B=>b(B.target.value),placeholder:"Operations Lead"})}),r.jsx(ie,{label:f("project.agent_detail.parent_label"),children:r.jsx(_t,{value:E,onChange:y,placeholder:f("project.agent_detail.none_parent"),options:[{value:"",label:f("project.agent_detail.none_parent")},...s.filter(B=>B.slug!==t.slug).map(B=>({value:B.slug,label:B.slug}))]})})]}),r.jsx(ie,{label:f("project.agent_detail.model_label"),hint:f("project.agent_detail.model_hint"),children:r.jsx(Ee,{value:v,onChange:B=>k(B.target.value),placeholder:f("project.agent_detail.model_ph")})}),r.jsx(ie,{label:f("project.agent_detail.skills_label"),children:r.jsx(Ee,{value:S,onChange:B=>N(B.target.value),placeholder:"skill-a, skill-b"})}),r.jsx(I8,{value:R,onChange:M}),r.jsx(ie,{label:f("project.agent_detail.bio_label"),children:r.jsx(On,{rows:2,value:T,onChange:B=>z(B.target.value)})}),r.jsx(ie,{label:f("project.agent_detail.system_label"),hint:f("project.agent_detail.system_hint"),children:r.jsx(On,{rows:10,className:"font-mono text-xs",value:D,onChange:B=>U(B.target.value),placeholder:"You are…"})}),r.jsx(Qt,{checked:j,onChange:C,label:f("project.agent_detail.master_label")}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[r.jsxs(ce,{variant:"destructive",onClick:P,children:[r.jsx(Gn,{size:13})," ",f("project.agent_detail.delete_btn")]}),r.jsxs(ce,{variant:"primary",loading:L,onClick:O,children:[r.jsx(Lf,{size:13})," ",f("project.agent_detail.save_btn")]})]})]})})}function Od({label:e,value:t,icon:s}){return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(s,{size:13})," ",e]}),r.jsx("div",{className:"mt-1 text-2xl font-semibold",children:t})]})}function D8({pid:e,slug:t,initial:s,onSaved:o}){const l=ot(),[c,u]=x.useState(s),[p,m]=x.useState(!1);x.useEffect(()=>{u(s)},[s]);const h=c!==s,g=async()=>{m(!0);try{await ln.memory.put(e,t,c),l.success(f("project.agent_detail.memory_saved")),o()}catch(b){l.error(b.message)}finally{m(!1)}};return r.jsxs(Ye,{title:f("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${t}/memory.md — ${f("agents_ui.memory_durable_desc")}`,children:[r.jsx(On,{rows:16,className:"font-mono text-xs",value:c,onChange:b=>u(b.target.value),placeholder:f("project.agent_detail.memory_empty")}),r.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[c.length," ",f("project.memories.chars")]}),r.jsxs(ce,{size:"sm",variant:"primary",loading:p,disabled:!h,onClick:g,children:[r.jsx(Lf,{size:12})," ",f("project.memories.save_btn")]})]})]})}function L8({records:e,loading:t}){const s=x.useMemo(()=>[...e].sort((o,l)=>(l.ts||"").localeCompare(o.ts||"")),[e]);return r.jsxs(Ye,{title:f("project.agent_detail.records_title"),description:f("project.agent_detail.records_desc"),children:[t&&r.jsx(rt,{}),!t&&s.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.agent_detail.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:s.map((o,l)=>r.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:o.direction==="in"?r.jsx(Gk,{size:13,className:"text-blue-400"}):r.jsx(Kk,{size:13,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:new Date(o.ts).toLocaleString()}),r.jsx($e,{tone:"info",children:o.channel}),o.type&&r.jsx($e,{children:o.type})]}),o.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:o.body.length>400?`${o.body.slice(0,400)}…`:o.body})]})]},`${o.ts}-${l}`))})]})}function P8({routines:e}){return e.length===0?r.jsx(Ye,{title:f("project.agent_detail.sleep_title"),description:f("project.agent_detail.sleep_desc"),children:r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[r.jsx("div",{className:"font-medium text-amber-400",children:f("project.agent_detail.sleep_deep")}),r.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:f("project.agent_detail.sleep_deep_desc")})]})}):r.jsx(Ye,{title:f("project.agent_detail.sleep_title"),description:f("project.agent_detail.sleep_desc"),children:r.jsx("div",{className:"space-y-3",children:e.map(t=>{const s=t.enabled,o=t.last_status==="error";return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Te("size-2 rounded-full",o?"bg-destructive":s?"bg-emerald-400":"bg-muted-fg/40")}),r.jsx("span",{className:"text-sm font-medium",children:t.name}),r.jsx($e,{tone:s?"success":"muted",children:f(s?"agents_ui.running":"agents_ui.paused")}),o&&r.jsx($e,{tone:"danger",children:f("agents_ui.last_error")})]}),r.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[r.jsx(zd,{label:f("agents_ui.field_tick"),value:t.schedule}),r.jsx(zd,{label:f("agents_ui.field_next_tick"),value:t.next_run_at?new Date(t.next_run_at).toLocaleString():"—"}),r.jsx(zd,{label:f("agents_ui.field_last_tick"),value:t.last_run_at?new Date(t.last_run_at).toLocaleString():"—"}),r.jsx(zd,{label:f("agents_ui.field_last_run"),value:t.last_status||"—"})]}),t.last_error&&r.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:t.last_error})]},t.name)})})})}function zd({label:e,value:t}){return r.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:t})]})}function I8({value:e,onChange:t}){const s=We("/tools",()=>YD.list()),o=Tx(e),l=s.data||[],c=p=>{const m=new Set(o);m.has(p)?m.delete(p):m.add(p),t([...m].join(", "))},u=o.filter(p=>!l.some(m=>m.name===p));return r.jsxs(ie,{label:f("agents_ui.tools_label"),hint:f("project.agent_detail.tools_hint"),children:[r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map(p=>{const m=o.includes(p.name);return r.jsx(Ge,{content:p.description||p.name,children:r.jsx("button",{type:"button",onClick:()=>c(p.name),className:Te("rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",m?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:p.name})},p.name)}),u.map(p=>r.jsxs("button",{type:"button",onClick:()=>c(p),className:"rounded-md border border-sky-500/50 bg-sky-500/10 px-2 py-0.5 font-mono text-[11px] text-sky-400",children:[p," ✕"]},p))]}),r.jsx(Ee,{className:"mt-2",value:e,onChange:p=>t(p.target.value),placeholder:f("project.agent_detail.tools_custom_ph")})]})}function B8({slug:e,memory:t,threads:s,tasks:o,routines:l,parent:c,children:u}){const p=x.useMemo(()=>{const m=[];return M8(t).forEach((h,g)=>m.push({id:`m${g}`,label:h,kind:"memory",relation:"knows",detail:h})),s.slice(0,8).forEach(h=>m.push({id:`th-${h.id}`,label:h.label,kind:"thread",relation:"in_thread"})),o.slice(0,8).forEach(h=>m.push({id:`ts-${h.id}`,label:h.label,kind:"task",relation:"handles_task",detail:h.detail})),l.forEach(h=>m.push({id:`rt-${h.name}`,label:h.name,kind:"routine",relation:"ticks",detail:`schedule: ${h.schedule}`})),c&&m.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),u.forEach(h=>m.push({id:`c-${h}`,label:h,kind:"agentlink",relation:"orchestrates"})),m},[t,s,o,l,c,u]);return r.jsx(Ye,{title:f("project.agent_detail.brain_title"),description:f("project.agent_detail.brain_desc"),children:p.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.agent_detail.brain_empty")}):r.jsx(E8,{center:e,nodes:p})})}function U8(){const e=Yn(),t=Zn(),{pid:s=""}=Lk(),{project:o}=Wb(s),{collapsed:l,toggle:c}=Yb(An.sidebarCollapsed+".project"),u=String(s)==="0",p=x.useMemo(()=>u?[{title:f("base.nav_general"),items:[{key:"",label:"Dashboard",icon:qM},{key:"workspaces",label:f("base.workspaces_title"),icon:mM},{key:"models",label:f("settings.tabs.engines"),icon:$x},{key:"agent-defaults",label:f("base.defaults_title"),icon:on}]},{title:f("base.nav_activity"),items:[{key:"chat",label:f("project.nav.chat"),icon:Zd},{key:"sessions",label:f("base.sessions_title"),icon:BM},{key:"tasks",label:f("project.nav.tasks"),icon:Il},{key:"logs",label:f("project.nav.logs"),icon:Jd}]},{title:f("base.nav_system"),items:[{key:"agents",label:f("project.nav.agents"),icon:on},{key:"memories",label:f("project.nav.memories"),icon:Xd},{key:"routines",label:f("project.nav.routines"),icon:Pl},{key:"mcps",label:f("project.nav.mcps"),icon:Kg},{key:"vars",label:f("project.nav.vars"),icon:Yg},{key:"artifacts",label:f("project.nav.artifacts"),icon:Qd},{key:"config",label:f("project.nav.config"),icon:Tc}]}]:[{title:f("project.sections.workspace"),items:[{key:"",label:f("project.nav.overview"),icon:Jk},{key:"telegram",label:f("project.nav.telegram"),icon:Gs},{key:"chat",label:f("project.nav.chat"),icon:Zd},{key:"agents",label:f("project.nav.agents"),icon:on},{key:"memories",label:f("project.nav.memories"),icon:Xd}]},{title:f("project.sections.automation"),items:[{key:"routines",label:f("project.nav.routines"),icon:Pl},{key:"tasks",label:f("project.nav.tasks"),icon:Il},{key:"mcps",label:f("project.nav.mcps"),icon:Kg},{key:"vars",label:f("project.nav.vars"),icon:Yg},{key:"artifacts",label:f("project.nav.artifacts"),icon:Qd},{key:"logs",label:f("project.nav.logs"),icon:Jd}]},{title:f("project.sections.config"),items:[{key:"config",label:f("project.nav.config"),icon:Tc}]}],[u]),m=t.pathname.replace(`/p/${s}`,"").replace(/^\//,"").split("/")[0];if(!o)return r.jsx(WC,{testId:"screen-project-not-found",mood:"confused",message:f("project.not_found",{pid:s}),action:r.jsx(Qa,{variant:"outline",onClick:()=>e("/"),children:f("not_found.home")})});const h=g=>{const b=g?`/p/${s}/${g}`:`/p/${s}`;e(b)};return r.jsx(XC,{sections:p,active:m,onChange:h,collapsed:l,onToggleCollapse:c,contentClassName:"w-full space-y-6 py-6 pt-3 pr-6 pl-1",testId:`project-tab-${m||"overview"}`,children:r.jsxs(Uk,{children:[r.jsx(Kt,{index:!0,element:r.jsx(Xj,{pid:s})}),r.jsx(Kt,{path:"workspaces",element:r.jsx(sP,{})}),r.jsx(Kt,{path:"models",element:r.jsx(dN,{})}),r.jsx(Kt,{path:"agent-defaults",element:r.jsx(a6,{})}),r.jsx(Kt,{path:"sessions",element:r.jsx(u6,{})}),r.jsx(Kt,{path:"logs",element:r.jsx(YP,{pid:s})}),r.jsx(Kt,{path:"config",element:r.jsx(R6,{pid:s})}),r.jsx(Kt,{path:"telegram",element:r.jsx(II,{pid:s})}),r.jsx(Kt,{path:"agents",element:r.jsx(z6,{pid:s})}),r.jsx(Kt,{path:"agents/:slug",element:r.jsx(O8,{pid:s})}),r.jsx(Kt,{path:"memories",element:r.jsx(UI,{pid:s})}),r.jsx(Kt,{path:"routines",element:r.jsx(K6,{pid:s})}),r.jsx(Kt,{path:"tasks",element:u?r.jsx(d6,{}):r.jsx(X6,{pid:s})}),r.jsx(Kt,{path:"mcps",element:r.jsx(rI,{pid:s})}),r.jsx(Kt,{path:"artifacts",element:r.jsx(VI,{pid:s})}),r.jsx(Kt,{path:"vars",element:r.jsx(dI,{pid:s})}),r.jsx(Kt,{path:"threads",element:r.jsx(CA,{to:`/p/${s}/chat`,replace:!0})}),r.jsx(Kt,{path:"chat",element:r.jsx(DI,{pid:s})}),r.jsx(Kt,{path:"*",element:r.jsx(Xj,{pid:s})})]})})}function H8({value:e,onChange:t,options:s,placeholder:o,className:l}){const c=S=>s.find(N=>N.value===S)?.label??S,[u,p]=x.useState(!1),[m,h]=x.useState(c(e)),g=x.useRef(null),b=x.useRef(null),[v,k]=x.useState(null);x.useEffect(()=>{h(c(e))},[e,s]),x.useLayoutEffect(()=>{if(!u)return;const S=()=>{const N=g.current;if(!N)return;const R=N.getBoundingClientRect();k({top:R.bottom+4,left:R.left,width:R.width})};return S(),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[u]),x.useEffect(()=>{if(!u)return;const S=N=>{const R=N.target;g.current?.contains(R)||b.current?.contains(R)||(h(c(e)),p(!1))};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[u,e,s]);const E=m.trim().toLowerCase(),y=m===c(e),j=E&&!y?s.filter(S=>S.label.toLowerCase().includes(E)||S.value.toLowerCase().includes(E)):s,C=S=>{t(S.value),h(S.label),p(!1)};return r.jsxs("div",{ref:g,className:Te("relative",l),children:[r.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:[r.jsx("input",{value:m,placeholder:o,onChange:S=>{h(S.target.value),p(!0)},onFocus:()=>p(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),r.jsx("button",{type:"button",tabIndex:-1,onClick:()=>p(S=>!S),className:"shrink-0 text-muted-fg hover:text-foreground",children:r.jsx(pa,{className:"size-4"})})]}),u&&j.length>0&&v&&Ps.createPortal(r.jsx("ul",{ref:b,style:{position:"fixed",top:v.top,left:v.left,width:v.width},className:"z-[1000] max-h-60 overflow-y-auto rounded-lg bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:j.map(S=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:N=>{N.preventDefault(),C(S)},className:Te("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",S.value===e&&"bg-accent/50"),children:r.jsx("span",{className:"truncate font-mono text-xs",children:S.label})})},S.value))}),document.body)]})}const V8=["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 q8(e){return e&&e.charAt(0).toLocaleUpperCase()+e.slice(1)}function $8(){const e=Gb();let t=null;try{t=new Intl.DisplayNames([e],{type:"language"})}catch{t=null}return V8.map(s=>{const o=t?.of(s);return{value:s,label:o?q8(o):s}}).sort((s,o)=>s.label.localeCompare(o.label,e))}const F8=["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 G8(){try{const e=Intl.supportedValuesOf;if(typeof e=="function")return e("timeZone")}catch{}return F8}function _w(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function Y8(e,t){try{const s=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(s);return o?(o[1]==="-"?-1:1)*(parseInt(o[2],10)*60+(o[3]?parseInt(o[3],10):0)):0}catch{return 0}}function K8(e){const t=e<0?"-":"+",s=Math.abs(e),o=String(Math.floor(s/60)).padStart(2,"0"),l=String(s%60).padStart(2,"0");return`GMT${t}${o}:${l}`}let Dd=null;function X8(){if(Dd)return Dd;const e=new Date;return Dd=G8().map(t=>({value:t,label:t,off:Y8(t,e)})).sort((t,s)=>t.off-s.off||t.value.localeCompare(s.value)).map(({value:t,off:s})=>({value:t,label:`(${K8(s)}) ${t}`})),Dd}function Q8(){const e=ot(),{identity:t,isLoading:s,save:o}=Zb(),[l,c]=x.useState({}),[u,p]=x.useState(!1),m=x.useMemo(()=>X8(),[]);if(x.useEffect(()=>{c({...t,timezone:t?.timezone||_w()})},[t]),s)return r.jsx(rt,{});const h=async()=>{p(!0);try{await o({owner_name:l.owner_name,owner_context:l.owner_context,language:l.language,timezone:l.timezone}),e.success(f("settings.identity.saved"))}catch(g){e.error(g.message)}finally{p(!1)}};return r.jsxs(Ye,{title:f("settings.identity.title"),description:f("settings.identity.subtitle"),children:[t?null:r.jsx(bt,{children:f("common.none_yet")}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("settings.identity.owner_name"),children:r.jsx(Ee,{value:l.owner_name||"",onChange:g=>c({...l,owner_name:g.target.value})})}),r.jsx(ie,{label:f("settings.identity.language"),children:r.jsx(_t,{value:l.language||"es",onChange:g=>c({...l,language:g}),options:$8()})}),r.jsx(ie,{label:f("settings.identity.timezone"),hint:f("settings.identity.timezone_hint"),children:r.jsx(H8,{value:l.timezone||_w(),onChange:g=>c({...l,timezone:g}),options:m})})]}),r.jsx("div",{className:"mt-3",children:r.jsx(ie,{label:f("settings.identity.owner_context"),hint:f("settings.identity.owner_context_hint"),children:r.jsx(On,{rows:3,value:l.owner_context||"",onChange:g=>c({...l,owner_context:g.target.value})})})}),r.jsx("div",{className:"mt-4",children:r.jsx(ce,{variant:"primary",loading:u,onClick:h,children:f("common.save")})})]})}function W8(){const e=ot(),t=Yn(),{superAgent:s,isLoading:o,mutate:l}=cN(),{patch:c}=qr(),{identity:u,save:p}=Zb(),[m,h]=x.useState(!0),[g,b]=x.useState(""),[v,k]=x.useState(""),[E,y]=x.useState("permiso"),[j,C]=x.useState(!1);if(x.useEffect(()=>{s&&(h(!!s.enabled),b(s.system||""),y(s.permission_mode||"permiso"))},[s]),x.useEffect(()=>{k(u.personality||"")},[u.personality]),o||!s)return r.jsx(rt,{});const S=async()=>{C(!0);try{await c({"super_agent.enabled":m,"super_agent.system":g,"super_agent.permission_mode":E},["super_agent.name"]),await p({personality:v}),e.success(f("settings.super_agent.saved")),l()}catch(N){e.error(N.message)}finally{C(!1)}};return r.jsx(Ye,{title:f("settings.super_agent.title"),description:f("settings.super_agent.behavior_subtitle"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsx(Qt,{checked:m,onChange:h,label:f("settings.super_agent.enabled_label")})}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("settings.super_agent.model_active")}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:s.model||"—"})]}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:()=>t("/p/0/models"),children:[r.jsx($x,{size:13})," ",f("settings.super_agent.model_configure")]})]}),r.jsx(ie,{label:f("settings.super_agent.permission_mode"),children:r.jsx(_t,{value:E,onChange:y,options:Qx.map(N=>({value:N,label:N}))})}),r.jsx(ie,{label:f("settings.super_agent.personality"),children:r.jsx(On,{rows:2,value:v,onChange:N=>k(N.target.value)})}),r.jsx(ie,{label:f("settings.super_agent.system"),hint:f("settings.super_agent.system_hint"),children:r.jsx(On,{rows:6,className:"font-mono text-xs",value:g,onChange:N=>b(N.target.value),placeholder:f("settings.super_agent.system_ph")})}),r.jsx(ce,{variant:"primary",loading:j,onClick:S,children:f("common.save")})]})})}const gg={providers:()=>he.get("/embeddings/providers"),test:(e={})=>he.post("/embeddings/test",e),reindex:()=>he.post("/embeddings/reindex",{})},Z8=()=>[{value:"auto",label:f("memory_panel.provider_auto")},{value:"ollama",label:f("memory_panel.provider_ollama")},{value:"gemini",label:f("memory_panel.provider_gemini")},{value:"openai",label:f("memory_panel.provider_openai")},{value:"tf",label:f("memory_panel.provider_tf")}],J8=()=>[{value:"chain",label:f("memory_panel.mode_chain")},{value:"single",label:f("memory_panel.mode_single")}],vw=e=>e.startsWith("***");function e7(){const e=ot(),{config:t,isLoading:s,patch:o}=qr(),{data:l,mutate:c}=We("/embeddings/providers",()=>gg.providers()),[u,p]=x.useState(!1),[m,h]=x.useState(null);if(s)return r.jsx(rt,{});const g=t.memory||{},b=g.embeddings||{},v=l?.configured_provider||b.provider||"auto",k=l?.mode||b.mode||"chain",E=l?.engines||[],y=async S=>{p(!0);try{await o(S),await c()}catch(N){e.error(f("memory_panel.save_failed",{msg:N.message}))}finally{p(!1)}},j=async()=>{p(!0),h(null);try{const S=await gg.test({});h(`${S.embedder} · dim ${S.dim} · ${S.ms}ms`),e.success(f("memory_panel.test_ok",{embedder:S.embedder}))}catch(S){e.error(f("memory_panel.test_failed",{msg:S.message}))}finally{p(!1)}},C=async()=>{p(!0);try{const S=await gg.reindex();e.success(f("memory_panel.reindexed",{indexed:S.indexed,cleared:S.cleared}))}catch(S){e.error(f("memory_panel.reindex_failed",{msg:S.message}))}finally{p(!1)}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ye,{title:f("memory_panel.embeddings_title"),description:f("memory_panel.embeddings_desc"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ie,{label:f("memory_panel.provider_label"),hint:f("memory_panel.provider_hint"),children:r.jsx(_t,{value:v,onChange:S=>y({"memory.embeddings.provider":S}),options:Z8(),disabled:u,className:"max-w-xl"})}),r.jsx(ie,{label:f("memory_panel.mode_label"),hint:f("memory_panel.mode_hint"),children:r.jsx(_t,{value:k,onChange:S=>y({"memory.embeddings.mode":S}),options:J8(),disabled:u,className:"max-w-md"})}),r.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:E.map(S=>r.jsxs($e,{tone:S.available?"success":"muted",children:[S.id,": ",S.available?f("memory_panel.available"):f("memory_panel.unavailable")]},S.id))}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(ce,{variant:"secondary",onClick:j,loading:u,children:[r.jsx(Za,{size:14})," ",f("memory_panel.test_btn")]}),r.jsxs(ce,{variant:"secondary",onClick:C,loading:u,children:[r.jsx(Wk,{size:14})," ",f("memory_panel.reindex_btn")]}),m&&r.jsx("span",{className:"text-sm text-muted-foreground",children:m})]})]})}),r.jsxs(Ye,{title:f("memory_panel.ollama_title"),description:f("memory_panel.ollama_desc"),children:[r.jsx(ie,{label:f("memory_panel.model_label"),children:r.jsx(Ee,{defaultValue:b.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:u,onBlur:S=>{const N=S.target.value.trim();N&&N!==b.ollama?.model&&y({"memory.embeddings.ollama.model":N})},className:"max-w-md"})}),r.jsx(ie,{label:f("memory_panel.base_url_label"),hint:f("memory_panel.ollama_base_url_hint"),children:r.jsx(Ee,{defaultValue:b.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:u,onBlur:S=>y({"memory.embeddings.ollama.base_url":S.target.value.trim()}),className:"max-w-md"})})]}),r.jsxs(Ye,{title:f("memory_panel.openai_title"),description:f("memory_panel.openai_desc"),children:[r.jsx(ie,{label:f("memory_panel.model_label"),children:r.jsx(Ee,{defaultValue:b.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:u,onBlur:S=>{const N=S.target.value.trim();N&&N!==b.openai?.model&&y({"memory.embeddings.openai.model":N})},className:"max-w-md"})}),r.jsx(ie,{label:f("memory_panel.api_key_label"),hint:f("memory_panel.openai_key_hint"),children:r.jsx(Ee,{type:"password",defaultValue:b.openai?.api_key||"",placeholder:"sk-…",disabled:u,onBlur:S=>{const N=S.target.value;N&&!vw(N)&&y({"memory.embeddings.openai.api_key":N})},className:"max-w-md"})})]}),r.jsxs(Ye,{title:f("memory_panel.gemini_title"),description:f("memory_panel.gemini_desc"),children:[r.jsx(ie,{label:f("memory_panel.model_label"),children:r.jsx(Ee,{defaultValue:b.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:u,onBlur:S=>{const N=S.target.value.trim();N&&N!==b.gemini?.model&&y({"memory.embeddings.gemini.model":N})},className:"max-w-md"})}),r.jsx(ie,{label:f("memory_panel.api_key_label"),hint:f("memory_panel.gemini_key_hint"),children:r.jsx(Ee,{type:"password",defaultValue:b.gemini?.api_key||"",placeholder:"AIza…",disabled:u,onBlur:S=>{const N=S.target.value;N&&!vw(N)&&y({"memory.embeddings.gemini.api_key":N})},className:"max-w-md"})})]}),r.jsxs(Ye,{title:f("memory_panel.compaction_title"),description:f("memory_panel.compaction_desc"),children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(ie,{label:f("memory_panel.threshold_label"),hint:f("memory_panel.threshold_hint"),children:r.jsx(Ee,{type:"number",min:1,defaultValue:g.compact_threshold??60,placeholder:"60",disabled:u,onBlur:S=>{const N=parseInt(S.target.value,10);Number.isFinite(N)&&N>0&&N!==g.compact_threshold&&y({"memory.compact_threshold":N})},className:"max-w-[10rem]"})}),r.jsx(ie,{label:f("memory_panel.keep_recent_label"),hint:f("memory_panel.keep_recent_hint"),children:r.jsx(Ee,{type:"number",min:1,defaultValue:g.keep_recent??40,placeholder:"40",disabled:u,onBlur:S=>{const N=parseInt(S.target.value,10);Number.isFinite(N)&&N>0&&N!==g.keep_recent&&y({"memory.keep_recent":N})},className:"max-w-[10rem]"})})]}),r.jsx(ie,{label:f("memory_panel.compact_model_label"),hint:f("memory_panel.compact_model_hint"),children:r.jsx(Ee,{defaultValue:g.compact_model||"ollama:gemma4:31b-cloud",placeholder:"ollama:gemma4:31b-cloud",disabled:u,onBlur:S=>{const N=S.target.value.trim();N&&N!==g.compact_model&&y({"memory.compact_model":N})},className:"max-w-md"})}),r.jsx(ie,{label:f("memory_panel.compact_fallback_label"),hint:f("memory_panel.compact_fallback_hint"),children:r.jsx(Ee,{defaultValue:g.compact_fallback_model||"",placeholder:f("memory_panel.compact_fallback_ph"),disabled:u,onBlur:S=>{const N=S.target.value.trim();N!==(g.compact_fallback_model||"")&&y({"memory.compact_fallback_model":N})},className:"max-w-md"})})]})]})}function t7(){return[{key:"load_threshold",label:f("settings_ui.knob_load_threshold"),hint:f("settings_ui.knob_load_threshold_hint"),step:.01,min:0,max:1},{key:"hint_threshold",label:f("settings_ui.knob_hint_threshold"),hint:f("settings_ui.knob_hint_threshold_hint"),step:.01,min:0,max:1},{key:"margin",label:f("settings_ui.knob_margin"),hint:f("settings_ui.knob_margin_hint"),step:.01,min:0,max:1},{key:"max_loaded",label:f("settings_ui.knob_max_loaded"),hint:f("settings_ui.knob_max_loaded_hint"),step:1,min:0,max:5},{key:"max_hints",label:f("settings_ui.knob_max_hints"),hint:f("settings_ui.knob_max_hints_hint"),step:1,min:0,max:8},{key:"prompt_floor",label:f("settings_ui.knob_prompt_floor"),hint:f("settings_ui.knob_prompt_floor_hint"),step:1,min:0,max:40},{key:"body_char_cap",label:f("settings_ui.knob_body_char_cap"),hint:f("settings_ui.knob_body_char_cap_hint"),step:500,min:500,max:2e4}]}function n7(){const e=ot(),{data:t,mutate:s,isLoading:o}=We("/skills/inspector",()=>pc.inspector()),[l,c]=x.useState(!1),[u,p]=x.useState(""),[m,h]=x.useState(null);if(o||!t)return r.jsx(rt,{});const g=t.config,b=t.index,v=async y=>{c(!0);try{await pc.updateInspector(y),await s()}catch(j){e.error(f("settings_ui.could_not_save",{msg:j.message}))}finally{c(!1)}},k=async(y=!1)=>{c(!0);try{const j=await pc.index({force:y});e.success(f("settings_ui.indexed_with",{embedder:j.embedder,dim:j.dim,added:j.changed.added,refreshed:j.changed.refreshed,removed:j.changed.removed})),await s()}catch(j){e.error(f("settings_ui.index_failed",{msg:j.message}))}finally{c(!1)}},E=async()=>{if(u.trim()){c(!0),h(null);try{const y=await pc.inspect(u.trim());h(y.trace)}catch(y){e.error(f("settings_ui.dry_run_failed",{msg:y.message}))}finally{c(!1)}}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ye,{title:f("settings_ui.inspector_title"),description:f("settings_ui.inspector_desc"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(ie,{label:f("settings_ui.enable_inspector"),hint:f("settings_ui.enable_inspector_hint"),children:r.jsx(Qt,{checked:g.enabled,disabled:l,onChange:y=>v({enabled:y}),label:g.enabled?f("settings_ui.on"):f("settings_ui.off")})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[r.jsx($e,{tone:b.count>0?"success":"warning",children:f("settings_ui.index_count",{n:b.count})}),r.jsx($e,{tone:"muted",children:b.embedder||f("settings_ui.not_indexed")}),b.dim?r.jsx($e,{tone:"muted",children:f("settings_ui.dim",{dim:b.dim})}):null,b.updated_at?r.jsx("span",{className:"text-xs text-muted-foreground",children:f("settings_ui.updated_at",{date:new Date(b.updated_at).toLocaleString()})}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(ce,{variant:"secondary",onClick:()=>k(!1),loading:l,children:[r.jsx(ua,{size:14})," ",f("settings_ui.reindex")]}),r.jsxs(ce,{variant:"secondary",onClick:()=>k(!0),loading:l,children:[r.jsx(ua,{size:14})," ",f("settings_ui.reindex_forced")]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:f("settings_ui.embedder_source")})]})]})}),r.jsx(Ye,{title:f("settings_ui.thresholds_title"),description:f("settings_ui.thresholds_desc"),children:r.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:t7().map(y=>r.jsx(ie,{label:y.label,hint:y.hint,children:r.jsx(Ee,{type:"number",step:y.step,min:y.min,max:y.max,defaultValue:String(g[y.key]),disabled:l,onBlur:j=>{const C=Number(j.target.value);Number.isFinite(C)&&C!==g[y.key]&&v({[y.key]:C})},className:"max-w-[12rem]"})},y.key))})}),r.jsx(Ye,{title:f("settings_ui.test_title"),description:f("settings_ui.test_desc"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Ee,{value:u,placeholder:f("settings_ui.test_placeholder"),disabled:l,onChange:y=>p(y.target.value),onKeyDown:y=>{y.key==="Enter"&&E()},className:"max-w-xl flex-1"}),r.jsxs(ce,{variant:"primary",onClick:E,loading:l,children:[r.jsx(r3,{size:14})," ",f("settings_ui.test_btn")]})]}),m&&r.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-sm",children:[r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[r.jsx(Za,{size:14,className:"text-muted-foreground"}),r.jsx("span",{className:"text-muted-foreground",children:m.embedder||"—"}),m.jit?r.jsx($e,{tone:"warning",children:f("settings_ui.jit_empty_index")}):null,m.reason&&!m.loaded?.length&&!m.hinted?.length?r.jsx($e,{tone:"muted",children:m.reason}):null]}),m.loaded?.length?r.jsxs("div",{className:"mb-1",children:[r.jsxs("span",{className:"text-muted-foreground",children:[f("settings_ui.loaded_label")," "]}),m.loaded.map(y=>r.jsx($e,{tone:"success",className:"mr-1",children:y},y))]}):null,m.hinted?.length?r.jsxs("div",{className:"mb-1",children:[r.jsxs("span",{className:"text-muted-foreground",children:[f("settings_ui.suggested_label")," "]}),m.hinted.map(y=>r.jsx($e,{tone:"info",className:"mr-1",children:y},y))]}):null,m.scored?.length?r.jsx("div",{className:"mt-2 space-y-0.5 font-mono text-xs text-muted-foreground",children:m.scored.map(y=>r.jsxs("div",{children:[y.sim.toFixed(3)," ",y.slug]},y.slug))}):null]})]})})]})}function s7(){const e=ot(),{config:t,isLoading:s,patch:o,mutate:l}=qr(),c=t.telegram?.channels||[],u=Math.max(0,c.findIndex(M=>M.name==="default")),p=c[u],[m,h]=x.useState(!0),[g,b]=x.useState(1500),[v,k]=x.useState(!0),[E,y]=x.useState(""),[j,C]=x.useState(""),[S,N]=x.useState(!1);if(x.useEffect(()=>{h(!!t.telegram?.enabled),b(Number(t.telegram?.poll_interval_ms||1500)),k(!!t.telegram?.respond_with_engine),y(""),C(p?.chat_id||"")},[t,p?.chat_id]),s)return r.jsx(rt,{});const R=async()=>{N(!0);try{const M=c.slice(),T={name:"default",chat_id:j,respond_with_engine:v,...E?{bot_token:E}:{}};c.length===0?M.push(T):M[u]={...p,...T},await o({"telegram.enabled":m,"telegram.poll_interval_ms":g,"telegram.respond_with_engine":v,"telegram.channels":M}),e.success(f("settings.telegram_global.saved")),l(),y("")}catch(M){e.error(M.message)}finally{N(!1)}};return r.jsx(Ye,{title:f("settings.telegram_global.title"),description:f("settings.telegram_global.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qt,{checked:m,onChange:h,label:f("settings.telegram_global.enabled")}),r.jsx(Qt,{checked:v,onChange:k,label:f("settings.telegram_global.respond_with_engine")})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("settings.telegram_global.bot_token"),hint:p?.bot_token?`…${ko(p.bot_token)??""} ${f("telegram_ui.secret_set_replace")}`:f("telegram_ui.bot_token_hint_short"),children:r.jsx(Ee,{type:"password",value:E,onChange:M=>y(M.target.value),placeholder:p?.bot_token?`…${ko(p.bot_token)??""} ${f("telegram_ui.secret_already_set")}`:""})}),r.jsx(ie,{label:f("settings.telegram_global.chat_id"),children:r.jsx(Ee,{value:j,onChange:M=>C(M.target.value),placeholder:"889721252"})}),r.jsx(ie,{label:f("settings.telegram_global.poll_interval"),children:r.jsx(Ee,{type:"number",value:String(g),onChange:M=>b(Number(M.target.value)||1500)})})]}),r.jsx(ce,{variant:"primary",loading:S,onClick:R,children:f("common.save")})]})})}function a7(){const e=ot(),{channels:t,isLoading:s,mutate:o}=a_(),{contacts:l}=r_(),[c,u]=x.useState(null),[p,m]=x.useState(null),h=new Map;for(const b of l)h.set(String(b.user_id),b.name||`@${b.username||b.user_id}`);const g=async b=>{if(confirm(f("telegram_channels.delete_confirm",{name:b})))try{await Mn.channels.remove(b),e.success(f("telegram_channels.removed")),o()}catch(v){e.error(v.message)}};return r.jsxs(Ye,{title:f("telegram_channels.title"),description:f("telegram_channels.desc"),action:r.jsxs(ce,{size:"sm",onClick:()=>u({name:""}),children:[r.jsx(an,{size:14})," ",f("telegram_channels.new_btn")]}),children:[s&&r.jsx(rt,{}),!s&&t.length===0&&r.jsx(bt,{children:f("telegram_channels.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:t.map(b=>{const v=b.owner_user_id!=null?h.get(String(b.owner_user_id))||f("telegram_ui.user_id_fallback",{id:b.owner_user_id}):f("telegram_channels.no_owner");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:b.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[b.project&&r.jsxs($e,{tone:"success",children:["project = ",b.project]}),r.jsxs(ce,{size:"sm",variant:"ghost",onClick:()=>m(b),children:[r.jsx(Gs,{size:13})," ",f("admin.telegram_send_test")]}),r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>u(b),children:f("common.edit")}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>g(b.name),children:f("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",b.chat_id||"—"]}),r.jsxs("span",{children:["bot_token: ",b.bot_token?`…${ko(b.bot_token)??""}`:"—"]}),r.jsxs("span",{children:["route_to_agent: ",b.route_to_agent||f("telegram_ui.default_apx")]}),r.jsxs("span",{children:["engine: ",b.respond_with_engine?f("telegram_ui.yes"):f("telegram_ui.no")]}),r.jsxs("span",{className:"col-span-2",children:[f("telegram_channels.owner_label")," ",v]})]})]},b.name)})}),r.jsx(UC,{channel:c,onClose:()=>u(null),onSaved:()=>{u(null),o()}}),r.jsx(HC,{channel:p,onClose:()=>m(null)})]})}const yw=new Set(["owner","guest"]);function r7(){const e=ot(),{roles:t,mutate:s,isLoading:o}=r_(),[l,c]=x.useState(""),[u,p]=x.useState(""),[m,h]=x.useState(!1),[g,b]=x.useState(!1),v=async()=>{const y=l.trim();if(!y){e.error(f("telegram_roles.name_required"));return}if(yw.has(y)){e.error(f("telegram_roles.builtin_error",{name:y}));return}b(!0);try{const j=m?"*":u.split(",").map(C=>C.trim()).filter(Boolean);await Mn.roles.set(y,j),e.success(f("telegram_roles.saved",{name:y})),c(""),p(""),h(!1),s()}catch(j){e.error(j.message)}finally{b(!1)}},k=async y=>{if(confirm(f("telegram_roles.delete_confirm",{name:y})))try{await Mn.roles.remove(y),e.success(f("telegram_roles.removed")),s()}catch(j){e.error(j.message)}},E=Object.entries(t);return r.jsxs(Ye,{title:f("telegram_roles.title"),description:f("telegram_roles.desc"),children:[o&&r.jsx(rt,{}),E.length===0&&!o&&r.jsx(bt,{children:f("telegram_roles.empty")}),E.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:E.map(([y,j])=>{const C=yw.has(y),S=j?.tools==="*"?f("telegram_roles.tools_all"):Array.isArray(j?.tools)&&j.tools.length>0?j.tools.join(", "):f("telegram_roles.tools_none");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:y}),C&&r.jsx($e,{tone:"info",children:f("telegram_roles.builtin")})]}),!C&&r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>k(y),children:f("telegram_roles.delete_btn")})]}),r.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[f("telegram_contacts.tools_label")," ",S]})]},y)})}),r.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(an,{size:14})," ",f("telegram_roles.new_title")]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(ie,{label:f("telegram_roles.name_label"),children:r.jsx(Ee,{value:l,onChange:y=>c(y.target.value),placeholder:f("telegram_roles.name_ph")})}),r.jsx(ie,{label:f("telegram_roles.tools_label"),hint:f("telegram_roles.tools_hint"),children:r.jsx(Ee,{value:u,onChange:y=>p(y.target.value),disabled:m,placeholder:f("telegram_roles.tools_ph")})})]}),r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Qt,{checked:m,onChange:h,label:f("telegram_roles.full_access")}),r.jsx(ce,{variant:"primary",loading:g,onClick:v,children:f("telegram_roles.save_btn")})]})]})]})}const BN="apx.settings.telegramTab";function o7(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(BN);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function l7(){const[e,t]=x.useState("default");x.useEffect(()=>{t(o7())},[]);const s=o=>{const l=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";t(l);try{window.localStorage.setItem(BN,l)}catch{}};return r.jsxs(hp,{value:e,onValueChange:s,className:"w-full",children:[r.jsxs(gp,{children:[r.jsx(ra,{value:"default",children:f("settings.telegram_global.title")}),r.jsx(ra,{value:"channels",children:f("telegram_channels.title")}),r.jsx(ra,{value:"contacts",children:f("telegram_contacts.title")}),r.jsx(ra,{value:"roles",children:f("telegram_roles.title")})]}),r.jsx(Ds,{value:"default",className:"mt-4",children:r.jsx(s7,{})}),r.jsx(Ds,{value:"channels",className:"mt-4",children:r.jsx(a7,{})}),r.jsx(Ds,{value:"contacts",className:"mt-4",children:r.jsx(VC,{})}),r.jsx(Ds,{value:"roles",className:"mt-4",children:r.jsx(r7,{})})]})}function i7(){const{data:e,error:t,isLoading:s,mutate:o}=We("/pair/list",()=>Yl.list(),{refreshInterval:Pf.pairList});return{clients:e?.clients||[],error:t,isLoading:s,mutate:o}}var wl={},xg,jw;function c7(){return jw||(jw=1,xg=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),xg}var bg={},Sr={},ww;function Oo(){if(ww)return Sr;ww=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 Sr.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},Sr.getSymbolTotalCodewords=function(o){return t[o]},Sr.getBCHDigit=function(s){let o=0;for(;s!==0;)o++,s>>>=1;return o},Sr.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},Sr.isKanjiModeEnabled=function(){return typeof e<"u"},Sr.toSJIS=function(o){return e(o)},Sr}var _g={},kw;function y_(){return kw||(kw=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+s)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,l){if(e.isValid(o))return o;try{return t(o)}catch{return l}}})(_g)),_g}var vg,Sw;function u7(){if(Sw)return vg;Sw=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const s=Math.floor(t/8);return(this.buffer[s]>>>7-t%8&1)===1},put:function(t,s){for(let o=0;o<s;o++)this.putBit((t>>>s-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const s=Math.floor(this.length/8);this.buffer.length<=s&&this.buffer.push(0),t&&(this.buffer[s]|=128>>>this.length%8),this.length++}},vg=e,vg}var yg,Cw;function d7(){if(Cw)return yg;Cw=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,s,o,l){const c=t*this.size+s;this.data[c]=o,l&&(this.reservedBit[c]=!0)},e.prototype.get=function(t,s){return this.data[t*this.size+s]},e.prototype.xor=function(t,s,o){this.data[t*this.size+s]^=o},e.prototype.isReserved=function(t,s){return this.reservedBit[t*this.size+s]},yg=e,yg}var jg={},Nw;function f7(){return Nw||(Nw=1,(function(e){const t=Oo().getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const l=Math.floor(o/7)+2,c=t(o),u=c===145?26:Math.ceil((c-13)/(2*l-2))*2,p=[c-7];for(let m=1;m<l-1;m++)p[m]=p[m-1]-u;return p.push(6),p.reverse()},e.getPositions=function(o){const l=[],c=e.getRowColCoords(o),u=c.length;for(let p=0;p<u;p++)for(let m=0;m<u;m++)p===0&&m===0||p===0&&m===u-1||p===u-1&&m===0||l.push([c[p],c[m]]);return l}})(jg)),jg}var wg={},Ew;function p7(){if(Ew)return wg;Ew=1;const e=Oo().getSymbolSize,t=7;return wg.getPositions=function(o){const l=e(o);return[[0,0],[l-t,0],[0,l-t]]},wg}var kg={},Rw;function m7(){return Rw||(Rw=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(l){return l!=null&&l!==""&&!isNaN(l)&&l>=0&&l<=7},e.from=function(l){return e.isValid(l)?parseInt(l,10):void 0},e.getPenaltyN1=function(l){const c=l.size;let u=0,p=0,m=0,h=null,g=null;for(let b=0;b<c;b++){p=m=0,h=g=null;for(let v=0;v<c;v++){let k=l.get(b,v);k===h?p++:(p>=5&&(u+=t.N1+(p-5)),h=k,p=1),k=l.get(v,b),k===g?m++:(m>=5&&(u+=t.N1+(m-5)),g=k,m=1)}p>=5&&(u+=t.N1+(p-5)),m>=5&&(u+=t.N1+(m-5))}return u},e.getPenaltyN2=function(l){const c=l.size;let u=0;for(let p=0;p<c-1;p++)for(let m=0;m<c-1;m++){const h=l.get(p,m)+l.get(p,m+1)+l.get(p+1,m)+l.get(p+1,m+1);(h===4||h===0)&&u++}return u*t.N2},e.getPenaltyN3=function(l){const c=l.size;let u=0,p=0,m=0;for(let h=0;h<c;h++){p=m=0;for(let g=0;g<c;g++)p=p<<1&2047|l.get(h,g),g>=10&&(p===1488||p===93)&&u++,m=m<<1&2047|l.get(g,h),g>=10&&(m===1488||m===93)&&u++}return u*t.N3},e.getPenaltyN4=function(l){let c=0;const u=l.data.length;for(let m=0;m<u;m++)c+=l.data[m];return Math.abs(Math.ceil(c*100/u/5)-10)*t.N4};function s(o,l,c){switch(o){case e.Patterns.PATTERN000:return(l+c)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return c%3===0;case e.Patterns.PATTERN011:return(l+c)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(c/3))%2===0;case e.Patterns.PATTERN101:return l*c%2+l*c%3===0;case e.Patterns.PATTERN110:return(l*c%2+l*c%3)%2===0;case e.Patterns.PATTERN111:return(l*c%3+(l+c)%2)%2===0;default:throw new Error("bad maskPattern:"+o)}}e.applyMask=function(l,c){const u=c.size;for(let p=0;p<u;p++)for(let m=0;m<u;m++)c.isReserved(m,p)||c.xor(m,p,s(l,m,p))},e.getBestMask=function(l,c){const u=Object.keys(e.Patterns).length;let p=0,m=1/0;for(let h=0;h<u;h++){c(h),e.applyMask(h,l);const g=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(h,l),g<m&&(m=g,p=h)}return p}})(kg)),kg}var Ld={},Tw;function UN(){if(Tw)return Ld;Tw=1;const e=y_(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Ld.getBlocksCount=function(l,c){switch(c){case e.L:return t[(l-1)*4+0];case e.M:return t[(l-1)*4+1];case e.Q:return t[(l-1)*4+2];case e.H:return t[(l-1)*4+3];default:return}},Ld.getTotalCodewordsCount=function(l,c){switch(c){case e.L:return s[(l-1)*4+0];case e.M:return s[(l-1)*4+1];case e.Q:return s[(l-1)*4+2];case e.H:return s[(l-1)*4+3];default:return}},Ld}var Sg={},cc={},Aw;function h7(){if(Aw)return cc;Aw=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let o=1;for(let l=0;l<255;l++)e[l]=o,t[o]=l,o<<=1,o&256&&(o^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),cc.log=function(o){if(o<1)throw new Error("log("+o+")");return t[o]},cc.exp=function(o){return e[o]},cc.mul=function(o,l){return o===0||l===0?0:e[t[o]+t[l]]},cc}var Mw;function g7(){return Mw||(Mw=1,(function(e){const t=h7();e.mul=function(o,l){const c=new Uint8Array(o.length+l.length-1);for(let u=0;u<o.length;u++)for(let p=0;p<l.length;p++)c[u+p]^=t.mul(o[u],l[p]);return c},e.mod=function(o,l){let c=new Uint8Array(o);for(;c.length-l.length>=0;){const u=c[0];for(let m=0;m<l.length;m++)c[m]^=t.mul(l[m],u);let p=0;for(;p<c.length&&c[p]===0;)p++;c=c.slice(p)}return c},e.generateECPolynomial=function(o){let l=new Uint8Array([1]);for(let c=0;c<o;c++)l=e.mul(l,new Uint8Array([1,t.exp(c)]));return l}})(Sg)),Sg}var Cg,Ow;function x7(){if(Ow)return Cg;Ow=1;const e=g7();function t(s){this.genPoly=void 0,this.degree=s,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(o){this.degree=o,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(o){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(o.length+this.degree);l.set(o);const c=e.mod(l,this.genPoly),u=this.degree-c.length;if(u>0){const p=new Uint8Array(this.degree);return p.set(c,u),p}return c},Cg=t,Cg}var Ng={},Eg={},Rg={},zw;function HN(){return zw||(zw=1,Rg.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Rg}var ea={},Dw;function VN(){if(Dw)return ea;Dw=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let s="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";s=s.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+s+`)(?:.|[\r
639
- ]))+`;ea.KANJI=new RegExp(s,"g"),ea.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),ea.BYTE=new RegExp(o,"g"),ea.NUMERIC=new RegExp(e,"g"),ea.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+s+"$"),c=new RegExp("^"+e+"$"),u=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return ea.testKanji=function(m){return l.test(m)},ea.testNumeric=function(m){return c.test(m)},ea.testAlphanumeric=function(m){return u.test(m)},ea}var Lw;function zo(){return Lw||(Lw=1,(function(e){const t=HN(),s=VN();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(c,u){if(!c.ccBits)throw new Error("Invalid mode: "+c);if(!t.isValid(u))throw new Error("Invalid version: "+u);return u>=1&&u<10?c.ccBits[0]:u<27?c.ccBits[1]:c.ccBits[2]},e.getBestModeForData=function(c){return s.testNumeric(c)?e.NUMERIC:s.testAlphanumeric(c)?e.ALPHANUMERIC:s.testKanji(c)?e.KANJI:e.BYTE},e.toString=function(c){if(c&&c.id)return c.id;throw new Error("Invalid mode")},e.isValid=function(c){return c&&c.bit&&c.ccBits};function o(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(c,u){if(e.isValid(c))return c;try{return o(c)}catch{return u}}})(Eg)),Eg}var Pw;function b7(){return Pw||(Pw=1,(function(e){const t=Oo(),s=UN(),o=y_(),l=zo(),c=HN(),u=7973,p=t.getBCHDigit(u);function m(v,k,E){for(let y=1;y<=40;y++)if(k<=e.getCapacity(y,E,v))return y}function h(v,k){return l.getCharCountIndicator(v,k)+4}function g(v,k){let E=0;return v.forEach(function(y){const j=h(y.mode,k);E+=j+y.getBitsLength()}),E}function b(v,k){for(let E=1;E<=40;E++)if(g(v,E)<=e.getCapacity(E,k,l.MIXED))return E}e.from=function(k,E){return c.isValid(k)?parseInt(k,10):E},e.getCapacity=function(k,E,y){if(!c.isValid(k))throw new Error("Invalid QR Code version");typeof y>"u"&&(y=l.BYTE);const j=t.getSymbolTotalCodewords(k),C=s.getTotalCodewordsCount(k,E),S=(j-C)*8;if(y===l.MIXED)return S;const N=S-h(y,k);switch(y){case l.NUMERIC:return Math.floor(N/10*3);case l.ALPHANUMERIC:return Math.floor(N/11*2);case l.KANJI:return Math.floor(N/13);case l.BYTE:default:return Math.floor(N/8)}},e.getBestVersionForData=function(k,E){let y;const j=o.from(E,o.M);if(Array.isArray(k)){if(k.length>1)return b(k,j);if(k.length===0)return 1;y=k[0]}else y=k;return m(y.mode,y.getLength(),j)},e.getEncodedBits=function(k){if(!c.isValid(k)||k<7)throw new Error("Invalid QR Code version");let E=k<<12;for(;t.getBCHDigit(E)-p>=0;)E^=u<<t.getBCHDigit(E)-p;return k<<12|E}})(Ng)),Ng}var Tg={},Iw;function _7(){if(Iw)return Tg;Iw=1;const e=Oo(),t=1335,s=21522,o=e.getBCHDigit(t);return Tg.getEncodedBits=function(c,u){const p=c.bit<<3|u;let m=p<<10;for(;e.getBCHDigit(m)-o>=0;)m^=t<<e.getBCHDigit(m)-o;return(p<<10|m)^s},Tg}var Ag={},Mg,Bw;function v7(){if(Bw)return Mg;Bw=1;const e=zo();function t(s){this.mode=e.NUMERIC,this.data=s.toString()}return t.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(o){let l,c,u;for(l=0;l+3<=this.data.length;l+=3)c=this.data.substr(l,3),u=parseInt(c,10),o.put(u,10);const p=this.data.length-l;p>0&&(c=this.data.substr(l),u=parseInt(c,10),o.put(u,p*3+1))},Mg=t,Mg}var Og,Uw;function y7(){if(Uw)return Og;Uw=1;const e=zo(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(o){this.mode=e.ALPHANUMERIC,this.data=o}return s.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(l){let c;for(c=0;c+2<=this.data.length;c+=2){let u=t.indexOf(this.data[c])*45;u+=t.indexOf(this.data[c+1]),l.put(u,11)}this.data.length%2&&l.put(t.indexOf(this.data[c]),6)},Og=s,Og}var zg,Hw;function j7(){if(Hw)return zg;Hw=1;const e=zo();function t(s){this.mode=e.BYTE,typeof s=="string"?this.data=new TextEncoder().encode(s):this.data=new Uint8Array(s)}return t.getBitsLength=function(o){return o*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(s){for(let o=0,l=this.data.length;o<l;o++)s.put(this.data[o],8)},zg=t,zg}var Dg,Vw;function w7(){if(Vw)return Dg;Vw=1;const e=zo(),t=Oo();function s(o){this.mode=e.KANJI,this.data=o}return s.getBitsLength=function(l){return l*13},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(o){let l;for(l=0;l<this.data.length;l++){let c=t.toSJIS(this.data[l]);if(c>=33088&&c<=40956)c-=33088;else if(c>=57408&&c<=60351)c-=49472;else throw new Error("Invalid SJIS character: "+this.data[l]+`
640
- Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},Dg=s,Dg}var Lg={exports:{}},qw;function k7(){return qw||(qw=1,(function(e){var t={single_source_shortest_paths:function(s,o,l){var c={},u={};u[o]=0;var p=t.PriorityQueue.make();p.push(o,0);for(var m,h,g,b,v,k,E,y,j;!p.empty();){m=p.pop(),h=m.value,b=m.cost,v=s[h]||{};for(g in v)v.hasOwnProperty(g)&&(k=v[g],E=b+k,y=u[g],j=typeof u[g]>"u",(j||y>E)&&(u[g]=E,p.push(g,E),c[g]=h))}if(typeof l<"u"&&typeof u[l]>"u"){var C=["Could not find a path from ",o," to ",l,"."].join("");throw new Error(C)}return c},extract_shortest_path_from_predecessor_list:function(s,o){for(var l=[],c=o;c;)l.push(c),s[c],c=s[c];return l.reverse(),l},find_path:function(s,o,l){var c=t.single_source_shortest_paths(s,o,l);return t.extract_shortest_path_from_predecessor_list(c,l)},PriorityQueue:{make:function(s){var o=t.PriorityQueue,l={},c;s=s||{};for(c in o)o.hasOwnProperty(c)&&(l[c]=o[c]);return l.queue=[],l.sorter=s.sorter||o.default_sorter,l},default_sorter:function(s,o){return s.cost-o.cost},push:function(s,o){var l={value:s,cost:o};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Lg)),Lg.exports}var $w;function S7(){return $w||($w=1,(function(e){const t=zo(),s=v7(),o=y7(),l=j7(),c=w7(),u=VN(),p=Oo(),m=k7();function h(C){return unescape(encodeURIComponent(C)).length}function g(C,S,N){const R=[];let M;for(;(M=C.exec(N))!==null;)R.push({data:M[0],index:M.index,mode:S,length:M[0].length});return R}function b(C){const S=g(u.NUMERIC,t.NUMERIC,C),N=g(u.ALPHANUMERIC,t.ALPHANUMERIC,C);let R,M;return p.isKanjiModeEnabled()?(R=g(u.BYTE,t.BYTE,C),M=g(u.KANJI,t.KANJI,C)):(R=g(u.BYTE_KANJI,t.BYTE,C),M=[]),S.concat(N,R,M).sort(function(z,D){return z.index-D.index}).map(function(z){return{data:z.data,mode:z.mode,length:z.length}})}function v(C,S){switch(S){case t.NUMERIC:return s.getBitsLength(C);case t.ALPHANUMERIC:return o.getBitsLength(C);case t.KANJI:return c.getBitsLength(C);case t.BYTE:return l.getBitsLength(C)}}function k(C){return C.reduce(function(S,N){const R=S.length-1>=0?S[S.length-1]:null;return R&&R.mode===N.mode?(S[S.length-1].data+=N.data,S):(S.push(N),S)},[])}function E(C){const S=[];for(let N=0;N<C.length;N++){const R=C[N];switch(R.mode){case t.NUMERIC:S.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:S.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:S.push([R,{data:R.data,mode:t.BYTE,length:h(R.data)}]);break;case t.BYTE:S.push([{data:R.data,mode:t.BYTE,length:h(R.data)}])}}return S}function y(C,S){const N={},R={start:{}};let M=["start"];for(let T=0;T<C.length;T++){const z=C[T],D=[];for(let U=0;U<z.length;U++){const L=z[U],H=""+T+U;D.push(H),N[H]={node:L,lastCount:0},R[H]={};for(let O=0;O<M.length;O++){const P=M[O];N[P]&&N[P].node.mode===L.mode?(R[P][H]=v(N[P].lastCount+L.length,L.mode)-v(N[P].lastCount,L.mode),N[P].lastCount+=L.length):(N[P]&&(N[P].lastCount=L.length),R[P][H]=v(L.length,L.mode)+4+t.getCharCountIndicator(L.mode,S))}}M=D}for(let T=0;T<M.length;T++)R[M[T]].end=0;return{map:R,table:N}}function j(C,S){let N;const R=t.getBestModeForData(C);if(N=t.from(S,R),N!==t.BYTE&&N.bit<R.bit)throw new Error('"'+C+'" cannot be encoded with mode '+t.toString(N)+`.
641
- Suggested mode is: `+t.toString(R));switch(N===t.KANJI&&!p.isKanjiModeEnabled()&&(N=t.BYTE),N){case t.NUMERIC:return new s(C);case t.ALPHANUMERIC:return new o(C);case t.KANJI:return new c(C);case t.BYTE:return new l(C)}}e.fromArray=function(S){return S.reduce(function(N,R){return typeof R=="string"?N.push(j(R,null)):R.data&&N.push(j(R.data,R.mode)),N},[])},e.fromString=function(S,N){const R=b(S,p.isKanjiModeEnabled()),M=E(R),T=y(M,N),z=m.find_path(T.map,"start","end"),D=[];for(let U=1;U<z.length-1;U++)D.push(T.table[z[U]].node);return e.fromArray(k(D))},e.rawSplit=function(S){return e.fromArray(b(S,p.isKanjiModeEnabled()))}})(Ag)),Ag}var Fw;function C7(){if(Fw)return bg;Fw=1;const e=Oo(),t=y_(),s=u7(),o=d7(),l=f7(),c=p7(),u=m7(),p=UN(),m=x7(),h=b7(),g=_7(),b=zo(),v=S7();function k(T,z){const D=T.size,U=c.getPositions(z);for(let L=0;L<U.length;L++){const H=U[L][0],O=U[L][1];for(let P=-1;P<=7;P++)if(!(H+P<=-1||D<=H+P))for(let B=-1;B<=7;B++)O+B<=-1||D<=O+B||(P>=0&&P<=6&&(B===0||B===6)||B>=0&&B<=6&&(P===0||P===6)||P>=2&&P<=4&&B>=2&&B<=4?T.set(H+P,O+B,!0,!0):T.set(H+P,O+B,!1,!0))}}function E(T){const z=T.size;for(let D=8;D<z-8;D++){const U=D%2===0;T.set(D,6,U,!0),T.set(6,D,U,!0)}}function y(T,z){const D=l.getPositions(z);for(let U=0;U<D.length;U++){const L=D[U][0],H=D[U][1];for(let O=-2;O<=2;O++)for(let P=-2;P<=2;P++)O===-2||O===2||P===-2||P===2||O===0&&P===0?T.set(L+O,H+P,!0,!0):T.set(L+O,H+P,!1,!0)}}function j(T,z){const D=T.size,U=h.getEncodedBits(z);let L,H,O;for(let P=0;P<18;P++)L=Math.floor(P/3),H=P%3+D-8-3,O=(U>>P&1)===1,T.set(L,H,O,!0),T.set(H,L,O,!0)}function C(T,z,D){const U=T.size,L=g.getEncodedBits(z,D);let H,O;for(H=0;H<15;H++)O=(L>>H&1)===1,H<6?T.set(H,8,O,!0):H<8?T.set(H+1,8,O,!0):T.set(U-15+H,8,O,!0),H<8?T.set(8,U-H-1,O,!0):H<9?T.set(8,15-H-1+1,O,!0):T.set(8,15-H-1,O,!0);T.set(U-8,8,1,!0)}function S(T,z){const D=T.size;let U=-1,L=D-1,H=7,O=0;for(let P=D-1;P>0;P-=2)for(P===6&&P--;;){for(let B=0;B<2;B++)if(!T.isReserved(L,P-B)){let $=!1;O<z.length&&($=(z[O]>>>H&1)===1),T.set(L,P-B,$),H--,H===-1&&(O++,H=7)}if(L+=U,L<0||D<=L){L-=U,U=-U;break}}}function N(T,z,D){const U=new s;D.forEach(function(B){U.put(B.mode.bit,4),U.put(B.getLength(),b.getCharCountIndicator(B.mode,T)),B.write(U)});const L=e.getSymbolTotalCodewords(T),H=p.getTotalCodewordsCount(T,z),O=(L-H)*8;for(U.getLengthInBits()+4<=O&&U.put(0,4);U.getLengthInBits()%8!==0;)U.putBit(0);const P=(O-U.getLengthInBits())/8;for(let B=0;B<P;B++)U.put(B%2?17:236,8);return R(U,T,z)}function R(T,z,D){const U=e.getSymbolTotalCodewords(z),L=p.getTotalCodewordsCount(z,D),H=U-L,O=p.getBlocksCount(z,D),P=U%O,B=O-P,$=Math.floor(U/O),q=Math.floor(H/O),X=q+1,Y=$-q,F=new m(Y);let K=0;const I=new Array(O),G=new Array(O);let Z=0;const te=new Uint8Array(T.buffer);for(let pe=0;pe<O;pe++){const Me=pe<B?q:X;I[pe]=te.slice(K,K+Me),G[pe]=F.encode(I[pe]),K+=Me,Z=Math.max(Z,Me)}const de=new Uint8Array(U);let ee=0,ne,ae;for(ne=0;ne<Z;ne++)for(ae=0;ae<O;ae++)ne<I[ae].length&&(de[ee++]=I[ae][ne]);for(ne=0;ne<Y;ne++)for(ae=0;ae<O;ae++)de[ee++]=G[ae][ne];return de}function M(T,z,D,U){let L;if(Array.isArray(T))L=v.fromArray(T);else if(typeof T=="string"){let $=z;if(!$){const q=v.rawSplit(T);$=h.getBestVersionForData(q,D)}L=v.fromString(T,$||40)}else throw new Error("Invalid data");const H=h.getBestVersionForData(L,D);if(!H)throw new Error("The amount of data is too big to be stored in a QR Code");if(!z)z=H;else if(z<H)throw new Error(`
642
- The chosen QR Code version cannot contain this amount of data.
643
- Minimum version required to store current data is: `+H+`.
644
- `);const O=N(z,D,L),P=e.getSymbolSize(z),B=new o(P);return k(B,z),E(B),y(B,z),C(B,D,0),z>=7&&j(B,z),S(B,O),isNaN(U)&&(U=u.getBestMask(B,C.bind(null,B,D))),u.applyMask(U,B),C(B,D,U),{modules:B,version:z,errorCorrectionLevel:D,maskPattern:U,segments:L}}return bg.create=function(z,D){if(typeof z>"u"||z==="")throw new Error("No input text");let U=t.M,L,H;return typeof D<"u"&&(U=t.from(D.errorCorrectionLevel,t.M),L=h.from(D.version),H=u.from(D.maskPattern),D.toSJISFunc&&e.setToSJISFunction(D.toSJISFunc)),M(z,L,U,H)},bg}var Pg={},Ig={},Gw;function qN(){return Gw||(Gw=1,(function(e){function t(s){if(typeof s=="number"&&(s=s.toString()),typeof s!="string")throw new Error("Color should be defined as hex string");let o=s.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+s);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(c){return[c,c]}))),o.length===6&&o.push("F","F");const l=parseInt(o.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+o.slice(0,6).join("")}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const l=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,c=o.width&&o.width>=21?o.width:void 0,u=o.scale||4;return{width:c,scale:c?4:u,margin:l,color:{dark:t(o.color.dark||"#000000ff"),light:t(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(o,l){return l.width&&l.width>=o+l.margin*2?l.width/(o+l.margin*2):l.scale},e.getImageWidth=function(o,l){const c=e.getScale(o,l);return Math.floor((o+l.margin*2)*c)},e.qrToImageData=function(o,l,c){const u=l.modules.size,p=l.modules.data,m=e.getScale(u,c),h=Math.floor((u+c.margin*2)*m),g=c.margin*m,b=[c.color.light,c.color.dark];for(let v=0;v<h;v++)for(let k=0;k<h;k++){let E=(v*h+k)*4,y=c.color.light;if(v>=g&&k>=g&&v<h-g&&k<h-g){const j=Math.floor((v-g)/m),C=Math.floor((k-g)/m);y=b[p[j*u+C]?1:0]}o[E++]=y.r,o[E++]=y.g,o[E++]=y.b,o[E]=y.a}}})(Ig)),Ig}var Yw;function N7(){return Yw||(Yw=1,(function(e){const t=qN();function s(l,c,u){l.clearRect(0,0,c.width,c.height),c.style||(c.style={}),c.height=u,c.width=u,c.style.height=u+"px",c.style.width=u+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(c,u,p){let m=p,h=u;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),u||(h=o()),m=t.getOptions(m);const g=t.getImageWidth(c.modules.size,m),b=h.getContext("2d"),v=b.createImageData(g,g);return t.qrToImageData(v.data,c,m),s(b,h,g),b.putImageData(v,0,0),h},e.renderToDataURL=function(c,u,p){let m=p;typeof m>"u"&&(!u||!u.getContext)&&(m=u,u=void 0),m||(m={});const h=e.render(c,u,m),g=m.type||"image/png",b=m.rendererOpts||{};return h.toDataURL(g,b.quality)}})(Pg)),Pg}var Bg={},Kw;function E7(){if(Kw)return Bg;Kw=1;const e=qN();function t(l,c){const u=l.a/255,p=c+'="'+l.hex+'"';return u<1?p+" "+c+'-opacity="'+u.toFixed(2).slice(1)+'"':p}function s(l,c,u){let p=l+c;return typeof u<"u"&&(p+=" "+u),p}function o(l,c,u){let p="",m=0,h=!1,g=0;for(let b=0;b<l.length;b++){const v=Math.floor(b%c),k=Math.floor(b/c);!v&&!h&&(h=!0),l[b]?(g++,b>0&&v>0&&l[b-1]||(p+=h?s("M",v+u,.5+k+u):s("m",m,0),m=0,h=!1),v+1<c&&l[b+1]||(p+=s("h",g),g=0)):m++}return p}return Bg.render=function(c,u,p){const m=e.getOptions(u),h=c.modules.size,g=c.modules.data,b=h+m.margin*2,v=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+b+"v"+b+'H0z"/>':"",k="<path "+t(m.color.dark,"stroke")+' d="'+o(g,h,m.margin)+'"/>',E='viewBox="0 0 '+b+" "+b+'"',j='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+E+' shape-rendering="crispEdges">'+v+k+`</svg>
645
- `;return typeof p=="function"&&p(null,j),j},Bg}var Xw;function R7(){if(Xw)return wl;Xw=1;const e=c7(),t=C7(),s=N7(),o=E7();function l(c,u,p,m,h){const g=[].slice.call(arguments,1),b=g.length,v=typeof g[b-1]=="function";if(!v&&!e())throw new Error("Callback required as last argument");if(v){if(b<2)throw new Error("Too few arguments provided");b===2?(h=p,p=u,u=m=void 0):b===3&&(u.getContext&&typeof h>"u"?(h=m,m=void 0):(h=m,m=p,p=u,u=void 0))}else{if(b<1)throw new Error("Too few arguments provided");return b===1?(p=u,u=m=void 0):b===2&&!u.getContext&&(m=p,p=u,u=void 0),new Promise(function(k,E){try{const y=t.create(p,m);k(c(y,u,m))}catch(y){E(y)}})}try{const k=t.create(p,m);h(null,c(k,u,m))}catch(k){h(k)}}return wl.create=t.create,wl.toCanvas=l.bind(null,s.render),wl.toDataURL=l.bind(null,s.renderToDataURL),wl.toString=l.bind(null,function(c,u,p){return o.render(c,p)}),wl}var T7=R7();const A7=Dx(T7);function M7({value:e,size:t=200}){const[s,o]=x.useState(null);return x.useEffect(()=>{let l=!0;return A7.toDataURL(e,{margin:2,width:t*2,errorCorrectionLevel:"M"}).then(c=>{l&&o(c)}).catch(()=>{l&&o(null)}),()=>{l=!1}},[e,t]),r.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:t+24,height:t+24},children:s?r.jsx("img",{src:s,width:t,height:t,alt:"QR"}):r.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function O7(e){return e.find(t=>!t.includes("127.0.0.1")&&!t.includes("localhost"))||e[0]||window.location.origin}function z7({open:e,onClose:t,onPaired:s}){const o=ot(),[l,c]=x.useState(null),[u,p]=x.useState(null),[m,h]=x.useState(0),[g,b]=x.useState(!1),v=x.useRef(null),k=x.useCallback(async()=>{c(null),p(null),b(!1);try{const S=await Yl.init();c(S),h(Math.round((S.ttl_ms||9e4)/1e3))}catch(S){S instanceof Qc&&S.status===403?p(f("settings.devices_pair_localhost_only")):p(S.message)}},[]);x.useEffect(()=>{e?k():(c(null),p(null),b(!1))},[e,k]),x.useEffect(()=>{if(!l||g||m<=0)return;const S=window.setTimeout(()=>h(N=>N-1),1e3);return()=>window.clearTimeout(S)},[l,m,g]),x.useEffect(()=>{if(!e||!l||g)return;let S=!0;const N=async()=>{try{const R=await Yl.status(l.pairing_id);if(!S)return;if(R.status==="confirmed"){b(!0),o.success(f("settings.devices_pair_done")),s(),window.setTimeout(()=>{S&&t()},900);return}if(R.status==="expired"||R.status==="unknown"){h(0);return}}catch{}v.current=window.setTimeout(N,1500)};return v.current=window.setTimeout(N,1500),()=>{S=!1,v.current&&window.clearTimeout(v.current)}},[e,l,g,t,s,o]);const E=!!l&&!g&&m<=0,y=l?O7(l.lan_urls):"",j=l?`${y}/#pair=${l.pairing_id}`:"",C=async(S,N)=>{try{await navigator.clipboard.writeText(S),o.success(N)}catch{o.error(S)}};return r.jsxs(Sn,{open:e,onClose:t,title:f("settings.devices_pair_title"),description:f("settings.devices_pair_desc"),footer:r.jsx(ce,{variant:"secondary",onClick:t,children:f("common.close")}),children:[u&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:u}),!u&&!l&&r.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[r.jsx(us,{})," ",f("common.loading")]}),!u&&l&&r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx("div",{className:E?"opacity-40":"",children:r.jsx(M7,{value:j,size:196})}),g?r.jsx("p",{className:"text-sm font-medium text-emerald-500",children:f("settings.devices_pair_done")}):E?r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("p",{className:"text-sm text-muted-fg",children:f("settings.devices_pair_expired")}),r.jsx(ce,{variant:"primary",onClick:()=>void k(),children:f("settings.devices_pair_regen")})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-center text-xs text-muted-fg",children:f("settings.devices_pair_scan")}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(us,{size:12}),r.jsx("span",{children:f("settings.devices_pair_waiting")}),r.jsxs("span",{className:"tabular-nums",children:["· ",f("settings.devices_pair_expires",{s:m})]})]}),r.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("settings.devices_pair_link")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:j}),r.jsx(Ge,{content:f("settings.devices_pair_copy"),children:r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>C(j,f("settings.devices_pair_copied")),children:r.jsx(Rc,{size:14})})})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("settings.devices_pair_code")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-center text-sm",children:l.pairing_id}),r.jsx(Ge,{content:f("settings.devices_pair_copy"),children:r.jsx(ce,{size:"sm",variant:"secondary",onClick:()=>C(l.pairing_id,f("settings.devices_pair_copied_code")),children:r.jsx(Rc,{size:14})})})]})]})]})]})]})]})}function D7(){const e=ot(),{clients:t,isLoading:s,mutate:o}=i7(),[l,c]=x.useState(!1),[u,p]=x.useState(""),m=async g=>{if(confirm(f("settings.devices_revoke_confirm",{id:g})))try{await Yl.revoke(g),e.success(f("settings.devices_revoke_success")),o()}catch(b){e.error(b.message)}},h=()=>{const g=u.trim();if(g){po(g);try{localStorage.setItem(An.token,g)}catch{}p(""),e.success(f("settings.token_saved"))}};return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{title:f("settings.devices"),description:f("settings.devices_sub"),action:r.jsxs(ce,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[r.jsx(WM,{size:14})," ",f("settings.devices_pair_btn")]}),children:[s&&r.jsx(rt,{}),!s&&t.length===0&&r.jsx(bt,{children:f("settings.devices_empty")}),t.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:t.map(g=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-medium",children:g.label||g.id}),r.jsx($e,{tone:g.kind==="web"?"info":g.kind==="deck"?"success":"muted",children:g.kind}),r.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",g.token_suffix]}),r.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[f("settings.devices_last_seen")," ",g.last_seen?new Date(g.last_seen).toLocaleString():f("settings.devices_never")]}),r.jsx(ce,{size:"sm",variant:"destructive",onClick:()=>m(g.id),children:f("settings.devices_revoke")})]},g.id))}),r.jsx(z7,{open:l,onClose:()=>c(!1),onPaired:()=>o()})]}),r.jsxs(Ye,{title:f("settings.token"),description:f("settings.token_sub"),children:[r.jsx(ie,{label:f("settings_ui.bearer_label"),children:r.jsx(Ee,{type:"password",placeholder:Qb()?f("settings.token_active"):f("settings.token_paste"),value:u,onChange:g=>p(g.target.value),className:"font-mono",onKeyDown:g=>{g.key==="Enter"&&h()}})}),r.jsx("div",{className:"mt-2",children:r.jsx(ce,{variant:"primary",onClick:h,children:f("common.save")})})]})]})}const L7=[{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:Qx.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 P7(){const{config:e,isLoading:t,patch:s,mutate:o}=qr();if(t)return r.jsx(rt,{});const l=async c=>{const u={};for(const[p,m]of Object.entries(f_(c)))is(m)||(u[p]=m);await s(u),o()};return r.jsx(Ye,{title:f("global_config.title"),description:f("settings_ui.global_config_desc"),children:r.jsx(kx,{sections:L7,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:f("settings_ui.global_json_desc"),onSaveFields:async(c,u)=>{await s(c,u),o()},onSaveJson:l})})}function I7(){const e=ot(),{health:t,isUp:s}=BC(),o=async()=>{try{await Gl.reload(),e.success(f("settings.advanced.reload_success"))}catch(l){e.error(l.message)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ye,{title:f("daemon.version"),action:r.jsx(ce,{size:"sm",onClick:o,children:f("common.reload")}),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(Ug,{label:f("daemon.version"),value:t?.version||"—"}),r.jsx(Ug,{label:f("daemon.uptime"),value:t?`${t.uptime_s}s`:"—"}),r.jsx(Ug,{label:f("daemon.status"),value:f(s?"daemon.running":"daemon.down"),ok:s})]})}),r.jsx(P7,{})]})}function Ug({label:e,value:t,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(Zc,{ok:s}),r.jsx("span",{children:t})]})]})}function B7(){const{preference:e,set:t}=Wx(),[s,o]=x.useState(Gb()),l=c=>{fC(c),o(c),window.location.reload()};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ye,{title:f("settings.appearance"),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ce,{variant:e==="light"?"primary":"secondary",onClick:()=>t("light"),children:f("settings.light_mode")}),r.jsx(ce,{variant:e==="dark"?"primary":"secondary",onClick:()=>t("dark"),children:f("settings.dark_mode")}),r.jsx(ce,{variant:e==="system"?"primary":"secondary",onClick:()=>t("system"),children:f("settings.system_mode")})]})}),r.jsx(Ye,{title:f("settings.language"),children:r.jsx("div",{className:"flex items-center gap-2",children:pC.map(c=>r.jsx(ce,{variant:s===c.value?"primary":"secondary",onClick:()=>l(c.value),children:c.label},c.value))})})]})}function U7({className:e,...t}){return r.jsx("kbd",{"data-slot":"kbd",className:Ct("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 Ax=typeof navigator<"u"&&/mac/i.test(navigator.platform||"");function H7(e){return(Ax?{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 V7(e){return(e||"").split("+").map(t=>t.trim()).filter(Boolean)}function q7(e){const t=e.code;if(/^(Shift|Control|Alt|Meta|OS)(Left|Right)?$/.test(t))return null;let s;if((s=t.match(/^Key([A-Z])$/))||(s=t.match(/^Digit(\d)$/))||(s=t.match(/^Numpad(\d)$/))||(s=t.match(/^(F\d{1,2})$/))||(s=t.match(/^Arrow(Up|Down|Left|Right)$/)))return s[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 $7(e){const t=q7(e);if(!t)return null;const s=[];(Ax?e.metaKey:e.ctrlKey)&&s.push("CommandOrControl"),Ax&&e.ctrlKey&&s.push("Control"),e.altKey&&s.push("Alt"),e.shiftKey&&s.push("Shift");const o=s.length>0,l=/^F\d{1,2}$/.test(t);return!o&&!l?null:(s.push(t),s.join("+"))}function F7({value:e,onChange:t,disabled:s,className:o,trailing:l}){const[c,u]=x.useState(!1),p=x.useRef(null);x.useEffect(()=>{if(!c)return;const h=g=>{if(g.preventDefault(),g.stopPropagation(),g.key==="Escape"){u(!1);return}const b=$7(g);b&&(t(b),u(!1))};return window.addEventListener("keydown",h,!0),()=>window.removeEventListener("keydown",h,!0)},[c,t]);const m=V7(e);return r.jsxs("div",{className:Te("flex h-9 w-full max-w-md items-center rounded-md border border-border bg-transparent transition",c&&"ring-2 ring-ring",s&&"opacity-50",o),children:[r.jsxs("button",{ref:p,type:"button",disabled:s,onClick:()=>u(h=>!h),onBlur:()=>u(!1),"aria-label":f("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?r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.desktop_shortcut_recording")}):m.length?r.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:m.map((h,g)=>r.jsxs("span",{className:"flex items-center gap-1",children:[g>0&&r.jsx("span",{className:"text-xs text-muted-fg",children:"+"}),r.jsx(U7,{className:"h-6 min-w-6 border border-border bg-muted px-1.5 text-[13px] font-semibold text-fg shadow-sm",children:H7(h)})]},g))}):r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.desktop_shortcut_record")}),r.jsx("span",{className:"ml-auto whitespace-nowrap pl-2 text-xs text-muted-fg",children:f(c?"modules_ui.desktop_shortcut_esc":"modules_ui.desktop_shortcut_change")})]}),l?r.jsx("div",{className:"flex h-full items-center border-l border-border px-1",children:l}):null]})}const Nl={status:()=>he.get("/desktop/status"),start:()=>he.post("/desktop/start",{}),stop:()=>he.post("/desktop/stop",{}),restart:()=>he.post("/desktop/restart",{}),autostartGet:()=>he.get("/desktop/autostart"),autostartSet:e=>he.post("/desktop/autostart",{enable:e})};function G7(e=30){return he.get(`/messages/global?channel=desktop&limit=${e}`)}function $N({showConfigLink:e=!1}){const t=ot(),{data:s,isLoading:o,mutate:l}=We("/desktop/status",()=>Nl.status(),{refreshInterval:5e3}),c=!!s?.running,[u,p]=x.useState(null),m=async(v,k)=>{p(v);try{await k()}catch(E){t.error(E.message)}finally{p(null),setTimeout(()=>l(),1200)}},h=()=>m("start",async()=>{const v=await Nl.start();t.success(v.already?f("modules_ui.desktop_start_already"):f("modules_ui.desktop_start_done"))}),g=()=>m("stop",async()=>{const v=await Nl.stop();t.success(v.stopped?f("modules_ui.desktop_stop_done"):f("modules_ui.desktop_stop_none"))}),b=()=>m("restart",async()=>{(await Nl.restart()).reloaded>0?t.success(f("modules_ui.desktop_restart_done")):t.info(f("modules_ui.desktop_restart_none"))});return r.jsx(Ye,{title:f("desktop_screen.status_title"),description:f("modules_ui.desktop_status_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ce,{variant:"primary",size:"sm",onClick:h,loading:u==="start",disabled:c||u!==null&&u!=="start",children:f("modules_ui.desktop_start")}),r.jsx(ce,{variant:"secondary",size:"sm",onClick:g,loading:u==="stop",disabled:!c||u!==null&&u!=="stop",children:f("modules_ui.desktop_stop")}),r.jsx(ce,{variant:"secondary",size:"sm",onClick:b,loading:u==="restart",disabled:!c||u!==null&&u!=="restart",title:f("modules_ui.desktop_restart_hint"),children:f("modules_ui.desktop_restart")}),e&&r.jsx(Tf,{to:"/settings/desktop",children:r.jsxs(ce,{size:"sm",variant:"ghost",children:[r.jsx(Tc,{size:14})," ",f("desktop_screen.open_config")]})})]}),children:o?r.jsx(rt,{}):r.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[r.jsx(Zc,{ok:c}),r.jsx("span",{className:"font-medium",children:f(c?"modules_ui.desktop_running":"modules_ui.desktop_stopped")}),r.jsx("button",{type:"button",onClick:()=>l(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:f("modules_ui.desktop_refresh")}),r.jsxs("span",{className:"text-xs text-muted-fg",children:["(",f("modules_ui.desktop_from_terminal")," ",r.jsx(Vj,{children:"apx desktop start"})," · ",r.jsx(Vj,{children:"apx desktop --debug"}),")"]})]})})}const Y7="CommandOrControl+G",K7=()=>[{value:"left",label:f("modules_ui.desktop_pos_left")},{value:"center",label:f("modules_ui.desktop_pos_center")},{value:"right",label:f("modules_ui.desktop_pos_right")}],X7=()=>[{value:"system",label:f("modules_ui.desktop_theme_system")},{value:"light",label:f("modules_ui.desktop_theme_light")},{value:"dark",label:f("modules_ui.desktop_theme_dark")}];function Q7(){const e=ot(),{config:t,isLoading:s,patch:o}=qr(),l=t,c=l.desktop?.shortcut||l.overlay?.shortcut||Y7,u=l.desktop?.enabled!==!1,p=l.desktop?.theme||"system",m=l.desktop?.position||"right",{data:h,mutate:g}=We("/desktop/autostart",()=>Nl.autostartGet()),[b,v]=x.useState(c),[k,E]=x.useState(!1),[y,j]=x.useState(!1);x.useEffect(()=>v(c),[c]);const C=async()=>{const R=b.trim();if(!(!R||R===c)){E(!0);try{await o({"desktop.shortcut":R}),e.success(f("modules_ui.desktop_shortcut_saved"))}catch(M){e.error(M.message)}finally{E(!1)}}},S=async(R,M,T)=>{E(!0);try{await o({[R]:M}),e.success(T)}catch(z){e.error(z.message)}finally{E(!1)}},N=async R=>{j(!0);try{await Nl.autostartSet(R),await g(),e.success(f(R?"modules_ui.desktop_autostart_on":"modules_ui.desktop_autostart_off"))}catch(M){e.error(M.message)}finally{j(!1)}};return r.jsxs("div",{className:"space-y-6","data-testid":"settings-desktop",children:[r.jsx($N,{}),r.jsx(Ye,{title:f("desktop_screen.autostart_title"),description:f("modules_ui.desktop_autostart_desc"),children:h?r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Qt,{checked:h.enabled,onChange:N,disabled:y,label:h.enabled?f("common.enabled"):f("common.disabled")}),r.jsx("span",{className:"text-xs text-muted-fg",children:f("modules_ui.desktop_platform",{platform:h.platform})})]}):r.jsx(rt,{})}),r.jsx(Ye,{title:f("desktop_screen.shortcut_title"),description:f("modules_ui.desktop_shortcut_desc"),children:s?r.jsx(rt,{}):r.jsx(ie,{label:f("modules_ui.desktop_accelerator"),hint:f("modules_ui.desktop_accelerator_hint"),children:r.jsx(F7,{value:b,onChange:v,disabled:k,trailing:r.jsx(ce,{variant:"primary",size:"sm",onClick:C,loading:k,disabled:!b.trim()||b.trim()===c,children:f("common.save")})})})}),r.jsx(Ye,{title:f("desktop_screen.appearance_title"),description:f("modules_ui.desktop_appearance_desc"),children:s?r.jsx(rt,{}):r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ie,{label:f("modules_ui.desktop_theme"),hint:f("modules_ui.desktop_restart_apply"),children:r.jsx(_t,{value:p,onChange:R=>S("desktop.theme",R,f("modules_ui.desktop_theme_set",{value:R})),options:X7(),disabled:k})}),r.jsx(ie,{label:f("modules_ui.desktop_position"),hint:f("modules_ui.desktop_position_hint"),children:r.jsx(_t,{value:m,onChange:R=>S("desktop.position",R,f("modules_ui.desktop_position_set",{value:R})),options:K7(),disabled:k})})]})}),r.jsx(Ye,{title:f("desktop_screen.activation_title"),description:f("modules_ui.desktop_activation_desc"),children:s?r.jsx(rt,{}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(Qt,{checked:u,onChange:R=>S("desktop.enabled",R,f(R?"modules_ui.desktop_enabled_toast":"modules_ui.desktop_disabled_toast")),disabled:k,label:f(u?"modules_ui.desktop_plugin_on":"modules_ui.desktop_plugin_off")}),r.jsxs("p",{className:"text-xs text-muted-fg",children:[f("modules_ui.desktop_stt_engine")," ",r.jsx(Tf,{to:"/settings/voice",className:"font-medium text-fg underline underline-offset-2",children:f("nav.modules.voice")})," ",f("modules_ui.desktop_stt_engine_suffix")]})]})})]})}function W7({engines:e,order:t,onToggleEnabled:s,onToggleEmotions:o,onReorder:l,onConfigure:c,onRemove:u,onAddNew:p,busy:m}){const h=e.filter(k=>k.id!=="mock"),g=new Map(h.map(k=>[k.id,k])),b=[...t.filter(k=>g.has(k)),...h.map(k=>k.id).filter(k=>!t.includes(k))],v=(k,E)=>{const y=b.indexOf(k),j=y+E;if(y<0||j<0||j>=b.length)return;const C=[...b];[C[y],C[j]]=[C[j],C[y]],l(C)};return r.jsxs("div",{className:"space-y-2",children:[b.map((k,E)=>{const y=g.get(k),j=_f[k],C=y.custom?y.label||k:j?.name||k,S=y.custom?y.note||f("voice_ui.custom_note"):j?.note||"";return r.jsxs("div",{"data-testid":`voice-provider-${k}`,className:Te("flex items-center gap-3 rounded-lg border px-3 py-2.5 border-border",!y.enabled&&"opacity-60"),children:[r.jsxs("div",{className:"flex flex-col",children:[r.jsx("button",{type:"button",onClick:()=>v(k,-1),disabled:m||E===0,"aria-label":f("voice_ui.move_up"),"data-testid":`voice-provider-${k}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(Xk,{className:"size-3.5"})}),r.jsx("button",{type:"button",onClick:()=>v(k,1),disabled:m||E===b.length-1,"aria-label":f("voice_ui.move_down"),"data-testid":`voice-provider-${k}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(pa,{className:"size-3.5"})})]}),r.jsx(Zc,{ok:y.available?!0:y.configured?!1:null}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:C}),y.custom&&r.jsx($e,{tone:"info",children:f("voice_ui.badge_custom")}),j?.local&&r.jsx($e,{tone:"info",children:f("voice_ui.badge_local")}),y.available?r.jsx($e,{tone:"success",children:f("voice_ui.badge_available")}):y.configured?r.jsx($e,{tone:"warning",children:f("voice_ui.badge_unavailable")}):r.jsx($e,{tone:"muted",children:f("voice_ui.badge_not_configured")})]}),r.jsx("div",{className:"truncate text-xs text-muted-fg",children:S})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.emotionsApplicable&&r.jsx("button",{type:"button",onClick:()=>o(k,!y.emotionsOn),disabled:m,title:f("voice_ui.emotions_hint"),"data-testid":`voice-provider-${k}-emotions`,className:Te("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:f("voice_ui.emotions_short")}),r.jsx(Qt,{checked:y.enabled,onChange:N=>s(k,N),disabled:m}),r.jsxs(ce,{size:"sm",variant:"secondary",onClick:()=>c(k),"data-testid":`voice-provider-${k}-config`,children:[r.jsx(ZM,{className:"size-3.5"})," ",f("voice_ui.configure")]}),y.custom&&r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>u(k),disabled:m,"aria-label":f("voice_ui.remove"),"data-testid":`voice-provider-${k}-remove`,children:r.jsx(Gn,{className:"size-3.5"})})]})]},k)}),r.jsxs("button",{type:"button",onClick:p,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:[r.jsx(an,{className:"size-4"})," ",f("voice_ui.add_provider")]})]})}function wn(e){return typeof e=="string"?e:e==null?"":String(e)}function Z7(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Qw({on:e,setOn:t,tags:s,setTags:o}){return r.jsxs("div",{className:"rounded-md border border-border/60 p-3 space-y-2",children:[r.jsx(Qt,{checked:e,onChange:t,label:f("voice_ui.emotions_label")}),r.jsx("p",{className:"text-xs text-muted-fg",children:f("voice_ui.emotions_hint")}),e&&r.jsx(ie,{label:f("voice_ui.emotions_tags_label"),hint:f("voice_ui.emotions_tags_hint"),children:r.jsx(Ee,{value:s,onChange:l=>o(l.target.value),placeholder:ZD.join(", ")})})]})}function J7({open:e,providerId:t,config:s,onClose:o,onSave:l}){const[c,u]=x.useState(!1),[p,m]=x.useState(null),[h,g]=x.useState(""),[b,v]=x.useState({}),[k,E]=x.useState(!1),[y,j]=x.useState(""),[C,S]=x.useState(!1);if(x.useEffect(()=>{if(!e||!t)return;m(null),g("");const O=s||{},P=O.emotions;if(E(!!P?.enabled),j(Array.isArray(P?.tags)?P.tags.join(", "):""),S(!1),t==="__new__"||t.startsWith("custom:")){const $=O;v({label:wn($.label),base_url:wn($.base_url),model:wn($.model),voice:wn($.voice),format:wn($.format),style:wn($.style),temperature:wn($.temperature)})}else if(t==="piper"){const $=O;v({bin:wn($.bin),model:wn($.model),speaker:wn($.speaker)})}else if(t==="elevenlabs"){const $=O;v({model:wn($.model),voice_id:wn($.voice_id),output_format:wn($.output_format)})}else if(t==="openai"){const $=O;v({model:wn($.model)||"tts-1",voice:wn($.voice)||"alloy",format:wn($.format)||"mp3"})}else if(t==="gemini"){const $=O;v({model:wn($.model),voice:wn($.voice)||"Kore",style:wn($.style)})}else v({})},[e,t,s]),!t)return null;const N=t==="__new__",R=N||t.startsWith("custom:"),M=_f[t],T=O=>v(P=>({...P,...O})),z=t!=="piper"&&t!=="mock",D=z&&is(s?.api_key),U=D?f("voice_ui.api_key_set",{suffix:ko(s?.api_key)??""}):f("voice_ui.api_key_label"),L=N?f("voice_ui.new_provider"):R?b.label||t.slice(7):M?.name||t,H=async()=>{u(!0),m(null);try{const O=N?Z7(b.label):R?t.slice(7):"";if(R){if(!b.label.trim())throw new Error(f("voice_ui.err_label_required"));if(!b.base_url.trim())throw new Error(f("voice_ui.err_base_url_required"));if(!O)throw new Error(f("voice_ui.err_label_required"))}const P=R?`voice.tts.custom.${O}`:`voice.tts.${t}`,B={},$=[],q=(X,Y)=>{Y.trim()?B[`${P}.${X}`]=Y.trim():$.push(`${P}.${X}`)};if(R?(B[`${P}.label`]=b.label.trim(),B[`${P}.base_url`]=b.base_url.trim(),q("style",b.style),b.temperature.trim()&&!Number.isNaN(Number(b.temperature))?B[`${P}.temperature`]=Number(b.temperature):$.push(`${P}.temperature`),q("model",b.model),q("voice",b.voice)):t==="piper"?(q("bin",b.bin),q("model",b.model),b.speaker.trim()?B[`${P}.speaker`]=b.speaker.trim():$.push(`${P}.speaker`)):t==="elevenlabs"?(q("model",b.model),q("voice_id",b.voice_id),q("output_format",b.output_format)):t==="openai"?(q("model",b.model),q("voice",b.voice),q("format",b.format)):t==="gemini"&&(q("model",b.model),q("voice",b.voice),q("style",b.style)),R||t==="gemini"){B[`${P}.emotions.enabled`]=k;const X=y.split(",").map(Y=>Y.trim().toLowerCase()).filter(Boolean);X.length?B[`${P}.emotions.tags`]=X:$.push(`${P}.emotions.tags`)}z&&h.trim()&&(B[`${P}.api_key`]=h.trim()),await l({set:B,unset:$}),o()}catch(O){m(O.message||f("voice_ui.err_save"))}finally{u(!1)}};return r.jsx(Sn,{open:e,onClose:o,title:f("voice_screen.configure_provider",{name:L}),description:R?f("voice_ui.custom_desc"):M?.note,size:"md",footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:o,disabled:c,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:H,loading:c,"data-testid":"voice-provider-save",children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[t==="piper"&&r.jsxs(r.Fragment,{children:[r.jsx(ie,{label:f("voice_ui.piper_bin_label"),hint:f("voice_ui.piper_bin_hint"),children:r.jsx(Ee,{value:b.bin,onChange:O=>T({bin:O.target.value}),placeholder:"piper"})}),r.jsx(ie,{label:f("voice_ui.piper_model_label"),hint:f("voice_ui.piper_model_hint"),children:r.jsx(Ee,{value:b.model,onChange:O=>T({model:O.target.value}),placeholder:"/abs/path/voice.onnx"})}),r.jsx(ie,{label:f("voice_ui.piper_speaker_label"),hint:f("voice_ui.piper_speaker_hint"),children:r.jsx(Ee,{value:b.speaker,onChange:O=>T({speaker:O.target.value}),placeholder:"0"})})]}),t==="elevenlabs"&&r.jsxs(r.Fragment,{children:[r.jsx(ie,{label:f("voice_ui.api_key_label"),hint:D?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_secret_hint",{env:"ELEVENLABS_API_KEY"}),children:r.jsx(Ee,{type:"password",autoComplete:"new-password",value:h,onChange:O=>g(O.target.value),placeholder:U})}),r.jsx(ie,{label:f("voice_ui.model_label"),children:r.jsx(_t,{value:b.model||"",onChange:O=>T({model:O}),options:QD.map(O=>({value:O,label:O})),placeholder:"eleven_multilingual_v2"})}),r.jsx(ie,{label:f("voice_ui.voice_id_label"),hint:f("voice_ui.voice_id_hint"),children:r.jsx(Ee,{value:b.voice_id,onChange:O=>T({voice_id:O.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),r.jsx(ie,{label:f("voice_ui.output_format_label"),children:r.jsx(Ee,{value:b.output_format,onChange:O=>T({output_format:O.target.value}),placeholder:"mp3_44100_128"})})]}),t==="openai"&&r.jsxs(r.Fragment,{children:[r.jsx(ie,{label:f("voice_ui.api_key_label"),hint:D?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:r.jsx(Ee,{type:"password",autoComplete:"new-password",value:h,onChange:O=>g(O.target.value),placeholder:U})}),r.jsx(ie,{label:f("voice_ui.model_label"),children:r.jsx(_t,{value:b.model||"tts-1",onChange:O=>T({model:O}),options:WD.map(O=>({value:O,label:O}))})}),r.jsx(ie,{label:f("voice_ui.voice_label"),children:r.jsx(_t,{value:b.voice||"alloy",onChange:O=>T({voice:O}),options:KD.map(O=>({value:O,label:O}))})}),r.jsx(ie,{label:f("voice_ui.format_label"),children:r.jsx(_t,{value:b.format||"mp3",onChange:O=>T({format:O}),options:["mp3","opus","aac","flac","wav"].map(O=>({value:O,label:O}))})})]}),R&&r.jsxs(r.Fragment,{children:[r.jsx(ie,{label:f("voice_ui.label_label"),hint:f("voice_ui.label_hint"),children:r.jsx(Ee,{value:b.label,onChange:O=>T({label:O.target.value}),placeholder:"QVox"})}),r.jsx(ie,{label:f("voice_ui.base_url_req_label"),hint:f("voice_ui.base_url_req_hint"),children:r.jsx(Ee,{value:b.base_url,onChange:O=>T({base_url:O.target.value}),placeholder:"http://127.0.0.1:5111/v1"})}),r.jsx(ie,{label:f("voice_ui.api_key_label"),hint:f(D?"voice_ui.api_key_keep_hint":"voice_ui.api_key_optional_hint"),children:r.jsx(Ee,{type:"password",autoComplete:"new-password",value:h,onChange:O=>g(O.target.value),placeholder:U})}),r.jsx(ie,{label:f("voice_ui.style_label"),hint:f("voice_ui.openai_style_hint"),children:r.jsx(On,{rows:2,value:b.style||"",onChange:O=>T({style:O.target.value}),placeholder:f("voice_ui.style_ph")})}),r.jsx(ie,{label:f("voice_ui.temperature_label"),hint:f("voice_ui.temperature_hint"),children:r.jsx(Ee,{value:b.temperature,onChange:O=>T({temperature:O.target.value}),inputMode:"decimal",placeholder:"0.7"})}),r.jsx(Qw,{on:k,setOn:E,tags:y,setTags:j}),r.jsxs("div",{children:[r.jsxs("button",{type:"button",onClick:()=>S(O=>!O),className:"text-xs text-muted-fg hover:text-fg",children:[C?"▾ ":"▸ ",f("voice_ui.advanced")]}),C&&r.jsxs("div",{className:"mt-2 space-y-3",children:[r.jsx(ie,{label:f("voice_ui.model_label"),hint:f("voice_ui.custom_model_hint"),children:r.jsx(Ee,{value:b.model,onChange:O=>T({model:O.target.value}),placeholder:f("voice_ui.custom_optional_ph")})}),r.jsx(ie,{label:f("voice_ui.voice_label"),hint:f("voice_ui.custom_voice_hint"),children:r.jsx(Ee,{value:b.voice,onChange:O=>T({voice:O.target.value}),placeholder:f("voice_ui.custom_optional_ph")})})]})]})]}),t==="gemini"&&r.jsxs(r.Fragment,{children:[r.jsx(ie,{label:f("voice_ui.api_key_label"),hint:D?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.gemini.api_key",env:"GEMINI_API_KEY"}),children:r.jsx(Ee,{type:"password",autoComplete:"new-password",value:h,onChange:O=>g(O.target.value),placeholder:U})}),r.jsx(ie,{label:f("voice_ui.model_label"),hint:f("voice_ui.gemini_model_hint"),children:r.jsx(Ee,{value:b.model,onChange:O=>T({model:O.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),r.jsx(ie,{label:f("voice_ui.voice_label"),children:r.jsx(_t,{value:b.voice||"Kore",onChange:O=>T({voice:O}),options:XD.map(O=>({value:O,label:O}))})}),r.jsx(ie,{label:f("voice_ui.style_label"),hint:f("voice_ui.style_hint"),children:r.jsx(On,{rows:2,value:b.style||"",onChange:O=>T({style:O.target.value}),placeholder:f("voice_ui.style_ph")})}),r.jsx(Qw,{on:k,setOn:E,tags:y,setTags:j})]}),t==="mock"&&r.jsx("p",{className:"text-sm text-muted-fg",children:f("voice_ui.mock_desc")}),p&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p})]})})}function eB(){const e=x.useRef(null),t=x.useRef(null),[s,o]=x.useState(!1),[l,c]=x.useState(!1),u=x.useCallback(()=>{t.current&&(URL.revokeObjectURL(t.current),t.current=null)},[]);x.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),u()},[u]);const p=x.useCallback(async h=>{c(!0);try{u();const g=await eL(h);t.current=g,e.current||(e.current=new Audio);const b=e.current;b.src=g,b.onended=()=>o(!1),b.onerror=()=>o(!1),await b.play(),o(!0)}finally{c(!1)}},[u]),m=x.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),o(!1)},[]);return{play:p,stop:m,playing:s,loading:l}}function tB({engines:e,defaultProvider:t,mode:s}){const o=ot(),{play:l,stop:c,playing:u,loading:p}=eB(),[m,h]=x.useState(f("voice_ui.test_default_text")),[g,b]=x.useState(""),[v,k]=x.useState(!1),[E,y]=x.useState(null),C=[{value:"",label:s==="single"&&t&&t!=="auto"?f("voice_ui.test_default_engine",{name:_f[t]?.name||t}):f("voice_ui.test_default_chain")},...e.filter(N=>N.id!=="mock").map(N=>({value:N.id,label:N.custom?N.label||N.id:_f[N.id]?.name||N.id,disabled:!N.available}))],S=async()=>{const N=m.trim();if(!N){o.error(f("voice_ui.test_empty_error"));return}k(!0);try{const R=await vf.say({text:N,provider:g||void 0});y(R),await l(R.audio_path)}catch(R){o.error(R.message||f("voice_ui.test_synth_error"))}finally{k(!1)}};return r.jsxs("div",{className:"space-y-3",children:[r.jsx(ie,{label:f("voice_ui.test_engine_label"),hint:f("voice_ui.test_engine_hint"),children:r.jsx(_t,{value:g,onChange:b,options:C})}),r.jsx(ie,{label:f("voice_ui.test_text_label"),children:r.jsx(On,{rows:2,value:m,onChange:N=>h(N.target.value),placeholder:f("voice_ui.test_text_ph"),"data-testid":"voice-test-input"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ce,{variant:"primary",onClick:S,loading:v,disabled:p,"data-testid":"voice-test-say",children:[r.jsx(a3,{className:"size-4"})," ",f("voice_ui.say_this")]}),u?r.jsxs(ce,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[r.jsx(rS,{className:"size-4"})," ",f("voice_ui.stop")]}):E?r.jsxs(ce,{variant:"secondary",onClick:()=>l(E.audio_path),loading:p,"data-testid":"voice-test-replay",children:[r.jsx(Kx,{className:"size-4"})," ",f("voice_ui.replay")]}):null,E&&r.jsxs("span",{className:"text-xs text-muted-fg",children:[f("voice_ui.engine_result"),": ",r.jsx("strong",{children:E.provider}),E.duration_s?` · ${E.duration_s.toFixed(1)}s`:""]})]})]})}const Ww={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 Zw({gpu:e}){const t=Ww[e]??Ww.none;return r.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 nB(e){return e.backend==="mlx"?"Metal · mlx-whisper":e.backend==="faster"?(e.device==="cuda"?"CUDA":"CPU")+" · faster-whisper":e.backend}const sB=()=>[{value:"auto",label:f("voice_ui.stt_provider_auto")},{value:"local",label:f("voice_ui.stt_provider_local")},{value:"openai",label:f("voice_ui.stt_provider_openai")},{value:"custom",label:f("voice_ui.stt_provider_custom")}],Jw=()=>[{value:"auto",label:f("voice_ui.lang_auto")},{value:"es",label:f("voice_ui.lang_es")},{value:"en",label:f("voice_ui.lang_en")},{value:"pt",label:f("voice_ui.lang_pt")},{value:"fr",label:f("voice_ui.lang_fr")},{value:"it",label:f("voice_ui.lang_it")},{value:"de",label:f("voice_ui.lang_de")}];function aB({config:e,onPatch:t,busy:s}){const[o,l]=x.useState(null);x.useEffect(()=>{let P=!0;return vf.sttHardware().then(B=>{P&&l(B)}).catch(()=>{}),()=>{P=!1}},[]);const c=e.provider||"auto",u=e.local||{},p=e.openai||{},m=e.custom||{},h=u.model||"small",g=u.language||"auto",b=c==="auto"||c==="local",v=(P,B,$)=>{const q=$.trim();q!==(B||"").trim()&&t({[P]:q})},k=(P,B)=>{const $=B.trim();!$||is($)||t({[P]:$})},E=P=>is(P)?f("voice_ui.api_key_set",{suffix:ko(P)??""}):f("voice_ui.api_key_label"),y=u.backend||"auto",j=o?.hardware.gpu||"none",C=y==="auto"?o?.recommended.backend||"faster":y,S=C==="mlx",N=S?"metal":C==="faster"&&j==="cuda"?"cuda":"none",R=()=>{const P=[{value:"auto",label:f("voice_ui.stt_backend_auto")}];return j==="metal"&&P.push({value:"mlx",label:"Metal — mlx-whisper"}),P.push({value:"faster",label:j==="cuda"?"CUDA — faster-whisper":"CPU — faster-whisper"}),P},[M,T]=x.useState([]);x.useEffect(()=>{let P=!0;return vf.sttModels(C).then(B=>{P&&T(B.models)}).catch(()=>{P&&T([])}),()=>{P=!1}},[C]);const z=P=>`${P.id} · ${P.downloaded?"✓ "+P.size:P.size}`,D=()=>M.length?M.map(P=>({value:S?P.repo:P.id,label:z(P)})):JD.map(P=>({value:P,label:P})),U=S?u.mlx_model||o?.recommended.model||"":h,L=S?"transcription.local.mlx_model":"transcription.local.model",H=M.find(P=>(S?P.repo:P.id)===U),O=!!H&&!H.downloaded;return r.jsxs("div",{className:"space-y-3",children:[o&&r.jsxs("div",{className:"rounded-lg border border-border bg-muted px-3 py-2 text-sm",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("span",{className:"text-muted-fg",children:[f("voice_ui.stt_hw_label"),":"]}),r.jsx(Zw,{gpu:o.hardware.gpu}),r.jsx("span",{className:"font-medium text-fg",children:o.hardware.gpuName||o.hardware.platform}),o.hardware.mem_gb?r.jsxs("span",{className:"text-muted-fg",children:["· ",o.hardware.mem_gb," GB",o.hardware.unified_memory?" unified":""]}):null]}),r.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[f("voice_ui.stt_hw_recommended"),":"," ",r.jsx("span",{className:"text-fg",children:o.recommended.model})," ","(",nB(o.recommended),")",o.recommended.limited?` — ${f("voice_ui.stt_hw_limited")}`:""]})]}),r.jsx(ie,{label:f("voice_ui.stt_engine_label"),hint:f("voice_ui.stt_engine_hint"),children:r.jsx(_t,{value:c,onChange:P=>t({"transcription.provider":P}),options:sB(),disabled:s,className:"max-w-md"})}),b&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(ie,{label:f("voice_ui.stt_backend_label"),hint:f("voice_ui.stt_backend_hint"),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_t,{value:y,onChange:P=>t({"transcription.local.backend":P}),options:R(),disabled:s,className:"max-w-xs"}),r.jsx(Zw,{gpu:N})]})}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ie,{label:f("voice_ui.stt_model_label"),hint:O?f("voice_ui.stt_model_needs_download",{size:H.size}):f("voice_ui.stt_model_hint"),children:r.jsx(_t,{value:U,onChange:P=>t({[L]:P}),options:D(),disabled:s})}),r.jsx(ie,{label:f("voice_ui.stt_language_label"),hint:f("voice_ui.stt_language_hint"),children:r.jsx(_t,{value:g,onChange:P=>t({"transcription.local.language":P}),options:Jw(),disabled:s})})]})]}),c==="openai"&&r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ie,{label:f("voice_ui.api_key_label"),hint:is(p.api_key)?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:r.jsx(Ee,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:E(p.api_key),onBlur:P=>k("transcription.openai.api_key",P.target.value),disabled:s})}),r.jsx(ie,{label:f("voice_ui.stt_openai_model_label"),hint:f("voice_ui.stt_openai_model_hint"),children:r.jsx(Ee,{defaultValue:p.model||"",placeholder:"whisper-1",onBlur:P=>v("transcription.openai.model",p.model,P.target.value),disabled:s})})]}),c==="custom"&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(ie,{label:f("voice_ui.stt_custom_baseurl_label"),hint:f("voice_ui.stt_custom_baseurl_hint"),children:r.jsx(Ee,{defaultValue:m.base_url||"",placeholder:"http://localhost:8000/v1",onBlur:P=>v("transcription.custom.base_url",m.base_url,P.target.value),disabled:s})}),r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(ie,{label:f("voice_ui.stt_custom_model_label"),hint:f("voice_ui.stt_custom_model_hint"),children:r.jsx(Ee,{defaultValue:m.model||"",placeholder:"mlx-community/whisper-large-v3-turbo",onBlur:P=>v("transcription.custom.model",m.model,P.target.value),disabled:s})}),r.jsx(ie,{label:f("voice_ui.stt_language_label"),hint:f("voice_ui.stt_language_hint"),children:r.jsx(_t,{value:m.language||"auto",onChange:P=>t({"transcription.custom.language":P}),options:Jw(),disabled:s})})]}),r.jsx(ie,{label:f("voice_ui.api_key_label"),hint:f("voice_ui.stt_custom_key_hint"),children:r.jsx(Ee,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:E(m.api_key),onBlur:P=>k("transcription.custom.api_key",P.target.value),disabled:s})})]})]})}function rB(){const e=ot(),{config:t,isLoading:s,patch:o,mutate:l}=qr(),{data:c,isLoading:u,error:p,mutate:m}=We("/tts/providers",()=>vf.providers()),[h,g]=x.useState(null),[b,v]=x.useState(!1),k=t,E=k.voice?.tts||{},y=k.transcription||{},j=c?.configured_provider||E.provider||"auto",C=c?.mode||E.mode||"chain",S=c?.order||[],N=(c?.engines||[]).map(H=>{if(!(!!H.custom||H.id==="gemini"))return H;const P=H.custom?E.custom?.[H.id.slice(7)]:E.gemini;return{...H,emotionsApplicable:!0,emotionsOn:!!P?.emotions?.enabled}}),R=x.useMemo(()=>!h||h==="__new__"?{}:h.startsWith("custom:")?E.custom?.[h.slice(7)]||{}:E[h]||{},[h,E]),M=async(H,O)=>{v(!0);try{const P=H.startsWith("custom:")?`voice.tts.custom.${H.slice(7)}.enabled`:`voice.tts.${H}.enabled`;await o({[P]:O}),await m()}catch(P){e.error(P.message)}finally{v(!1)}},T=async(H,O)=>{v(!0);try{const P=H.startsWith("custom:")?`voice.tts.custom.${H.slice(7)}.emotions.enabled`:`voice.tts.${H}.emotions.enabled`;await o({[P]:O}),await m(),await l()}catch(P){e.error(P.message)}finally{v(!1)}},z=async H=>{v(!0);try{await o({"voice.tts.order":H}),await m()}catch(O){e.error(O.message)}finally{v(!1)}},D=async({set:H,unset:O})=>{await o(H,O.length?O:void 0),await m(),await l(),e.success(f("voice_ui.toast_config_saved"))},U=async H=>{if(H.startsWith("custom:")&&window.confirm(f("voice_ui.remove_confirm"))){v(!0);try{const O=H.slice(7);await o({"voice.tts.order":S.filter(P=>P!==H)},[`voice.tts.custom.${O}`]),await m(),await l(),e.success(f("voice_ui.toast_provider_removed"))}catch(O){e.error(O.message)}finally{v(!1)}}},L=async(H,O)=>{try{await o(H,O),e.success(f("voice_ui.toast_transcription_updated"))}catch(P){e.error(P.message)}};return r.jsxs("div",{"data-testid":"screen-voice",children:[r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[r.jsx(Ye,{title:f("voice_screen.providers_title"),description:f("voice_ui.providers_desc"),children:u||s?r.jsx(rt,{}):p?r.jsx(bt,{children:f("voice_ui.providers_load_error",{msg:p.message})}):r.jsx(W7,{engines:N,order:S,onToggleEnabled:M,onToggleEmotions:T,onReorder:z,onConfigure:H=>g(H),onRemove:U,onAddNew:()=>g("__new__"),busy:b})}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ye,{title:f("voice_screen.test_title"),description:f("voice_ui.test_desc"),children:r.jsx(tB,{engines:N,defaultProvider:j,mode:C})}),r.jsx(Ye,{title:f("voice_screen.stt_title"),description:f("voice_ui.stt_desc"),children:s?r.jsx(rt,{}):r.jsx(aB,{config:y,onPatch:L})})]})]}),r.jsx(J7,{open:!!h,providerId:h,config:R,onClose:()=>g(null),onSave:D})]})}function oB(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 lB({manifest:e}){const t=e.daemon,s=e.safety;return r.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[r.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{className:"font-semibold text-foreground",children:[t.name," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["v",t.version]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_daemon_active",{uptime:oB(t.uptime_s)})})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("span",{className:"text-muted-fg",children:[t.host,":",t.port]}),r.jsx("span",{className:"text-muted-fg",children:"·"}),r.jsxs("span",{className:"text-muted-fg",children:[f("modules_ui.deck_daemon_started")," ",new Date(t.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),r.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[s.direct_shell===!1&&r.jsx($e,{tone:"success",children:f("modules_ui.deck_safety_no_shell")}),s.arbitrary_commands===!1&&r.jsx($e,{tone:"success",children:f("modules_ui.deck_safety_no_arbitrary")}),s.dangerous_actions_require_confirmation&&r.jsx($e,{tone:"info",children:f("modules_ui.deck_safety_confirm")})]})]})}function iB(e){return e==="available"?"success":e==="configured"?"info":"muted"}function cB(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function uB(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function dB({widget:e,onToggle:t}){const s=e.source==="external",[o,l]=x.useState(!1),c=e.user_enabled===!0,u=async p=>{if(!(!t||o)){l(!0);try{await t(p)}finally{l(!1)}}};return r.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:Te("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",s?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[r.jsx(Ge,{content:e.source==="apx"?f("deck_screen.widget_native"):f("deck_screen.widget_external"),children:r.jsx("span",{className:Te("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"font-medium",children:e.title}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),r.jsx($e,{tone:uB(e.kind),children:e.kind}),r.jsx($e,{tone:iB(e.status),children:cB(e.status)}),s?r.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:r.jsx(Qt,{checked:c,onChange:u,disabled:o||!t})}):r.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function fB({desktop:e,widgets:t,onToggle:s}){return t.length===0?null:r.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),r.jsx("ul",{className:"space-y-1.5",children:t.map(o=>r.jsx(dB,{widget:o,onToggle:o.source==="external"?l=>s(o.id,l):void 0},o.id))})]})}function pB(){ot();const{data:e,error:t,isLoading:s,mutate:o}=We("/deck/manifest",()=>SC.manifest(),{refreshInterval:3e4}),l=async(g,b)=>{},c=e?.deck.desktops??[],u=e?.deck.widgets??[],p=c.map(g=>({desktop:g,widgets:u.filter(b=>b.desktop===g.id)})),h=u.filter(g=>g.source==="external").filter(g=>g.user_enabled===!0).length;return r.jsxs("div",{className:"relative min-h-full","data-testid":"screen-deck",children:[r.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&&r.jsx(lB,{manifest:e}),r.jsxs(Ye,{title:f("deck_screen.widgets_title"),description:s?f("modules_ui.deck_loading_manifest"):t?f("modules_ui.deck_manifest_error"):f("modules_ui.deck_widgets_summary",{count:u.length,enabled:h}),action:r.jsx(Ge,{content:f("deck_screen.reload_manifest"),children:r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>o(),disabled:s,"aria-label":f("deck_screen.reload_manifest"),children:r.jsx(ua,{size:14,className:s?"animate-spin":""})})}),children:[s&&r.jsx(rt,{label:f("modules_ui.deck_loading_manifest_full")}),!s&&t&&r.jsxs(bt,{children:[f("modules_ui.deck_manifest_load_failed")," ",r.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>o(),children:f("modules_ui.deck_retry")})]}),!s&&!t&&u.length===0&&r.jsx(bt,{children:f("modules_ui.deck_no_widgets")}),!s&&!t&&u.length>0&&r.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:p.filter(g=>g.widgets.length>0).map(g=>r.jsx(fB,{desktop:g.desktop,widgets:g.widgets,onToggle:l},g.desktop.id))})]}),e?.apx&&r.jsx(Ye,{title:f("deck_screen.context_title"),description:f("modules_ui.deck_context_desc"),children:r.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_active_project")}),r.jsx("span",{className:"font-medium",children:e.apx.active_project?e.apx.active_project.name:f("modules_ui.deck_none")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_registered_projects")}),r.jsx("span",{className:"font-medium",children:e.apx.projects.length})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_active_plugins")}),r.jsx("span",{className:"font-medium",children:Object.keys(e.apx.plugins).join(", ")||"—"})]})]})})]}),r.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:r.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card/95 p-8 text-center shadow-2xl",children:[r.jsx("div",{className:"mx-auto mb-4 flex size-12 items-center justify-center rounded-full bg-muted",children:r.jsx(jM,{className:"size-6 text-muted-fg"})}),r.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:f("deck_screen.preview_badge")}),r.jsx("h2",{id:"deck-coming-soon-title",className:"mt-3 text-lg font-semibold",children:f("deck_screen.preview_title")}),r.jsx("p",{className:"mt-2 text-sm text-muted-fg",children:f("deck_screen.preview_body")})]})})]})}const mB=[{title:f("settings.account_section"),items:[{key:"identity",label:f("settings.tabs.identity"),icon:Xx}]},{title:f("settings.agents_section"),items:[{key:"super_agent",label:f("settings.tabs.super_agent"),icon:on},{key:"engines",label:f("settings.tabs.engines"),icon:$x},{key:"memory",label:"Memory (RAG)",icon:Wk},{key:"skills",label:"Skills (RAG)",icon:Za}]},{title:f("settings.channels_section"),items:[{key:"telegram",label:f("settings.tabs.telegram"),icon:Gs},{key:"devices",label:f("settings.tabs.devices"),icon:JM}]},{title:f("settings.modules_section"),items:[{key:"voice",label:f("nav.modules.voice"),icon:nS},{key:"desktop",label:f("nav.modules.desktop"),icon:Yx},{key:"deck",label:f("nav.modules.deck"),icon:$M},{key:"web",label:f("nav.modules.web"),icon:PM}]},{title:f("settings.advanced_section"),items:[{key:"advanced",label:f("settings.tabs.advanced"),icon:Jd}]}],hB=new Set(["engines","telegram","memory","skills","web","voice"]),gB={identity:()=>r.jsx(Q8,{}),super_agent:()=>r.jsx(W8,{}),engines:()=>r.jsx(dN,{}),memory:()=>r.jsx(e7,{}),skills:()=>r.jsx(n7,{}),telegram:()=>r.jsx(l7,{}),devices:()=>r.jsx(D7,{}),voice:()=>r.jsx(rB,{}),deck:()=>r.jsx(pB,{}),desktop:()=>r.jsx(Q7,{}),web:()=>r.jsx(B7,{}),advanced:()=>r.jsx(I7,{})};function xB(){const e=Yn(),t=Zn(),s=bB(t.pathname),o=gB[s],{collapsed:l,toggle:c}=Yb(An.sidebarCollapsed+".settings");return r.jsx(XC,{sections:mB,active:s,onChange:u=>e(u==="identity"?"/settings":`/settings/${_B(u)}`),collapsed:l,onToggleCollapse:c,contentClassName:`w-full ${hB.has(s)?"":"mx-auto max-w-3xl"} space-y-6 py-6 pt-3 pr-6 pl-4`,testId:`settings-tab-${s}`,children:r.jsx(o,{})})}function bB(e){switch(e.split("/").filter(Boolean)[1]||"identity"){case"super-agent":return"super_agent";case"engines":return"engines";case"memory":return"memory";case"skills":return"skills";case"telegram":return"telegram";case"devices":return"devices";case"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 _B(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function vB(){const{data:e,isLoading:t,mutate:s}=We("/messages/global?channel=desktop",()=>G7(40),{refreshInterval:8e3});return r.jsx("div",{className:"mx-auto max-w-3xl space-y-6 p-6","data-testid":"screen-desktop",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{children:r.jsx($N,{showConfigLink:!0})}),r.jsx("div",{children:r.jsx(Ye,{title:f("desktop_screen.last_conv_title"),description:f("modules_ui.desktop_last_conv_desc"),action:r.jsx("button",{type:"button",onClick:()=>s(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:f("modules_ui.desktop_refresh")}),children:r.jsx(yB,{messages:e||[],loading:t})})})]})})}function yB({messages:e,loading:t}){const s=x.useMemo(()=>wB(e),[e]);return t?r.jsx(rt,{}):e.length?r.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:s.slice().reverse().map((o,l)=>r.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:o.map((c,u)=>r.jsx(jB,{m:c},u))},l))}):r.jsx(bt,{children:f("modules_ui.desktop_no_messages")})}function jB({m:e}){const t=e.direction==="in",s=kB(e.ts);return r.jsxs("div",{className:"py-1",children:[r.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-semibold",children:f(t?"modules_ui.desktop_you":"modules_ui.desktop_roby")}),r.jsx("span",{children:s})]}),r.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(t?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||r.jsx("span",{className:"italic opacity-50",children:f("modules_ui.desktop_empty_msg")})})]})}function wB(e){const t=[];for(const s of e)s.direction==="in"||!t.length?t.push([s]):t[t.length-1].push(s);return t}function kB(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 SB(e,t){const s=getComputedStyle(e),o=parseFloat(s.fontSize);return t*o}function CB(e,t){const s=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(s.fontSize);return t*o}function NB(e){return e/100*window.innerHeight}function EB(e){return e/100*window.innerWidth}function RB(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 _c({groupSize:e,panelElement:t,styleProp:s}){let o;const[l,c]=RB(s);switch(c){case"%":{o=l/100*e;break}case"px":{o=l;break}case"rem":{o=CB(t,l);break}case"em":{o=SB(t,l);break}case"vh":{o=NB(l);break}case"vw":{o=EB(l);break}}return o}function Qn(e){return parseFloat(e.toFixed(3))}function Xl({group:e}){const{orientation:t,panels:s}=e;return s.reduce((o,l)=>(o+=t==="horizontal"?l.element.offsetWidth:l.element.offsetHeight,o),0)}function Mx(e){const{panels:t}=e,s=Xl({group:e});return s===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:l,panelConstraints:c}=o;let u=0;if(c.collapsedSize!==void 0){const g=_c({groupSize:s,panelElement:l,styleProp:c.collapsedSize});u=Qn(g/s*100)}let p;if(c.defaultSize!==void 0){const g=_c({groupSize:s,panelElement:l,styleProp:c.defaultSize});p=Qn(g/s*100)}let m=0;if(c.minSize!==void 0){const g=_c({groupSize:s,panelElement:l,styleProp:c.minSize});m=Qn(g/s*100)}let h=100;if(c.maxSize!==void 0){const g=_c({groupSize:s,panelElement:l,styleProp:c.maxSize});h=Qn(g/s*100)}return{groupResizeBehavior:c.groupResizeBehavior,collapsedSize:u,collapsible:c.collapsible===!0,defaultSize:p,disabled:c.disabled,minSize:m,maxSize:h,panelId:o.id}})}function Vt(e,t="Assertion error"){if(!e)throw Error(t)}function Ox(e,t){return Array.from(t).sort(e==="horizontal"?TB:AB)}function TB(e,t){const s=e.element.offsetLeft-t.element.offsetLeft;return s!==0?s:e.element.offsetWidth-t.element.offsetWidth}function AB(e,t){const s=e.element.offsetTop-t.element.offsetTop;return s!==0?s:e.element.offsetHeight-t.element.offsetHeight}function FN(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function GN(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 MB({orientation:e,rects:t,targetRect:s}){const o={x:s.x+s.width/2,y:s.y+s.height/2};let l,c=Number.MAX_VALUE;for(const u of t){const{x:p,y:m}=GN(o,u),h=e==="horizontal"?p:m;h<c&&(c=h,l=u)}return Vt(l,"No rect found"),l}let Pd;function OB(){return Pd===void 0&&(typeof matchMedia=="function"?Pd=!!matchMedia("(pointer:coarse)").matches:Pd=!1),Pd}function YN(e){const{element:t,orientation:s,panels:o,separators:l}=e,c=Ox(s,Array.from(t.children).filter(FN).map(E=>({element:E}))).map(({element:E})=>E),u=[];let p=!1,m=!1,h=-1,g=-1,b=0,v,k=[];{let E=-1;for(const y of c)y.hasAttribute("data-panel")&&(E++,y.hasAttribute("data-disabled")||(b++,h===-1&&(h=E),g=E))}if(b>1){let E=-1;for(const y of c)if(y.hasAttribute("data-panel")){E++;const j=o.find(C=>C.element===y);if(j){if(v){const C=v.element.getBoundingClientRect(),S=y.getBoundingClientRect();let N;if(m){const R=s==="horizontal"?new DOMRect(C.right,C.top,0,C.height):new DOMRect(C.left,C.bottom,C.width,0),M=s==="horizontal"?new DOMRect(S.left,S.top,0,S.height):new DOMRect(S.left,S.top,S.width,0);switch(k.length){case 0:{N=[R,M];break}case 1:{const T=k[0],z=MB({orientation:s,rects:[C,S],targetRect:T.element.getBoundingClientRect()});N=[T,z===C?M:R];break}default:{N=k;break}}}else k.length?N=k:N=[s==="horizontal"?new DOMRect(C.right,S.top,S.left-C.right,S.height):new DOMRect(S.left,C.bottom,S.width,S.top-C.bottom)];for(const R of N){let M="width"in R?R:R.element.getBoundingClientRect();const T=OB()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(M.width<T){const D=T-M.width;M=new DOMRect(M.x-D/2,M.y,M.width+D,M.height)}if(M.height<T){const D=T-M.height;M=new DOMRect(M.x,M.y-D/2,M.width,M.height+D)}const z=E<=h||E>g;!p&&!z&&u.push({group:e,groupSize:Xl({group:e}),panels:[v,j],separator:"width"in R?void 0:R,rect:M}),p=!1}}m=!1,v=j,k=[]}}else if(y.hasAttribute("data-separator")){y.ariaDisabled!==null&&(p=!0);const j=l.find(C=>C.element===y);j?k.push(j):(v=void 0,k=[])}else m=!0}return u}class KN{#e={};addListener(t,s){const o=this.#e[t];return o===void 0?this.#e[t]=[s]:o.includes(s)||o.push(s),()=>{this.removeListener(t,s)}}emit(t,s){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,s);else{let l=!1,c=null;const u=Array.from(o);for(let p=0;p<u.length;p++){const m=u[p];try{m.call(null,s)}catch(h){c===null&&(l=!0,c=h)}}if(l)throw c}}removeAllListeners(){this.#e={}}removeListener(t,s){const o=this.#e[t];if(o!==void 0){const l=o.indexOf(s);l>=0&&o.splice(l,1)}}}let Dl={cursorFlags:0,state:"inactive"};const j_=new KN;function No(){return Dl}function zB(e){return j_.addListener("change",e)}function DB(e){const t=Dl,s={...Dl};s.cursorFlags=e,Dl=s,j_.emit("change",{prev:t,next:s})}function Ll(e){const t=Dl;Dl=e,j_.emit("change",{prev:t,next:e})}const LB=e=>e,Hg=()=>{},XN=1,QN=2,WN=4,ZN=8,ek=3,tk=12;let Id;function nk(){return Id===void 0&&(Id=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Id=!0)),Id}function PB({cursorFlags:e,groups:t,state:s}){let o=0,l=0;switch(s){case"active":case"hover":t.forEach(c=>{if(!c.mutableState.disableCursor)switch(c.orientation){case"horizontal":{o++;break}case"vertical":{l++;break}}})}if(!(o===0&&l===0)){switch(s){case"active":{if(e&&nk()){const c=(e&XN)!==0,u=(e&QN)!==0,p=(e&WN)!==0,m=(e&ZN)!==0;if(c)return p?"se-resize":m?"ne-resize":"e-resize";if(u)return p?"sw-resize":m?"nw-resize":"w-resize";if(p)return"s-resize";if(m)return"n-resize"}break}}return nk()?o>0&&l>0?"move":o>0?"ew-resize":"ns-resize":o>0&&l>0?"grab":o>0?"col-resize":"row-resize"}}const sk=new WeakMap;function w_(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:s}=sk.get(e)??{};s===void 0&&(s=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(s):e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]));const o=No();switch(o.state){case"active":case"hover":{const l=PB({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(u=>u.group),state:o.state}),c=`*, *:hover {cursor: ${l} !important; }`;if(t===c)return;t=c,l?s.cssRules.length===0?s.insertRule(c):s.replaceSync(c):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{t=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}sk.set(e,{prevStyle:t,styleSheet:s})}let oa=new Map;const JN=new KN;function IB(e){oa=new Map(oa),oa.delete(e)}function ak(e,t){for(const[s]of oa)if(s.id===e)return s}function Or(e,t){for(const[s,o]of oa)if(s.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Do(){return oa}function k_(e,t){return JN.addListener("groupChange",s=>{s.group.id===e&&t(s)})}function Wa(e,t,s){const o=oa.get(e);oa=new Map(oa),oa.set(e,t),JN.emit("groupChange",{group:e,isUserInteraction:s?.isUserInteraction===!0,prev:o,next:t})}function eE(e){const t=No();let s=!1;switch(t.state){case"active":Ll({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(w_(e),s=!0,t.hitRegions.forEach(o=>{const l=Or(o.group.id,!0);Wa(o.group,l,{isUserInteraction:!0})}))}return s}function rk(e){e.defaultPrevented||eE(e.currentTarget)}function BB(e,t,s){let o,l={x:1/0,y:1/0};for(const c of t){const u=GN(s,c.rect);switch(e){case"horizontal":{u.x<=l.x&&(o=c,l=u);break}case"vertical":{u.y<=l.y&&(o=c,l=u);break}}}return o?{distance:l,hitRegion:o}:void 0}function UB(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function HB(e,t){if(e===t)throw new Error("Cannot compare node with itself");const s={a:ik(e),b:ik(t)};let o;for(;s.a.at(-1)===s.b.at(-1);)o=s.a.pop(),s.b.pop();Vt(o,"Stacking order can only be calculated for elements with a common ancestor");const l={a:lk(ok(s.a)),b:lk(ok(s.b))};if(l.a===l.b){const c=o.childNodes,u={a:s.a.at(-1),b:s.b.at(-1)};let p=c.length;for(;p--;){const m=c[p];if(m===u.a)return 1;if(m===u.b)return-1}}return Math.sign(l.a-l.b)}const VB=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function qB(e){const t=getComputedStyle(tE(e)??e).display;return t==="flex"||t==="inline-flex"}function $B(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||qB(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"||VB.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function ok(e){let t=e.length;for(;t--;){const s=e[t];if(Vt(s,"Missing node"),$B(s))return s}return null}function lk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function ik(e){const t=[];for(;e;)t.push(e),e=tE(e);return t}function tE(e){const{parentNode:t}=e;return UB(t)?t.host:t}function FB(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 GB({groupElement:e,hitRegion:t,pointerEventTarget:s}){if(!FN(s)||s.contains(e)||e.contains(s))return!0;if(HB(s,e)>0){let o=s;for(;o;){if(o.contains(e))return!0;if(FB(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function S_(e,t){const s=[];return t.forEach((o,l)=>{if(l.disabled)return;const c=YN(l),u=BB(l.orientation,c,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&GB({groupElement:l.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&s.push(u.hitRegion)}),s}function YB(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=t[s])return!1;return!0}function $n(e,t,s=0){return Math.abs(Qn(e)-Qn(t))<=s}function na(e,t){return $n(e,t)?0:e>t?1:-1}function El({overrideDisabledPanels:e,panelConstraints:t,prevSize:s,size:o}){const{collapsedSize:l=0,collapsible:c,disabled:u,maxSize:p=100,minSize:m=0}=t;if(u&&!e)return s;if(na(o,m)<0)if(c){const h=(l+m)/2;na(o,h)<0?o=l:o=m}else o=m;return o=Math.min(p,o),o=Qn(o),o}function Bc({delta:e,initialLayout:t,panelConstraints:s,pivotIndices:o,prevLayout:l,trigger:c}){if($n(e,0))return t;const u=c==="imperative-api",p=Object.values(t),m=Object.values(l),h=[...p],[g,b]=o;Vt(g!=null,"Invalid first pivot index"),Vt(b!=null,"Invalid second pivot index");let v=0;switch(c){case"keyboard":{{const y=e<0?b:g,j=s[y];Vt(j,`Panel constraints not found for index ${y}`);const{collapsedSize:C=0,collapsible:S,minSize:N=0}=j;if(S){const R=p[y];if(Vt(R!=null,`Previous layout not found for panel index ${y}`),$n(R,C)){const M=N-R;na(M,Math.abs(e))>0&&(e=e<0?0-M:M)}}}{const y=e<0?g:b,j=s[y];Vt(j,`No panel constraints found for index ${y}`);const{collapsedSize:C=0,collapsible:S,minSize:N=0}=j;if(S){const R=p[y];if(Vt(R!=null,`Previous layout not found for panel index ${y}`),$n(R,N)){const M=R-C;na(M,Math.abs(e))>0&&(e=e<0?0-M:M)}}}break}default:{const y=e<0?b:g,j=s[y];Vt(j,`Panel constraints not found for index ${y}`);const C=p[y],{collapsible:S,collapsedSize:N,minSize:R}=j;if(S&&na(C,R)<0)if(e>0){const M=R-N,T=M/2,z=C+e;na(z,R)<0&&(e=na(e,T)<=0?0:M)}else{const M=R-N,T=100-M/2,z=C-e;na(z,R)<0&&(e=na(100+e,T)>0?0:-M)}break}}{const y=e<0?1:-1;let j=e<0?b:g,C=0;for(;;){const N=p[j];Vt(N!=null,`Previous layout not found for panel index ${j}`);const R=El({overrideDisabledPanels:u,panelConstraints:s[j],prevSize:N,size:100})-N;if(C+=R,j+=y,j<0||j>=s.length)break}const S=Math.min(Math.abs(e),Math.abs(C));e=e<0?0-S:S}{let y=e<0?g:b;for(;y>=0&&y<s.length;){const j=Math.abs(e)-Math.abs(v),C=p[y];Vt(C!=null,`Previous layout not found for panel index ${y}`);const S=C-j,N=El({overrideDisabledPanels:u,panelConstraints:s[y],prevSize:C,size:S});if(!$n(C,N)&&(v+=C-N,h[y]=N,v.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?y--:y++}}if(YB(m,h))return l;{const y=e<0?b:g,j=p[y];Vt(j!=null,`Previous layout not found for panel index ${y}`);const C=j+v,S=El({overrideDisabledPanels:u,panelConstraints:s[y],prevSize:j,size:C});if(h[y]=S,!$n(S,C)){let N=C-S,R=e<0?b:g;for(;R>=0&&R<s.length;){const M=h[R];Vt(M!=null,`Previous layout not found for panel index ${R}`);const T=M+N,z=El({overrideDisabledPanels:u,panelConstraints:s[R],prevSize:M,size:T});if($n(M,z)||(N-=z-M,h[R]=z),$n(N,0))break;e>0?R--:R++}}}const k=Object.values(h).reduce((y,j)=>j+y,0);if(!$n(k,100,.1))return l;const E=Object.keys(l);return h.reduce((y,j,C)=>(y[E[C]]=j,y),{})}function Eo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(t[s]===void 0||na(e[s],t[s])!==0)return!1;return!0}function Ro({layout:e,panelConstraints:t}){const s=Object.values(e),o=[...s],l=o.reduce((p,m)=>p+m,0);if(o.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${o.map(p=>`${p}%`).join(", ")}`);if(!$n(l,100)&&o.length>0)for(let p=0;p<t.length;p++){const m=o[p];Vt(m!=null,`No layout data found for index ${p}`);const h=100/l*m;o[p]=h}let c=0;for(let p=0;p<t.length;p++){const m=s[p];Vt(m!=null,`No layout data found for index ${p}`);const h=o[p];Vt(h!=null,`No layout data found for index ${p}`);const g=El({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:h});h!=g&&(c+=h-g,o[p]=g)}if(!$n(c,0))for(let p=0;p<t.length;p++){const m=o[p];Vt(m!=null,`No layout data found for index ${p}`);const h=m+c,g=El({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:h});if(m!==g&&(c-=g-m,o[p]=g,$n(c,0)))break}const u=Object.keys(e);return o.reduce((p,m,h)=>(p[u[h]]=m,p),{})}function nE({groupId:e,panelId:t}){const s=()=>{const m=Do();for(const[h,{defaultLayoutDeferred:g,derivedPanelConstraints:b,layout:v,groupSize:k,separatorToPanels:E}]of m)if(h.id===e)return{defaultLayoutDeferred:g,derivedPanelConstraints:b,group:h,groupSize:k,layout:v,separatorToPanels:E};throw Error(`Group ${e} not found`)},o=()=>{const m=s().derivedPanelConstraints.find(h=>h.panelId===t);if(m!==void 0)return m;throw Error(`Panel constraints not found for Panel ${t}`)},l=()=>{const m=s().group.panels.find(h=>h.id===t);if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},c=()=>{const m=s().layout[t];if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},u=({nextSize:m,panels:h,prevLayout:g,derivedPanelConstraints:b})=>{const v=c(),k=h.findIndex(j=>j.id===t),E=k===0,y=k===h.length-1;if(y&&m<v&&(E||h.slice(0,k).every((j,C)=>{const S=b[C];return S?.collapsible&&$n(S.collapsedSize,g[S.panelId])}))){const j=h.slice(0,k).reduce((C,S)=>C+g[S.id],0);return{...g,[t]:Qn(100-j)}}return Bc({delta:y?v-m:m-v,initialLayout:g,panelConstraints:b,pivotIndices:y?[k-1,k]:[k,k+1],prevLayout:g,trigger:"imperative-api"})},p=m=>{const h=c();if(m===h)return;const{defaultLayoutDeferred:g,derivedPanelConstraints:b,group:v,groupSize:k,layout:E,separatorToPanels:y}=s(),j=u({nextSize:m,panels:v.panels,prevLayout:E,derivedPanelConstraints:b}),C=Ro({layout:j,panelConstraints:b});Eo(E,C)||Wa(v,{defaultLayoutDeferred:g,derivedPanelConstraints:b,groupSize:k,layout:C,separatorToPanels:y})};return{collapse:()=>{const{collapsible:m,collapsedSize:h}=o(),{mutableValues:g}=l(),b=c();m&&b!==h&&(g.expandToSize=b,p(h))},expand:()=>{const{collapsible:m,collapsedSize:h,minSize:g}=o(),{mutableValues:b}=l(),v=c();if(m&&v===h){let k=b.expandToSize??g;k===0&&(k=1),p(k)}},getSize:()=>{const{group:m}=s(),h=c(),{element:g}=l(),b=m.orientation==="horizontal"?g.offsetWidth:g.offsetHeight;return{asPercentage:h,inPixels:b}},isCollapsed:()=>{const{collapsible:m,collapsedSize:h}=o(),g=c();return m&&$n(h,g)},resize:m=>{const{group:h}=s(),{element:g}=l(),b=Xl({group:h}),v=_c({groupSize:b,panelElement:g,styleProp:m}),k=Qn(v/b*100);p(k)}}}function ck(e){if(e.defaultPrevented)return;const t=Do();S_(e,t).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const o=s.panels.find(l=>l.panelConstraints.defaultSize!==void 0);if(o){const l=o.panelConstraints.defaultSize,c=nE({groupId:s.group.id,panelId:o.id});c&&l!==void 0&&(c.resize(l),e.preventDefault())}}})}function Gd(e){const t=Do();for(const[s]of t)if(s.separators.some(o=>o.element===e))return s;throw Error("Could not find parent Group for separator element")}function sE({groupId:e}){const t=()=>{const s=Do();for(const[o,l]of s)if(o.id===e)return{group:o,...l};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:o}=t();return s?{}:o},setLayout(s){const{defaultLayoutDeferred:o,derivedPanelConstraints:l,group:c,groupSize:u,layout:p,separatorToPanels:m}=t(),h=Ro({layout:s,panelConstraints:l});return o?p:(Eo(p,h)||Wa(c,{defaultLayoutDeferred:o,derivedPanelConstraints:l,groupSize:u,layout:h,separatorToPanels:m}),h)}}}function co(e,t){const s=Gd(e),o=Or(s.id,!0),l=s.separators.find(g=>g.element===e);Vt(l,"Matching separator not found");const c=o.separatorToPanels.get(l);Vt(c,"Matching panels not found");const u=c.map(g=>s.panels.indexOf(g)),p=sE({groupId:s.id}).getLayout(),m=Bc({delta:t,initialLayout:p,panelConstraints:o.derivedPanelConstraints,pivotIndices:u,prevLayout:p,trigger:"keyboard"}),h=Ro({layout:m,panelConstraints:o.derivedPanelConstraints});Eo(p,h)||Wa(s,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:h,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function uk(e){if(e.defaultPrevented)return;const t=e.currentTarget,s=Gd(t);if(!s.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),s.orientation==="vertical"&&co(t,5);break}case"ArrowLeft":{e.preventDefault(),s.orientation==="horizontal"&&co(t,-5);break}case"ArrowRight":{e.preventDefault(),s.orientation==="horizontal"&&co(t,5);break}case"ArrowUp":{e.preventDefault(),s.orientation==="vertical"&&co(t,-5);break}case"End":{e.preventDefault(),co(t,100);break}case"Enter":{e.preventDefault();const o=Gd(t),l=Or(o.id,!0),{derivedPanelConstraints:c,layout:u,separatorToPanels:p}=l,m=o.separators.find(v=>v.element===t);Vt(m,"Matching separator not found");const h=p.get(m);Vt(h,"Matching panels not found");const g=h[0],b=c.find(v=>v.panelId===g.id);if(Vt(b,"Panel metadata not found"),b.collapsible){const v=u[g.id],k=b.collapsedSize===v?o.mutableState.expandedPanelSizes[g.id]??b.minSize:b.collapsedSize;co(t,k-v)}break}case"F6":{e.preventDefault();const o=Gd(t).separators.map(u=>u.element),l=Array.from(o).findIndex(u=>u===e.currentTarget);Vt(l!==null,"Index not found");const c=e.shiftKey?l>0?l-1:o.length-1:l+1<o.length?l+1:0;o[c].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),co(t,-100);break}}}function dk(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Do(),s=S_(e,t),o=new Map;let l=!1;s.forEach(c=>{c.separator&&(l||(l=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const u=t.get(c.group);u&&o.set(c.group,u.layout)}),Ll({cursorFlags:0,hitRegions:s,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),s.length&&e.preventDefault()}function aE({document:e,event:t,hitRegions:s,initialLayoutMap:o,mountedGroups:l,pointerDownAtPoint:c,prevCursorFlags:u}){let p=0;s.forEach(h=>{const{group:g,groupSize:b}=h,{orientation:v,panels:k}=g,{disableCursor:E}=g.mutableState;let y=0;c?v==="horizontal"?y=(t.clientX-c.x)/b*100:y=(t.clientY-c.y)/b*100:v==="horizontal"?y=t.clientX<0?-100:100:y=t.clientY<0?-100:100;const j=o.get(g),C=l.get(g);if(!j||!C)return;const{defaultLayoutDeferred:S,derivedPanelConstraints:N,groupSize:R,layout:M,separatorToPanels:T}=C;if(N&&M&&T){const z=Bc({delta:y,initialLayout:j,panelConstraints:N,pivotIndices:h.panels.map(D=>k.indexOf(D)),prevLayout:M,trigger:"mouse-or-touch"});if(Eo(z,M)){if(y!==0&&!E)switch(v){case"horizontal":{p|=y<0?XN:QN;break}case"vertical":{p|=y<0?WN:ZN;break}}}else Wa(h.group,{defaultLayoutDeferred:S,derivedPanelConstraints:N,groupSize:R,layout:z,separatorToPanels:T})}});let m=0;t.movementX===0?m|=u&ek:m|=p&ek,t.movementY===0?m|=u&tk:m|=p&tk,DB(m),w_(e)}function fk(e){const t=Do(),s=No();switch(s.state){case"active":aE({document:e.currentTarget,event:e,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:t,prevCursorFlags:s.cursorFlags})}}function pk(e){if(e.defaultPrevented)return;const t=No(),s=Do();switch(t.state){case"active":{if(e.buttons===0){Ll({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const l=Or(o.group.id,!0);Wa(o.group,l,{isUserInteraction:!0})});return}for(const o of t.hitRegions)if(o.separator){const{element:l}=o.separator;l.hasPointerCapture?.(e.pointerId)||l.setPointerCapture?.(e.pointerId)}aE({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=S_(e,s);o.length===0?t.state!=="inactive"&&Ll({cursorFlags:0,state:"inactive"}):Ll({cursorFlags:0,hitRegions:o,state:"hover"}),w_(e.currentTarget);break}}}function mk(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(No().state){case"hover":Ll({cursorFlags:0,state:"inactive"})}}function hk(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||eE(e.currentTarget)&&e.preventDefault()}function gk(e){let t=0,s=0;const o={};for(const c of e)if(c.defaultSize!==void 0){t++;const u=Qn(c.defaultSize);s+=u,o[c.panelId]=u}else o[c.panelId]=void 0;const l=e.length-t;if(l!==0){const c=Qn((100-s)/l);for(const u of e)u.defaultSize===void 0&&(o[u.panelId]=c)}return o}function KB(e,t,s){if(!s[0])return;const o=e.panels.find(m=>m.element===t);if(!o||!o.onResize)return;const l=Xl({group:e}),c=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,u=o.mutableValues.prevSize,p={asPercentage:Qn(c/l*100),inPixels:c};o.mutableValues.prevSize=p,o.onResize(p,o.id,u)}function XB(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const s in e)if(e[s]!==t[s])return!1;return!0}function QB({group:e,nextGroupSize:t,prevGroupSize:s,prevLayout:o}){if(s<=0||t<=0||s===t)return o;let l=0,c=0,u=!1;const p=new Map,m=[];for(const b of e.panels){const v=o[b.id]??0;switch(b.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const k=v/100*s,E=Qn(k/t*100);p.set(b.id,E),l+=E;break}case"preserve-relative-size":default:{m.push(b.id),c+=v;break}}}if(!u||m.length===0)return o;const h=100-l,g={...o};if(p.forEach((b,v)=>{g[v]=b}),c>0)for(const b of m){const v=o[b]??0;g[b]=Qn(v/c*h)}else{const b=Qn(h/m.length);for(const v of m)g[v]=b}return g}function WB(e,t){const s=e.map(l=>l.id),o=Object.keys(t);if(s.length!==o.length)return!1;for(const l of s)if(!o.includes(l))return!1;return!0}const kl=new Map;function ZB(e){let t=!0;Vt(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,l=new Set,c=new s(E=>{for(const y of E){const{borderBoxSize:j,target:C}=y;if(C===e.element){if(t){const S=Xl({group:e});if(S===0)return;const N=Or(e.id);if(!N)return;const R=Mx(e),M=N.defaultLayoutDeferred?gk(R):N.layout,T=QB({group:e,nextGroupSize:S,prevGroupSize:N.groupSize,prevLayout:M}),z=Ro({layout:T,panelConstraints:R});if(!N.defaultLayoutDeferred&&Eo(N.layout,z)&&XB(N.derivedPanelConstraints,R)&&N.groupSize===S)return;Wa(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:S,layout:z,separatorToPanels:N.separatorToPanels})}}else KB(e,C,j)}});c.observe(e.element),e.panels.forEach(E=>{Vt(!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 u=Xl({group:e}),p=Mx(e),m=e.panels.map(({id:E})=>E).join(",");let h=e.mutableState.defaultLayout;h&&(WB(e.panels,h)||(h=void 0));const g=e.mutableState.layouts[m]??h??gk(p),b=Ro({layout:g,panelConstraints:p}),v=e.element.ownerDocument;kl.set(v,(kl.get(v)??0)+1);const k=new Map;return YN(e).forEach(E=>{E.separator&&k.set(E.separator,E.panels)}),Wa(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:p,groupSize:u,layout:b,separatorToPanels:k}),e.separators.forEach(E=>{Vt(!l.has(E.id),`Separator ids must be unique; id "${E.id}" was used more than once`),l.add(E.id),E.element.addEventListener("keydown",uk)}),kl.get(v)===1&&(v.addEventListener("contextmenu",rk,!0),v.addEventListener("dblclick",ck,!0),v.addEventListener("pointerdown",dk,!0),v.addEventListener("pointerleave",fk),v.addEventListener("pointermove",pk),v.addEventListener("pointerout",mk),v.addEventListener("pointerup",hk,!0)),function(){t=!1,kl.set(v,Math.max(0,(kl.get(v)??0)-1)),IB(e),e.separators.forEach(E=>{E.element.removeEventListener("keydown",uk)}),kl.get(v)||(v.removeEventListener("contextmenu",rk,!0),v.removeEventListener("dblclick",ck,!0),v.removeEventListener("pointerdown",dk,!0),v.removeEventListener("pointerleave",fk),v.removeEventListener("pointermove",pk),v.removeEventListener("pointerout",mk),v.removeEventListener("pointerup",hk,!0)),c.disconnect()}}function JB(){const[e,t]=x.useState({}),s=x.useCallback(()=>t({}),[]);return[e,s]}function C_(e){const t=x.useId();return`${e??t}`}const Lo=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Nc(e){const t=x.useRef(e);return Lo(()=>{t.current=e},[e]),x.useCallback((...s)=>t.current?.(...s),[t])}function N_(...e){return Nc(t=>{e.forEach(s=>{if(s)switch(typeof s){case"function":{s(t);break}case"object":{s.current=t;break}}})})}function E_(e){const t=x.useRef({...e});return Lo(()=>{for(const s in e)t.current[s]=e[s]},[e]),t.current}const rE=x.createContext(null);function eU(e,t){const s=x.useRef({getLayout:()=>({}),setLayout:LB});x.useImperativeHandle(t,()=>s.current,[]),Lo(()=>{Object.assign(s.current,sE({groupId:e}))})}function zx({children:e,className:t,defaultLayout:s,disableCursor:o,disabled:l,elementRef:c,groupRef:u,id:p,onLayoutChange:m,onLayoutChanged:h,orientation:g="horizontal",resizeTargetMinimumSize:b={coarse:20,fine:10},style:v,...k}){const E=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),y=Nc(H=>{Eo(E.current.onLayoutChange,H)||(E.current.onLayoutChange=H,m?.(H))}),j=Nc((H,O)=>{Eo(E.current.onLayoutChanged,H)||(E.current.onLayoutChanged=H,h?.(H,{isUserInteraction:O}))}),C=C_(p),S=x.useRef(null),[N,R]=JB(),M=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),T=N_(S,c);eU(C,u);const z=Nc((H,O)=>{const P=No(),B=ak(H),$=Or(H);if($){let q=!1;switch(P.state){case"active":{q=P.hitRegions.some(X=>X.group===B);break}}return{flexGrow:$.layout[O]??1,pointerEvents:q?"none":void 0}}if(s?.[O])return{flexGrow:s?.[O]}}),D=E_({defaultLayout:s,disableCursor:o}),U=x.useMemo(()=>({get disableCursor(){return!!D.disableCursor},getPanelStyles:z,id:C,orientation:g,registerPanel:H=>{const O=M.current;return O.panels=Ox(g,[...O.panels,H]),R(),()=>{O.panels=O.panels.filter(P=>P!==H),R()}},registerSeparator:H=>{const O=M.current;return O.separators=Ox(g,[...O.separators,H]),R(),()=>{O.separators=O.separators.filter(P=>P!==H),R()}},updatePanelProps:(H,{disabled:O})=>{const P=M.current.panels.find(q=>q.id===H);P&&(P.panelConstraints.disabled=O);const B=ak(C),$=Or(C);B&&$&&Wa(B,{...$,derivedPanelConstraints:Mx(B)})},updateSeparatorProps:(H,{disabled:O,disableDoubleClick:P})=>{const B=M.current.separators.find($=>$.id===H);B&&(B.disabled=O,B.disableDoubleClick=P)}}),[z,C,R,g,D]),L=x.useRef(null);return Lo(()=>{const H=S.current;if(H===null)return;const O=M.current;let P;if(D.defaultLayout!==void 0&&Object.keys(D.defaultLayout).length===O.panels.length){P={};for(const K of O.panels){const I=D.defaultLayout[K.id];I!==void 0&&(P[K.id]=I)}}const B={disabled:!!l,element:H,id:C,mutableState:{defaultLayout:P,disableCursor:!!D.disableCursor,expandedPanelSizes:M.current.lastExpandedPanelSizes,layouts:M.current.layouts},orientation:g,panels:O.panels,resizeTargetMinimumSize:O.resizeTargetMinimumSize,separators:O.separators};L.current=B;const $=ZB(B),{defaultLayoutDeferred:q,derivedPanelConstraints:X,layout:Y}=Or(B.id,!0);!q&&X.length>0&&(y(Y),j(Y,!1));const F=k_(C,K=>{const{defaultLayoutDeferred:I,derivedPanelConstraints:G,layout:Z}=K.next;if(I||G.length===0)return;const te=B.panels.map(({id:ee})=>ee).join(",");B.mutableState.layouts[te]=Z,G.forEach(ee=>{if(ee.collapsible){const{layout:ne}=K.prev??{};if(ne){const ae=$n(ee.collapsedSize,Z[ee.panelId]),pe=$n(ee.collapsedSize,ne[ee.panelId]);ae&&!pe&&(B.mutableState.expandedPanelSizes[ee.panelId]=ne[ee.panelId])}}});const de=No().state!=="active";y(Z),de&&j(Z,K.isUserInteraction)});return()=>{L.current=null,$(),F()}},[l,C,j,y,g,N,D]),x.useEffect(()=>{const H=L.current;H&&(H.mutableState.defaultLayout=s,H.mutableState.disableCursor=!!o)}),r.jsx(rE.Provider,{value:U,children:r.jsx("div",{...k,className:t,"data-group":!0,"data-testid":C,id:C,ref:T,style:{height:"100%",width:"100%",overflow:"hidden",...v,display:"flex",flexDirection:g==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:g==="horizontal"?"pan-y":"pan-x"},children:e})})}zx.displayName="Group";function R_(){const e=x.useContext(rE);return Vt(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function tU(e,t){const{id:s}=R_(),o=x.useRef({collapse:Hg,expand:Hg,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:Hg});x.useImperativeHandle(t,()=>o.current,[]),Lo(()=>{Object.assign(o.current,nE({groupId:s,panelId:e}))})}function fo({children:e,className:t,collapsedSize:s="0%",collapsible:o=!1,defaultSize:l,disabled:c,elementRef:u,groupResizeBehavior:p="preserve-relative-size",id:m,maxSize:h="100%",minSize:g="0%",onResize:b,panelRef:v,style:k,...E}){const y=!!m,j=C_(m),C=E_({disabled:c}),S=x.useRef(null),N=N_(S,u),{getPanelStyles:R,id:M,orientation:T,registerPanel:z,updatePanelProps:D}=R_(),U=b!==null,L=Nc((B,$,q)=>{b?.(B,m,q)});Lo(()=>{const B=S.current;if(B!==null){const $={element:B,id:j,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:U?L:void 0,panelConstraints:{groupResizeBehavior:p,collapsedSize:s,collapsible:o,defaultSize:l,disabled:C.disabled,maxSize:h,minSize:g}};return z($)}},[p,s,o,l,U,j,y,h,g,L,z,C]),x.useEffect(()=>{D(j,{disabled:c})},[c,j,D]),tU(j,v);const H=()=>{const B=R(M,j);if(B)return JSON.stringify(B)},O=x.useSyncExternalStore(B=>k_(M,B),H,H);let P;return O?P=JSON.parse(O):l!==void 0?P={flexGrow:void 0,flexShrink:void 0,flexBasis:l}:P={flexGrow:1},r.jsx("div",{...E,"data-disabled":c||void 0,"data-panel":!0,"data-testid":j,id:j,ref:N,style:{...nU,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...P},children:r.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...k,touchAction:T==="horizontal"?"pan-y":"pan-x"},children:e})})}fo.displayName="Panel";const nU={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function sU({layout:e,panelConstraints:t,panelId:s,panelIndex:o}){let l,c;const u=e[s],p=t.find(m=>m.panelId===s);if(p){const m=p.maxSize,h=p.collapsible?p.collapsedSize:p.minSize,g=[o,o+1];c=Ro({layout:Bc({delta:h-u,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[s],l=Ro({layout:Bc({delta:m-u,initialLayout:e,panelConstraints:t,pivotIndices:g,prevLayout:e}),panelConstraints:t})[s]}return{valueControls:s,valueMax:l,valueMin:c,valueNow:u}}function T_({children:e,className:t,disabled:s,disableDoubleClick:o,elementRef:l,id:c,style:u,...p}){const m=C_(c),h=E_({disabled:s,disableDoubleClick:o}),[g,b]=x.useState({}),[v,k]=x.useState("inactive"),[E,y]=x.useState(!1),j=x.useRef(null),C=N_(j,l),{disableCursor:S,id:N,orientation:R,registerSeparator:M,updateSeparatorProps:T}=R_(),z=R==="horizontal"?"vertical":"horizontal";Lo(()=>{const L=j.current;if(L!==null){const H={disabled:h.disabled,disableDoubleClick:h.disableDoubleClick,element:L,id:m},O=M(H),P=zB($=>{k($.next.state!=="inactive"&&$.next.hitRegions.some(q=>q.separator===H)?$.next.state:"inactive")}),B=k_(N,$=>{const{derivedPanelConstraints:q,layout:X,separatorToPanels:Y}=$.next,F=Y.get(H);if(F){const K=F[0],I=F.indexOf(K);b(sU({layout:X,panelConstraints:q,panelId:K.id,panelIndex:I}))}});return()=>{P(),B(),O()}}},[N,m,M,h]),x.useEffect(()=>{T(m,{disabled:s,disableDoubleClick:o})},[s,o,m,T]);let D;s&&!S&&(D="not-allowed");let U;if(s)U="disabled";else switch(v){case"active":{U="active";break}default:E?U="focus":U=v}return r.jsx("div",{...p,"aria-controls":g.valueControls,"aria-disabled":s||void 0,"aria-orientation":z,"aria-valuemax":g.valueMax,"aria-valuemin":g.valueMin,"aria-valuenow":g.valueNow,children:e,className:t,"data-separator":U,"data-testid":m,id:m,onBlur:()=>y(!1),onFocus:()=>y(!0),ref:C,role:"separator",style:{flexBasis:"auto",cursor:D,...u,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}T_.displayName="Separator";function aU({projects:e,value:t,onChange:s,disabled:o}){const l=e.map(c=>{const u=c.path?.split("/").filter(Boolean).pop()||f("modules_ui.code_project_fallback",{id:c.id});return{value:String(c.id),label:c.name||u,icon:MM,description:c.path}});return r.jsx("div",{className:"w-full","data-testid":"code-project-select",children:r.jsx(_t,{value:t,onChange:s,options:l,placeholder:f("modules_ui.code_pick_project_ph"),disabled:o})})}function rU({sessions:e,activeId:t,busy:s,onSelect:o,onCreate:l,onRename:c,onDelete:u}){return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:f("code_module.sessions")}),r.jsx(Ge,{content:f("code_module.new_session"),children:r.jsxs("button",{type:"button",onClick:l,disabled:s,"data-testid":"code-new-session",className:"flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",children:[r.jsx(an,{className:"size-3"})," ",f("code_module.new_session")]})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?r.jsx("div",{className:"p-2",children:r.jsx(bt,{children:f("code_module.no_sessions")})}):r.jsx("ul",{className:"space-y-0.5",children:e.map(p=>r.jsxs("li",{className:"group/item relative",children:[r.jsxs("button",{type:"button",onClick:()=>o(p.id),className:Te("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",p.id===t?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[r.jsx(Gx,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate font-medium",children:p.title}),r.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[p.mode," · ",p.messageCount," msg",p.model?` · ${p.model}`:""]})]})]}),r.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[r.jsx(Ge,{content:f("code_module.rename"),children:r.jsx("button",{type:"button",onClick:()=>c(p.id,p.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:r.jsx(To,{className:"size-3"})})}),r.jsx(Ge,{content:f("code_module.delete"),children:r.jsx("button",{type:"button",onClick:()=>u(p.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:r.jsx(Gn,{className:"size-3"})})})]})]},p.id))})})]})}function oU({mode:e,onChange:t,disabled:s}){const o=(l,c,u,p)=>r.jsx(Ge,{content:u,children:r.jsxs("button",{type:"button",disabled:s,"data-testid":`code-mode-${l}`,"aria-pressed":e===l,onClick:()=>t(l),className:Te("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors disabled:opacity-50",e===l?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(p,{className:"size-3.5"})," ",c]})});return r.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[o("build",f("code_module.mode_build"),f("code_module.mode_build_hint"),IM),o("plan",f("code_module.mode_plan"),f("code_module.mode_plan_hint"),_M)]})}function lU({value:e,onValueChange:t,onSubmit:s,onStop:o,busy:l,disabled:c,mode:u,onModeChange:p,model:m,onModelChange:h}){return r.jsx(h_,{value:e,onValueChange:t,onSubmit:s,onStop:o,busy:l,disabled:c,placeholder:f("code_module.placeholder"),minRows:1,maxRows:6,footer:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(oU,{mode:u,onChange:p,disabled:l}),r.jsx(g_,{value:m,onChange:h,disabled:l})]})})}function Vg(e,t){let s=0;for(const o of e.parts||[])o.kind==="text"&&t.text&&(s+=o.text.length),o.kind==="tool"&&t.tool&&(o.args&&(s+=JSON.stringify(o.args).length),o.result!==void 0&&(s+=JSON.stringify(o.result).length));return Math.ceil(s/4)}function iU(e){let t=null,s=0,o=0;for(const u of e)u.role==="user"?s++:o++,u.role==="assistant"&&u.usage&&(t={input:u.usage.input_tokens,output:u.usage.output_tokens,model:u.model});const l=t?.input??0,c=t?.output??0;return{model:t?.model??null,input:l,output:c,total:l+c,hasUsage:!!t,messages:e.length,userMsgs:s,assistantMsgs:o}}function cU(e){let t=0,s=0,o=0;for(const u of e)u.role==="user"?t+=Vg(u,{text:!0}):s+=Vg(u,{text:!0}),o+=Vg(u,{tool:!0});const l=t+s+o||1,c=(u,p)=>({key:u,tokens:p,percent:Math.round(p/l*100)});return[c("user",t),c("assistant",s),c("tool",o)].filter(u=>u.tokens>0)}const xk={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Ba({label:e,value:t}){return r.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[r.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("span",{className:"min-w-0 truncate text-right font-mono text-xs text-foreground",children:t})]})}function bk(e){if(!e)return"";const t=new Date(e),s=o=>String(o).padStart(2,"0");return`${s(t.getDate())} ${t.toLocaleString("es",{month:"short"})} ${t.getFullYear()}, ${s(t.getHours())}:${s(t.getMinutes())}`}function uU({turns:e,session:t}){const s=x.useMemo(()=>iU(e),[e]),o=x.useMemo(()=>cU(e),[e]);return e.length===0?r.jsx("div",{className:"p-3",children:r.jsx(bt,{children:f("code_module.ctx_none")})}):r.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[r.jsx(Ba,{label:f("code_module.ctx_model"),value:s.model||f("modules_ui.code_ctx_auto")}),t?.mode&&r.jsx(Ba,{label:f("modules_ui.code_ctx_mode"),value:t.mode}),t?.agentSlug&&r.jsx(Ba,{label:f("modules_ui.code_ctx_agent"),value:t.agentSlug}),r.jsx(Ba,{label:f("code_module.ctx_messages"),value:f("modules_ui.code_ctx_msgs_value",{user:s.userMsgs,assistant:s.assistantMsgs})}),r.jsx(Ba,{label:f("code_module.ctx_input"),value:s.input.toLocaleString()}),r.jsx(Ba,{label:f("code_module.ctx_output"),value:s.output.toLocaleString()}),r.jsx(Ba,{label:f("modules_ui.code_ctx_tokens_total"),value:(s.input+s.output).toLocaleString()}),t?.createdAt&&r.jsx(Ba,{label:f("modules_ui.code_ctx_created"),value:bk(t.createdAt)}),t?.updatedAt&&r.jsx(Ba,{label:f("modules_ui.code_ctx_activity"),value:bk(t.updatedAt)}),r.jsx("hr",{className:"border-border my-2"}),r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:f("code_module.ctx_breakdown")}),o.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:o.map(l=>r.jsx(Ge,{content:`${l.key}: ${l.tokens} (${l.percent}%)`,children:r.jsx("div",{className:xk[l.key],style:{width:`${l.percent}%`}})},l.key))}),r.jsx("ul",{className:"mt-2 space-y-1",children:o.map(l=>r.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[r.jsx("span",{className:`size-2 rounded-full ${xk[l.key]}`}),r.jsx("span",{className:"flex-1 text-foreground/80",children:f(`code_module.seg_${l.key}`)}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.tokens," · ",l.percent,"%"]})]},l.key))})]}):r.jsx("p",{className:"text-[11px] text-muted-foreground",children:f("code_module.ctx_none")})]})]})}function dU(e){const t=[];for(const s of(e||"").split(`
646
- `))s.startsWith("diff --git")||s.startsWith("index ")||s.startsWith("--- ")||s.startsWith("+++ ")||s.startsWith("new file")||s.startsWith("deleted file")||s.startsWith("similarity index")||s.startsWith("rename ")||(s.startsWith("@@")?t.push({kind:"hunk",text:s}):s.startsWith("+")?t.push({kind:"add",text:s.slice(1)}):s.startsWith("-")?t.push({kind:"del",text:s.slice(1)}):t.push({kind:"ctx",text:s.replace(/^ /,"")}));for(;t.length&&t[t.length-1].kind==="ctx"&&t[t.length-1].text==="";)t.pop();return t}function fU({patch:e}){const t=x.useMemo(()=>dU(e),[e]);return t.length?r.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:r.jsx("code",{className:"block",children:t.map((s,o)=>r.jsxs("div",{className:Te("px-2 whitespace-pre",s.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",s.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",s.kind==="hunk"&&"bg-muted/60 text-muted-foreground",s.kind==="ctx"&&"text-foreground/70"),children:[r.jsx("span",{className:"select-none opacity-50",children:s.kind==="add"?"+":s.kind==="del"?"-":" "}),s.text]},o))})}):null}const pU={added:NM,modified:Wd,deleted:TM},mU={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 hU({file:e}){const[t,s]=x.useState(!1),o=pU[e.status];return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[r.jsx(Jl,{className:Te("size-3 shrink-0 transition-transform",t&&"rotate-90")}),r.jsx(o,{className:Te("size-3.5 shrink-0",mU[e.status])}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&r.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&r.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),t&&r.jsx("div",{className:"border-t border-border p-1.5",children:r.jsx(fU,{patch:e.patch})})]})}function gU({changes:e,loading:t,onRefresh:s}){const o=e?.files||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:o.length>0?f("code_module.changes_files",{n:o.length}):""}),r.jsx(Ge,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:s,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:t?r.jsx(us,{size:12}):r.jsx(ua,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?r.jsx(bt,{children:f("code_module.changes_no_git")}):o.length===0?r.jsx(bt,{children:f("code_module.changes_none")}):r.jsx("ul",{className:"space-y-1.5",children:o.map(l=>r.jsx(hU,{file:l},l.path))})})]})}const xU=[{value:"context",icon:Of,label:"tab_context"},{value:"changes",icon:LM,label:"tab_changes"},{value:"artifacts",icon:KM,label:"tab_artifacts"}];function bU({pid:e,turns:t,changes:s,changesLoading:o,onRefreshChanges:l,session:c,onRunInTerminal:u,onEditArtifact:p}){const[m,h]=x.useState("context"),g=s?.files.length||0;return r.jsxs(hp,{value:m,onValueChange:h,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[r.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:r.jsx(gp,{variant:"line",className:"w-full",children:xU.map(({value:b,icon:v,label:k})=>{const E=m===b,y=f(`code_module.${k}`);return r.jsx(Ge,{content:y,children:r.jsxs(ra,{value:b,className:E?"flex-1 min-w-0":"w-8 shrink-0",children:[r.jsx(v,{className:"size-3.5 shrink-0"}),E&&r.jsx("span",{className:"truncate text-xs",children:y}),b==="changes"&&g>0&&r.jsx("span",{className:"ml-0.5 rounded-full bg-muted px-1 text-[10px] text-muted-foreground leading-none py-0.5",children:g})]})},b)})})}),r.jsx(Ds,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx(uU,{turns:t,session:c})}),r.jsx(Ds,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(gU,{changes:s,loading:o,onRefresh:l})}),r.jsx(Ds,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(MN,{pid:e,onRunInTerminal:u,onEditArtifact:p})})]})}function _U(e){const t=[];for(const o of e){const l=o.split("/").filter(Boolean);let c=t,u="";for(let p=0;p<l.length;p++){u=u?`${u}/${l[p]}`:l[p];const m=p===l.length-1;let h=c.find(g=>g.name===l[p]);h||(h={name:l[p],path:u,type:m?"file":"dir",children:m?void 0:[]},c.push(h)),m||(c=h.children)}}const s=o=>(o.forEach(l=>{l.children&&(l.children=s(l.children))}),o.sort((l,c)=>l.type!==c.type?l.type==="dir"?-1:1:l.name.localeCompare(c.name)));return s(t)}function oE({node:e,depth:t,onOpenFile:s,openDirs:o,toggleDir:l}){const c=e.type==="dir",u=c&&o.has(e.path);return r.jsxs("li",{children:[r.jsxs("button",{type:"button",onClick:()=>c?l(e.path):s(e.path),style:{paddingLeft:`${t*12+6}px`},className:Te("flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[11px] rounded transition-colors","hover:bg-accent/40",c?"text-foreground/80":"text-foreground/70"),children:[c?r.jsxs(r.Fragment,{children:[r.jsx(Jl,{className:Te("size-3 shrink-0 transition-transform",u&&"rotate-90")}),u?r.jsx(Mf,{className:"size-3.5 shrink-0 text-amber-400"}):r.jsx(OM,{className:"size-3.5 shrink-0 text-amber-400"})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(AM,{className:"size-3.5 shrink-0 text-sky-400"})]}),r.jsx("span",{className:"truncate",children:e.name})]}),c&&u&&e.children&&e.children.length>0&&r.jsx("ul",{children:e.children.map(p=>r.jsx(oE,{node:p,depth:t+1,onOpenFile:s,openDirs:o,toggleDir:l},p.path))})]})}function vU({pid:e,projectPath:t,className:s,onOpenFile:o}){const[l,c]=x.useState([]),[u,p]=x.useState(!1),[m,h]=x.useState(!1),[g,b]=x.useState(()=>new Set),v=x.useCallback(async()=>{p(!0);try{const S=(await he.post("/run",{cmd:"find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' -not -path '*/dist/*' -not -path '*/.claude/*' | sed 's|^\\./||' | sort | head -500",project:e})).stdout.split(`
647
- `).map(N=>N.trim()).filter(Boolean);c(S),h(!0)}catch{h(!0)}finally{p(!1)}},[e]);x.useEffect(()=>{b(new Set),v()},[v]);const k=x.useCallback(C=>{b(S=>{const N=new Set(S);return N.has(C)?N.delete(C):N.add(C),N})},[]),E=x.useCallback(()=>{b(new Set)},[]),y=_U(l),j=g.size>0;return r.jsxs("div",{className:Te("flex h-full flex-col",s),"data-testid":"code-file-tree",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Archivos"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(Ge,{content:f("code_module.tree_collapse_all"),children:r.jsx("button",{type:"button",onClick:E,disabled:!j,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:r.jsx(xM,{className:"size-3"})})}),r.jsx(Ge,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void v(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:u?r.jsx(us,{size:12}):r.jsx(ua,{className:"size-3"})})})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:m?y.length===0?r.jsx("div",{className:"p-3",children:r.jsx(bt,{children:"Sin archivos"})}):r.jsx("ul",{children:y.map(C=>r.jsx(oE,{node:C,depth:0,onOpenFile:o??(()=>{}),openDirs:g,toggleDir:k},C.path))}):r.jsx("div",{className:"flex justify-center pt-6",children:r.jsx(us,{size:14})})})]})}function yU({path:e,content:t,loading:s,onSave:o}){const l=typeof o=="function",[c,u]=x.useState(t),[p,m]=x.useState(!1);x.useEffect(()=>{u(t)},[t]);const h=l&&c!==t,g=async()=>{if(!(!o||!h)){m(!0);try{await o(c)}finally{m(!1)}}};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"code-file-viewer",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e,h&&r.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),l&&r.jsxs(r.Fragment,{children:[r.jsx(Ge,{content:f("code_module.discard_changes"),children:r.jsxs("button",{type:"button",onClick:()=>u(t),disabled:!h||p,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",children:[r.jsx(Df,{className:"size-3"}),"Descartar"]})}),r.jsx(Ge,{content:f("code_module.save_shortcut_hint"),children:r.jsxs("button",{type:"button",onClick:()=>void g(),disabled:!h||p,className:Te("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",h&&!p?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[p?r.jsx(us,{size:10}):r.jsx(Lf,{className:"size-3"}),"Guardar"]})})]})]}),s?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(us,{size:16})}):l?r.jsx("textarea",{value:c,onChange:b=>u(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),g())},className:"min-h-0 flex-1 resize-none bg-transparent p-3 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none",spellCheck:!1}):r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:r.jsx("tbody",{children:t.split(`
648
- `).map((b,v)=>r.jsxs("tr",{className:"hover:bg-accent/20",children:[r.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 py-0 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:v+1}),r.jsx("td",{className:"px-4 py-0 align-top text-foreground/90 whitespace-pre",children:b||" "})]},v))})})})]})}function jU({pid:e,className:t,initCmd:s,onClose:o}){const[l,c]=x.useState([]),[u,p]=x.useState(""),[m,h]=x.useState(!1),[g,b]=x.useState([]),[v,k]=x.useState(-1),E=x.useRef(null),y=x.useRef(null);x.useEffect(()=>{E.current?.scrollIntoView({behavior:"smooth"})},[l]),x.useEffect(()=>{s&&(p(s),setTimeout(()=>y.current?.focus(),50))},[s]);const j=async S=>{const N=S.trim();if(N){b(R=>[N,...R.slice(0,49)]),k(-1),c(R=>[...R,{type:"cmd",text:`$ ${N}`}]),h(!0);try{const R=await he.post("/run",{cmd:N,project:e});R.stdout&&c(M=>[...M,{type:"out",text:R.stdout}]),R.stderr&&c(M=>[...M,{type:"err",text:R.stderr}])}catch(R){c(M=>[...M,{type:"err",text:String(R.message)}])}finally{h(!1)}}},C=S=>{if(S.key==="Enter")j(u),p("");else if(S.key==="ArrowUp"){S.preventDefault();const N=Math.min(v+1,g.length-1);k(N),p(g[N]??"")}else if(S.key==="ArrowDown"){S.preventDefault();const N=Math.max(v-1,-1);k(N),p(N===-1?"":g[N]??"")}};return r.jsxs("div",{className:Te("flex h-full min-h-0 flex-col bg-card/60",t),"data-testid":"code-terminal",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1",children:[r.jsx(Ga,{className:"size-3 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),r.jsx(Ge,{content:f("code_module.terminal_clear"),children:r.jsx("button",{type:"button",onClick:()=>c([]),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(SM,{className:"size-3"})})}),r.jsx(Ge,{content:f("code_module.terminal_close"),children:r.jsx("button",{type:"button",onClick:()=>o?.(),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Ys,{className:"size-3"})})})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-1 font-mono text-[11px] leading-snug cursor-text",onClick:()=>y.current?.focus(),children:[l.map((S,N)=>r.jsx("div",{className:Te("whitespace-pre-wrap break-all",S.type==="cmd"&&"text-emerald-400",S.type==="err"&&"text-rose-400",S.type==="out"&&"text-foreground/90"),children:S.text},N)),r.jsx("div",{ref:E})]}),r.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-3 py-1",children:[r.jsx("span",{className:"mr-2 text-[11px] text-emerald-400 font-mono",children:"$"}),r.jsx("input",{ref:y,value:u,onChange:S=>p(S.target.value),onKeyDown:C,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 uc="super-agent";function qg(){return r.jsx(T_,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function wU(){return r.jsx(T_,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function kU(){const e=ot(),t=We("/projects",()=>ls.list()),s=x.useMemo(()=>t.data||[],[t.data]),[o,l]=x.useState(""),[c,u]=x.useState(null),[p,m]=x.useState(uc),[h,g]=x.useState([]),[b,v]=x.useState(""),[k,E]=x.useState(!1),[y,j]=x.useState(!0),[C,S]=x.useState(!0),[N,R]=x.useState(!1),[M,T]=x.useState(""),[z,D]=x.useState(!1),U=x.useRef(null),[L,H]=$c(),O=x.useRef(!1),[P,B]=x.useState([]),[$,q]=x.useState("chat"),X=x.useCallback(xe=>{R(!0),T(xe)},[]);x.useEffect(()=>{!o&&s.length&&l(String(s[0].id))},[o,s]);const Y=We(o?["code-sessions",o]:null,()=>Ia.sessions.list(o)),F=We(o?["agents",o]:null,()=>ln.list(o)),K=We(o&&c?["code-session",o,c]:null,()=>Ia.sessions.get(o,c)),I=We(o&&c?["code-changes",o,c]:null,()=>Ia.changes(o,c));x.useEffect(()=>{const xe=Y.data||[];!c&&xe.length&&u(xe[0].id),c&&xe.length&&!xe.some(Le=>Le.id===c)&&u(xe[0]?.id??null)},[Y.data,c]),x.useEffect(()=>{K.data&&m(K.data.agentSlug||uc)},[K.data]),x.useEffect(()=>{k||(K.data?g(K.data.messages||[]):c||g([]))},[K.data,c,k]),x.useEffect(()=>()=>U.current?.abort(),[]);const G=K.data,Z=G?.mode==="plan"?"plan":"build",te=G?.model||"",de=xe=>{xe===o||k||(l(xe),u(null),g([]))},ee=xe=>{k||xe===c||(u(xe),g([]))},ne=async()=>{if(!(!o||k))try{const xe=await Ia.sessions.create(o,{title:f("code_module.untitled"),agentSlug:p!==uc?p:null});await Y.mutate(),u(xe.id),g([])}catch(xe){e.error(xe.message)}},ae=async(xe,Le)=>{const Ke=window.prompt(f("code_module.rename"),Le);if(!(!Ke||Ke===Le))try{await Ia.sessions.update(o,xe,{title:Ke}),await Y.mutate(),xe===c&&await K.mutate()}catch(it){e.error(it.message)}},pe=async xe=>{if(!k&&window.confirm(f("code_module.delete_confirm")))try{await Ia.sessions.remove(o,xe),xe===c&&(u(null),g([])),await Y.mutate()}catch(Le){e.error(Le.message)}},Me=async xe=>{if(m(xe),!!c)try{await Ia.sessions.update(o,c,{agentSlug:xe!==uc?xe:null}),await Promise.all([K.mutate(),Y.mutate()])}catch(Le){e.error(Le.message)}},ue=x.useCallback(async xe=>{if(c)try{await Ia.sessions.update(o,c,xe),await Promise.all([K.mutate(),Y.mutate()])}catch(Le){e.error(Le.message)}},[o,c,K,Y,e]),me=()=>{U.current?.abort(),E(!1)},ke=xe=>g(Le=>{const Ke=[...Le],it=Ke[Ke.length-1];return it&&it.role==="assistant"&&(Ke[Ke.length-1]=xe(it)),Ke}),je=async xe=>{const Le=(xe??b).trim();if(!Le||k||!o||!c)return;const Ke=new Date().toISOString();g(ft=>[...ft,{role:"user",parts:[{kind:"text",text:Le}],ts:Ke},{role:"assistant",parts:[],ts:Ke,pending:!0}]),v(""),E(!0);const it=new AbortController;U.current=it;const Xe=ft=>{if(ft.type==="error"){e.error(ft.error||f("modules_ui.code_stream_error"));return}ke(Ot=>x_(Ot,ft))};try{await Ia.stream(o,c,{prompt:Le},Xe,it.signal),ke(ft=>({...ft,pending:!1}))}catch(ft){it.signal.aborted?ke(Ot=>({...Ot,pending:!1,parts:[...Ot.parts,{kind:"text",text:f("code_module.stopped")}]})):(e.error(ft.message),g(Ot=>Ot.filter((Wt,Yt)=>Yt!==Ot.length-1)))}finally{U.current===it&&(U.current=null),E(!1),K.mutate(),Y.mutate(),I.mutate()}},Be=async xe=>{try{await navigator.clipboard.writeText(xe),e.info(f("modules_ui.code_copied"))}catch{}},He=x.useCallback(xe=>{q(xe),B(Le=>Le.some(Ke=>Ke.path===xe)?Le:[...Le,{path:xe,content:"",loading:!0}]),he.post("/run",{cmd:`cat "${xe}"`,project:o}).then(Le=>{const Ke=Le.stdout||Le.stderr||f("modules_ui.code_file_empty");B(it=>it.map(Xe=>Xe.path===xe?{...Xe,content:Ke,loading:!1}:Xe))}).catch(Le=>{B(Ke=>Ke.map(it=>it.path===xe?{...it,content:f("modules_ui.code_file_error",{msg:Le.message}),loading:!1}:it))})},[o]),we=x.useCallback(xe=>{B(Le=>Le.filter(Ke=>Ke.path!==xe)),q(Le=>Le===xe?"chat":Le)},[]),Re=x.useCallback(xe=>{const Le=`artifacts/${xe}`;q(Le),B(Ke=>Ke.some(it=>it.path===Le)?Ke:[...Ke,{path:Le,content:"",loading:!0,artifactName:xe}]),Tr.read(o,xe).then(Ke=>{B(it=>it.map(Xe=>Xe.path===Le?{...Xe,content:Ke.content,loading:!1}:Xe))}).catch(Ke=>{B(it=>it.map(Xe=>Xe.path===Le?{...Xe,content:f("modules_ui.code_file_error",{msg:Ke.message}),loading:!1}:Xe))})},[o]);x.useEffect(()=>{if(O.current)return;const xe=L.get("pid"),Le=L.get("cmd"),Ke=L.get("edit");if(!(!xe||!Le&&!Ke)){if(String(o)!==String(xe)){l(String(xe));return}O.current=!0,Ke&&Re(Ke),Le&&X(Le.endsWith(" ")?Le:Le+" "),H({},{replace:!0})}},[L,o,Re,X,H]);const ve=x.useCallback(async(xe,Le)=>{const Ke=P.find(it=>it.path===xe);if(Ke?.artifactName)try{await Tr.write(o,Ke.artifactName,Le),B(it=>it.map(Xe=>Xe.path===xe?{...Xe,content:Le}:Xe)),e.info(f("modules_ui.code_saved"))}catch(it){e.error(it.message)}},[P,o,e]),Ce=!t.isLoading&&s.length>0,De=x.useMemo(()=>{const xe=[{value:uc,label:f("modules_ui.code_super_agent"),icon:on,description:f("modules_ui.code_super_agent_desc")}],Le=(F.data||[]).map(Ke=>({value:Ke.slug,label:Ke.slug,icon:on,description:Ke.description||Ke.role||void 0}));return[...xe,...Le]},[F.data]),Pe=x.useMemo(()=>h,[h]),Ie=x.useMemo(()=>Y.data?.find(xe=>xe.id===c)?.title||"",[Y.data,c]),le=x.useMemo(()=>s.find(xe=>String(xe.id)===o),[s,o]);eP(Ie);const[_e,qe]=x.useState(null),Ne=k?null:TN(h),Oe=Ne&&Ne.turnKey!==_e,et=xe=>{je(xe)},at=x.useCallback(()=>j(xe=>!xe),[]),vt=x.useCallback(()=>D(xe=>!xe),[]),Mt=x.useCallback(()=>R(xe=>!xe),[]),lt=x.useCallback(()=>S(xe=>!xe),[]),Rt=x.useMemo(()=>c?r.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:sS,open:y,toggle:at,title:f("modules_ui.code_panel_sessions")},{Icon:eS,open:z,toggle:vt,title:f("modules_ui.code_panel_tree")},{Icon:Ga,open:N,toggle:Mt,title:f("modules_ui.code_panel_terminal")},{Icon:XM,open:C,toggle:lt,title:f("modules_ui.code_panel_context")}].map(({Icon:xe,open:Le,toggle:Ke,title:it})=>r.jsx(Ge,{content:it,children:r.jsx("button",{type:"button",onClick:Ke,"data-active":Le,className:"rounded p-1 text-muted-fg transition-colors hover:bg-accent hover:text-accent-fg data-[active=true]:bg-accent data-[active=true]:text-accent-fg",children:r.jsx(xe,{className:"size-3.5"})})},it))}):null,[c,y,z,N,C,at,vt,Mt,lt]);return nP(Rt),r.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:t.isLoading?r.jsx(rt,{}):Ce?r.jsxs(zx,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[r.jsx(fo,{id:"top",defaultSize:N?"55%":"100%",minSize:"20%",children:r.jsxs(zx,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[y&&r.jsxs(r.Fragment,{children:[r.jsx(fo,{id:"left",defaultSize:"14%",minSize:"8%",children:r.jsxs("aside",{className:"flex h-full flex-col",children:[r.jsx("div",{className:"shrink-0 border-b border-border p-2",children:r.jsx(aU,{projects:s,value:o,onChange:de,disabled:k})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(rU,{sessions:Y.data||[],activeId:c,busy:k,onSelect:ee,onCreate:ne,onRename:ae,onDelete:pe})}),r.jsx("div",{className:"shrink-0 border-t border-border p-2",children:r.jsx(_t,{value:p,onChange:Me,options:De,disabled:k,showIcon:!0})})]})}),r.jsx(qg,{})]}),z&&r.jsxs(r.Fragment,{children:[r.jsx(fo,{id:"tree",defaultSize:"13%",minSize:"8%",children:r.jsx("div",{className:"h-full",children:r.jsx(vU,{pid:o,projectPath:le?.path,onOpenFile:He})})}),r.jsx(qg,{})]}),r.jsx(fo,{id:"main",defaultSize:"50%",minSize:"20%",children:r.jsxs("div",{className:"flex h-full flex-col",children:[P.length>0&&r.jsxs("div",{className:"flex shrink-0 items-center gap-0 overflow-x-auto border-b border-border",children:[r.jsxs("button",{type:"button",onClick:()=>q("chat"),"data-active":$==="chat",className:"flex shrink-0 items-center gap-1.5 border-r border-border px-3 py-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(Gx,{className:"size-3 shrink-0"}),f("modules_ui.code_chat_tab")]}),P.map(xe=>{const Le=xe.path.split("/").pop()??xe.path,Ke=$===xe.path;return r.jsxs("div",{"data-active":Ke,className:"group flex shrink-0 items-center gap-1 border-r border-border px-2 py-2 text-[11px] text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(Ge,{content:xe.path,children:r.jsx("button",{type:"button",onClick:()=>q(xe.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:Le})}),r.jsx(Ge,{content:f("code_module.close"),children:r.jsx("button",{type:"button",onClick:()=>we(xe.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:r.jsx(Ys,{className:"size-2.5"})})})]},xe.path)})]}),$==="chat"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?h.length?r.jsx(b_,{msgs:h,onCopy:Be}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(bt,{children:f("code_module.empty_chat")})}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(bt,{children:f("code_module.pick_project")})})}),Oe&&Ne&&r.jsx(RN,{turnKey:Ne.turnKey,questions:Ne.questions,onSubmit:et,onDismiss:()=>qe(Ne.turnKey),disabled:k})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const xe=P.find(Le=>Le.path===$);return xe?r.jsx(yU,{path:xe.path,content:xe.content,loading:xe.loading,onSave:xe.artifactName?Le=>ve(xe.path,Le):void 0}):null})()}),r.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:r.jsx(lU,{value:b,onValueChange:v,onSubmit:()=>void je(),onStop:me,busy:k,disabled:!c,mode:Z,onModeChange:xe=>void ue({mode:xe}),model:te,onModelChange:xe=>void ue({model:xe||null})})})]})}),C&&r.jsxs(r.Fragment,{children:[r.jsx(qg,{}),r.jsx(fo,{id:"right",defaultSize:"22%",minSize:"15%",children:r.jsx("aside",{className:"flex h-full flex-col",children:r.jsx(bU,{pid:o,turns:Pe,changes:I.data,changesLoading:I.isLoading,onRefreshChanges:()=>void I.mutate(),session:K.data?{title:K.data.title,mode:K.data.mode,createdAt:K.data.createdAt,updatedAt:K.data.updatedAt,agentSlug:K.data.agentSlug??null}:null,onRunInTerminal:X,onEditArtifact:Re})})})]})]})}),N&&o&&r.jsxs(r.Fragment,{children:[r.jsx(wU,{}),r.jsx(fo,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:r.jsx(jU,{pid:o,initCmd:M,onClose:Mt,className:"h-full"})})]})]}):r.jsx("div",{className:"grid flex-1 place-items-center",children:r.jsx(bt,{children:f("code_module.no_projects")})})})}function SU({open:e,onClose:t}){const{mutate:s}=jC(),o=Yn(),l=ot(),[c,u]=x.useState(""),[p,m]=x.useState(!1),[h,g]=x.useState(""),[b,v]=x.useState([]),[k,E]=x.useState(null),[y,j]=x.useState(""),[C,S]=x.useState(!1),[N,R]=x.useState(!1),M=async(D,U=!1)=>{S(!0),j("");try{const L=await Uj.dirs(D||"~");g(L.path),u(L.path),E(L.parent),v(L.entries)}catch(L){const H=L.message;j(H),U||l.error(H)}finally{S(!1)}};x.useEffect(()=>{e||(u(""),m(!1),g(""),v([]),E(null),j(""))},[e]);const T=async()=>{S(!0);try{const D=await Uj.pickDir(f("add_project.picker_prompt"));if("cancelled"in D)return;u(D.path);return}catch{m(!0),await M(c||"~")}finally{S(!1)}},z=async()=>{const D=c.trim();if(!D){l.error(f("add_project.path_required"));return}R(!0);try{const U=await ls.register(D);l.success(f("add_project.registered",{id:U.id})),await s("/projects"),t(),o(`/p/${U.id}`)}catch(U){l.error(U.message)}finally{R(!1)}};return r.jsx(Sn,{open:e,onClose:t,title:f("add_project.title"),description:f("add_project.subtitle"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ce,{variant:"ghost",onClick:t,disabled:N,children:f("common.cancel")}),r.jsx(ce,{variant:"primary",onClick:z,loading:N,children:f("add_project.register")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(ie,{label:f("add_project.path_label"),hint:f("add_project.path_hint"),children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ee,{autoFocus:!0,placeholder:f("add_project.path_placeholder"),value:c,onChange:D=>u(D.target.value),onKeyDown:D=>{D.key==="Enter"&&z()}}),r.jsxs(ce,{onClick:T,disabled:C,children:[r.jsx(vc,{size:14})," ",f("add_project.search_btn")]})]})}),p&&r.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:h||c||"~"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>M("~"),disabled:C,children:r.jsx(UM,{size:13})}),r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>k&&M(k),disabled:!k||C,children:".."}),r.jsx(ce,{size:"sm",variant:"ghost",onClick:()=>m(!1),disabled:C,children:r.jsx(Ys,{size:13})})]})]}),r.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[C&&r.jsx(rt,{}),!C&&y&&r.jsx(bt,{children:f("add_project.browser_unavailable")}),!C&&!y&&b.length===0&&r.jsx(bt,{children:f("add_project.no_folders")}),!C&&!y&&b.map(D=>r.jsxs("button",{type:"button",onClick:()=>M(D),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[r.jsx(Mf,{size:14,className:"text-muted-fg"}),r.jsx("span",{className:"truncate",children:D.split("/").pop()}),r.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:D})]},D))]})]})]})})}function CU({onPaired:e}){const[t,s]=x.useState(""),[o,l]=x.useState(NU()),[c,u]=x.useState(!1),[p,m]=x.useState(null);async function h(){const g=t.trim();if(!g){m(f("pairing.err_required"));return}u(!0),m(null);try{const b=await Yl.confirm({pairing_id:g,label:o.trim()||void 0});po(b.token);try{localStorage.setItem(An.token,b.token)}catch{}e()}catch(b){m(EU(b)),u(!1)}}return r.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:r.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[r.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:r.jsx(Yg,{size:20})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-base font-semibold",children:f("pairing.title")}),r.jsx("p",{className:"text-xs text-muted-fg",children:f("pairing.subtitle")})]})]}),r.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[r.jsx("li",{className:"font-medium text-foreground",children:f("pairing.steps_title")}),r.jsxs("li",{children:["1. ",f("pairing.step_1")]}),r.jsxs("li",{children:["2. ",f("pairing.step_2")]}),r.jsxs("li",{children:["3. ",f("pairing.step_3")]})]}),r.jsxs("form",{className:"space-y-3",onSubmit:g=>{g.preventDefault(),h()},children:[r.jsx(ie,{label:f("pairing.code_label"),children:r.jsx(Ee,{value:t,onChange:g=>s(g.target.value),placeholder:f("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),r.jsx(ie,{label:f("pairing.label_label"),hint:f("pairing.revoke_hint"),children:r.jsx(Ee,{value:o,onChange:g=>l(g.target.value),placeholder:f("pairing.label_ph")})}),p&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p}),r.jsx(ce,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:f(c?"pairing.linking":"pairing.submit")})]})]})})}function NU(){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 EU(e){if(e instanceof Qc){if(e.status===410)return f("pairing.err_expired");if(e.status===404||e.status===409)return f("pairing.err_unknown")}return f("pairing.err_generic")}function RU({...e}){return r.jsx(LC,{"data-slot":"sheet",...e})}function TU({...e}){return r.jsx(DC,{"data-slot":"sheet-portal",...e})}function AU({className:e,...t}){return r.jsx(AC,{"data-slot":"sheet-overlay",className:Ct("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 MU({className:e,children:t,side:s="right",showCloseButton:o=!0,...l}){return r.jsxs(TU,{children:[r.jsx(AU,{}),r.jsxs(zC,{"data-slot":"sheet-content","data-side":s,className:Ct("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...l,children:[t,o&&r.jsxs(pp,{"data-slot":"sheet-close",render:r.jsx(Qa,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[r.jsx(Ys,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function OU({className:e,...t}){return r.jsx("div",{"data-slot":"sheet-header",className:Ct("flex flex-col gap-0.5 p-4",e),...t})}function zU({className:e,...t}){return r.jsx(PC,{"data-slot":"sheet-title",className:Ct("font-heading text-base font-medium text-foreground",e),...t})}function DU({className:e,...t}){return r.jsx(MC,{"data-slot":"sheet-description",className:Ct("text-sm text-muted-foreground",e),...t})}function LU({value:e,projectPath:t,onPick:s}){const o=PU(e),l=o?IU(e):"",{data:c}=We(o?["/skills",t||""]:null,()=>pc.list(t)),u=c?.skills||[],p=x.useMemo(()=>{const m=l.toLowerCase();return m?u.filter(h=>h.slug.toLowerCase().includes(m)).slice(0,8):u.slice(0,8)},[u,l]);return!o||p.length===0?null:r.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[r.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:p.map(m=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(m.slug),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-accent hover:text-accent-foreground",children:[r.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",m.slug]}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:m.description})]})},m.slug))}),r.jsx("div",{className:"border-t border-border px-3 py-1.5 text-[10px] text-muted-foreground",children:"Type a name to filter · click to insert · the skill body will be loaded for this turn."})]})}function PU(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function IU(e){const t=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return t?t[1]:""}function BU(){try{const e=localStorage.getItem(An.robyChat);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(s=>s&&Array.isArray(s.parts)&&!s.pending):[]}catch{return[]}}function UU({open:e,onOpenChange:t}){const s=up(),o=ot(),[l,c]=x.useState(BU),[u,p]=x.useState(""),[m,h]=x.useState(!1),[g,b]=x.useState(""),v=x.useRef(null);x.useEffect(()=>{const S=l.filter(N=>!N.pending);try{S.length?localStorage.setItem(An.robyChat,JSON.stringify(S)):localStorage.removeItem(An.robyChat)}catch{}},[l]);const k=()=>{if(!m){c([]),p("");try{localStorage.removeItem(An.robyChat)}catch{}}};x.useEffect(()=>()=>v.current?.abort(),[]),x.useEffect(()=>{const S=N=>{const R=N.detail?.prompt;typeof R=="string"&&(t(!0),p(R))};return window.addEventListener("apx:roby-prompt",S),()=>window.removeEventListener("apx:roby-prompt",S)},[t]);const E=()=>{v.current?.abort(),h(!1)},y=S=>c(N=>{const R=[...N],M=R[R.length-1];return M?.role==="assistant"&&(R[R.length-1]=S(M)),R}),j=async()=>{const S=u.trim();if(!S||m)return;const N=new Date().toISOString(),R=l.filter(D=>!D.pending).map(D=>({role:D.role,content:Cx(D)}));c(D=>[...D,{role:"user",parts:[{kind:"text",text:S}],ts:N},{role:"assistant",parts:[],ts:N,pending:!0}]),p(""),h(!0);const M=new AbortController;v.current=M;let T=!1;const z=D=>{if(D?.type==="error"){T=!0,o.error(D.error||"error"),c(U=>{const L=[...U],H=L[L.length-1];return H?.role==="assistant"&&H.pending&&L.pop(),L});return}y(U=>x_(U,D))};try{await kC.stream(0,{prompt:S,previousMessages:R,model:g||void 0,channel:"web_sidebar"},z,M.signal),y(D=>({...D,pending:!1}))}catch(D){M.signal.aborted?y(U=>({...U,pending:!1,parts:[...U.parts,{kind:"text",text:f("project.chat.stopped_marker")}]})):T||(o.error(D.message),c(U=>{const L=[...U],H=L[L.length-1];return H?.role==="assistant"&&H.pending&&L.pop(),L}))}finally{v.current===M&&(v.current=null),h(!1)}},C=async S=>{try{await navigator.clipboard.writeText(S),o.info(f("project.chat.copied"))}catch{}};return r.jsx(RU,{open:e,onOpenChange:t,children:r.jsxs(MU,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[r.jsxs(OU,{className:"pr-12",children:[r.jsxs(zU,{className:"flex items-center gap-2",children:[r.jsx(on,{size:18})," ",f("superagent.title",{persona:s}),r.jsx("span",{className:"text-xs font-normal text-muted-fg",children:f("superagent.badge")})]}),r.jsx(DU,{children:f("superagent.desc")})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?r.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:f("superagent.empty",{persona:s})}):r.jsx(b_,{msgs:l,onCopy:C})}),r.jsx(EN,{msgs:l}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsx("div",{className:"mb-1.5",children:r.jsx(LU,{value:u,onPick:S=>p(`/${S} `)})}),r.jsx(h_,{value:u,onValueChange:p,onSubmit:()=>void j(),onStop:E,busy:m,placeholder:f("superagent.placeholder"),footer:r.jsx(g_,{value:g,onChange:b,disabled:m})}),r.jsx("div",{className:"mt-1.5 flex justify-end",children:r.jsxs(Qa,{size:"xs",variant:"ghost",onClick:k,disabled:m||l.length===0,children:[r.jsx(an,{className:"size-3"})," ",f("superagent.new_chat")]})})]})]})})}function HU(){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 VU(){const[e,t]=x.useState({status:"loading"}),[s,o]=x.useState(0),l=x.useCallback(()=>{t({status:"loading"}),o(c=>c+1)},[]);return x.useEffect(()=>{let c=!1;return(async()=>{try{const g=await fetch("/health");if(!g.ok)throw new Error(`HTTP ${g.status}`)}catch(g){c||t({status:"error",reason:String(g)});return}const u=window.location.hash.replace(/^#/,""),p=new URLSearchParams(u),m=p.get("pair");if(m){history.replaceState(null,"",window.location.pathname+window.location.search);try{const g=await Yl.confirm({pairing_id:m,label:HU(),kind:"web"});po(g.token);try{localStorage.setItem(An.token,g.token)}catch{}c||t({status:"ok"});return}catch{}}const h=p.get("token");if(h){po(h);try{localStorage.setItem(An.token,h)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const g=localStorage.getItem(An.token);g&&po(g)}catch{}try{const g=await fetch("/admin/web-token");if(g.ok){const b=await g.json();if(b?.token){po(b.token);try{localStorage.setItem(An.token,b.token)}catch{}}}}catch{}if(!Qb()){c||t({status:"unpaired"});return}try{await he.get("/projects"),c||t({status:"ok"})}catch(g){if(g instanceof Qc&&(g.status===401||g.status===403)){po(null);try{localStorage.removeItem(An.token)}catch{}c||t({status:"unpaired"})}else c||t({status:"error",reason:String(g)})}})(),()=>{c=!0}},[s]),{...e,reload:l}}function qU(){const e=VU();return e.status==="loading"?r.jsx(_k,{text:f("daemon.connecting")}):e.status==="error"?r.jsx(_k,{mood:"sad",text:f("daemon.unreachable"),sub:`${f("daemon.unreachable_hint")}
649
-
650
- ${e.reason}`}):e.status==="unpaired"?r.jsx(CU,{onPaired:e.reload}):r.jsx(FL,{children:r.jsx(az,{delay:0,children:r.jsx($U,{})})})}function $U(){const e=Yn(),t=Zn(),[s,o]=$c(),{theme:l,toggle:c}=Wx(),u=s.get("action")==="add-project",[p,m]=x.useState(!1),h=()=>{const b=new URLSearchParams(s);b.delete("action"),o(b,{replace:!0})},g=()=>{const b=new URLSearchParams(s);b.set("action","add-project"),o(b)};return r.jsx(QL,{children:r.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[r.jsx(sL,{onSelect:b=>e(b),onOpenRoby:()=>m(!0),onOpenAddProject:g}),r.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:[r.jsx(FU,{onToggleTheme:c,isDark:l==="dark",pathname:t.pathname}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs(Uk,{children:[r.jsx(Kt,{path:"/",element:r.jsx(XL,{})}),r.jsx(Kt,{path:"/settings/*",element:r.jsx(xB,{})}),r.jsx(Kt,{path:"/m/desktop/*",element:r.jsx(vB,{})}),r.jsx(Kt,{path:"/m/code/*",element:r.jsx(kU,{})}),r.jsx(Kt,{path:"/p/:pid/*",element:r.jsx(U8,{})}),r.jsx(Kt,{path:"*",element:r.jsx(QU,{})})]})})]}),r.jsx(SU,{open:u,onClose:h}),r.jsx(UU,{open:p,onOpenChange:m})]})})}function FU({onToggleTheme:e,isDark:t,pathname:s}){const{projects:o}=Wc(),l=JL(),c=s.split("/").filter(Boolean),u=c[0]==="p"?o.find(E=>String(E.id)===c[1]):void 0,p=c[0]==="settings"?KU(c[1]):c[0]==="p"?XU(c[2]):"",m=c[0]==="p"&&c[1]==="0",h=u?.name||u?.path?.split("/").pop()||f("nav.project"),g=s==="/"?f("topbar.breadcrumb_root"):c[0]==="settings"?[f("topbar.breadcrumb_root"),f("nav.settings"),p].filter(Boolean).join(" › "):c[0]==="m"?[f("topbar.breadcrumb_root"),YU(c[1]),l].filter(Boolean).join(" › "):c[0]==="p"?m?[f("topbar.breadcrumb_root"),f("topbar.breadcrumb_base"),p].filter(Boolean).join(" › "):[f("topbar.breadcrumb_root"),f("topbar.breadcrumb_projects"),h,p].filter(Boolean).join(" › "):f("topbar.breadcrumb_root"),b=s==="/"?"":c[0]==="settings"?f("settings.subtitle"):c[0]==="p"?m?f("base.subtitle"):u?`${CC(u.kind)} · ${u.path}`:"":"",v=WL(),k=tP();return r.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[v&&r.jsx(hD,{collapsed:v.collapsed,onToggle:v.toggle}),r.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[g,b&&r.jsxs("span",{className:"text-muted-fg/50",children:[" · ",b]})]}),k,r.jsx(GU,{}),r.jsx(Ge,{content:f(t?"topbar.light":"topbar.dark"),children:r.jsx("button",{type:"button","data-testid":"theme-toggle",onClick:e,className:"shrink-0 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:t?r.jsx(t3,{size:14}):r.jsx(YM,{size:14})})})]})}function GU(){const e=Gb(),t=s=>{s!==e&&(fC(s),window.location.reload())};return r.jsxs(cC,{children:[r.jsxs(uC,{"data-testid":"lang-menu",title:f("topbar.lang_toggle"),className:"flex shrink-0 items-center gap-1 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:[r.jsx(VM,{size:14}),r.jsx("span",{className:"text-[11px] font-medium uppercase",children:e})]}),r.jsx(dC,{align:"end",children:r.jsx(lD,{value:e,onValueChange:s=>t(s),children:pC.map(s=>r.jsx(iD,{value:s.value,children:s.label},s.value))})})]})}function YU(e){switch(e){case"desktop":return f("nav.modules.desktop");case"code":return f("nav.modules.code");default:return e||""}}function KU(e){switch(e){case"super-agent":return f("settings.tabs.super_agent");case"engines":return f("settings.tabs.engines");case"telegram":return f("settings.tabs.telegram");case"devices":return f("settings.tabs.devices");case"voice":return f("nav.modules.voice");case"deck":return f("nav.modules.deck");case"desktop":return f("nav.modules.desktop");case"appearance":return f("settings.appearance");case"config":case"advanced":return f("settings.tabs.advanced");case"identity":default:return e||""}}function XU(e){switch(e){case"chat":return f("project.nav.chat");case"telegram":return f("project.nav.telegram");case"agents":return f("project.nav.agents");case"routines":return f("project.nav.routines");case"tasks":return f("project.nav.tasks");case"mcps":return f("project.nav.mcps");case"artifacts":return f("project.nav.artifacts");case"config":return f("project.nav.config");case"workspaces":return f("base.workspaces_title");case"models":return f("settings.tabs.engines");case"agent-defaults":return f("base.defaults_title");case"sessions":return f("base.sessions_title");case"logs":return f("project.nav.logs");case"memories":return f("project.nav.memories");default:return""}}function _k({text:e,sub:t,mood:s="happy"}){return r.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:r.jsxs("div",{className:"flex flex-col items-center text-center",children:[r.jsx(QC,{mood:s,className:"mb-4 text-xs"}),r.jsx("div",{className:"text-foreground",children:e}),t&&r.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:t})]})})}function QU(){const e=Yn();return r.jsx(WC,{testId:"screen-not-found",mood:"confused",title:f("not_found.title"),titleClassName:"text-7xl",message:f("not_found.message"),action:r.jsx(Qa,{variant:"outline",onClick:()=>e("/"),children:f("not_found.home")})})}ET.createRoot(document.getElementById("root")).render(r.jsx(Hc.StrictMode,{children:r.jsx(ZA,{children:r.jsx(i3,{children:r.jsx(qU,{})})})}));
651
- //# sourceMappingURL=index-DJ-ocXOR.js.map