@agentprojectcontext/apx 1.66.0 → 1.68.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.
- package/package.json +3 -2
- package/skills/apx/SKILL.md +3 -0
- package/src/core/agent/index.js +2 -0
- package/src/core/agent/judge.js +174 -0
- package/src/core/agent/model-router.js +107 -5
- package/src/core/agent/prompts/modes/code-build.md +1 -1
- package/src/core/agent/run-agent.js +149 -12
- package/src/core/agent/security.js +97 -0
- package/src/core/agent/stuck-detector.js +89 -0
- package/src/core/agent/super-agent.js +58 -17
- package/src/core/agent/tools/handlers/run-subagent.js +117 -0
- package/src/core/agent/tools/helpers.js +11 -1
- package/src/core/agent/tools/names.js +2 -0
- package/src/core/agent/tools/registry.js +10 -0
- package/src/core/artifacts/preview.js +392 -0
- package/src/core/artifacts/tunnel.js +169 -0
- package/src/core/config/index.js +61 -0
- package/src/core/config/redact.js +44 -0
- package/src/core/config/secret-values.js +132 -0
- package/src/core/engines/mock.js +15 -1
- package/src/core/logging.js +10 -3
- package/src/core/memory/compactor.js +65 -56
- package/src/core/memory/summarizer.js +125 -0
- package/src/core/stores/conversations-compactor.js +24 -31
- package/src/host/daemon/api/admin-config.js +5 -0
- package/src/host/daemon/api/artifact-preview.js +82 -0
- package/src/host/daemon/api/config.js +17 -5
- package/src/host/daemon/api/sessions.js +9 -0
- package/src/host/daemon/api/web.js +1 -1
- package/src/host/daemon/api.js +2 -0
- package/src/host/daemon/index.js +16 -1
- package/src/interfaces/acp/index.js +363 -0
- package/src/interfaces/acp/jsonrpc.js +180 -0
- package/src/interfaces/acp/session.js +205 -0
- package/src/interfaces/cli/commands/acp.js +10 -0
- package/src/interfaces/cli/commands/artifact.js +115 -0
- package/src/interfaces/cli/index.js +74 -0
- package/src/interfaces/web/dist/assets/index-D4BmWoDM.css +1 -0
- package/src/interfaces/web/dist/assets/index-vwd6yQVw.js +803 -0
- package/src/interfaces/web/dist/assets/index-vwd6yQVw.js.map +1 -0
- package/src/interfaces/web/dist/index.html +2 -2
- package/src/interfaces/web/package-lock.json +9 -9
- package/src/interfaces/web/src/components/code/CodeArtifactsTab.tsx +145 -2
- package/src/interfaces/web/src/components/config/ConfigTabsEditor.tsx +46 -31
- package/src/interfaces/web/src/components/config/project-config-sections.ts +9 -11
- package/src/interfaces/web/src/components/memory/MemoryBrowser.tsx +162 -0
- package/src/interfaces/web/src/components/settings/RoutingPanel.tsx +236 -0
- package/src/interfaces/web/src/i18n/en.ts +53 -0
- package/src/interfaces/web/src/i18n/es.ts +53 -0
- package/src/interfaces/web/src/lib/api/artifacts.ts +38 -0
- package/src/interfaces/web/src/lib/api/sessions.ts +2 -1
- package/src/interfaces/web/src/screens/ProjectScreen.tsx +50 -60
- package/src/interfaces/web/src/screens/base/ModelsTab.tsx +4 -2
- package/src/interfaces/web/src/screens/base/SessionsTab.tsx +11 -5
- package/src/interfaces/web/src/screens/project/ConfigTab.tsx +110 -25
- package/src/interfaces/web/src/screens/project/MemoriesTab.tsx +7 -128
- package/src/interfaces/web/src/screens/project/Overview.tsx +3 -2
- package/src/interfaces/web/src/types/daemon.ts +16 -0
- package/src/interfaces/web/dist/assets/index-BuII-tAi.css +0 -1
- package/src/interfaces/web/dist/assets/index-YmMRG--4.js +0 -778
- package/src/interfaces/web/dist/assets/index-YmMRG--4.js.map +0 -1
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
function kA(e,t){for(var a=0;a<t.length;a++){const o=t[a];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 d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&o(d)}).observe(document,{childList:!0,subtree:!0});function a(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=a(l);fetch(l.href,c)}})();function tb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var $g={exports:{}},ac={};/**
|
|
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 tj;function SA(){if(tj)return ac;tj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function a(o,l,c){var d=null;if(c!==void 0&&(d=""+c),l.key!==void 0&&(d=""+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:d,ref:l!==void 0?l:null,props:c}}return ac.Fragment=t,ac.jsx=a,ac.jsxs=a,ac}var nj;function CA(){return nj||(nj=1,$g.exports=SA()),$g.exports}var s=CA(),Hg={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 sj;function NA(){if(sj)return ct;sj=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),g=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),_=Symbol.iterator;function j(I){return I===null||typeof I!="object"?null:(I=_&&I[_]||I["@@iterator"],typeof I=="function"?I:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,w={};function S(I,X,Z){this.props=I,this.context=X,this.refs=w,this.updater=Z||N}S.prototype.isReactComponent={},S.prototype.setState=function(I,X){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,X,"setState")},S.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function k(){}k.prototype=S.prototype;function E(I,X,Z){this.props=I,this.context=X,this.refs=w,this.updater=Z||N}var R=E.prototype=new k;R.constructor=E,y(R,S.prototype),R.isPureReactComponent=!0;var A=Array.isArray;function T(){}var z={H:null,A:null,T:null,S:null},O=Object.prototype.hasOwnProperty;function B(I,X,Z){var W=Z.ref;return{$$typeof:e,type:I,key:X,ref:W!==void 0?W:null,props:Z}}function P(I,X){return B(I.type,X,I.props)}function U(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function D(I){var X={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function(Z){return X[Z]})}var L=/\/+/g;function V(I,X){return typeof I=="object"&&I!==null&&I.key!=null?D(""+I.key):X.toString(36)}function H(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(X){I.status==="pending"&&(I.status="fulfilled",I.value=X)},function(X){I.status==="pending"&&(I.status="rejected",I.reason=X)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function $(I,X,Z,W,fe){var te=typeof I;(te==="undefined"||te==="boolean")&&(I=null);var re=!1;if(I===null)re=!0;else switch(te){case"bigint":case"string":case"number":re=!0;break;case"object":switch(I.$$typeof){case e:case t:re=!0;break;case h:return re=I._init,$(re(I._payload),X,Z,W,fe)}}if(re)return fe=fe(I),re=W===""?"."+V(I,0):W,A(fe)?(Z="",re!=null&&(Z=re.replace(L,"$&/")+"/"),$(fe,X,Z,"",function(Me){return Me})):fe!=null&&(U(fe)&&(fe=P(fe,Z+(fe.key==null||I&&I.key===fe.key?"":(""+fe.key).replace(L,"$&/")+"/")+re)),X.push(fe)),1;re=0;var le=W===""?".":W+":";if(A(I))for(var me=0;me<I.length;me++)W=I[me],te=le+V(W,me),re+=$(W,X,Z,te,fe);else if(me=j(I),typeof me=="function")for(I=me.call(I),me=0;!(W=I.next()).done;)W=W.value,te=le+V(W,me++),re+=$(W,X,Z,te,fe);else if(te==="object"){if(typeof I.then=="function")return $(H(I),X,Z,W,fe);throw X=String(I),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return re}function F(I,X,Z){if(I==null)return I;var W=[],fe=0;return $(I,W,"","",function(te){return X.call(Z,te,fe++)}),W}function Y(I){if(I._status===-1){var X=I._result;X=X(),X.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=X)}if(I._status===1)return I._result.default;throw I._result}var G=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=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(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},K={map:F,forEach:function(I,X,Z){F(I,function(){X.apply(this,arguments)},Z)},count:function(I){var X=0;return F(I,function(){X++}),X},toArray:function(I){return F(I,function(X){return X})||[]},only:function(I){if(!U(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=S,ct.Fragment=a,ct.Profiler=l,ct.PureComponent=E,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,X,Z){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var W=y({},I.props),fe=I.key;if(X!=null)for(te in X.key!==void 0&&(fe=""+X.key),X)!O.call(X,te)||te==="key"||te==="__self"||te==="__source"||te==="ref"&&X.ref===void 0||(W[te]=X[te]);var te=arguments.length-2;if(te===1)W.children=Z;else if(1<te){for(var re=Array(te),le=0;le<te;le++)re[le]=arguments[le+2];W.children=re}return B(I.type,fe,W)},ct.createContext=function(I){return I={$$typeof:d,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:c,_context:I},I},ct.createElement=function(I,X,Z){var W,fe={},te=null;if(X!=null)for(W in X.key!==void 0&&(te=""+X.key),X)O.call(X,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(fe[W]=X[W]);var re=arguments.length-2;if(re===1)fe.children=Z;else if(1<re){for(var le=Array(re),me=0;me<re;me++)le[me]=arguments[me+2];fe.children=le}if(I&&I.defaultProps)for(W in re=I.defaultProps,re)fe[W]===void 0&&(fe[W]=re[W]);return B(I,te,fe)},ct.createRef=function(){return{current:null}},ct.forwardRef=function(I){return{$$typeof:p,render:I}},ct.isValidElement=U,ct.lazy=function(I){return{$$typeof:h,_payload:{_status:-1,_result:I},_init:Y}},ct.memo=function(I,X){return{$$typeof:g,type:I,compare:X===void 0?null:X}},ct.startTransition=function(I){var X=z.T,Z={};z.T=Z;try{var W=I(),fe=z.S;fe!==null&&fe(Z,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(T,G)}catch(te){G(te)}finally{X!==null&&Z.types!==null&&(X.types=Z.types),z.T=X}},ct.unstable_useCacheRefresh=function(){return z.H.useCacheRefresh()},ct.use=function(I){return z.H.use(I)},ct.useActionState=function(I,X,Z){return z.H.useActionState(I,X,Z)},ct.useCallback=function(I,X){return z.H.useCallback(I,X)},ct.useContext=function(I){return z.H.useContext(I)},ct.useDebugValue=function(){},ct.useDeferredValue=function(I,X){return z.H.useDeferredValue(I,X)},ct.useEffect=function(I,X){return z.H.useEffect(I,X)},ct.useEffectEvent=function(I){return z.H.useEffectEvent(I)},ct.useId=function(){return z.H.useId()},ct.useImperativeHandle=function(I,X,Z){return z.H.useImperativeHandle(I,X,Z)},ct.useInsertionEffect=function(I,X){return z.H.useInsertionEffect(I,X)},ct.useLayoutEffect=function(I,X){return z.H.useLayoutEffect(I,X)},ct.useMemo=function(I,X){return z.H.useMemo(I,X)},ct.useOptimistic=function(I,X){return z.H.useOptimistic(I,X)},ct.useReducer=function(I,X,Z){return z.H.useReducer(I,X,Z)},ct.useRef=function(I){return z.H.useRef(I)},ct.useState=function(I){return z.H.useState(I)},ct.useSyncExternalStore=function(I,X,Z){return z.H.useSyncExternalStore(I,X,Z)},ct.useTransition=function(){return z.H.useTransition()},ct.version="19.2.7",ct}var aj;function Qc(){return aj||(aj=1,Hg.exports=NA()),Hg.exports}var x=Qc();const Wc=tb(x),EA=kA({__proto__:null,default:Wc},[x]);var qg={exports:{}},rc={},Vg={exports:{}},Fg={};/**
|
|
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 rj;function RA(){return rj||(rj=1,(function(e){function t($,F){var Y=$.length;$.push(F);e:for(;0<Y;){var G=Y-1>>>1,K=$[G];if(0<l(K,F))$[G]=F,$[Y]=K,Y=G;else break e}}function a($){return $.length===0?null:$[0]}function o($){if($.length===0)return null;var F=$[0],Y=$.pop();if(Y!==F){$[0]=Y;e:for(var G=0,K=$.length,I=K>>>1;G<I;){var X=2*(G+1)-1,Z=$[X],W=X+1,fe=$[W];if(0>l(Z,Y))W<K&&0>l(fe,Z)?($[G]=fe,$[W]=Y,G=W):($[G]=Z,$[X]=Y,G=X);else if(W<K&&0>l(fe,Y))$[G]=fe,$[W]=Y,G=W;else break e}}return F}function l($,F){var Y=$.sortIndex-F.sortIndex;return Y!==0?Y:$.id-F.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,p=d.now();e.unstable_now=function(){return d.now()-p}}var m=[],g=[],h=1,b=null,_=3,j=!1,N=!1,y=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function R($){for(var F=a(g);F!==null;){if(F.callback===null)o(g);else if(F.startTime<=$)o(g),F.sortIndex=F.expirationTime,t(m,F);else break;F=a(g)}}function A($){if(y=!1,R($),!N)if(a(m)!==null)N=!0,T||(T=!0,D());else{var F=a(g);F!==null&&H(A,F.startTime-$)}}var T=!1,z=-1,O=5,B=-1;function P(){return w?!0:!(e.unstable_now()-B<O)}function U(){if(w=!1,T){var $=e.unstable_now();B=$;var F=!0;try{e:{N=!1,y&&(y=!1,k(z),z=-1),j=!0;var Y=_;try{t:{for(R($),b=a(m);b!==null&&!(b.expirationTime>$&&P());){var G=b.callback;if(typeof G=="function"){b.callback=null,_=b.priorityLevel;var K=G(b.expirationTime<=$);if($=e.unstable_now(),typeof K=="function"){b.callback=K,R($),F=!0;break t}b===a(m)&&o(m),R($)}else o(m);b=a(m)}if(b!==null)F=!0;else{var I=a(g);I!==null&&H(A,I.startTime-$),F=!1}}break e}finally{b=null,_=Y,j=!1}F=void 0}}finally{F?D():T=!1}}}var D;if(typeof E=="function")D=function(){E(U)};else if(typeof MessageChannel<"u"){var L=new MessageChannel,V=L.port2;L.port1.onmessage=U,D=function(){V.postMessage(null)}}else D=function(){S(U,0)};function H($,F){z=S(function(){$(e.unstable_now())},F)}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($){$.callback=null},e.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):O=0<$?Math.floor(1e3/$):5},e.unstable_getCurrentPriorityLevel=function(){return _},e.unstable_next=function($){switch(_){case 1:case 2:case 3:var F=3;break;default:F=_}var Y=_;_=F;try{return $()}finally{_=Y}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function($,F){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var Y=_;_=$;try{return F()}finally{_=Y}},e.unstable_scheduleCallback=function($,F,Y){var G=e.unstable_now();switch(typeof Y=="object"&&Y!==null?(Y=Y.delay,Y=typeof Y=="number"&&0<Y?G+Y:G):Y=G,$){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,$={id:h++,callback:F,priorityLevel:$,startTime:Y,expirationTime:K,sortIndex:-1},Y>G?($.sortIndex=Y,t(g,$),a(m)===null&&$===a(g)&&(y?(k(z),z=-1):y=!0,H(A,Y-G))):($.sortIndex=K,t(m,$),N||j||(N=!0,T||(T=!0,D()))),$},e.unstable_shouldYield=P,e.unstable_wrapCallback=function($){var F=_;return function(){var Y=_;_=F;try{return $.apply(this,arguments)}finally{_=Y}}}})(Fg)),Fg}var oj;function TA(){return oj||(oj=1,Vg.exports=RA()),Vg.exports}var Gg={exports:{}},Fn={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var lj;function AA(){if(lj)return Fn;lj=1;var e=Qc();function t(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)g+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(){}var o={d:{f:a,r:function(){throw Error(t(522))},D:a,C:a,L:a,m:a,X:a,S:a,M:a},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(m,g,h){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:b==null?null:""+b,children:m,containerInfo:g,implementation:h}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(m,g){if(m==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return Fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Fn.createPortal=function(m,g){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(t(299));return c(m,g,null,h)},Fn.flushSync=function(m){var g=d.T,h=o.p;try{if(d.T=null,o.p=2,m)return m()}finally{d.T=g,o.p=h,o.d.f()}},Fn.preconnect=function(m,g){typeof m=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,o.d.C(m,g))},Fn.prefetchDNS=function(m){typeof m=="string"&&o.d.D(m)},Fn.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var h=g.as,b=p(h,g.crossOrigin),_=typeof g.integrity=="string"?g.integrity:void 0,j=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;h==="style"?o.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:_,fetchPriority:j}):h==="script"&&o.d.X(m,{crossOrigin:b,integrity:_,fetchPriority:j,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Fn.preinitModule=function(m,g){if(typeof m=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var h=p(g.as,g.crossOrigin);o.d.M(m,{crossOrigin:h,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&o.d.M(m)},Fn.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var h=g.as,b=p(h,g.crossOrigin);o.d.L(m,h,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},Fn.preloadModule=function(m,g){if(typeof m=="string")if(g){var h=p(g.as,g.crossOrigin);o.d.m(m,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:h,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else o.d.m(m)},Fn.requestFormReset=function(m){o.d.r(m)},Fn.unstable_batchedUpdates=function(m,g){return m(g)},Fn.useFormState=function(m,g,h){return d.H.useFormState(m,g,h)},Fn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Fn.version="19.2.7",Fn}var ij;function uS(){if(ij)return Gg.exports;ij=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(),Gg.exports=AA(),Gg.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 cj;function MA(){if(cj)return rc;cj=1;var e=TA(),t=Qc(),a=uS();function o(n){var r="https://react.dev/errors/"+n;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)r+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+n+"; visit "+r+" 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 r=n,i=n;if(n.alternate)for(;r.return;)r=r.return;else{n=r;do r=n,(r.flags&4098)!==0&&(i=r.return),n=r.return;while(n)}return r.tag===3?i:null}function d(n){if(n.tag===13){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function p(n){if(n.tag===31){var r=n.memoizedState;if(r===null&&(n=n.alternate,n!==null&&(r=n.memoizedState)),r!==null)return r.dehydrated}return null}function m(n){if(c(n)!==n)throw Error(o(188))}function g(n){var r=n.alternate;if(!r){if(r=c(n),r===null)throw Error(o(188));return r!==n?null:n}for(var i=n,f=r;;){var v=i.return;if(v===null)break;var C=v.alternate;if(C===null){if(f=v.return,f!==null){i=f;continue}break}if(v.child===C.child){for(C=v.child;C;){if(C===i)return m(v),n;if(C===f)return m(v),r;C=C.sibling}throw Error(o(188))}if(i.return!==f.return)i=v,f=C;else{for(var M=!1,q=v.child;q;){if(q===i){M=!0,i=v,f=C;break}if(q===f){M=!0,f=v,i=C;break}q=q.sibling}if(!M){for(q=C.child;q;){if(q===i){M=!0,i=C,f=v;break}if(q===f){M=!0,f=C,i=v;break}q=q.sibling}if(!M)throw Error(o(189))}}if(i.alternate!==f)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?n:r}function h(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n;for(n=n.child;n!==null;){if(r=h(n),r!==null)return r;n=n.sibling}return null}var b=Object.assign,_=Symbol.for("react.element"),j=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),E=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),z=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),U=Symbol.iterator;function D(n){return n===null||typeof n!="object"?null:(n=U&&n[U]||n["@@iterator"],typeof n=="function"?n:null)}var L=Symbol.for("react.client.reference");function V(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===L?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case y:return"Fragment";case S:return"Profiler";case w:return"StrictMode";case A:return"Suspense";case T:return"SuspenseList";case B:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case N:return"Portal";case E:return n.displayName||"Context";case k:return(n._context.displayName||"Context")+".Consumer";case R:var r=n.render;return n=n.displayName,n||(n=r.displayName||r.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case z:return r=n.displayName||null,r!==null?r:V(n.type)||"Memo";case O:r=n._payload,n=n._init;try{return V(n(r))}catch{}}return null}var H=Array.isArray,$=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=a.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y={pending:!1,data:null,method:null,action:null},G=[],K=-1;function I(n){return{current:n}}function X(n){0>K||(n.current=G[K],G[K]=null,K--)}function Z(n,r){K++,G[K]=n.current,n.current=r}var W=I(null),fe=I(null),te=I(null),re=I(null);function le(n,r){switch(Z(te,r),Z(fe,n),Z(W,null),r.nodeType){case 9:case 11:n=(n=r.documentElement)&&(n=n.namespaceURI)?k1(n):0;break;default:if(n=r.tagName,r=r.namespaceURI)r=k1(r),n=S1(r,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}X(W),Z(W,n)}function me(){X(W),X(fe),X(te)}function Me(n){n.memoizedState!==null&&Z(re,n);var r=W.current,i=S1(r,n.type);r!==i&&(Z(fe,n),Z(W,i))}function de(n){fe.current===n&&(X(W),X(fe)),re.current===n&&(X(re),ec._currentValue=Y)}var ge,Ce;function ke(n){if(ge===void 0)try{throw Error()}catch(i){var r=i.stack.trim().match(/\n( *(at )?)/);ge=r&&r[1]||"",Ce=-1<i.stack.indexOf(`
|
|
42
|
+
at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
|
+
`+ge+n+Ce}var Be=!1;function Ve(n,r){if(!n||Be)return"";Be=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(r){var we=function(){throw Error()};if(Object.defineProperty(we.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(we,[])}catch(pe){var ce=pe}Reflect.construct(n,[],we)}else{try{we.call()}catch(pe){ce=pe}n.call(we.prototype)}}else{try{throw Error()}catch(pe){ce=pe}(we=n())&&typeof we.catch=="function"&&we.catch(function(){})}}catch(pe){if(pe&&ce&&typeof pe.stack=="string")return[pe.stack,ce.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var C=f.DetermineComponentFrameRoot(),M=C[0],q=C[1];if(M&&q){var Q=M.split(`
|
|
44
|
+
`),ie=q.split(`
|
|
45
|
+
`);for(v=f=0;f<Q.length&&!Q[f].includes("DetermineComponentFrameRoot");)f++;for(;v<ie.length&&!ie[v].includes("DetermineComponentFrameRoot");)v++;if(f===Q.length||v===ie.length)for(f=Q.length-1,v=ie.length-1;1<=f&&0<=v&&Q[f]!==ie[v];)v--;for(;1<=f&&0<=v;f--,v--)if(Q[f]!==ie[v]){if(f!==1||v!==1)do if(f--,v--,0>v||Q[f]!==ie[v]){var be=`
|
|
46
|
+
`+Q[f].replace(" at new "," at ");return n.displayName&&be.includes("<anonymous>")&&(be=be.replace("<anonymous>",n.displayName)),be}while(1<=f&&0<=v);break}}}finally{Be=!1,Error.prepareStackTrace=i}return(i=n?n.displayName||n.name:"")?ke(i):""}function Se(n,r){switch(n.tag){case 26:case 27:case 5:return ke(n.type);case 16:return ke("Lazy");case 13:return n.child!==r&&r!==null?ke("Suspense Fallback"):ke("Suspense");case 19:return ke("SuspenseList");case 0:case 15:return Ve(n.type,!1);case 11:return Ve(n.type.render,!1);case 1:return Ve(n.type,!0);case 31:return ke("Activity");default:return""}}function Te(n){try{var r="",i=null;do r+=Se(n,i),i=n,n=n.return;while(n);return r}catch(f){return`
|
|
47
|
+
Error generating stack: `+f.message+`
|
|
48
|
+
`+f.stack}}var je=Object.prototype.hasOwnProperty,Ee=e.unstable_scheduleCallback,De=e.unstable_cancelCallback,Le=e.unstable_shouldYield,Ie=e.unstable_requestPaint,ue=e.unstable_now,ye=e.unstable_getCurrentPriorityLevel,Ge=e.unstable_ImmediatePriority,Re=e.unstable_UserBlockingPriority,Oe=e.unstable_NormalPriority,tt=e.unstable_LowPriority,ot=e.unstable_IdlePriority,vt=e.log,Mt=e.unstable_setDisableYieldValue,lt=null,Rt=null;function _e(n){if(typeof vt=="function"&&Mt(n),Rt&&typeof Rt.setStrictMode=="function")try{Rt.setStrictMode(lt,n)}catch{}}var Pe=Math.clz32?Math.clz32:Qe,Xe=Math.log,it=Math.LN2;function Qe(n){return n>>>=0,n===0?32:31-(Xe(n)/it|0)|0}var mt=256,Ot=262144,Jt=4194304;function Qt(n){var r=n&42;if(r!==0)return r;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 en(n,r,i){var f=n.pendingLanes;if(f===0)return 0;var v=0,C=n.suspendedLanes,M=n.pingedLanes;n=n.warmLanes;var q=f&134217727;return q!==0?(f=q&~C,f!==0?v=Qt(f):(M&=q,M!==0?v=Qt(M):i||(i=q&~n,i!==0&&(v=Qt(i))))):(q=f&~C,q!==0?v=Qt(q):M!==0?v=Qt(M):i||(i=f&~n,i!==0&&(v=Qt(i)))),v===0?0:r!==0&&r!==v&&(r&C)===0&&(C=v&-v,i=r&-r,C>=i||C===32&&(i&4194048)!==0)?r:v}function mn(n,r){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&r)===0}function ss(n,r){switch(n){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gs(){var n=Jt;return Jt<<=1,(Jt&62914560)===0&&(Jt=4194304),n}function Cs(n){for(var r=[],i=0;31>i;i++)r.push(n);return r}function gn(n,r){n.pendingLanes|=r,r!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Ns(n,r,i,f,v,C){var M=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 q=n.entanglements,Q=n.expirationTimes,ie=n.hiddenUpdates;for(i=M&~i;0<i;){var be=31-Pe(i),we=1<<be;q[be]=0,Q[be]=-1;var ce=ie[be];if(ce!==null)for(ie[be]=null,be=0;be<ce.length;be++){var pe=ce[be];pe!==null&&(pe.lane&=-536870913)}i&=~we}f!==0&&Ca(n,f,0),C!==0&&v===0&&n.tag!==0&&(n.suspendedLanes|=C&~(M&~r))}function Ca(n,r,i){n.pendingLanes|=r,n.suspendedLanes&=~r;var f=31-Pe(r);n.entangledLanes|=r,n.entanglements[f]=n.entanglements[f]|1073741824|i&261930}function Fs(n,r){var i=n.entangledLanes|=r;for(n=n.entanglements;i;){var f=31-Pe(i),v=1<<f;v&r|n[f]&r&&(n[f]|=r),i&=~v}}function Na(n,r){var i=r&-r;return i=(i&42)!==0?1:dt(i),(i&(n.suspendedLanes|r))!==0?0:i}function dt(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function Ut(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function hn(){var n=F.p;return n!==0?n:(n=window.event,n===void 0?32:K1(n.type))}function Rn(n,r){var i=F.p;try{return F.p=n,r()}finally{F.p=i}}var Sn=Math.random().toString(36).slice(2),Yt="__reactFiber$"+Sn,Ln="__reactProps$"+Sn,sa="__reactContainer$"+Sn,mi="__reactEvents$"+Sn,mu="__reactListeners$"+Sn,mR="__reactHandles$"+Sn,dv="__reactResources$"+Sn,gi="__reactMarker$"+Sn;function Op(n){delete n[Yt],delete n[Ln],delete n[mi],delete n[mu],delete n[mR]}function Ko(n){var r=n[Yt];if(r)return r;for(var i=n.parentNode;i;){if(r=i[sa]||i[Yt]){if(i=r.alternate,r.child!==null||i!==null&&i.child!==null)for(n=M1(n);n!==null;){if(i=n[Yt])return i;n=M1(n)}return r}n=i,i=n.parentNode}return null}function Xo(n){if(n=n[Yt]||n[sa]){var r=n.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return n}return null}function hi(n){var r=n.tag;if(r===5||r===26||r===27||r===6)return n.stateNode;throw Error(o(33))}function Qo(n){var r=n[dv];return r||(r=n[dv]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Tn(n){n[gi]=!0}var fv=new Set,pv={};function Jr(n,r){Wo(n,r),Wo(n+"Capture",r)}function Wo(n,r){for(pv[n]=r,n=0;n<r.length;n++)fv.add(r[n])}var gR=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]*$"),mv={},gv={};function hR(n){return je.call(gv,n)?!0:je.call(mv,n)?!1:gR.test(n)?gv[n]=!0:(mv[n]=!0,!1)}function gu(n,r,i){if(hR(r))if(i===null)n.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":n.removeAttribute(r);return;case"boolean":var f=r.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){n.removeAttribute(r);return}}n.setAttribute(r,""+i)}}function hu(n,r,i){if(i===null)n.removeAttribute(r);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(r);return}n.setAttribute(r,""+i)}}function Ea(n,r,i,f){if(f===null)n.removeAttribute(i);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(i);return}n.setAttributeNS(r,i,""+f)}}function Es(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function hv(n){var r=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function xR(n,r,i){var f=Object.getOwnPropertyDescriptor(n.constructor.prototype,r);if(!n.hasOwnProperty(r)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var v=f.get,C=f.set;return Object.defineProperty(n,r,{configurable:!0,get:function(){return v.call(this)},set:function(M){i=""+M,C.call(this,M)}}),Object.defineProperty(n,r,{enumerable:f.enumerable}),{getValue:function(){return i},setValue:function(M){i=""+M},stopTracking:function(){n._valueTracker=null,delete n[r]}}}}function zp(n){if(!n._valueTracker){var r=hv(n)?"checked":"value";n._valueTracker=xR(n,r,""+n[r])}}function xv(n){if(!n)return!1;var r=n._valueTracker;if(!r)return!0;var i=r.getValue(),f="";return n&&(f=hv(n)?n.checked?"true":"false":n.value),n=f,n!==i?(r.setValue(n),!0):!1}function xu(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 bR=/[\n"\\]/g;function Rs(n){return n.replace(bR,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Dp(n,r,i,f,v,C,M,q){n.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?n.type=M:n.removeAttribute("type"),r!=null?M==="number"?(r===0&&n.value===""||n.value!=r)&&(n.value=""+Es(r)):n.value!==""+Es(r)&&(n.value=""+Es(r)):M!=="submit"&&M!=="reset"||n.removeAttribute("value"),r!=null?Pp(n,M,Es(r)):i!=null?Pp(n,M,Es(i)):f!=null&&n.removeAttribute("value"),v==null&&C!=null&&(n.defaultChecked=!!C),v!=null&&(n.checked=v&&typeof v!="function"&&typeof v!="symbol"),q!=null&&typeof q!="function"&&typeof q!="symbol"&&typeof q!="boolean"?n.name=""+Es(q):n.removeAttribute("name")}function bv(n,r,i,f,v,C,M,q){if(C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(n.type=C),r!=null||i!=null){if(!(C!=="submit"&&C!=="reset"||r!=null)){zp(n);return}i=i!=null?""+Es(i):"",r=r!=null?""+Es(r):i,q||r===n.value||(n.value=r),n.defaultValue=r}f=f??v,f=typeof f!="function"&&typeof f!="symbol"&&!!f,n.checked=q?n.checked:!!f,n.defaultChecked=!!f,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(n.name=M),zp(n)}function Pp(n,r,i){r==="number"&&xu(n.ownerDocument)===n||n.defaultValue===""+i||(n.defaultValue=""+i)}function Zo(n,r,i,f){if(n=n.options,r){r={};for(var v=0;v<i.length;v++)r["$"+i[v]]=!0;for(i=0;i<n.length;i++)v=r.hasOwnProperty("$"+n[i].value),n[i].selected!==v&&(n[i].selected=v),v&&f&&(n[i].defaultSelected=!0)}else{for(i=""+Es(i),r=null,v=0;v<n.length;v++){if(n[v].value===i){n[v].selected=!0,f&&(n[v].defaultSelected=!0);return}r!==null||n[v].disabled||(r=n[v])}r!==null&&(r.selected=!0)}}function _v(n,r,i){if(r!=null&&(r=""+Es(r),r!==n.value&&(n.value=r),i==null)){n.defaultValue!==r&&(n.defaultValue=r);return}n.defaultValue=i!=null?""+Es(i):""}function vv(n,r,i,f){if(r==null){if(f!=null){if(i!=null)throw Error(o(92));if(H(f)){if(1<f.length)throw Error(o(93));f=f[0]}i=f}i==null&&(i=""),r=i}i=Es(r),n.defaultValue=i,f=n.textContent,f===i&&f!==""&&f!==null&&(n.value=f),zp(n)}function Jo(n,r){if(r){var i=n.firstChild;if(i&&i===n.lastChild&&i.nodeType===3){i.nodeValue=r;return}}n.textContent=r}var _R=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 yv(n,r,i){var f=r.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?f?n.setProperty(r,""):r==="float"?n.cssFloat="":n[r]="":f?n.setProperty(r,i):typeof i!="number"||i===0||_R.has(r)?r==="float"?n.cssFloat=i:n[r]=(""+i).trim():n[r]=i+"px"}function jv(n,r,i){if(r!=null&&typeof r!="object")throw Error(o(62));if(n=n.style,i!=null){for(var f in i)!i.hasOwnProperty(f)||r!=null&&r.hasOwnProperty(f)||(f.indexOf("--")===0?n.setProperty(f,""):f==="float"?n.cssFloat="":n[f]="");for(var v in r)f=r[v],r.hasOwnProperty(v)&&i[v]!==f&&yv(n,v,f)}else for(var C in r)r.hasOwnProperty(C)&&yv(n,C,r[C])}function Lp(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 vR=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"]]),yR=/^[\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 bu(n){return yR.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Ra(){}var Ip=null;function Bp(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var el=null,tl=null;function wv(n){var r=Xo(n);if(r&&(n=r.stateNode)){var i=n[Ln]||null;e:switch(n=r.stateNode,r.type){case"input":if(Dp(n,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),r=i.name,i.type==="radio"&&r!=null){for(i=n;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+Rs(""+r)+'"][type="radio"]'),r=0;r<i.length;r++){var f=i[r];if(f!==n&&f.form===n.form){var v=f[Ln]||null;if(!v)throw Error(o(90));Dp(f,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(r=0;r<i.length;r++)f=i[r],f.form===n.form&&xv(f)}break e;case"textarea":_v(n,i.value,i.defaultValue);break e;case"select":r=i.value,r!=null&&Zo(n,!!i.multiple,r,!1)}}}var Up=!1;function kv(n,r,i){if(Up)return n(r,i);Up=!0;try{var f=n(r);return f}finally{if(Up=!1,(el!==null||tl!==null)&&(rd(),el&&(r=el,n=tl,tl=el=null,wv(r),n)))for(r=0;r<n.length;r++)wv(n[r])}}function xi(n,r){var i=n.stateNode;if(i===null)return null;var f=i[Ln]||null;if(f===null)return null;i=f[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(n=n.type,f=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!f;break e;default:n=!1}if(n)return null;if(i&&typeof i!="function")throw Error(o(231,r,typeof i));return i}var Ta=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),$p=!1;if(Ta)try{var bi={};Object.defineProperty(bi,"passive",{get:function(){$p=!0}}),window.addEventListener("test",bi,bi),window.removeEventListener("test",bi,bi)}catch{$p=!1}var ir=null,Hp=null,_u=null;function Sv(){if(_u)return _u;var n,r=Hp,i=r.length,f,v="value"in ir?ir.value:ir.textContent,C=v.length;for(n=0;n<i&&r[n]===v[n];n++);var M=i-n;for(f=1;f<=M&&r[i-f]===v[C-f];f++);return _u=v.slice(n,1<f?1-f:void 0)}function vu(n){var r=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&r===13&&(n=13)):n=r,n===10&&(n=13),32<=n||n===13?n:0}function yu(){return!0}function Cv(){return!1}function as(n){function r(i,f,v,C,M){this._reactName=i,this._targetInst=v,this.type=f,this.nativeEvent=C,this.target=M,this.currentTarget=null;for(var q in n)n.hasOwnProperty(q)&&(i=n[q],this[q]=i?i(C):C[q]);return this.isDefaultPrevented=(C.defaultPrevented!=null?C.defaultPrevented:C.returnValue===!1)?yu:Cv,this.isPropagationStopped=Cv,this}return b(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=yu)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=yu)},persist:function(){},isPersistent:yu}),r}var eo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ju=as(eo),_i=b({},eo,{view:0,detail:0}),jR=as(_i),qp,Vp,vi,wu=b({},_i,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gp,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!==vi&&(vi&&n.type==="mousemove"?(qp=n.screenX-vi.screenX,Vp=n.screenY-vi.screenY):Vp=qp=0,vi=n),qp)},movementY:function(n){return"movementY"in n?n.movementY:Vp}}),Nv=as(wu),wR=b({},wu,{dataTransfer:0}),kR=as(wR),SR=b({},_i,{relatedTarget:0}),Fp=as(SR),CR=b({},eo,{animationName:0,elapsedTime:0,pseudoElement:0}),NR=as(CR),ER=b({},eo,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),RR=as(ER),TR=b({},eo,{data:0}),Ev=as(TR),AR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},MR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},OR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zR(n){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(n):(n=OR[n])?!!r[n]:!1}function Gp(){return zR}var DR=b({},_i,{key:function(n){if(n.key){var r=AR[n.key]||n.key;if(r!=="Unidentified")return r}return n.type==="keypress"?(n=vu(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?MR[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gp,charCode:function(n){return n.type==="keypress"?vu(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?vu(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),PR=as(DR),LR=b({},wu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Rv=as(LR),IR=b({},_i,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gp}),BR=as(IR),UR=b({},eo,{propertyName:0,elapsedTime:0,pseudoElement:0}),$R=as(UR),HR=b({},wu,{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}),qR=as(HR),VR=b({},eo,{newState:0,oldState:0}),FR=as(VR),GR=[9,13,27,32],Yp=Ta&&"CompositionEvent"in window,yi=null;Ta&&"documentMode"in document&&(yi=document.documentMode);var YR=Ta&&"TextEvent"in window&&!yi,Tv=Ta&&(!Yp||yi&&8<yi&&11>=yi),Av=" ",Mv=!1;function Ov(n,r){switch(n){case"keyup":return GR.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function zv(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var nl=!1;function KR(n,r){switch(n){case"compositionend":return zv(r);case"keypress":return r.which!==32?null:(Mv=!0,Av);case"textInput":return n=r.data,n===Av&&Mv?null:n;default:return null}}function XR(n,r){if(nl)return n==="compositionend"||!Yp&&Ov(n,r)?(n=Sv(),_u=Hp=ir=null,nl=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Tv&&r.locale!=="ko"?null:r.data;default:return null}}var QR={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 Dv(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r==="input"?!!QR[n.type]:r==="textarea"}function Pv(n,r,i,f){el?tl?tl.push(f):tl=[f]:el=f,r=fd(r,"onChange"),0<r.length&&(i=new ju("onChange","change",null,i,f),n.push({event:i,listeners:r}))}var ji=null,wi=null;function WR(n){b1(n,0)}function ku(n){var r=hi(n);if(xv(r))return n}function Lv(n,r){if(n==="change")return r}var Iv=!1;if(Ta){var Kp;if(Ta){var Xp="oninput"in document;if(!Xp){var Bv=document.createElement("div");Bv.setAttribute("oninput","return;"),Xp=typeof Bv.oninput=="function"}Kp=Xp}else Kp=!1;Iv=Kp&&(!document.documentMode||9<document.documentMode)}function Uv(){ji&&(ji.detachEvent("onpropertychange",$v),wi=ji=null)}function $v(n){if(n.propertyName==="value"&&ku(wi)){var r=[];Pv(r,wi,n,Bp(n)),kv(WR,r)}}function ZR(n,r,i){n==="focusin"?(Uv(),ji=r,wi=i,ji.attachEvent("onpropertychange",$v)):n==="focusout"&&Uv()}function JR(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return ku(wi)}function eT(n,r){if(n==="click")return ku(r)}function tT(n,r){if(n==="input"||n==="change")return ku(r)}function nT(n,r){return n===r&&(n!==0||1/n===1/r)||n!==n&&r!==r}var hs=typeof Object.is=="function"?Object.is:nT;function ki(n,r){if(hs(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;var i=Object.keys(n),f=Object.keys(r);if(i.length!==f.length)return!1;for(f=0;f<i.length;f++){var v=i[f];if(!je.call(r,v)||!hs(n[v],r[v]))return!1}return!0}function Hv(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function qv(n,r){var i=Hv(n);n=0;for(var f;i;){if(i.nodeType===3){if(f=n+i.textContent.length,n<=r&&f>=r)return{node:i,offset:r-n};n=f}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=Hv(i)}}function Vv(n,r){return n&&r?n===r?!0:n&&n.nodeType===3?!1:r&&r.nodeType===3?Vv(n,r.parentNode):"contains"in n?n.contains(r):n.compareDocumentPosition?!!(n.compareDocumentPosition(r)&16):!1:!1}function Fv(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var r=xu(n.document);r instanceof n.HTMLIFrameElement;){try{var i=typeof r.contentWindow.location.href=="string"}catch{i=!1}if(i)n=r.contentWindow;else break;r=xu(n.document)}return r}function Qp(n){var r=n&&n.nodeName&&n.nodeName.toLowerCase();return r&&(r==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||r==="textarea"||n.contentEditable==="true")}var sT=Ta&&"documentMode"in document&&11>=document.documentMode,sl=null,Wp=null,Si=null,Zp=!1;function Gv(n,r,i){var f=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;Zp||sl==null||sl!==xu(f)||(f=sl,"selectionStart"in f&&Qp(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Si&&ki(Si,f)||(Si=f,f=fd(Wp,"onSelect"),0<f.length&&(r=new ju("onSelect","select",null,r,i),n.push({event:r,listeners:f}),r.target=sl)))}function to(n,r){var i={};return i[n.toLowerCase()]=r.toLowerCase(),i["Webkit"+n]="webkit"+r,i["Moz"+n]="moz"+r,i}var al={animationend:to("Animation","AnimationEnd"),animationiteration:to("Animation","AnimationIteration"),animationstart:to("Animation","AnimationStart"),transitionrun:to("Transition","TransitionRun"),transitionstart:to("Transition","TransitionStart"),transitioncancel:to("Transition","TransitionCancel"),transitionend:to("Transition","TransitionEnd")},Jp={},Yv={};Ta&&(Yv=document.createElement("div").style,"AnimationEvent"in window||(delete al.animationend.animation,delete al.animationiteration.animation,delete al.animationstart.animation),"TransitionEvent"in window||delete al.transitionend.transition);function no(n){if(Jp[n])return Jp[n];if(!al[n])return n;var r=al[n],i;for(i in r)if(r.hasOwnProperty(i)&&i in Yv)return Jp[n]=r[i];return n}var Kv=no("animationend"),Xv=no("animationiteration"),Qv=no("animationstart"),aT=no("transitionrun"),rT=no("transitionstart"),oT=no("transitioncancel"),Wv=no("transitionend"),Zv=new Map,em="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(" ");em.push("scrollEnd");function Gs(n,r){Zv.set(n,r),Jr(r,[n])}var Su=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=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(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Ts=[],rl=0,tm=0;function Cu(){for(var n=rl,r=tm=rl=0;r<n;){var i=Ts[r];Ts[r++]=null;var f=Ts[r];Ts[r++]=null;var v=Ts[r];Ts[r++]=null;var C=Ts[r];if(Ts[r++]=null,f!==null&&v!==null){var M=f.pending;M===null?v.next=v:(v.next=M.next,M.next=v),f.pending=v}C!==0&&Jv(i,v,C)}}function Nu(n,r,i,f){Ts[rl++]=n,Ts[rl++]=r,Ts[rl++]=i,Ts[rl++]=f,tm|=f,n.lanes|=f,n=n.alternate,n!==null&&(n.lanes|=f)}function nm(n,r,i,f){return Nu(n,r,i,f),Eu(n)}function so(n,r){return Nu(n,null,null,r),Eu(n)}function Jv(n,r,i){n.lanes|=i;var f=n.alternate;f!==null&&(f.lanes|=i);for(var v=!1,C=n.return;C!==null;)C.childLanes|=i,f=C.alternate,f!==null&&(f.childLanes|=i),C.tag===22&&(n=C.stateNode,n===null||n._visibility&1||(v=!0)),n=C,C=C.return;return n.tag===3?(C=n.stateNode,v&&r!==null&&(v=31-Pe(i),n=C.hiddenUpdates,f=n[v],f===null?n[v]=[r]:f.push(r),r.lane=i|536870912),C):null}function Eu(n){if(50<Yi)throw Yi=0,dg=null,Error(o(185));for(var r=n.return;r!==null;)n=r,r=n.return;return n.tag===3?n.stateNode:null}var ol={};function lT(n,r,i,f){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=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xs(n,r,i,f){return new lT(n,r,i,f)}function sm(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Aa(n,r){var i=n.alternate;return i===null?(i=xs(n.tag,r,n.key,n.mode),i.elementType=n.elementType,i.type=n.type,i.stateNode=n.stateNode,i.alternate=n,n.alternate=i):(i.pendingProps=r,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,r=n.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},i.sibling=n.sibling,i.index=n.index,i.ref=n.ref,i.refCleanup=n.refCleanup,i}function ey(n,r){n.flags&=65011714;var i=n.alternate;return i===null?(n.childLanes=0,n.lanes=r,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,r=i.dependencies,n.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),n}function Ru(n,r,i,f,v,C){var M=0;if(f=n,typeof n=="function")sm(n)&&(M=1);else if(typeof n=="string")M=fA(n,i,W.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case B:return n=xs(31,i,r,v),n.elementType=B,n.lanes=C,n;case y:return ao(i.children,v,C,r);case w:M=8,v|=24;break;case S:return n=xs(12,i,r,v|2),n.elementType=S,n.lanes=C,n;case A:return n=xs(13,i,r,v),n.elementType=A,n.lanes=C,n;case T:return n=xs(19,i,r,v),n.elementType=T,n.lanes=C,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case E:M=10;break e;case k:M=9;break e;case R:M=11;break e;case z:M=14;break e;case O:M=16,f=null;break e}M=29,i=Error(o(130,n===null?"null":typeof n,"")),f=null}return r=xs(M,i,r,v),r.elementType=n,r.type=f,r.lanes=C,r}function ao(n,r,i,f){return n=xs(7,n,f,r),n.lanes=i,n}function am(n,r,i){return n=xs(6,n,null,r),n.lanes=i,n}function ty(n){var r=xs(18,null,null,0);return r.stateNode=n,r}function rm(n,r,i){return r=xs(4,n.children!==null?n.children:[],n.key,r),r.lanes=i,r.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},r}var ny=new WeakMap;function As(n,r){if(typeof n=="object"&&n!==null){var i=ny.get(n);return i!==void 0?i:(r={value:n,source:r,stack:Te(r)},ny.set(n,r),r)}return{value:n,source:r,stack:Te(r)}}var ll=[],il=0,Tu=null,Ci=0,Ms=[],Os=0,cr=null,aa=1,ra="";function Ma(n,r){ll[il++]=Ci,ll[il++]=Tu,Tu=n,Ci=r}function sy(n,r,i){Ms[Os++]=aa,Ms[Os++]=ra,Ms[Os++]=cr,cr=n;var f=aa;n=ra;var v=32-Pe(f)-1;f&=~(1<<v),i+=1;var C=32-Pe(r)+v;if(30<C){var M=v-v%5;C=(f&(1<<M)-1).toString(32),f>>=M,v-=M,aa=1<<32-Pe(r)+v|i<<v|f,ra=C+n}else aa=1<<C|i<<v|f,ra=n}function om(n){n.return!==null&&(Ma(n,1),sy(n,1,0))}function lm(n){for(;n===Tu;)Tu=ll[--il],ll[il]=null,Ci=ll[--il],ll[il]=null;for(;n===cr;)cr=Ms[--Os],Ms[Os]=null,ra=Ms[--Os],Ms[Os]=null,aa=Ms[--Os],Ms[Os]=null}function ay(n,r){Ms[Os++]=aa,Ms[Os++]=ra,Ms[Os++]=cr,aa=r.id,ra=r.overflow,cr=n}var In=null,tn=null,Nt=!1,ur=null,zs=!1,im=Error(o(519));function dr(n){var r=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ni(As(r,n)),im}function ry(n){var r=n.stateNode,i=n.type,f=n.memoizedProps;switch(r[Yt]=n,r[Ln]=f,i){case"dialog":jt("cancel",r),jt("close",r);break;case"iframe":case"object":case"embed":jt("load",r);break;case"video":case"audio":for(i=0;i<Xi.length;i++)jt(Xi[i],r);break;case"source":jt("error",r);break;case"img":case"image":case"link":jt("error",r),jt("load",r);break;case"details":jt("toggle",r);break;case"input":jt("invalid",r),bv(r,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":jt("invalid",r);break;case"textarea":jt("invalid",r),vv(r,f.value,f.defaultValue,f.children)}i=f.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||r.textContent===""+i||f.suppressHydrationWarning===!0||j1(r.textContent,i)?(f.popover!=null&&(jt("beforetoggle",r),jt("toggle",r)),f.onScroll!=null&&jt("scroll",r),f.onScrollEnd!=null&&jt("scrollend",r),f.onClick!=null&&(r.onclick=Ra),r=!0):r=!1,r||dr(n,!0)}function oy(n){for(In=n.return;In;)switch(In.tag){case 5:case 31:case 13:zs=!1;return;case 27:case 3:zs=!0;return;default:In=In.return}}function cl(n){if(n!==In)return!1;if(!Nt)return oy(n),Nt=!0,!1;var r=n.tag,i;if((i=r!==3&&r!==27)&&((i=r===5)&&(i=n.type,i=!(i!=="form"&&i!=="button")||Cg(n.type,n.memoizedProps)),i=!i),i&&tn&&dr(n),oy(n),r===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));tn=A1(n)}else if(r===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(317));tn=A1(n)}else r===27?(r=tn,Sr(n.type)?(n=Ag,Ag=null,tn=n):tn=r):tn=In?Ps(n.stateNode.nextSibling):null;return!0}function ro(){tn=In=null,Nt=!1}function cm(){var n=ur;return n!==null&&(is===null?is=n:is.push.apply(is,n),ur=null),n}function Ni(n){ur===null?ur=[n]:ur.push(n)}var um=I(null),oo=null,Oa=null;function fr(n,r,i){Z(um,r._currentValue),r._currentValue=i}function za(n){n._currentValue=um.current,X(um)}function dm(n,r,i){for(;n!==null;){var f=n.alternate;if((n.childLanes&r)!==r?(n.childLanes|=r,f!==null&&(f.childLanes|=r)):f!==null&&(f.childLanes&r)!==r&&(f.childLanes|=r),n===i)break;n=n.return}}function fm(n,r,i,f){var v=n.child;for(v!==null&&(v.return=n);v!==null;){var C=v.dependencies;if(C!==null){var M=v.child;C=C.firstContext;e:for(;C!==null;){var q=C;C=v;for(var Q=0;Q<r.length;Q++)if(q.context===r[Q]){C.lanes|=i,q=C.alternate,q!==null&&(q.lanes|=i),dm(C.return,i,n),f||(M=null);break e}C=q.next}}else if(v.tag===18){if(M=v.return,M===null)throw Error(o(341));M.lanes|=i,C=M.alternate,C!==null&&(C.lanes|=i),dm(M,i,n),M=null}else M=v.child;if(M!==null)M.return=v;else for(M=v;M!==null;){if(M===n){M=null;break}if(v=M.sibling,v!==null){v.return=M.return,M=v;break}M=M.return}v=M}}function ul(n,r,i,f){n=null;for(var v=r,C=!1;v!==null;){if(!C){if((v.flags&524288)!==0)C=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var M=v.alternate;if(M===null)throw Error(o(387));if(M=M.memoizedProps,M!==null){var q=v.type;hs(v.pendingProps.value,M.value)||(n!==null?n.push(q):n=[q])}}else if(v===re.current){if(M=v.alternate,M===null)throw Error(o(387));M.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(n!==null?n.push(ec):n=[ec])}v=v.return}n!==null&&fm(r,n,i,f),r.flags|=262144}function Au(n){for(n=n.firstContext;n!==null;){if(!hs(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function lo(n){oo=n,Oa=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Bn(n){return ly(oo,n)}function Mu(n,r){return oo===null&&lo(n),ly(n,r)}function ly(n,r){var i=r._currentValue;if(r={context:r,memoizedValue:i,next:null},Oa===null){if(n===null)throw Error(o(308));Oa=r,n.dependencies={lanes:0,firstContext:r},n.flags|=524288}else Oa=Oa.next=r;return i}var iT=typeof AbortController<"u"?AbortController:function(){var n=[],r=this.signal={aborted:!1,addEventListener:function(i,f){n.push(f)}};this.abort=function(){r.aborted=!0,n.forEach(function(i){return i()})}},cT=e.unstable_scheduleCallback,uT=e.unstable_NormalPriority,yn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pm(){return{controller:new iT,data:new Map,refCount:0}}function Ei(n){n.refCount--,n.refCount===0&&cT(uT,function(){n.controller.abort()})}var Ri=null,mm=0,dl=0,fl=null;function dT(n,r){if(Ri===null){var i=Ri=[];mm=0,dl=xg(),fl={status:"pending",value:void 0,then:function(f){i.push(f)}}}return mm++,r.then(iy,iy),r}function iy(){if(--mm===0&&Ri!==null){fl!==null&&(fl.status="fulfilled");var n=Ri;Ri=null,dl=0,fl=null;for(var r=0;r<n.length;r++)(0,n[r])()}}function fT(n,r){var i=[],f={status:"pending",value:null,reason:null,then:function(v){i.push(v)}};return n.then(function(){f.status="fulfilled",f.value=r;for(var v=0;v<i.length;v++)(0,i[v])(r)},function(v){for(f.status="rejected",f.reason=v,v=0;v<i.length;v++)(0,i[v])(void 0)}),f}var cy=$.S;$.S=function(n,r){G0=ue(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&dT(n,r),cy!==null&&cy(n,r)};var io=I(null);function gm(){var n=io.current;return n!==null?n:Kt.pooledCache}function Ou(n,r){r===null?Z(io,io.current):Z(io,r.pool)}function uy(){var n=gm();return n===null?null:{parent:yn._currentValue,pool:n}}var pl=Error(o(460)),hm=Error(o(474)),zu=Error(o(542)),Du={then:function(){}};function dy(n){return n=n.status,n==="fulfilled"||n==="rejected"}function fy(n,r,i){switch(i=n[i],i===void 0?n.push(r):i!==r&&(r.then(Ra,Ra),r=i),r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,my(n),n;default:if(typeof r.status=="string")r.then(Ra,Ra);else{if(n=Kt,n!==null&&100<n.shellSuspendCounter)throw Error(o(482));n=r,n.status="pending",n.then(function(f){if(r.status==="pending"){var v=r;v.status="fulfilled",v.value=f}},function(f){if(r.status==="pending"){var v=r;v.status="rejected",v.reason=f}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw n=r.reason,my(n),n}throw uo=r,pl}}function co(n){try{var r=n._init;return r(n._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(uo=i,pl):i}}var uo=null;function py(){if(uo===null)throw Error(o(459));var n=uo;return uo=null,n}function my(n){if(n===pl||n===zu)throw Error(o(483))}var ml=null,Ti=0;function Pu(n){var r=Ti;return Ti+=1,ml===null&&(ml=[]),fy(ml,n,r)}function Ai(n,r){r=r.props.ref,n.ref=r!==void 0?r:null}function Lu(n,r){throw r.$$typeof===_?Error(o(525)):(n=Object.prototype.toString.call(r),Error(o(31,n==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":n)))}function gy(n){function r(ee,J){if(n){var oe=ee.deletions;oe===null?(ee.deletions=[J],ee.flags|=16):oe.push(J)}}function i(ee,J){if(!n)return null;for(;J!==null;)r(ee,J),J=J.sibling;return null}function f(ee){for(var J=new Map;ee!==null;)ee.key!==null?J.set(ee.key,ee):J.set(ee.index,ee),ee=ee.sibling;return J}function v(ee,J){return ee=Aa(ee,J),ee.index=0,ee.sibling=null,ee}function C(ee,J,oe){return ee.index=oe,n?(oe=ee.alternate,oe!==null?(oe=oe.index,oe<J?(ee.flags|=67108866,J):oe):(ee.flags|=67108866,J)):(ee.flags|=1048576,J)}function M(ee){return n&&ee.alternate===null&&(ee.flags|=67108866),ee}function q(ee,J,oe,ve){return J===null||J.tag!==6?(J=am(oe,ee.mode,ve),J.return=ee,J):(J=v(J,oe),J.return=ee,J)}function Q(ee,J,oe,ve){var Je=oe.type;return Je===y?be(ee,J,oe.props.children,ve,oe.key):J!==null&&(J.elementType===Je||typeof Je=="object"&&Je!==null&&Je.$$typeof===O&&co(Je)===J.type)?(J=v(J,oe.props),Ai(J,oe),J.return=ee,J):(J=Ru(oe.type,oe.key,oe.props,null,ee.mode,ve),Ai(J,oe),J.return=ee,J)}function ie(ee,J,oe,ve){return J===null||J.tag!==4||J.stateNode.containerInfo!==oe.containerInfo||J.stateNode.implementation!==oe.implementation?(J=rm(oe,ee.mode,ve),J.return=ee,J):(J=v(J,oe.children||[]),J.return=ee,J)}function be(ee,J,oe,ve,Je){return J===null||J.tag!==7?(J=ao(oe,ee.mode,ve,Je),J.return=ee,J):(J=v(J,oe),J.return=ee,J)}function we(ee,J,oe){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=am(""+J,ee.mode,oe),J.return=ee,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case j:return oe=Ru(J.type,J.key,J.props,null,ee.mode,oe),Ai(oe,J),oe.return=ee,oe;case N:return J=rm(J,ee.mode,oe),J.return=ee,J;case O:return J=co(J),we(ee,J,oe)}if(H(J)||D(J))return J=ao(J,ee.mode,oe,null),J.return=ee,J;if(typeof J.then=="function")return we(ee,Pu(J),oe);if(J.$$typeof===E)return we(ee,Mu(ee,J),oe);Lu(ee,J)}return null}function ce(ee,J,oe,ve){var Je=J!==null?J.key:null;if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return Je!==null?null:q(ee,J,""+oe,ve);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case j:return oe.key===Je?Q(ee,J,oe,ve):null;case N:return oe.key===Je?ie(ee,J,oe,ve):null;case O:return oe=co(oe),ce(ee,J,oe,ve)}if(H(oe)||D(oe))return Je!==null?null:be(ee,J,oe,ve,null);if(typeof oe.then=="function")return ce(ee,J,Pu(oe),ve);if(oe.$$typeof===E)return ce(ee,J,Mu(ee,oe),ve);Lu(ee,oe)}return null}function pe(ee,J,oe,ve,Je){if(typeof ve=="string"&&ve!==""||typeof ve=="number"||typeof ve=="bigint")return ee=ee.get(oe)||null,q(J,ee,""+ve,Je);if(typeof ve=="object"&&ve!==null){switch(ve.$$typeof){case j:return ee=ee.get(ve.key===null?oe:ve.key)||null,Q(J,ee,ve,Je);case N:return ee=ee.get(ve.key===null?oe:ve.key)||null,ie(J,ee,ve,Je);case O:return ve=co(ve),pe(ee,J,oe,ve,Je)}if(H(ve)||D(ve))return ee=ee.get(oe)||null,be(J,ee,ve,Je,null);if(typeof ve.then=="function")return pe(ee,J,oe,Pu(ve),Je);if(ve.$$typeof===E)return pe(ee,J,oe,Mu(J,ve),Je);Lu(J,ve)}return null}function Fe(ee,J,oe,ve){for(var Je=null,Tt=null,Ke=J,gt=J=0,kt=null;Ke!==null&><oe.length;gt++){Ke.index>gt?(kt=Ke,Ke=null):kt=Ke.sibling;var At=ce(ee,Ke,oe[gt],ve);if(At===null){Ke===null&&(Ke=kt);break}n&&Ke&&At.alternate===null&&r(ee,Ke),J=C(At,J,gt),Tt===null?Je=At:Tt.sibling=At,Tt=At,Ke=kt}if(gt===oe.length)return i(ee,Ke),Nt&&Ma(ee,gt),Je;if(Ke===null){for(;gt<oe.length;gt++)Ke=we(ee,oe[gt],ve),Ke!==null&&(J=C(Ke,J,gt),Tt===null?Je=Ke:Tt.sibling=Ke,Tt=Ke);return Nt&&Ma(ee,gt),Je}for(Ke=f(Ke);gt<oe.length;gt++)kt=pe(Ke,ee,gt,oe[gt],ve),kt!==null&&(n&&kt.alternate!==null&&Ke.delete(kt.key===null?gt:kt.key),J=C(kt,J,gt),Tt===null?Je=kt:Tt.sibling=kt,Tt=kt);return n&&Ke.forEach(function(Tr){return r(ee,Tr)}),Nt&&Ma(ee,gt),Je}function at(ee,J,oe,ve){if(oe==null)throw Error(o(151));for(var Je=null,Tt=null,Ke=J,gt=J=0,kt=null,At=oe.next();Ke!==null&&!At.done;gt++,At=oe.next()){Ke.index>gt?(kt=Ke,Ke=null):kt=Ke.sibling;var Tr=ce(ee,Ke,At.value,ve);if(Tr===null){Ke===null&&(Ke=kt);break}n&&Ke&&Tr.alternate===null&&r(ee,Ke),J=C(Tr,J,gt),Tt===null?Je=Tr:Tt.sibling=Tr,Tt=Tr,Ke=kt}if(At.done)return i(ee,Ke),Nt&&Ma(ee,gt),Je;if(Ke===null){for(;!At.done;gt++,At=oe.next())At=we(ee,At.value,ve),At!==null&&(J=C(At,J,gt),Tt===null?Je=At:Tt.sibling=At,Tt=At);return Nt&&Ma(ee,gt),Je}for(Ke=f(Ke);!At.done;gt++,At=oe.next())At=pe(Ke,ee,gt,At.value,ve),At!==null&&(n&&At.alternate!==null&&Ke.delete(At.key===null?gt:At.key),J=C(At,J,gt),Tt===null?Je=At:Tt.sibling=At,Tt=At);return n&&Ke.forEach(function(wA){return r(ee,wA)}),Nt&&Ma(ee,gt),Je}function qt(ee,J,oe,ve){if(typeof oe=="object"&&oe!==null&&oe.type===y&&oe.key===null&&(oe=oe.props.children),typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case j:e:{for(var Je=oe.key;J!==null;){if(J.key===Je){if(Je=oe.type,Je===y){if(J.tag===7){i(ee,J.sibling),ve=v(J,oe.props.children),ve.return=ee,ee=ve;break e}}else if(J.elementType===Je||typeof Je=="object"&&Je!==null&&Je.$$typeof===O&&co(Je)===J.type){i(ee,J.sibling),ve=v(J,oe.props),Ai(ve,oe),ve.return=ee,ee=ve;break e}i(ee,J);break}else r(ee,J);J=J.sibling}oe.type===y?(ve=ao(oe.props.children,ee.mode,ve,oe.key),ve.return=ee,ee=ve):(ve=Ru(oe.type,oe.key,oe.props,null,ee.mode,ve),Ai(ve,oe),ve.return=ee,ee=ve)}return M(ee);case N:e:{for(Je=oe.key;J!==null;){if(J.key===Je)if(J.tag===4&&J.stateNode.containerInfo===oe.containerInfo&&J.stateNode.implementation===oe.implementation){i(ee,J.sibling),ve=v(J,oe.children||[]),ve.return=ee,ee=ve;break e}else{i(ee,J);break}else r(ee,J);J=J.sibling}ve=rm(oe,ee.mode,ve),ve.return=ee,ee=ve}return M(ee);case O:return oe=co(oe),qt(ee,J,oe,ve)}if(H(oe))return Fe(ee,J,oe,ve);if(D(oe)){if(Je=D(oe),typeof Je!="function")throw Error(o(150));return oe=Je.call(oe),at(ee,J,oe,ve)}if(typeof oe.then=="function")return qt(ee,J,Pu(oe),ve);if(oe.$$typeof===E)return qt(ee,J,Mu(ee,oe),ve);Lu(ee,oe)}return typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint"?(oe=""+oe,J!==null&&J.tag===6?(i(ee,J.sibling),ve=v(J,oe),ve.return=ee,ee=ve):(i(ee,J),ve=am(oe,ee.mode,ve),ve.return=ee,ee=ve),M(ee)):i(ee,J)}return function(ee,J,oe,ve){try{Ti=0;var Je=qt(ee,J,oe,ve);return ml=null,Je}catch(Ke){if(Ke===pl||Ke===zu)throw Ke;var Tt=xs(29,Ke,null,ee.mode);return Tt.lanes=ve,Tt.return=ee,Tt}finally{}}}var fo=gy(!0),hy=gy(!1),pr=!1;function xm(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bm(n,r){n=n.updateQueue,r.updateQueue===n&&(r.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function mr(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function gr(n,r,i){var f=n.updateQueue;if(f===null)return null;if(f=f.shared,(zt&2)!==0){var v=f.pending;return v===null?r.next=r:(r.next=v.next,v.next=r),f.pending=r,r=Eu(n),Jv(n,null,i),r}return Nu(n,f,r,i),Eu(n)}function Mi(n,r,i){if(r=r.updateQueue,r!==null&&(r=r.shared,(i&4194048)!==0)){var f=r.lanes;f&=n.pendingLanes,i|=f,r.lanes=i,Fs(n,i)}}function _m(n,r){var i=n.updateQueue,f=n.alternate;if(f!==null&&(f=f.updateQueue,i===f)){var v=null,C=null;if(i=i.firstBaseUpdate,i!==null){do{var M={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};C===null?v=C=M:C=C.next=M,i=i.next}while(i!==null);C===null?v=C=r:C=C.next=r}else v=C=r;i={baseState:f.baseState,firstBaseUpdate:v,lastBaseUpdate:C,shared:f.shared,callbacks:f.callbacks},n.updateQueue=i;return}n=i.lastBaseUpdate,n===null?i.firstBaseUpdate=r:n.next=r,i.lastBaseUpdate=r}var vm=!1;function Oi(){if(vm){var n=fl;if(n!==null)throw n}}function zi(n,r,i,f){vm=!1;var v=n.updateQueue;pr=!1;var C=v.firstBaseUpdate,M=v.lastBaseUpdate,q=v.shared.pending;if(q!==null){v.shared.pending=null;var Q=q,ie=Q.next;Q.next=null,M===null?C=ie:M.next=ie,M=Q;var be=n.alternate;be!==null&&(be=be.updateQueue,q=be.lastBaseUpdate,q!==M&&(q===null?be.firstBaseUpdate=ie:q.next=ie,be.lastBaseUpdate=Q))}if(C!==null){var we=v.baseState;M=0,be=ie=Q=null,q=C;do{var ce=q.lane&-536870913,pe=ce!==q.lane;if(pe?(wt&ce)===ce:(f&ce)===ce){ce!==0&&ce===dl&&(vm=!0),be!==null&&(be=be.next={lane:0,tag:q.tag,payload:q.payload,callback:null,next:null});e:{var Fe=n,at=q;ce=r;var qt=i;switch(at.tag){case 1:if(Fe=at.payload,typeof Fe=="function"){we=Fe.call(qt,we,ce);break e}we=Fe;break e;case 3:Fe.flags=Fe.flags&-65537|128;case 0:if(Fe=at.payload,ce=typeof Fe=="function"?Fe.call(qt,we,ce):Fe,ce==null)break e;we=b({},we,ce);break e;case 2:pr=!0}}ce=q.callback,ce!==null&&(n.flags|=64,pe&&(n.flags|=8192),pe=v.callbacks,pe===null?v.callbacks=[ce]:pe.push(ce))}else pe={lane:ce,tag:q.tag,payload:q.payload,callback:q.callback,next:null},be===null?(ie=be=pe,Q=we):be=be.next=pe,M|=ce;if(q=q.next,q===null){if(q=v.shared.pending,q===null)break;pe=q,q=pe.next,pe.next=null,v.lastBaseUpdate=pe,v.shared.pending=null}}while(!0);be===null&&(Q=we),v.baseState=Q,v.firstBaseUpdate=ie,v.lastBaseUpdate=be,C===null&&(v.shared.lanes=0),vr|=M,n.lanes=M,n.memoizedState=we}}function xy(n,r){if(typeof n!="function")throw Error(o(191,n));n.call(r)}function by(n,r){var i=n.callbacks;if(i!==null)for(n.callbacks=null,n=0;n<i.length;n++)xy(i[n],r)}var gl=I(null),Iu=I(0);function _y(n,r){n=qa,Z(Iu,n),Z(gl,r),qa=n|r.baseLanes}function ym(){Z(Iu,qa),Z(gl,gl.current)}function jm(){qa=Iu.current,X(gl),X(Iu)}var bs=I(null),Ds=null;function hr(n){var r=n.alternate;Z(xn,xn.current&1),Z(bs,n),Ds===null&&(r===null||gl.current!==null||r.memoizedState!==null)&&(Ds=n)}function wm(n){Z(xn,xn.current),Z(bs,n),Ds===null&&(Ds=n)}function vy(n){n.tag===22?(Z(xn,xn.current),Z(bs,n),Ds===null&&(Ds=n)):xr()}function xr(){Z(xn,xn.current),Z(bs,bs.current)}function _s(n){X(bs),Ds===n&&(Ds=null),X(xn)}var xn=I(0);function Bu(n){for(var r=n;r!==null;){if(r.tag===13){var i=r.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||Rg(i)||Tg(i)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Da=0,ft=null,$t=null,jn=null,Uu=!1,hl=!1,po=!1,$u=0,Di=0,xl=null,pT=0;function dn(){throw Error(o(321))}function km(n,r){if(r===null)return!1;for(var i=0;i<r.length&&i<n.length;i++)if(!hs(n[i],r[i]))return!1;return!0}function Sm(n,r,i,f,v,C){return Da=C,ft=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,$.H=n===null||n.memoizedState===null?s0:Um,po=!1,C=i(f,v),po=!1,hl&&(C=jy(r,i,f,v)),yy(n),C}function yy(n){$.H=Ii;var r=$t!==null&&$t.next!==null;if(Da=0,jn=$t=ft=null,Uu=!1,Di=0,xl=null,r)throw Error(o(300));n===null||wn||(n=n.dependencies,n!==null&&Au(n)&&(wn=!0))}function jy(n,r,i,f){ft=n;var v=0;do{if(hl&&(xl=null),Di=0,hl=!1,25<=v)throw Error(o(301));if(v+=1,jn=$t=null,n.updateQueue!=null){var C=n.updateQueue;C.lastEffect=null,C.events=null,C.stores=null,C.memoCache!=null&&(C.memoCache.index=0)}$.H=a0,C=r(i,f)}while(hl);return C}function mT(){var n=$.H,r=n.useState()[0];return r=typeof r.then=="function"?Pi(r):r,n=n.useState()[0],($t!==null?$t.memoizedState:null)!==n&&(ft.flags|=1024),r}function Cm(){var n=$u!==0;return $u=0,n}function Nm(n,r,i){r.updateQueue=n.updateQueue,r.flags&=-2053,n.lanes&=~i}function Em(n){if(Uu){for(n=n.memoizedState;n!==null;){var r=n.queue;r!==null&&(r.pending=null),n=n.next}Uu=!1}Da=0,jn=$t=ft=null,hl=!1,Di=$u=0,xl=null}function Xn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return jn===null?ft.memoizedState=jn=n:jn=jn.next=n,jn}function bn(){if($t===null){var n=ft.alternate;n=n!==null?n.memoizedState:null}else n=$t.next;var r=jn===null?ft.memoizedState:jn.next;if(r!==null)jn=r,$t=n;else{if(n===null)throw ft.alternate===null?Error(o(467)):Error(o(310));$t=n,n={memoizedState:$t.memoizedState,baseState:$t.baseState,baseQueue:$t.baseQueue,queue:$t.queue,next:null},jn===null?ft.memoizedState=jn=n:jn=jn.next=n}return jn}function Hu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pi(n){var r=Di;return Di+=1,xl===null&&(xl=[]),n=fy(xl,n,r),r=ft,(jn===null?r.memoizedState:jn.next)===null&&(r=r.alternate,$.H=r===null||r.memoizedState===null?s0:Um),n}function qu(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Pi(n);if(n.$$typeof===E)return Bn(n)}throw Error(o(438,String(n)))}function Rm(n){var r=null,i=ft.updateQueue;if(i!==null&&(r=i.memoCache),r==null){var f=ft.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(r={data:f.data.map(function(v){return v.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),i===null&&(i=Hu(),ft.updateQueue=i),i.memoCache=r,i=r.data[r.index],i===void 0)for(i=r.data[r.index]=Array(n),f=0;f<n;f++)i[f]=P;return r.index++,i}function Pa(n,r){return typeof r=="function"?r(n):r}function Vu(n){var r=bn();return Tm(r,$t,n)}function Tm(n,r,i){var f=n.queue;if(f===null)throw Error(o(311));f.lastRenderedReducer=i;var v=n.baseQueue,C=f.pending;if(C!==null){if(v!==null){var M=v.next;v.next=C.next,C.next=M}r.baseQueue=v=C,f.pending=null}if(C=n.baseState,v===null)n.memoizedState=C;else{r=v.next;var q=M=null,Q=null,ie=r,be=!1;do{var we=ie.lane&-536870913;if(we!==ie.lane?(wt&we)===we:(Da&we)===we){var ce=ie.revertLane;if(ce===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null}),we===dl&&(be=!0);else if((Da&ce)===ce){ie=ie.next,ce===dl&&(be=!0);continue}else we={lane:0,revertLane:ie.revertLane,gesture:null,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},Q===null?(q=Q=we,M=C):Q=Q.next=we,ft.lanes|=ce,vr|=ce;we=ie.action,po&&i(C,we),C=ie.hasEagerState?ie.eagerState:i(C,we)}else ce={lane:we,revertLane:ie.revertLane,gesture:ie.gesture,action:ie.action,hasEagerState:ie.hasEagerState,eagerState:ie.eagerState,next:null},Q===null?(q=Q=ce,M=C):Q=Q.next=ce,ft.lanes|=we,vr|=we;ie=ie.next}while(ie!==null&&ie!==r);if(Q===null?M=C:Q.next=q,!hs(C,n.memoizedState)&&(wn=!0,be&&(i=fl,i!==null)))throw i;n.memoizedState=C,n.baseState=M,n.baseQueue=Q,f.lastRenderedState=C}return v===null&&(f.lanes=0),[n.memoizedState,f.dispatch]}function Am(n){var r=bn(),i=r.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=n;var f=i.dispatch,v=i.pending,C=r.memoizedState;if(v!==null){i.pending=null;var M=v=v.next;do C=n(C,M.action),M=M.next;while(M!==v);hs(C,r.memoizedState)||(wn=!0),r.memoizedState=C,r.baseQueue===null&&(r.baseState=C),i.lastRenderedState=C}return[C,f]}function wy(n,r,i){var f=ft,v=bn(),C=Nt;if(C){if(i===void 0)throw Error(o(407));i=i()}else i=r();var M=!hs(($t||v).memoizedState,i);if(M&&(v.memoizedState=i,wn=!0),v=v.queue,zm(Cy.bind(null,f,v,n),[n]),v.getSnapshot!==r||M||jn!==null&&jn.memoizedState.tag&1){if(f.flags|=2048,bl(9,{destroy:void 0},Sy.bind(null,f,v,i,r),null),Kt===null)throw Error(o(349));C||(Da&127)!==0||ky(f,r,i)}return i}function ky(n,r,i){n.flags|=16384,n={getSnapshot:r,value:i},r=ft.updateQueue,r===null?(r=Hu(),ft.updateQueue=r,r.stores=[n]):(i=r.stores,i===null?r.stores=[n]:i.push(n))}function Sy(n,r,i,f){r.value=i,r.getSnapshot=f,Ny(r)&&Ey(n)}function Cy(n,r,i){return i(function(){Ny(r)&&Ey(n)})}function Ny(n){var r=n.getSnapshot;n=n.value;try{var i=r();return!hs(n,i)}catch{return!0}}function Ey(n){var r=so(n,2);r!==null&&cs(r,n,2)}function Mm(n){var r=Xn();if(typeof n=="function"){var i=n;if(n=i(),po){_e(!0);try{i()}finally{_e(!1)}}}return r.memoizedState=r.baseState=n,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pa,lastRenderedState:n},r}function Ry(n,r,i,f){return n.baseState=i,Tm(n,$t,typeof f=="function"?f:Pa)}function gT(n,r,i,f,v){if(Yu(n))throw Error(o(485));if(n=r.action,n!==null){var C={payload:v,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){C.listeners.push(M)}};$.T!==null?i(!0):C.isTransition=!1,f(C),i=r.pending,i===null?(C.next=r.pending=C,Ty(r,C)):(C.next=i.next,r.pending=i.next=C)}}function Ty(n,r){var i=r.action,f=r.payload,v=n.state;if(r.isTransition){var C=$.T,M={};$.T=M;try{var q=i(v,f),Q=$.S;Q!==null&&Q(M,q),Ay(n,r,q)}catch(ie){Om(n,r,ie)}finally{C!==null&&M.types!==null&&(C.types=M.types),$.T=C}}else try{C=i(v,f),Ay(n,r,C)}catch(ie){Om(n,r,ie)}}function Ay(n,r,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(f){My(n,r,f)},function(f){return Om(n,r,f)}):My(n,r,i)}function My(n,r,i){r.status="fulfilled",r.value=i,Oy(r),n.state=i,r=n.pending,r!==null&&(i=r.next,i===r?n.pending=null:(i=i.next,r.next=i,Ty(n,i)))}function Om(n,r,i){var f=n.pending;if(n.pending=null,f!==null){f=f.next;do r.status="rejected",r.reason=i,Oy(r),r=r.next;while(r!==f)}n.action=null}function Oy(n){n=n.listeners;for(var r=0;r<n.length;r++)(0,n[r])()}function zy(n,r){return r}function Dy(n,r){if(Nt){var i=Kt.formState;if(i!==null){e:{var f=ft;if(Nt){if(tn){t:{for(var v=tn,C=zs;v.nodeType!==8;){if(!C){v=null;break t}if(v=Ps(v.nextSibling),v===null){v=null;break t}}C=v.data,v=C==="F!"||C==="F"?v:null}if(v){tn=Ps(v.nextSibling),f=v.data==="F!";break e}}dr(f)}f=!1}f&&(r=i[0])}}return i=Xn(),i.memoizedState=i.baseState=r,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zy,lastRenderedState:r},i.queue=f,i=e0.bind(null,ft,f),f.dispatch=i,f=Mm(!1),C=Bm.bind(null,ft,!1,f.queue),f=Xn(),v={state:r,dispatch:null,action:n,pending:null},f.queue=v,i=gT.bind(null,ft,v,C,i),v.dispatch=i,f.memoizedState=n,[r,i,!1]}function Py(n){var r=bn();return Ly(r,$t,n)}function Ly(n,r,i){if(r=Tm(n,r,zy)[0],n=Vu(Pa)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var f=Pi(r)}catch(M){throw M===pl?zu:M}else f=r;r=bn();var v=r.queue,C=v.dispatch;return i!==r.memoizedState&&(ft.flags|=2048,bl(9,{destroy:void 0},hT.bind(null,v,i),null)),[f,C,n]}function hT(n,r){n.action=r}function Iy(n){var r=bn(),i=$t;if(i!==null)return Ly(r,i,n);bn(),r=r.memoizedState,i=bn();var f=i.queue.dispatch;return i.memoizedState=n,[r,f,!1]}function bl(n,r,i,f){return n={tag:n,create:i,deps:f,inst:r,next:null},r=ft.updateQueue,r===null&&(r=Hu(),ft.updateQueue=r),i=r.lastEffect,i===null?r.lastEffect=n.next=n:(f=i.next,i.next=n,n.next=f,r.lastEffect=n),n}function By(){return bn().memoizedState}function Fu(n,r,i,f){var v=Xn();ft.flags|=n,v.memoizedState=bl(1|r,{destroy:void 0},i,f===void 0?null:f)}function Gu(n,r,i,f){var v=bn();f=f===void 0?null:f;var C=v.memoizedState.inst;$t!==null&&f!==null&&km(f,$t.memoizedState.deps)?v.memoizedState=bl(r,C,i,f):(ft.flags|=n,v.memoizedState=bl(1|r,C,i,f))}function Uy(n,r){Fu(8390656,8,n,r)}function zm(n,r){Gu(2048,8,n,r)}function xT(n){ft.flags|=4;var r=ft.updateQueue;if(r===null)r=Hu(),ft.updateQueue=r,r.events=[n];else{var i=r.events;i===null?r.events=[n]:i.push(n)}}function $y(n){var r=bn().memoizedState;return xT({ref:r,nextImpl:n}),function(){if((zt&2)!==0)throw Error(o(440));return r.impl.apply(void 0,arguments)}}function Hy(n,r){return Gu(4,2,n,r)}function qy(n,r){return Gu(4,4,n,r)}function Vy(n,r){if(typeof r=="function"){n=n();var i=r(n);return function(){typeof i=="function"?i():r(null)}}if(r!=null)return n=n(),r.current=n,function(){r.current=null}}function Fy(n,r,i){i=i!=null?i.concat([n]):null,Gu(4,4,Vy.bind(null,r,n),i)}function Dm(){}function Gy(n,r){var i=bn();r=r===void 0?null:r;var f=i.memoizedState;return r!==null&&km(r,f[1])?f[0]:(i.memoizedState=[n,r],n)}function Yy(n,r){var i=bn();r=r===void 0?null:r;var f=i.memoizedState;if(r!==null&&km(r,f[1]))return f[0];if(f=n(),po){_e(!0);try{n()}finally{_e(!1)}}return i.memoizedState=[f,r],f}function Pm(n,r,i){return i===void 0||(Da&1073741824)!==0&&(wt&261930)===0?n.memoizedState=r:(n.memoizedState=i,n=K0(),ft.lanes|=n,vr|=n,i)}function Ky(n,r,i,f){return hs(i,r)?i:gl.current!==null?(n=Pm(n,i,f),hs(n,r)||(wn=!0),n):(Da&42)===0||(Da&1073741824)!==0&&(wt&261930)===0?(wn=!0,n.memoizedState=i):(n=K0(),ft.lanes|=n,vr|=n,r)}function Xy(n,r,i,f,v){var C=F.p;F.p=C!==0&&8>C?C:8;var M=$.T,q={};$.T=q,Bm(n,!1,r,i);try{var Q=v(),ie=$.S;if(ie!==null&&ie(q,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var be=fT(Q,f);Li(n,r,be,js(n))}else Li(n,r,f,js(n))}catch(we){Li(n,r,{then:function(){},status:"rejected",reason:we},js())}finally{F.p=C,M!==null&&q.types!==null&&(M.types=q.types),$.T=M}}function bT(){}function Lm(n,r,i,f){if(n.tag!==5)throw Error(o(476));var v=Qy(n).queue;Xy(n,v,r,Y,i===null?bT:function(){return Wy(n),i(f)})}function Qy(n){var r=n.memoizedState;if(r!==null)return r;r={memoizedState:Y,baseState:Y,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pa,lastRenderedState:Y},next:null};var i={};return r.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pa,lastRenderedState:i},next:null},n.memoizedState=r,n=n.alternate,n!==null&&(n.memoizedState=r),r}function Wy(n){var r=Qy(n);r.next===null&&(r=n.alternate.memoizedState),Li(n,r.next.queue,{},js())}function Im(){return Bn(ec)}function Zy(){return bn().memoizedState}function Jy(){return bn().memoizedState}function _T(n){for(var r=n.return;r!==null;){switch(r.tag){case 24:case 3:var i=js();n=mr(i);var f=gr(r,n,i);f!==null&&(cs(f,r,i),Mi(f,r,i)),r={cache:pm()},n.payload=r;return}r=r.return}}function vT(n,r,i){var f=js();i={lane:f,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Yu(n)?t0(r,i):(i=nm(n,r,i,f),i!==null&&(cs(i,n,f),n0(i,r,f)))}function e0(n,r,i){var f=js();Li(n,r,i,f)}function Li(n,r,i,f){var v={lane:f,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(Yu(n))t0(r,v);else{var C=n.alternate;if(n.lanes===0&&(C===null||C.lanes===0)&&(C=r.lastRenderedReducer,C!==null))try{var M=r.lastRenderedState,q=C(M,i);if(v.hasEagerState=!0,v.eagerState=q,hs(q,M))return Nu(n,r,v,0),Kt===null&&Cu(),!1}catch{}finally{}if(i=nm(n,r,v,f),i!==null)return cs(i,n,f),n0(i,r,f),!0}return!1}function Bm(n,r,i,f){if(f={lane:2,revertLane:xg(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},Yu(n)){if(r)throw Error(o(479))}else r=nm(n,i,f,2),r!==null&&cs(r,n,2)}function Yu(n){var r=n.alternate;return n===ft||r!==null&&r===ft}function t0(n,r){hl=Uu=!0;var i=n.pending;i===null?r.next=r:(r.next=i.next,i.next=r),n.pending=r}function n0(n,r,i){if((i&4194048)!==0){var f=r.lanes;f&=n.pendingLanes,i|=f,r.lanes=i,Fs(n,i)}}var Ii={readContext:Bn,use:qu,useCallback:dn,useContext:dn,useEffect:dn,useImperativeHandle:dn,useLayoutEffect:dn,useInsertionEffect:dn,useMemo:dn,useReducer:dn,useRef:dn,useState:dn,useDebugValue:dn,useDeferredValue:dn,useTransition:dn,useSyncExternalStore:dn,useId:dn,useHostTransitionStatus:dn,useFormState:dn,useActionState:dn,useOptimistic:dn,useMemoCache:dn,useCacheRefresh:dn};Ii.useEffectEvent=dn;var s0={readContext:Bn,use:qu,useCallback:function(n,r){return Xn().memoizedState=[n,r===void 0?null:r],n},useContext:Bn,useEffect:Uy,useImperativeHandle:function(n,r,i){i=i!=null?i.concat([n]):null,Fu(4194308,4,Vy.bind(null,r,n),i)},useLayoutEffect:function(n,r){return Fu(4194308,4,n,r)},useInsertionEffect:function(n,r){Fu(4,2,n,r)},useMemo:function(n,r){var i=Xn();r=r===void 0?null:r;var f=n();if(po){_e(!0);try{n()}finally{_e(!1)}}return i.memoizedState=[f,r],f},useReducer:function(n,r,i){var f=Xn();if(i!==void 0){var v=i(r);if(po){_e(!0);try{i(r)}finally{_e(!1)}}}else v=r;return f.memoizedState=f.baseState=v,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:v},f.queue=n,n=n.dispatch=vT.bind(null,ft,n),[f.memoizedState,n]},useRef:function(n){var r=Xn();return n={current:n},r.memoizedState=n},useState:function(n){n=Mm(n);var r=n.queue,i=e0.bind(null,ft,r);return r.dispatch=i,[n.memoizedState,i]},useDebugValue:Dm,useDeferredValue:function(n,r){var i=Xn();return Pm(i,n,r)},useTransition:function(){var n=Mm(!1);return n=Xy.bind(null,ft,n.queue,!0,!1),Xn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,r,i){var f=ft,v=Xn();if(Nt){if(i===void 0)throw Error(o(407));i=i()}else{if(i=r(),Kt===null)throw Error(o(349));(wt&127)!==0||ky(f,r,i)}v.memoizedState=i;var C={value:i,getSnapshot:r};return v.queue=C,Uy(Cy.bind(null,f,C,n),[n]),f.flags|=2048,bl(9,{destroy:void 0},Sy.bind(null,f,C,i,r),null),i},useId:function(){var n=Xn(),r=Kt.identifierPrefix;if(Nt){var i=ra,f=aa;i=(f&~(1<<32-Pe(f)-1)).toString(32)+i,r="_"+r+"R_"+i,i=$u++,0<i&&(r+="H"+i.toString(32)),r+="_"}else i=pT++,r="_"+r+"r_"+i.toString(32)+"_";return n.memoizedState=r},useHostTransitionStatus:Im,useFormState:Dy,useActionState:Dy,useOptimistic:function(n){var r=Xn();r.memoizedState=r.baseState=n;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=i,r=Bm.bind(null,ft,!0,i),i.dispatch=r,[n,r]},useMemoCache:Rm,useCacheRefresh:function(){return Xn().memoizedState=_T.bind(null,ft)},useEffectEvent:function(n){var r=Xn(),i={impl:n};return r.memoizedState=i,function(){if((zt&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},Um={readContext:Bn,use:qu,useCallback:Gy,useContext:Bn,useEffect:zm,useImperativeHandle:Fy,useInsertionEffect:Hy,useLayoutEffect:qy,useMemo:Yy,useReducer:Vu,useRef:By,useState:function(){return Vu(Pa)},useDebugValue:Dm,useDeferredValue:function(n,r){var i=bn();return Ky(i,$t.memoizedState,n,r)},useTransition:function(){var n=Vu(Pa)[0],r=bn().memoizedState;return[typeof n=="boolean"?n:Pi(n),r]},useSyncExternalStore:wy,useId:Zy,useHostTransitionStatus:Im,useFormState:Py,useActionState:Py,useOptimistic:function(n,r){var i=bn();return Ry(i,$t,n,r)},useMemoCache:Rm,useCacheRefresh:Jy};Um.useEffectEvent=$y;var a0={readContext:Bn,use:qu,useCallback:Gy,useContext:Bn,useEffect:zm,useImperativeHandle:Fy,useInsertionEffect:Hy,useLayoutEffect:qy,useMemo:Yy,useReducer:Am,useRef:By,useState:function(){return Am(Pa)},useDebugValue:Dm,useDeferredValue:function(n,r){var i=bn();return $t===null?Pm(i,n,r):Ky(i,$t.memoizedState,n,r)},useTransition:function(){var n=Am(Pa)[0],r=bn().memoizedState;return[typeof n=="boolean"?n:Pi(n),r]},useSyncExternalStore:wy,useId:Zy,useHostTransitionStatus:Im,useFormState:Iy,useActionState:Iy,useOptimistic:function(n,r){var i=bn();return $t!==null?Ry(i,$t,n,r):(i.baseState=n,[n,i.queue.dispatch])},useMemoCache:Rm,useCacheRefresh:Jy};a0.useEffectEvent=$y;function $m(n,r,i,f){r=n.memoizedState,i=i(f,r),i=i==null?r:b({},r,i),n.memoizedState=i,n.lanes===0&&(n.updateQueue.baseState=i)}var Hm={enqueueSetState:function(n,r,i){n=n._reactInternals;var f=js(),v=mr(f);v.payload=r,i!=null&&(v.callback=i),r=gr(n,v,f),r!==null&&(cs(r,n,f),Mi(r,n,f))},enqueueReplaceState:function(n,r,i){n=n._reactInternals;var f=js(),v=mr(f);v.tag=1,v.payload=r,i!=null&&(v.callback=i),r=gr(n,v,f),r!==null&&(cs(r,n,f),Mi(r,n,f))},enqueueForceUpdate:function(n,r){n=n._reactInternals;var i=js(),f=mr(i);f.tag=2,r!=null&&(f.callback=r),r=gr(n,f,i),r!==null&&(cs(r,n,i),Mi(r,n,i))}};function r0(n,r,i,f,v,C,M){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(f,C,M):r.prototype&&r.prototype.isPureReactComponent?!ki(i,f)||!ki(v,C):!0}function o0(n,r,i,f){n=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(i,f),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(i,f),r.state!==n&&Hm.enqueueReplaceState(r,r.state,null)}function mo(n,r){var i=r;if("ref"in r){i={};for(var f in r)f!=="ref"&&(i[f]=r[f])}if(n=n.defaultProps){i===r&&(i=b({},i));for(var v in n)i[v]===void 0&&(i[v]=n[v])}return i}function l0(n){Su(n)}function i0(n){console.error(n)}function c0(n){Su(n)}function Ku(n,r){try{var i=n.onUncaughtError;i(r.value,{componentStack:r.stack})}catch(f){setTimeout(function(){throw f})}}function u0(n,r,i){try{var f=n.onCaughtError;f(i.value,{componentStack:i.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function qm(n,r,i){return i=mr(i),i.tag=3,i.payload={element:null},i.callback=function(){Ku(n,r)},i}function d0(n){return n=mr(n),n.tag=3,n}function f0(n,r,i,f){var v=i.type.getDerivedStateFromError;if(typeof v=="function"){var C=f.value;n.payload=function(){return v(C)},n.callback=function(){u0(r,i,f)}}var M=i.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(n.callback=function(){u0(r,i,f),typeof v!="function"&&(yr===null?yr=new Set([this]):yr.add(this));var q=f.stack;this.componentDidCatch(f.value,{componentStack:q!==null?q:""})})}function yT(n,r,i,f,v){if(i.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(r=i.alternate,r!==null&&ul(r,i,v,!0),i=bs.current,i!==null){switch(i.tag){case 31:case 13:return Ds===null?od():i.alternate===null&&fn===0&&(fn=3),i.flags&=-257,i.flags|=65536,i.lanes=v,f===Du?i.flags|=16384:(r=i.updateQueue,r===null?i.updateQueue=new Set([f]):r.add(f),mg(n,f,v)),!1;case 22:return i.flags|=65536,f===Du?i.flags|=16384:(r=i.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([f])},i.updateQueue=r):(i=r.retryQueue,i===null?r.retryQueue=new Set([f]):i.add(f)),mg(n,f,v)),!1}throw Error(o(435,i.tag))}return mg(n,f,v),od(),!1}if(Nt)return r=bs.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=v,f!==im&&(n=Error(o(422),{cause:f}),Ni(As(n,i)))):(f!==im&&(r=Error(o(423),{cause:f}),Ni(As(r,i))),n=n.current.alternate,n.flags|=65536,v&=-v,n.lanes|=v,f=As(f,i),v=qm(n.stateNode,f,v),_m(n,v),fn!==4&&(fn=2)),!1;var C=Error(o(520),{cause:f});if(C=As(C,i),Gi===null?Gi=[C]:Gi.push(C),fn!==4&&(fn=2),r===null)return!0;f=As(f,i),i=r;do{switch(i.tag){case 3:return i.flags|=65536,n=v&-v,i.lanes|=n,n=qm(i.stateNode,f,n),_m(i,n),!1;case 1:if(r=i.type,C=i.stateNode,(i.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||C!==null&&typeof C.componentDidCatch=="function"&&(yr===null||!yr.has(C))))return i.flags|=65536,v&=-v,i.lanes|=v,v=d0(v),f0(v,n,i,f),_m(i,v),!1}i=i.return}while(i!==null);return!1}var Vm=Error(o(461)),wn=!1;function Un(n,r,i,f){r.child=n===null?hy(r,null,i,f):fo(r,n.child,i,f)}function p0(n,r,i,f,v){i=i.render;var C=r.ref;if("ref"in f){var M={};for(var q in f)q!=="ref"&&(M[q]=f[q])}else M=f;return lo(r),f=Sm(n,r,i,M,C,v),q=Cm(),n!==null&&!wn?(Nm(n,r,v),La(n,r,v)):(Nt&&q&&om(r),r.flags|=1,Un(n,r,f,v),r.child)}function m0(n,r,i,f,v){if(n===null){var C=i.type;return typeof C=="function"&&!sm(C)&&C.defaultProps===void 0&&i.compare===null?(r.tag=15,r.type=C,g0(n,r,C,f,v)):(n=Ru(i.type,null,f,r,r.mode,v),n.ref=r.ref,n.return=r,r.child=n)}if(C=n.child,!Zm(n,v)){var M=C.memoizedProps;if(i=i.compare,i=i!==null?i:ki,i(M,f)&&n.ref===r.ref)return La(n,r,v)}return r.flags|=1,n=Aa(C,f),n.ref=r.ref,n.return=r,r.child=n}function g0(n,r,i,f,v){if(n!==null){var C=n.memoizedProps;if(ki(C,f)&&n.ref===r.ref)if(wn=!1,r.pendingProps=f=C,Zm(n,v))(n.flags&131072)!==0&&(wn=!0);else return r.lanes=n.lanes,La(n,r,v)}return Fm(n,r,i,f,v)}function h0(n,r,i,f){var v=f.children,C=n!==null?n.memoizedState:null;if(n===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((r.flags&128)!==0){if(C=C!==null?C.baseLanes|i:i,n!==null){for(f=r.child=n.child,v=0;f!==null;)v=v|f.lanes|f.childLanes,f=f.sibling;f=v&~C}else f=0,r.child=null;return x0(n,r,C,i,f)}if((i&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},n!==null&&Ou(r,C!==null?C.cachePool:null),C!==null?_y(r,C):ym(),vy(r);else return f=r.lanes=536870912,x0(n,r,C!==null?C.baseLanes|i:i,i,f)}else C!==null?(Ou(r,C.cachePool),_y(r,C),xr(),r.memoizedState=null):(n!==null&&Ou(r,null),ym(),xr());return Un(n,r,v,i),r.child}function Bi(n,r){return n!==null&&n.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function x0(n,r,i,f,v){var C=gm();return C=C===null?null:{parent:yn._currentValue,pool:C},r.memoizedState={baseLanes:i,cachePool:C},n!==null&&Ou(r,null),ym(),vy(r),n!==null&&ul(n,r,f,!0),r.childLanes=v,null}function Xu(n,r){return r=Wu({mode:r.mode,children:r.children},n.mode),r.ref=n.ref,n.child=r,r.return=n,r}function b0(n,r,i){return fo(r,n.child,null,i),n=Xu(r,r.pendingProps),n.flags|=2,_s(r),r.memoizedState=null,n}function jT(n,r,i){var f=r.pendingProps,v=(r.flags&128)!==0;if(r.flags&=-129,n===null){if(Nt){if(f.mode==="hidden")return n=Xu(r,f),r.lanes=536870912,Bi(null,n);if(wm(r),(n=tn)?(n=T1(n,zs),n=n!==null&&n.data==="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:cr!==null?{id:aa,overflow:ra}:null,retryLane:536870912,hydrationErrors:null},i=ty(n),i.return=r,r.child=i,In=r,tn=null)):n=null,n===null)throw dr(r);return r.lanes=536870912,null}return Xu(r,f)}var C=n.memoizedState;if(C!==null){var M=C.dehydrated;if(wm(r),v)if(r.flags&256)r.flags&=-257,r=b0(n,r,i);else if(r.memoizedState!==null)r.child=n.child,r.flags|=128,r=null;else throw Error(o(558));else if(wn||ul(n,r,i,!1),v=(i&n.childLanes)!==0,wn||v){if(f=Kt,f!==null&&(M=Na(f,i),M!==0&&M!==C.retryLane))throw C.retryLane=M,so(n,M),cs(f,n,M),Vm;od(),r=b0(n,r,i)}else n=C.treeContext,tn=Ps(M.nextSibling),In=r,Nt=!0,ur=null,zs=!1,n!==null&&ay(r,n),r=Xu(r,f),r.flags|=4096;return r}return n=Aa(n.child,{mode:f.mode,children:f.children}),n.ref=r.ref,r.child=n,n.return=r,n}function Qu(n,r){var i=r.ref;if(i===null)n!==null&&n.ref!==null&&(r.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(n===null||n.ref!==i)&&(r.flags|=4194816)}}function Fm(n,r,i,f,v){return lo(r),i=Sm(n,r,i,f,void 0,v),f=Cm(),n!==null&&!wn?(Nm(n,r,v),La(n,r,v)):(Nt&&f&&om(r),r.flags|=1,Un(n,r,i,v),r.child)}function _0(n,r,i,f,v,C){return lo(r),r.updateQueue=null,i=jy(r,f,i,v),yy(n),f=Cm(),n!==null&&!wn?(Nm(n,r,C),La(n,r,C)):(Nt&&f&&om(r),r.flags|=1,Un(n,r,i,C),r.child)}function v0(n,r,i,f,v){if(lo(r),r.stateNode===null){var C=ol,M=i.contextType;typeof M=="object"&&M!==null&&(C=Bn(M)),C=new i(f,C),r.memoizedState=C.state!==null&&C.state!==void 0?C.state:null,C.updater=Hm,r.stateNode=C,C._reactInternals=r,C=r.stateNode,C.props=f,C.state=r.memoizedState,C.refs={},xm(r),M=i.contextType,C.context=typeof M=="object"&&M!==null?Bn(M):ol,C.state=r.memoizedState,M=i.getDerivedStateFromProps,typeof M=="function"&&($m(r,i,M,f),C.state=r.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof C.getSnapshotBeforeUpdate=="function"||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(M=C.state,typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount(),M!==C.state&&Hm.enqueueReplaceState(C,C.state,null),zi(r,f,C,v),Oi(),C.state=r.memoizedState),typeof C.componentDidMount=="function"&&(r.flags|=4194308),f=!0}else if(n===null){C=r.stateNode;var q=r.memoizedProps,Q=mo(i,q);C.props=Q;var ie=C.context,be=i.contextType;M=ol,typeof be=="object"&&be!==null&&(M=Bn(be));var we=i.getDerivedStateFromProps;be=typeof we=="function"||typeof C.getSnapshotBeforeUpdate=="function",q=r.pendingProps!==q,be||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(q||ie!==M)&&o0(r,C,f,M),pr=!1;var ce=r.memoizedState;C.state=ce,zi(r,f,C,v),Oi(),ie=r.memoizedState,q||ce!==ie||pr?(typeof we=="function"&&($m(r,i,we,f),ie=r.memoizedState),(Q=pr||r0(r,i,Q,f,ce,ie,M))?(be||typeof C.UNSAFE_componentWillMount!="function"&&typeof C.componentWillMount!="function"||(typeof C.componentWillMount=="function"&&C.componentWillMount(),typeof C.UNSAFE_componentWillMount=="function"&&C.UNSAFE_componentWillMount()),typeof C.componentDidMount=="function"&&(r.flags|=4194308)):(typeof C.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=f,r.memoizedState=ie),C.props=f,C.state=ie,C.context=M,f=Q):(typeof C.componentDidMount=="function"&&(r.flags|=4194308),f=!1)}else{C=r.stateNode,bm(n,r),M=r.memoizedProps,be=mo(i,M),C.props=be,we=r.pendingProps,ce=C.context,ie=i.contextType,Q=ol,typeof ie=="object"&&ie!==null&&(Q=Bn(ie)),q=i.getDerivedStateFromProps,(ie=typeof q=="function"||typeof C.getSnapshotBeforeUpdate=="function")||typeof C.UNSAFE_componentWillReceiveProps!="function"&&typeof C.componentWillReceiveProps!="function"||(M!==we||ce!==Q)&&o0(r,C,f,Q),pr=!1,ce=r.memoizedState,C.state=ce,zi(r,f,C,v),Oi();var pe=r.memoizedState;M!==we||ce!==pe||pr||n!==null&&n.dependencies!==null&&Au(n.dependencies)?(typeof q=="function"&&($m(r,i,q,f),pe=r.memoizedState),(be=pr||r0(r,i,be,f,ce,pe,Q)||n!==null&&n.dependencies!==null&&Au(n.dependencies))?(ie||typeof C.UNSAFE_componentWillUpdate!="function"&&typeof C.componentWillUpdate!="function"||(typeof C.componentWillUpdate=="function"&&C.componentWillUpdate(f,pe,Q),typeof C.UNSAFE_componentWillUpdate=="function"&&C.UNSAFE_componentWillUpdate(f,pe,Q)),typeof C.componentDidUpdate=="function"&&(r.flags|=4),typeof C.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof C.componentDidUpdate!="function"||M===n.memoizedProps&&ce===n.memoizedState||(r.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||M===n.memoizedProps&&ce===n.memoizedState||(r.flags|=1024),r.memoizedProps=f,r.memoizedState=pe),C.props=f,C.state=pe,C.context=Q,f=be):(typeof C.componentDidUpdate!="function"||M===n.memoizedProps&&ce===n.memoizedState||(r.flags|=4),typeof C.getSnapshotBeforeUpdate!="function"||M===n.memoizedProps&&ce===n.memoizedState||(r.flags|=1024),f=!1)}return C=f,Qu(n,r),f=(r.flags&128)!==0,C||f?(C=r.stateNode,i=f&&typeof i.getDerivedStateFromError!="function"?null:C.render(),r.flags|=1,n!==null&&f?(r.child=fo(r,n.child,null,v),r.child=fo(r,null,i,v)):Un(n,r,i,v),r.memoizedState=C.state,n=r.child):n=La(n,r,v),n}function y0(n,r,i,f){return ro(),r.flags|=256,Un(n,r,i,f),r.child}var Gm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ym(n){return{baseLanes:n,cachePool:uy()}}function Km(n,r,i){return n=n!==null?n.childLanes&~i:0,r&&(n|=ys),n}function j0(n,r,i){var f=r.pendingProps,v=!1,C=(r.flags&128)!==0,M;if((M=C)||(M=n!==null&&n.memoizedState===null?!1:(xn.current&2)!==0),M&&(v=!0,r.flags&=-129),M=(r.flags&32)!==0,r.flags&=-33,n===null){if(Nt){if(v?hr(r):xr(),(n=tn)?(n=T1(n,zs),n=n!==null&&n.data!=="&"?n:null,n!==null&&(r.memoizedState={dehydrated:n,treeContext:cr!==null?{id:aa,overflow:ra}:null,retryLane:536870912,hydrationErrors:null},i=ty(n),i.return=r,r.child=i,In=r,tn=null)):n=null,n===null)throw dr(r);return Tg(n)?r.lanes=32:r.lanes=536870912,null}var q=f.children;return f=f.fallback,v?(xr(),v=r.mode,q=Wu({mode:"hidden",children:q},v),f=ao(f,v,i,null),q.return=r,f.return=r,q.sibling=f,r.child=q,f=r.child,f.memoizedState=Ym(i),f.childLanes=Km(n,M,i),r.memoizedState=Gm,Bi(null,f)):(hr(r),Xm(r,q))}var Q=n.memoizedState;if(Q!==null&&(q=Q.dehydrated,q!==null)){if(C)r.flags&256?(hr(r),r.flags&=-257,r=Qm(n,r,i)):r.memoizedState!==null?(xr(),r.child=n.child,r.flags|=128,r=null):(xr(),q=f.fallback,v=r.mode,f=Wu({mode:"visible",children:f.children},v),q=ao(q,v,i,null),q.flags|=2,f.return=r,q.return=r,f.sibling=q,r.child=f,fo(r,n.child,null,i),f=r.child,f.memoizedState=Ym(i),f.childLanes=Km(n,M,i),r.memoizedState=Gm,r=Bi(null,f));else if(hr(r),Tg(q)){if(M=q.nextSibling&&q.nextSibling.dataset,M)var ie=M.dgst;M=ie,f=Error(o(419)),f.stack="",f.digest=M,Ni({value:f,source:null,stack:null}),r=Qm(n,r,i)}else if(wn||ul(n,r,i,!1),M=(i&n.childLanes)!==0,wn||M){if(M=Kt,M!==null&&(f=Na(M,i),f!==0&&f!==Q.retryLane))throw Q.retryLane=f,so(n,f),cs(M,n,f),Vm;Rg(q)||od(),r=Qm(n,r,i)}else Rg(q)?(r.flags|=192,r.child=n.child,r=null):(n=Q.treeContext,tn=Ps(q.nextSibling),In=r,Nt=!0,ur=null,zs=!1,n!==null&&ay(r,n),r=Xm(r,f.children),r.flags|=4096);return r}return v?(xr(),q=f.fallback,v=r.mode,Q=n.child,ie=Q.sibling,f=Aa(Q,{mode:"hidden",children:f.children}),f.subtreeFlags=Q.subtreeFlags&65011712,ie!==null?q=Aa(ie,q):(q=ao(q,v,i,null),q.flags|=2),q.return=r,f.return=r,f.sibling=q,r.child=f,Bi(null,f),f=r.child,q=n.child.memoizedState,q===null?q=Ym(i):(v=q.cachePool,v!==null?(Q=yn._currentValue,v=v.parent!==Q?{parent:Q,pool:Q}:v):v=uy(),q={baseLanes:q.baseLanes|i,cachePool:v}),f.memoizedState=q,f.childLanes=Km(n,M,i),r.memoizedState=Gm,Bi(n.child,f)):(hr(r),i=n.child,n=i.sibling,i=Aa(i,{mode:"visible",children:f.children}),i.return=r,i.sibling=null,n!==null&&(M=r.deletions,M===null?(r.deletions=[n],r.flags|=16):M.push(n)),r.child=i,r.memoizedState=null,i)}function Xm(n,r){return r=Wu({mode:"visible",children:r},n.mode),r.return=n,n.child=r}function Wu(n,r){return n=xs(22,n,null,r),n.lanes=0,n}function Qm(n,r,i){return fo(r,n.child,null,i),n=Xm(r,r.pendingProps.children),n.flags|=2,r.memoizedState=null,n}function w0(n,r,i){n.lanes|=r;var f=n.alternate;f!==null&&(f.lanes|=r),dm(n.return,r,i)}function Wm(n,r,i,f,v,C){var M=n.memoizedState;M===null?n.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:f,tail:i,tailMode:v,treeForkCount:C}:(M.isBackwards=r,M.rendering=null,M.renderingStartTime=0,M.last=f,M.tail=i,M.tailMode=v,M.treeForkCount=C)}function k0(n,r,i){var f=r.pendingProps,v=f.revealOrder,C=f.tail;f=f.children;var M=xn.current,q=(M&2)!==0;if(q?(M=M&1|2,r.flags|=128):M&=1,Z(xn,M),Un(n,r,f,i),f=Nt?Ci:0,!q&&n!==null&&(n.flags&128)!==0)e:for(n=r.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&w0(n,i,r);else if(n.tag===19)w0(n,i,r);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===r)break e;for(;n.sibling===null;){if(n.return===null||n.return===r)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(v){case"forwards":for(i=r.child,v=null;i!==null;)n=i.alternate,n!==null&&Bu(n)===null&&(v=i),i=i.sibling;i=v,i===null?(v=r.child,r.child=null):(v=i.sibling,i.sibling=null),Wm(r,!1,v,i,C,f);break;case"backwards":case"unstable_legacy-backwards":for(i=null,v=r.child,r.child=null;v!==null;){if(n=v.alternate,n!==null&&Bu(n)===null){r.child=v;break}n=v.sibling,v.sibling=i,i=v,v=n}Wm(r,!0,i,null,C,f);break;case"together":Wm(r,!1,null,null,void 0,f);break;default:r.memoizedState=null}return r.child}function La(n,r,i){if(n!==null&&(r.dependencies=n.dependencies),vr|=r.lanes,(i&r.childLanes)===0)if(n!==null){if(ul(n,r,i,!1),(i&r.childLanes)===0)return null}else return null;if(n!==null&&r.child!==n.child)throw Error(o(153));if(r.child!==null){for(n=r.child,i=Aa(n,n.pendingProps),r.child=i,i.return=r;n.sibling!==null;)n=n.sibling,i=i.sibling=Aa(n,n.pendingProps),i.return=r;i.sibling=null}return r.child}function Zm(n,r){return(n.lanes&r)!==0?!0:(n=n.dependencies,!!(n!==null&&Au(n)))}function wT(n,r,i){switch(r.tag){case 3:le(r,r.stateNode.containerInfo),fr(r,yn,n.memoizedState.cache),ro();break;case 27:case 5:Me(r);break;case 4:le(r,r.stateNode.containerInfo);break;case 10:fr(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,wm(r),null;break;case 13:var f=r.memoizedState;if(f!==null)return f.dehydrated!==null?(hr(r),r.flags|=128,null):(i&r.child.childLanes)!==0?j0(n,r,i):(hr(r),n=La(n,r,i),n!==null?n.sibling:null);hr(r);break;case 19:var v=(n.flags&128)!==0;if(f=(i&r.childLanes)!==0,f||(ul(n,r,i,!1),f=(i&r.childLanes)!==0),v){if(f)return k0(n,r,i);r.flags|=128}if(v=r.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),Z(xn,xn.current),f)break;return null;case 22:return r.lanes=0,h0(n,r,i,r.pendingProps);case 24:fr(r,yn,n.memoizedState.cache)}return La(n,r,i)}function S0(n,r,i){if(n!==null)if(n.memoizedProps!==r.pendingProps)wn=!0;else{if(!Zm(n,i)&&(r.flags&128)===0)return wn=!1,wT(n,r,i);wn=(n.flags&131072)!==0}else wn=!1,Nt&&(r.flags&1048576)!==0&&sy(r,Ci,r.index);switch(r.lanes=0,r.tag){case 16:e:{var f=r.pendingProps;if(n=co(r.elementType),r.type=n,typeof n=="function")sm(n)?(f=mo(n,f),r.tag=1,r=v0(null,r,n,f,i)):(r.tag=0,r=Fm(null,r,n,f,i));else{if(n!=null){var v=n.$$typeof;if(v===R){r.tag=11,r=p0(null,r,n,f,i);break e}else if(v===z){r.tag=14,r=m0(null,r,n,f,i);break e}}throw r=V(n)||n,Error(o(306,r,""))}}return r;case 0:return Fm(n,r,r.type,r.pendingProps,i);case 1:return f=r.type,v=mo(f,r.pendingProps),v0(n,r,f,v,i);case 3:e:{if(le(r,r.stateNode.containerInfo),n===null)throw Error(o(387));f=r.pendingProps;var C=r.memoizedState;v=C.element,bm(n,r),zi(r,f,null,i);var M=r.memoizedState;if(f=M.cache,fr(r,yn,f),f!==C.cache&&fm(r,[yn],i,!0),Oi(),f=M.element,C.isDehydrated)if(C={element:f,isDehydrated:!1,cache:M.cache},r.updateQueue.baseState=C,r.memoizedState=C,r.flags&256){r=y0(n,r,f,i);break e}else if(f!==v){v=As(Error(o(424)),r),Ni(v),r=y0(n,r,f,i);break e}else{switch(n=r.stateNode.containerInfo,n.nodeType){case 9:n=n.body;break;default:n=n.nodeName==="HTML"?n.ownerDocument.body:n}for(tn=Ps(n.firstChild),In=r,Nt=!0,ur=null,zs=!0,i=hy(r,null,f,i),r.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if(ro(),f===v){r=La(n,r,i);break e}Un(n,r,f,i)}r=r.child}return r;case 26:return Qu(n,r),n===null?(i=P1(r.type,null,r.pendingProps,null))?r.memoizedState=i:Nt||(i=r.type,n=r.pendingProps,f=pd(te.current).createElement(i),f[Yt]=r,f[Ln]=n,$n(f,i,n),Tn(f),r.stateNode=f):r.memoizedState=P1(r.type,n.memoizedProps,r.pendingProps,n.memoizedState),null;case 27:return Me(r),n===null&&Nt&&(f=r.stateNode=O1(r.type,r.pendingProps,te.current),In=r,zs=!0,v=tn,Sr(r.type)?(Ag=v,tn=Ps(f.firstChild)):tn=v),Un(n,r,r.pendingProps.children,i),Qu(n,r),n===null&&(r.flags|=4194304),r.child;case 5:return n===null&&Nt&&((v=f=tn)&&(f=JT(f,r.type,r.pendingProps,zs),f!==null?(r.stateNode=f,In=r,tn=Ps(f.firstChild),zs=!1,v=!0):v=!1),v||dr(r)),Me(r),v=r.type,C=r.pendingProps,M=n!==null?n.memoizedProps:null,f=C.children,Cg(v,C)?f=null:M!==null&&Cg(v,M)&&(r.flags|=32),r.memoizedState!==null&&(v=Sm(n,r,mT,null,null,i),ec._currentValue=v),Qu(n,r),Un(n,r,f,i),r.child;case 6:return n===null&&Nt&&((n=i=tn)&&(i=eA(i,r.pendingProps,zs),i!==null?(r.stateNode=i,In=r,tn=null,n=!0):n=!1),n||dr(r)),null;case 13:return j0(n,r,i);case 4:return le(r,r.stateNode.containerInfo),f=r.pendingProps,n===null?r.child=fo(r,null,f,i):Un(n,r,f,i),r.child;case 11:return p0(n,r,r.type,r.pendingProps,i);case 7:return Un(n,r,r.pendingProps,i),r.child;case 8:return Un(n,r,r.pendingProps.children,i),r.child;case 12:return Un(n,r,r.pendingProps.children,i),r.child;case 10:return f=r.pendingProps,fr(r,r.type,f.value),Un(n,r,f.children,i),r.child;case 9:return v=r.type._context,f=r.pendingProps.children,lo(r),v=Bn(v),f=f(v),r.flags|=1,Un(n,r,f,i),r.child;case 14:return m0(n,r,r.type,r.pendingProps,i);case 15:return g0(n,r,r.type,r.pendingProps,i);case 19:return k0(n,r,i);case 31:return jT(n,r,i);case 22:return h0(n,r,i,r.pendingProps);case 24:return lo(r),f=Bn(yn),n===null?(v=gm(),v===null&&(v=Kt,C=pm(),v.pooledCache=C,C.refCount++,C!==null&&(v.pooledCacheLanes|=i),v=C),r.memoizedState={parent:f,cache:v},xm(r),fr(r,yn,v)):((n.lanes&i)!==0&&(bm(n,r),zi(r,null,null,i),Oi()),v=n.memoizedState,C=r.memoizedState,v.parent!==f?(v={parent:f,cache:f},r.memoizedState=v,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=v),fr(r,yn,f)):(f=C.cache,fr(r,yn,f),f!==v.cache&&fm(r,[yn],i,!0))),Un(n,r,r.pendingProps.children,i),r.child;case 29:throw r.pendingProps}throw Error(o(156,r.tag))}function Ia(n){n.flags|=4}function Jm(n,r,i,f,v){if((r=(n.mode&32)!==0)&&(r=!1),r){if(n.flags|=16777216,(v&335544128)===v)if(n.stateNode.complete)n.flags|=8192;else if(Z0())n.flags|=8192;else throw uo=Du,hm}else n.flags&=-16777217}function C0(n,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!$1(r))if(Z0())n.flags|=8192;else throw uo=Du,hm}function Zu(n,r){r!==null&&(n.flags|=4),n.flags&16384&&(r=n.tag!==22?gs():536870912,n.lanes|=r,jl|=r)}function Ui(n,r){if(!Nt)switch(n.tailMode){case"hidden":r=n.tail;for(var i=null;r!==null;)r.alternate!==null&&(i=r),r=r.sibling;i===null?n.tail=null:i.sibling=null;break;case"collapsed":i=n.tail;for(var f=null;i!==null;)i.alternate!==null&&(f=i),i=i.sibling;f===null?r||n.tail===null?n.tail=null:n.tail.sibling=null:f.sibling=null}}function nn(n){var r=n.alternate!==null&&n.alternate.child===n.child,i=0,f=0;if(r)for(var v=n.child;v!==null;)i|=v.lanes|v.childLanes,f|=v.subtreeFlags&65011712,f|=v.flags&65011712,v.return=n,v=v.sibling;else for(v=n.child;v!==null;)i|=v.lanes|v.childLanes,f|=v.subtreeFlags,f|=v.flags,v.return=n,v=v.sibling;return n.subtreeFlags|=f,n.childLanes=i,r}function kT(n,r,i){var f=r.pendingProps;switch(lm(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nn(r),null;case 1:return nn(r),null;case 3:return i=r.stateNode,f=null,n!==null&&(f=n.memoizedState.cache),r.memoizedState.cache!==f&&(r.flags|=2048),za(yn),me(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(n===null||n.child===null)&&(cl(r)?Ia(r):n===null||n.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,cm())),nn(r),null;case 26:var v=r.type,C=r.memoizedState;return n===null?(Ia(r),C!==null?(nn(r),C0(r,C)):(nn(r),Jm(r,v,null,f,i))):C?C!==n.memoizedState?(Ia(r),nn(r),C0(r,C)):(nn(r),r.flags&=-16777217):(n=n.memoizedProps,n!==f&&Ia(r),nn(r),Jm(r,v,n,f,i)),null;case 27:if(de(r),i=te.current,v=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==f&&Ia(r);else{if(!f){if(r.stateNode===null)throw Error(o(166));return nn(r),null}n=W.current,cl(r)?ry(r):(n=O1(v,f,i),r.stateNode=n,Ia(r))}return nn(r),null;case 5:if(de(r),v=r.type,n!==null&&r.stateNode!=null)n.memoizedProps!==f&&Ia(r);else{if(!f){if(r.stateNode===null)throw Error(o(166));return nn(r),null}if(C=W.current,cl(r))ry(r);else{var M=pd(te.current);switch(C){case 1:C=M.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:C=M.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":C=M.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":C=M.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":C=M.createElement("div"),C.innerHTML="<script><\/script>",C=C.removeChild(C.firstChild);break;case"select":C=typeof f.is=="string"?M.createElement("select",{is:f.is}):M.createElement("select"),f.multiple?C.multiple=!0:f.size&&(C.size=f.size);break;default:C=typeof f.is=="string"?M.createElement(v,{is:f.is}):M.createElement(v)}}C[Yt]=r,C[Ln]=f;e:for(M=r.child;M!==null;){if(M.tag===5||M.tag===6)C.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===r)break e;for(;M.sibling===null;){if(M.return===null||M.return===r)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}r.stateNode=C;e:switch($n(C,v,f),v){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}f&&Ia(r)}}return nn(r),Jm(r,r.type,n===null?null:n.memoizedProps,r.pendingProps,i),null;case 6:if(n&&r.stateNode!=null)n.memoizedProps!==f&&Ia(r);else{if(typeof f!="string"&&r.stateNode===null)throw Error(o(166));if(n=te.current,cl(r)){if(n=r.stateNode,i=r.memoizedProps,f=null,v=In,v!==null)switch(v.tag){case 27:case 5:f=v.memoizedProps}n[Yt]=r,n=!!(n.nodeValue===i||f!==null&&f.suppressHydrationWarning===!0||j1(n.nodeValue,i)),n||dr(r,!0)}else n=pd(n).createTextNode(f),n[Yt]=r,r.stateNode=n}return nn(r),null;case 31:if(i=r.memoizedState,n===null||n.memoizedState!==null){if(f=cl(r),i!==null){if(n===null){if(!f)throw Error(o(318));if(n=r.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(o(557));n[Yt]=r}else ro(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;nn(r),n=!1}else i=cm(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=i),n=!0;if(!n)return r.flags&256?(_s(r),r):(_s(r),null);if((r.flags&128)!==0)throw Error(o(558))}return nn(r),null;case 13:if(f=r.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(v=cl(r),f!==null&&f.dehydrated!==null){if(n===null){if(!v)throw Error(o(318));if(v=r.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(o(317));v[Yt]=r}else ro(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;nn(r),v=!1}else v=cm(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=v),v=!0;if(!v)return r.flags&256?(_s(r),r):(_s(r),null)}return _s(r),(r.flags&128)!==0?(r.lanes=i,r):(i=f!==null,n=n!==null&&n.memoizedState!==null,i&&(f=r.child,v=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(v=f.alternate.memoizedState.cachePool.pool),C=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(C=f.memoizedState.cachePool.pool),C!==v&&(f.flags|=2048)),i!==n&&i&&(r.child.flags|=8192),Zu(r,r.updateQueue),nn(r),null);case 4:return me(),n===null&&yg(r.stateNode.containerInfo),nn(r),null;case 10:return za(r.type),nn(r),null;case 19:if(X(xn),f=r.memoizedState,f===null)return nn(r),null;if(v=(r.flags&128)!==0,C=f.rendering,C===null)if(v)Ui(f,!1);else{if(fn!==0||n!==null&&(n.flags&128)!==0)for(n=r.child;n!==null;){if(C=Bu(n),C!==null){for(r.flags|=128,Ui(f,!1),n=C.updateQueue,r.updateQueue=n,Zu(r,n),r.subtreeFlags=0,n=i,i=r.child;i!==null;)ey(i,n),i=i.sibling;return Z(xn,xn.current&1|2),Nt&&Ma(r,f.treeForkCount),r.child}n=n.sibling}f.tail!==null&&ue()>sd&&(r.flags|=128,v=!0,Ui(f,!1),r.lanes=4194304)}else{if(!v)if(n=Bu(C),n!==null){if(r.flags|=128,v=!0,n=n.updateQueue,r.updateQueue=n,Zu(r,n),Ui(f,!0),f.tail===null&&f.tailMode==="hidden"&&!C.alternate&&!Nt)return nn(r),null}else 2*ue()-f.renderingStartTime>sd&&i!==536870912&&(r.flags|=128,v=!0,Ui(f,!1),r.lanes=4194304);f.isBackwards?(C.sibling=r.child,r.child=C):(n=f.last,n!==null?n.sibling=C:r.child=C,f.last=C)}return f.tail!==null?(n=f.tail,f.rendering=n,f.tail=n.sibling,f.renderingStartTime=ue(),n.sibling=null,i=xn.current,Z(xn,v?i&1|2:i&1),Nt&&Ma(r,f.treeForkCount),n):(nn(r),null);case 22:case 23:return _s(r),jm(),f=r.memoizedState!==null,n!==null?n.memoizedState!==null!==f&&(r.flags|=8192):f&&(r.flags|=8192),f?(i&536870912)!==0&&(r.flags&128)===0&&(nn(r),r.subtreeFlags&6&&(r.flags|=8192)):nn(r),i=r.updateQueue,i!==null&&Zu(r,i.retryQueue),i=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==i&&(r.flags|=2048),n!==null&&X(io),null;case 24:return i=null,n!==null&&(i=n.memoizedState.cache),r.memoizedState.cache!==i&&(r.flags|=2048),za(yn),nn(r),null;case 25:return null;case 30:return null}throw Error(o(156,r.tag))}function ST(n,r){switch(lm(r),r.tag){case 1:return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 3:return za(yn),me(),n=r.flags,(n&65536)!==0&&(n&128)===0?(r.flags=n&-65537|128,r):null;case 26:case 27:case 5:return de(r),null;case 31:if(r.memoizedState!==null){if(_s(r),r.alternate===null)throw Error(o(340));ro()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 13:if(_s(r),n=r.memoizedState,n!==null&&n.dehydrated!==null){if(r.alternate===null)throw Error(o(340));ro()}return n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 19:return X(xn),null;case 4:return me(),null;case 10:return za(r.type),null;case 22:case 23:return _s(r),jm(),n!==null&&X(io),n=r.flags,n&65536?(r.flags=n&-65537|128,r):null;case 24:return za(yn),null;case 25:return null;default:return null}}function N0(n,r){switch(lm(r),r.tag){case 3:za(yn),me();break;case 26:case 27:case 5:de(r);break;case 4:me();break;case 31:r.memoizedState!==null&&_s(r);break;case 13:_s(r);break;case 19:X(xn);break;case 10:za(r.type);break;case 22:case 23:_s(r),jm(),n!==null&&X(io);break;case 24:za(yn)}}function $i(n,r){try{var i=r.updateQueue,f=i!==null?i.lastEffect:null;if(f!==null){var v=f.next;i=v;do{if((i.tag&n)===n){f=void 0;var C=i.create,M=i.inst;f=C(),M.destroy=f}i=i.next}while(i!==v)}}catch(q){Lt(r,r.return,q)}}function br(n,r,i){try{var f=r.updateQueue,v=f!==null?f.lastEffect:null;if(v!==null){var C=v.next;f=C;do{if((f.tag&n)===n){var M=f.inst,q=M.destroy;if(q!==void 0){M.destroy=void 0,v=r;var Q=i,ie=q;try{ie()}catch(be){Lt(v,Q,be)}}}f=f.next}while(f!==C)}}catch(be){Lt(r,r.return,be)}}function E0(n){var r=n.updateQueue;if(r!==null){var i=n.stateNode;try{by(r,i)}catch(f){Lt(n,n.return,f)}}}function R0(n,r,i){i.props=mo(n.type,n.memoizedProps),i.state=n.memoizedState;try{i.componentWillUnmount()}catch(f){Lt(n,r,f)}}function Hi(n,r){try{var i=n.ref;if(i!==null){switch(n.tag){case 26:case 27:case 5:var f=n.stateNode;break;case 30:f=n.stateNode;break;default:f=n.stateNode}typeof i=="function"?n.refCleanup=i(f):i.current=f}}catch(v){Lt(n,r,v)}}function oa(n,r){var i=n.ref,f=n.refCleanup;if(i!==null)if(typeof f=="function")try{f()}catch(v){Lt(n,r,v)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(v){Lt(n,r,v)}else i.current=null}function T0(n){var r=n.type,i=n.memoizedProps,f=n.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":i.autoFocus&&f.focus();break e;case"img":i.src?f.src=i.src:i.srcSet&&(f.srcset=i.srcSet)}}catch(v){Lt(n,n.return,v)}}function eg(n,r,i){try{var f=n.stateNode;YT(f,n.type,i,r),f[Ln]=r}catch(v){Lt(n,n.return,v)}}function A0(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Sr(n.type)||n.tag===4}function tg(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||A0(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&&Sr(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 ng(n,r,i){var f=n.tag;if(f===5||f===6)n=n.stateNode,r?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(n,r):(r=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,r.appendChild(n),i=i._reactRootContainer,i!=null||r.onclick!==null||(r.onclick=Ra));else if(f!==4&&(f===27&&Sr(n.type)&&(i=n.stateNode,r=null),n=n.child,n!==null))for(ng(n,r,i),n=n.sibling;n!==null;)ng(n,r,i),n=n.sibling}function Ju(n,r,i){var f=n.tag;if(f===5||f===6)n=n.stateNode,r?i.insertBefore(n,r):i.appendChild(n);else if(f!==4&&(f===27&&Sr(n.type)&&(i=n.stateNode),n=n.child,n!==null))for(Ju(n,r,i),n=n.sibling;n!==null;)Ju(n,r,i),n=n.sibling}function M0(n){var r=n.stateNode,i=n.memoizedProps;try{for(var f=n.type,v=r.attributes;v.length;)r.removeAttributeNode(v[0]);$n(r,f,i),r[Yt]=n,r[Ln]=i}catch(C){Lt(n,n.return,C)}}var Ba=!1,kn=!1,sg=!1,O0=typeof WeakSet=="function"?WeakSet:Set,An=null;function CT(n,r){if(n=n.containerInfo,kg=vd,n=Fv(n),Qp(n)){if("selectionStart"in n)var i={start:n.selectionStart,end:n.selectionEnd};else e:{i=(i=n.ownerDocument)&&i.defaultView||window;var f=i.getSelection&&i.getSelection();if(f&&f.rangeCount!==0){i=f.anchorNode;var v=f.anchorOffset,C=f.focusNode;f=f.focusOffset;try{i.nodeType,C.nodeType}catch{i=null;break e}var M=0,q=-1,Q=-1,ie=0,be=0,we=n,ce=null;t:for(;;){for(var pe;we!==i||v!==0&&we.nodeType!==3||(q=M+v),we!==C||f!==0&&we.nodeType!==3||(Q=M+f),we.nodeType===3&&(M+=we.nodeValue.length),(pe=we.firstChild)!==null;)ce=we,we=pe;for(;;){if(we===n)break t;if(ce===i&&++ie===v&&(q=M),ce===C&&++be===f&&(Q=M),(pe=we.nextSibling)!==null)break;we=ce,ce=we.parentNode}we=pe}i=q===-1||Q===-1?null:{start:q,end:Q}}else i=null}i=i||{start:0,end:0}}else i=null;for(Sg={focusedElem:n,selectionRange:i},vd=!1,An=r;An!==null;)if(r=An,n=r.child,(r.subtreeFlags&1028)!==0&&n!==null)n.return=r,An=n;else for(;An!==null;){switch(r=An,C=r.alternate,n=r.flags,r.tag){case 0:if((n&4)!==0&&(n=r.updateQueue,n=n!==null?n.events:null,n!==null))for(i=0;i<n.length;i++)v=n[i],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&C!==null){n=void 0,i=r,v=C.memoizedProps,C=C.memoizedState,f=i.stateNode;try{var Fe=mo(i.type,v);n=f.getSnapshotBeforeUpdate(Fe,C),f.__reactInternalSnapshotBeforeUpdate=n}catch(at){Lt(i,i.return,at)}}break;case 3:if((n&1024)!==0){if(n=r.stateNode.containerInfo,i=n.nodeType,i===9)Eg(n);else if(i===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":Eg(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=r.sibling,n!==null){n.return=r.return,An=n;break}An=r.return}}function z0(n,r,i){var f=i.flags;switch(i.tag){case 0:case 11:case 15:$a(n,i),f&4&&$i(5,i);break;case 1:if($a(n,i),f&4)if(n=i.stateNode,r===null)try{n.componentDidMount()}catch(M){Lt(i,i.return,M)}else{var v=mo(i.type,r.memoizedProps);r=r.memoizedState;try{n.componentDidUpdate(v,r,n.__reactInternalSnapshotBeforeUpdate)}catch(M){Lt(i,i.return,M)}}f&64&&E0(i),f&512&&Hi(i,i.return);break;case 3:if($a(n,i),f&64&&(n=i.updateQueue,n!==null)){if(r=null,i.child!==null)switch(i.child.tag){case 27:case 5:r=i.child.stateNode;break;case 1:r=i.child.stateNode}try{by(n,r)}catch(M){Lt(i,i.return,M)}}break;case 27:r===null&&f&4&&M0(i);case 26:case 5:$a(n,i),r===null&&f&4&&T0(i),f&512&&Hi(i,i.return);break;case 12:$a(n,i);break;case 31:$a(n,i),f&4&&L0(n,i);break;case 13:$a(n,i),f&4&&I0(n,i),f&64&&(n=i.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(i=DT.bind(null,i),tA(n,i))));break;case 22:if(f=i.memoizedState!==null||Ba,!f){r=r!==null&&r.memoizedState!==null||kn,v=Ba;var C=kn;Ba=f,(kn=r)&&!C?Ha(n,i,(i.subtreeFlags&8772)!==0):$a(n,i),Ba=v,kn=C}break;case 30:break;default:$a(n,i)}}function D0(n){var r=n.alternate;r!==null&&(n.alternate=null,D0(r)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(r=n.stateNode,r!==null&&Op(r)),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 an=null,rs=!1;function Ua(n,r,i){for(i=i.child;i!==null;)P0(n,r,i),i=i.sibling}function P0(n,r,i){if(Rt&&typeof Rt.onCommitFiberUnmount=="function")try{Rt.onCommitFiberUnmount(lt,i)}catch{}switch(i.tag){case 26:kn||oa(i,r),Ua(n,r,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:kn||oa(i,r);var f=an,v=rs;Sr(i.type)&&(an=i.stateNode,rs=!1),Ua(n,r,i),Wi(i.stateNode),an=f,rs=v;break;case 5:kn||oa(i,r);case 6:if(f=an,v=rs,an=null,Ua(n,r,i),an=f,rs=v,an!==null)if(rs)try{(an.nodeType===9?an.body:an.nodeName==="HTML"?an.ownerDocument.body:an).removeChild(i.stateNode)}catch(C){Lt(i,r,C)}else try{an.removeChild(i.stateNode)}catch(C){Lt(i,r,C)}break;case 18:an!==null&&(rs?(n=an,E1(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,i.stateNode),Tl(n)):E1(an,i.stateNode));break;case 4:f=an,v=rs,an=i.stateNode.containerInfo,rs=!0,Ua(n,r,i),an=f,rs=v;break;case 0:case 11:case 14:case 15:br(2,i,r),kn||br(4,i,r),Ua(n,r,i);break;case 1:kn||(oa(i,r),f=i.stateNode,typeof f.componentWillUnmount=="function"&&R0(i,r,f)),Ua(n,r,i);break;case 21:Ua(n,r,i);break;case 22:kn=(f=kn)||i.memoizedState!==null,Ua(n,r,i),kn=f;break;default:Ua(n,r,i)}}function L0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Tl(n)}catch(i){Lt(r,r.return,i)}}}function I0(n,r){if(r.memoizedState===null&&(n=r.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Tl(n)}catch(i){Lt(r,r.return,i)}}function NT(n){switch(n.tag){case 31:case 13:case 19:var r=n.stateNode;return r===null&&(r=n.stateNode=new O0),r;case 22:return n=n.stateNode,r=n._retryCache,r===null&&(r=n._retryCache=new O0),r;default:throw Error(o(435,n.tag))}}function ed(n,r){var i=NT(n);r.forEach(function(f){if(!i.has(f)){i.add(f);var v=PT.bind(null,n,f);f.then(v,v)}})}function os(n,r){var i=r.deletions;if(i!==null)for(var f=0;f<i.length;f++){var v=i[f],C=n,M=r,q=M;e:for(;q!==null;){switch(q.tag){case 27:if(Sr(q.type)){an=q.stateNode,rs=!1;break e}break;case 5:an=q.stateNode,rs=!1;break e;case 3:case 4:an=q.stateNode.containerInfo,rs=!0;break e}q=q.return}if(an===null)throw Error(o(160));P0(C,M,v),an=null,rs=!1,C=v.alternate,C!==null&&(C.return=null),v.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)B0(r,n),r=r.sibling}var Ys=null;function B0(n,r){var i=n.alternate,f=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:os(r,n),ls(n),f&4&&(br(3,n,n.return),$i(3,n),br(5,n,n.return));break;case 1:os(r,n),ls(n),f&512&&(kn||i===null||oa(i,i.return)),f&64&&Ba&&(n=n.updateQueue,n!==null&&(f=n.callbacks,f!==null&&(i=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=i===null?f:i.concat(f))));break;case 26:var v=Ys;if(os(r,n),ls(n),f&512&&(kn||i===null||oa(i,i.return)),f&4){var C=i!==null?i.memoizedState:null;if(f=n.memoizedState,i===null)if(f===null)if(n.stateNode===null){e:{f=n.type,i=n.memoizedProps,v=v.ownerDocument||v;t:switch(f){case"title":C=v.getElementsByTagName("title")[0],(!C||C[gi]||C[Yt]||C.namespaceURI==="http://www.w3.org/2000/svg"||C.hasAttribute("itemprop"))&&(C=v.createElement(f),v.head.insertBefore(C,v.querySelector("head > title"))),$n(C,f,i),C[Yt]=n,Tn(C),f=C;break e;case"link":var M=B1("link","href",v).get(f+(i.href||""));if(M){for(var q=0;q<M.length;q++)if(C=M[q],C.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&C.getAttribute("rel")===(i.rel==null?null:i.rel)&&C.getAttribute("title")===(i.title==null?null:i.title)&&C.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){M.splice(q,1);break t}}C=v.createElement(f),$n(C,f,i),v.head.appendChild(C);break;case"meta":if(M=B1("meta","content",v).get(f+(i.content||""))){for(q=0;q<M.length;q++)if(C=M[q],C.getAttribute("content")===(i.content==null?null:""+i.content)&&C.getAttribute("name")===(i.name==null?null:i.name)&&C.getAttribute("property")===(i.property==null?null:i.property)&&C.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&C.getAttribute("charset")===(i.charSet==null?null:i.charSet)){M.splice(q,1);break t}}C=v.createElement(f),$n(C,f,i),v.head.appendChild(C);break;default:throw Error(o(468,f))}C[Yt]=n,Tn(C),f=C}n.stateNode=f}else U1(v,n.type,n.stateNode);else n.stateNode=I1(v,f,n.memoizedProps);else C!==f?(C===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):C.count--,f===null?U1(v,n.type,n.stateNode):I1(v,f,n.memoizedProps)):f===null&&n.stateNode!==null&&eg(n,n.memoizedProps,i.memoizedProps)}break;case 27:os(r,n),ls(n),f&512&&(kn||i===null||oa(i,i.return)),i!==null&&f&4&&eg(n,n.memoizedProps,i.memoizedProps);break;case 5:if(os(r,n),ls(n),f&512&&(kn||i===null||oa(i,i.return)),n.flags&32){v=n.stateNode;try{Jo(v,"")}catch(Fe){Lt(n,n.return,Fe)}}f&4&&n.stateNode!=null&&(v=n.memoizedProps,eg(n,v,i!==null?i.memoizedProps:v)),f&1024&&(sg=!0);break;case 6:if(os(r,n),ls(n),f&4){if(n.stateNode===null)throw Error(o(162));f=n.memoizedProps,i=n.stateNode;try{i.nodeValue=f}catch(Fe){Lt(n,n.return,Fe)}}break;case 3:if(hd=null,v=Ys,Ys=md(r.containerInfo),os(r,n),Ys=v,ls(n),f&4&&i!==null&&i.memoizedState.isDehydrated)try{Tl(r.containerInfo)}catch(Fe){Lt(n,n.return,Fe)}sg&&(sg=!1,U0(n));break;case 4:f=Ys,Ys=md(n.stateNode.containerInfo),os(r,n),ls(n),Ys=f;break;case 12:os(r,n),ls(n);break;case 31:os(r,n),ls(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,ed(n,f)));break;case 13:os(r,n),ls(n),n.child.flags&8192&&n.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(nd=ue()),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,ed(n,f)));break;case 22:v=n.memoizedState!==null;var Q=i!==null&&i.memoizedState!==null,ie=Ba,be=kn;if(Ba=ie||v,kn=be||Q,os(r,n),kn=be,Ba=ie,ls(n),f&8192)e:for(r=n.stateNode,r._visibility=v?r._visibility&-2:r._visibility|1,v&&(i===null||Q||Ba||kn||go(n)),i=null,r=n;;){if(r.tag===5||r.tag===26){if(i===null){Q=i=r;try{if(C=Q.stateNode,v)M=C.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{q=Q.stateNode;var we=Q.memoizedProps.style,ce=we!=null&&we.hasOwnProperty("display")?we.display:null;q.style.display=ce==null||typeof ce=="boolean"?"":(""+ce).trim()}}catch(Fe){Lt(Q,Q.return,Fe)}}}else if(r.tag===6){if(i===null){Q=r;try{Q.stateNode.nodeValue=v?"":Q.memoizedProps}catch(Fe){Lt(Q,Q.return,Fe)}}}else if(r.tag===18){if(i===null){Q=r;try{var pe=Q.stateNode;v?R1(pe,!0):R1(Q.stateNode,!1)}catch(Fe){Lt(Q,Q.return,Fe)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===n)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===n)break e;for(;r.sibling===null;){if(r.return===null||r.return===n)break e;i===r&&(i=null),r=r.return}i===r&&(i=null),r.sibling.return=r.return,r=r.sibling}f&4&&(f=n.updateQueue,f!==null&&(i=f.retryQueue,i!==null&&(f.retryQueue=null,ed(n,i))));break;case 19:os(r,n),ls(n),f&4&&(f=n.updateQueue,f!==null&&(n.updateQueue=null,ed(n,f)));break;case 30:break;case 21:break;default:os(r,n),ls(n)}}function ls(n){var r=n.flags;if(r&2){try{for(var i,f=n.return;f!==null;){if(A0(f)){i=f;break}f=f.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var v=i.stateNode,C=tg(n);Ju(n,C,v);break;case 5:var M=i.stateNode;i.flags&32&&(Jo(M,""),i.flags&=-33);var q=tg(n);Ju(n,q,M);break;case 3:case 4:var Q=i.stateNode.containerInfo,ie=tg(n);ng(n,ie,Q);break;default:throw Error(o(161))}}catch(be){Lt(n,n.return,be)}n.flags&=-3}r&4096&&(n.flags&=-4097)}function U0(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var r=n;U0(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),n=n.sibling}}function $a(n,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)z0(n,r.alternate,r),r=r.sibling}function go(n){for(n=n.child;n!==null;){var r=n;switch(r.tag){case 0:case 11:case 14:case 15:br(4,r,r.return),go(r);break;case 1:oa(r,r.return);var i=r.stateNode;typeof i.componentWillUnmount=="function"&&R0(r,r.return,i),go(r);break;case 27:Wi(r.stateNode);case 26:case 5:oa(r,r.return),go(r);break;case 22:r.memoizedState===null&&go(r);break;case 30:go(r);break;default:go(r)}n=n.sibling}}function Ha(n,r,i){for(i=i&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var f=r.alternate,v=n,C=r,M=C.flags;switch(C.tag){case 0:case 11:case 15:Ha(v,C,i),$i(4,C);break;case 1:if(Ha(v,C,i),f=C,v=f.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(ie){Lt(f,f.return,ie)}if(f=C,v=f.updateQueue,v!==null){var q=f.stateNode;try{var Q=v.shared.hiddenCallbacks;if(Q!==null)for(v.shared.hiddenCallbacks=null,v=0;v<Q.length;v++)xy(Q[v],q)}catch(ie){Lt(f,f.return,ie)}}i&&M&64&&E0(C),Hi(C,C.return);break;case 27:M0(C);case 26:case 5:Ha(v,C,i),i&&f===null&&M&4&&T0(C),Hi(C,C.return);break;case 12:Ha(v,C,i);break;case 31:Ha(v,C,i),i&&M&4&&L0(v,C);break;case 13:Ha(v,C,i),i&&M&4&&I0(v,C);break;case 22:C.memoizedState===null&&Ha(v,C,i),Hi(C,C.return);break;case 30:break;default:Ha(v,C,i)}r=r.sibling}}function ag(n,r){var i=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(i=n.memoizedState.cachePool.pool),n=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(n=r.memoizedState.cachePool.pool),n!==i&&(n!=null&&n.refCount++,i!=null&&Ei(i))}function rg(n,r){n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Ei(n))}function Ks(n,r,i,f){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)$0(n,r,i,f),r=r.sibling}function $0(n,r,i,f){var v=r.flags;switch(r.tag){case 0:case 11:case 15:Ks(n,r,i,f),v&2048&&$i(9,r);break;case 1:Ks(n,r,i,f);break;case 3:Ks(n,r,i,f),v&2048&&(n=null,r.alternate!==null&&(n=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==n&&(r.refCount++,n!=null&&Ei(n)));break;case 12:if(v&2048){Ks(n,r,i,f),n=r.stateNode;try{var C=r.memoizedProps,M=C.id,q=C.onPostCommit;typeof q=="function"&&q(M,r.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Q){Lt(r,r.return,Q)}}else Ks(n,r,i,f);break;case 31:Ks(n,r,i,f);break;case 13:Ks(n,r,i,f);break;case 23:break;case 22:C=r.stateNode,M=r.alternate,r.memoizedState!==null?C._visibility&2?Ks(n,r,i,f):qi(n,r):C._visibility&2?Ks(n,r,i,f):(C._visibility|=2,_l(n,r,i,f,(r.subtreeFlags&10256)!==0||!1)),v&2048&&ag(M,r);break;case 24:Ks(n,r,i,f),v&2048&&rg(r.alternate,r);break;default:Ks(n,r,i,f)}}function _l(n,r,i,f,v){for(v=v&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var C=n,M=r,q=i,Q=f,ie=M.flags;switch(M.tag){case 0:case 11:case 15:_l(C,M,q,Q,v),$i(8,M);break;case 23:break;case 22:var be=M.stateNode;M.memoizedState!==null?be._visibility&2?_l(C,M,q,Q,v):qi(C,M):(be._visibility|=2,_l(C,M,q,Q,v)),v&&ie&2048&&ag(M.alternate,M);break;case 24:_l(C,M,q,Q,v),v&&ie&2048&&rg(M.alternate,M);break;default:_l(C,M,q,Q,v)}r=r.sibling}}function qi(n,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var i=n,f=r,v=f.flags;switch(f.tag){case 22:qi(i,f),v&2048&&ag(f.alternate,f);break;case 24:qi(i,f),v&2048&&rg(f.alternate,f);break;default:qi(i,f)}r=r.sibling}}var Vi=8192;function vl(n,r,i){if(n.subtreeFlags&Vi)for(n=n.child;n!==null;)H0(n,r,i),n=n.sibling}function H0(n,r,i){switch(n.tag){case 26:vl(n,r,i),n.flags&Vi&&n.memoizedState!==null&&pA(i,Ys,n.memoizedState,n.memoizedProps);break;case 5:vl(n,r,i);break;case 3:case 4:var f=Ys;Ys=md(n.stateNode.containerInfo),vl(n,r,i),Ys=f;break;case 22:n.memoizedState===null&&(f=n.alternate,f!==null&&f.memoizedState!==null?(f=Vi,Vi=16777216,vl(n,r,i),Vi=f):vl(n,r,i));break;default:vl(n,r,i)}}function q0(n){var r=n.alternate;if(r!==null&&(n=r.child,n!==null)){r.child=null;do r=n.sibling,n.sibling=null,n=r;while(n!==null)}}function Fi(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var i=0;i<r.length;i++){var f=r[i];An=f,F0(f,n)}q0(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)V0(n),n=n.sibling}function V0(n){switch(n.tag){case 0:case 11:case 15:Fi(n),n.flags&2048&&br(9,n,n.return);break;case 3:Fi(n);break;case 12:Fi(n);break;case 22:var r=n.stateNode;n.memoizedState!==null&&r._visibility&2&&(n.return===null||n.return.tag!==13)?(r._visibility&=-3,td(n)):Fi(n);break;default:Fi(n)}}function td(n){var r=n.deletions;if((n.flags&16)!==0){if(r!==null)for(var i=0;i<r.length;i++){var f=r[i];An=f,F0(f,n)}q0(n)}for(n=n.child;n!==null;){switch(r=n,r.tag){case 0:case 11:case 15:br(8,r,r.return),td(r);break;case 22:i=r.stateNode,i._visibility&2&&(i._visibility&=-3,td(r));break;default:td(r)}n=n.sibling}}function F0(n,r){for(;An!==null;){var i=An;switch(i.tag){case 0:case 11:case 15:br(8,i,r);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var f=i.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Ei(i.memoizedState.cache)}if(f=i.child,f!==null)f.return=i,An=f;else e:for(i=n;An!==null;){f=An;var v=f.sibling,C=f.return;if(D0(f),f===i){An=null;break e}if(v!==null){v.return=C,An=v;break e}An=C}}}var ET={getCacheForType:function(n){var r=Bn(yn),i=r.data.get(n);return i===void 0&&(i=n(),r.data.set(n,i)),i},cacheSignal:function(){return Bn(yn).controller.signal}},RT=typeof WeakMap=="function"?WeakMap:Map,zt=0,Kt=null,yt=null,wt=0,Pt=0,vs=null,_r=!1,yl=!1,og=!1,qa=0,fn=0,vr=0,ho=0,lg=0,ys=0,jl=0,Gi=null,is=null,ig=!1,nd=0,G0=0,sd=1/0,ad=null,yr=null,Cn=0,jr=null,wl=null,Va=0,cg=0,ug=null,Y0=null,Yi=0,dg=null;function js(){return(zt&2)!==0&&wt!==0?wt&-wt:$.T!==null?xg():hn()}function K0(){if(ys===0)if((wt&536870912)===0||Nt){var n=Ot;Ot<<=1,(Ot&3932160)===0&&(Ot=262144),ys=n}else ys=536870912;return n=bs.current,n!==null&&(n.flags|=32),ys}function cs(n,r,i){(n===Kt&&(Pt===2||Pt===9)||n.cancelPendingCommit!==null)&&(kl(n,0),wr(n,wt,ys,!1)),gn(n,i),((zt&2)===0||n!==Kt)&&(n===Kt&&((zt&2)===0&&(ho|=i),fn===4&&wr(n,wt,ys,!1)),la(n))}function X0(n,r,i){if((zt&6)!==0)throw Error(o(327));var f=!i&&(r&127)===0&&(r&n.expiredLanes)===0||mn(n,r),v=f?MT(n,r):pg(n,r,!0),C=f;do{if(v===0){yl&&!f&&wr(n,r,0,!1);break}else{if(i=n.current.alternate,C&&!TT(i)){v=pg(n,r,!1),C=!1;continue}if(v===2){if(C=r,n.errorRecoveryDisabledLanes&C)var M=0;else M=n.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){r=M;e:{var q=n;v=Gi;var Q=q.current.memoizedState.isDehydrated;if(Q&&(kl(q,M).flags|=256),M=pg(q,M,!1),M!==2){if(og&&!Q){q.errorRecoveryDisabledLanes|=C,ho|=C,v=4;break e}C=is,is=v,C!==null&&(is===null?is=C:is.push.apply(is,C))}v=M}if(C=!1,v!==2)continue}}if(v===1){kl(n,0),wr(n,r,0,!0);break}e:{switch(f=n,C=v,C){case 0:case 1:throw Error(o(345));case 4:if((r&4194048)!==r)break;case 6:wr(f,r,ys,!_r);break e;case 2:is=null;break;case 3:case 5:break;default:throw Error(o(329))}if((r&62914560)===r&&(v=nd+300-ue(),10<v)){if(wr(f,r,ys,!_r),en(f,0,!0)!==0)break e;Va=r,f.timeoutHandle=C1(Q0.bind(null,f,i,is,ad,ig,r,ys,ho,jl,_r,C,"Throttled",-0,0),v);break e}Q0(f,i,is,ad,ig,r,ys,ho,jl,_r,C,null,-0,0)}}break}while(!0);la(n)}function Q0(n,r,i,f,v,C,M,q,Q,ie,be,we,ce,pe){if(n.timeoutHandle=-1,we=r.subtreeFlags,we&8192||(we&16785408)===16785408){we={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ra},H0(r,C,we);var Fe=(C&62914560)===C?nd-ue():(C&4194048)===C?G0-ue():0;if(Fe=mA(we,Fe),Fe!==null){Va=C,n.cancelPendingCommit=Fe(a1.bind(null,n,r,C,i,f,v,M,q,Q,be,we,null,ce,pe)),wr(n,C,M,!ie);return}}a1(n,r,C,i,f,v,M,q,Q)}function TT(n){for(var r=n;;){var i=r.tag;if((i===0||i===11||i===15)&&r.flags&16384&&(i=r.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var f=0;f<i.length;f++){var v=i[f],C=v.getSnapshot;v=v.value;try{if(!hs(C(),v))return!1}catch{return!1}}if(i=r.child,r.subtreeFlags&16384&&i!==null)i.return=r,r=i;else{if(r===n)break;for(;r.sibling===null;){if(r.return===null||r.return===n)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function wr(n,r,i,f){r&=~lg,r&=~ho,n.suspendedLanes|=r,n.pingedLanes&=~r,f&&(n.warmLanes|=r),f=n.expirationTimes;for(var v=r;0<v;){var C=31-Pe(v),M=1<<C;f[C]=-1,v&=~M}i!==0&&Ca(n,i,r)}function rd(){return(zt&6)===0?(Ki(0),!1):!0}function fg(){if(yt!==null){if(Pt===0)var n=yt.return;else n=yt,Oa=oo=null,Em(n),ml=null,Ti=0,n=yt;for(;n!==null;)N0(n.alternate,n),n=n.return;yt=null}}function kl(n,r){var i=n.timeoutHandle;i!==-1&&(n.timeoutHandle=-1,QT(i)),i=n.cancelPendingCommit,i!==null&&(n.cancelPendingCommit=null,i()),Va=0,fg(),Kt=n,yt=i=Aa(n.current,null),wt=r,Pt=0,vs=null,_r=!1,yl=mn(n,r),og=!1,jl=ys=lg=ho=vr=fn=0,is=Gi=null,ig=!1,(r&8)!==0&&(r|=r&32);var f=n.entangledLanes;if(f!==0)for(n=n.entanglements,f&=r;0<f;){var v=31-Pe(f),C=1<<v;r|=n[v],f&=~C}return qa=r,Cu(),i}function W0(n,r){ft=null,$.H=Ii,r===pl||r===zu?(r=py(),Pt=3):r===hm?(r=py(),Pt=4):Pt=r===Vm?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,vs=r,yt===null&&(fn=1,Ku(n,As(r,n.current)))}function Z0(){var n=bs.current;return n===null?!0:(wt&4194048)===wt?Ds===null:(wt&62914560)===wt||(wt&536870912)!==0?n===Ds:!1}function J0(){var n=$.H;return $.H=Ii,n===null?Ii:n}function e1(){var n=$.A;return $.A=ET,n}function od(){fn=4,_r||(wt&4194048)!==wt&&bs.current!==null||(yl=!0),(vr&134217727)===0&&(ho&134217727)===0||Kt===null||wr(Kt,wt,ys,!1)}function pg(n,r,i){var f=zt;zt|=2;var v=J0(),C=e1();(Kt!==n||wt!==r)&&(ad=null,kl(n,r)),r=!1;var M=fn;e:do try{if(Pt!==0&&yt!==null){var q=yt,Q=vs;switch(Pt){case 8:fg(),M=6;break e;case 3:case 2:case 9:case 6:bs.current===null&&(r=!0);var ie=Pt;if(Pt=0,vs=null,Sl(n,q,Q,ie),i&&yl){M=0;break e}break;default:ie=Pt,Pt=0,vs=null,Sl(n,q,Q,ie)}}AT(),M=fn;break}catch(be){W0(n,be)}while(!0);return r&&n.shellSuspendCounter++,Oa=oo=null,zt=f,$.H=v,$.A=C,yt===null&&(Kt=null,wt=0,Cu()),M}function AT(){for(;yt!==null;)t1(yt)}function MT(n,r){var i=zt;zt|=2;var f=J0(),v=e1();Kt!==n||wt!==r?(ad=null,sd=ue()+500,kl(n,r)):yl=mn(n,r);e:do try{if(Pt!==0&&yt!==null){r=yt;var C=vs;t:switch(Pt){case 1:Pt=0,vs=null,Sl(n,r,C,1);break;case 2:case 9:if(dy(C)){Pt=0,vs=null,n1(r);break}r=function(){Pt!==2&&Pt!==9||Kt!==n||(Pt=7),la(n)},C.then(r,r);break e;case 3:Pt=7;break e;case 4:Pt=5;break e;case 7:dy(C)?(Pt=0,vs=null,n1(r)):(Pt=0,vs=null,Sl(n,r,C,7));break;case 5:var M=null;switch(yt.tag){case 26:M=yt.memoizedState;case 5:case 27:var q=yt;if(M?$1(M):q.stateNode.complete){Pt=0,vs=null;var Q=q.sibling;if(Q!==null)yt=Q;else{var ie=q.return;ie!==null?(yt=ie,ld(ie)):yt=null}break t}}Pt=0,vs=null,Sl(n,r,C,5);break;case 6:Pt=0,vs=null,Sl(n,r,C,6);break;case 8:fg(),fn=6;break e;default:throw Error(o(462))}}OT();break}catch(be){W0(n,be)}while(!0);return Oa=oo=null,$.H=f,$.A=v,zt=i,yt!==null?0:(Kt=null,wt=0,Cu(),fn)}function OT(){for(;yt!==null&&!Le();)t1(yt)}function t1(n){var r=S0(n.alternate,n,qa);n.memoizedProps=n.pendingProps,r===null?ld(n):yt=r}function n1(n){var r=n,i=r.alternate;switch(r.tag){case 15:case 0:r=_0(i,r,r.pendingProps,r.type,void 0,wt);break;case 11:r=_0(i,r,r.pendingProps,r.type.render,r.ref,wt);break;case 5:Em(r);default:N0(i,r),r=yt=ey(r,qa),r=S0(i,r,qa)}n.memoizedProps=n.pendingProps,r===null?ld(n):yt=r}function Sl(n,r,i,f){Oa=oo=null,Em(r),ml=null,Ti=0;var v=r.return;try{if(yT(n,v,r,i,wt)){fn=1,Ku(n,As(i,n.current)),yt=null;return}}catch(C){if(v!==null)throw yt=v,C;fn=1,Ku(n,As(i,n.current)),yt=null;return}r.flags&32768?(Nt||f===1?n=!0:yl||(wt&536870912)!==0?n=!1:(_r=n=!0,(f===2||f===9||f===3||f===6)&&(f=bs.current,f!==null&&f.tag===13&&(f.flags|=16384))),s1(r,n)):ld(r)}function ld(n){var r=n;do{if((r.flags&32768)!==0){s1(r,_r);return}n=r.return;var i=kT(r.alternate,r,qa);if(i!==null){yt=i;return}if(r=r.sibling,r!==null){yt=r;return}yt=r=n}while(r!==null);fn===0&&(fn=5)}function s1(n,r){do{var i=ST(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),!r&&(n=n.sibling,n!==null)){yt=n;return}yt=n=i}while(n!==null);fn=6,yt=null}function a1(n,r,i,f,v,C,M,q,Q){n.cancelPendingCommit=null;do id();while(Cn!==0);if((zt&6)!==0)throw Error(o(327));if(r!==null){if(r===n.current)throw Error(o(177));if(C=r.lanes|r.childLanes,C|=tm,Ns(n,i,C,M,q,Q),n===Kt&&(yt=Kt=null,wt=0),wl=r,jr=n,Va=i,cg=C,ug=v,Y0=f,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,LT(Oe,function(){return c1(),null})):(n.callbackNode=null,n.callbackPriority=0),f=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||f){f=$.T,$.T=null,v=F.p,F.p=2,M=zt,zt|=4;try{CT(n,r,i)}finally{zt=M,F.p=v,$.T=f}}Cn=1,r1(),o1(),l1()}}function r1(){if(Cn===1){Cn=0;var n=jr,r=wl,i=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||i){i=$.T,$.T=null;var f=F.p;F.p=2;var v=zt;zt|=4;try{B0(r,n);var C=Sg,M=Fv(n.containerInfo),q=C.focusedElem,Q=C.selectionRange;if(M!==q&&q&&q.ownerDocument&&Vv(q.ownerDocument.documentElement,q)){if(Q!==null&&Qp(q)){var ie=Q.start,be=Q.end;if(be===void 0&&(be=ie),"selectionStart"in q)q.selectionStart=ie,q.selectionEnd=Math.min(be,q.value.length);else{var we=q.ownerDocument||document,ce=we&&we.defaultView||window;if(ce.getSelection){var pe=ce.getSelection(),Fe=q.textContent.length,at=Math.min(Q.start,Fe),qt=Q.end===void 0?at:Math.min(Q.end,Fe);!pe.extend&&at>qt&&(M=qt,qt=at,at=M);var ee=qv(q,at),J=qv(q,qt);if(ee&&J&&(pe.rangeCount!==1||pe.anchorNode!==ee.node||pe.anchorOffset!==ee.offset||pe.focusNode!==J.node||pe.focusOffset!==J.offset)){var oe=we.createRange();oe.setStart(ee.node,ee.offset),pe.removeAllRanges(),at>qt?(pe.addRange(oe),pe.extend(J.node,J.offset)):(oe.setEnd(J.node,J.offset),pe.addRange(oe))}}}}for(we=[],pe=q;pe=pe.parentNode;)pe.nodeType===1&&we.push({element:pe,left:pe.scrollLeft,top:pe.scrollTop});for(typeof q.focus=="function"&&q.focus(),q=0;q<we.length;q++){var ve=we[q];ve.element.scrollLeft=ve.left,ve.element.scrollTop=ve.top}}vd=!!kg,Sg=kg=null}finally{zt=v,F.p=f,$.T=i}}n.current=r,Cn=2}}function o1(){if(Cn===2){Cn=0;var n=jr,r=wl,i=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||i){i=$.T,$.T=null;var f=F.p;F.p=2;var v=zt;zt|=4;try{z0(n,r.alternate,r)}finally{zt=v,F.p=f,$.T=i}}Cn=3}}function l1(){if(Cn===4||Cn===3){Cn=0,Ie();var n=jr,r=wl,i=Va,f=Y0;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Cn=5:(Cn=0,wl=jr=null,i1(n,n.pendingLanes));var v=n.pendingLanes;if(v===0&&(yr=null),Ut(i),r=r.stateNode,Rt&&typeof Rt.onCommitFiberRoot=="function")try{Rt.onCommitFiberRoot(lt,r,void 0,(r.current.flags&128)===128)}catch{}if(f!==null){r=$.T,v=F.p,F.p=2,$.T=null;try{for(var C=n.onRecoverableError,M=0;M<f.length;M++){var q=f[M];C(q.value,{componentStack:q.stack})}}finally{$.T=r,F.p=v}}(Va&3)!==0&&id(),la(n),v=n.pendingLanes,(i&261930)!==0&&(v&42)!==0?n===dg?Yi++:(Yi=0,dg=n):Yi=0,Ki(0)}}function i1(n,r){(n.pooledCacheLanes&=r)===0&&(r=n.pooledCache,r!=null&&(n.pooledCache=null,Ei(r)))}function id(){return r1(),o1(),l1(),c1()}function c1(){if(Cn!==5)return!1;var n=jr,r=cg;cg=0;var i=Ut(Va),f=$.T,v=F.p;try{F.p=32>i?32:i,$.T=null,i=ug,ug=null;var C=jr,M=Va;if(Cn=0,wl=jr=null,Va=0,(zt&6)!==0)throw Error(o(331));var q=zt;if(zt|=4,V0(C.current),$0(C,C.current,M,i),zt=q,Ki(0,!1),Rt&&typeof Rt.onPostCommitFiberRoot=="function")try{Rt.onPostCommitFiberRoot(lt,C)}catch{}return!0}finally{F.p=v,$.T=f,i1(n,r)}}function u1(n,r,i){r=As(i,r),r=qm(n.stateNode,r,2),n=gr(n,r,2),n!==null&&(gn(n,2),la(n))}function Lt(n,r,i){if(n.tag===3)u1(n,n,i);else for(;r!==null;){if(r.tag===3){u1(r,n,i);break}else if(r.tag===1){var f=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(yr===null||!yr.has(f))){n=As(i,n),i=d0(2),f=gr(r,i,2),f!==null&&(f0(i,f,r,n),gn(f,2),la(f));break}}r=r.return}}function mg(n,r,i){var f=n.pingCache;if(f===null){f=n.pingCache=new RT;var v=new Set;f.set(r,v)}else v=f.get(r),v===void 0&&(v=new Set,f.set(r,v));v.has(i)||(og=!0,v.add(i),n=zT.bind(null,n,r,i),r.then(n,n))}function zT(n,r,i){var f=n.pingCache;f!==null&&f.delete(r),n.pingedLanes|=n.suspendedLanes&i,n.warmLanes&=~i,Kt===n&&(wt&i)===i&&(fn===4||fn===3&&(wt&62914560)===wt&&300>ue()-nd?(zt&2)===0&&kl(n,0):lg|=i,jl===wt&&(jl=0)),la(n)}function d1(n,r){r===0&&(r=gs()),n=so(n,r),n!==null&&(gn(n,r),la(n))}function DT(n){var r=n.memoizedState,i=0;r!==null&&(i=r.retryLane),d1(n,i)}function PT(n,r){var i=0;switch(n.tag){case 31:case 13:var f=n.stateNode,v=n.memoizedState;v!==null&&(i=v.retryLane);break;case 19:f=n.stateNode;break;case 22:f=n.stateNode._retryCache;break;default:throw Error(o(314))}f!==null&&f.delete(r),d1(n,i)}function LT(n,r){return Ee(n,r)}var cd=null,Cl=null,gg=!1,ud=!1,hg=!1,kr=0;function la(n){n!==Cl&&n.next===null&&(Cl===null?cd=Cl=n:Cl=Cl.next=n),ud=!0,gg||(gg=!0,BT())}function Ki(n,r){if(!hg&&ud){hg=!0;do for(var i=!1,f=cd;f!==null;){if(n!==0){var v=f.pendingLanes;if(v===0)var C=0;else{var M=f.suspendedLanes,q=f.pingedLanes;C=(1<<31-Pe(42|n)+1)-1,C&=v&~(M&~q),C=C&201326741?C&201326741|1:C?C|2:0}C!==0&&(i=!0,g1(f,C))}else C=wt,C=en(f,f===Kt?C:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(C&3)===0||mn(f,C)||(i=!0,g1(f,C));f=f.next}while(i);hg=!1}}function IT(){f1()}function f1(){ud=gg=!1;var n=0;kr!==0&&XT()&&(n=kr);for(var r=ue(),i=null,f=cd;f!==null;){var v=f.next,C=p1(f,r);C===0?(f.next=null,i===null?cd=v:i.next=v,v===null&&(Cl=i)):(i=f,(n!==0||(C&3)!==0)&&(ud=!0)),f=v}Cn!==0&&Cn!==5||Ki(n),kr!==0&&(kr=0)}function p1(n,r){for(var i=n.suspendedLanes,f=n.pingedLanes,v=n.expirationTimes,C=n.pendingLanes&-62914561;0<C;){var M=31-Pe(C),q=1<<M,Q=v[M];Q===-1?((q&i)===0||(q&f)!==0)&&(v[M]=ss(q,r)):Q<=r&&(n.expiredLanes|=q),C&=~q}if(r=Kt,i=wt,i=en(n,n===r?i:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f=n.callbackNode,i===0||n===r&&(Pt===2||Pt===9)||n.cancelPendingCommit!==null)return f!==null&&f!==null&&De(f),n.callbackNode=null,n.callbackPriority=0;if((i&3)===0||mn(n,i)){if(r=i&-i,r===n.callbackPriority)return r;switch(f!==null&&De(f),Ut(i)){case 2:case 8:i=Re;break;case 32:i=Oe;break;case 268435456:i=ot;break;default:i=Oe}return f=m1.bind(null,n),i=Ee(i,f),n.callbackPriority=r,n.callbackNode=i,r}return f!==null&&f!==null&&De(f),n.callbackPriority=2,n.callbackNode=null,2}function m1(n,r){if(Cn!==0&&Cn!==5)return n.callbackNode=null,n.callbackPriority=0,null;var i=n.callbackNode;if(id()&&n.callbackNode!==i)return null;var f=wt;return f=en(n,n===Kt?f:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),f===0?null:(X0(n,f,r),p1(n,ue()),n.callbackNode!=null&&n.callbackNode===i?m1.bind(null,n):null)}function g1(n,r){if(id())return null;X0(n,r,!0)}function BT(){WT(function(){(zt&6)!==0?Ee(Ge,IT):f1()})}function xg(){if(kr===0){var n=dl;n===0&&(n=mt,mt<<=1,(mt&261888)===0&&(mt=256)),kr=n}return kr}function h1(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:bu(""+n)}function x1(n,r){var i=r.ownerDocument.createElement("input");return i.name=r.name,i.value=r.value,n.id&&i.setAttribute("form",n.id),r.parentNode.insertBefore(i,r),n=new FormData(n),i.parentNode.removeChild(i),n}function UT(n,r,i,f,v){if(r==="submit"&&i&&i.stateNode===v){var C=h1((v[Ln]||null).action),M=f.submitter;M&&(r=(r=M[Ln]||null)?h1(r.formAction):M.getAttribute("formAction"),r!==null&&(C=r,M=null));var q=new ju("action","action",null,f,v);n.push({event:q,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(kr!==0){var Q=M?x1(v,M):new FormData(v);Lm(i,{pending:!0,data:Q,method:v.method,action:C},null,Q)}}else typeof C=="function"&&(q.preventDefault(),Q=M?x1(v,M):new FormData(v),Lm(i,{pending:!0,data:Q,method:v.method,action:C},C,Q))},currentTarget:v}]})}}for(var bg=0;bg<em.length;bg++){var _g=em[bg],$T=_g.toLowerCase(),HT=_g[0].toUpperCase()+_g.slice(1);Gs($T,"on"+HT)}Gs(Kv,"onAnimationEnd"),Gs(Xv,"onAnimationIteration"),Gs(Qv,"onAnimationStart"),Gs("dblclick","onDoubleClick"),Gs("focusin","onFocus"),Gs("focusout","onBlur"),Gs(aT,"onTransitionRun"),Gs(rT,"onTransitionStart"),Gs(oT,"onTransitionCancel"),Gs(Wv,"onTransitionEnd"),Wo("onMouseEnter",["mouseout","mouseover"]),Wo("onMouseLeave",["mouseout","mouseover"]),Wo("onPointerEnter",["pointerout","pointerover"]),Wo("onPointerLeave",["pointerout","pointerover"]),Jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Jr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Xi="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(" "),qT=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Xi));function b1(n,r){r=(r&4)!==0;for(var i=0;i<n.length;i++){var f=n[i],v=f.event;f=f.listeners;e:{var C=void 0;if(r)for(var M=f.length-1;0<=M;M--){var q=f[M],Q=q.instance,ie=q.currentTarget;if(q=q.listener,Q!==C&&v.isPropagationStopped())break e;C=q,v.currentTarget=ie;try{C(v)}catch(be){Su(be)}v.currentTarget=null,C=Q}else for(M=0;M<f.length;M++){if(q=f[M],Q=q.instance,ie=q.currentTarget,q=q.listener,Q!==C&&v.isPropagationStopped())break e;C=q,v.currentTarget=ie;try{C(v)}catch(be){Su(be)}v.currentTarget=null,C=Q}}}}function jt(n,r){var i=r[mi];i===void 0&&(i=r[mi]=new Set);var f=n+"__bubble";i.has(f)||(_1(r,n,2,!1),i.add(f))}function vg(n,r,i){var f=0;r&&(f|=4),_1(i,n,f,r)}var dd="_reactListening"+Math.random().toString(36).slice(2);function yg(n){if(!n[dd]){n[dd]=!0,fv.forEach(function(i){i!=="selectionchange"&&(qT.has(i)||vg(i,!1,n),vg(i,!0,n))});var r=n.nodeType===9?n:n.ownerDocument;r===null||r[dd]||(r[dd]=!0,vg("selectionchange",!1,r))}}function _1(n,r,i,f){switch(K1(r)){case 2:var v=xA;break;case 8:v=bA;break;default:v=Pg}i=v.bind(null,r,i,n),v=void 0,!$p||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(v=!0),f?v!==void 0?n.addEventListener(r,i,{capture:!0,passive:v}):n.addEventListener(r,i,!0):v!==void 0?n.addEventListener(r,i,{passive:v}):n.addEventListener(r,i,!1)}function jg(n,r,i,f,v){var C=f;if((r&1)===0&&(r&2)===0&&f!==null)e:for(;;){if(f===null)return;var M=f.tag;if(M===3||M===4){var q=f.stateNode.containerInfo;if(q===v)break;if(M===4)for(M=f.return;M!==null;){var Q=M.tag;if((Q===3||Q===4)&&M.stateNode.containerInfo===v)return;M=M.return}for(;q!==null;){if(M=Ko(q),M===null)return;if(Q=M.tag,Q===5||Q===6||Q===26||Q===27){f=C=M;continue e}q=q.parentNode}}f=f.return}kv(function(){var ie=C,be=Bp(i),we=[];e:{var ce=Zv.get(n);if(ce!==void 0){var pe=ju,Fe=n;switch(n){case"keypress":if(vu(i)===0)break e;case"keydown":case"keyup":pe=PR;break;case"focusin":Fe="focus",pe=Fp;break;case"focusout":Fe="blur",pe=Fp;break;case"beforeblur":case"afterblur":pe=Fp;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":pe=Nv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":pe=kR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":pe=BR;break;case Kv:case Xv:case Qv:pe=NR;break;case Wv:pe=$R;break;case"scroll":case"scrollend":pe=jR;break;case"wheel":pe=qR;break;case"copy":case"cut":case"paste":pe=RR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":pe=Rv;break;case"toggle":case"beforetoggle":pe=FR}var at=(r&4)!==0,qt=!at&&(n==="scroll"||n==="scrollend"),ee=at?ce!==null?ce+"Capture":null:ce;at=[];for(var J=ie,oe;J!==null;){var ve=J;if(oe=ve.stateNode,ve=ve.tag,ve!==5&&ve!==26&&ve!==27||oe===null||ee===null||(ve=xi(J,ee),ve!=null&&at.push(Qi(J,ve,oe))),qt)break;J=J.return}0<at.length&&(ce=new pe(ce,Fe,null,i,be),we.push({event:ce,listeners:at}))}}if((r&7)===0){e:{if(ce=n==="mouseover"||n==="pointerover",pe=n==="mouseout"||n==="pointerout",ce&&i!==Ip&&(Fe=i.relatedTarget||i.fromElement)&&(Ko(Fe)||Fe[sa]))break e;if((pe||ce)&&(ce=be.window===be?be:(ce=be.ownerDocument)?ce.defaultView||ce.parentWindow:window,pe?(Fe=i.relatedTarget||i.toElement,pe=ie,Fe=Fe?Ko(Fe):null,Fe!==null&&(qt=c(Fe),at=Fe.tag,Fe!==qt||at!==5&&at!==27&&at!==6)&&(Fe=null)):(pe=null,Fe=ie),pe!==Fe)){if(at=Nv,ve="onMouseLeave",ee="onMouseEnter",J="mouse",(n==="pointerout"||n==="pointerover")&&(at=Rv,ve="onPointerLeave",ee="onPointerEnter",J="pointer"),qt=pe==null?ce:hi(pe),oe=Fe==null?ce:hi(Fe),ce=new at(ve,J+"leave",pe,i,be),ce.target=qt,ce.relatedTarget=oe,ve=null,Ko(be)===ie&&(at=new at(ee,J+"enter",Fe,i,be),at.target=oe,at.relatedTarget=qt,ve=at),qt=ve,pe&&Fe)t:{for(at=VT,ee=pe,J=Fe,oe=0,ve=ee;ve;ve=at(ve))oe++;ve=0;for(var Je=J;Je;Je=at(Je))ve++;for(;0<oe-ve;)ee=at(ee),oe--;for(;0<ve-oe;)J=at(J),ve--;for(;oe--;){if(ee===J||J!==null&&ee===J.alternate){at=ee;break t}ee=at(ee),J=at(J)}at=null}else at=null;pe!==null&&v1(we,ce,pe,at,!1),Fe!==null&&qt!==null&&v1(we,qt,Fe,at,!0)}}e:{if(ce=ie?hi(ie):window,pe=ce.nodeName&&ce.nodeName.toLowerCase(),pe==="select"||pe==="input"&&ce.type==="file")var Tt=Lv;else if(Dv(ce))if(Iv)Tt=tT;else{Tt=JR;var Ke=ZR}else pe=ce.nodeName,!pe||pe.toLowerCase()!=="input"||ce.type!=="checkbox"&&ce.type!=="radio"?ie&&Lp(ie.elementType)&&(Tt=Lv):Tt=eT;if(Tt&&(Tt=Tt(n,ie))){Pv(we,Tt,i,be);break e}Ke&&Ke(n,ce,ie),n==="focusout"&&ie&&ce.type==="number"&&ie.memoizedProps.value!=null&&Pp(ce,"number",ce.value)}switch(Ke=ie?hi(ie):window,n){case"focusin":(Dv(Ke)||Ke.contentEditable==="true")&&(sl=Ke,Wp=ie,Si=null);break;case"focusout":Si=Wp=sl=null;break;case"mousedown":Zp=!0;break;case"contextmenu":case"mouseup":case"dragend":Zp=!1,Gv(we,i,be);break;case"selectionchange":if(sT)break;case"keydown":case"keyup":Gv(we,i,be)}var gt;if(Yp)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 nl?Ov(n,i)&&(kt="onCompositionEnd"):n==="keydown"&&i.keyCode===229&&(kt="onCompositionStart");kt&&(Tv&&i.locale!=="ko"&&(nl||kt!=="onCompositionStart"?kt==="onCompositionEnd"&&nl&&(gt=Sv()):(ir=be,Hp="value"in ir?ir.value:ir.textContent,nl=!0)),Ke=fd(ie,kt),0<Ke.length&&(kt=new Ev(kt,n,null,i,be),we.push({event:kt,listeners:Ke}),gt?kt.data=gt:(gt=zv(i),gt!==null&&(kt.data=gt)))),(gt=YR?KR(n,i):XR(n,i))&&(kt=fd(ie,"onBeforeInput"),0<kt.length&&(Ke=new Ev("onBeforeInput","beforeinput",null,i,be),we.push({event:Ke,listeners:kt}),Ke.data=gt)),UT(we,n,ie,i,be)}b1(we,r)})}function Qi(n,r,i){return{instance:n,listener:r,currentTarget:i}}function fd(n,r){for(var i=r+"Capture",f=[];n!==null;){var v=n,C=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||C===null||(v=xi(n,i),v!=null&&f.unshift(Qi(n,v,C)),v=xi(n,r),v!=null&&f.push(Qi(n,v,C))),n.tag===3)return f;n=n.return}return[]}function VT(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function v1(n,r,i,f,v){for(var C=r._reactName,M=[];i!==null&&i!==f;){var q=i,Q=q.alternate,ie=q.stateNode;if(q=q.tag,Q!==null&&Q===f)break;q!==5&&q!==26&&q!==27||ie===null||(Q=ie,v?(ie=xi(i,C),ie!=null&&M.unshift(Qi(i,ie,Q))):v||(ie=xi(i,C),ie!=null&&M.push(Qi(i,ie,Q)))),i=i.return}M.length!==0&&n.push({event:r,listeners:M})}var FT=/\r\n?/g,GT=/\u0000|\uFFFD/g;function y1(n){return(typeof n=="string"?n:""+n).replace(FT,`
|
|
49
|
+
`).replace(GT,"")}function j1(n,r){return r=y1(r),y1(n)===r}function Ht(n,r,i,f,v,C){switch(i){case"children":typeof f=="string"?r==="body"||r==="textarea"&&f===""||Jo(n,f):(typeof f=="number"||typeof f=="bigint")&&r!=="body"&&Jo(n,""+f);break;case"className":hu(n,"class",f);break;case"tabIndex":hu(n,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":hu(n,i,f);break;case"style":jv(n,f,C);break;case"data":if(r!=="object"){hu(n,"data",f);break}case"src":case"href":if(f===""&&(r!=="a"||i!=="href")){n.removeAttribute(i);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(i);break}f=bu(""+f),n.setAttribute(i,f);break;case"action":case"formAction":if(typeof f=="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 C=="function"&&(i==="formAction"?(r!=="input"&&Ht(n,r,"name",v.name,v,null),Ht(n,r,"formEncType",v.formEncType,v,null),Ht(n,r,"formMethod",v.formMethod,v,null),Ht(n,r,"formTarget",v.formTarget,v,null)):(Ht(n,r,"encType",v.encType,v,null),Ht(n,r,"method",v.method,v,null),Ht(n,r,"target",v.target,v,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){n.removeAttribute(i);break}f=bu(""+f),n.setAttribute(i,f);break;case"onClick":f!=null&&(n.onclick=Ra);break;case"onScroll":f!=null&&jt("scroll",n);break;case"onScrollEnd":f!=null&&jt("scrollend",n);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(o(61));if(i=f.__html,i!=null){if(v.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"multiple":n.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":n.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){n.removeAttribute("xlink:href");break}i=bu(""+f),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":f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(i,""+f):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":f&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(i,""):n.removeAttribute(i);break;case"capture":case"download":f===!0?n.setAttribute(i,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?n.setAttribute(i,f):n.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?n.setAttribute(i,f):n.removeAttribute(i);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?n.removeAttribute(i):n.setAttribute(i,f);break;case"popover":jt("beforetoggle",n),jt("toggle",n),gu(n,"popover",f);break;case"xlinkActuate":Ea(n,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Ea(n,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Ea(n,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Ea(n,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Ea(n,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Ea(n,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Ea(n,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Ea(n,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Ea(n,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":gu(n,"is",f);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=vR.get(i)||i,gu(n,i,f))}}function wg(n,r,i,f,v,C){switch(i){case"style":jv(n,f,C);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(o(61));if(i=f.__html,i!=null){if(v.children!=null)throw Error(o(60));n.innerHTML=i}}break;case"children":typeof f=="string"?Jo(n,f):(typeof f=="number"||typeof f=="bigint")&&Jo(n,""+f);break;case"onScroll":f!=null&&jt("scroll",n);break;case"onScrollEnd":f!=null&&jt("scrollend",n);break;case"onClick":f!=null&&(n.onclick=Ra);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!pv.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(v=i.endsWith("Capture"),r=i.slice(2,v?i.length-7:void 0),C=n[Ln]||null,C=C!=null?C[i]:null,typeof C=="function"&&n.removeEventListener(r,C,v),typeof f=="function")){typeof C!="function"&&C!==null&&(i in n?n[i]=null:n.hasAttribute(i)&&n.removeAttribute(i)),n.addEventListener(r,f,v);break e}i in n?n[i]=f:f===!0?n.setAttribute(i,""):gu(n,i,f)}}}function $n(n,r,i){switch(r){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 f=!1,v=!1,C;for(C in i)if(i.hasOwnProperty(C)){var M=i[C];if(M!=null)switch(C){case"src":f=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,r));default:Ht(n,r,C,M,i,null)}}v&&Ht(n,r,"srcSet",i.srcSet,i,null),f&&Ht(n,r,"src",i.src,i,null);return;case"input":jt("invalid",n);var q=C=M=v=null,Q=null,ie=null;for(f in i)if(i.hasOwnProperty(f)){var be=i[f];if(be!=null)switch(f){case"name":v=be;break;case"type":M=be;break;case"checked":Q=be;break;case"defaultChecked":ie=be;break;case"value":C=be;break;case"defaultValue":q=be;break;case"children":case"dangerouslySetInnerHTML":if(be!=null)throw Error(o(137,r));break;default:Ht(n,r,f,be,i,null)}}bv(n,C,q,Q,ie,M,v,!1);return;case"select":jt("invalid",n),f=M=C=null;for(v in i)if(i.hasOwnProperty(v)&&(q=i[v],q!=null))switch(v){case"value":C=q;break;case"defaultValue":M=q;break;case"multiple":f=q;default:Ht(n,r,v,q,i,null)}r=C,i=M,n.multiple=!!f,r!=null?Zo(n,!!f,r,!1):i!=null&&Zo(n,!!f,i,!0);return;case"textarea":jt("invalid",n),C=v=f=null;for(M in i)if(i.hasOwnProperty(M)&&(q=i[M],q!=null))switch(M){case"value":f=q;break;case"defaultValue":v=q;break;case"children":C=q;break;case"dangerouslySetInnerHTML":if(q!=null)throw Error(o(91));break;default:Ht(n,r,M,q,i,null)}vv(n,f,v,C);return;case"option":for(Q in i)if(i.hasOwnProperty(Q)&&(f=i[Q],f!=null))switch(Q){case"selected":n.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Ht(n,r,Q,f,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(f=0;f<Xi.length;f++)jt(Xi[f],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(ie in i)if(i.hasOwnProperty(ie)&&(f=i[ie],f!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,r));default:Ht(n,r,ie,f,i,null)}return;default:if(Lp(r)){for(be in i)i.hasOwnProperty(be)&&(f=i[be],f!==void 0&&wg(n,r,be,f,i,void 0));return}}for(q in i)i.hasOwnProperty(q)&&(f=i[q],f!=null&&Ht(n,r,q,f,i,null))}function YT(n,r,i,f){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,C=null,M=null,q=null,Q=null,ie=null,be=null;for(pe in i){var we=i[pe];if(i.hasOwnProperty(pe)&&we!=null)switch(pe){case"checked":break;case"value":break;case"defaultValue":Q=we;default:f.hasOwnProperty(pe)||Ht(n,r,pe,null,f,we)}}for(var ce in f){var pe=f[ce];if(we=i[ce],f.hasOwnProperty(ce)&&(pe!=null||we!=null))switch(ce){case"type":C=pe;break;case"name":v=pe;break;case"checked":ie=pe;break;case"defaultChecked":be=pe;break;case"value":M=pe;break;case"defaultValue":q=pe;break;case"children":case"dangerouslySetInnerHTML":if(pe!=null)throw Error(o(137,r));break;default:pe!==we&&Ht(n,r,ce,pe,f,we)}}Dp(n,M,q,Q,ie,be,C,v);return;case"select":pe=M=q=ce=null;for(C in i)if(Q=i[C],i.hasOwnProperty(C)&&Q!=null)switch(C){case"value":break;case"multiple":pe=Q;default:f.hasOwnProperty(C)||Ht(n,r,C,null,f,Q)}for(v in f)if(C=f[v],Q=i[v],f.hasOwnProperty(v)&&(C!=null||Q!=null))switch(v){case"value":ce=C;break;case"defaultValue":q=C;break;case"multiple":M=C;default:C!==Q&&Ht(n,r,v,C,f,Q)}r=q,i=M,f=pe,ce!=null?Zo(n,!!i,ce,!1):!!f!=!!i&&(r!=null?Zo(n,!!i,r,!0):Zo(n,!!i,i?[]:"",!1));return;case"textarea":pe=ce=null;for(q in i)if(v=i[q],i.hasOwnProperty(q)&&v!=null&&!f.hasOwnProperty(q))switch(q){case"value":break;case"children":break;default:Ht(n,r,q,null,f,v)}for(M in f)if(v=f[M],C=i[M],f.hasOwnProperty(M)&&(v!=null||C!=null))switch(M){case"value":ce=v;break;case"defaultValue":pe=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(o(91));break;default:v!==C&&Ht(n,r,M,v,f,C)}_v(n,ce,pe);return;case"option":for(var Fe in i)if(ce=i[Fe],i.hasOwnProperty(Fe)&&ce!=null&&!f.hasOwnProperty(Fe))switch(Fe){case"selected":n.selected=!1;break;default:Ht(n,r,Fe,null,f,ce)}for(Q in f)if(ce=f[Q],pe=i[Q],f.hasOwnProperty(Q)&&ce!==pe&&(ce!=null||pe!=null))switch(Q){case"selected":n.selected=ce&&typeof ce!="function"&&typeof ce!="symbol";break;default:Ht(n,r,Q,ce,f,pe)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var at in i)ce=i[at],i.hasOwnProperty(at)&&ce!=null&&!f.hasOwnProperty(at)&&Ht(n,r,at,null,f,ce);for(ie in f)if(ce=f[ie],pe=i[ie],f.hasOwnProperty(ie)&&ce!==pe&&(ce!=null||pe!=null))switch(ie){case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(o(137,r));break;default:Ht(n,r,ie,ce,f,pe)}return;default:if(Lp(r)){for(var qt in i)ce=i[qt],i.hasOwnProperty(qt)&&ce!==void 0&&!f.hasOwnProperty(qt)&&wg(n,r,qt,void 0,f,ce);for(be in f)ce=f[be],pe=i[be],!f.hasOwnProperty(be)||ce===pe||ce===void 0&&pe===void 0||wg(n,r,be,ce,f,pe);return}}for(var ee in i)ce=i[ee],i.hasOwnProperty(ee)&&ce!=null&&!f.hasOwnProperty(ee)&&Ht(n,r,ee,null,f,ce);for(we in f)ce=f[we],pe=i[we],!f.hasOwnProperty(we)||ce===pe||ce==null&&pe==null||Ht(n,r,we,ce,f,pe)}function w1(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function KT(){if(typeof performance.getEntriesByType=="function"){for(var n=0,r=0,i=performance.getEntriesByType("resource"),f=0;f<i.length;f++){var v=i[f],C=v.transferSize,M=v.initiatorType,q=v.duration;if(C&&q&&w1(M)){for(M=0,q=v.responseEnd,f+=1;f<i.length;f++){var Q=i[f],ie=Q.startTime;if(ie>q)break;var be=Q.transferSize,we=Q.initiatorType;be&&w1(we)&&(Q=Q.responseEnd,M+=be*(Q<q?1:(q-ie)/(Q-ie)))}if(--f,r+=8*(C+M)/(v.duration/1e3),n++,10<n)break}}if(0<n)return r/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var kg=null,Sg=null;function pd(n){return n.nodeType===9?n:n.ownerDocument}function k1(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 S1(n,r){if(n===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&r==="foreignObject"?0:n}function Cg(n,r){return n==="textarea"||n==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Ng=null;function XT(){var n=window.event;return n&&n.type==="popstate"?n===Ng?!1:(Ng=n,!0):(Ng=null,!1)}var C1=typeof setTimeout=="function"?setTimeout:void 0,QT=typeof clearTimeout=="function"?clearTimeout:void 0,N1=typeof Promise=="function"?Promise:void 0,WT=typeof queueMicrotask=="function"?queueMicrotask:typeof N1<"u"?function(n){return N1.resolve(null).then(n).catch(ZT)}:C1;function ZT(n){setTimeout(function(){throw n})}function Sr(n){return n==="head"}function E1(n,r){var i=r,f=0;do{var v=i.nextSibling;if(n.removeChild(i),v&&v.nodeType===8)if(i=v.data,i==="/$"||i==="/&"){if(f===0){n.removeChild(v),Tl(r);return}f--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")f++;else if(i==="html")Wi(n.ownerDocument.documentElement);else if(i==="head"){i=n.ownerDocument.head,Wi(i);for(var C=i.firstChild;C;){var M=C.nextSibling,q=C.nodeName;C[gi]||q==="SCRIPT"||q==="STYLE"||q==="LINK"&&C.rel.toLowerCase()==="stylesheet"||i.removeChild(C),C=M}}else i==="body"&&Wi(n.ownerDocument.body);i=v}while(i);Tl(r)}function R1(n,r){var i=n;n=0;do{var f=i.nextSibling;if(i.nodeType===1?r?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(r?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),f&&f.nodeType===8)if(i=f.data,i==="/$"){if(n===0)break;n--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||n++;i=f}while(i)}function Eg(n){var r=n.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var i=r;switch(r=r.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Eg(i),Op(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}n.removeChild(i)}}function JT(n,r,i,f){for(;n.nodeType===1;){var v=i;if(n.nodeName.toLowerCase()!==r.toLowerCase()){if(!f&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(f){if(!n[gi])switch(r){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(C=n.getAttribute("rel"),C==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(C!==v.rel||n.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||n.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||n.getAttribute("title")!==(v.title==null?null:v.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(C=n.getAttribute("src"),(C!==(v.src==null?null:v.src)||n.getAttribute("type")!==(v.type==null?null:v.type)||n.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&C&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(r==="input"&&n.type==="hidden"){var C=v.name==null?null:""+v.name;if(v.type==="hidden"&&n.getAttribute("name")===C)return n}else return n;if(n=Ps(n.nextSibling),n===null)break}return null}function eA(n,r,i){if(r==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!i||(n=Ps(n.nextSibling),n===null))return null;return n}function T1(n,r){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!r||(n=Ps(n.nextSibling),n===null))return null;return n}function Rg(n){return n.data==="$?"||n.data==="$~"}function Tg(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function tA(n,r){var i=n.ownerDocument;if(n.data==="$~")n._reactRetry=r;else if(n.data!=="$?"||i.readyState!=="loading")r();else{var f=function(){r(),i.removeEventListener("DOMContentLoaded",f)};i.addEventListener("DOMContentLoaded",f),n._reactRetry=f}}function Ps(n){for(;n!=null;n=n.nextSibling){var r=n.nodeType;if(r===1||r===3)break;if(r===8){if(r=n.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return n}var Ag=null;function A1(n){n=n.nextSibling;for(var r=0;n;){if(n.nodeType===8){var i=n.data;if(i==="/$"||i==="/&"){if(r===0)return Ps(n.nextSibling);r--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||r++}n=n.nextSibling}return null}function M1(n){n=n.previousSibling;for(var r=0;n;){if(n.nodeType===8){var i=n.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(r===0)return n;r--}else i!=="/$"&&i!=="/&"||r++}n=n.previousSibling}return null}function O1(n,r,i){switch(r=pd(i),n){case"html":if(n=r.documentElement,!n)throw Error(o(452));return n;case"head":if(n=r.head,!n)throw Error(o(453));return n;case"body":if(n=r.body,!n)throw Error(o(454));return n;default:throw Error(o(451))}}function Wi(n){for(var r=n.attributes;r.length;)n.removeAttributeNode(r[0]);Op(n)}var Ls=new Map,z1=new Set;function md(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Fa=F.d;F.d={f:nA,r:sA,D:aA,C:rA,L:oA,m:lA,X:cA,S:iA,M:uA};function nA(){var n=Fa.f(),r=rd();return n||r}function sA(n){var r=Xo(n);r!==null&&r.tag===5&&r.type==="form"?Wy(r):Fa.r(n)}var Nl=typeof document>"u"?null:document;function D1(n,r,i){var f=Nl;if(f&&typeof r=="string"&&r){var v=Rs(r);v='link[rel="'+n+'"][href="'+v+'"]',typeof i=="string"&&(v+='[crossorigin="'+i+'"]'),z1.has(v)||(z1.add(v),n={rel:n,crossOrigin:i,href:r},f.querySelector(v)===null&&(r=f.createElement("link"),$n(r,"link",n),Tn(r),f.head.appendChild(r)))}}function aA(n){Fa.D(n),D1("dns-prefetch",n,null)}function rA(n,r){Fa.C(n,r),D1("preconnect",n,r)}function oA(n,r,i){Fa.L(n,r,i);var f=Nl;if(f&&n&&r){var v='link[rel="preload"][as="'+Rs(r)+'"]';r==="image"&&i&&i.imageSrcSet?(v+='[imagesrcset="'+Rs(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(v+='[imagesizes="'+Rs(i.imageSizes)+'"]')):v+='[href="'+Rs(n)+'"]';var C=v;switch(r){case"style":C=El(n);break;case"script":C=Rl(n)}Ls.has(C)||(n=b({rel:"preload",href:r==="image"&&i&&i.imageSrcSet?void 0:n,as:r},i),Ls.set(C,n),f.querySelector(v)!==null||r==="style"&&f.querySelector(Zi(C))||r==="script"&&f.querySelector(Ji(C))||(r=f.createElement("link"),$n(r,"link",n),Tn(r),f.head.appendChild(r)))}}function lA(n,r){Fa.m(n,r);var i=Nl;if(i&&n){var f=r&&typeof r.as=="string"?r.as:"script",v='link[rel="modulepreload"][as="'+Rs(f)+'"][href="'+Rs(n)+'"]',C=v;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":C=Rl(n)}if(!Ls.has(C)&&(n=b({rel:"modulepreload",href:n},r),Ls.set(C,n),i.querySelector(v)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Ji(C)))return}f=i.createElement("link"),$n(f,"link",n),Tn(f),i.head.appendChild(f)}}}function iA(n,r,i){Fa.S(n,r,i);var f=Nl;if(f&&n){var v=Qo(f).hoistableStyles,C=El(n);r=r||"default";var M=v.get(C);if(!M){var q={loading:0,preload:null};if(M=f.querySelector(Zi(C)))q.loading=5;else{n=b({rel:"stylesheet",href:n,"data-precedence":r},i),(i=Ls.get(C))&&Mg(n,i);var Q=M=f.createElement("link");Tn(Q),$n(Q,"link",n),Q._p=new Promise(function(ie,be){Q.onload=ie,Q.onerror=be}),Q.addEventListener("load",function(){q.loading|=1}),Q.addEventListener("error",function(){q.loading|=2}),q.loading|=4,gd(M,r,f)}M={type:"stylesheet",instance:M,count:1,state:q},v.set(C,M)}}}function cA(n,r){Fa.X(n,r);var i=Nl;if(i&&n){var f=Qo(i).hoistableScripts,v=Rl(n),C=f.get(v);C||(C=i.querySelector(Ji(v)),C||(n=b({src:n,async:!0},r),(r=Ls.get(v))&&Og(n,r),C=i.createElement("script"),Tn(C),$n(C,"link",n),i.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},f.set(v,C))}}function uA(n,r){Fa.M(n,r);var i=Nl;if(i&&n){var f=Qo(i).hoistableScripts,v=Rl(n),C=f.get(v);C||(C=i.querySelector(Ji(v)),C||(n=b({src:n,async:!0,type:"module"},r),(r=Ls.get(v))&&Og(n,r),C=i.createElement("script"),Tn(C),$n(C,"link",n),i.head.appendChild(C)),C={type:"script",instance:C,count:1,state:null},f.set(v,C))}}function P1(n,r,i,f){var v=(v=te.current)?md(v):null;if(!v)throw Error(o(446));switch(n){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(r=El(i.href),i=Qo(v).hoistableStyles,f=i.get(r),f||(f={type:"style",instance:null,count:0,state:null},i.set(r,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){n=El(i.href);var C=Qo(v).hoistableStyles,M=C.get(n);if(M||(v=v.ownerDocument||v,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},C.set(n,M),(C=v.querySelector(Zi(n)))&&!C._p&&(M.instance=C,M.state.loading=5),Ls.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},Ls.set(n,i),C||dA(v,n,i,M.state))),r&&f===null)throw Error(o(528,""));return M}if(r&&f!==null)throw Error(o(529,""));return null;case"script":return r=i.async,i=i.src,typeof i=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Rl(i),i=Qo(v).hoistableScripts,f=i.get(r),f||(f={type:"script",instance:null,count:0,state:null},i.set(r,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,n))}}function El(n){return'href="'+Rs(n)+'"'}function Zi(n){return'link[rel="stylesheet"]['+n+"]"}function L1(n){return b({},n,{"data-precedence":n.precedence,precedence:null})}function dA(n,r,i,f){n.querySelector('link[rel="preload"][as="style"]['+r+"]")?f.loading=1:(r=n.createElement("link"),f.preload=r,r.addEventListener("load",function(){return f.loading|=1}),r.addEventListener("error",function(){return f.loading|=2}),$n(r,"link",i),Tn(r),n.head.appendChild(r))}function Rl(n){return'[src="'+Rs(n)+'"]'}function Ji(n){return"script[async]"+n}function I1(n,r,i){if(r.count++,r.instance===null)switch(r.type){case"style":var f=n.querySelector('style[data-href~="'+Rs(i.href)+'"]');if(f)return r.instance=f,Tn(f),f;var v=b({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return f=(n.ownerDocument||n).createElement("style"),Tn(f),$n(f,"style",v),gd(f,i.precedence,n),r.instance=f;case"stylesheet":v=El(i.href);var C=n.querySelector(Zi(v));if(C)return r.state.loading|=4,r.instance=C,Tn(C),C;f=L1(i),(v=Ls.get(v))&&Mg(f,v),C=(n.ownerDocument||n).createElement("link"),Tn(C);var M=C;return M._p=new Promise(function(q,Q){M.onload=q,M.onerror=Q}),$n(C,"link",f),r.state.loading|=4,gd(C,i.precedence,n),r.instance=C;case"script":return C=Rl(i.src),(v=n.querySelector(Ji(C)))?(r.instance=v,Tn(v),v):(f=i,(v=Ls.get(C))&&(f=b({},i),Og(f,v)),n=n.ownerDocument||n,v=n.createElement("script"),Tn(v),$n(v,"link",f),n.head.appendChild(v),r.instance=v);case"void":return null;default:throw Error(o(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(f=r.instance,r.state.loading|=4,gd(f,i.precedence,n));return r.instance}function gd(n,r,i){for(var f=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=f.length?f[f.length-1]:null,C=v,M=0;M<f.length;M++){var q=f[M];if(q.dataset.precedence===r)C=q;else if(C!==v)break}C?C.parentNode.insertBefore(n,C.nextSibling):(r=i.nodeType===9?i.head:i,r.insertBefore(n,r.firstChild))}function Mg(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.title==null&&(n.title=r.title)}function Og(n,r){n.crossOrigin==null&&(n.crossOrigin=r.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=r.referrerPolicy),n.integrity==null&&(n.integrity=r.integrity)}var hd=null;function B1(n,r,i){if(hd===null){var f=new Map,v=hd=new Map;v.set(i,f)}else v=hd,f=v.get(i),f||(f=new Map,v.set(i,f));if(f.has(n))return f;for(f.set(n,null),i=i.getElementsByTagName(n),v=0;v<i.length;v++){var C=i[v];if(!(C[gi]||C[Yt]||n==="link"&&C.getAttribute("rel")==="stylesheet")&&C.namespaceURI!=="http://www.w3.org/2000/svg"){var M=C.getAttribute(r)||"";M=n+M;var q=f.get(M);q?q.push(C):f.set(M,[C])}}return f}function U1(n,r,i){n=n.ownerDocument||n,n.head.insertBefore(i,r==="title"?n.querySelector("head > title"):null)}function fA(n,r,i){if(i===1||r.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return n=r.disabled,typeof r.precedence=="string"&&n==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function $1(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function pA(n,r,i,f){if(i.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var v=El(f.href),C=r.querySelector(Zi(v));if(C){r=C._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(n.count++,n=xd.bind(n),r.then(n,n)),i.state.loading|=4,i.instance=C,Tn(C);return}C=r.ownerDocument||r,f=L1(f),(v=Ls.get(v))&&Mg(f,v),C=C.createElement("link"),Tn(C);var M=C;M._p=new Promise(function(q,Q){M.onload=q,M.onerror=Q}),$n(C,"link",f),i.instance=C}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(i,r),(r=i.state.preload)&&(i.state.loading&3)===0&&(n.count++,i=xd.bind(n),r.addEventListener("load",i),r.addEventListener("error",i))}}var zg=0;function mA(n,r){return n.stylesheets&&n.count===0&&_d(n,n.stylesheets),0<n.count||0<n.imgCount?function(i){var f=setTimeout(function(){if(n.stylesheets&&_d(n,n.stylesheets),n.unsuspend){var C=n.unsuspend;n.unsuspend=null,C()}},6e4+r);0<n.imgBytes&&zg===0&&(zg=62500*KT());var v=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&_d(n,n.stylesheets),n.unsuspend)){var C=n.unsuspend;n.unsuspend=null,C()}},(n.imgBytes>zg?50:800)+r);return n.unsuspend=i,function(){n.unsuspend=null,clearTimeout(f),clearTimeout(v)}}:null}function xd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)_d(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var bd=null;function _d(n,r){n.stylesheets=null,n.unsuspend!==null&&(n.count++,bd=new Map,r.forEach(gA,n),bd=null,xd.call(n))}function gA(n,r){if(!(r.state.loading&4)){var i=bd.get(n);if(i)var f=i.get(null);else{i=new Map,bd.set(n,i);for(var v=n.querySelectorAll("link[data-precedence],style[data-precedence]"),C=0;C<v.length;C++){var M=v[C];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(i.set(M.dataset.precedence,M),f=M)}f&&i.set(null,f)}v=r.instance,M=v.getAttribute("data-precedence"),C=i.get(M)||f,C===f&&i.set(null,v),i.set(M,v),this.count++,f=xd.bind(this),v.addEventListener("load",f),v.addEventListener("error",f),C?C.parentNode.insertBefore(v,C.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(v,n.firstChild)),r.state.loading|=4}}var ec={$$typeof:E,Provider:null,Consumer:null,_currentValue:Y,_currentValue2:Y,_threadCount:0};function hA(n,r,i,f,v,C,M,q,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=Cs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cs(0),this.hiddenUpdates=Cs(null),this.identifierPrefix=f,this.onUncaughtError=v,this.onCaughtError=C,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function H1(n,r,i,f,v,C,M,q,Q,ie,be,we){return n=new hA(n,r,i,M,Q,ie,be,we,q),r=1,C===!0&&(r|=24),C=xs(3,null,null,r),n.current=C,C.stateNode=n,r=pm(),r.refCount++,n.pooledCache=r,r.refCount++,C.memoizedState={element:f,isDehydrated:i,cache:r},xm(C),n}function q1(n){return n?(n=ol,n):ol}function V1(n,r,i,f,v,C){v=q1(v),f.context===null?f.context=v:f.pendingContext=v,f=mr(r),f.payload={element:i},C=C===void 0?null:C,C!==null&&(f.callback=C),i=gr(n,f,r),i!==null&&(cs(i,n,r),Mi(i,n,r))}function F1(n,r){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var i=n.retryLane;n.retryLane=i!==0&&i<r?i:r}}function Dg(n,r){F1(n,r),(n=n.alternate)&&F1(n,r)}function G1(n){if(n.tag===13||n.tag===31){var r=so(n,67108864);r!==null&&cs(r,n,67108864),Dg(n,67108864)}}function Y1(n){if(n.tag===13||n.tag===31){var r=js();r=dt(r);var i=so(n,r);i!==null&&cs(i,n,r),Dg(n,r)}}var vd=!0;function xA(n,r,i,f){var v=$.T;$.T=null;var C=F.p;try{F.p=2,Pg(n,r,i,f)}finally{F.p=C,$.T=v}}function bA(n,r,i,f){var v=$.T;$.T=null;var C=F.p;try{F.p=8,Pg(n,r,i,f)}finally{F.p=C,$.T=v}}function Pg(n,r,i,f){if(vd){var v=Lg(f);if(v===null)jg(n,r,f,yd,i),X1(n,f);else if(vA(v,n,r,i,f))f.stopPropagation();else if(X1(n,f),r&4&&-1<_A.indexOf(n)){for(;v!==null;){var C=Xo(v);if(C!==null)switch(C.tag){case 3:if(C=C.stateNode,C.current.memoizedState.isDehydrated){var M=Qt(C.pendingLanes);if(M!==0){var q=C;for(q.pendingLanes|=2,q.entangledLanes|=2;M;){var Q=1<<31-Pe(M);q.entanglements[1]|=Q,M&=~Q}la(C),(zt&6)===0&&(sd=ue()+500,Ki(0))}}break;case 31:case 13:q=so(C,2),q!==null&&cs(q,C,2),rd(),Dg(C,2)}if(C=Lg(f),C===null&&jg(n,r,f,yd,i),C===v)break;v=C}v!==null&&f.stopPropagation()}else jg(n,r,f,null,i)}}function Lg(n){return n=Bp(n),Ig(n)}var yd=null;function Ig(n){if(yd=null,n=Ko(n),n!==null){var r=c(n);if(r===null)n=null;else{var i=r.tag;if(i===13){if(n=d(r),n!==null)return n;n=null}else if(i===31){if(n=p(r),n!==null)return n;n=null}else if(i===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;n=null}else r!==n&&(n=null)}}return yd=n,null}function K1(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(ye()){case Ge:return 2;case Re:return 8;case Oe:case tt:return 32;case ot:return 268435456;default:return 32}default:return 32}}var Bg=!1,Cr=null,Nr=null,Er=null,tc=new Map,nc=new Map,Rr=[],_A="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 X1(n,r){switch(n){case"focusin":case"focusout":Cr=null;break;case"dragenter":case"dragleave":Nr=null;break;case"mouseover":case"mouseout":Er=null;break;case"pointerover":case"pointerout":tc.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":nc.delete(r.pointerId)}}function sc(n,r,i,f,v,C){return n===null||n.nativeEvent!==C?(n={blockedOn:r,domEventName:i,eventSystemFlags:f,nativeEvent:C,targetContainers:[v]},r!==null&&(r=Xo(r),r!==null&&G1(r)),n):(n.eventSystemFlags|=f,r=n.targetContainers,v!==null&&r.indexOf(v)===-1&&r.push(v),n)}function vA(n,r,i,f,v){switch(r){case"focusin":return Cr=sc(Cr,n,r,i,f,v),!0;case"dragenter":return Nr=sc(Nr,n,r,i,f,v),!0;case"mouseover":return Er=sc(Er,n,r,i,f,v),!0;case"pointerover":var C=v.pointerId;return tc.set(C,sc(tc.get(C)||null,n,r,i,f,v)),!0;case"gotpointercapture":return C=v.pointerId,nc.set(C,sc(nc.get(C)||null,n,r,i,f,v)),!0}return!1}function Q1(n){var r=Ko(n.target);if(r!==null){var i=c(r);if(i!==null){if(r=i.tag,r===13){if(r=d(i),r!==null){n.blockedOn=r,Rn(n.priority,function(){Y1(i)});return}}else if(r===31){if(r=p(i),r!==null){n.blockedOn=r,Rn(n.priority,function(){Y1(i)});return}}else if(r===3&&i.stateNode.current.memoizedState.isDehydrated){n.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}n.blockedOn=null}function jd(n){if(n.blockedOn!==null)return!1;for(var r=n.targetContainers;0<r.length;){var i=Lg(n.nativeEvent);if(i===null){i=n.nativeEvent;var f=new i.constructor(i.type,i);Ip=f,i.target.dispatchEvent(f),Ip=null}else return r=Xo(i),r!==null&&G1(r),n.blockedOn=i,!1;r.shift()}return!0}function W1(n,r,i){jd(n)&&i.delete(r)}function yA(){Bg=!1,Cr!==null&&jd(Cr)&&(Cr=null),Nr!==null&&jd(Nr)&&(Nr=null),Er!==null&&jd(Er)&&(Er=null),tc.forEach(W1),nc.forEach(W1)}function wd(n,r){n.blockedOn===r&&(n.blockedOn=null,Bg||(Bg=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,yA)))}var kd=null;function Z1(n){kd!==n&&(kd=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){kd===n&&(kd=null);for(var r=0;r<n.length;r+=3){var i=n[r],f=n[r+1],v=n[r+2];if(typeof f!="function"){if(Ig(f||i)===null)continue;break}var C=Xo(i);C!==null&&(n.splice(r,3),r-=3,Lm(C,{pending:!0,data:v,method:i.method,action:f},f,v))}}))}function Tl(n){function r(Q){return wd(Q,n)}Cr!==null&&wd(Cr,n),Nr!==null&&wd(Nr,n),Er!==null&&wd(Er,n),tc.forEach(r),nc.forEach(r);for(var i=0;i<Rr.length;i++){var f=Rr[i];f.blockedOn===n&&(f.blockedOn=null)}for(;0<Rr.length&&(i=Rr[0],i.blockedOn===null);)Q1(i),i.blockedOn===null&&Rr.shift();if(i=(n.ownerDocument||n).$$reactFormReplay,i!=null)for(f=0;f<i.length;f+=3){var v=i[f],C=i[f+1],M=v[Ln]||null;if(typeof C=="function")M||Z1(i);else if(M){var q=null;if(C&&C.hasAttribute("formAction")){if(v=C,M=C[Ln]||null)q=M.formAction;else if(Ig(v)!==null)continue}else q=M.action;typeof q=="function"?i[f+1]=q:(i.splice(f,3),f-=3),Z1(i)}}}function J1(){function n(C){C.canIntercept&&C.info==="react-transition"&&C.intercept({handler:function(){return new Promise(function(M){return v=M})},focusReset:"manual",scroll:"manual"})}function r(){v!==null&&(v(),v=null),f||setTimeout(i,20)}function i(){if(!f&&!navigation.transition){var C=navigation.currentEntry;C&&C.url!=null&&navigation.navigate(C.url,{state:C.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,v=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(i,100),function(){f=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),v!==null&&(v(),v=null)}}}function Ug(n){this._internalRoot=n}Sd.prototype.render=Ug.prototype.render=function(n){var r=this._internalRoot;if(r===null)throw Error(o(409));var i=r.current,f=js();V1(i,f,n,r,null,null)},Sd.prototype.unmount=Ug.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var r=n.containerInfo;V1(n.current,2,null,n,null,null),rd(),r[sa]=null}};function Sd(n){this._internalRoot=n}Sd.prototype.unstable_scheduleHydration=function(n){if(n){var r=hn();n={blockedOn:null,target:n,priority:r};for(var i=0;i<Rr.length&&r!==0&&r<Rr[i].priority;i++);Rr.splice(i,0,n),i===0&&Q1(n)}};var ej=t.version;if(ej!=="19.2.7")throw Error(o(527,ej,"19.2.7"));F.findDOMNode=function(n){var r=n._reactInternals;if(r===void 0)throw typeof n.render=="function"?Error(o(188)):(n=Object.keys(n).join(","),Error(o(268,n)));return n=g(r),n=n!==null?h(n):null,n=n===null?null:n.stateNode,n};var jA={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:$,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Cd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cd.isDisabled&&Cd.supportsFiber)try{lt=Cd.inject(jA),Rt=Cd}catch{}}return rc.createRoot=function(n,r){if(!l(n))throw Error(o(299));var i=!1,f="",v=l0,C=i0,M=c0;return r!=null&&(r.unstable_strictMode===!0&&(i=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(v=r.onUncaughtError),r.onCaughtError!==void 0&&(C=r.onCaughtError),r.onRecoverableError!==void 0&&(M=r.onRecoverableError)),r=H1(n,1,!1,null,null,i,f,null,v,C,M,J1),n[sa]=r.current,yg(n),new Ug(r)},rc.hydrateRoot=function(n,r,i){if(!l(n))throw Error(o(299));var f=!1,v="",C=l0,M=i0,q=c0,Q=null;return i!=null&&(i.unstable_strictMode===!0&&(f=!0),i.identifierPrefix!==void 0&&(v=i.identifierPrefix),i.onUncaughtError!==void 0&&(C=i.onUncaughtError),i.onCaughtError!==void 0&&(M=i.onCaughtError),i.onRecoverableError!==void 0&&(q=i.onRecoverableError),i.formState!==void 0&&(Q=i.formState)),r=H1(n,1,!0,r,i??null,f,v,Q,C,M,q,J1),r.context=q1(null),i=r.current,f=js(),f=dt(f),v=mr(f),v.callback=null,gr(i,v,f),i=f,r.current.lanes=i,gn(r,i),la(r),n[sa]=r.current,yg(n),new Sd(r)},rc.version="19.2.7",rc}var uj;function OA(){if(uj)return qg.exports;uj=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),qg.exports=MA(),qg.exports}var zA=OA();const DA=tb(zA);/**
|
|
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 nb=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,dS=/^[\\/]{2}/;function PA(e,t){return t+e.replace(/\\/g,"/")}var dj="popstate";function fj(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function LA(e={}){function t(o,l){let c=l.state?.masked,{pathname:d,search:p,hash:m}=c||o.location;return ux("",{pathname:d,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 a(o,l){return typeof l=="string"?l:Bc(l)}return BA(t,a,null,e)}function rn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Hs(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function IA(){return Math.random().toString(36).substring(2,10)}function pj(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 ux(e,t,a=null,o,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?oi(t):t,state:a,key:t&&t.key||o||IA(),mask:l}}function Bc({pathname:e="/",search:t="",hash:a=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),a&&a!=="#"&&(e+=a.charAt(0)==="#"?a:"#"+a),e}function oi(e){let t={};if(e){let a=e.indexOf("#");a>=0&&(t.hash=e.substring(a),e=e.substring(0,a));let o=e.indexOf("?");o>=0&&(t.search=e.substring(o),e=e.substring(0,o)),e&&(t.pathname=e)}return t}function BA(e,t,a,o={}){let{window:l=document.defaultView,v5Compat:c=!1}=o,d=l.history,p="POP",m=null,g=h();g==null&&(g=0,d.replaceState({...d.state,idx:g},""));function h(){return(d.state||{idx:null}).idx}function b(){p="POP";let w=h(),S=w==null?null:w-g;g=w,m&&m({action:p,location:y.location,delta:S})}function _(w,S){p="PUSH";let k=fj(w)?w:ux(y.location,w,S);g=h()+1;let E=pj(k,g),R=y.createHref(k.mask||k);try{d.pushState(E,"",R)}catch(A){if(A instanceof DOMException&&A.name==="DataCloneError")throw A;l.location.assign(R)}c&&m&&m({action:p,location:y.location,delta:1})}function j(w,S){p="REPLACE";let k=fj(w)?w:ux(y.location,w,S);g=h();let E=pj(k,g),R=y.createHref(k.mask||k);d.replaceState(E,"",R),c&&m&&m({action:p,location:y.location,delta:0})}function N(w){return UA(l,w)}let y={get action(){return p},get location(){return e(l,d)},listen(w){if(m)throw new Error("A history only accepts one active listener");return l.addEventListener(dj,b),m=w,()=>{l.removeEventListener(dj,b),m=null}},createHref(w){return t(l,w)},createURL:N,encodeLocation(w){let S=N(w);return{pathname:S.pathname,search:S.search,hash:S.hash}},push:_,replace:j,go(w){return d.go(w)}};return y}function UA(e,t,a=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),rn(o,"No window.location.(origin|href) available to create URL");let l=typeof t=="string"?t:Bc(t);return l=l.replace(/ $/,"%20"),!a&&dS.test(l)&&(l=o+l),new URL(l,o)}function fS(e,t,a="/"){return $A(e,t,a,!1)}function $A(e,t,a,o,l){let c=typeof t=="string"?oi(t):t,d=er(c.pathname||"/",a);if(d==null)return null;let p=HA(e),m=null,g=JA(d);for(let h=0;m==null&&h<p.length;++h)m=ZA(p[h],g,o);return m}function HA(e){let t=pS(e);return qA(t),t}function pS(e,t=[],a=[],o="",l=!1){let c=(d,p,m=l,g)=>{let h={relativePath:g===void 0?d.path||"":g,caseSensitive:d.caseSensitive===!0,childrenIndex:p,route:d};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(o)&&m)return;rn(h.relativePath.startsWith(o),`Absolute route path "${h.relativePath}" nested under path "${o}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(o.length)}let b=Ws([o,h.relativePath]),_=a.concat(h);d.children&&d.children.length>0&&(rn(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${b}".`),pS(d.children,t,_,b,m)),!(d.path==null&&!d.index)&&t.push({path:b,score:QA(b,d.index),routesMeta:_.map((j,N)=>{let[y,w]=hS(j.relativePath,j.caseSensitive,N===_.length-1);return{...j,matcher:y,compiledParams:w}})})};return e.forEach((d,p)=>{if(d.path===""||!d.path?.includes("?"))c(d,p);else for(let m of mS(d.path))c(d,p,!0,m)}),t}function mS(e){let t=e.split("/");if(t.length===0)return[];let[a,...o]=t,l=a.endsWith("?"),c=a.replace(/\?$/,"");if(o.length===0)return l?[c,""]:[c];let d=mS(o.join("/")),p=[];return p.push(...d.map(m=>m===""?c:[c,m].join("/"))),l&&p.push(...d),p.map(m=>e.startsWith("/")&&m===""?"/":m)}function qA(e){e.sort((t,a)=>t.score!==a.score?a.score-t.score:WA(t.routesMeta.map(o=>o.childrenIndex),a.routesMeta.map(o=>o.childrenIndex)))}var VA=/^:[\w-]+$/,FA=3,GA=2,YA=1,KA=10,XA=-2,mj=e=>e==="*";function QA(e,t){let a=e.split("/"),o=a.length;return a.some(mj)&&(o+=XA),t&&(o+=GA),a.filter(l=>!mj(l)).reduce((l,c)=>l+(VA.test(c)?FA:c===""?YA:KA),o)}function WA(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 ZA(e,t,a=!1){let{routesMeta:o}=e,l={},c="/",d=[];for(let p=0;p<o.length;++p){let m=o[p],g=p===o.length-1,h=c==="/"?t:t.slice(c.length)||"/",b={path:m.relativePath,caseSensitive:m.caseSensitive,end:g},_=m.matcher&&m.compiledParams?gS(b,h,m.matcher,m.compiledParams):ff(b,h),j=m.route;if(!_&&g&&a&&!o[o.length-1].route.index&&(_=ff({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},h)),!_)return null;Object.assign(l,_.params),d.push({params:l,pathname:Ws([c,_.pathname]),pathnameBase:n5(Ws([c,_.pathnameBase])),route:j}),_.pathnameBase!=="/"&&(c=Ws([c,_.pathnameBase]))}return d}function ff(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,o]=hS(e.path,e.caseSensitive,e.end);return gS(e,t,a,o)}function gS(e,t,a,o){let l=t.match(a);if(!l)return null;let c=l[0],d=c.replace(/(.)\/+$/,"$1"),p=l.slice(1);return{params:o.reduce((g,{paramName:h,isOptional:b},_)=>{if(h==="*"){let N=p[_]||"";d=c.slice(0,c.length-N.length).replace(/(.)\/+$/,"$1")}const j=p[_];return b&&!j?g[h]=void 0:g[h]=(j||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:d,pattern:e}}function hS(e,t=!1,a=!0){Hs(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,(d,p,m,g,h)=>{if(o.push({paramName:p,isOptional:m!=null}),m){let b=h.charAt(g+d.length);return b&&b!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,t?void 0:"i"),o]}function JA(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Hs(!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 er(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let a=t.endsWith("/")?t.length-1:t.length,o=e.charAt(a);return o&&o!=="/"?null:e.slice(a)||"/"}function e5(e,t="/"){let{pathname:a,search:o="",hash:l=""}=typeof e=="string"?oi(e):e,c;return a?(a=xS(a),a.startsWith("/")?c=gj(a.substring(1),"/"):c=gj(a,t)):c=t,{pathname:c,search:s5(o),hash:a5(l)}}function gj(e,t){let a=pf(t).split("/");return e.split("/").forEach(l=>{l===".."?a.length>1&&a.pop():l!=="."&&a.push(l)}),a.length>1?a.join("/"):"/"}function Yg(e,t,a,o){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${a}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function t5(e){return e.filter((t,a)=>a===0||t.route.path&&t.route.path.length>0)}function sb(e){let t=t5(e);return t.map((a,o)=>o===t.length-1?a.pathname:a.pathnameBase)}function qf(e,t,a,o=!1){let l;typeof e=="string"?l=oi(e):(l={...e},rn(!l.pathname||!l.pathname.includes("?"),Yg("?","pathname","search",l)),rn(!l.pathname||!l.pathname.includes("#"),Yg("#","pathname","hash",l)),rn(!l.search||!l.search.includes("#"),Yg("#","search","hash",l)));let c=e===""||l.pathname==="",d=c?"/":l.pathname,p;if(d==null)p=a;else{let b=t.length-1;if(!o&&d.startsWith("..")){let _=d.split("/");for(;_[0]==="..";)_.shift(),b-=1;l.pathname=_.join("/")}p=b>=0?t[b]:"/"}let m=e5(l,p),g=d&&d!=="/"&&d.endsWith("/"),h=(c||d===".")&&a.endsWith("/");return!m.pathname.endsWith("/")&&(g||h)&&(m.pathname+="/"),m}var xS=e=>e.replace(/[\\/]{2,}/g,"/"),Ws=e=>xS(e.join("/")),pf=e=>e.replace(/\/+$/,""),n5=e=>pf(e).replace(/^\/*/,"/"),s5=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,a5=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,r5=class{constructor(e,t,a,o=!1){this.status=e,this.statusText=t||"",this.internal=o,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}};function o5(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function l5(e){let t=e.map(a=>a.route.path).filter(Boolean);return Ws(t)||"/"}var bS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function _S(e,t){let a=e;if(typeof a!="string"||!nb.test(a))return{absoluteURL:void 0,isExternal:!1,to:a};let o=a,l=!1;if(bS)try{let c=new URL(window.location.href),d=dS.test(a)?new URL(PA(a,c.protocol)):new URL(a),p=er(d.pathname,t);d.origin===c.origin&&p!=null?a=p+d.search+d.hash:l=!0}catch{Hs(!1,`<Link to="${a}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:l,to:a}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var vS=["POST","PUT","PATCH","DELETE"];new Set(vS);var i5=["GET",...vS];new Set(i5);var c5=["about:","blob:","chrome:","chrome-untrusted:","content:","data:","devtools:","file:","filesystem:","javascript:"];function u5(e){try{return c5.includes(new URL(e).protocol)}catch{return!1}}var li=x.createContext(null);li.displayName="DataRouter";var Vf=x.createContext(null);Vf.displayName="DataRouterState";var yS=x.createContext(!1);function d5(){return x.useContext(yS)}var jS=x.createContext({isTransitioning:!1});jS.displayName="ViewTransition";var f5=x.createContext(new Map);f5.displayName="Fetchers";var p5=x.createContext(null);p5.displayName="Await";var ks=x.createContext(null);ks.displayName="Navigation";var Zc=x.createContext(null);Zc.displayName="Location";var Js=x.createContext({outlet:null,matches:[],isDataRoute:!1});Js.displayName="Route";var ab=x.createContext(null);ab.displayName="RouteError";var wS="REACT_ROUTER_ERROR",m5="REDIRECT",g5="ROUTE_ERROR_RESPONSE";function h5(e){if(e.startsWith(`${wS}:${m5}:{`))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 x5(e){if(e.startsWith(`${wS}:${g5}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t=="object"&&t&&typeof t.status=="number"&&typeof t.statusText=="string")return new r5(t.status,t.statusText,t.data)}catch{}}function b5(e,{relative:t}={}){rn(ii(),"useHref() may be used only in the context of a <Router> component.");let{basename:a,navigator:o}=x.useContext(ks),{hash:l,pathname:c,search:d}=Jc(e,{relative:t}),p=c;return a!=="/"&&(p=c==="/"?a:Ws([a,c])),o.createHref({pathname:p,search:d,hash:l})}function ii(){return x.useContext(Zc)!=null}function ts(){return rn(ii(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Zc).location}var kS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function SS(e){x.useContext(ks).static||x.useLayoutEffect(e)}function Pn(){let{isDataRoute:e}=x.useContext(Js);return e?A5():_5()}function _5(){rn(ii(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(li),{basename:t,navigator:a}=x.useContext(ks),{matches:o}=x.useContext(Js),{pathname:l}=ts(),c=JSON.stringify(sb(o)),d=x.useRef(!1);return SS(()=>{d.current=!0}),x.useCallback((m,g={})=>{if(Hs(d.current,kS),!d.current)return;if(typeof m=="number"){a.go(m);return}let h=qf(m,JSON.parse(c),l,g.relative==="path");e==null&&t!=="/"&&(h.pathname=h.pathname==="/"?t:Ws([t,h.pathname])),(g.replace?a.replace:a.push)(h,g.state,g)},[t,a,c,l,e])}x.createContext(null);function CS(){let{matches:e}=x.useContext(Js);return e[e.length-1]?.params??{}}function Jc(e,{relative:t}={}){let{matches:a}=x.useContext(Js),{pathname:o}=ts(),l=JSON.stringify(sb(a));return x.useMemo(()=>qf(e,JSON.parse(l),o,t==="path"),[e,l,o,t])}function v5(e,t){return NS(e,t)}function NS(e,t,a){rn(ii(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(ks),{matches:l}=x.useContext(Js),c=l[l.length-1],d=c?c.params:{},p=c?c.pathname:"/",m=c?c.pathnameBase:"/",g=c&&c.route;{let w=g&&g.path||"";RS(p,!g||w.endsWith("*")||w.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${w}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
59
|
+
|
|
60
|
+
Please change the parent <Route path="${w}"> to <Route path="${w==="/"?"*":`${w}/*`}">.`)}let h=ts(),b;if(t){let w=typeof t=="string"?oi(t):t;rn(m==="/"||w.pathname?.startsWith(m),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${w.pathname}" was given in the \`location\` prop.`),b=w}else b=h;let _=b.pathname||"/",j=_;if(m!=="/"){let w=m.replace(/^\//,"").split("/");j="/"+_.replace(/^\//,"").split("/").slice(w.length).join("/")}let N=a&&a.state.matches.length?a.state.matches.map(w=>Object.assign(w,{route:a.manifest[w.route.id]||w.route})):fS(e,{pathname:j});Hs(g||N!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),Hs(N==null||N[N.length-1].route.element!==void 0||N[N.length-1].route.Component!==void 0||N[N.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=S5(N&&N.map(w=>Object.assign({},w,{params:Object.assign({},d,w.params),pathname:Ws([m,o.encodeLocation?o.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?m:Ws([m,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),l,a);return t&&y?x.createElement(Zc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...b},navigationType:"POP"}},y):y}function y5(){let e=T5(),t=o5(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),a=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:o},c={padding:"2px 4px",backgroundColor:o},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=x.createElement(x.Fragment,null,x.createElement("p",null,"💿 Hey developer 👋"),x.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",x.createElement("code",{style:c},"ErrorBoundary")," or"," ",x.createElement("code",{style:c},"errorElement")," prop on your route.")),x.createElement(x.Fragment,null,x.createElement("h2",null,"Unexpected Application Error!"),x.createElement("h3",{style:{fontStyle:"italic"}},t),a?x.createElement("pre",{style:l},a):null,d)}var j5=x.createElement(y5,null),ES=class extends x.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const a=x5(e.digest);a&&(e=a)}let t=e!==void 0?x.createElement(Js.Provider,{value:this.props.routeContext},x.createElement(ab.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(w5,{error:e},t):t}};ES.contextType=yS;var Kg=new WeakMap;function w5({children:e,error:t}){let{basename:a}=x.useContext(ks);if(typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){let o=h5(t.digest);if(o){let l=Kg.get(t);if(l)throw l;let c=_S(o.location,a),d=c.absoluteURL||c.to;if(u5(d))throw new Error("Invalid redirect location");if(bS&&!Kg.get(t))if(c.isExternal||o.reloadDocument)window.location.href=d;else{const p=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:o.replace}));throw Kg.set(t,p),p}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${d}`})}}return e}function k5({routeContext:e,match:t,children:a}){let o=x.useContext(li);return o&&o.static&&o.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=t.route.id),x.createElement(Js.Provider,{value:e},a)}function S5(e,t=[],a){let o=a?.state;if(e==null){if(!o)return null;if(o.errors)e=o.matches;else if(t.length===0&&!o.initialized&&o.matches.length>0)e=o.matches;else return null}let l=e,c=o?.errors;if(c!=null){let h=l.findIndex(b=>b.route.id&&c?.[b.route.id]!==void 0);rn(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),l=l.slice(0,Math.min(l.length,h+1))}let d=!1,p=-1;if(a&&o){d=o.renderFallback;for(let h=0;h<l.length;h++){let b=l[h];if((b.route.HydrateFallback||b.route.hydrateFallbackElement)&&(p=h),b.route.id){let{loaderData:_,errors:j}=o,N=b.route.loader&&!_.hasOwnProperty(b.route.id)&&(!j||j[b.route.id]===void 0);if(b.route.lazy||N){a.isStatic&&(d=!0),p>=0?l=l.slice(0,p+1):l=[l[0]];break}}}}let m=a?.onError,g=o&&m?(h,b)=>{m(h,{location:o.location,params:o.matches?.[0]?.params??{},pattern:l5(o.matches),errorInfo:b})}:void 0;return l.reduceRight((h,b,_)=>{let j,N=!1,y=null,w=null;o&&(j=c&&b.route.id?c[b.route.id]:void 0,y=b.route.errorElement||j5,d&&(p<0&&_===0?(RS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,w=null):p===_&&(N=!0,w=b.route.hydrateFallbackElement||null)));let S=t.concat(l.slice(0,_+1)),k=()=>{let E;return j?E=y:N?E=w:b.route.Component?E=x.createElement(b.route.Component,null):b.route.element?E=b.route.element:E=h,x.createElement(k5,{match:b,routeContext:{outlet:h,matches:S,isDataRoute:o!=null},children:E})};return o&&(b.route.ErrorBoundary||b.route.errorElement||_===0)?x.createElement(ES,{location:o.location,revalidation:o.revalidation,component:y,error:j,children:k(),routeContext:{outlet:null,matches:S,isDataRoute:!0},onError:g}):k()},null)}function rb(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function C5(e){let t=x.useContext(li);return rn(t,rb(e)),t}function N5(e){let t=x.useContext(Vf);return rn(t,rb(e)),t}function E5(e){let t=x.useContext(Js);return rn(t,rb(e)),t}function ob(e){let t=E5(e),a=t.matches[t.matches.length-1];return rn(a.route.id,`${e} can only be used on routes that contain a unique "id"`),a.route.id}function R5(){return ob("useRouteId")}function T5(){let e=x.useContext(ab),t=N5("useRouteError"),a=ob("useRouteError");return e!==void 0?e:t.errors?.[a]}function A5(){let{router:e}=C5("useNavigate"),t=ob("useNavigate"),a=x.useRef(!1);return SS(()=>{a.current=!0}),x.useCallback(async(l,c={})=>{Hs(a.current,kS),a.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:t,...c}))},[e,t])}var hj={};function RS(e,t,a){!t&&!hj[e]&&(hj[e]=!0,Hs(!1,a))}x.memo(M5);function M5({routes:e,manifest:t,future:a,state:o,isStatic:l,onError:c}){return NS(e,void 0,{manifest:t,state:o,isStatic:l,onError:c})}function O5({to:e,replace:t,state:a,relative:o}){rn(ii(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=x.useContext(ks);Hs(!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(Js),{pathname:d}=ts(),p=Pn(),m=qf(e,sb(c),d,o==="path"),g=JSON.stringify(m);return x.useEffect(()=>{p(JSON.parse(g),{replace:t,state:a,relative:o})},[p,g,o,t,a]),null}function Dt(e){rn(!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 z5({basename:e="/",children:t=null,location:a,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:d}){rn(!ii(),"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:d,future:{}}),[p,l,c,d]);typeof a=="string"&&(a=oi(a));let{pathname:g="/",search:h="",hash:b="",state:_=null,key:j="default",mask:N}=a,y=x.useMemo(()=>{let w=er(g,p);return w==null?null:{location:{pathname:w,search:h,hash:b,state:_,key:j,mask:N},navigationType:o}},[p,g,h,b,_,j,o,N]);return Hs(y!=null,`<Router basename="${p}"> is not able to match the URL "${g}${h}${b}" because it does not start with the basename, so the <Router> won't render anything.`),y==null?null:x.createElement(ks.Provider,{value:m},x.createElement(Zc.Provider,{children:t,value:y}))}function TS({children:e,location:t}){return v5(dx(e),t)}function dx(e,t=[]){let a=[];return x.Children.forEach(e,(o,l)=>{if(!x.isValidElement(o))return;let c=[...t,l];if(o.type===x.Fragment){a.push.apply(a,dx(o.props.children,c));return}rn(o.type===Dt,`[${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>`),rn(!o.props.index||!o.props.children,"An index route cannot have child routes.");let d={id:o.props.id||c.join("-"),caseSensitive:o.props.caseSensitive,element:o.props.element,Component:o.props.Component,index:o.props.index,path:o.props.path,middleware:o.props.middleware,loader:o.props.loader,action:o.props.action,hydrateFallbackElement:o.props.hydrateFallbackElement,HydrateFallback:o.props.HydrateFallback,errorElement:o.props.errorElement,ErrorBoundary:o.props.ErrorBoundary,hasErrorBoundary:o.props.hasErrorBoundary===!0||o.props.ErrorBoundary!=null||o.props.errorElement!=null,shouldRevalidate:o.props.shouldRevalidate,handle:o.props.handle,lazy:o.props.lazy};o.props.children&&(d.children=dx(o.props.children,c)),a.push(d)}),a}var tf="get",nf="application/x-www-form-urlencoded";function Ff(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function D5(e){return Ff(e)&&e.tagName.toLowerCase()==="button"}function P5(e){return Ff(e)&&e.tagName.toLowerCase()==="form"}function L5(e){return Ff(e)&&e.tagName.toLowerCase()==="input"}function I5(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function B5(e,t){return e.button===0&&(!t||t==="_self")&&!I5(e)}function fx(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,a)=>{let o=e[a];return t.concat(Array.isArray(o)?o.map(l=>[a,l]):[[a,o]])},[]))}function U5(e,t){let a=fx(e);return t&&t.forEach((o,l)=>{a.has(l)||t.getAll(l).forEach(c=>{a.append(l,c)})}),a}var Nd=null;function $5(){if(Nd===null)try{new FormData(document.createElement("form"),0),Nd=!1}catch{Nd=!0}return Nd}var H5=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Xg(e){return e!=null&&!H5.has(e)?(Hs(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${nf}"`),null):e}function q5(e,t){let a,o,l,c,d;if(P5(e)){let p=e.getAttribute("action");o=p?er(p,t):null,a=e.getAttribute("method")||tf,l=Xg(e.getAttribute("enctype"))||nf,c=new FormData(e)}else if(D5(e)||L5(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?er(m,t):null,a=e.getAttribute("formmethod")||p.getAttribute("method")||tf,l=Xg(e.getAttribute("formenctype"))||Xg(p.getAttribute("enctype"))||nf,c=new FormData(p,e),!$5()){let{name:g,type:h,value:b}=e;if(h==="image"){let _=g?`${g}.`:"";c.append(`${_}x`,"0"),c.append(`${_}y`,"0")}else g&&c.append(g,b)}}else{if(Ff(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');a=tf,o=null,l=nf,d=e}return c&&l==="text/plain"&&(d=c,c=void 0),{action:o,method:a.toLowerCase(),encType:l,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function lb(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function AS(e,t,a,o){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return a?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${o}`:l.pathname=`${l.pathname}.${o}`:l.pathname==="/"?l.pathname=`_root.${o}`:t&&er(l.pathname,t)==="/"?l.pathname=`${pf(t)}/_root.${o}`:l.pathname=`${pf(l.pathname)}.${o}`,l}async function V5(e,t){if(e.id in t)return t[e.id];try{let a=await import(e.module);return t[e.id]=a,a}catch(a){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(a),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function F5(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 G5(e,t,a){let o=await Promise.all(e.map(async l=>{let c=t.routes[l.route.id];if(c){let d=await V5(c,a);return d.links?d.links():[]}return[]}));return Q5(o.flat(1).filter(F5).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function xj(e,t,a,o,l,c){let d=(m,g)=>a[g]?m.route.id!==a[g].route.id:!0,p=(m,g)=>a[g].pathname!==m.pathname||a[g].route.path?.endsWith("*")&&a[g].params["*"]!==m.params["*"];return c==="assets"?t.filter((m,g)=>d(m,g)||p(m,g)):c==="data"?t.filter((m,g)=>{let h=o.routes[m.route.id];if(!h||!h.hasLoader)return!1;if(d(m,g)||p(m,g))return!0;if(m.route.shouldRevalidate){let b=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:a[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function Y5(e,t,{includeHydrateFallback:a}={}){return K5(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)),a&&l.hydrateFallbackModule&&(c=c.concat(l.hydrateFallbackModule)),l.imports&&(c=c.concat(l.imports)),c}).flat(1))}function K5(e){return[...new Set(e)]}function X5(e){let t={},a=Object.keys(e).sort();for(let o of a)t[o]=e[o];return t}function Q5(e,t){let a=new Set;return new Set(t),e.reduce((o,l)=>{let c=JSON.stringify(X5(l));return a.has(c)||(a.add(c),o.push({key:c,link:l})),o},[])}function ib(){let e=x.useContext(li);return lb(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function W5(){let e=x.useContext(Vf);return lb(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var cb=x.createContext(void 0);cb.displayName="FrameworkContext";function Gf(){let e=x.useContext(cb);return lb(e,"You must render this element inside a <HydratedRouter> element"),e}function Z5(e,t){let a=x.useContext(cb),[o,l]=x.useState(!1),[c,d]=x.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:h,onTouchStart:b}=t,_=x.useRef(null);x.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let y=S=>{S.forEach(k=>{d(k.isIntersecting)})},w=new IntersectionObserver(y,{threshold:.5});return _.current&&w.observe(_.current),()=>{w.disconnect()}}},[e]),x.useEffect(()=>{if(o){let y=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(y)}}},[o]);let j=()=>{l(!0)},N=()=>{l(!1),d(!1)};return a?e!=="intent"?[c,_,{}]:[c,_,{onFocus:oc(p,j),onBlur:oc(m,N),onMouseEnter:oc(g,j),onMouseLeave:oc(h,N),onTouchStart:oc(b,j)}]:[!1,_,{}]}function oc(e,t){return a=>{e&&e(a),a.defaultPrevented||t(a)}}function J5({page:e,...t}){let a=d5(),{nonce:o}=Gf(),{router:l}=ib(),c=x.useMemo(()=>fS(l.routes,e,l.basename),[l.routes,e,l.basename]);return c?(t.nonce==null&&o&&(t={...t,nonce:o}),a?x.createElement(tM,{page:e,matches:c,...t}):x.createElement(nM,{page:e,matches:c,...t})):null}function eM(e){let{manifest:t,routeModules:a}=Gf(),[o,l]=x.useState([]);return x.useEffect(()=>{let c=!1;return G5(e,t,a).then(d=>{c||l(d)}),()=>{c=!0}},[e,t,a]),o}function tM({page:e,matches:t,...a}){let o=ts(),{future:l}=Gf(),{basename:c}=ib(),d=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let p=AS(e,c,l.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,g=[];for(let h of t)typeof h.route.shouldRevalidate=="function"?m=!0:g.push(h.route.id);return m&&g.length>0&&p.searchParams.set("_routes",g.join(",")),[p.pathname+p.search]},[c,l.v8_trailingSlashAwareDataRequests,e,o,t]);return x.createElement(x.Fragment,null,d.map(p=>x.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...a})))}function nM({page:e,matches:t,...a}){let o=ts(),{future:l,manifest:c,routeModules:d}=Gf(),{basename:p}=ib(),{loaderData:m,matches:g}=W5(),h=x.useMemo(()=>xj(e,t,g,c,o,"data"),[e,t,g,c,o]),b=x.useMemo(()=>xj(e,t,g,c,o,"assets"),[e,t,g,c,o]),_=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let y=new Set,w=!1;if(t.forEach(k=>{let E=c.routes[k.route.id];!E||!E.hasLoader||(!h.some(R=>R.route.id===k.route.id)&&k.route.id in m&&d[k.route.id]?.shouldRevalidate||E.hasClientLoader?w=!0:y.add(k.route.id))}),y.size===0)return[];let S=AS(e,p,l.v8_trailingSlashAwareDataRequests,"data");return w&&y.size>0&&S.searchParams.set("_routes",t.filter(k=>y.has(k.route.id)).map(k=>k.route.id).join(",")),[S.pathname+S.search]},[p,l.v8_trailingSlashAwareDataRequests,m,o,c,h,t,e,d]),j=x.useMemo(()=>Y5(b,c),[b,c]),N=eM(b);return x.createElement(x.Fragment,null,_.map(y=>x.createElement("link",{key:y,rel:"prefetch",as:"fetch",href:y,...a})),j.map(y=>x.createElement("link",{key:y,rel:"modulepreload",href:y,...a})),N.map(({key:y,link:w})=>x.createElement("link",{key:y,nonce:a.nonce,...w,crossOrigin:w.crossOrigin??a.crossOrigin})))}function sM(...e){return t=>{e.forEach(a=>{typeof a=="function"?a(t):a!=null&&(a.current=t)})}}var aM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{aM&&(window.__reactRouterVersion="7.18.1")}catch{}function rM({basename:e,children:t,useTransitions:a,window:o}){let l=x.useRef();l.current==null&&(l.current=LA({window:o,v5Compat:!0}));let c=l.current,[d,p]=x.useState({action:c.action,location:c.location}),m=x.useCallback(g=>{a===!1?p(g):x.startTransition(()=>p(g))},[a]);return x.useLayoutEffect(()=>c.listen(m),[c,m]),x.createElement(z5,{basename:e,children:t,location:d.location,navigationType:d.action,navigator:c,useTransitions:a})}var Yf=x.forwardRef(function({onClick:t,discover:a="render",prefetch:o="none",relative:l,reloadDocument:c,replace:d,mask:p,state:m,target:g,to:h,preventScrollReset:b,viewTransition:_,defaultShouldRevalidate:j,...N},y){let{basename:w,navigator:S,useTransitions:k}=x.useContext(ks),E=typeof h=="string"&&nb.test(h),R=_S(h,w);h=R.to;let A=b5(h,{relative:l}),T=ts(),z=null;if(p){let H=qf(p,[],T.mask?T.mask.pathname:"/",!0);w!=="/"&&(H.pathname=H.pathname==="/"?w:Ws([w,H.pathname])),z=S.createHref(H)}let[O,B,P]=Z5(o,N),U=iM(h,{replace:d,mask:p,state:m,target:g,preventScrollReset:b,relative:l,viewTransition:_,defaultShouldRevalidate:j,useTransitions:k});function D(H){t&&t(H),H.defaultPrevented||U(H)}let L=!(R.isExternal||c),V=x.createElement("a",{...N,...P,href:(L?z:void 0)||R.absoluteURL||A,onClick:L?D:t,ref:sM(y,B),target:g,"data-discover":!E&&a==="render"?"true":void 0});return O&&!E?x.createElement(x.Fragment,null,V,x.createElement(J5,{page:A})):V});Yf.displayName="Link";var mf=x.forwardRef(function({"aria-current":t="page",caseSensitive:a=!1,className:o="",end:l=!1,style:c,to:d,viewTransition:p,children:m,...g},h){let b=Jc(d,{relative:g.relative}),_=ts(),j=x.useContext(Vf),{navigator:N,basename:y}=x.useContext(ks),w=j!=null&&pM(b)&&p===!0,S=N.encodeLocation?N.encodeLocation(b).pathname:b.pathname,k=_.pathname,E=j&&j.navigation&&j.navigation.location?j.navigation.location.pathname:null;a||(k=k.toLowerCase(),E=E?E.toLowerCase():null,S=S.toLowerCase()),E&&y&&(E=er(E,y)||E);const R=S!=="/"&&S.endsWith("/")?S.length-1:S.length;let A=k===S||!l&&k.startsWith(S)&&k.charAt(R)==="/",T=E!=null&&(E===S||!l&&E.startsWith(S)&&E.charAt(S.length)==="/"),z={isActive:A,isPending:T,isTransitioning:w},O=A?t:void 0,B;typeof o=="function"?B=o(z):B=[o,A?"active":null,T?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let P=typeof c=="function"?c(z):c;return x.createElement(Yf,{...g,"aria-current":O,className:B,ref:h,style:P,to:d,viewTransition:p},typeof m=="function"?m(z):m)});mf.displayName="NavLink";var oM=x.forwardRef(({discover:e="render",fetcherKey:t,navigate:a,reloadDocument:o,replace:l,state:c,method:d=tf,action:p,onSubmit:m,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:_,...j},N)=>{let{useTransitions:y}=x.useContext(ks),w=dM(),S=fM(p,{relative:g}),k=d.toLowerCase()==="get"?"get":"post",E=typeof p=="string"&&nb.test(p),R=A=>{if(m&&m(A),A.defaultPrevented)return;A.preventDefault();let T=A.nativeEvent.submitter,z=T?.getAttribute("formmethod")||d,O=()=>w(T||A.currentTarget,{fetcherKey:t,method:z,navigate:a,replace:l,state:c,relative:g,preventScrollReset:h,viewTransition:b,defaultShouldRevalidate:_});y&&a!==!1?x.startTransition(()=>O()):O()};return x.createElement("form",{ref:N,method:k,action:S,onSubmit:o?m:R,...j,"data-discover":!E&&e==="render"?"true":void 0})});oM.displayName="Form";function lM(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function MS(e){let t=x.useContext(li);return rn(t,lM(e)),t}function iM(e,{target:t,replace:a,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:p,defaultShouldRevalidate:m,useTransitions:g}={}){let h=Pn(),b=ts(),_=Jc(e,{relative:d});return x.useCallback(j=>{if(B5(j,t)){j.preventDefault();let N=a!==void 0?a:Bc(b)===Bc(_),y=()=>h(e,{replace:N,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:p,defaultShouldRevalidate:m});g?x.startTransition(()=>y()):y()}},[b,h,_,a,o,l,t,e,c,d,p,m,g])}function $o(e){Hs(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(fx(e)),a=x.useRef(!1),o=ts(),l=x.useMemo(()=>U5(o.search,a.current?null:t.current),[o.search]),c=Pn(),d=x.useCallback((p,m)=>{const g=fx(typeof p=="function"?p(new URLSearchParams(l)):p);a.current=!0,c("?"+g,m)},[c,l]);return[l,d]}var cM=0,uM=()=>`__${String(++cM)}__`;function dM(){let{router:e}=MS("useSubmit"),{basename:t}=x.useContext(ks),a=R5(),o=e.fetch,l=e.navigate;return x.useCallback(async(c,d={})=>{let{action:p,method:m,encType:g,formData:h,body:b}=q5(c,t);if(d.navigate===!1){let _=d.fetcherKey||uM();await o(_,a,d.action||p,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:b,formMethod:d.method||m,formEncType:d.encType||g,flushSync:d.flushSync})}else await l(d.action||p,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:b,formMethod:d.method||m,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:a,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,l,t,a])}function fM(e,{relative:t}={}){let{basename:a}=x.useContext(ks),o=x.useContext(Js);rn(o,"useFormAction must be used inside a RouteContext");let[l]=o.matches.slice(-1),c={...Jc(e||".",{relative:t})},d=ts();if(e==null){c.search=d.search;let p=new URLSearchParams(c.search),m=p.getAll("index");if(m.some(h=>h==="")){p.delete("index"),m.filter(b=>b).forEach(b=>p.append("index",b));let h=p.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&l.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),a!=="/"&&(c.pathname=c.pathname==="/"?a:Ws([a,c.pathname])),Bc(c)}function pM(e,{relative:t}={}){let a=x.useContext(jS);rn(a!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=MS("useViewTransitionState"),l=Jc(e,{relative:t});if(!a.isTransitioning)return!1;let c=er(a.currentLocation.pathname,o)||a.currentLocation.pathname,d=er(a.nextLocation.pathname,o)||a.nextLocation.pathname;return ff(l.pathname,d)!=null||ff(l.pathname,c)!=null}var qs=uS();/**
|
|
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 mM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),OS=(...e)=>e.filter((t,a,o)=>!!t&&t.trim()!==""&&o.indexOf(t)===a).join(" ").trim();/**
|
|
66
|
+
* @license lucide-react v0.469.0 - ISC
|
|
67
|
+
*
|
|
68
|
+
* This source code is licensed under the ISC license.
|
|
69
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
70
|
+
*/var gM={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 hM=x.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:a=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...p},m)=>x.createElement("svg",{ref:m,...gM,width:t,height:t,stroke:e,strokeWidth:o?Number(a)*24/Number(t):a,className:OS("lucide",l),...p},[...d.map(([g,h])=>x.createElement(g,h)),...Array.isArray(c)?c:[c]]));/**
|
|
76
|
+
* @license lucide-react v0.469.0 - ISC
|
|
77
|
+
*
|
|
78
|
+
* This source code is licensed under the ISC license.
|
|
79
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
80
|
+
*/const xe=(e,t)=>{const a=x.forwardRef(({className:o,...l},c)=>x.createElement(hM,{ref:c,iconNode:t,className:OS(`lucide-${mM(e)}`,o),...l}));return a.displayName=`${e}`,a};/**
|
|
81
|
+
* @license lucide-react v0.469.0 - ISC
|
|
82
|
+
*
|
|
83
|
+
* This source code is licensed under the ISC license.
|
|
84
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
85
|
+
*/const ub=xe("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 zS=xe("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 xM=xe("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 DS=xe("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 PS=xe("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 bM=xe("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 _M=xe("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 vM=xe("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 un=xe("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
|
|
126
|
+
* @license lucide-react v0.469.0 - ISC
|
|
127
|
+
*
|
|
128
|
+
* This source code is licensed under the ISC license.
|
|
129
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
130
|
+
*/const yM=xe("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 jM=xe("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 gf=xe("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 LS=xe("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
|
|
146
|
+
* @license lucide-react v0.469.0 - ISC
|
|
147
|
+
*
|
|
148
|
+
* This source code is licensed under the ISC license.
|
|
149
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
150
|
+
*/const wM=xe("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
|
|
151
|
+
* @license lucide-react v0.469.0 - ISC
|
|
152
|
+
*
|
|
153
|
+
* This source code is licensed under the ISC license.
|
|
154
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
155
|
+
*/const kM=xe("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/**
|
|
156
|
+
* @license lucide-react v0.469.0 - ISC
|
|
157
|
+
*
|
|
158
|
+
* This source code is licensed under the ISC license.
|
|
159
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
160
|
+
*/const Hr=xe("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
161
|
+
* @license lucide-react v0.469.0 - ISC
|
|
162
|
+
*
|
|
163
|
+
* This source code is licensed under the ISC license.
|
|
164
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
165
|
+
*/const ms=xe("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
166
|
+
* @license lucide-react v0.469.0 - ISC
|
|
167
|
+
*
|
|
168
|
+
* This source code is licensed under the ISC license.
|
|
169
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
170
|
+
*/const SM=xe("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
171
|
+
* @license lucide-react v0.469.0 - ISC
|
|
172
|
+
*
|
|
173
|
+
* This source code is licensed under the ISC license.
|
|
174
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
175
|
+
*/const Fr=xe("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
176
|
+
* @license lucide-react v0.469.0 - ISC
|
|
177
|
+
*
|
|
178
|
+
* This source code is licensed under the ISC license.
|
|
179
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
180
|
+
*/const db=xe("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
181
|
+
* @license lucide-react v0.469.0 - ISC
|
|
182
|
+
*
|
|
183
|
+
* This source code is licensed under the ISC license.
|
|
184
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
185
|
+
*/const CM=xe("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
|
|
186
|
+
* @license lucide-react v0.469.0 - ISC
|
|
187
|
+
*
|
|
188
|
+
* This source code is licensed under the ISC license.
|
|
189
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
190
|
+
*/const NM=xe("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
191
|
+
* @license lucide-react v0.469.0 - ISC
|
|
192
|
+
*
|
|
193
|
+
* This source code is licensed under the ISC license.
|
|
194
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
195
|
+
*/const fb=xe("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
196
|
+
* @license lucide-react v0.469.0 - ISC
|
|
197
|
+
*
|
|
198
|
+
* This source code is licensed under the ISC license.
|
|
199
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
200
|
+
*/const EM=xe("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
|
|
201
|
+
* @license lucide-react v0.469.0 - ISC
|
|
202
|
+
*
|
|
203
|
+
* This source code is licensed under the ISC license.
|
|
204
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
205
|
+
*/const RM=xe("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
206
|
+
* @license lucide-react v0.469.0 - ISC
|
|
207
|
+
*
|
|
208
|
+
* This source code is licensed under the ISC license.
|
|
209
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
210
|
+
*/const IS=xe("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
211
|
+
* @license lucide-react v0.469.0 - ISC
|
|
212
|
+
*
|
|
213
|
+
* This source code is licensed under the ISC license.
|
|
214
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
215
|
+
*/const TM=xe("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
|
|
216
|
+
* @license lucide-react v0.469.0 - ISC
|
|
217
|
+
*
|
|
218
|
+
* This source code is licensed under the ISC license.
|
|
219
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
220
|
+
*/const BS=xe("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
221
|
+
* @license lucide-react v0.469.0 - ISC
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the ISC license.
|
|
224
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
225
|
+
*/const AM=xe("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
|
226
|
+
* @license lucide-react v0.469.0 - ISC
|
|
227
|
+
*
|
|
228
|
+
* This source code is licensed under the ISC license.
|
|
229
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
230
|
+
*/const MM=xe("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
231
|
+
* @license lucide-react v0.469.0 - ISC
|
|
232
|
+
*
|
|
233
|
+
* This source code is licensed under the ISC license.
|
|
234
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
235
|
+
*/const OM=xe("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
|
|
236
|
+
* @license lucide-react v0.469.0 - ISC
|
|
237
|
+
*
|
|
238
|
+
* This source code is licensed under the ISC license.
|
|
239
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
240
|
+
*/const zM=xe("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/**
|
|
241
|
+
* @license lucide-react v0.469.0 - ISC
|
|
242
|
+
*
|
|
243
|
+
* This source code is licensed under the ISC license.
|
|
244
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
245
|
+
*/const No=xe("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
246
|
+
* @license lucide-react v0.469.0 - ISC
|
|
247
|
+
*
|
|
248
|
+
* This source code is licensed under the ISC license.
|
|
249
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
250
|
+
*/const DM=xe("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
|
|
251
|
+
* @license lucide-react v0.469.0 - ISC
|
|
252
|
+
*
|
|
253
|
+
* This source code is licensed under the ISC license.
|
|
254
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
255
|
+
*/const PM=xe("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
|
|
256
|
+
* @license lucide-react v0.469.0 - ISC
|
|
257
|
+
*
|
|
258
|
+
* This source code is licensed under the ISC license.
|
|
259
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
260
|
+
*/const pb=xe("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
|
|
261
|
+
* @license lucide-react v0.469.0 - ISC
|
|
262
|
+
*
|
|
263
|
+
* This source code is licensed under the ISC license.
|
|
264
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
265
|
+
*/const xa=xe("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
|
|
266
|
+
* @license lucide-react v0.469.0 - ISC
|
|
267
|
+
*
|
|
268
|
+
* This source code is licensed under the ISC license.
|
|
269
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
270
|
+
*/const US=xe("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
|
|
271
|
+
* @license lucide-react v0.469.0 - ISC
|
|
272
|
+
*
|
|
273
|
+
* This source code is licensed under the ISC license.
|
|
274
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
275
|
+
*/const LM=xe("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
276
|
+
* @license lucide-react v0.469.0 - ISC
|
|
277
|
+
*
|
|
278
|
+
* This source code is licensed under the ISC license.
|
|
279
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
280
|
+
*/const IM=xe("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
|
|
281
|
+
* @license lucide-react v0.469.0 - ISC
|
|
282
|
+
*
|
|
283
|
+
* This source code is licensed under the ISC license.
|
|
284
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
285
|
+
*/const mb=xe("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
286
|
+
* @license lucide-react v0.469.0 - ISC
|
|
287
|
+
*
|
|
288
|
+
* This source code is licensed under the ISC license.
|
|
289
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
290
|
+
*/const $S=xe("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
291
|
+
* @license lucide-react v0.469.0 - ISC
|
|
292
|
+
*
|
|
293
|
+
* This source code is licensed under the ISC license.
|
|
294
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
295
|
+
*/const eu=xe("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
296
|
+
* @license lucide-react v0.469.0 - ISC
|
|
297
|
+
*
|
|
298
|
+
* This source code is licensed under the ISC license.
|
|
299
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
300
|
+
*/const gb=xe("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/**
|
|
301
|
+
* @license lucide-react v0.469.0 - ISC
|
|
302
|
+
*
|
|
303
|
+
* This source code is licensed under the ISC license.
|
|
304
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
305
|
+
*/const BM=xe("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
|
|
306
|
+
* @license lucide-react v0.469.0 - ISC
|
|
307
|
+
*
|
|
308
|
+
* This source code is licensed under the ISC license.
|
|
309
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
310
|
+
*/const hf=xe("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/**
|
|
311
|
+
* @license lucide-react v0.469.0 - ISC
|
|
312
|
+
*
|
|
313
|
+
* This source code is licensed under the ISC license.
|
|
314
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
315
|
+
*/const px=xe("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/**
|
|
316
|
+
* @license lucide-react v0.469.0 - ISC
|
|
317
|
+
*
|
|
318
|
+
* This source code is licensed under the ISC license.
|
|
319
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
320
|
+
*/const UM=xe("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
|
|
321
|
+
* @license lucide-react v0.469.0 - ISC
|
|
322
|
+
*
|
|
323
|
+
* This source code is licensed under the ISC license.
|
|
324
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
325
|
+
*/const $M=xe("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/**
|
|
326
|
+
* @license lucide-react v0.469.0 - ISC
|
|
327
|
+
*
|
|
328
|
+
* This source code is licensed under the ISC license.
|
|
329
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
330
|
+
*/const Kf=xe("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
331
|
+
* @license lucide-react v0.469.0 - ISC
|
|
332
|
+
*
|
|
333
|
+
* This source code is licensed under the ISC license.
|
|
334
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
335
|
+
*/const HM=xe("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/**
|
|
336
|
+
* @license lucide-react v0.469.0 - ISC
|
|
337
|
+
*
|
|
338
|
+
* This source code is licensed under the ISC license.
|
|
339
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
340
|
+
*/const HS=xe("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
|
|
341
|
+
* @license lucide-react v0.469.0 - ISC
|
|
342
|
+
*
|
|
343
|
+
* This source code is licensed under the ISC license.
|
|
344
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
345
|
+
*/const mx=xe("FlaskConical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);/**
|
|
346
|
+
* @license lucide-react v0.469.0 - ISC
|
|
347
|
+
*
|
|
348
|
+
* This source code is licensed under the ISC license.
|
|
349
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
350
|
+
*/const qM=xe("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/**
|
|
351
|
+
* @license lucide-react v0.469.0 - ISC
|
|
352
|
+
*
|
|
353
|
+
* This source code is licensed under the ISC license.
|
|
354
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
355
|
+
*/const qS=xe("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/**
|
|
356
|
+
* @license lucide-react v0.469.0 - ISC
|
|
357
|
+
*
|
|
358
|
+
* This source code is licensed under the ISC license.
|
|
359
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
360
|
+
*/const ci=xe("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
|
|
361
|
+
* @license lucide-react v0.469.0 - ISC
|
|
362
|
+
*
|
|
363
|
+
* This source code is licensed under the ISC license.
|
|
364
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
365
|
+
*/const hb=xe("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/**
|
|
366
|
+
* @license lucide-react v0.469.0 - ISC
|
|
367
|
+
*
|
|
368
|
+
* This source code is licensed under the ISC license.
|
|
369
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
370
|
+
*/const VS=xe("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
|
|
371
|
+
* @license lucide-react v0.469.0 - ISC
|
|
372
|
+
*
|
|
373
|
+
* This source code is licensed under the ISC license.
|
|
374
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
375
|
+
*/const VM=xe("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/**
|
|
376
|
+
* @license lucide-react v0.469.0 - ISC
|
|
377
|
+
*
|
|
378
|
+
* This source code is licensed under the ISC license.
|
|
379
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
380
|
+
*/const Xf=xe("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
|
|
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 FM=xe("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"}]]);/**
|
|
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 tu=xe("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"}]]);/**
|
|
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=xe("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"}]]);/**
|
|
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 FS=xe("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
|
|
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 GS=xe("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"}]]);/**
|
|
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 YM=xe("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"}]]);/**
|
|
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 KM=xe("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/**
|
|
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 Kl=xe("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"}]]);/**
|
|
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 XM=xe("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"}]]);/**
|
|
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 QM=xe("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"}]]);/**
|
|
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 gx=xe("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
|
|
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 YS=xe("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
|
|
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 KS=xe("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"}]]);/**
|
|
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 WM=xe("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"}]]);/**
|
|
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 ZM=xe("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"}]]);/**
|
|
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 JM=xe("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"}]]);/**
|
|
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 e3=xe("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"}]]);/**
|
|
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 t3=xe("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"}]]);/**
|
|
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 Ir=xe("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
|
|
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 XS=xe("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
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 QS=xe("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"}]]);/**
|
|
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 n3=xe("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
|
|
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 xb=xe("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"}]]);/**
|
|
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 bb=xe("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"}]]);/**
|
|
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 _b=xe("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"}]]);/**
|
|
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 vb=xe("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"}]]);/**
|
|
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 s3=xe("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
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 a3=xe("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/**
|
|
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 r3=xe("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"}]]);/**
|
|
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 WS=xe("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
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 o3=xe("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
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 l3=xe("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/**
|
|
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 ya=xe("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"}]]);/**
|
|
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 yb=xe("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
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 i3=xe("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"}]]);/**
|
|
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 It=xe("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
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 Qf=xe("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"}]]);/**
|
|
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 c3=xe("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"}]]);/**
|
|
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 u3=xe("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/**
|
|
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 Vs=xe("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"}]]);/**
|
|
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 ui=xe("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"}]]);/**
|
|
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 Qg=xe("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/**
|
|
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 Wg=xe("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/**
|
|
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 nu=xe("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"}]]);/**
|
|
601
|
+
* @license lucide-react v0.469.0 - ISC
|
|
602
|
+
*
|
|
603
|
+
* This source code is licensed under the ISC license.
|
|
604
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
605
|
+
*/const jb=xe("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"}]]);/**
|
|
606
|
+
* @license lucide-react v0.469.0 - ISC
|
|
607
|
+
*
|
|
608
|
+
* This source code is licensed under the ISC license.
|
|
609
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
610
|
+
*/const Ac=xe("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
611
|
+
* @license lucide-react v0.469.0 - ISC
|
|
612
|
+
*
|
|
613
|
+
* This source code is licensed under the ISC license.
|
|
614
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
615
|
+
*/const ja=xe("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"}]]);/**
|
|
616
|
+
* @license lucide-react v0.469.0 - ISC
|
|
617
|
+
*
|
|
618
|
+
* This source code is licensed under the ISC license.
|
|
619
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
620
|
+
*/const ZS=xe("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"}]]);/**
|
|
621
|
+
* @license lucide-react v0.469.0 - ISC
|
|
622
|
+
*
|
|
623
|
+
* This source code is licensed under the ISC license.
|
|
624
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
625
|
+
*/const d3=xe("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"}]]);/**
|
|
626
|
+
* @license lucide-react v0.469.0 - ISC
|
|
627
|
+
*
|
|
628
|
+
* This source code is licensed under the ISC license.
|
|
629
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
630
|
+
*/const Wf=xe("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"}]]);/**
|
|
631
|
+
* @license lucide-react v0.469.0 - ISC
|
|
632
|
+
*
|
|
633
|
+
* This source code is licensed under the ISC license.
|
|
634
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
635
|
+
*/const f3=xe("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
|
|
636
|
+
* @license lucide-react v0.469.0 - ISC
|
|
637
|
+
*
|
|
638
|
+
* This source code is licensed under the ISC license.
|
|
639
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
640
|
+
*/const p3=xe("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
|
|
641
|
+
* @license lucide-react v0.469.0 - ISC
|
|
642
|
+
*
|
|
643
|
+
* This source code is licensed under the ISC license.
|
|
644
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
645
|
+
*/const m3=xe("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
|
|
646
|
+
* @license lucide-react v0.469.0 - ISC
|
|
647
|
+
*
|
|
648
|
+
* This source code is licensed under the ISC license.
|
|
649
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
650
|
+
*/const ea=xe("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"}]]);/**
|
|
651
|
+
* @license lucide-react v0.469.0 - ISC
|
|
652
|
+
*
|
|
653
|
+
* This source code is licensed under the ISC license.
|
|
654
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
655
|
+
*/const g3=xe("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"}]]);/**
|
|
656
|
+
* @license lucide-react v0.469.0 - ISC
|
|
657
|
+
*
|
|
658
|
+
* This source code is licensed under the ISC license.
|
|
659
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
660
|
+
*/const wb=xe("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
661
|
+
* @license lucide-react v0.469.0 - ISC
|
|
662
|
+
*
|
|
663
|
+
* This source code is licensed under the ISC license.
|
|
664
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
665
|
+
*/const h3=xe("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"}]]);/**
|
|
666
|
+
* @license lucide-react v0.469.0 - ISC
|
|
667
|
+
*
|
|
668
|
+
* This source code is licensed under the ISC license.
|
|
669
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
670
|
+
*/const ba=xe("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
|
|
671
|
+
* @license lucide-react v0.469.0 - ISC
|
|
672
|
+
*
|
|
673
|
+
* This source code is licensed under the ISC license.
|
|
674
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
675
|
+
*/const x3=xe("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"}]]);/**
|
|
676
|
+
* @license lucide-react v0.469.0 - ISC
|
|
677
|
+
*
|
|
678
|
+
* This source code is licensed under the ISC license.
|
|
679
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
680
|
+
*/const vn=xe("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"}]]);/**
|
|
681
|
+
* @license lucide-react v0.469.0 - ISC
|
|
682
|
+
*
|
|
683
|
+
* This source code is licensed under the ISC license.
|
|
684
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
685
|
+
*/const JS=xe("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"}]]);/**
|
|
686
|
+
* @license lucide-react v0.469.0 - ISC
|
|
687
|
+
*
|
|
688
|
+
* This source code is licensed under the ISC license.
|
|
689
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
690
|
+
*/const e2=xe("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"}]]);/**
|
|
691
|
+
* @license lucide-react v0.469.0 - ISC
|
|
692
|
+
*
|
|
693
|
+
* This source code is licensed under the ISC license.
|
|
694
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
695
|
+
*/const kb=xe("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"}]]);/**
|
|
696
|
+
* @license lucide-react v0.469.0 - ISC
|
|
697
|
+
*
|
|
698
|
+
* This source code is licensed under the ISC license.
|
|
699
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
700
|
+
*/const b3=xe("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"}]]);/**
|
|
701
|
+
* @license lucide-react v0.469.0 - ISC
|
|
702
|
+
*
|
|
703
|
+
* This source code is licensed under the ISC license.
|
|
704
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
705
|
+
*/const _3=xe("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"}]]);/**
|
|
706
|
+
* @license lucide-react v0.469.0 - ISC
|
|
707
|
+
*
|
|
708
|
+
* This source code is licensed under the ISC license.
|
|
709
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
710
|
+
*/const v3=xe("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
711
|
+
* @license lucide-react v0.469.0 - ISC
|
|
712
|
+
*
|
|
713
|
+
* This source code is licensed under the ISC license.
|
|
714
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
715
|
+
*/const ta=xe("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"}]]);/**
|
|
716
|
+
* @license lucide-react v0.469.0 - ISC
|
|
717
|
+
*
|
|
718
|
+
* This source code is licensed under the ISC license.
|
|
719
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
720
|
+
*/const Ss=xe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
721
|
+
* @license lucide-react v0.469.0 - ISC
|
|
722
|
+
*
|
|
723
|
+
* This source code is licensed under the ISC license.
|
|
724
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
725
|
+
*/const su=xe("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"}]]),Zf={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},zn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},Sb=["total","automatico","permiso"],bj=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],y3={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 j3(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches}function Zg(e){return e==="system"?j3()?"dark":"light":e}function _j(){if(typeof window>"u")return"dark";const e=localStorage.getItem(zn.theme);return e==="light"||e==="dark"||e==="system"?e:"dark"}const t2=x.createContext(null);function w3({children:e}){const[t,a]=x.useState(_j),[o,l]=x.useState(()=>Zg(_j()));x.useEffect(()=>{const p=()=>{const m=Zg(t);l(m),document.documentElement.classList.toggle("dark",m==="dark")};p();try{localStorage.setItem(zn.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(()=>{a(p=>Zg(p)==="dark"?"light":"dark")},[]),d=x.useMemo(()=>({theme:o,preference:t,toggle:c,set:a}),[o,t,c]);return s.jsx(t2.Provider,{value:d,children:e})}function Cb(){const e=x.useContext(t2);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const k3=1367/458,S3=735/1016;function C3({size:e=32,title:t="APX",variant:a="icon"}){const{theme:o}=Cb(),l=y3[a][o];if(a==="full"){const c=e,d=Math.round(e*k3);return s.jsx("img",{src:l,alt:t,width:d,height:c,className:"block object-contain",draggable:!1})}if(a==="vertical"){const c=e,d=Math.round(e/S3);return s.jsx("img",{src:l,alt:t,width:c,height:d,className:"block object-contain",draggable:!1})}return s.jsx("img",{src:l,alt:t,width:e,height:e,className:"block object-contain",draggable:!1})}function n2(e){var t,a,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]&&(a=n2(e[t]))&&(o&&(o+=" "),o+=a)}else for(a in e)e[a]&&(o&&(o+=" "),o+=a);return o}function Uc(){for(var e,t,a=0,o="",l=arguments.length;a<l;a++)(e=arguments[a])&&(t=n2(e))&&(o&&(o+=" "),o+=t);return o}const Nb="-",N3=e=>{const t=R3(e),{conflictingClassGroups:a,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:d=>{const p=d.split(Nb);return p[0]===""&&p.length!==1&&p.shift(),s2(p,t)||E3(d)},getConflictingClassGroupIds:(d,p)=>{const m=a[d]||[];return p&&o[d]?[...m,...o[d]]:m}}},s2=(e,t)=>{if(e.length===0)return t.classGroupId;const a=e[0],o=t.nextPart.get(a),l=o?s2(e.slice(1),o):void 0;if(l)return l;if(t.validators.length===0)return;const c=e.join(Nb);return t.validators.find(({validator:d})=>d(c))?.classGroupId},vj=/^\[(.+)\]$/,E3=e=>{if(vj.test(e)){const t=vj.exec(e)[1],a=t?.substring(0,t.indexOf(":"));if(a)return"arbitrary.."+a}},R3=e=>{const{theme:t,prefix:a}=e,o={nextPart:new Map,validators:[]};return A3(Object.entries(e.classGroups),a).forEach(([c,d])=>{hx(d,o,c,t)}),o},hx=(e,t,a,o)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?t:yj(t,l);c.classGroupId=a;return}if(typeof l=="function"){if(T3(l)){hx(l(o),t,a,o);return}t.validators.push({validator:l,classGroupId:a});return}Object.entries(l).forEach(([c,d])=>{hx(d,yj(t,c),a,o)})})},yj=(e,t)=>{let a=e;return t.split(Nb).forEach(o=>{a.nextPart.has(o)||a.nextPart.set(o,{nextPart:new Map,validators:[]}),a=a.nextPart.get(o)}),a},T3=e=>e.isThemeGetter,A3=(e,t)=>t?e.map(([a,o])=>{const l=o.map(c=>typeof c=="string"?t+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([d,p])=>[t+d,p])):c);return[a,l]}):e,M3=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,a=new Map,o=new Map;const l=(c,d)=>{a.set(c,d),t++,t>e&&(t=0,o=a,a=new Map)};return{get(c){let d=a.get(c);if(d!==void 0)return d;if((d=o.get(c))!==void 0)return l(c,d),d},set(c,d){a.has(c)?a.set(c,d):l(c,d)}}},a2="!",O3=e=>{const{separator:t,experimentalParseClassName:a}=e,o=t.length===1,l=t[0],c=t.length,d=p=>{const m=[];let g=0,h=0,b;for(let w=0;w<p.length;w++){let S=p[w];if(g===0){if(S===l&&(o||p.slice(w,w+c)===t)){m.push(p.slice(h,w)),h=w+c;continue}if(S==="/"){b=w;continue}}S==="["?g++:S==="]"&&g--}const _=m.length===0?p:p.substring(h),j=_.startsWith(a2),N=j?_.substring(1):_,y=b&&b>h?b-h:void 0;return{modifiers:m,hasImportantModifier:j,baseClassName:N,maybePostfixModifierPosition:y}};return a?p=>a({className:p,parseClassName:d}):d},z3=e=>{if(e.length<=1)return e;const t=[];let a=[];return e.forEach(o=>{o[0]==="["?(t.push(...a.sort(),o),a=[]):a.push(o)}),t.push(...a.sort()),t},D3=e=>({cache:M3(e.cacheSize),parseClassName:O3(e),...N3(e)}),P3=/\s+/,L3=(e,t)=>{const{parseClassName:a,getClassGroupId:o,getConflictingClassGroupIds:l}=t,c=[],d=e.trim().split(P3);let p="";for(let m=d.length-1;m>=0;m-=1){const g=d[m],{modifiers:h,hasImportantModifier:b,baseClassName:_,maybePostfixModifierPosition:j}=a(g);let N=!!j,y=o(N?_.substring(0,j):_);if(!y){if(!N){p=g+(p.length>0?" "+p:p);continue}if(y=o(_),!y){p=g+(p.length>0?" "+p:p);continue}N=!1}const w=z3(h).join(":"),S=b?w+a2:w,k=S+y;if(c.includes(k))continue;c.push(k);const E=l(y,N);for(let R=0;R<E.length;++R){const A=E[R];c.push(S+A)}p=g+(p.length>0?" "+p:p)}return p};function I3(){let e=0,t,a,o="";for(;e<arguments.length;)(t=arguments[e++])&&(a=r2(t))&&(o&&(o+=" "),o+=a);return o}const r2=e=>{if(typeof e=="string")return e;let t,a="";for(let o=0;o<e.length;o++)e[o]&&(t=r2(e[o]))&&(a&&(a+=" "),a+=t);return a};function B3(e,...t){let a,o,l,c=d;function d(m){const g=t.reduce((h,b)=>b(h),e());return a=D3(g),o=a.cache.get,l=a.cache.set,c=p,p(m)}function p(m){const g=o(m);if(g)return g;const h=L3(m,a);return l(m,h),h}return function(){return c(I3.apply(null,arguments))}}const sn=e=>{const t=a=>a[e]||[];return t.isThemeGetter=!0,t},o2=/^\[(?:([a-z-]+):)?(.+)\]$/i,U3=/^\d+\/\d+$/,$3=new Set(["px","full","screen"]),H3=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,q3=/\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$/,V3=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,F3=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,G3=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ga=e=>Bl(e)||$3.has(e)||U3.test(e),Ar=e=>di(e,"length",e4),Bl=e=>!!e&&!Number.isNaN(Number(e)),Jg=e=>di(e,"number",Bl),lc=e=>!!e&&Number.isInteger(Number(e)),Y3=e=>e.endsWith("%")&&Bl(e.slice(0,-1)),ht=e=>o2.test(e),Mr=e=>H3.test(e),K3=new Set(["length","size","percentage"]),X3=e=>di(e,K3,l2),Q3=e=>di(e,"position",l2),W3=new Set(["image","url"]),Z3=e=>di(e,W3,n4),J3=e=>di(e,"",t4),ic=()=>!0,di=(e,t,a)=>{const o=o2.exec(e);return o?o[1]?typeof t=="string"?o[1]===t:t.has(o[1]):a(o[2]):!1},e4=e=>q3.test(e)&&!V3.test(e),l2=()=>!1,t4=e=>F3.test(e),n4=e=>G3.test(e),s4=()=>{const e=sn("colors"),t=sn("spacing"),a=sn("blur"),o=sn("brightness"),l=sn("borderColor"),c=sn("borderRadius"),d=sn("borderSpacing"),p=sn("borderWidth"),m=sn("contrast"),g=sn("grayscale"),h=sn("hueRotate"),b=sn("invert"),_=sn("gap"),j=sn("gradientColorStops"),N=sn("gradientColorStopPositions"),y=sn("inset"),w=sn("margin"),S=sn("opacity"),k=sn("padding"),E=sn("saturate"),R=sn("scale"),A=sn("sepia"),T=sn("skew"),z=sn("space"),O=sn("translate"),B=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",ht,t],D=()=>[ht,t],L=()=>["",Ga,Ar],V=()=>["auto",Bl,ht],H=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],$=()=>["solid","dashed","dotted","double","none"],F=()=>["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"],G=()=>["","0",ht],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Bl,ht];return{cacheSize:500,separator:":",theme:{colors:[ic],spacing:[Ga,Ar],blur:["none","",Mr,ht],brightness:I(),borderColor:[e],borderRadius:["none","","full",Mr,ht],borderSpacing:D(),borderWidth:L(),contrast:I(),grayscale:G(),hueRotate:I(),invert:G(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[Y3,Ar],inset:U(),margin:U(),opacity:I(),padding:D(),saturate:I(),scale:I(),sepia:G(),skew:I(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",ht]}],container:["container"],columns:[{columns:[Mr]}],"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:[...H(),ht]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],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",lc,ht]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ht]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",lc,ht]}],"grid-cols":[{"grid-cols":[ic]}],"col-start-end":[{col:["auto",{span:["full",lc,ht]},ht]}],"col-start":[{"col-start":V()}],"col-end":[{"col-end":V()}],"grid-rows":[{"grid-rows":[ic]}],"row-start-end":[{row:["auto",{span:[lc,ht]},ht]}],"row-start":[{"row-start":V()}],"row-end":[{"row-end":V()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ht]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ht]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"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:[k]}],px:[{px:[k]}],py:[{py:[k]}],ps:[{ps:[k]}],pe:[{pe:[k]}],pt:[{pt:[k]}],pr:[{pr:[k]}],pb:[{pb:[k]}],pl:[{pl:[k]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[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",ht,t]}],"min-w":[{"min-w":[ht,t,"min","max","fit"]}],"max-w":[{"max-w":[ht,t,"none","full","min","max","fit","prose",{screen:[Mr]},Mr]}],h:[{h:[ht,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ht,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ht,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ht,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Mr,Ar]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Jg]}],"font-family":[{font:[ic]}],"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",ht]}],"line-clamp":[{"line-clamp":["none",Bl,Jg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ga,ht]}],"list-image":[{"list-image":["none",ht]}],"list-style-type":[{list:["none","disc","decimal",ht]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[S]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[S]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...$(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ga,Ar]}],"underline-offset":[{"underline-offset":["auto",Ga,ht]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ht]}],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",ht]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[S]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...H(),Q3]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",X3]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Z3]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[N]}],"gradient-via-pos":[{via:[N]}],"gradient-to-pos":[{to:[N]}],"gradient-from":[{from:[j]}],"gradient-via":[{via:[j]}],"gradient-to":[{to:[j]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"border-w":[{border:[p]}],"border-w-x":[{"border-x":[p]}],"border-w-y":[{"border-y":[p]}],"border-w-s":[{"border-s":[p]}],"border-w-e":[{"border-e":[p]}],"border-w-t":[{"border-t":[p]}],"border-w-r":[{"border-r":[p]}],"border-w-b":[{"border-b":[p]}],"border-w-l":[{"border-l":[p]}],"border-opacity":[{"border-opacity":[S]}],"border-style":[{border:[...$(),"hidden"]}],"divide-x":[{"divide-x":[p]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[p]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[S]}],"divide-style":[{divide:$()}],"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:["",...$()]}],"outline-offset":[{"outline-offset":[Ga,ht]}],"outline-w":[{outline:[Ga,Ar]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:L()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[S]}],"ring-offset-w":[{"ring-offset":[Ga,Ar]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Mr,J3]}],"shadow-color":[{shadow:[ic]}],opacity:[{opacity:[S]}],"mix-blend":[{"mix-blend":[...F(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":F()}],filter:[{filter:["","none"]}],blur:[{blur:[a]}],brightness:[{brightness:[o]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",Mr,ht]}],grayscale:[{grayscale:[g]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[b]}],saturate:[{saturate:[E]}],sepia:[{sepia:[A]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[a]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[g]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[b]}],"backdrop-opacity":[{"backdrop-opacity":[S]}],"backdrop-saturate":[{"backdrop-saturate":[E]}],"backdrop-sepia":[{"backdrop-sepia":[A]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[d]}],"border-spacing-x":[{"border-spacing-x":[d]}],"border-spacing-y":[{"border-spacing-y":[d]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ht]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",ht]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",ht]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[lc,ht]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"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",ht]}],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",ht]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ht]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ga,Ar,Jg]}],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"]}}},i2=B3(s4);function he(...e){return i2(Uc(e))}const jj={};function es(e,t){const a=x.useRef(jj);return a.current===jj&&(a.current=e(t)),a}const xx=[];let bx;function a4(){return bx}function r4(e){xx.push(e)}function Eb(e){const t=(a,o)=>{const l=es(o4).current;let c;try{bx=l;for(const d of xx)d.before(l);c=e(a,o);for(const d of xx)d.after(l);l.didInitialize=!0}finally{bx=void 0}return c};return t.displayName=e.displayName||e.name,t}function c2(e){return x.forwardRef(Eb(e))}function o4(){return{didInitialize:!1}}const l4=()=>{},ze=typeof document<"u"?x.useLayoutEffect:l4;function i4(e,t){return function(o,...l){const c=new URL(e);return c.searchParams.set("code",o.toString()),l.forEach(d=>c.searchParams.append("args[]",d)),`${t} error #${o}; visit ${c} for the full message.`}}const ln=i4("https://base-ui.com/production-error","Base UI"),u2=x.createContext(void 0);function au(e){const t=x.useContext(u2);if(t===void 0&&!e)throw new Error(ln(72));return t}const c4=[];function Rb(e){x.useEffect(e,c4)}const cc=0;class Zs{static create(){return new Zs}currentId=cc;start(t,a){this.clear(),this.currentId=setTimeout(()=>{this.currentId=cc,a()},t)}isStarted(){return this.currentId!==cc}clear=()=>{this.currentId!==cc&&(clearTimeout(this.currentId),this.currentId=cc)};disposeEffect=()=>this.clear}function En(){const e=es(Zs.create).current;return Rb(e.disposeEffect),e}function u4(){return typeof navigator>"u"?{userAgent:"",platform:"",maxTouchPoints:0}:{userAgent:navigator.userAgent,platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??0}}const{userAgent:d4,platform:f4,maxTouchPoints:p4}=u4(),Jf=d4.toLowerCase(),$c=f4.toLowerCase(),ep=/^i(os$|p)/.test($c)||$c==="macintel"&&p4>1,wj="android",_x=$c===wj||Jf.includes(wj),Tb=!ep&&$c.startsWith("mac");$c.startsWith("win");const m4=Tb||ep,Gr=typeof CSS<"u"&&!!CSS.supports?.("-webkit-backdrop-filter:none");!Gr&&Jf.includes("firefox");!Gr&&Jf.includes("chrom");const g4=m4,Ab=/jsdom|happydom/.test(Jf);function ca(e){e.preventDefault(),e.stopPropagation()}function h4(e){return"nativeEvent"in e}function Mb(e){return e.pointerType===""&&e.isTrusted?!0:_x&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function d2(e){return Ab?!1:!_x&&e.width===0&&e.height===0||_x&&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 Ro(e,t){const a=["mouse","pen"];return t||a.push("",void 0),a.includes(e)}function x4(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}function tp(){return typeof window<"u"}function Vn(e){return Ob(e)?(e.nodeName||"").toLowerCase():"#document"}function Wt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function wa(e){var t;return(t=(Ob(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ob(e){return tp()?e instanceof Node||e instanceof Wt(e).Node:!1}function bt(e){return tp()?e instanceof Element||e instanceof Wt(e).Element:!1}function Gt(e){return tp()?e instanceof HTMLElement||e instanceof Wt(e).HTMLElement:!1}function Xl(e){return!tp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wt(e).ShadowRoot}function Yr(e){const{overflow:t,overflowX:a,overflowY:o,display:l}=ps(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+a)&&l!=="inline"&&l!=="contents"}function b4(e){return/^(table|td|th)$/.test(Vn(e))}function np(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const _4=/transform|translate|scale|rotate|perspective|filter/,v4=/paint|layout|strict|content/,xo=e=>!!e&&e!=="none";let eh;function zb(e){const t=bt(e)?ps(e):e;return xo(t.transform)||xo(t.translate)||xo(t.scale)||xo(t.rotate)||xo(t.perspective)||!Db()&&(xo(t.backdropFilter)||xo(t.filter))||_4.test(t.willChange||"")||v4.test(t.contain||"")}function y4(e){let t=_a(e);for(;Gt(t)&&!ma(t);){if(zb(t))return t;if(np(t))return null;t=_a(t)}return null}function Db(){return eh==null&&(eh=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),eh}function ma(e){return/^(html|body|#document)$/.test(Vn(e))}function ps(e){return Wt(e).getComputedStyle(e)}function sp(e){return bt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function _a(e){if(Vn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Xl(e)&&e.host||wa(e);return Xl(t)?t.host:t}function f2(e){const t=_a(e);return ma(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gt(t)&&Yr(t)?t:f2(t)}function Hc(e,t,a){var o;t===void 0&&(t=[]),a===void 0&&(a=!0);const l=f2(e),c=l===((o=e.ownerDocument)==null?void 0:o.body),d=Wt(l);if(c){const p=vx(d);return t.concat(d,d.visualViewport||[],Yr(l)?l:[],p&&a?Hc(p):[])}else return t.concat(l,Hc(l,[],a))}function vx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const yx="data-base-ui-focusable",p2="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",ap="ArrowLeft",rp="ArrowRight",m2="ArrowUp",Pb="ArrowDown";function Gn(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function We(e,t){if(!e||!t)return!1;const a=t.getRootNode?.();if(e.contains(t))return!0;if(a&&Xl(a)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function qn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function xf(e,t){if(!bt(e))return!1;const a=e;if(t.hasElement(a))return!a.hasAttribute("data-trigger-disabled");for(const[,o]of t.entries())if(We(o,a))return!o.hasAttribute("data-trigger-disabled");return!1}function th(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const a=e;return a.target!=null&&t.contains(a.target)}function j4(e){return e.matches("html,body")}function op(e){return Gt(e)&&e.matches(p2)}function w4(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${p2}`)!=null}function jx(e){return e?e.getAttribute("role")==="combobox"&&op(e):!1}function k4(e){if(!e||Ab)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function bf(e){return e?e.hasAttribute(yx)?e:e.querySelector(`[${yx}]`)||e:null}function S4(e,t){return t!=null&&!Ro(t)?0:typeof e=="function"?e():e}function Ql(e,t,a){const o=S4(e,a);return typeof o=="number"?o:o?.[t]}function kj(e){return typeof e=="function"?e():e}function g2(e,t){return t||e==="click"||e==="mousedown"}function C4(e){return e?.includes("mouse")&&e!=="mousedown"}function Mn(){}const tr=Object.freeze([]),Xt=Object.freeze({}),va="none",fi="trigger-press",On="trigger-hover",Ul="trigger-focus",lp="outside-press",$l="item-press",N4="close-press",To="focus-out",ip="escape-key",wx="list-navigation",h2="cancel-open",jc="sibling-open",x2="disabled",Sj="missing",Cj="initial",Lb="imperative-action",E4="window-resize";function st(e,t,a,o){let l=!1,c=!1;const d=o??Xt;return{reason:e,event:t??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:a,...d}}const b2=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Zs,currentIdRef:{current:null},currentContextRef:{current:null}});function R4(e,t){e.current=t.current}function T4(e){const{children:t,delay:a,timeoutMs:o=0}=e,l=x.useRef(a),c=x.useRef(a),d=x.useRef(null),p=x.useRef(null),m=En();return ze(()=>{if(c.current=a,!d.current){l.current=a;return}l.current={open:Ql(l.current,"open"),close:Ql(a,"close")}},[a,d,l,c]),s.jsx(b2.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:d,timeoutMs:o,currentContextRef:p,timeout:m}),[o,m]),children:t})}function A4(e,t={open:!1}){const{open:a}=t,o="rootStore"in e?e.rootStore:e,l=o.useState("floatingId"),c=x.useContext(b2),{currentIdRef:d,delayRef:p,timeoutMs:m,initialDelayRef:g,currentContextRef:h,hasProvider:b,timeout:_}=c,[j,N]=x.useState(!1),y=x.useRef(a),w=x.useRef(!1);return ze(()=>{y.current=a},[a]),ze(()=>()=>{w.current=!0},[]),ze(()=>{function S(){w.current||N(!1),h.current?.setIsInstantPhase(!1),d.current=null,h.current=null,p.current=g.current,_.clear()}if(d.current&&!a&&d.current===l){if(N(!1),m){const k=l;return _.start(m,()=>{o.select("open")||d.current&&d.current!==k||S()}),()=>{(y.current||d.current!==k)&&_.clear()}}S()}},[a,l,d,p,m,g,h,_,o]),ze(()=>{if(!a)return;const S=h.current,k=d.current;_.clear(),h.current={onOpenChange:o.setOpen,setIsInstantPhase:N},d.current=l,p.current={open:0,close:Ql(g.current,"close")},k!==null&&k!==l?(N(!0),S?.setIsInstantPhase(!0),S?.onOpenChange(!1,st(va))):(N(!1),S?.setIsInstantPhase(!1))},[a,l,o,d,p,g,h,_]),ze(()=>()=>{if(d.current===l){if(h.current=null,!y.current)return;d.current=null,R4(p,g),_.clear()}},[h,d,p,l,g,_]),x.useMemo(()=>({hasProvider:b,delayRef:p,isInstantPhase:j}),[b,p,j])}function _t(e,t,a,o){return e.addEventListener(t,a,o),()=>{e.removeEventListener(t,a,o)}}function ga(...e){return()=>{for(let t=0;t<e.length;t+=1){const a=e[t];a&&a()}}}function nr(e,t,a,o){const l=es(_2).current;return O4(l,e,t,a,o)&&v2(l,[e,t,a,o]),l.callback}function M4(e){const t=es(_2).current;return z4(t,e)&&v2(t,e),t.callback}function _2(){return{callback:null,cleanup:null,refs:[]}}function O4(e,t,a,o,l){return e.refs[0]!==t||e.refs[1]!==a||e.refs[2]!==o||e.refs[3]!==l}function z4(e,t){return e.refs.length!==t.length||e.refs.some((a,o)=>a!==t[o])}function v2(e,t){if(e.refs=t,t.every(a=>a==null)){e.callback=null;return}e.callback=a=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),a!=null){const o=Array(t.length).fill(null);for(let l=0;l<t.length;l+=1){const c=t[l];if(c!=null)switch(typeof c){case"function":{const d=c(a);typeof d=="function"&&(o[l]=d);break}case"object":{c.current=a;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 d=o[l];typeof d=="function"?d():c(null);break}case"object":{c.current=null;break}}}}}}}function pn(e){const t=es(D4,e).current;return t.next=e,ze(t.effect),t}function D4(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const Ib={...EA},nh=Ib.useInsertionEffect,P4=nh&&nh!==Ib.useLayoutEffect?nh:e=>e();function Ue(e){const t=es(L4).current;return t.next=e,P4(t.effect),t.trampoline}function L4(){const e={next:void 0,callback:I4,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function I4(){}const Ed=null;class B4{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const a=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let l=0;l<a.length;l+=1)a[l]?.(t)};request(t){const a=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),a}cancel(t){const a=t-this.startId;a<0||a>=this.callbacks.length||(this.callbacks[a]=null,this.callbacksCount-=1)}}const Rd=new B4;class da{static create(){return new da}static request(t){return Rd.request(t)}static cancel(t){return Rd.cancel(t)}currentId=Ed;request(t){this.cancel(),this.currentId=Rd.request(()=>{this.currentId=Ed,t()})}cancel=()=>{this.currentId!==Ed&&(Rd.cancel(this.currentId),this.currentId=Ed)};disposeEffect=()=>this.cancel}function Wl(){const e=es(da.create).current;return Rb(e.disposeEffect),e}function xt(e){return e?.ownerDocument||document}const y2={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Bb={...y2,position:"fixed",top:0,left:0},j2={...y2,position:"absolute"},Zl=x.forwardRef(function(t,a){const[o,l]=x.useState();ze(()=>{g4&&Gr&&l("button")},[]);const c={tabIndex:0,role:o};return s.jsx("span",{...t,ref:a,style:Bb,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),U4=["top","right","bottom","left"],Jl=Math.min,ws=Math.max,_f=Math.round,Td=Math.floor,ha=e=>({x:e,y:e}),$4={left:"right",right:"left",bottom:"top",top:"bottom"};function kx(e,t,a){return ws(e,Jl(t,a))}function sr(e,t){return typeof e=="function"?e(t):e}function fs(e){return e.split("-")[0]}function Kr(e){return e.split("-")[1]}function Ub(e){return e==="x"?"y":"x"}function $b(e){return e==="y"?"height":"width"}function $s(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Hb(e){return Ub($s(e))}function H4(e,t,a){a===void 0&&(a=!1);const o=Kr(e),l=Hb(e),c=$b(l);let d=l==="x"?o===(a?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[c]>t.floating[c]&&(d=vf(d)),[d,vf(d)]}function q4(e){const t=vf(e);return[Sx(e),t,Sx(t)]}function Sx(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Nj=["left","right"],Ej=["right","left"],V4=["top","bottom"],F4=["bottom","top"];function G4(e,t,a){switch(e){case"top":case"bottom":return a?t?Ej:Nj:t?Nj:Ej;case"left":case"right":return t?V4:F4;default:return[]}}function Y4(e,t,a,o){const l=Kr(e);let c=G4(fs(e),a==="start",o);return l&&(c=c.map(d=>d+"-"+l),t&&(c=c.concat(c.map(Sx)))),c}function vf(e){const t=fs(e);return $4[t]+e.slice(t.length)}function K4(e){return{top:0,right:0,bottom:0,left:0,...e}}function w2(e){return typeof e!="number"?K4(e):{top:e,right:e,bottom:e,left:e}}function qc(e){const{x:t,y:a,width:o,height:l}=e;return{width:o,height:l,top:a,left:t,right:t+o,bottom:a+l,x:t,y:a}}function Mc(e,t){return t<0||t>=e.length}function sf(e,t){return Wa(e.current,{disabledIndices:t})}function Cx(e,t){return Wa(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Wa(e,{startingIndex:t=-1,decrement:a=!1,disabledIndices:o,amount:l=1}={}){let c=t;do c+=a?-l:l;while(c>=0&&c<=e.length-1&&yf(e,c,o));return c}function yf(e,t,a){if(typeof a=="function"?a(t):a?.includes(t)??!1)return!0;const l=e[t];return l?cp(l)?!a&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!0:!1}function X4(e){return e.visibility==="hidden"||e.visibility==="collapse"}function cp(e,t=e?ps(e):null){return!e||!e.isConnected||!t||X4(t)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():t.display!=="none"&&t.display!=="contents"}const Q4='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function W4(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const a=e.getRootNode();return Xl(a)?a.host:null}function Nx(e){for(const t of Array.from(e.children))if(Vn(t)==="summary")return t;return null}function Z4(e,t){const a=Nx(t);return!!a&&(e===a||We(a,e))}function k2(e){const t=e?Vn(e):"";return e!=null&&e.matches(Q4)&&(t!=="summary"||e.parentElement!=null&&Vn(e.parentElement)==="details"&&Nx(e.parentElement)===e)&&(t!=="details"||Nx(e)==null)&&(t!=="input"||e.type!=="hidden")}function S2(e){if(!k2(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let t=e;t;t=W4(t)){const a=t!==e,o=Vn(t)==="slot";if(t.hasAttribute("inert")||a&&Vn(t)==="details"&&!t.open&&!Z4(e,t)||t.hasAttribute("hidden")||!o&&!J4(t,a))return!1}return!0}function J4(e,t){const a=ps(e);return t?a.display!=="none":cp(e,a)}function C2(e){const t=e.tabIndex;if(t<0){const a=Vn(e);if(a==="details"||a==="audio"||a==="video"||Gt(e)&&e.isContentEditable)return 0}return t}function sh(e){if(Vn(e)!=="input")return null;const t=e;return t.type==="radio"&&t.name!==""?t:null}function eO(e,t){const a=sh(e);if(!a)return!0;const o=t.find(l=>{const c=sh(l);return c?.name===a.name&&c.form===a.form&&c.checked});return o?o===a:t.find(l=>{const c=sh(l);return c?.name===a.name&&c.form===a.form})===a}function N2(e){if(Gt(e)&&Vn(e)==="slot"){const t=e.assignedElements({flatten:!0});if(t.length>0)return t}return Gt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function E2(e,t){N2(e).forEach(a=>{k2(a)&&t.push(a),E2(a,t)})}function R2(e,t,a){N2(e).forEach(o=>{Gt(o)&&o.matches(t)&&a.push(o),R2(o,t,a)})}function qb(e){return S2(e)&&C2(e)>=0}function T2(e){const t=[];return E2(e,t),t.filter(S2)}function ru(e){const t=T2(e);return t.filter(a=>C2(a)>=0&&eO(a,t))}function A2(e,t){const a=ru(e),o=a.length;if(o===0)return;const l=Gn(xt(e)),c=a.indexOf(l),d=c===-1?t===1?0:o-1:c+t;return a[d]}function Vb(e){return A2(xt(e).body,1)||e}function M2(e){return A2(xt(e).body,-1)||e}function O2(e,t){if(!e)return null;const a=ru(xt(e).body),o=a.length;if(o===0)return null;const l=a.indexOf(e);if(l===-1)return null;const c=(l+t+o)%o;return a[c]}function tO(e){return O2(e,1)}function nO(e){return O2(e,-1)}function Hl(e,t){const a=t||e.currentTarget,o=e.relatedTarget;return!o||!We(a,o)}function sO(e){ru(e).forEach(a=>{a.dataset.tabindex=a.getAttribute("tabindex")||"",a.setAttribute("tabindex","-1")})}function Rj(e){const t=[];R2(e,"[data-tabindex]",t),t.forEach(a=>{const o=a.dataset.tabindex;delete a.dataset.tabindex,o?a.setAttribute("tabindex",o):a.removeAttribute("tabindex")})}function qr(e,t,a=!0){return e.filter(l=>l.parentId===t).flatMap(l=>[...!a||l.context?.open?[l]:[],...qr(e,l.id,a)])}function Tj(e,t){let a=[],o=e.find(l=>l.id===t)?.parentId;for(;o;){const l=e.find(c=>c.id===o);o=l?.parentId,l&&(a=a.concat(l))}return a}function Vc(e){return`data-base-ui-${e}`}let Ad=0;function af(e,t={}){const{preventScroll:a=!1,sync:o=!1,shouldFocus:l}=t;cancelAnimationFrame(Ad);function c(){l&&!l()||e?.focus({preventScroll:a})}if(o)return c(),Mn;const d=requestAnimationFrame(c);return Ad=d,()=>{Ad===d&&(cancelAnimationFrame(d),Ad=0)}}const ah={inert:new WeakMap,"aria-hidden":new WeakMap},Aj="data-base-ui-inert",Ex={inert:new WeakSet,"aria-hidden":new WeakSet};let uc=new WeakMap,rh=0;function aO(e){return Ex[e]}function z2(e){return e?Xl(e)?e.host:z2(e.parentNode):null}const Mj=(e,t)=>t.map(a=>{if(e.contains(a))return a;const o=z2(a);return e.contains(o)?o:null}).filter(a=>a!=null),Oj=e=>{const t=new Set;return e.forEach(a=>{let o=a;for(;o&&!t.has(o);)t.add(o),o=o.parentNode}),t},zj=(e,t,a)=>{const o=[],l=c=>{!c||a.has(c)||Array.from(c.children).forEach(d=>{Vn(d)!=="script"&&(t.has(d)?l(d):o.push(d))})};return l(e),o};function rO(e,t,a,o,{mark:l=!0}){let c=null;o?c="inert":a&&(c="aria-hidden");let d=null,p=null;const m=Mj(t,e),g=l?zj(t,Oj(m),new Set(m)):[],h=[],b=[];if(c){const _=ah[c],j=aO(c);p=j,d=_;const N=Mj(t,Array.from(t.querySelectorAll("[aria-live]"))),y=m.concat(N);zj(t,Oj(y),new Set(y)).forEach(S=>{const k=S.getAttribute(c),E=k!==null&&k!=="false",R=(_.get(S)||0)+1;_.set(S,R),h.push(S),R===1&&E&&j.add(S),E||S.setAttribute(c,c==="inert"?"":"true")})}return l&&g.forEach(_=>{const j=(uc.get(_)||0)+1;uc.set(_,j),b.push(_),j===1&&_.setAttribute(Aj,"")}),rh+=1,()=>{d&&h.forEach(_=>{const N=(d.get(_)||0)-1;d.set(_,N),N||(!p?.has(_)&&c&&_.removeAttribute(c),p?.delete(_))}),l&&b.forEach(_=>{const j=(uc.get(_)||0)-1;uc.set(_,j),j||_.removeAttribute(Aj)}),rh-=1,rh||(ah.inert=new WeakMap,ah["aria-hidden"]=new WeakMap,Ex.inert=new WeakSet,Ex["aria-hidden"]=new WeakSet,uc=new WeakMap)}}function Dj(e,t={}){const{ariaHidden:a=!1,inert:o=!1,mark:l=!0}=t,c=xt(e[0]).body;return rO(e,c,a,o,{mark:l})}let Pj=0;function oO(e,t="mui"){const[a,o]=x.useState(e),l=e||a;return x.useEffect(()=>{a==null&&(Pj+=1,o(`${t}-${Pj}`))},[a,t]),l}const Lj=Ib.useId;function Ao(e,t){if(Lj!==void 0){const a=Lj();return e??(t?`${t}-${a}`:a)}return oO(e,t)}const lO=parseInt(x.version,10);function Fb(e){return lO>=e}function Ij(e){if(!x.isValidElement(e))return null;const t=e,a=t.props;return(Fb(19)?a?.ref:t.ref)??null}function Rx(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function iO(e,t){const a={};for(const o in e){const l=e[o];if(t?.hasOwnProperty(o)){const c=t[o](l);c!=null&&Object.assign(a,c);continue}l===!0?a[`data-${o.toLowerCase()}`]="":l&&(a[`data-${o.toLowerCase()}`]=l.toString())}return a}function cO(e,t){return typeof e=="function"?e(t):e}function uO(e,t){return typeof e=="function"?e(t):e}const Gb={};function Kn(e,t,a,o,l){if(!a&&!o&&!l&&!e)return jf(t);let c=jf(e);return t&&(c=wc(c,t)),a&&(c=wc(c,a)),o&&(c=wc(c,o)),l&&(c=wc(c,l)),c}function dO(e){if(e.length===0)return Gb;if(e.length===1)return jf(e[0]);let t=jf(e[0]);for(let a=1;a<e.length;a+=1)t=wc(t,e[a]);return t}function jf(e){return Yb(e)?{...P2(e,Gb)}:fO(e)}function wc(e,t){return Yb(t)?P2(t,e):pO(e,t)}function fO(e){const t={...e};for(const a in t){const o=t[a];D2(a,o)&&(t[a]=L2(o))}return t}function pO(e,t){if(!t)return e;for(const a in t){const o=t[a];switch(a){case"style":{e[a]=Rx(e.style,o);break}case"className":{e[a]=I2(e.className,o);break}default:D2(a,o)?e[a]=mO(e[a],o):e[a]=o}}return e}function D2(e,t){const a=e.charCodeAt(0),o=e.charCodeAt(1),l=e.charCodeAt(2);return a===111&&o===110&&l>=65&&l<=90&&(typeof t=="function"||typeof t>"u")}function Yb(e){return typeof e=="function"}function P2(e,t){return Yb(e)?e(t):e??Gb}function mO(e,t){return t?e?(...a)=>{const o=a[0];if(B2(o)){const c=o;wf(c);const d=t(...a);return c.baseUIHandlerPrevented||e?.(...a),d}const l=t(...a);return e?.(...a),l}:L2(t):e}function L2(e){return e&&((...t)=>{const a=t[0];return B2(a)&&wf(a),e(...t)})}function wf(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function I2(e,t){return t?e?t+" "+e:t:e}function B2(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Et(e,t,a={}){const o=t.render,l=gO(t,a);if(a.enabled===!1)return null;const c=a.state??Xt;return bO(e,o,l,c)}function gO(e,t={}){const{className:a,style:o,render:l}=e,{state:c=Xt,ref:d,props:p,stateAttributesMapping:m,enabled:g=!0}=t,h=g?cO(a,c):void 0,b=g?uO(o,c):void 0,_=g?iO(c,m):Xt,j=g&&p?hO(p):void 0,N=g?Rx(_,j)??{}:Xt;return typeof document<"u"&&(g?Array.isArray(d)?N.ref=M4([N.ref,Ij(l),...d]):N.ref=nr(N.ref,Ij(l),d):nr(null,null)),g?(h!==void 0&&(N.className=I2(N.className,h)),b!==void 0&&(N.style=Rx(N.style,b)),N):Xt}function hO(e){return Array.isArray(e)?dO(e):Kn(void 0,e)}const xO=Symbol.for("react.lazy");function bO(e,t,a,o){if(t){if(typeof t=="function")return t(a,o);const l=Kn(a,t.props);l.ref=a.ref;let c=t;return c?.$$typeof===xO&&(c=x.Children.toArray(t)[0]),x.cloneElement(c,l)}if(e&&typeof e=="string")return _O(e,a);throw new Error(ln(8))}function _O(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 vO=500,yO=500,jO={style:{transition:"none"}},wO="data-base-ui-click-trigger",U2={fallbackAxisSide:"none"},$2={fallbackAxisSide:"end"},kO={clipPath:"inset(50%)",position:"fixed",top:0,left:0},H2=x.createContext(null),q2=()=>x.useContext(H2),SO=Vc("portal");function V2(e={}){const{ref:t,container:a,componentProps:o=Xt,elementProps:l}=e,c=Ao(),p=q2()?.portalNode,[m,g]=x.useState(null),[h,b]=x.useState(null),_=Ue(w=>{w!==null&&b(w)}),j=x.useRef(null);ze(()=>{if(a===null){j.current&&(j.current=null,b(null),g(null));return}if(c==null)return;const w=(a&&(Ob(a)?a:a.current))??p??document.body;if(w==null){j.current&&(j.current=null,b(null),g(null));return}j.current!==w&&(j.current=w,b(null),g(w))},[a,p,c]);const N=Et("div",o,{ref:[t,_],props:[{id:c,[SO]:""},l]});return{portalNode:h,portalSubtree:m&&N?qs.createPortal(N,m):null}}const Kb=x.forwardRef(function(t,a){const{render:o,className:l,style:c,children:d,container:p,renderGuards:m,...g}=t,{portalNode:h,portalSubtree:b}=V2({container:p,ref:a,componentProps:t,elementProps:g}),_=x.useRef(null),j=x.useRef(null),N=x.useRef(null),y=x.useRef(null),[w,S]=x.useState(null),k=x.useRef(!1),E=w?.modal,R=w?.open,A=typeof m=="boolean"?m:!!w&&!w.modal&&w.open&&!!h;x.useEffect(()=>{if(!h||E)return;function z(O){h&&O.relatedTarget&&Hl(O)&&(O.type==="focusin"?k.current&&(Rj(h),k.current=!1):(sO(h),k.current=!0))}return ga(_t(h,"focusin",z,!0),_t(h,"focusout",z,!0))},[h,E]),ze(()=>{!h||R!==!0||!k.current||(Rj(h),k.current=!1)},[R,h]);const T=x.useMemo(()=>({beforeOutsideRef:_,afterOutsideRef:j,beforeInsideRef:N,afterInsideRef:y,portalNode:h,setFocusManagerState:S}),[h]);return s.jsxs(x.Fragment,{children:[b,s.jsxs(H2.Provider,{value:T,children:[A&&h&&s.jsx(Zl,{"data-type":"outside",ref:_,onFocus:z=>{if(Hl(z,h))N.current?.focus();else{const O=w?w.domReference:null;M2(O)?.focus()}}}),A&&h&&s.jsx("span",{"aria-owns":h.id,style:kO}),h&&qs.createPortal(d,h),A&&h&&s.jsx(Zl,{"data-type":"outside",ref:j,onFocus:z=>{if(Hl(z,h))y.current?.focus();else{const O=w?w.domReference:null;Vb(O)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,st(To,z.nativeEvent))}}})]})]})});function F2(){const e=new Map;return{emit(t,a){e.get(t)?.forEach(o=>o(a))},on(t,a){e.has(t)||e.set(t,new Set),e.get(t).add(a)},off(t,a){e.get(t)?.delete(a)}}}class Xb{nodesRef={current:[]};events=F2();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const a=this.nodesRef.current.findIndex(o=>o===t);a!==-1&&this.nodesRef.current.splice(a,1)}}const G2=x.createContext(null),Y2=x.createContext(null),Xr=()=>x.useContext(G2)?.id||null,Qr=e=>{const t=x.useContext(Y2);return e??t};function K2(e){const t=Ao(),a=Qr(e),o=Xr();return ze(()=>{if(!t)return;const l={id:t,parentId:o};return a?.addNode(l),()=>{a?.removeNode(l)}},[a,t,o]),t}function CO(e){const{children:t,id:a}=e,o=Xr();return s.jsx(G2.Provider,{value:x.useMemo(()=>({id:a,parentId:o}),[a,o]),children:t})}function NO(e){const{children:t,externalTree:a}=e,o=es(()=>a??new Xb).current;return s.jsx(Y2.Provider,{value:o,children:t})}function Xa(e){return e==null?e:"current"in e?e.current:e}function EO(e,t){const a=Wt(qn(e));return e instanceof a.KeyboardEvent?"keyboard":e instanceof a.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof a.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const Bj=20;let Pr=[];function Qb(){Pr=Pr.filter(e=>e.deref()?.isConnected)}function Uj(e){Qb(),e&&Vn(e)!=="body"&&(Pr.push(new WeakRef(e)),Pr.length>Bj&&(Pr=Pr.slice(-Bj)))}function $j(){return Qb(),Pr[Pr.length-1]?.deref()}function RO(e){return e?qb(e)?e:ru(e)[0]||e:null}function Hj(e){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!e.getAttribute("role")?.includes("dialog"))return;const a=T2(e).filter(l=>{const c=l.getAttribute("data-tabindex")||"";return qb(l)||l.hasAttribute("data-tabindex")&&!c.startsWith("-")}),o=e.getAttribute("tabindex");a.length===0?o!=="0"&&(e.setAttribute("tabindex","0"),e.setAttribute("data-tabindex","0")):(o!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Wb(e){const{context:t,children:a,disabled:o=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:d=!1,modal:p=!0,closeOnFocusOut:m=!0,openInteractionType:g="",nextFocusableElement:h,previousFocusableElement:b,beforeContentFocusGuardRef:_,externalTree:j,getInsideElements:N}=e,y="rootStore"in t?t.rootStore:t,w=y.useState("open"),S=y.useState("domReferenceElement"),k=y.useState("floatingElement"),{events:E,dataRef:R}=y.context,A=Ue(()=>R.current.floatingContext?.nodeId),T=l===!1,z=jx(S)&&T,O=pn(l),B=pn(c),P=pn(g),U=pn(w),D=Qr(j),L=q2(),V=x.useRef(!1),H=x.useRef(!1),$=x.useRef(!1),F=x.useRef(null),Y=x.useRef(""),G=x.useRef(""),K=x.useRef(null),I=x.useRef(null),X=nr(K,_,L?.beforeInsideRef),Z=nr(I,L?.afterInsideRef),W=En(),fe=En(),te=Wl(),re=L!=null,le=bf(k),me=Ue((ge=le)=>ge?ru(ge):[]),Me=Ue(()=>N?.().filter(ge=>ge!=null)??[]);x.useEffect(()=>{if(o||!p)return;function ge(ke){ke.key==="Tab"&&We(le,Gn(xt(le)))&&me().length===0&&!z&&ca(ke)}const Ce=xt(le);return _t(Ce,"keydown",ge)},[o,le,p,z,me]),x.useEffect(()=>{if(o||!w)return;const ge=xt(le);function Ce(){$.current=!1}function ke(Ve){const Se=qn(Ve),Te=Me(),je=We(k,Se)||We(S,Se)||We(L?.portalNode,Se)||Te.some(Ee=>Ee===Se||We(Ee,Se));$.current=!je,G.current=Ve.pointerType||"keyboard",Se?.closest(`[${wO}]`)&&(H.current=!0,fe.start(0,()=>{H.current=!1}))}function Be(){G.current="keyboard"}return ga(_t(ge,"pointerdown",ke,!0),_t(ge,"pointerup",Ce,!0),_t(ge,"pointercancel",Ce,!0),_t(ge,"keydown",Be,!0),Ce)},[o,k,S,le,w,L,fe,Me]),x.useEffect(()=>{if(o||!m)return;const ge=xt(le);function Ce(){H.current=!0,fe.start(0,()=>{H.current=!1})}function ke(Te){const je=qn(Te);qb(je)&&(F.current=je)}function Be(Te){const je=Te.relatedTarget,Ee=Te.currentTarget,De=qn(Te);p&&je==null&&De!=null&&We(k,De)&&Uj(De),queueMicrotask(()=>{const Le=A(),Ie=y.context.triggerElements,ue=Me(),ye=je?.hasAttribute(Vc("focus-guard"))&&[K.current,I.current,L?.beforeInsideRef.current,L?.afterInsideRef.current,L?.beforeOutsideRef.current,L?.afterOutsideRef.current,Xa(b),Xa(h)].includes(je),Ge=!(We(S,je)||We(k,je)||We(je,k)||We(L?.portalNode,je)||ue.some(Re=>Re===je||We(Re,je))||je!=null&&Ie.hasElement(je)||Ie.hasMatchingElement(Re=>We(Re,je))||ye||D&&(qr(D.nodesRef.current,Le).find(Re=>We(Re.context?.elements.floating,je)||We(Re.context?.elements.domReference,je))||Tj(D.nodesRef.current,Le).find(Re=>[Re.context?.elements.floating,bf(Re.context?.elements.floating)].includes(je)||Re.context?.elements.domReference===je)));if(Ee===S&&le&&Hj(le),d&&Ee!==S&&!cp(De)&&Gn(ge)===ge.body){if(Gt(le)&&(le.focus(),d==="popup")){te.request(()=>{le.focus()});return}const Re=me(),Oe=F.current,tt=(Oe&&Re.includes(Oe)?Oe:null)||Re[Re.length-1]||le;Gt(tt)&&tt.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(z||!p)&&je&&Ge&&!H.current&&(z||je!==$j())&&(V.current=!0,y.setOpen(!1,st(To,Te)))})}function Ve(){$.current||(R.current.insideReactTree=!0,W.start(0,()=>{R.current.insideReactTree=!1}))}const Se=Gt(S)?S:null;if(!(!k&&!Se))return ga(Se&&_t(Se,"focusout",Be),Se&&_t(Se,"pointerdown",Ce),k&&_t(k,"focusin",ke),k&&_t(k,"focusout",Be),k&&L&&_t(k,"focusout",Ve,!0))},[o,S,k,le,p,D,L,y,m,d,me,z,A,R,W,fe,te,h,b,Me]),x.useEffect(()=>{if(o||!k||!w)return;const ge=Array.from(L?.portalNode?.querySelectorAll(`[${Vc("portal")}]`)||[]),ke=(D?Tj(D.nodesRef.current,A()):[]).find(Ee=>jx(Ee.context?.elements.domReference||null))?.context?.elements.domReference,Ve=[...[k,...ge,K.current,I.current,L?.beforeOutsideRef.current,L?.afterOutsideRef.current,...Me()],ke,Xa(b),Xa(h),z?S:null].filter(Ee=>Ee!=null),Se=Dj(Ve,{ariaHidden:p||z,mark:!1}),Te=[k,...ge].filter(Ee=>Ee!=null),je=Dj(Te);return()=>{je(),Se()}},[w,o,S,k,p,L,z,D,A,h,b,Me]),ze(()=>{if(!w||o||!Gt(le))return;const ge=xt(le),Ce=Gn(ge);queueMicrotask(()=>{const ke=O.current,Be=typeof ke=="function"?ke(P.current||""):ke;if(Be===void 0||Be===!1||We(le,Ce))return;let Se=null;const Te=()=>(Se==null&&(Se=me(le)),Se[0]||le);let je;Be===!0||Be===null?je=Te():je=Xa(Be),je=je||Te();const Ee=We(le,Gn(ge));af(je,{preventScroll:je===le,shouldFocus(){if(!U.current)return!1;if(Ee)return!0;const De=Gn(ge);return!(De!==je&&We(le,De))}})})},[o,w,le,me,O,P,U]),ze(()=>{if(o||!le)return;const ge=xt(le),Ce=Gn(ge),ke=P.current==null;Uj(Ce);function Be(Se){if(Se.open||(Y.current=EO(Se.nativeEvent,G.current)),Se.reason===On&&Se.nativeEvent.type==="mouseleave"&&(V.current=!0),Se.reason===lp)if(Se.nested)V.current=!1;else if(Mb(Se.nativeEvent)||d2(Se.nativeEvent))V.current=!1;else{let Te=!1;xt(le).createElement("div").focus({get preventScroll(){return Te=!0,!1}}),Te?V.current=!1:V.current=!0}}E.on("openchange",Be);function Ve(){const Se=B.current;let Te=typeof Se=="function"?Se(Y.current):Se;if(Te===void 0||Te===!1)return null;Te===null&&(Te=!0);const je=S?.isConnected?S:null,Ee=Ce?.isConnected&&Vn(Ce)!=="body"?Ce:null;let De=ke?Ee||je:je||Ee;return De||(De=$j()||null),typeof Te=="boolean"?De:Xa(Te)||De||null}return()=>{E.off("openchange",Be);const Se=Gn(ge),Te=Me(),je=We(k,Se)||Te.some(Le=>Le===Se||We(Le,Se))||D&&qr(D.nodesRef.current,A(),!1).some(Le=>We(Le.context?.elements.floating,Se)),Ee=B.current,De=Ve();queueMicrotask(()=>{const Le=RO(De),Ie=typeof Ee!="boolean";Ee&&!V.current&&Gt(Le)&&(!(!Ie&&Le!==Se&&Se!==ge.body)||je)&&Le.focus({preventScroll:!0}),V.current=!1})}},[o,k,le,B,P,E,D,S,A,Me]),ze(()=>{if(!Gr||w||!k)return;const ge=Gn(xt(k));!Gt(ge)||!op(ge)||We(k,ge)&&ge.blur()},[w,k]),ze(()=>{if(!(o||!L))return L.setFocusManagerState({modal:p,closeOnFocusOut:m,open:w,onOpenChange:y.setOpen,domReference:S}),()=>{L.setFocusManagerState(null)}},[o,L,p,w,y,m,S]),ze(()=>{if(!(o||!le))return Hj(le),()=>{queueMicrotask(Qb)}},[o,le]);const de=!o&&(p?!z:!0)&&(re||p);return s.jsxs(x.Fragment,{children:[de&&s.jsx(Zl,{"data-type":"inside",ref:X,onFocus:ge=>{if(p){const Ce=me();af(Ce[Ce.length-1])}else L?.portalNode&&(V.current=!1,Hl(ge,L.portalNode)?Vb(S)?.focus():Xa(b??L.beforeOutsideRef)?.focus())}}),a,de&&s.jsx(Zl,{"data-type":"inside",ref:Z,onFocus:ge=>{p?af(me()[0]):L?.portalNode&&(m&&(V.current=!0),Hl(ge,L.portalNode)?M2(S)?.focus():Xa(h??L.afterOutsideRef)?.focus())}})]})}function X2(e,t={}){const{enabled:a=!0,event:o="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:p=0,reason:m=fi}=t,g="rootStore"in e?e.rootStore:e,h=g.context.dataRef,b=x.useRef(void 0),_=Wl(),j=En(),N=x.useMemo(()=>{function y(S,k,E,R){const A=st(m,k,E);S&&R==="touch"&&p>0?j.start(p,()=>{g.setOpen(!0,A)}):g.setOpen(S,A)}function w(S,k,E){const R=h.current.openEvent,A=g.select("domReferenceElement")!==k;return S&&A||!S||!l?!0:R&&d?!E(R.type):!1}return{onPointerDown(S){b.current=S.pointerType},onMouseDown(S){const k=b.current,E=S.nativeEvent,R=g.select("open");if(S.button!==0||o==="click"||Ro(k,!0)&&c)return;const A=w(R,S.currentTarget,O=>O==="click"||O==="mousedown"),T=qn(E);if(op(T)){y(A,E,T,k);return}const z=S.currentTarget;_.request(()=>{y(A,E,z,k)})},onClick(S){if(o==="mousedown-only")return;const k=b.current;if(o==="mousedown"&&k){b.current=void 0;return}if(Ro(k,!0)&&c)return;const E=g.select("open"),R=w(E,S.currentTarget,A=>A==="click"||A==="mousedown"||A==="keydown"||A==="keyup");y(R,S.nativeEvent,S.currentTarget,k)},onKeyDown(){b.current=void 0}}},[h,o,c,m,g,d,l,_,j,p]);return x.useMemo(()=>a?{reference:N}:Xt,[a,N])}function TO(e,t){let a=null,o=null,l=!1;return{contextElement:e||void 0,getBoundingClientRect(){const c=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=t.axis==="x"||t.axis==="both",p=t.axis==="y"||t.axis==="both",m=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let g=c.width,h=c.height,b=c.x,_=c.y;return a==null&&t.x&&d&&(a=c.x-t.x),o==null&&t.y&&p&&(o=c.y-t.y),b-=a||0,_-=o||0,g=0,h=0,!l||m?(g=t.axis==="y"?c.width:0,h=t.axis==="x"?c.height:0,b=d&&t.x!=null?t.x:b,_=p&&t.y!=null?t.y:_):l&&!m&&(h=t.axis==="x"?c.height:h,g=t.axis==="y"?c.width:g),l=!0,{width:g,height:h,x:b,y:_,top:_,right:b+g,bottom:_+h,left:b}}}}function qj(e){return e!=null&&e.clientX!=null}function AO(e,t={}){const{enabled:a=!0,axis:o="both"}=t,l="rootStore"in e?e.rootStore:e,c=l.useState("open"),d=l.useState("floatingElement"),p=l.useState("domReferenceElement"),m=l.context.dataRef,g=x.useRef(!1),h=x.useRef(null),[b,_]=x.useState(),[j,N]=x.useState([]),y=Ue(R=>{l.set("positionReference",R)}),w=Ue((R,A,T)=>{g.current||m.current.openEvent&&!qj(m.current.openEvent)||l.set("positionReference",TO(T??p,{x:R,y:A,axis:o,dataRef:m,pointerType:b}))}),S=Ue(R=>{c?h.current||(w(R.clientX,R.clientY,R.currentTarget),N([])):w(R.clientX,R.clientY,R.currentTarget)}),k=Ro(b)?d:c;x.useEffect(()=>{if(!a){y(p);return}if(!k)return;function R(){h.current?.(),h.current=null}const A=Wt(d);function T(z){const O=qn(z);We(d,O)?R():w(z.clientX,z.clientY)}return!m.current.openEvent||qj(m.current.openEvent)?h.current=_t(A,"mousemove",T):y(p),R},[k,a,d,m,p,l,w,y,j]),x.useEffect(()=>()=>{l.set("positionReference",null)},[l]),x.useEffect(()=>{a&&!d&&(g.current=!1)},[a,d]),x.useEffect(()=>{!a&&c&&(g.current=!0)},[a,c]);const E=x.useMemo(()=>{function R(A){_(A.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:S,onMouseEnter:S}},[S]);return x.useMemo(()=>a?{reference:E,trigger:E}:{},[a,E])}function MO(){return!1}function OO(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function up(e,t={}){const{enabled:a=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:d=MO,bubbles:p,externalTree:m}=t,g="rootStore"in e?e.rootStore:e,h=g.useState("open"),b=g.useState("floatingElement"),{dataRef:_}=g.context,j=Qr(m),N=Ue(typeof l=="function"?l:()=>!1),y=typeof l=="function"?N:l,w=y!==!1,S=Ue(()=>c),{escapeKey:k,outsidePress:E}=OO(p),R=x.useRef(!1),A=x.useRef(!1),T=x.useRef(!1),z=x.useRef(!1),O=x.useRef(""),B=x.useRef(null),P=En(),U=En(),D=Ue(()=>{U.clear(),_.current.insideReactTree=!1}),L=Ue(X=>{const Z=_.current.floatingContext?.nodeId;return(j?qr(j.nodesRef.current,Z):[]).some(fe=>fe.context?.open&&!fe.context.dataRef.current[X])}),V=Ue(X=>th(X,g.select("floatingElement"))||th(X,g.select("domReferenceElement"))),H=Ue(X=>{d()&&g.setOpen(!1,st(fi,X.nativeEvent))}),$=Ue(X=>{if(!h||!a||!o||X.key!=="Escape"||z.current||!k&&L("__escapeKeyBubbles"))return;const Z=h4(X)?X.nativeEvent:X,W=st(ip,Z);g.setOpen(!1,W),W.isCanceled||X.preventDefault(),!k&&!W.isPropagationAllowed&&X.stopPropagation()}),F=Ue(()=>{_.current.insideReactTree=!0,U.start(0,D)}),Y=Ue(X=>{if(!h||!a||X.button!==0)return;const Z=qn(X.nativeEvent);We(g.select("floatingElement"),Z)&&(R.current||(R.current=!0,A.current=!1))}),G=Ue(X=>{!h||!a||(X.defaultPrevented||X.nativeEvent.defaultPrevented)&&R.current&&(A.current=!0)});x.useEffect(()=>{if(!h||!a)return;_.current.__escapeKeyBubbles=k,_.current.__outsidePressBubbles=E;const X=new Zs,Z=new Zs;function W(){X.clear(),z.current=!0}function fe(){X.start(Gr?5:0,()=>{z.current=!1})}function te(){T.current=!0,Z.start(0,()=>{T.current=!1})}function re(){R.current=!1,A.current=!1}function le(){const ue=O.current,ye=ue==="pen"||!ue?"mouse":ue,Ge=S(),Re=typeof Ge=="function"?Ge():Ge;return typeof Re=="string"?Re:Re[ye]}function me(ue){const ye=le();return ye==="intentional"&&ue.type!=="click"||ye==="sloppy"&&ue.type==="click"}function Me(ue){const ye=_.current.floatingContext?.nodeId,Ge=j&&qr(j.nodesRef.current,ye).some(Re=>th(ue,Re.context?.elements.floating));return V(ue)||Ge}function de(ue){if(me(ue)){ue.type!=="click"&&!V(ue)&&(Z.clear(),T.current=!1),D();return}if(_.current.insideReactTree){D();return}const ye=qn(ue),Ge=`[${Vc("inert")}]`,Re=bt(ye)?ye.getRootNode():null,Oe=Array.from((Xl(Re)?Re:xt(g.select("floatingElement"))).querySelectorAll(Ge)),tt=g.context.triggerElements;if(ye&&(tt.hasElement(ye)||tt.hasMatchingElement(vt=>We(vt,ye))))return;let ot=bt(ye)?ye:null;for(;ot&&!ma(ot);){const vt=_a(ot);if(ma(vt)||!bt(vt))break;ot=vt}if(!(Oe.length&&bt(ye)&&!j4(ye)&&!We(ye,g.select("floatingElement"))&&Oe.every(vt=>!We(ot,vt)))){if(Gt(ye)&&!("touches"in ue)){const vt=ma(ye),Mt=ps(ye),lt=/auto|scroll/,Rt=vt||lt.test(Mt.overflowX),_e=vt||lt.test(Mt.overflowY),Pe=Rt&&ye.clientWidth>0&&ye.scrollWidth>ye.clientWidth,Xe=_e&&ye.clientHeight>0&&ye.scrollHeight>ye.clientHeight,it=Mt.direction==="rtl",Qe=Xe&&(it?ue.offsetX<=ye.offsetWidth-ye.clientWidth:ue.offsetX>ye.clientWidth),mt=Pe&&ue.offsetY>ye.clientHeight;if(Qe||mt)return}if(!Me(ue)){if(le()==="intentional"&&T.current){Z.clear(),T.current=!1;return}typeof y=="function"&&!y(ue)||L("__outsidePressBubbles")||(g.setOpen(!1,st(lp,ue)),D())}}}function ge(ue){le()!=="sloppy"||ue.pointerType==="touch"||!g.select("open")||!a||V(ue)||de(ue)}function Ce(ue){if(le()!=="sloppy"||!g.select("open")||!a||V(ue))return;const ye=ue.touches[0];ye&&(B.current={startTime:Date.now(),startX:ye.clientX,startY:ye.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},P.start(1e3,()=>{B.current&&(B.current.dismissOnTouchEnd=!1,B.current.dismissOnMouseDown=!1)}))}function ke(ue,ye){const Ge=qn(ue);if(!Ge)return;const Re=_t(Ge,ue.type,()=>{ye(ue),Re()})}function Be(ue){O.current="touch",ke(ue,Ce)}function Ve(ue){P.clear(),ue.type==="pointerdown"&&(O.current=ue.pointerType),!(ue.type==="mousedown"&&B.current&&!B.current.dismissOnMouseDown)&&ke(ue,ye=>{ye.type==="pointerdown"?ge(ye):de(ye)})}function Se(ue){if(!R.current)return;const ye=A.current;if(re(),le()==="intentional"){if(ue.type==="pointercancel"){ye&&te();return}if(!Me(ue)){if(ye){te();return}typeof y=="function"&&!y(ue)||(Z.clear(),T.current=!0,D())}}}function Te(ue){if(le()!=="sloppy"||!B.current||V(ue))return;const ye=ue.touches[0];if(!ye)return;const Ge=Math.abs(ye.clientX-B.current.startX),Re=Math.abs(ye.clientY-B.current.startY),Oe=Math.sqrt(Ge*Ge+Re*Re);Oe>5&&(B.current.dismissOnTouchEnd=!0),Oe>10&&(de(ue),P.clear(),B.current=null)}function je(ue){ke(ue,Te)}function Ee(ue){le()!=="sloppy"||!B.current||V(ue)||(B.current.dismissOnTouchEnd&&de(ue),P.clear(),B.current=null)}function De(ue){ke(ue,Ee)}const Le=xt(b),Ie=ga(o&&ga(_t(Le,"keydown",$),_t(Le,"compositionstart",W),_t(Le,"compositionend",fe)),w&&ga(_t(Le,"click",Ve,!0),_t(Le,"pointerdown",Ve,!0),_t(Le,"pointerup",Se,!0),_t(Le,"pointercancel",Se,!0),_t(Le,"mousedown",Ve,!0),_t(Le,"mouseup",Se,!0),_t(Le,"touchstart",Be,!0),_t(Le,"touchmove",je,!0),_t(Le,"touchend",De,!0)));return()=>{Ie(),X.clear(),Z.clear(),re(),T.current=!1}},[_,b,o,w,y,h,a,k,E,$,D,S,L,V,j,g,P]),x.useEffect(D,[y,D]);const K=x.useMemo(()=>({onKeyDown:$,onPointerDown:H,onClick:H}),[$,H]),I=x.useMemo(()=>({onKeyDown:$,onPointerDown:G,onMouseDown:G,onClickCapture:F,onMouseDownCapture(X){F(),Y(X)},onPointerDownCapture(X){F(),Y(X)},onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[$,F,Y,G]);return x.useMemo(()=>a?{reference:K,floating:I,trigger:K}:{},[a,K,I])}function Vj(e,t,a){let{reference:o,floating:l}=e;const c=$s(t),d=Hb(t),p=$b(d),m=fs(t),g=c==="y",h=o.x+o.width/2-l.width/2,b=o.y+o.height/2-l.height/2,_=o[p]/2-l[p]/2;let j;switch(m){case"top":j={x:h,y:o.y-l.height};break;case"bottom":j={x:h,y:o.y+o.height};break;case"right":j={x:o.x+o.width,y:b};break;case"left":j={x:o.x-l.width,y:b};break;default:j={x:o.x,y:o.y}}switch(Kr(t)){case"start":j[d]-=_*(a&&g?-1:1);break;case"end":j[d]+=_*(a&&g?-1:1);break}return j}async function zO(e,t){var a;t===void 0&&(t={});const{x:o,y:l,platform:c,rects:d,elements:p,strategy:m}=e,{boundary:g="clippingAncestors",rootBoundary:h="viewport",elementContext:b="floating",altBoundary:_=!1,padding:j=0}=sr(t,e),N=w2(j),w=p[_?b==="floating"?"reference":"floating":b],S=qc(await c.getClippingRect({element:(a=await(c.isElement==null?void 0:c.isElement(w)))==null||a?w:w.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(p.floating)),boundary:g,rootBoundary:h,strategy:m})),k=b==="floating"?{x:o,y:l,width:d.floating.width,height:d.floating.height}:d.reference,E=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p.floating)),R=await(c.isElement==null?void 0:c.isElement(E))?await(c.getScale==null?void 0:c.getScale(E))||{x:1,y:1}:{x:1,y:1},A=qc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:k,offsetParent:E,strategy:m}):k);return{top:(S.top-A.top+N.top)/R.y,bottom:(A.bottom-S.bottom+N.bottom)/R.y,left:(S.left-A.left+N.left)/R.x,right:(A.right-S.right+N.right)/R.x}}const DO=50,PO=async(e,t,a)=>{const{placement:o="bottom",strategy:l="absolute",middleware:c=[],platform:d}=a,p=d.detectOverflow?d:{...d,detectOverflow:zO},m=await(d.isRTL==null?void 0:d.isRTL(t));let g=await d.getElementRects({reference:e,floating:t,strategy:l}),{x:h,y:b}=Vj(g,o,m),_=o,j=0;const N={};for(let y=0;y<c.length;y++){const w=c[y];if(!w)continue;const{name:S,fn:k}=w,{x:E,y:R,data:A,reset:T}=await k({x:h,y:b,initialPlacement:o,placement:_,strategy:l,middlewareData:N,rects:g,platform:p,elements:{reference:e,floating:t}});h=E??h,b=R??b,N[S]={...N[S],...A},T&&j<DO&&(j++,typeof T=="object"&&(T.placement&&(_=T.placement),T.rects&&(g=T.rects===!0?await d.getElementRects({reference:e,floating:t,strategy:l}):T.rects),{x:h,y:b}=Vj(g,_,m)),y=-1)}return{x:h,y:b,placement:_,strategy:l,middlewareData:N}},LO=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var a,o;const{placement:l,middlewareData:c,rects:d,initialPlacement:p,platform:m,elements:g}=t,{mainAxis:h=!0,crossAxis:b=!0,fallbackPlacements:_,fallbackStrategy:j="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:y=!0,...w}=sr(e,t);if((a=c.arrow)!=null&&a.alignmentOffset)return{};const S=fs(l),k=$s(p),E=fs(p)===p,R=await(m.isRTL==null?void 0:m.isRTL(g.floating)),A=_||(E||!y?[vf(p)]:q4(p)),T=N!=="none";!_&&T&&A.push(...Y4(p,y,N,R));const z=[p,...A],O=await m.detectOverflow(t,w),B=[];let P=((o=c.flip)==null?void 0:o.overflows)||[];if(h&&B.push(O[S]),b){const V=H4(l,d,R);B.push(O[V[0]],O[V[1]])}if(P=[...P,{placement:l,overflows:B}],!B.every(V=>V<=0)){var U,D;const V=(((U=c.flip)==null?void 0:U.index)||0)+1,H=z[V];if(H&&(!(b==="alignment"?k!==$s(H):!1)||P.every(Y=>$s(Y.placement)===k?Y.overflows[0]>0:!0)))return{data:{index:V,overflows:P},reset:{placement:H}};let $=(D=P.filter(F=>F.overflows[0]<=0).sort((F,Y)=>F.overflows[1]-Y.overflows[1])[0])==null?void 0:D.placement;if(!$)switch(j){case"bestFit":{var L;const F=(L=P.filter(Y=>{if(T){const G=$s(Y.placement);return G===k||G==="y"}return!0}).map(Y=>[Y.placement,Y.overflows.filter(G=>G>0).reduce((G,K)=>G+K,0)]).sort((Y,G)=>Y[1]-G[1])[0])==null?void 0:L[0];F&&($=F);break}case"initialPlacement":$=p;break}if(l!==$)return{reset:{placement:$}}}return{}}}};function Fj(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Gj(e){return U4.some(t=>e[t]>=0)}const IO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:a,platform:o}=t,{strategy:l="referenceHidden",...c}=sr(e,t);switch(l){case"referenceHidden":{const d=await o.detectOverflow(t,{...c,elementContext:"reference"}),p=Fj(d,a.reference);return{data:{referenceHiddenOffsets:p,referenceHidden:Gj(p)}}}case"escaped":{const d=await o.detectOverflow(t,{...c,altBoundary:!0}),p=Fj(d,a.floating);return{data:{escapedOffsets:p,escaped:Gj(p)}}}default:return{}}}}},Q2=new Set(["left","top"]);async function BO(e,t){const{placement:a,platform:o,elements:l}=e,c=await(o.isRTL==null?void 0:o.isRTL(l.floating)),d=fs(a),p=Kr(a),m=$s(a)==="y",g=Q2.has(d)?-1:1,h=c&&m?-1:1,b=sr(t,e);let{mainAxis:_,crossAxis:j,alignmentAxis:N}=typeof b=="number"?{mainAxis:b,crossAxis:0,alignmentAxis:null}:{mainAxis:b.mainAxis||0,crossAxis:b.crossAxis||0,alignmentAxis:b.alignmentAxis};return p&&typeof N=="number"&&(j=p==="end"?N*-1:N),m?{x:j*h,y:_*g}:{x:_*g,y:j*h}}const UO=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var a,o;const{x:l,y:c,placement:d,middlewareData:p}=t,m=await BO(t,e);return d===((a=p.offset)==null?void 0:a.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:l+m.x,y:c+m.y,data:{...m,placement:d}}}}},$O=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:a,y:o,placement:l,platform:c}=t,{mainAxis:d=!0,crossAxis:p=!1,limiter:m={fn:S=>{let{x:k,y:E}=S;return{x:k,y:E}}},...g}=sr(e,t),h={x:a,y:o},b=await c.detectOverflow(t,g),_=$s(fs(l)),j=Ub(_);let N=h[j],y=h[_];if(d){const S=j==="y"?"top":"left",k=j==="y"?"bottom":"right",E=N+b[S],R=N-b[k];N=kx(E,N,R)}if(p){const S=_==="y"?"top":"left",k=_==="y"?"bottom":"right",E=y+b[S],R=y-b[k];y=kx(E,y,R)}const w=m.fn({...t,[j]:N,[_]:y});return{...w,data:{x:w.x-a,y:w.y-o,enabled:{[j]:d,[_]:p}}}}}},HO=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:a,y:o,placement:l,rects:c,middlewareData:d}=t,{offset:p=0,mainAxis:m=!0,crossAxis:g=!0}=sr(e,t),h={x:a,y:o},b=$s(l),_=Ub(b);let j=h[_],N=h[b];const y=sr(p,t),w=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(m){const E=_==="y"?"height":"width",R=c.reference[_]-c.floating[E]+w.mainAxis,A=c.reference[_]+c.reference[E]-w.mainAxis;j<R?j=R:j>A&&(j=A)}if(g){var S,k;const E=_==="y"?"width":"height",R=Q2.has(fs(l)),A=c.reference[b]-c.floating[E]+(R&&((S=d.offset)==null?void 0:S[b])||0)+(R?0:w.crossAxis),T=c.reference[b]+c.reference[E]+(R?0:((k=d.offset)==null?void 0:k[b])||0)-(R?w.crossAxis:0);N<A?N=A:N>T&&(N=T)}return{[_]:j,[b]:N}}}},qO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var a,o;const{placement:l,rects:c,platform:d,elements:p}=t,{apply:m=()=>{},...g}=sr(e,t),h=await d.detectOverflow(t,g),b=fs(l),_=Kr(l),j=$s(l)==="y",{width:N,height:y}=c.floating;let w,S;b==="top"||b==="bottom"?(w=b,S=_===(await(d.isRTL==null?void 0:d.isRTL(p.floating))?"start":"end")?"left":"right"):(S=b,w=_==="end"?"top":"bottom");const k=y-h.top-h.bottom,E=N-h.left-h.right,R=Jl(y-h[w],k),A=Jl(N-h[S],E),T=!t.middlewareData.shift;let z=R,O=A;if((a=t.middlewareData.shift)!=null&&a.enabled.x&&(O=E),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(z=k),T&&!_){const P=ws(h.left,0),U=ws(h.right,0),D=ws(h.top,0),L=ws(h.bottom,0);j?O=N-2*(P!==0||U!==0?P+U:ws(h.left,h.right)):z=y-2*(D!==0||L!==0?D+L:ws(h.top,h.bottom))}await m({...t,availableWidth:O,availableHeight:z});const B=await d.getDimensions(p.floating);return N!==B.width||y!==B.height?{reset:{rects:!0}}:{}}}};function W2(e){const t=ps(e);let a=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const l=Gt(e),c=l?e.offsetWidth:a,d=l?e.offsetHeight:o,p=_f(a)!==c||_f(o)!==d;return p&&(a=c,o=d),{width:a,height:o,$:p}}function Zb(e){return bt(e)?e:e.contextElement}function ql(e){const t=Zb(e);if(!Gt(t))return ha(1);const a=t.getBoundingClientRect(),{width:o,height:l,$:c}=W2(t);let d=(c?_f(a.width):a.width)/o,p=(c?_f(a.height):a.height)/l;return(!d||!Number.isFinite(d))&&(d=1),(!p||!Number.isFinite(p))&&(p=1),{x:d,y:p}}const VO=ha(0);function Z2(e){const t=Wt(e);return!Db()||!t.visualViewport?VO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function FO(e,t,a){return t===void 0&&(t=!1),!a||t&&a!==Wt(e)?!1:t}function Mo(e,t,a,o){t===void 0&&(t=!1),a===void 0&&(a=!1);const l=e.getBoundingClientRect(),c=Zb(e);let d=ha(1);t&&(o?bt(o)&&(d=ql(o)):d=ql(e));const p=FO(c,a,o)?Z2(c):ha(0);let m=(l.left+p.x)/d.x,g=(l.top+p.y)/d.y,h=l.width/d.x,b=l.height/d.y;if(c){const _=Wt(c),j=o&&bt(o)?Wt(o):o;let N=_,y=vx(N);for(;y&&o&&j!==N;){const w=ql(y),S=y.getBoundingClientRect(),k=ps(y),E=S.left+(y.clientLeft+parseFloat(k.paddingLeft))*w.x,R=S.top+(y.clientTop+parseFloat(k.paddingTop))*w.y;m*=w.x,g*=w.y,h*=w.x,b*=w.y,m+=E,g+=R,N=Wt(y),y=vx(N)}}return qc({width:h,height:b,x:m,y:g})}function dp(e,t){const a=sp(e).scrollLeft;return t?t.left+a:Mo(wa(e)).left+a}function J2(e,t){const a=e.getBoundingClientRect(),o=a.left+t.scrollLeft-dp(e,a),l=a.top+t.scrollTop;return{x:o,y:l}}function GO(e){let{elements:t,rect:a,offsetParent:o,strategy:l}=e;const c=l==="fixed",d=wa(o),p=t?np(t.floating):!1;if(o===d||p&&c)return a;let m={scrollLeft:0,scrollTop:0},g=ha(1);const h=ha(0),b=Gt(o);if((b||!b&&!c)&&((Vn(o)!=="body"||Yr(d))&&(m=sp(o)),b)){const j=Mo(o);g=ql(o),h.x=j.x+o.clientLeft,h.y=j.y+o.clientTop}const _=d&&!b&&!c?J2(d,m):ha(0);return{width:a.width*g.x,height:a.height*g.y,x:a.x*g.x-m.scrollLeft*g.x+h.x+_.x,y:a.y*g.y-m.scrollTop*g.y+h.y+_.y}}function YO(e){return Array.from(e.getClientRects())}function KO(e){const t=wa(e),a=sp(e),o=e.ownerDocument.body,l=ws(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),c=ws(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let d=-a.scrollLeft+dp(e);const p=-a.scrollTop;return ps(o).direction==="rtl"&&(d+=ws(t.clientWidth,o.clientWidth)-l),{width:l,height:c,x:d,y:p}}const Yj=25;function XO(e,t){const a=Wt(e),o=wa(e),l=a.visualViewport;let c=o.clientWidth,d=o.clientHeight,p=0,m=0;if(l){c=l.width,d=l.height;const h=Db();(!h||h&&t==="fixed")&&(p=l.offsetLeft,m=l.offsetTop)}const g=dp(o);if(g<=0){const h=o.ownerDocument,b=h.body,_=getComputedStyle(b),j=h.compatMode==="CSS1Compat"&&parseFloat(_.marginLeft)+parseFloat(_.marginRight)||0,N=Math.abs(o.clientWidth-b.clientWidth-j);N<=Yj&&(c-=N)}else g<=Yj&&(c+=g);return{width:c,height:d,x:p,y:m}}function QO(e,t){const a=Mo(e,!0,t==="fixed"),o=a.top+e.clientTop,l=a.left+e.clientLeft,c=Gt(e)?ql(e):ha(1),d=e.clientWidth*c.x,p=e.clientHeight*c.y,m=l*c.x,g=o*c.y;return{width:d,height:p,x:m,y:g}}function Kj(e,t,a){let o;if(t==="viewport")o=XO(e,a);else if(t==="document")o=KO(wa(e));else if(bt(t))o=QO(t,a);else{const l=Z2(e);o={x:t.x-l.x,y:t.y-l.y,width:t.width,height:t.height}}return qc(o)}function eC(e,t){const a=_a(e);return a===t||!bt(a)||ma(a)?!1:ps(a).position==="fixed"||eC(a,t)}function WO(e,t){const a=t.get(e);if(a)return a;let o=Hc(e,[],!1).filter(p=>bt(p)&&Vn(p)!=="body"),l=null;const c=ps(e).position==="fixed";let d=c?_a(e):e;for(;bt(d)&&!ma(d);){const p=ps(d),m=zb(d);!m&&p.position==="fixed"&&(l=null),(c?!m&&!l:!m&&p.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Yr(d)&&!m&&eC(e,d))?o=o.filter(h=>h!==d):l=p,d=_a(d)}return t.set(e,o),o}function ZO(e){let{element:t,boundary:a,rootBoundary:o,strategy:l}=e;const d=[...a==="clippingAncestors"?np(t)?[]:WO(t,this._c):[].concat(a),o],p=Kj(t,d[0],l);let m=p.top,g=p.right,h=p.bottom,b=p.left;for(let _=1;_<d.length;_++){const j=Kj(t,d[_],l);m=ws(j.top,m),g=Jl(j.right,g),h=Jl(j.bottom,h),b=ws(j.left,b)}return{width:g-b,height:h-m,x:b,y:m}}function JO(e){const{width:t,height:a}=W2(e);return{width:t,height:a}}function ez(e,t,a){const o=Gt(t),l=wa(t),c=a==="fixed",d=Mo(e,!0,c,t);let p={scrollLeft:0,scrollTop:0};const m=ha(0);function g(){m.x=dp(l)}if(o||!o&&!c)if((Vn(t)!=="body"||Yr(l))&&(p=sp(t)),o){const j=Mo(t,!0,c,t);m.x=j.x+t.clientLeft,m.y=j.y+t.clientTop}else l&&g();c&&!o&&l&&g();const h=l&&!o&&!c?J2(l,p):ha(0),b=d.left+p.scrollLeft-m.x-h.x,_=d.top+p.scrollTop-m.y-h.y;return{x:b,y:_,width:d.width,height:d.height}}function oh(e){return ps(e).position==="static"}function Xj(e,t){if(!Gt(e)||ps(e).position==="fixed")return null;if(t)return t(e);let a=e.offsetParent;return wa(e)===a&&(a=a.ownerDocument.body),a}function tC(e,t){const a=Wt(e);if(np(e))return a;if(!Gt(e)){let l=_a(e);for(;l&&!ma(l);){if(bt(l)&&!oh(l))return l;l=_a(l)}return a}let o=Xj(e,t);for(;o&&b4(o)&&oh(o);)o=Xj(o,t);return o&&ma(o)&&oh(o)&&!zb(o)?a:o||y4(e)||a}const tz=async function(e){const t=this.getOffsetParent||tC,a=this.getDimensions,o=await a(e.floating);return{reference:ez(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function nz(e){return ps(e).direction==="rtl"}const nC={convertOffsetParentRelativeRectToViewportRelativeRect:GO,getDocumentElement:wa,getClippingRect:ZO,getOffsetParent:tC,getElementRects:tz,getClientRects:YO,getDimensions:JO,getScale:ql,isElement:bt,isRTL:nz};function sC(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function sz(e,t){let a=null,o;const l=wa(e);function c(){var p;clearTimeout(o),(p=a)==null||p.disconnect(),a=null}function d(p,m){p===void 0&&(p=!1),m===void 0&&(m=1),c();const g=e.getBoundingClientRect(),{left:h,top:b,width:_,height:j}=g;if(p||t(),!_||!j)return;const N=Td(b),y=Td(l.clientWidth-(h+_)),w=Td(l.clientHeight-(b+j)),S=Td(h),E={rootMargin:-N+"px "+-y+"px "+-w+"px "+-S+"px",threshold:ws(0,Jl(1,m))||1};let R=!0;function A(T){const z=T[0].intersectionRatio;if(z!==m){if(!R)return d();z?d(!1,z):o=setTimeout(()=>{d(!1,1e-7)},1e3)}z===1&&!sC(g,e.getBoundingClientRect())&&d(),R=!1}try{a=new IntersectionObserver(A,{...E,root:l.ownerDocument})}catch{a=new IntersectionObserver(A,E)}a.observe(e)}return d(!0),c}function Qj(e,t,a,o){o===void 0&&(o={});const{ancestorScroll:l=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:p=typeof IntersectionObserver=="function",animationFrame:m=!1}=o,g=Zb(e),h=l||c?[...g?Hc(g):[],...t?Hc(t):[]]:[];h.forEach(S=>{l&&S.addEventListener("scroll",a,{passive:!0}),c&&S.addEventListener("resize",a)});const b=g&&p?sz(g,a):null;let _=-1,j=null;d&&(j=new ResizeObserver(S=>{let[k]=S;k&&k.target===g&&j&&t&&(j.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var E;(E=j)==null||E.observe(t)})),a()}),g&&!m&&j.observe(g),t&&j.observe(t));let N,y=m?Mo(e):null;m&&w();function w(){const S=Mo(e);y&&!sC(y,S)&&a(),y=S,N=requestAnimationFrame(w)}return a(),()=>{var S;h.forEach(k=>{l&&k.removeEventListener("scroll",a),c&&k.removeEventListener("resize",a)}),b?.(),(S=j)==null||S.disconnect(),j=null,m&&cancelAnimationFrame(N)}}const az=UO,rz=$O,oz=LO,lz=qO,iz=IO,cz=HO,uz=(e,t,a)=>{const o=new Map,l={platform:nC,...a},c={...l.platform,_c:o};return PO(e,t,{...l,platform:c})};var dz=typeof document<"u",fz=function(){},rf=dz?x.useLayoutEffect:fz;function kf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let a,o,l;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==t.length)return!1;for(o=a;o--!==0;)if(!kf(e[o],t[o]))return!1;return!0}if(l=Object.keys(e),a=l.length,a!==Object.keys(t).length)return!1;for(o=a;o--!==0;)if(!{}.hasOwnProperty.call(t,l[o]))return!1;for(o=a;o--!==0;){const c=l[o];if(!(c==="_owner"&&e.$$typeof)&&!kf(e[c],t[c]))return!1}return!0}return e!==e&&t!==t}function aC(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wj(e,t){const a=aC(e);return Math.round(t*a)/a}function lh(e){const t=x.useRef(e);return rf(()=>{t.current=e}),t}function pz(e){e===void 0&&(e={});const{placement:t="bottom",strategy:a="absolute",middleware:o=[],platform:l,elements:{reference:c,floating:d}={},transform:p=!0,whileElementsMounted:m,open:g}=e,[h,b]=x.useState({x:0,y:0,strategy:a,placement:t,middlewareData:{},isPositioned:!1}),[_,j]=x.useState(o);kf(_,o)||j(o);const[N,y]=x.useState(null),[w,S]=x.useState(null),k=x.useCallback(Y=>{Y!==T.current&&(T.current=Y,y(Y))},[]),E=x.useCallback(Y=>{Y!==z.current&&(z.current=Y,S(Y))},[]),R=c||N,A=d||w,T=x.useRef(null),z=x.useRef(null),O=x.useRef(h),B=m!=null,P=lh(m),U=lh(l),D=lh(g),L=x.useCallback(()=>{if(!T.current||!z.current)return;const Y={placement:t,strategy:a,middleware:_};U.current&&(Y.platform=U.current),uz(T.current,z.current,Y).then(G=>{const K={...G,isPositioned:D.current!==!1};V.current&&!kf(O.current,K)&&(O.current=K,qs.flushSync(()=>{b(K)}))})},[_,t,a,U,D]);rf(()=>{g===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,b(Y=>({...Y,isPositioned:!1})))},[g]);const V=x.useRef(!1);rf(()=>(V.current=!0,()=>{V.current=!1}),[]),rf(()=>{if(R&&(T.current=R),A&&(z.current=A),R&&A){if(P.current)return P.current(R,A,L);L()}},[R,A,L,P,B]);const H=x.useMemo(()=>({reference:T,floating:z,setReference:k,setFloating:E}),[k,E]),$=x.useMemo(()=>({reference:R,floating:A}),[R,A]),F=x.useMemo(()=>{const Y={position:a,left:0,top:0};if(!$.floating)return Y;const G=Wj($.floating,h.x),K=Wj($.floating,h.y);return p?{...Y,transform:"translate("+G+"px, "+K+"px)",...aC($.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:G,top:K}},[a,p,$.floating,h.x,h.y]);return x.useMemo(()=>({...h,update:L,refs:H,elements:$,floatingStyles:F}),[h,L,H,$,F])}const mz=(e,t)=>{const a=az(e);return{name:a.name,fn:a.fn,options:[e,t]}},gz=(e,t)=>{const a=rz(e);return{name:a.name,fn:a.fn,options:[e,t]}},hz=(e,t)=>({fn:cz(e).fn,options:[e,t]}),xz=(e,t)=>{const a=oz(e);return{name:a.name,fn:a.fn,options:[e,t]}},bz=(e,t)=>{const a=lz(e);return{name:a.name,fn:a.fn,options:[e,t]}},_z=(e,t)=>{const a=iz(e);return{name:a.name,fn:a.fn,options:[e,t]}};function Jb(e){const t=x.useRef(!0);t.current&&(t.current=!1,e())}const Ae=(e,t,a,o,l,c,...d)=>{if(d.length>0)throw new Error(ln(1));let p;if(e)p=e;else throw new Error("Missing arguments");return p};var ih={exports:{}},ch={};/**
|
|
726
|
+
* @license React
|
|
727
|
+
* use-sync-external-store-shim.production.js
|
|
728
|
+
*
|
|
729
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
730
|
+
*
|
|
731
|
+
* This source code is licensed under the MIT license found in the
|
|
732
|
+
* LICENSE file in the root directory of this source tree.
|
|
733
|
+
*/var Zj;function vz(){if(Zj)return ch;Zj=1;var e=Qc();function t(b,_){return b===_&&(b!==0||1/b===1/_)||b!==b&&_!==_}var a=typeof Object.is=="function"?Object.is:t,o=e.useState,l=e.useEffect,c=e.useLayoutEffect,d=e.useDebugValue;function p(b,_){var j=_(),N=o({inst:{value:j,getSnapshot:_}}),y=N[0].inst,w=N[1];return c(function(){y.value=j,y.getSnapshot=_,m(y)&&w({inst:y})},[b,j,_]),l(function(){return m(y)&&w({inst:y}),b(function(){m(y)&&w({inst:y})})},[b]),d(j),j}function m(b){var _=b.getSnapshot;b=b.value;try{var j=_();return!a(b,j)}catch{return!0}}function g(b,_){return _()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:p;return ch.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,ch}var Jj;function rC(){return Jj||(Jj=1,ih.exports=vz()),ih.exports}var Sf=rC(),uh={exports:{}},dh={};/**
|
|
734
|
+
* @license React
|
|
735
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
736
|
+
*
|
|
737
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
738
|
+
*
|
|
739
|
+
* This source code is licensed under the MIT license found in the
|
|
740
|
+
* LICENSE file in the root directory of this source tree.
|
|
741
|
+
*/var ew;function yz(){if(ew)return dh;ew=1;var e=Qc(),t=rC();function a(g,h){return g===h&&(g!==0||1/g===1/h)||g!==g&&h!==h}var o=typeof Object.is=="function"?Object.is:a,l=t.useSyncExternalStore,c=e.useRef,d=e.useEffect,p=e.useMemo,m=e.useDebugValue;return dh.useSyncExternalStoreWithSelector=function(g,h,b,_,j){var N=c(null);if(N.current===null){var y={hasValue:!1,value:null};N.current=y}else y=N.current;N=p(function(){function S(T){if(!k){if(k=!0,E=T,T=_(T),j!==void 0&&y.hasValue){var z=y.value;if(j(z,T))return R=z}return R=T}if(z=R,o(E,T))return z;var O=_(T);return j!==void 0&&j(z,O)?(E=T,z):(E=T,R=O)}var k=!1,E,R,A=b===void 0?null:b;return[function(){return S(h())},A===null?void 0:function(){return S(A())}]},[h,b,_,j]);var w=l(g,N[0],N[1]);return d(function(){y.hasValue=!0,y.value=w},[w]),m(w),w},dh}var tw;function jz(){return tw||(tw=1,uh.exports=yz()),uh.exports}var wz=jz();const kz=Fb(19),Sz=kz?Nz:Ez;function nt(e,t,a,o,l){return Sz(e,t,a,o,l)}function Cz(e,t,a,o,l){const c=x.useCallback(()=>t(e.getSnapshot(),a,o,l),[e,t,a,o,l]);return Sf.useSyncExternalStore(e.subscribe,c,c)}r4({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let a=0;a<e.syncHooks.length;a+=1){const o=e.syncHooks[a],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 a=new Set;for(const l of e.syncHooks)a.add(l.store);const o=[];for(const l of a)o.push(l.subscribe(t));return()=>{for(const l of o)l()}}),Sf.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Nz(e,t,a,o,l){const c=a4();if(!c)return Cz(e,t,a,o,l);const d=c.syncIndex;c.syncIndex+=1;let p;return c.didInitialize?(p=c.syncHooks[d],(p.store!==e||p.selector!==t||!Object.is(p.a1,a)||!Object.is(p.a2,o)||!Object.is(p.a3,l))&&(p.store!==e&&(c.didChangeStore=!0),p.store=e,p.selector=t,p.a1=a,p.a2=o,p.a3=l,p.value=t(e.getSnapshot(),a,o,l))):(p={store:e,selector:t,a1:a,a2:o,a3:l,value:t(e.getSnapshot(),a,o,l)},c.syncHooks.push(p)),p.value}function Ez(e,t,a,o,l){return wz.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>t(c,a,o,l))}class oC{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const a=this.updateTick;for(const o of this.listeners){if(a!==this.updateTick)return;o(t)}}update(t){for(const a in t)if(!Object.is(this.state[a],t[a])){this.setState({...this.state,...t});return}}set(t,a){Object.is(this.state[t],a)||this.setState({...this.state,[t]:a})}notifyAll(){const t={...this.state};this.setState(t)}use(t,a,o,l){return nt(this,t,a,o,l)}}class fp extends oC{constructor(t,a={},o){super(t),this.context=a,this.selectors=o}useSyncedValue(t,a){x.useDebugValue(t);const o=this;ze(()=>{o.state[t]!==a&&o.set(t,a)},[o,t,a])}useSyncedValueWithCleanup(t,a){const o=this;ze(()=>(o.state[t]!==a&&o.set(t,a),()=>{o.set(t,void 0)}),[o,t,a])}useSyncedValues(t){const a=this,o=Object.values(t);ze(()=>{a.update(t)},[a,...o])}useControlledProp(t,a){x.useDebugValue(t);const o=this,l=a!==void 0;ze(()=>{l&&!Object.is(o.state[t],a)&&o.setState({...o.state,[t]:a})},[o,t,a,l])}select(t,a,o,l){const c=this.selectors[t];return c(this.state,a,o,l)}useState(t,a,o,l){return x.useDebugValue(t),nt(this,this.selectors[t],a,o,l)}useContextCallback(t,a){x.useDebugValue(t);const o=Ue(a??Mn);this.context[t]=o}useStateSetter(t){const a=x.useRef(void 0);return a.current===void 0&&(a.current=o=>{this.set(t,o)}),a.current}observe(t,a){let o;typeof t=="function"?o=t:o=this.selectors[t];let l=o(this.state);return a(l,l,this),this.subscribe(c=>{const d=o(c);if(!Object.is(l,d)){const p=l;l=d,a(d,p,this)}})}}const Rz={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 pp extends fp{constructor(t){const{syncOnly:a,nested:o,onOpenChange:l,triggerElements:c,...d}=t;super({...d,positionReference:d.referenceElement,domReferenceElement:d.referenceElement},{onOpenChange:l,dataRef:{current:{}},events:F2(),nested:o,triggerElements:c},Rz),this.syncOnly=a}syncOpenEvent=(t,a)=>{(!t||!this.state.open||a!=null&&x4(a))&&(this.context.dataRef.current.openEvent=t?a:void 0)};dispatchOpenChange=(t,a)=>{this.syncOpenEvent(t,a.event);const o={open:t,reason:a.reason,nativeEvent:a.event,nested:this.context.nested,triggerElement:a.trigger};this.context.events.emit("openchange",o)};setOpen=(t,a)=>{if(this.syncOnly){this.context.onOpenChange?.(t,a);return}this.dispatchOpenChange(t,a),this.context.onOpenChange?.(t,a)}}function lC(e){const{popupStore:t,treatPopupAsFloatingElement:a=!1,floatingRootContext:o,floatingId:l,nested:c,onOpenChange:d}=e,p=t.useState("open"),m=t.useState("activeTriggerElement"),g=t.useState(a?"popupElement":"positionerElement"),h=t.context.triggerElements,b=d,_=x.useRef(null);o===void 0&&_.current===null&&(_.current=new pp({open:p,transitionStatus:void 0,referenceElement:m,floatingElement:g,triggerElements:h,onOpenChange:b,floatingId:l,syncOnly:!0,nested:c}));const j=o??_.current;return t.useSyncedValue("floatingId",l),ze(()=>{const N={open:p,floatingId:l,referenceElement:m,floatingElement:g};bt(m)&&(N.domReferenceElement=m),j.state.positionReference===j.state.referenceElement&&(N.positionReference=m),j.update(N)},[p,l,m,g,j]),j.context.onOpenChange=b,j.context.nested=c,j}function pi(e,t=!1,a=!1){const[o,l]=x.useState(e&&t?"idle":void 0),[c,d]=x.useState(e);return e&&!c&&(d(!0),l("starting")),!e&&c&&o!=="ending"&&!a&&l("ending"),!e&&!c&&o==="ending"&&l(void 0),ze(()=>{if(!e&&c&&o!=="ending"&&a){const p=da.request(()=>{l("ending")});return()=>{da.cancel(p)}}},[e,c,o,a]),ze(()=>{if(!e||t)return;const p=da.request(()=>{l(void 0)});return()=>{da.cancel(p)}},[t,e]),ze(()=>{if(!e||!t)return;e&&c&&o!=="idle"&&l("starting");const p=da.request(()=>{l("idle")});return()=>{da.cancel(p)}},[t,e,c,o]),{mounted:c,setMounted:d,transitionStatus:o}}let Oo=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const Tz={[Oo.startingStyle]:""},Az={[Oo.endingStyle]:""},or={transitionStatus(e){return e==="starting"?Tz:e==="ending"?Az:null}};function iC(e,t=!1,a=!0){const o=Wl();return Ue((l,c=null)=>{o.cancel();const d=Xa(e);if(d==null)return;const p=d,m=()=>{qs.flushSync(l)};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){l();return}function g(){Promise.all(p.getAnimations().map(h=>h.finished)).then(()=>{c?.aborted||m()}).catch(()=>{if(a){c?.aborted||m();return}const h=p.getAnimations();!c?.aborted&&h.length>0&&h.some(b=>b.pending||b.playState!=="finished")&&g()})}if(t){const h=Oo.startingStyle;if(!p.hasAttribute(h)){o.request(g);return}const b=new MutationObserver(()=>{p.hasAttribute(h)||(b.disconnect(),g())});b.observe(p,{attributes:!0,attributeFilter:[h]}),c?.addEventListener("abort",()=>b.disconnect(),{once:!0});return}o.request(g)})}function ka(e){const{enabled:t=!0,open:a,ref:o,onComplete:l}=e,c=Ue(l),d=iC(o,a,!1);x.useEffect(()=>{if(!t)return;const p=new AbortController;return d(c,p.signal),()=>{p.abort()}},[t,a,c,d])}const mp={tabIndex:-1,[yx]:""};function Mz(e){return t=>t==="touch"?e.current:!0}function cC(e,t,a=!1){const o=Ao(),l=Xr()!=null,c=x.useRef(null);e===void 0&&c.current===null&&(c.current=t(o,l));const d=e??c.current;return lC({popupStore:d,treatPopupAsFloatingElement:a,floatingRootContext:d.state.floatingRootContext,floatingId:o,nested:l,onOpenChange:d.setOpen}),{store:d,internalStore:c.current}}function Oz(e,t){const a=x.useRef(null),o=x.useRef(null);return x.useCallback(l=>{if(e===void 0)return;let c=!1;if(a.current!==null){const d=a.current,p=o.current,m=t.context.triggerElements.getById(d);p&&m===p&&(t.context.triggerElements.delete(d),c=!0),a.current=null,o.current=null}if(l!==null&&(a.current=e,o.current=l,t.context.triggerElements.add(e,l),c=!0),c){const d=t.context.triggerElements.size;t.select("open")&&t.state.triggerCount!==d&&t.set("triggerCount",d)}},[t,e])}function e_(e,t,a,o=!1){t?e.preventUnmountingOnClose=!1:o&&(e.preventUnmountingOnClose=!0);const l=a?.id??null;(l||t)&&(e.activeTriggerId=l,e.activeTriggerElement=a??null)}function uC(e){let t=!1;return e.preventUnmountOnClose=()=>{t=!0},()=>t}function zz(e,t,a,o={}){const l=a.reason,c=l===On,d=t&&l===Ul,p=!t&&(l===fi||l===ip),m=uC(a);if(e.context.onOpenChange?.(t,a),a.isCanceled)return;o.onBeforeDispatch?.(),e.state.floatingRootContext.dispatchOpenChange(t,a);const g=()=>{const h={...o.extraState,open:t};d?h.instantType="focus":p?h.instantType="dismiss":c&&(h.instantType=void 0),e_(h,t,a.trigger,m()),e.update(h)};c?qs.flushSync(g):g()}function dC(e,t,a,o){Jb(()=>{t===void 0&&e.state.open===!1&&a&&(e.state={...e.state,open:!0,activeTriggerId:o,preventUnmountingOnClose:!1})})}function fC(e,t,a,o){const l=a.useState("isMountedByTrigger",e),c=Oz(e,a),d=Ue(p=>{if(c(p),!p)return;const m=a.select("open"),g=a.select("activeTriggerId");if(g===e){a.update({activeTriggerElement:p,...m?o:null});return}g==null&&m&&a.update({activeTriggerId:e,activeTriggerElement:p,...o})});return ze(()=>{l&&a.update({activeTriggerElement:t.current,...o})},[l,a,t,...Object.values(o)]),{registerTrigger:d,isMountedByThisTrigger:l}}function t_(e,t={}){const{closeOnActiveTriggerUnmount:a=!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,d={};e.state.triggerCount!==c&&(d.triggerCount=c);const p=e.select("activeTriggerId");let m=null;if(p){const g=e.context.triggerElements.getById(p);g?g!==e.state.activeTriggerElement&&(d.activeTriggerElement=g):m=p}if(!m&&!p&&c===1){const g=e.context.triggerElements.entries().next();if(!g.done){const[h,b]=g.value;d.activeTriggerId=h,d.activeTriggerElement=b}}(d.triggerCount!==void 0||d.activeTriggerId!==void 0||d.activeTriggerElement!==void 0)&&e.update(d),m&&a&&queueMicrotask(()=>{if(e.select("open")&&e.select("activeTriggerId")===m&&!e.context.triggerElements.getById(m)){const g=st(va);e.setOpen(!1,g),g.isCanceled||e.update({activeTriggerId:null,activeTriggerElement:null})}})},[o,e,l,a])}function n_(e,t,a){const{mounted:o,setMounted:l,transitionStatus:c}=pi(e),d=t.useState("preventUnmountingOnClose"),p=e?!1:d;t.useSyncedValues({mounted:o,transitionStatus:c,preventUnmountingOnClose:p});const m=Ue(()=>{l(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),a?.(),t.context.onOpenChangeComplete?.(!1)});return ka({enabled:o&&!e&&!p,open:e,ref:t.context.popupRef,onComplete(){e||m()}}),{forceUnmount:m,transitionStatus:c}}function s_(e,t){e.useSyncedValues(t),ze(()=>()=>{e.update({activeTriggerProps:Xt,inactiveTriggerProps:Xt,popupProps:Xt})},[e])}function Dz(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 ou{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,a){const o=this.idMap.get(t);o!==a&&(o!==void 0&&this.elementsSet.delete(o),this.elementsSet.add(a),this.idMap.set(t,a))}delete(t){const a=this.idMap.get(t);a&&(this.elementsSet.delete(a),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const a of this.elementsSet)if(t(a))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 Pz(){return new pp({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new ou,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function a_(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:Pz(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Xt,inactiveTriggerProps:Xt,popupProps:Xt}}function pC(e,t,a=!1){return new pp({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:t,syncOnly:!0,nested:a,onOpenChange:void 0})}const Oc=Ae(e=>e.triggerIdProp??e.activeTriggerId),r_=Ae(e=>e.openProp??e.open),nw=Ae(e=>(e.popupElement?.id??e.floatingId)||void 0);function mC(e,t){return t!==void 0&&r_(e)&&Oc(e)===t}function Lz(e,t){return mC(e,t)?!0:t!==void 0&&r_(e)&&Oc(e)==null&&e.triggerCount===1}const o_={open:r_,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:Oc,activeTriggerElement:Ae(e=>e.mounted?e.activeTriggerElement:null),popupId:nw,isTriggerActive:Ae((e,t)=>t!==void 0&&Oc(e)===t),isOpenedByTrigger:Ae((e,t)=>mC(e,t)),isMountedByTrigger:Ae((e,t)=>t!==void 0&&Oc(e)===t&&e.mounted),triggerProps:Ae((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Ae((e,t)=>Lz(e,t)?nw(e):void 0),popupProps:Ae(e=>e.popupProps),popupElement:Ae(e=>e.popupElement),positionerElement:Ae(e=>e.positionerElement)};function gC(e){const{open:t=!1,onOpenChange:a,elements:o={}}=e,l=Ao(),c=Xr()!=null,d=es(()=>new pp({open:t,transitionStatus:void 0,onOpenChange:a,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new ou,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=bt(o.reference)?o.reference:null),o.floating!==void 0&&(p.floatingElement=o.floating),d.update(p)},[t,l,o.reference,o.floating,d]),d.context.onOpenChange=a,d.context.nested=c,d}function Iz(e={}){const{nodeId:t,externalTree:a}=e,o=gC(e),l=e.rootContext||o,c=l.useState("referenceElement"),d=l.useState("floatingElement"),p=l.useState("domReferenceElement"),m=l.useState("open"),g=l.useState("floatingId"),[h,b]=x.useState(null),[_,j]=x.useState(void 0),[N,y]=x.useState(void 0),w=x.useRef(null),S=Qr(a),k=x.useMemo(()=>({reference:c,floating:d,domReference:p}),[c,d,p]),E=pz({...e,elements:{...k,...h&&{reference:h}}}),R=bt(_)?_:null,A=N===void 0?l.state.floatingElement:N;l.useSyncedValue("referenceElement",_??null),l.useSyncedValue("domReferenceElement",_===void 0?p:R),l.useSyncedValue("floatingElement",A);const T=x.useCallback(D=>{const L=bt(D)?{getBoundingClientRect:()=>D.getBoundingClientRect(),getClientRects:()=>D.getClientRects(),contextElement:D}:D;b(L),E.refs.setReference(L)},[E.refs]),z=x.useCallback(D=>{(bt(D)||D===null)&&(w.current=D,j(D)),(bt(E.refs.reference.current)||E.refs.reference.current===null||D!==null&&!bt(D))&&E.refs.setReference(D)},[E.refs,j]),O=x.useCallback(D=>{y(D),E.refs.setFloating(D)},[E.refs]),B=x.useMemo(()=>({...E.refs,setReference:z,setFloating:O,setPositionReference:T,domReference:w}),[E.refs,z,O,T]),P=x.useMemo(()=>({...E.elements,domReference:p}),[E.elements,p]),U=x.useMemo(()=>({...E,dataRef:l.context.dataRef,open:m,onOpenChange:l.setOpen,events:l.context.events,floatingId:g,refs:B,elements:P,nodeId:t,rootStore:l}),[E,B,P,t,l,m,g]);return ze(()=>{p&&(w.current=p)},[p]),ze(()=>{l.context.dataRef.current.floatingContext=U;const D=S?.nodesRef.current.find(L=>L.id===t);D&&(D.context=U)}),x.useMemo(()=>({...E,context:U,refs:B,elements:P,rootStore:l}),[E,B,P,U,l])}const fh=Tb&&Gr;function hC(e,t={}){const{enabled:a=!0,delay:o}=t,l="rootStore"in e?e.rootStore:e,{events:c,dataRef:d}=l.context,p=x.useRef(!1),m=x.useRef(null),g=x.useRef(!0),h=En();x.useEffect(()=>{const _=l.select("domReferenceElement");if(!a)return;const j=Wt(_);function N(){const S=l.select("domReferenceElement");!l.select("open")&&Gt(S)&&S===Gn(xt(S))&&(p.current=!0)}function y(){g.current=!0}function w(){g.current=!1}return ga(_t(j,"blur",N),fh&&_t(j,"keydown",y,!0),fh&&_t(j,"pointerdown",w,!0))},[l,a]),x.useEffect(()=>{if(!a)return;function _(j){if(j.reason===fi||j.reason===ip){const N=l.select("domReferenceElement");bt(N)&&(m.current=N,p.current=!0)}}return c.on("openchange",_),()=>{c.off("openchange",_)}},[c,a,l]);const b=x.useMemo(()=>{function _(){p.current=!1,m.current=null}return{onMouseLeave(){_()},onFocus(j){const N=j.currentTarget;if(p.current){if(m.current===N)return;_()}const y=qn(j.nativeEvent);if(bt(y)){if(fh&&!j.relatedTarget){if(!g.current&&!op(y))return}else if(!k4(y))return}const w=xf(j.relatedTarget,l.context.triggerElements),{nativeEvent:S,currentTarget:k}=j,E=typeof o=="function"?o():o;if(l.select("open")&&w||E===0||E===void 0){l.setOpen(!0,st(Ul,S,k));return}h.start(E,()=>{p.current||l.setOpen(!0,st(Ul,S,k))})},onBlur(j){_();const N=j.relatedTarget,y=j.nativeEvent,w=bt(N)&&N.hasAttribute(Vc("focus-guard"))&&N.getAttribute("data-type")==="outside";h.start(0,()=>{const S=l.select("domReferenceElement"),k=Gn(xt(S));!N&&k===S||We(d.current.floatingContext?.refs.floating.current,k)||We(S,k)||w||xf(N??k,l.context.triggerElements)||l.setOpen(!1,st(Ul,y))})}}},[d,o,l,h]);return x.useMemo(()=>a?{reference:b,trigger:b}:{},[a,b])}class l_{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 Zs,this.restTimeout=new Zs,this.handleCloseOptions=void 0}static create(){return new l_}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Cf=new WeakMap;function Nf(e){if(!e.performedPointerEventsMutation)return;const t=e.pointerEventsScopeElement;t&&Cf.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Cf.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function xC(e,t){const{scopeElement:a,referenceElement:o,floatingElement:l}=t,c=Cf.get(a);c&&c!==e&&Nf(c),Nf(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=a,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=l,Cf.set(a,e),a.style.pointerEvents="none",o.style.pointerEvents="auto",l.style.pointerEvents="auto"}function i_(e){const t=e.context.dataRef.current,a=es(()=>t.hoverInteractionState??l_.create()).current;return t.hoverInteractionState||(t.hoverInteractionState=a),Rb(t.hoverInteractionState.disposeEffect),t.hoverInteractionState}function bC(e,t={}){const{enabled:a=!0,closeDelay:o=0,nodeId:l}=t,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),p=c.useState("floatingElement"),m=c.useState("domReferenceElement"),{dataRef:g}=c.context,h=Qr(),b=Xr(),_=i_(c),j=En(),N=Ue(()=>g2(g.current.openEvent?.type,_.interactedInside)),y=Ue(()=>C4(g.current.openEvent?.type)),w=Ue(()=>{Nf(_)});ze(()=>{d||(_.pointerType=void 0,_.restTimeoutPending=!1,_.interactedInside=!1,w())},[d,_,w]),x.useEffect(()=>w,[w]),ze(()=>{if(a&&d&&_.handleCloseOptions?.blockPointerEvents&&y()&&bt(m)&&p){const S=m,k=p,E=xt(p),R=h?.nodesRef.current.find(O=>O.id===b)?.context?.elements.floating;R&&(R.style.pointerEvents="");const A=_.pointerEventsScopeElement!==k?_.pointerEventsScopeElement:null,T=R!==k?R:null,z=_.handleCloseOptions?.getScope?.()??A??T??S.closest("[data-rootownerid]")??E.body;return xC(_,{scopeElement:z,referenceElement:S,floatingElement:k}),()=>{w()}}},[a,d,m,p,_,y,h,b,w]),x.useEffect(()=>{if(!a)return;function S(){return!!(h&&b&&qr(h.nodesRef.current,b).length>0)}function k(O){const B=Ql(o,"close",_.pointerType),P=()=>{c.setOpen(!1,st(On,O)),h?.events.emit("floating.closed",O)};B?_.openChangeTimeout.start(B,P):(_.openChangeTimeout.clear(),P())}function E(O){const B=qn(O);if(!w4(B)){_.interactedInside=!1;return}_.interactedInside=B?.closest("[aria-haspopup]")!=null}function R(){_.openChangeTimeout.clear(),j.clear(),h?.events.off("floating.closed",T),w()}function A(O){if(S()&&h){h.events.on("floating.closed",T);return}if(xf(O.relatedTarget,c.context.triggerElements))return;const B=g.current.floatingContext?.nodeId??l,P=O.relatedTarget;if(!(h&&B&&bt(P)&&qr(h.nodesRef.current,B,!1).some(D=>We(D.context?.elements.floating,P)))){if(_.handler){_.handler(O);return}w(),y()&&!N()&&k(O)}}function T(O){!h||!b||S()||j.start(0,()=>{h.events.off("floating.closed",T),c.setOpen(!1,st(On,O)),h.events.emit("floating.closed",O)})}const z=p;return ga(z&&_t(z,"mouseenter",R),z&&_t(z,"mouseleave",A),z&&_t(z,"pointerdown",E,!0),()=>{h?.events.off("floating.closed",T)})},[a,p,c,g,o,l,y,N,w,_,h,b,j])}const Bz={current:null};function _C(e,t={}){const{enabled:a=!0,delay:o=0,handleClose:l=null,mouseOnly:c=!1,restMs:d=0,move:p=!0,triggerElementRef:m=Bz,externalTree:g,isActiveTrigger:h=!0,getHandleCloseContext:b,isClosing:_,shouldOpen:j}=t,N="rootStore"in e?e.rootStore:e,{dataRef:y,events:w}=N.context,S=Qr(g),k=i_(N),E=x.useRef(!1),R=pn(l),A=pn(o),T=pn(d),z=pn(a),O=pn(j),B=pn(_),P=Ue(()=>g2(y.current.openEvent?.type,k.interactedInside)),U=Ue(()=>O.current?.()!==!1),D=Ue((H,$,F)=>{const Y=N.context.triggerElements;if(Y.hasElement($))return!H||!We(H,$);if(!bt(F))return!1;const G=F;return Y.hasMatchingElement(K=>We(K,G))&&(!H||!We(H,G))}),L=Ue(()=>{if(!k.handler)return;xt(N.select("domReferenceElement")).removeEventListener("mousemove",k.handler),k.handler=void 0}),V=Ue(()=>{Nf(k)});return h&&(k.handleCloseOptions=R.current?.__options),x.useEffect(()=>L,[L]),x.useEffect(()=>{if(!a)return;function H($){$.open?E.current=!1:(E.current=$.reason===On,L(),k.openChangeTimeout.clear(),k.restTimeout.clear(),k.blockMouseMove=!0,k.restTimeoutPending=!1)}return w.on("openchange",H),()=>{w.off("openchange",H)}},[a,w,k,L]),x.useEffect(()=>{if(!a)return;function H(G,K=!0){const I=Ql(A.current,"close",k.pointerType);I?k.openChangeTimeout.start(I,()=>{N.setOpen(!1,st(On,G)),S?.events.emit("floating.closed",G)}):K&&(k.openChangeTimeout.clear(),N.setOpen(!1,st(On,G)),S?.events.emit("floating.closed",G))}const $=m.current??(h?N.select("domReferenceElement"):null);if(!bt($))return;function F(G){if(k.openChangeTimeout.clear(),k.blockMouseMove=!1,c&&!Ro(k.pointerType))return;const K=kj(T.current),I=Ql(A.current,"open",k.pointerType),X=qn(G),Z=G.currentTarget??null,W=N.select("domReferenceElement");let fe=Z;if(bt(X)&&!N.context.triggerElements.hasElement(X)){for(const ke of N.context.triggerElements.elements())if(We(ke,X)){fe=ke;break}}bt(Z)&&bt(W)&&!N.context.triggerElements.hasElement(Z)&&We(Z,W)&&(fe=W);const te=fe==null?!1:D(W,fe,X),re=N.select("open"),le=B.current?.()??N.select("transitionStatus")==="ending",me=!re&&le&&E.current,Me=!te&&bt(fe)&&bt(W)&&We(W,fe)&&me,de=K>0&&!I,ge=te&&(re||me)||Me,Ce=!re||te;if(ge){U()&&N.setOpen(!0,st(On,G,fe));return}de||(I?k.openChangeTimeout.start(I,()=>{Ce&&U()&&N.setOpen(!0,st(On,G,fe))}):Ce&&U()&&N.setOpen(!0,st(On,G,fe)))}function Y(G){if(P()){V();return}L();const K=N.select("domReferenceElement"),I=xt(K);k.restTimeout.clear(),k.restTimeoutPending=!1;const X=y.current.floatingContext??b?.();if(xf(G.relatedTarget,N.context.triggerElements))return;if(R.current&&X){N.select("open")||k.openChangeTimeout.clear();const W=m.current;k.handler=R.current({...X,tree:S,x:G.clientX,y:G.clientY,onClose(){V(),L(),z.current&&!P()&&W===N.select("domReferenceElement")&&H(G,!0)}}),I.addEventListener("mousemove",k.handler),k.handler(G);return}(k.pointerType==="touch"?!We(N.select("floatingElement"),G.relatedTarget):!0)&&H(G)}return p?ga(_t($,"mousemove",F,{once:!0}),_t($,"mouseenter",F),_t($,"mouseleave",Y)):ga(_t($,"mouseenter",F),_t($,"mouseleave",Y))},[L,V,y,A,N,a,R,k,h,D,P,c,p,T,m,S,z,b,B,U]),x.useMemo(()=>{if(!a)return;function H($){k.pointerType=$.pointerType}return{onPointerDown:H,onPointerEnter:H,onMouseMove($){const{nativeEvent:F}=$,Y=$.currentTarget,G=N.select("domReferenceElement"),K=N.select("open"),I=D(G,Y,$.target);if(c&&!Ro(k.pointerType))return;if(K&&I&&k.handleCloseOptions?.blockPointerEvents){const W=N.select("floatingElement");if(W){const fe=k.handleCloseOptions?.getScope?.()??Y.ownerDocument.body;xC(k,{scopeElement:fe,referenceElement:Y,floatingElement:W})}}const X=kj(T.current);if(K&&!I||X===0||!I&&k.restTimeoutPending&&$.movementX**2+$.movementY**2<2)return;k.restTimeout.clear();function Z(){if(k.restTimeoutPending=!1,P())return;const W=N.select("open");!k.blockMouseMove&&(!W||I)&&U()&&N.setOpen(!0,st(On,F,Y))}k.pointerType==="touch"?qs.flushSync(()=>{Z()}):I&&K?Z():(k.restTimeoutPending=!0,k.restTimeout.start(X,Z))}}},[a,k,P,D,c,N,T,U])}const Uz="Escape";function gp(e,t,a){switch(e){case"vertical":return t;case"horizontal":return a;default:return t||a}}function Md(e,t){return gp(t,e===m2||e===Pb,e===ap||e===rp)}function ph(e,t,a){return gp(t,e===Pb,a?e===ap:e===rp)||e==="Enter"||e===" "||e===""}function $z(e,t,a){return gp(t,a?e===ap:e===rp,e===Pb)}function Hz(e,t,a,o){const l=a?e===rp:e===ap,c=e===m2;return t==="both"||t==="horizontal"&&o?e===Uz:gp(t,l,c)}function vC(e,t){const{listRef:a,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:d=null,allowEscape:p=!1,loopFocus:m=!1,nested:g=!1,rtl:h=!1,virtual:b=!1,focusItemOnOpen:_="auto",focusItemOnHover:j=!0,openOnArrowKeyDown:N=!0,disabledIndices:y=void 0,orientation:w="vertical",parentOrientation:S,id:k,resetOnPointerLeave:E=!0,externalTree:R,grid:A}=t,T=A!=null,z="rootStore"in e?e.rootStore:e,O=z.useState("open"),B=z.useState("floatingElement"),P=z.useState("domReferenceElement"),U=z.context.dataRef,D=bf(B),L=jx(P),V=pn(D),H=Xr(),$=Qr(R),F=x.useRef(_),Y=x.useRef(d??-1),G=x.useRef(null),K=x.useRef(!0),I=Ue(ue=>{l(Y.current===-1?null:Y.current,ue)}),X=x.useRef(!!B),Z=x.useRef(O),W=x.useRef(!1),fe=x.useRef(!1),te=x.useRef(null),re=pn(y),le=pn(O),me=pn(d),Me=pn(E),de=Wl(),ge=Wl(),Ce=Ue(()=>{function ue(Oe){b?$?.events.emit("virtualfocus",Oe):te.current=af(Oe,{sync:W.current,preventScroll:!0})}const ye=a.current[Y.current],Ge=fe.current;ye&&ue(ye),(W.current?Oe=>Oe():Oe=>de.request(Oe))(()=>{const Oe=a.current[Y.current]||ye;if(!Oe)return;ye||ue(Oe),je&&(Ge||!K.current)&&Oe.scrollIntoView?.({block:"nearest",inline:"nearest"})})});ze(()=>{U.current.orientation=w},[U,w]),ze(()=>{c&&(O&&B?(Y.current=d??-1,F.current&&d!=null&&(fe.current=!0,I())):X.current&&(Y.current=-1,I()))},[c,O,B,d,I]),ze(()=>{if(c){if(!O){W.current=!1;return}if(B)if(o==null){if(W.current=!1,me.current!=null)return;if(X.current&&(Y.current=-1,Ce()),(!Z.current||!X.current)&&F.current&&(G.current!=null||F.current===!0&&G.current==null)){let ue=0;const ye=()=>{a.current[0]==null?(ue<2&&(ue?Re=>ge.request(Re):queueMicrotask)(ye),ue+=1):(Y.current=G.current==null||ph(G.current,w,h)||g?sf(a):Cx(a),G.current=null,I())};ye()}}else Mc(a.current,o)||(Y.current=o,Ce(),fe.current=!1)}},[c,O,B,o,me,g,a,w,h,I,Ce,ge]),ze(()=>{if(!c||B||!$||b||!X.current)return;const ue=$.nodesRef.current,ye=ue.find(Oe=>Oe.id===H)?.context?.elements.floating,Ge=Gn(xt(P??ye??null)),Re=ue.some(Oe=>Oe.context&&We(Oe.context.elements.floating,Ge));ye&&!Re&&K.current&&ye.focus({preventScroll:!0})},[c,B,P,$,H,b]),ze(()=>{Z.current=O,X.current=!!B}),ze(()=>{O||(G.current=null,F.current=_)},[O,_]);const ke=o!=null,Be=Ue(ue=>{if(!le.current)return;const ye=a.current.indexOf(ue.currentTarget);ye!==-1&&(Y.current!==ye||o!==ye)&&(Y.current=ye,I(ue))}),Ve=Ue(()=>S??$?.nodesRef.current.find(ue=>ue.id===H)?.context?.dataRef?.current.orientation),Se=Ue(()=>sf(a,re.current)),Te=Ue(ue=>{if(K.current=!1,W.current=!0,ue.which===229||!le.current&&ue.currentTarget===V.current)return;if(g&&Hz(ue.key,w,h,T)){Md(ue.key,Ve())||ca(ue),z.setOpen(!1,st(wx,ue.nativeEvent)),Gt(P)&&(b?$?.events.emit("virtualfocus",P):P.focus());return}const ye=Y.current,Ge=sf(a,y),Re=Cx(a,y);if(L||(ue.key==="Home"&&(ca(ue),Y.current=Ge,I(ue)),ue.key==="End"&&(ca(ue),Y.current=Re,I(ue))),A!=null){const Oe=A(ue,Y.current,a,w,m,h,y,Ge,Re);if(Oe!=null&&(Y.current=Oe,I(ue)),w==="both")return}if(Md(ue.key,w)){if(ca(ue),O&&!b&&Gn(ue.currentTarget.ownerDocument)===ue.currentTarget){Y.current=ph(ue.key,w,h)?Ge:Re,I(ue);return}ph(ue.key,w,h)?m?ye>=Re?p&&ye!==a.current.length?Y.current=-1:(W.current=!1,Y.current=Ge):Y.current=Wa(a.current,{startingIndex:ye,disabledIndices:y}):Y.current=Math.min(Re,Wa(a.current,{startingIndex:ye,disabledIndices:y})):m?ye<=Ge?p&&ye!==-1?Y.current=a.current.length:(W.current=!1,Y.current=Re):Y.current=Wa(a.current,{startingIndex:ye,decrement:!0,disabledIndices:y}):Y.current=Math.max(Ge,Wa(a.current,{startingIndex:ye,decrement:!0,disabledIndices:y})),Mc(a.current,Y.current)&&(Y.current=-1),I(ue)}}),je=x.useMemo(()=>({onFocus(ye){W.current=!0,Be(ye)},onClick:({currentTarget:ye})=>ye.focus({preventScroll:!0}),onMouseMove(ye){W.current=!0,fe.current=!1,j&&Be(ye)},onPointerLeave(ye){if(!le.current||!K.current||ye.pointerType==="touch")return;W.current=!0;const Ge=ye.relatedTarget;if(!(!j||a.current.includes(Ge))&&Me.current&&(te.current?.(),te.current=null,Y.current=-1,I(ye),!b)){const Re=V.current,Oe=Gn(xt(Re));Re&&We(Re,Oe)&&Re.focus({preventScroll:!0})}}}),[Be,le,V,j,a,I,Me,b]),Ee=x.useMemo(()=>b&&O&&ke&&{"aria-activedescendant":`${k}-${o}`},[b,O,ke,k,o]),De=x.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...L?{}:Ee,onKeyDown(ue){if(ue.key==="Tab"&&ue.shiftKey&&O&&!b){const ye=qn(ue.nativeEvent);if(ye&&!We(V.current,ye))return;ca(ue),z.setOpen(!1,st(To,ue.nativeEvent)),Gt(P)&&P.focus();return}Te(ue)},onPointerMove(){K.current=!0}}),[Ee,Te,V,w,L,z,O,b,P]),Le=x.useMemo(()=>{function ue(Re){z.setOpen(!0,st(wx,Re.nativeEvent,Re.currentTarget))}function ye(Re){_==="auto"&&Mb(Re.nativeEvent)&&(F.current=!b)}function Ge(Re){F.current=_,_==="auto"&&d2(Re.nativeEvent)&&(F.current=!0)}return{onKeyDown(Re){const Oe=z.select("open");K.current=!1;const tt=Re.key.startsWith("Arrow"),ot=$z(Re.key,Ve(),h),vt=Md(Re.key,w),Mt=(g?ot:vt)||Re.key==="Enter"||Re.key.trim()==="";if(b&&Oe)return Te(Re);if(!(!Oe&&!N&&tt)){if(Mt){const lt=Md(Re.key,Ve());G.current=g&<?null:Re.key}if(g){ot&&(ca(Re),Oe?(Y.current=Se(),I(Re)):ue(Re));return}vt&&(me.current!=null&&(Y.current=me.current),ca(Re),!Oe&&N?ue(Re):Te(Re),Oe&&I(Re))}},onFocus(Re){z.select("open")&&!b&&(Y.current=-1,I(Re))},onPointerDown:Ge,onPointerEnter:Ge,onMouseDown:ye,onClick:ye}},[Te,_,Se,g,I,z,N,w,Ve,h,me,b]),Ie=x.useMemo(()=>({...Ee,...Le}),[Ee,Le]);return x.useMemo(()=>c?{reference:Ie,floating:De,item:je,trigger:Le}:{},[c,Ie,De,Le,je])}function yC(e,t){const{listRef:a,elementsRef:o,activeIndex:l,onMatch:c,disabledIndices:d,onTyping:p,enabled:m=!0,resetMs:g=750,selectedIndex:h=null}=t,b="rootStore"in e?e.rootStore:e,_=b.useState("open"),j=En(),N=x.useRef(""),y=x.useRef(h??l??-1),w=x.useRef(null),S=Ue(R=>{function A(V){const H=o?.current[V];return!H||cp(H)}function T(V){return A(V)?d==null||!yf(tr,V,d):!1}function z(V,H,$=0){if(V.length===0)return-1;const F=($%V.length+V.length)%V.length,Y=H.toLowerCase();for(let G=0;G<V.length;G+=1){const K=(F+G)%V.length;if(!(!V[K]?.toLowerCase().startsWith(Y)||!T(K)))return K}return-1}const O=a.current;if(N.current.length>0&&R.key===" "&&(ca(R),p?.(!0)),N.current.length>0&&N.current[0]!==" "&&z(O,N.current)===-1&&R.key!==" "&&p?.(!1),O==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;_&&R.key!==" "&&(ca(R),p?.(!0));const B=N.current==="";B&&(y.current=h??l??-1),O.every((V,H)=>V&&T(H)?V[0]?.toLowerCase()!==V[1]?.toLowerCase():!0)&&N.current===R.key&&(N.current="",y.current=w.current),N.current+=R.key,j.start(g,()=>{N.current="",y.current=w.current,p?.(!1)});const D=((B?h??l??-1:y.current)??0)+1,L=z(O,N.current,D);L!==-1?(c?.(L),w.current=L):R.key!==" "&&(N.current="",p?.(!1))}),k=Ue(R=>{const A=R.relatedTarget,T=b.select("domReferenceElement"),z=b.select("floatingElement");We(T,A)||We(z,A)||(j.clear(),N.current="",y.current=w.current,p?.(!1))});ze(()=>{!_&&h!==null||(j.clear(),w.current=null,N.current!==""&&(N.current=""))},[_,h,j]),ze(()=>{_&&N.current===""&&(y.current=h??l??-1)},[_,h,l]);const E=x.useMemo(()=>({onKeyDown:S,onBlur:k}),[S,k]);return x.useMemo(()=>m?{reference:E,floating:E}:{},[m,E])}const sw=.1,qz=sw*sw,Vt=.5;function Od(e,t,a,o,l,c){return o>=t!=c>=t&&e<=(l-a)*(t-o)/(c-o)+a}function zd(e,t,a,o,l,c,d,p,m,g){let h=!1;return Od(e,t,a,o,l,c)&&(h=!h),Od(e,t,l,c,d,p)&&(h=!h),Od(e,t,d,p,m,g)&&(h=!h),Od(e,t,m,g,a,o)&&(h=!h),h}function Vz(e,t,a){return e>=a.x&&e<=a.x+a.width&&t>=a.y&&t<=a.y+a.height}function Dd(e,t,a,o,l,c){const d=Math.min(a,l),p=Math.max(a,l),m=Math.min(o,c),g=Math.max(o,c);return e>=d&&e<=p&&t>=m&&t<=g}function jC(e={}){const{blockPointerEvents:t=!1}=e,a=new Zs,o=({x:l,y:c,placement:d,elements:p,onClose:m,nodeId:g,tree:h})=>{const b=d?.split("-")[0];let _=!1,j=null,N=null,y=typeof performance<"u"?performance.now():0;function w(k,E){const R=performance.now(),A=R-y;if(j===null||N===null||A===0)return j=k,N=E,y=R,!1;const T=k-j,z=E-N,O=T*T+z*z,B=A*A*qz;return j=k,N=E,y=R,O<B}function S(){a.clear(),m()}return function(E){a.clear();const R=p.domReference,A=p.floating;if(!R||!A||b==null||l==null||c==null)return;const{clientX:T,clientY:z}=E,O=qn(E),B=E.type==="mouseleave",P=We(A,O),U=We(R,O);if(P&&(_=!0,!B))return;if(U&&(_=!1,!B)){_=!0;return}if(B&&bt(E.relatedTarget)&&We(A,E.relatedTarget))return;function D(){return!!(h&&qr(h.nodesRef.current,g).length>0)}function L(){D()||S()}if(D())return;const V=R.getBoundingClientRect(),H=A.getBoundingClientRect(),$=l>H.right-H.width/2,F=c>H.bottom-H.height/2,Y=H.width>V.width,G=H.height>V.height,K=(Y?V:H).left,I=(Y?V:H).right,X=(G?V:H).top,Z=(G?V:H).bottom;if(b==="top"&&c>=V.bottom-1||b==="bottom"&&c<=V.top+1||b==="left"&&l>=V.right-1||b==="right"&&l<=V.left+1){L();return}let W=!1;switch(b){case"top":W=Dd(T,z,K,V.top+1,I,H.bottom-1);break;case"bottom":W=Dd(T,z,K,H.top+1,I,V.bottom-1);break;case"left":W=Dd(T,z,H.right-1,Z,V.left+1,X);break;case"right":W=Dd(T,z,V.right-1,Z,H.left+1,X);break}if(W)return;if(_&&!Vz(T,z,V)){L();return}if(!B&&w(T,z)){L();return}let fe=!1;switch(b){case"top":{const te=Y?Vt/2:Vt*4,re=Y||$?l+te:l-te,le=Y?l-te:$?l+te:l-te,me=c+Vt+1,Me=$||Y?H.bottom-Vt:H.top,de=$?Y?H.bottom-Vt:H.top:H.bottom-Vt;fe=zd(T,z,re,me,le,me,H.left,Me,H.right,de);break}case"bottom":{const te=Y?Vt/2:Vt*4,re=Y||$?l+te:l-te,le=Y?l-te:$?l+te:l-te,me=c-Vt,Me=$||Y?H.top+Vt:H.bottom,de=$?Y?H.top+Vt:H.bottom:H.top+Vt;fe=zd(T,z,re,me,le,me,H.left,Me,H.right,de);break}case"left":{const te=G?Vt/2:Vt*4,re=G||F?c+te:c-te,le=G?c-te:F?c+te:c-te,me=l+Vt+1,Me=F||G?H.right-Vt:H.left,de=F?G?H.right-Vt:H.left:H.right-Vt;fe=zd(T,z,Me,H.top,de,H.bottom,me,re,me,le);break}case"right":{const te=G?Vt/2:Vt*4,re=G||F?c+te:c-te,le=G?c-te:F?c+te:c-te,me=l-Vt,Me=F||G?H.left+Vt:H.right,de=F?G?H.left+Vt:H.right:H.left+Vt;fe=zd(T,z,me,re,me,le,Me,H.top,de,H.bottom);break}}fe?_||a.start(40,L):L()}};return o.__options={...e,blockPointerEvents:t},o}const Fz={...o_,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 c_ extends fp{constructor(t,a,o=!1){const l=new ou,c={...Gz(),...t};c.floatingRootContext=pC(l,a,o),super(c,{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:l},Fz)}setOpen=(t,a)=>{zz(this,t,a,{extraState:{openChangeReason:a.reason}})};cancelPendingOpen(t){this.state.floatingRootContext.dispatchOpenChange(!1,st(fi,t))}static useStore(t,a){return cC(t,(l,c)=>new c_(a,l,c)).store}}function Gz(){return{...a_(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const Yz=Eb(function(t){const{disabled:a=!1,defaultOpen:o=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:d="none",actionsRef:p,onOpenChange:m,onOpenChangeComplete:g,handle:h,triggerId:b,defaultTriggerId:_=null,children:j}=t,N=c_.useStore(h?.store,{open:o,openProp:l,activeTriggerId:_,triggerIdProp:b});dC(N,l,o,_),N.useControlledProp("openProp",l),N.useControlledProp("triggerIdProp",b),N.useContextCallback("onOpenChange",m),N.useContextCallback("onOpenChangeComplete",g);const y=N.useState("open"),w=!a&&y,S=N.useState("activeTriggerId"),k=N.useState("mounted"),E=N.useState("payload");N.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:c}),N.useSyncedValue("disabled",a),t_(N,{closeOnActiveTriggerUnmount:!0});const{forceUnmount:R,transitionStatus:A}=n_(w,N),T=N.useState("isInstantPhase"),z=N.useState("instantType"),O=N.useState("lastOpenChangeReason"),B=x.useRef(null);ze(()=>{y&&a&&N.setOpen(!1,st(x2))},[y,a,N]),ze(()=>{A==="ending"&&O===va||A!=="ending"&&T?(z!=="delay"&&(B.current=z),N.set("instantType","delay")):B.current!==null&&(N.set("instantType",B.current),B.current=null)},[A,T,O,z,N]),ze(()=>{w&&S==null&&N.set("payload",void 0)},[N,S,w]);const P=x.useCallback(()=>{N.setOpen(!1,st(Lb))},[N]);x.useImperativeHandle(p,()=>({unmount:R,close:P}),[R,P]);const U=w||k||!a&&d!=="none";return s.jsxs(u2.Provider,{value:N,children:[U&&s.jsx(Kz,{store:N,disabled:a,trackCursorAxis:d}),typeof j=="function"?j({payload:E}):j]})});function Kz({store:e,disabled:t,trackCursorAxis:a}){const o=e.useState("floatingRootContext"),l=up(o,{enabled:!t,referencePress:()=>e.select("closeOnClick")}),c=AO(o,{enabled:!t&&a!=="none",axis:a==="none"?void 0:a}),d=x.useMemo(()=>Kn(c.reference,l.reference),[c.reference,l.reference]),p=x.useMemo(()=>Kn(c.trigger,l.trigger),[c.trigger,l.trigger]),m=x.useMemo(()=>Kn(mp,c.floating,l.floating),[c.floating,l.floating]);return s_(e,{activeTriggerProps:d,inactiveTriggerProps:p,popupProps:m}),null}let Co=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Oo.startingStyle]="startingStyle",e[e.endingStyle=Oo.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),Ef=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Xz={[Ef.popupOpen]:""},Qz={[Ef.popupOpen]:"",[Ef.pressed]:""},Wz={[Co.open]:""},Zz={[Co.closed]:""},Jz={[Co.anchorHidden]:""},wC={open(e){return e?Xz:null}},Tx={open(e){return e?Qz:null}},Ho={open(e){return e?Wz:Zz},anchorHidden(e){return e?Jz:null}};function na(e){return Ao(e,"base-ui")}const kC=x.createContext(void 0);function eD(){return x.useContext(kC)}let tD=(function(e){return e[e.popupOpen=Ef.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const nD=600,SC="data-base-ui-tooltip-trigger";function aw(e){if("composedPath"in e){const a=e.composedPath();for(let o=0;o<a.length;o+=1){const l=a[o];if(bt(l))return l}}const t=e.target;return bt(t)?t:null}function sD(e){let t=e;for(;t;){if(t.hasAttribute(SC))return t;const a=t.parentElement;if(a){t=a;continue}const o=t.getRootNode();t="host"in o&&bt(o.host)?o.host:null}return null}const aD=c2(function(t,a){const{render:o,className:l,style:c,handle:d,payload:p,disabled:m,delay:g,closeOnClick:h=!0,closeDelay:b,id:_,...j}=t,N=au(!0),y=d?.store??N;if(!y)throw new Error(ln(82));const w=na(_),S=y.useState("isTriggerActive",w),k=y.useState("isOpenedByTrigger",w),E=y.useState("floatingRootContext"),R=x.useRef(null),A=g??nD,T=b??0,{registerTrigger:z,isMountedByThisTrigger:O}=fC(w,R,y,{payload:p,closeOnClick:h,closeDelay:T}),B=eD(),{delayRef:P,isInstantPhase:U,hasProvider:D}=A4(E,{open:k}),L=i_(E);y.useSyncedValue("isInstantPhase",U);const V=y.useState("disabled"),H=m??V,$=pn(H),F=y.useState("trackCursorAxis"),Y=y.useState("disableHoverablePopup"),G=x.useRef(!1),K=En(),I=x.useRef(void 0);function X(){const ge=B?.delay,Ce=typeof P.current=="object"?P.current.open:void 0;let ke=A;return D&&(Ce!==0?ke=g??ge??A:ke=0),ke}function Z(ge){const Ce=R.current;if(!Ce||!ge)return!1;const ke=sD(ge);return ke!==null&&ke!==Ce&&We(Ce,ke)}function W(ge){const Ce=Z(ge);return G.current=Ce,Ce&&(L.openChangeTimeout.clear(),L.restTimeout.clear(),L.restTimeoutPending=!1,K.clear()),Ce}const fe=_C(E,{enabled:!H,mouseOnly:!0,move:!1,handleClose:!Y&&F!=="both"?jC():null,restMs:X,delay(){const ge=typeof P.current=="object"?P.current.close:void 0;let Ce=T;return b==null&&D&&(Ce=ge),{close:Ce}},triggerElementRef:R,isActiveTrigger:S,isClosing:()=>y.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),te=hC(E,{enabled:!H}).reference,re=ge=>{const Ce=G.current,ke=aw(ge),Be=W(ke),Ve=R.current,Se=Ve&&ke&&We(Ve,ke);if(Be&&y.select("open")&&y.select("lastOpenChangeReason")===On){y.setOpen(!1,st(On,ge));return}if(Ce&&!Be&&Se&&!$.current&&!y.select("open")&&Ve&&Ro(I.current)){const Te=()=>{!G.current&&!$.current&&!y.select("open")&&y.setOpen(!0,st(On,ge,Ve))},je=X();je===0?(K.clear(),Te()):K.start(je,Te)}},le=y.useState("triggerProps",O);return Et("button",t,{state:{open:k},ref:[a,z,R],props:[fe,te,O||F!=="none"?le:void 0,{onMouseOver(ge){re(ge.nativeEvent)},onFocus(ge){Z(aw(ge.nativeEvent))&&ge.preventBaseUIHandler()},onMouseLeave(){G.current=!1,K.clear(),I.current=void 0},onPointerEnter(ge){I.current=ge.pointerType},onPointerDown(ge){I.current=ge.pointerType,y.set("closeOnClick",h),h&&!y.select("open")&&y.cancelPendingOpen(ge.nativeEvent)},onClick(ge){h&&!y.select("open")&&y.cancelPendingOpen(ge.nativeEvent)},id:w,[tD.triggerDisabled]:H?"":void 0,[SC]:H?void 0:""},j],stateAttributesMapping:wC})}),CC=x.createContext(void 0);function rD(){const e=x.useContext(CC);if(e===void 0)throw new Error(ln(70));return e}const oD=x.forwardRef(function(t,a){const{children:o,container:l,className:c,render:d,style:p,...m}=t,{portalNode:g,portalSubtree:h}=V2({container:l,ref:a,componentProps:t,elementProps:m});return!h&&!g?null:s.jsxs(x.Fragment,{children:[h,g&&qs.createPortal(o,g)]})}),lD=x.forwardRef(function(t,a){const{keepMounted:o=!1,...l}=t;return au().useState("mounted")||o?s.jsx(CC.Provider,{value:o,children:s.jsx(oD,{ref:a,...l})}):null}),NC=x.createContext(void 0);function EC(){const e=x.useContext(NC);if(e===void 0)throw new Error(ln(71));return e}const iD=x.createContext(void 0);function hp(){return x.useContext(iD)?.direction??"ltr"}const cD=e=>({name:"arrow",options:e,async fn(t){const{x:a,y:o,placement:l,rects:c,platform:d,elements:p,middlewareData:m}=t,{element:g,padding:h=0,offsetParent:b="real"}=sr(e,t)||{};if(g==null)return{};const _=w2(h),j={x:a,y:o},N=Hb(l),y=$b(N),w=await d.getDimensions(g),S=N==="y",k=S?"top":"left",E=S?"bottom":"right",R=S?"clientHeight":"clientWidth",A=c.reference[y]+c.reference[N]-j[N]-c.floating[y],T=j[N]-c.reference[N],z=b==="real"?await d.getOffsetParent?.(g):p.floating;let O=p.floating[R]||c.floating[y];(!O||!await d.isElement?.(z))&&(O=p.floating[R]||c.floating[y]);const B=A/2-T/2,P=O/2-w[y]/2-1,U=Math.min(_[k],P),D=Math.min(_[E],P),L=U,V=O-w[y]-D,H=O/2-w[y]/2+B,$=kx(L,H,V),F=!m.arrow&&Kr(l)!=null&&H!==$&&c.reference[y]/2-(H<L?U:D)-w[y]/2<0,Y=F?H<L?H-L:H-V:0;return{[N]:j[N]+Y,data:{[N]:$,centerOffset:H-$-Y,...F&&{alignmentOffset:Y}},reset:F}}}),uD=(e,t)=>({...cD(e),options:[e,t]}),dD=_z().fn,fD={name:"hide",async fn(e){const{width:t,height:a,x:o,y:l}=e.rects.reference,c=t===0&&a===0&&o===0&&l===0;return{data:{referenceHidden:(await dD(e)).data?.referenceHidden||c}}}},of={sideX:"left",sideY:"top"},RC={name:"adaptiveOrigin",async fn(e){const{x:t,y:a,rects:{floating:o},elements:{floating:l},platform:c,strategy:d,placement:p}=e,m=Wt(l),g=m.getComputedStyle(l);if(!(g.transitionDuration!=="0s"&&g.transitionDuration!==""))return{x:t,y:a,data:of};const b=await c.getOffsetParent?.(l);let _={width:0,height:0};if(d==="fixed"&&m?.visualViewport)_={width:m.visualViewport.width,height:m.visualViewport.height};else if(b===m){const k=xt(l);_={width:k.documentElement.clientWidth,height:k.documentElement.clientHeight}}else await c.isElement?.(b)&&(_=await c.getDimensions(b));const j=fs(p);let N=t,y=a;j==="left"&&(N=_.width-(t+o.width)),j==="top"&&(y=_.height-(a+o.height));const w=j==="left"?"right":of.sideX,S=j==="top"?"bottom":of.sideY;return{x:N,y,data:{sideX:w,sideY:S}}}};function TC(e,t,a){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?a?"inline-start":"inline-end":"right",bottom:"bottom",left:o?a?"inline-end":"inline-start":"left"}[t]}function rw(e,t,a){const{rects:o,placement:l}=e;return{side:TC(t,fs(l),a),align:Kr(l)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function u_(e){const{anchor:t,positionMethod:a="absolute",side:o="bottom",sideOffset:l=0,align:c="center",alignOffset:d=0,collisionBoundary:p,collisionPadding:m=5,sticky:g=!1,arrowPadding:h=5,disableAnchorTracking:b=!1,inline:_,keepMounted:j=!1,floatingRootContext:N,mounted:y,collisionAvoidance:w,shiftCrossAxis:S=!1,nodeId:k,adaptiveOrigin:E,lazyFlip:R=!1,externalTree:A}=e,[T,z]=x.useState(null);!y&&T!==null&&z(null);const O=w.side||"flip",B=w.align||"flip",P=w.fallbackAxisSide||"end",U=typeof t=="function"?t:void 0,D=Ue(U),L=U?D:t,V=pn(t),H=pn(y),F=hp()==="rtl",Y=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[o],G=c==="center"?Y:`${Y}-${c}`;let K=m;const I=1,X=o==="bottom"?I:0,Z=o==="top"?I:0,W=o==="right"?I:0,fe=o==="left"?I:0;typeof K=="number"?K={top:K+X,right:K+fe,bottom:K+Z,left:K+W}:K&&(K={top:(K.top||0)+X,right:(K.right||0)+fe,bottom:(K.bottom||0)+Z,left:(K.left||0)+W});const te={boundary:p==="clipping-ancestors"?"clippingAncestors":p,padding:K},re=x.useRef(null),le=pn(l),me=pn(d),Me=typeof l!="function"?l:0,de=typeof d!="function"?d:0,ge=[];_&&ge.push(_),ge.push(mz(Qe=>{const mt=rw(Qe,o,F),Ot=typeof le.current=="function"?le.current(mt):le.current,Jt=typeof me.current=="function"?me.current(mt):me.current;return{mainAxis:Ot,crossAxis:Jt,alignmentAxis:Jt}},[Me,de,F,o]));const Ce=B==="none"&&O!=="shift",ke=!Ce&&(g||S||O==="shift"),Be=O==="none"?null:xz({...te,padding:{top:K.top+I,right:K.right+I,bottom:K.bottom+I,left:K.left+I},mainAxis:!S&&O==="flip",crossAxis:B==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),Ve=Ce?null:gz(Qe=>{const mt=xt(Qe.elements.floating).documentElement;return{...te,rootBoundary:S?{x:0,y:0,width:mt.clientWidth,height:mt.clientHeight}:void 0,mainAxis:B!=="none",crossAxis:ke,limiter:g||S?void 0:hz(Ot=>{if(!re.current)return{};const{width:Jt,height:Qt}=re.current.getBoundingClientRect(),en=$s(fs(Ot.placement)),mn=en==="y"?Jt:Qt,ss=en==="y"?K.left+K.right:K.top+K.bottom;return{offset:mn/2+ss/2}})}},[te,g,S,K,B]);O==="shift"||B==="shift"||c==="center"?ge.push(Ve,Be):ge.push(Be,Ve),ge.push(bz({...te,apply({elements:{floating:Qe},availableWidth:mt,availableHeight:Ot,rects:Jt}){if(!H.current)return;const Qt=Qe.style;Qt.setProperty("--available-width",`${mt}px`),Qt.setProperty("--available-height",`${Ot}px`);const en=Wt(Qe).devicePixelRatio||1,{x:mn,y:ss,width:gs,height:Cs}=Jt.reference,gn=(Math.round((mn+gs)*en)-Math.round(mn*en))/en,Ns=(Math.round((ss+Cs)*en)-Math.round(ss*en))/en;Qt.setProperty("--anchor-width",`${gn}px`),Qt.setProperty("--anchor-height",`${Ns}px`)}}),uD(Qe=>({element:re.current||xt(Qe.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(Qe){const{elements:mt,middlewareData:Ot,placement:Jt,rects:Qt,y:en}=Qe,mn=fs(Jt),ss=$s(mn),gs=re.current,Cs=Ot.arrow?.x||0,gn=Ot.arrow?.y||0,Ns=gs?.clientWidth||0,Ca=gs?.clientHeight||0,Fs=Cs+Ns/2,Na=gn+Ca/2,dt=Math.abs(Ot.shift?.y||0),Ut=Qt.reference.height/2,hn=typeof l=="function"?l(rw(Qe,o,F)):l,Rn=dt>hn,Sn={top:`${Fs}px calc(100% + ${hn}px)`,bottom:`${Fs}px ${-hn}px`,left:`calc(100% + ${hn}px) ${Na}px`,right:`${-hn}px ${Na}px`}[mn],Yt=`${Fs}px ${Qt.reference.y+Ut-en}px`;return mt.floating.style.setProperty("--transform-origin",ke&&ss==="y"&&Rn?Yt:Sn),{}}},fD,E),ze(()=>{!y&&N&&N.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[y,N]);const Se=x.useMemo(()=>({elementResize:!b&&typeof ResizeObserver<"u",layoutShift:!b&&typeof IntersectionObserver<"u"}),[b]),{refs:Te,elements:je,x:Ee,y:De,middlewareData:Le,update:Ie,placement:ue,context:ye,isPositioned:Ge,floatingStyles:Re}=Iz({rootContext:N,open:j?y:void 0,placement:G,middleware:ge,strategy:a,whileElementsMounted:j?void 0:(...Qe)=>Qj(...Qe,Se),nodeId:k,externalTree:A}),{sideX:Oe,sideY:tt}=Le.adaptiveOrigin||of,ot=Ge?a:"fixed",vt=x.useMemo(()=>{const Qe=E?{position:ot,[Oe]:Ee,[tt]:De}:{position:ot,...Re};return Ge||(Qe.opacity=0),Qe},[E,ot,Oe,Ee,tt,De,Re,Ge]),Mt=x.useRef(null);ze(()=>{if(!y)return;const Qe=V.current,mt=typeof Qe=="function"?Qe():Qe,Jt=(ow(mt)?mt.current:mt)||null||null;Jt!==Mt.current&&(Te.setPositionReference(Jt),Mt.current=Jt)},[y,Te,L,V]),x.useEffect(()=>{if(!y)return;const Qe=V.current;typeof Qe!="function"&&ow(Qe)&&Qe.current!==Mt.current&&(Te.setPositionReference(Qe.current),Mt.current=Qe.current)},[y,Te,L,V]),x.useEffect(()=>{if(j&&y&&je.reference&&je.floating)return Qj(je.reference,je.floating,Ie,Se)},[j,y,je,Ie,Se]);const lt=fs(ue),Rt=TC(o,lt,F),_e=Kr(ue)||"center",Pe=!!Le.hide?.referenceHidden;ze(()=>{R&&y&&Ge&&z(lt)},[R,y,Ge,lt]);const Xe=x.useMemo(()=>({position:"absolute",top:Le.arrow?.y,left:Le.arrow?.x}),[Le.arrow]),it=Le.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:vt,arrowStyles:Xe,arrowRef:re,arrowUncentered:it,side:Rt,align:_e,physicalSide:lt,anchorHidden:Pe,refs:Te,context:ye,isPositioned:Ge,update:Ie}),[vt,Xe,re,it,Rt,_e,lt,Pe,Te,ye,Ge,Ie])}function ow(e){return e!=null&&"current"in e}function xp(e){return e==="starting"?jO:Xt}function d_(e,t,{styles:a,transitionStatus:o,props:l,refs:c,hidden:d,inert:p=!1}){const m={...a};return p&&(m.pointerEvents="none"),Et("div",e,{state:t,ref:c,props:[{role:"presentation",hidden:d,style:m},xp(o),l],stateAttributesMapping:Ho})}const pD=x.forwardRef(function(t,a){const{render:o,className:l,anchor:c,positionMethod:d="absolute",side:p="top",align:m="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_=5,arrowPadding:j=5,sticky:N=!1,disableAnchorTracking:y=!1,collisionAvoidance:w=$2,style:S,...k}=t,E=au(),R=rD(),A=E.useState("open"),T=E.useState("mounted"),z=E.useState("trackCursorAxis"),O=E.useState("disableHoverablePopup"),B=E.useState("floatingRootContext"),P=E.useState("instantType"),U=E.useState("transitionStatus"),D=E.useState("hasViewport"),L=u_({anchor:c,positionMethod:d,floatingRootContext:B,mounted:T,side:p,sideOffset:g,align:m,alignOffset:h,collisionBoundary:b,collisionPadding:_,sticky:N,arrowPadding:j,disableAnchorTracking:y,keepMounted:R,collisionAvoidance:w,adaptiveOrigin:D?RC:void 0}),V=x.useMemo(()=>({open:A,side:L.side,align:L.align,anchorHidden:L.anchorHidden,instant:z!=="none"?"tracking-cursor":P}),[A,L.side,L.align,L.anchorHidden,z,P]),H=d_(t,V,{styles:L.positionerStyles,transitionStatus:U,props:k,refs:[a,E.useStateSetter("positionerElement")],hidden:!T,inert:!A||z==="both"||O});return s.jsx(NC.Provider,{value:L,children:H})}),mD={...Ho,...or},gD=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...d}=t,p=au(),{side:m,align:g}=EC(),h=p.useState("open"),b=p.useState("instantType"),_=p.useState("transitionStatus"),j=p.useState("popupProps"),N=p.useState("floatingRootContext"),y=p.useState("disabled"),w=p.useState("closeDelay");ka({open:h,ref:p.context.popupRef,onComplete(){h&&p.context.onOpenChangeComplete?.(!0)}}),bC(N,{enabled:!y,closeDelay:w});const S=p.useStateSetter("popupElement");return Et("div",t,{state:{open:h,side:m,align:g,instant:b,transitionStatus:_},ref:[a,p.context.popupRef,S],props:[j,xp(_),d],stateAttributesMapping:mD})}),hD=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...d}=t,p=au(),{arrowRef:m,side:g,align:h,arrowUncentered:b,arrowStyles:_}=EC(),j=p.useState("open"),N=p.useState("instantType");return Et("div",t,{state:{open:j,side:g,align:h,uncentered:b,instant:N},ref:[a,m],props:[{style:_,"aria-hidden":!0},d],stateAttributesMapping:Ho})}),xD=function(t){const{delay:a,closeDelay:o,timeout:l=400}=t,c=x.useMemo(()=>({delay:a,closeDelay:o}),[a,o]),d=x.useMemo(()=>({open:a,close:o}),[a,o]);return s.jsx(kC.Provider,{value:c,children:s.jsx(T4,{delay:d,timeoutMs:l,children:t.children})})};function bp(e){return Fb(19)?e:e?"true":void 0}function bD(e){const[t,a]=x.useState({current:e,previous:null});return e!==t.current&&a({current:e,previous:t.current}),t.previous}function Ct(...e){return i2(Uc(e))}function _D({delay:e=0,...t}){return s.jsx(xD,{"data-slot":"tooltip-provider",delay:e,...t})}function f_({...e}){return s.jsx(Yz,{"data-slot":"tooltip",...e})}function p_({...e}){return s.jsx(aD,{"data-slot":"tooltip-trigger",...e})}function m_({className:e,side:t="top",sideOffset:a=4,align:o="center",alignOffset:l=0,children:c,...d}){return s.jsx(lD,{children:s.jsx(pD,{align:o,alignOffset:l,side:t,sideOffset:a,className:"isolate z-50",children:s.jsxs(gD,{"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),...d,children:[c,s.jsx(hD,{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 Al({label:e,active:t,onClick:a,isAdd:o,isSettings:l,isDefault:c,icon:d,title:p,testId:m}){const g=e.trim()||"·",{initials:h,subLabel:b}=AC(g),_=o||l?"indigo":MC(g),j=b&&!o&&!l&&!c;return s.jsxs(f_,{children:[s.jsx(p_,{render:s.jsxs("button",{type:"button",onClick:a,"data-testid":m,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[s.jsx("span",{className:he("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&&wD(_),!o&&!l&&!c&&!t&&jD(_)),children:d??h}),j&&s.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:b})]})}),s.jsx(m_,{side:"right",children:p||e})]})}function AC(e){const t=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!t)return{initials:"·",subLabel:null};const a=t.split(" ");if(a.length>=2)return{initials:(a[0][0]+a[1][0]).toUpperCase(),subLabel:vD(t)};const o=a[0];return o.length<=4?{initials:o[0].toUpperCase(),subLabel:o}:{initials:o[0].toUpperCase(),subLabel:o.slice(0,4)+"…"}}function vD(e){return e.length>6?e.slice(0,5)+"…":e}function MC(e){let t=0;for(let a=0;a<e.length;a++)t=t*31+e.charCodeAt(a)|0;return bj[Math.abs(t)%bj.length]}const OC={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"},yD={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 jD(e){return OC[e]}function wD(e){return yD[e]}function kD(e){const{initials:t}=AC(e);return{initials:t,idleClass:OC[MC(e)]}}function $e({content:e,side:t="top",children:a}){return e?s.jsxs(f_,{children:[s.jsx(p_,{render:a}),s.jsx(m_,{side:t,children:e})]}):a}const zC=x.createContext(void 0);function g_(e){const t=x.useContext(zC);if(t===void 0&&!e)throw new Error(ln(33));return t}const DC=x.createContext(void 0);function Wr(e){const t=x.useContext(DC);if(t===void 0&&!e)throw new Error(ln(36));return t}const SD=x.createContext(void 0);function _p(e=!0){const t=x.useContext(SD);if(t===void 0&&!e)throw new Error(ln(25));return t}function ei({controlled:e,default:t,name:a,state:o="value"}){const{current:l}=x.useRef(e!==void 0),[c,d]=x.useState(t),p=l?e:c,m=x.useCallback(g=>{l||d(g)},[]);return[p,m]}const PC=x.createContext(void 0);function h_(e=!1){const t=x.useContext(PC);if(t===void 0&&!e)throw new Error(ln(16));return t}function CD(e){const{focusableWhenDisabled:t,disabled:a,composite:o=!1,tabIndex:l=0,isNativeButton:c}=e,d=o&&t!==!1,p=o&&t===!1;return{props:x.useMemo(()=>{const g={onKeyDown(h){a&&t&&h.key!=="Tab"&&h.preventDefault()}};return o||(g.tabIndex=l,!c&&a&&(g.tabIndex=t?l:-1)),(c&&(t||d)||!c&&a)&&(g["aria-disabled"]=a),c&&(!t||p)&&(g.disabled=a),g},[o,a,t,d,p,c,l])}}function Zr(e={}){const{disabled:t=!1,focusableWhenDisabled:a,tabIndex:o=0,native:l=!0,composite:c}=e,d=x.useRef(null),p=h_(!0),m=c??p!==void 0,{props:g}=CD({focusableWhenDisabled:a,disabled:t,composite:m,tabIndex:o,isNativeButton:l}),h=x.useCallback(()=>{const j=d.current;mh(j)&&m&&t&&g.disabled===void 0&&j.disabled&&(j.disabled=!1)},[t,g.disabled,m]);ze(h,[h]);const b=x.useCallback((j={})=>{const{onClick:N,onMouseDown:y,onKeyUp:w,onKeyDown:S,onPointerDown:k,...E}=j;return Kn({onClick(R){if(t){R.preventDefault();return}N?.(R)},onMouseDown(R){t||y?.(R)},onKeyDown(R){if(t||(wf(R),S?.(R),R.baseUIHandlerPrevented))return;const A=R.target===R.currentTarget,T=R.currentTarget,z=mh(T),O=!l&&ND(T),B=A&&(l?z:!O),P=R.key==="Enter",U=R.key===" ",D=T.getAttribute("role"),L=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(A&&m&&U){if(R.defaultPrevented&&L)return;R.preventDefault(),O||l&&z?(T.click(),R.preventBaseUIHandler()):B&&(N?.(R),R.preventBaseUIHandler());return}B&&(!l&&(U||P)&&R.preventDefault(),!l&&P&&N?.(R))},onKeyUp(R){if(!t){if(wf(R),w?.(R),R.target===R.currentTarget&&l&&m&&mh(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!l&&!m&&R.key===" "&&N?.(R)}},onPointerDown(R){if(t){R.preventDefault();return}k?.(R)}},l?{type:"button"}:{role:"button"},g,E)},[t,g,m,l]),_=Ue(j=>{d.current=j,h()});return{getButtonProps:b,buttonRef:_}}function mh(e){return Gt(e)&&e.tagName==="BUTTON"}function ND(e){return!!(e?.tagName==="A"&&e?.href)}function ED(e){const{closeOnClick:t,highlighted:a,id:o,nodeId:l,store:c,typingRef:d,itemRef:p,itemMetadata:m}=e,{events:g}=c.useState("floatingTreeRoot"),h=c.useState("open"),b=_p(!0),_=b!==void 0;return x.useMemo(()=>({id:o,role:"menuitem",tabIndex:h&&a?0:-1,onKeyDown(j){j.key===" "&&d?.current&&j.preventDefault()},onMouseMove(j){l&&g.emit("itemhover",{nodeId:l,target:j.currentTarget})},onClick(j){t&&g.emit("close",{domEvent:j,reason:$l})},onMouseUp(j){if(b){const N=b.initialCursorPointRef.current;if(b.initialCursorPointRef.current=null,_&&N&&Math.abs(j.clientX-N.x)<=1&&Math.abs(j.clientY-N.y)<=1||_&&!Tb&&j.button===2)return}p.current&&c.context.allowMouseUpTriggerRef.current&&(!_||j.button===2)&&(!m||m.type==="regular-item")&&p.current.click()}}),[t,a,o,g,l,h,c,d,p,b,_,m])}const LC={type:"regular-item"};function IC(e){const{closeOnClick:t,disabled:a=!1,highlighted:o,id:l,store:c,typingRef:d=c.context.typingRef,nativeButton:p,itemMetadata:m,nodeId:g}=e,h=c.useState("disabled"),b=a||h,_=x.useRef(null),{getButtonProps:j,buttonRef:N}=Zr({disabled:b,focusableWhenDisabled:!0,native:p,composite:!0}),y=ED({closeOnClick:t,highlighted:o,id:l,nodeId:g,store:c,typingRef:d,itemRef:_,itemMetadata:m}),w=x.useCallback(k=>Kn(y,{onMouseEnter(){m.type==="submenu-trigger"&&m.setActive()}},k,j),[y,j,m]),S=nr(_,N);return x.useMemo(()=>({getItemProps:w,itemRef:S}),[w,S])}const BC=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function RD(){return x.useContext(BC)}let UC=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function lu(e={}){const{label:t,metadata:a,textRef:o,indexGuessBehavior:l,index:c}=e,{register:d,unregister:p,subscribeMapChange:m,elementsRef:g,labelsRef:h,nextIndexRef:b}=RD(),_=x.useRef(-1),[j,N]=x.useState(c??(l===UC.GuessFromOrder?()=>{if(_.current===-1){const S=b.current;b.current+=1,_.current=S}return _.current}:-1)),y=x.useRef(null),w=x.useCallback(S=>{if(y.current=S,j!==-1&&S!==null&&(g.current[j]=S,h)){const k=t!==void 0;h.current[j]=k?t:o?.current?.textContent??S.textContent}},[j,g,h,t,o]);return ze(()=>{if(c!=null)return;const S=y.current;if(S)return d(S,a),()=>{p(S)}},[c,d,p,a]),ze(()=>{if(c==null)return m(S=>{const k=y.current?S.get(y.current)?.index:null;k!=null&&N(k)})},[c,m,N]),{ref:w,index:j}}let lw=(function(e){return e.checked="data-checked",e.unchecked="data-unchecked",e.disabled="data-disabled",e.highlighted="data-highlighted",e})({});const $C={checked(e){return e?{[lw.checked]:""}:{[lw.unchecked]:""}},...or},TD=x.createContext(void 0),AD=x.forwardRef(function(t,a){const{render:o,className:l,id:c,label:d,nativeButton:p=!1,disabled:m=!1,closeOnClick:g=!0,style:h,...b}=t,_=lu({label:d}),j=g_(!0),N=na(c),{store:y}=Wr(),w=y.useState("isActive",_.index),S=y.useState("itemProps"),{getItemProps:k,itemRef:E}=IC({closeOnClick:g,disabled:m,highlighted:w,id:N,store:y,nativeButton:p,nodeId:j?.context.nodeId,itemMetadata:LC});return Et("div",t,{state:{disabled:m,highlighted:w},props:[S,b,k],ref:[E,a,_.ref]})}),MD=x.createContext(void 0);function HC(e){return x.useContext(MD)}const zc="ArrowUp",Dc="ArrowDown",Rf="ArrowLeft",Tf="ArrowRight",vp="Home",yp="End",qC=new Set([Rf,Tf]),OD=new Set([Rf,Tf,vp,yp]),VC=new Set([zc,Dc]),zD=new Set([zc,Dc,vp,yp]),FC=new Set([...qC,...VC]),jp=new Set([...FC,vp,yp]),DD="Shift",PD="Control",LD="Alt",ID="Meta",BD=new Set([DD,PD,LD,ID]);function UD(e){return Gt(e)&&e.tagName==="INPUT"}function iw(e){return!!(UD(e)&&e.selectionStart!=null||Gt(e)&&e.tagName==="TEXTAREA")}function cw(e,t,a,o){if(!e||!t||!t.scrollTo)return;let l=e.scrollLeft,c=e.scrollTop;const d=e.clientWidth<e.scrollWidth,p=e.clientHeight<e.scrollHeight;if(d&&o!=="vertical"){const m=uw(e,t,"left"),g=Pd(e),h=Pd(t);a==="ltr"&&(m+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight?l=m+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight:m-h.scrollMarginLeft<e.scrollLeft+g.scrollPaddingLeft&&(l=m-h.scrollMarginLeft-g.scrollPaddingLeft)),a==="rtl"&&(m-h.scrollMarginRight<e.scrollLeft+g.scrollPaddingLeft?l=m-h.scrollMarginLeft-g.scrollPaddingLeft:m+t.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight&&(l=m+t.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight))}if(p&&o!=="horizontal"){const m=uw(e,t,"top"),g=Pd(e),h=Pd(t);m-h.scrollMarginTop<e.scrollTop+g.scrollPaddingTop?c=m-h.scrollMarginTop-g.scrollPaddingTop:m+t.offsetHeight+h.scrollMarginBottom>e.scrollTop+e.clientHeight-g.scrollPaddingBottom&&(c=m+t.offsetHeight+h.scrollMarginBottom-e.clientHeight+g.scrollPaddingBottom)}e.scrollTo({left:l,top:c,behavior:"auto"})}function uw(e,t,a){const o=a==="left"?"offsetLeft":"offsetTop";let l=0;for(;t.offsetParent&&(l+=t[o],t.offsetParent!==e);)t=t.offsetParent;return l}function Pd(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 $D={...Ho,...or},HD=x.forwardRef(function(t,a){const{render:o,className:l,style:c,finalFocus:d,...p}=t,{store:m}=Wr(),{side:g,align:h}=g_(),b=HC()!=null,_=m.useState("open"),j=m.useState("transitionStatus"),N=m.useState("popupProps"),y=m.useState("mounted"),w=m.useState("instantType"),S=m.useState("activeTriggerElement"),k=m.useState("parent"),E=m.useState("lastOpenChangeReason"),R=m.useState("rootId"),A=m.useState("floatingRootContext"),T=m.useState("floatingTreeRoot"),z=m.useState("closeDelay"),O=m.useState("activeTriggerElement"),B=m.useState("hoverEnabled"),P=m.useState("disabled"),U=m.useState("openMethod"),D=k.type==="context-menu";ka({open:_,ref:m.context.popupRef,onComplete(){_&&m.context.onOpenChangeComplete?.(!0)}}),x.useEffect(()=>{function F(Y){m.setOpen(!1,st(Y.reason,Y.domEvent))}return T.events.on("close",F),()=>{T.events.off("close",F)}},[T.events,m]),bC(A,{enabled:B&&!P&&!D&&k.type!=="menubar",closeDelay:z});const L=x.useCallback(F=>{m.set("popupElement",F)},[m]),V={transitionStatus:j,side:g,align:h,open:_,nested:k.type==="menu",instant:w},H=Et("div",t,{state:V,ref:[a,m.context.popupRef,L],stateAttributesMapping:$D,props:[N,{onKeyDown(F){b&&jp.has(F.key)&&F.stopPropagation()}},xp(j),p,{"data-rootownerid":R}]});let $=k.type===void 0||D;return(S||k.type==="menubar"&&E!==lp)&&($=!0),s.jsx(Wb,{context:A,openInteractionType:U,modal:D,disabled:!y,returnFocus:d===void 0?$:d,initialFocus:k.type!=="menu",restoreFocus:!0,externalTree:k.type!=="menubar"?T:void 0,previousFocusableElement:O,nextFocusableElement:k.type===void 0?m.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:k.type===void 0?m.context.beforeContentFocusGuardRef:void 0,children:H})}),GC=x.createContext(void 0);function qD(){const e=x.useContext(GC);if(e===void 0)throw new Error(ln(32));return e}const VD=x.forwardRef(function(t,a){const{keepMounted:o=!1,...l}=t,{store:c}=Wr();return c.useState("mounted")||o?s.jsx(GC.Provider,{value:o,children:s.jsx(Kb,{ref:a,...l})}):null});function wp(e){const{children:t,elementsRef:a,labelsRef:o,onMapChange:l}=e,c=Ue(l),d=x.useRef(0),p=es(GD).current,m=es(FD).current,[g,h]=x.useState(0),b=x.useRef(g),_=Ue((S,k)=>{m.set(S,k??null),b.current+=1,h(b.current)}),j=Ue(S=>{m.delete(S),b.current+=1,h(b.current)}),N=x.useMemo(()=>{const S=new Map;return Array.from(m.keys()).filter(E=>E.isConnected).sort(YD).forEach((E,R)=>{const A=m.get(E)??{};S.set(E,{...A,index:R})}),S},[m,g]);ze(()=>{if(typeof MutationObserver!="function"||N.size===0)return;const S=new MutationObserver(k=>{const E=new Set,R=A=>E.has(A)?E.delete(A):E.add(A);k.forEach(A=>{A.removedNodes.forEach(R),A.addedNodes.forEach(R)}),E.size===0&&(b.current+=1,h(b.current))});return N.forEach((k,E)=>{E.parentElement&&S.observe(E.parentElement,{childList:!0})}),()=>{S.disconnect()}},[N]),ze(()=>{b.current===g&&(a.current.length!==N.size&&(a.current.length=N.size),o&&o.current.length!==N.size&&(o.current.length=N.size),d.current=N.size),c(N)},[c,N,a,o,g]),ze(()=>()=>{a.current=[]},[a]),ze(()=>()=>{o&&(o.current=[])},[o]);const y=Ue(S=>(p.add(S),()=>{p.delete(S)}));ze(()=>{p.forEach(S=>S(N))},[p,N]);const w=x.useMemo(()=>({register:_,unregister:j,subscribeMapChange:y,elementsRef:a,labelsRef:o,nextIndexRef:d}),[_,j,y,a,o,d]);return s.jsx(BC.Provider,{value:w,children:t})}function FD(){return new Map}function GD(){return new Set}function YD(e,t){const a=e.compareDocumentPosition(t);return a&Node.DOCUMENT_POSITION_FOLLOWING||a&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:a&Node.DOCUMENT_POSITION_PRECEDING||a&Node.DOCUMENT_POSITION_CONTAINS?1:0}const x_=x.forwardRef(function(t,a){const{cutout:o,...l}=t;let c;if(o){const d=o.getBoundingClientRect();c=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${d.left}px ${d.top}px,${d.left}px ${d.bottom}px,${d.right}px ${d.bottom}px,${d.right}px ${d.top}px,${d.left}px ${d.top}px)`}return s.jsx("div",{ref:a,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})});let dw={},fw={},pw="";function KD(e){if(typeof document>"u")return!1;const t=xt(e);return Wt(t).innerWidth-t.documentElement.clientWidth>0}function XD(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const a=xt(e),o=a.documentElement,l=a.body,c=Yr(o)?o:l,d=c.style.overflowY,p=o.style.scrollbarGutter;o.style.scrollbarGutter="stable",c.style.overflowY="scroll";const m=c.offsetWidth;c.style.overflowY="hidden";const g=c.offsetWidth;return c.style.overflowY=d,o.style.scrollbarGutter=p,m===g}function QD(e){const t=xt(e),a=t.documentElement,o=t.body,l=Yr(a)?a: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 WD(e){const t=xt(e),a=t.documentElement,o=t.body,l=Wt(a);let c=0,d=0,p=!1;const m=da.create();if(Gr&&(l.visualViewport?.scale??1)!==1)return()=>{};function g(){const j=l.getComputedStyle(a),N=l.getComputedStyle(o),S=(j.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=a.scrollTop,d=a.scrollLeft,dw={scrollbarGutter:a.style.scrollbarGutter,overflowY:a.style.overflowY,overflowX:a.style.overflowX},pw=a.style.scrollBehavior,fw={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 k=a.scrollHeight>a.clientHeight,E=a.scrollWidth>a.clientWidth,R=j.overflowY==="scroll"||N.overflowY==="scroll",A=j.overflowX==="scroll"||N.overflowX==="scroll",T=Math.max(0,l.innerWidth-o.clientWidth),z=Math.max(0,l.innerHeight-o.clientHeight),O=parseFloat(N.marginTop)+parseFloat(N.marginBottom),B=parseFloat(N.marginLeft)+parseFloat(N.marginRight),P=Yr(a)?a:o;if(p=XD(e),p){a.style.scrollbarGutter=S,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(a.style,{scrollbarGutter:S,overflowY:"hidden",overflowX:"hidden"}),(k||R)&&(a.style.overflowY="scroll"),(E||A)&&(a.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:O||z?`calc(100dvh - ${O+z}px)`:"100dvh",width:B||T?`calc(100vw - ${B+T}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=c,o.scrollLeft=d,a.setAttribute("data-base-ui-scroll-locked",""),a.style.scrollBehavior="unset"}function h(){Object.assign(a.style,dw),Object.assign(o.style,fw),p||(a.scrollTop=c,a.scrollLeft=d,a.removeAttribute("data-base-ui-scroll-locked"),a.style.scrollBehavior=pw)}function b(){h(),m.request(g)}g();const _=_t(l,"resize",b);return()=>{m.cancel(),h(),typeof l.removeEventListener=="function"&&_()}}class ZD{lockCount=0;restore=null;timeoutLock=Zs.create();timeoutUnlock=Zs.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=xt(t).documentElement,l=Wt(o).getComputedStyle(o).overflowY;if(l==="hidden"||l==="clip"){this.restore=Mn;return}const c=ep||!KD(t);this.restore=c?QD(t):WD(t)}}const JD=new ZD;function YC(e=!0,t=null){ze(()=>{if(e)return JD.acquire(t)},[e,t])}const eP=20;function KC(e,t,a,o){const[l,c]=x.useState(!1);ze(()=>{if(!e||!t||a==null){c(!1);return}const d=xt(a).documentElement.clientWidth,p=a.offsetWidth;c(d>0&&p>0&&p>=d-eP)},[e,t,a]),YC(e&&(!t||l),o)}const tP=x.forwardRef(function(t,a){const{anchor:o,positionMethod:l="absolute",className:c,render:d,side:p,align:m,sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_=5,arrowPadding:j=5,sticky:N=!1,disableAnchorTracking:y=!1,collisionAvoidance:w=U2,style:S,...k}=t,{store:E}=Wr(),R=qD(),A=_p(!0),T=E.useState("parent"),z=E.useState("floatingRootContext"),O=E.useState("floatingTreeRoot"),B=E.useState("mounted"),P=E.useState("open"),U=E.useState("modal"),D=E.useState("openMethod"),L=E.useState("activeTriggerElement"),V=E.useState("transitionStatus"),H=E.useState("positionerElement"),$=E.useState("instantType"),F=E.useState("hasViewport"),Y=E.useState("lastOpenChangeReason"),G=E.useState("floatingNodeId"),K=E.useState("floatingParentNodeId"),I=z.useState("domReferenceElement"),X=x.useRef(null),Z=iC(H,!1,!1);let W=o,fe=g,te=h,re=m,le=w;T.type==="context-menu"&&(W=o??T.context?.anchor,re=re??"start",!p&&re!=="center"&&(te=t.alignOffset??2,fe=t.sideOffset??-5));let me=p,Me=re;T.type==="menu"?(me=me??"inline-end",Me=Me??"start",le=t.collisionAvoidance??$2):T.type==="menubar"&&(me=me??(T.context.orientation==="vertical"?"inline-end":"bottom"),Me=Me??"start");const de=T.type==="context-menu",ge=u_({anchor:W,floatingRootContext:z,positionMethod:A?"fixed":l,mounted:B,side:me,sideOffset:fe,align:Me,alignOffset:te,arrowPadding:de?0:j,collisionBoundary:b,collisionPadding:_,sticky:N,nodeId:G,keepMounted:R,disableAnchorTracking:y,collisionAvoidance:le,shiftCrossAxis:de&&!("side"in le&&le.side==="flip"),externalTree:O,adaptiveOrigin:F?RC:void 0});x.useEffect(()=>{function Ee(De){De.open&&(De.parentNodeId===G&&E.set("hoverEnabled",!1),De.nodeId!==G&&De.parentNodeId===E.select("floatingParentNodeId")&&E.setOpen(!1,st(jc)))}return O.events.on("menuopenchange",Ee),()=>{O.events.off("menuopenchange",Ee)}},[E,O.events,G]),x.useEffect(()=>{if(E.select("floatingParentNodeId")==null)return;function Ee(De){if(De.open||De.nodeId!==E.select("floatingParentNodeId"))return;const Le=De.reason??jc;E.setOpen(!1,st(Le))}return O.events.on("menuopenchange",Ee),()=>{O.events.off("menuopenchange",Ee)}},[O.events,E]);const Ce=En();x.useEffect(()=>{P||Ce.clear()},[P,Ce]),x.useEffect(()=>{function Ee(De){if(!(!P||De.nodeId!==E.select("floatingParentNodeId")))if(De.target&&L&&L!==De.target){const Le=E.select("closeDelay");Le>0?Ce.isStarted()||Ce.start(Le,()=>{E.setOpen(!1,st(jc))}):E.setOpen(!1,st(jc))}else Ce.clear()}return O.events.on("itemhover",Ee),()=>{O.events.off("itemhover",Ee)}},[O.events,P,L,E,Ce]),x.useEffect(()=>{const Ee={open:P,nodeId:G,parentNodeId:K,reason:E.select("lastOpenChangeReason")};O.events.emit("menuopenchange",Ee)},[O.events,P,E,G,K]),ze(()=>{const Ee=I,De=X.current;if(Ee&&(X.current=Ee),De&&Ee&&Ee!==De){E.set("instantType",void 0);const Le=new AbortController;return Z(()=>{E.set("instantType","trigger-change")},Le.signal),()=>{Le.abort()}}},[I,Z,E]);const ke={open:P,side:ge.side,align:ge.align,anchorHidden:ge.anchorHidden,nested:T.type==="menu",instant:$},Be=T.type==="menubar"&&T.context.modal;KC(P&&(Be||U&&Y!==On),D==="touch",H,L);const Se=d_(t,ke,{styles:ge.positionerStyles,transitionStatus:V,props:k,refs:[a,E.useStateSetter("positionerElement")],hidden:!B,inert:!P}),Te=B&&T.type!=="menu"&&(T.type!=="menubar"&&U&&Y!==On||T.type==="menubar"&&T.context.modal);let je=null;return T.type==="menubar"?je=T.context.contentElement:T.type===void 0&&(je=L),s.jsxs(zC.Provider,{value:ge,children:[Te&&s.jsx(x_,{ref:T.type==="context-menu"||T.type==="nested-context-menu"?T.context.internalBackdropRef:null,inert:bp(!P),cutout:je}),s.jsx(CO,{id:G,children:s.jsx(wp,{elementsRef:E.context.itemDomElements,labelsRef:E.context.itemLabels,children:Se})})]})}),XC=x.createContext(void 0);function nP(){const e=x.useContext(XC);if(e===void 0)throw new Error(ln(34));return e}const sP=x.memo(x.forwardRef(function(t,a){const{render:o,className:l,value:c,defaultValue:d,onValueChange:p,disabled:m=!1,style:g,"aria-labelledby":h,...b}=t,[_,j]=x.useState(void 0),[N,y]=ei({controlled:c,default:d,name:"MenuRadioGroup"}),w=Ue((R,A)=>{p?.(R,A),!A.isCanceled&&y(R)}),k=Et("div",t,{state:{disabled:m},ref:a,props:{role:"group","aria-labelledby":h??_,"aria-disabled":m||void 0,...b}}),E=x.useMemo(()=>({value:N,setValue:w,disabled:m}),[N,w,m]);return s.jsx(TD.Provider,{value:j,children:s.jsx(XC.Provider,{value:E,children:k})})})),QC=x.createContext(void 0);function aP(){const e=x.useContext(QC);if(e===void 0)throw new Error(ln(35));return e}const rP=x.forwardRef(function(t,a){const{render:o,className:l,id:c,label:d,nativeButton:p=!1,disabled:m=!1,closeOnClick:g=!1,value:h,style:b,..._}=t,j=lu({label:d}),N=g_(!0),y=na(c),{store:w}=Wr(),S=w.useState("isActive",j.index),k=w.useState("itemProps"),{value:E,setValue:R,disabled:A}=nP(),T=A||m,z=E===h,{getItemProps:O,itemRef:B}=IC({closeOnClick:g,disabled:T,highlighted:S,id:y,store:w,nativeButton:p,nodeId:N?.context.nodeId,itemMetadata:LC}),P=x.useMemo(()=>({disabled:T,highlighted:S,checked:z}),[T,S,z]);function U(L){const V=st($l,L.nativeEvent,void 0,{preventUnmountOnClose(){}});R(h,V)}const D=Et("div",t,{state:P,stateAttributesMapping:$C,props:[k,{role:"menuitemradio","aria-checked":z,onClick:U},_,O],ref:[B,a,j.ref]});return s.jsx(QC.Provider,{value:P,children:D})}),oP=x.forwardRef(function(t,a){const{render:o,className:l,style:c,keepMounted:d=!1,...p}=t,m=aP(),g=x.useRef(null),{transitionStatus:h,setMounted:b}=pi(m.checked);ka({open:m.checked,ref:g,onComplete(){m.checked||b(!1)}});const _={checked:m.checked,disabled:m.disabled,highlighted:m.highlighted,transitionStatus:h};return Et("span",t,{state:_,stateAttributesMapping:$C,ref:[a,g],props:{"aria-hidden":!0,...p},enabled:d||m.checked})}),lP=x.createContext(null);function WC(e){return x.useContext(lP)}function iP(e){const t=x.useRef(""),a=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:a}}function b_(e,t){const a=x.useRef(e),o=Ue(t);ze(()=>{a.current!==e&&o(a.current)},[e,o]),ze(()=>{a.current=e},[e])}function cP(e,t){const a=Ue((c,d)=>{(typeof e=="function"?e():e)||t(d||(ep?"touch":""))}),{onClick:o,onPointerDown:l}=iP(a);return x.useMemo(()=>({onClick:o,onPointerDown:l}),[o,l])}function ZC(e){const[t,a]=x.useState(null),o=cP(e,a);return b_(e,l=>{l&&!e&&a(null)}),x.useMemo(()=>({openMethod:t,triggerProps:o}),[t,o])}const uP={...o_,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 __ extends fp{constructor(t){super({...dP(),...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 ou},uP),this.unsubscribeParentListener=this.observe("parent",a=>{if(this.unsubscribeParentListener?.(),a.type==="menu"){let o=a.store.select("rootId"),l=a.store.select("floatingTreeRoot"),c=a.store.select("keyboardEventRelay");this.unsubscribeParentListener=a.store.subscribe(()=>{const d=a.store.select("rootId"),p=a.store.select("floatingTreeRoot"),m=a.store.select("keyboardEventRelay");o===d&&l===p&&c===m||(o=d,l=p,c=m,this.notifyAll())}),this.context.allowMouseUpTriggerRef=a.store.context.allowMouseUpTriggerRef;return}a.type!==void 0&&(this.context.allowMouseUpTriggerRef=a.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,a){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:a})}static useStore(t,a){const o=es(()=>new __(a)).current;return t??o}unsubscribeParentListener=null}function dP(){return{...a_(),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 Xb,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:Xt,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const fP=x.createContext(void 0);function pP(){return x.useContext(fP)}const mP=Eb(function(t){const{children:a,open:o,onOpenChange:l,onOpenChangeComplete:c,defaultOpen:d=!1,disabled:p=!1,modal:m,loopFocus:g=!0,orientation:h="vertical",actionsRef:b,closeParentOnEsc:_=!1,handle:j,triggerId:N,defaultTriggerId:y=null,highlightItemOnHover:w=!0}=t,S=_p(!0),k=Wr(!0),E=WC(!0),R=pP(),A=x.useMemo(()=>R&&k?{type:"menu",store:k.store}:E?{type:"menubar",context:E}:S&&!k?{type:"context-menu",context:S}:{type:void 0},[S,k,E,R]),T=__.useStore(j?.store,{open:d,openProp:o,activeTriggerId:y,triggerIdProp:N,parent:A});dC(T,o,d,y),T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",N),T.useContextCallback("onOpenChangeComplete",c);const z=Ao(),O=Ao(),B=T.useState("floatingTreeRoot"),P=K2(B),U=Xr(),D=T.useState("open"),L=T.useState("activeTriggerElement"),V=T.useState("positionerElement"),H=T.useState("hoverEnabled"),$=T.useState("disabled"),F=T.useState("lastOpenChangeReason"),Y=T.useState("parent"),G=T.useState("activeIndex"),K=T.useState("payload"),I=T.useState("floatingParentNodeId"),X=x.useRef(null),Z=x.useRef(Y.type!=="context-menu"),W=En(),fe=x.useRef(!0),te=En(),re=I!=null,{openMethod:le,triggerProps:me}=ZC(D);T.useSyncedValues({disabled:p,highlightItemOnHover:w,modal:Y.type===void 0?m:void 0,openMethod:le,rootId:z}),t_(T);const{forceUnmount:Me}=n_(D,T,()=>{T.update({allowMouseEnter:!1,stickIfOpen:!0})});ze(()=>{S&&!k?T.update({parent:{type:"context-menu",context:S},floatingNodeId:P,floatingParentNodeId:U}):k&&T.update({floatingNodeId:P,floatingParentNodeId:U})},[S,k,P,U,T]),x.useEffect(()=>{if(D||(X.current=null),Y.type==="context-menu"){if(!D){W.clear(),Z.current=!1;return}W.start(500,()=>{Z.current=!0})}},[W,D,Y.type]),ze(()=>{!D&&!H&&T.set("hoverEnabled",!0)},[D,H,T]);const de=Ue((Oe,tt)=>{const ot=tt.reason;if(D===Oe&&tt.trigger===L&&F===ot)return;const vt=uC(tt);if(!Oe&&tt.trigger==null&&(tt.trigger=L??void 0),l?.(Oe,tt),tt.isCanceled)return;T.state.floatingRootContext.dispatchOpenChange(Oe,tt);const Mt=tt.event;if(Oe===!1&&Mt?.type==="click"&&Mt.pointerType==="touch"&&!fe.current)return;Oe&&ot===Ul?(fe.current=!1,te.start(300,()=>{fe.current=!0})):(fe.current=!0,te.clear());const lt=(ot===fi||ot===$l)&&Mt.detail===0&&Mt?.isTrusted,Rt=!Oe&&(ot===ip||ot==null),_e={open:Oe,openChangeReason:ot};X.current=tt.event??null,e_(_e,Oe,tt.trigger,vt()),T.update(_e),Y.type==="menubar"&&(ot===Ul||ot===To||ot===On||ot===wx||ot===jc)?T.set("instantType","group"):lt||Rt?T.set("instantType",lt?"click":"dismiss"):T.set("instantType",void 0)}),ge=lC({popupStore:T,floatingId:O,nested:U!=null,onOpenChange:de}),Ce=ge.context.events;x.useEffect(()=>{const Oe=({open:tt,eventDetails:ot})=>de(tt,ot);return Ce.on("setOpen",Oe),()=>{Ce?.off("setOpen",Oe)}},[Ce,de]);const ke=x.useCallback(()=>{T.setOpen(!1,st(Lb))},[T]);x.useImperativeHandle(b,()=>({unmount:Me,close:ke}),[Me,ke]);let Be;Y.type==="context-menu"&&(Be=Y.context),x.useImperativeHandle(Be?.positionerRef,()=>V,[V]),x.useImperativeHandle(Be?.actionsRef,()=>({setOpen:de}),[de]);const Ve=up(ge,{enabled:!$,bubbles:{escapeKey:_&&Y.type==="menu"},outsidePress(){return Y.type!=="context-menu"||X.current?.type==="contextmenu"?!0:Z.current},externalTree:re?B:void 0}),Se=hp(),Te=x.useCallback(Oe=>{T.select("activeIndex")!==Oe&&T.set("activeIndex",Oe)},[T]),je=vC(ge,{enabled:!$,listRef:T.context.itemDomElements,activeIndex:G,nested:Y.type!==void 0,loopFocus:g,orientation:h,parentOrientation:Y.type==="menubar"?Y.context.orientation:void 0,rtl:Se==="rtl",disabledIndices:tr,onNavigate:Te,openOnArrowKeyDown:Y.type!=="context-menu",externalTree:re?B:void 0,focusItemOnHover:w}),Ee=x.useCallback(Oe=>{T.context.typingRef.current=Oe},[T]),De=yC(ge,{enabled:!$,listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:G,resetMs:vO,onMatch:Oe=>{D&&Oe!==G&&T.set("activeIndex",Oe)},onTyping:Ee}),Le=x.useMemo(()=>{const Oe=Kn(De.reference,je.reference,Ve.reference,{onMouseMove(){T.set("allowMouseEnter",!0)}},me);return Oe["aria-haspopup"]="menu",Oe["aria-expanded"]=D,Oe},[T,De.reference,je.reference,Ve.reference,me,D]),Ie=x.useMemo(()=>{const Oe=Kn(je.trigger,Ve.trigger,me);return Oe["aria-haspopup"]="menu",Oe["aria-expanded"]=!1,Oe},[je.trigger,Ve.trigger,me]),ue=x.useMemo(()=>Kn(mp,{id:O,role:"menu","aria-labelledby":L?.id,onMouseMove(){T.set("allowMouseEnter",!0),Y.type==="menu"&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(Oe){const tt=T.select("keyboardEventRelay");tt&&!Oe.isPropagationStopped()&&tt(Oe)}},De.floating,je.floating,Ve.floating),[L,O,Y.type,T,De.floating,je.floating,Ve.floating]),ye=je.item??Xt;s_(T,{floatingRootContext:ge,activeTriggerProps:Le,inactiveTriggerProps:Ie,popupProps:ue,itemProps:ye});const Ge=x.useMemo(()=>({store:T,parent:A}),[T,A]),Re=s.jsx(DC.Provider,{value:Ge,children:typeof a=="function"?a({payload:K}):a});return Y.type===void 0||Y.type==="context-menu"?s.jsx(NO,{externalTree:B,children:Re}):Re});function JC(e){const t=e.getBoundingClientRect(),a=Wt(e);if(Ab)return t;const o=a.getComputedStyle(e,"::before"),l=a.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return t;const d=parseFloat(o.width)||0,p=parseFloat(o.height)||0,m=parseFloat(l.width)||0,g=parseFloat(l.height)||0,h=Math.max(t.width,d,m),b=Math.max(t.height,p,g),_=h-t.width,j=b-t.height;return{left:t.left-_/2,right:t.right+_/2,top:t.top-j/2,bottom:t.bottom+j/2}}function eN(e={}){const{highlightItemOnHover:t,highlightedIndex:a,onHighlightedIndexChange:o}=h_(),{ref:l,index:c}=lu(e),d=a===c,p=x.useRef(null),m=nr(l,p);return{compositeProps:{tabIndex:d?0:-1,onFocus(){o(c)},onMouseMove(){const h=p.current;if(!t||!h)return;const b=h.hasAttribute("disabled")||h.ariaDisabled==="true";!d&&!b&&h.focus()}},compositeRef:m,index:c}}function gP(e){const{render:t,className:a,style:o,state:l=Xt,props:c=tr,refs:d=tr,metadata:p,stateAttributesMapping:m,tag:g="div",...h}=e,{compositeProps:b,compositeRef:_}=eN({metadata:p});return Et(g,e,{state:l,ref:[...d,_],props:[b,...c,h],stateAttributesMapping:m})}function tN(e){if(Gt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!ma(e))return tN(_a(e))}function hP(e,t){const a=x.useRef(null);function o(c){qs.flushSync(()=>{e.setOpen(!1,st(To,c.nativeEvent,c.currentTarget))}),nO(a.current)?.focus()}function l(c){const d=e.select("positionerElement");if(d&&Hl(c,d))e.context.beforeContentFocusGuardRef.current?.focus();else{qs.flushSync(()=>{e.setOpen(!1,st(To,c.nativeEvent,c.currentTarget))});let p=tO(e.context.triggerFocusTargetRef.current||t.current);for(;p!==null&&We(d,p);){const m=p;if(p=Vb(p),p===m)break}p?.focus()}}return{preFocusGuardRef:a,handlePreFocusGuardFocus:o,handleFocusTargetFocus:l}}function xP(e){const{enabled:t=!0,mouseDownAction:a,open:o}=e,l=x.useRef(!1);return x.useMemo(()=>t?{onMouseDown:c=>{(a==="open"&&!o||a==="close"&&o)&&(l.current=!0,xt(c.currentTarget).addEventListener("click",()=>{l.current=!1},{once:!0}))},onClick:c=>{l.current&&(l.current=!1,c.preventBaseUIHandler())}}:Xt,[t,a,o])}const Ld=2,bP=c2(function(t,a){const{render:o,className:l,style:c,disabled:d=!1,nativeButton:p=!0,id:m,openOnHover:g,delay:h=100,closeDelay:b=0,handle:_,payload:j,...N}=t,y=Wr(!0),w=_?.store??y?.store;if(!w)throw new Error(ln(85));const S=na(m),k=w.useState("isTriggerActive",S),E=w.useState("floatingRootContext"),R=w.useState("isOpenedByTrigger",S),A=w.useState("triggerPopupId",S),T=x.useRef(null),z=vP(),O=h_(!0),B=Qr(),P=x.useMemo(()=>B??new Xb,[B]),U=K2(P),D=Xr(),{registerTrigger:L,isMountedByThisTrigger:V}=fC(S,T,w,{payload:j,closeDelay:b,parent:z,floatingTreeRoot:P,floatingNodeId:U,floatingParentNodeId:D,keyboardEventRelay:O?.relayKeyboardEvent}),H=z.type==="menubar",$=w.useState("disabled"),F=d||$||H&&z.context.disabled,{getButtonProps:Y,buttonRef:G}=Zr({disabled:F,native:p});x.useEffect(()=>{!R&&z.type===void 0&&(w.context.allowMouseUpTriggerRef.current=!1)},[w,R,z.type]);const K=x.useRef(null),I=En(),X=Ue(je=>{if(!K.current)return;I.clear(),w.context.allowMouseUpTriggerRef.current=!1;const Ee=je.target;if(We(K.current,Ee)||We(w.select("positionerElement"),Ee)||Ee===K.current||Ee!=null&&tN(Ee)===w.select("rootId"))return;const De=JC(K.current);je.clientX>=De.left-Ld&&je.clientX<=De.right+Ld&&je.clientY>=De.top-Ld&&je.clientY<=De.bottom+Ld||P.events.emit("close",{domEvent:je,reason:h2})});x.useEffect(()=>{R&&w.select("lastOpenChangeReason")===On&&xt(K.current).addEventListener("mouseup",X,{once:!0})},[R,X,w]);const Z=H&&z.context.hasSubmenuOpen,fe=_C(E,{enabled:(g??Z)&&!F&&z.type!=="context-menu"&&(!H||Z&&!V),handleClose:jC({blockPointerEvents:!H}),mouseOnly:!0,move:!1,restMs:z.type===void 0?h:void 0,delay:{close:b},triggerElementRef:T,externalTree:P,isActiveTrigger:k,isClosing:()=>w.select("transitionStatus")==="ending"}),te=_P(R,w.select("lastOpenChangeReason")),re=X2(E,{enabled:!F&&z.type!=="context-menu",event:R&&H?"click":"mousedown",toggle:!0,ignoreMouse:!1,stickIfOpen:z.type===void 0?te:!1}),le=hC(E,{enabled:!F&&Z}),me=xP({open:R,enabled:H,mouseDownAction:"open"}),Me=x.useMemo(()=>Kn(le.reference,re.reference),[le.reference,re.reference]),de=w.useState("triggerProps",V),{preFocusGuardRef:ge,handlePreFocusGuardFocus:Ce,handleFocusTargetFocus:ke}=hP(w,T),Be={disabled:F,open:R},Ve=[K,a,G,L,T],Se=[Me,fe??Xt,de,{"aria-haspopup":"menu","aria-controls":A,id:S,onMouseDown:je=>{if(w.select("open"))return;I.start(200,()=>{w.context.allowMouseUpTriggerRef.current=!0}),xt(je.currentTarget).addEventListener("mouseup",X,{once:!0})}},H?{role:"menuitem"}:{},me,N,Y],Te=Et("button",t,{enabled:!H,stateAttributesMapping:Tx,state:Be,ref:Ve,props:Se});return H?s.jsx(gP,{tag:"button",render:o,className:l,style:c,state:Be,refs:Ve,props:Se,stateAttributesMapping:Tx}):R?s.jsxs(x.Fragment,{children:[s.jsx(Zl,{ref:ge,onFocus:Ce},`${S}-pre-focus-guard`),s.jsx(x.Fragment,{children:Te},S),s.jsx(Zl,{ref:w.context.triggerFocusTargetRef,onFocus:ke},`${S}-post-focus-guard`)]}):s.jsx(x.Fragment,{children:Te},S)});function _P(e,t){const a=En(),[o,l]=x.useState(!1);return ze(()=>{e&&t==="trigger-hover"?(l(!0),a.start(yO,()=>{l(!1)})):e||(a.clear(),l(!1))},[e,t,a]),o}function vP(){const e=_p(!0),t=Wr(!0),a=WC();return x.useMemo(()=>a?{type:"menubar",context:a}:e&&!t?{type:"context-menu",context:e}:{type:void 0},[e,t,a])}function nN(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}function v_({...e}){return s.jsx(mP,{"data-slot":"dropdown-menu",...e})}function y_({...e}){return s.jsx(bP,{"data-slot":"dropdown-menu-trigger",...e})}function j_({align:e="start",alignOffset:t=0,side:a="bottom",sideOffset:o=4,className:l,...c}){return s.jsx(VD,{children:s.jsx(tP,{className:"isolate z-50 outline-none",align:e,alignOffset:t,side:a,sideOffset:o,children:s.jsx(HD,{"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 lf({className:e,inset:t,variant:a="default",...o}){return s.jsx(AD,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":a,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 yP({...e}){return s.jsx(sP,{"data-slot":"dropdown-menu-radio-group",...e})}function jP({className:e,children:t,inset:a,...o}){return s.jsxs(rP,{"data-slot":"dropdown-menu-radio-item","data-inset":a,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:[s.jsx("span",{className:"pointer-events-none absolute right-2 flex items-center justify-center","data-slot":"dropdown-menu-radio-item-indicator",children:s.jsx(oP,{children:s.jsx(Hr,{})})}),t]})}const wP={common:{loading:"Cargando…",saving:"Guardando…",cancel:"Cancelar",save:"Guardar",delete:"Borrar",edit:"Editar",create:"Crear",add:"Agregar",remove:"Quitar",reload:"Recargar",shutdown:"Apagar",enabled:"Habilitado",disabled:"Deshabilitado",enable:"Habilitar",disable:"Deshabilitar",open:"Abrir",close:"Cerrar",confirm:"Confirmar",optional:"(opcional)",none:"—",none_yet:"Todavía no hay nada.",error_generic:"Algo salió mal.",search:"Buscar",new:"Nuevo",restore:"Restaurar",show:"Mostrar",hide:"Ocultar",copy:"Copiar",run:"Ejecutar",refresh:"Refrescar",view_all:"Ver todo",saved:"Guardado.",deleted:"Eliminado.",pager_prev:"Anterior",pager_next:"Siguiente",pager_page:"Página {page} de {total}",pager_range:"{from}–{to} de {total}",pager_per_page:"Por página"},daemon:{connecting:"Conectando con el daemon…",unreachable:"No pude llegar al daemon en localhost:7430.",unreachable_hint:"Arrancá APX con `apx daemon start` y refrescá.",version:"Versión",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — relee ~/.apx/config.json sin reiniciar.",shutdown_confirm:"¿Apagar el daemon? Las próximas requests fallarán hasta levantarlo de nuevo.",shutdown_done:"Daemon detenido."},pairing:{title:"Vincular este equipo",subtitle:"Estás entrando desde fuera de esta máquina. Por seguridad, vinculá este navegador con un código de pairing.",steps_title:"Cómo obtener el código",step_1:"En la PC donde corre APX, abrí una terminal.",step_2:"Ejecutá `apx pair` (o escaneá el QR con APX Deck).",step_3:"Copiá el código que aparece debajo del QR y pegalo acá.",code_label:"Código de pairing",code_ph:"p. ej. 7f3a1c9e-…",label_label:"Nombre de este equipo",label_ph:"p. ej. Notebook del living",submit:"Vincular",linking:"Vinculando…",success:"Equipo vinculado ✓",err_required:"Pegá el código de pairing.",err_expired:"El código expiró. Volvé a correr `apx pair` y probá de nuevo.",err_unknown:"Código desconocido o ya usado. Generá uno nuevo con `apx pair`.",err_generic:"No se pudo vincular. Revisá el código e intentá otra vez.",revoke_hint:"Podés revocar este equipo cuando quieras desde Settings o con `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Proyecto",add_project:"Agregar proyecto",all_projects:"Todos los proyectos",more_projects:"{count} más",collapse_projects:"Ocultar proyectos",expand_projects:"Mostrar proyectos",modules:{voice:"Voces",desktop:"Escritorio",deck:"Deck",code:"Code",web:"Web"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Proyecto",breadcrumb_base:"Base",breadcrumb_projects:"Proyectos",light:"Cambiar a claro",dark:"Cambiar a oscuro",lang_toggle:"Idioma"},admin:{title:"APX",subtitle:"Panel general. Configuración global, canales y proyectos.",engines_title:"Engines",engines_subtitle:"Adaptadores LLM disponibles. Las API keys viven en ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Canales configurados. Cada uno puede estar pineado a un proyecto.",telegram_polling_on:"Polling activo",telegram_polling_off:"Deshabilitado",telegram_add_channel:"Canal",telegram_send_test:"Probar",telegram_send_test_title:"Enviar a",telegram_default_message:"Mensaje de prueba desde el panel de APX ✅",projects_title:"Proyectos registrados",projects_subtitle:"Click en un proyecto para abrir su panel.",unregister:"Desregistrar",unregister_confirm:"¿Quitar {label} de APX? La carpeta no se borra; sólo se desregistra.",reload_success:"Config recargada.",telegram_polling_started:"Polling iniciado.",telegram_polling_stopped:"Polling detenido.",telegram_channel_removed:"Canal eliminado.",agents_badge:"agents",engine_badge:"sí",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Agregar proyecto",subtitle:"APX indexará .apc/, agents y AGENTS.md en esa carpeta.",path_label:"Ruta absoluta",path_hint:"Equivalente a apx project add /ruta/al/proyecto",path_placeholder:"/Volumes/SSDT7Shield/proyectos_varios/mi-proyecto",register:"Registrar",path_required:"Ruta requerida.",registered:"Proyecto #{id} registrado.",search_btn:"Buscar",picker_prompt:"Elegí la carpeta del proyecto",browser_unavailable:"Explorador no disponible hasta reiniciar daemon. Pegá ruta manual.",no_folders:"Sin carpetas."},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",structure:"Estructura",docs:"Docs",files:"Archivos"},sections:{workspace:"Workspace",content:"Contenido",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",routines_active:"Rutinas activas",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"abrir",roster:"Equipo",no_agents:"Todavía no hay agentes.",orchestrators:"Orquestadores",specialists:"Especialistas",recent_tasks:"Tasks recientes",no_activity:"No hay tasks abiertas."},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",tools_count:"{n} tools",logs_title:"Logs · {name}",logs_empty:"Sin logs todavía. Arrancá el MCP llamando un tool o probando.",logs_events:"Eventos recientes",logs_stderr:"stderr (últimos 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"elegí un MCP",logs_panel_hint:"Click un MCP de la lista para ver lo que está pasando en vivo.",logs_panel_idle:"Sin actividad. Apretá Probar para arrancarlo.",name_required:"Nombre requerido",removed:"eliminado",added:"MCP agregado.",updated:"MCP actualizado."},vars:{title:"Variables",subtitle_project:"Reemplazan ${var.NOMBRE} al cargar MCPs y plantillas. Las del proyecto ganan sobre las globales. Se guardan fuera del repo (~/.apx/, chmod 0600).",subtitle_base:"Variables globales — disponibles para todos los proyectos. Se guardan en ~/.apx/vars.json (chmod 0600).",empty:"Sin variables todavía.",new:"Variable",new_title:"Nueva variable",edit_title:"Editar variable",new_desc:"Se referencia como ${var.NOMBRE} en cualquier campo que soporte interpolación.",reveal_all:"Mostrar valores",reveal:"Mostrar",hide:"Ocultar",filter_label:"Mostrar:",filter_all:"Todas",filter_project:"Sólo proyecto",filter_global:"Sólo globales",scope_label:"Scope",scope_project:"proyecto",scope_project_desc:"Sólo este proyecto. Pisa la global con mismo nombre.",scope_global:"global",scope_global_desc:"Disponible en todos los proyectos.",name_label:"Nombre",name_hint:"Mayúsculas, dígitos y _. P. ej.: MY_API_KEY, GITHUB_TOKEN.",value_label:"Valor",value_hint:"Se guarda en disco con permisos 0600. Nunca se commitea.",value_edit_ph:"(dejá vacío para no cambiarlo… aún no soportado, pegá el valor de nuevo)",add_btn:"Agregar",save_btn:"Guardar",edit_btn:"Editar",delete_btn:"Borrar",delete_confirm:"¿Borrar {name} ({scope})?",removed:"Variable eliminada.",added:"Variable agregada.",updated:"Variable actualizada.",name_required:"Nombre requerido.",value_required:"Valor requerido."},threads:{title:"Chats",subtitle:"Conversaciones por agent (vacío = ningún log persistido todavía).",no_agents:"No hay agents. Las conversaciones requieren un agent configurado.",pick:"Elegí un agent para ver sus conversaciones.",empty:"No hay conversaciones para {slug}.",conversation_title:"Conversación {id}",messages:"mensajes",via:"via"},config:{title:"Config rápida",subtitle:"Override del proyecto. Se escribe en {path}.",model:"super_agent.model",model_hint:"ej. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug del agent que atiende por defecto en este proyecto.",use_global:"(usa global)",saved:"Guardado.",nothing:"Nada para guardar.",raw_title:"Config (JSON crudo)",raw_subtitle:"Pegá el objeto entero — equivale a PUT del archivo.",raw_save:"Reemplazar config",raw_done:"Config sobrescrita.",effective:"Effective config (read-only)",effective_sub:"Lo que ve realmente el daemon (global ⊕ override).",section_title:"Config proyecto",section_desc:"APC metadata y overrides separados. General APX vive en Settings > Config.",effective_read:"Lectura: global APX + override proyecto.",save_project:".apc/project.json guardado.",save_override:".apc/config.json guardado.",save_fields_success:"Overrides guardados.",save_meta_success:"Project metadata guardado.",no_data:"Sin datos.",tab_settings:"Settings",tab_project:"Project"},telegram:{title:"Canal de Telegram (override)",subtitle:"Si seteás un canal acá, los mensajes generados por este proyecto se mandan ahí en lugar del default.",use_default:"Usar el canal default",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override guardado.",cleared:"Override eliminado — vuelve al default.",override_active:"override activo",channel_badge:"Canal {name}",no_override:"Sin override. Los mensajes de este proyecto van al canal default.",respond_engine:"Responder con engine",route_agent:"route_to_agent",route_hint:"Slug del agent que atiende (vacío = super-agent).",bot_hint_none:"Si vacío, hereda del default."},memories:{sidebar_title:"Memorias",general_group:"General",general_item:"Memoria del proyecto",project_title:"Memoria del proyecto",project_desc:"Hechos durables a nivel proyecto. .apc/memory.md — la leen los agentes y el super-agente.",project_ph:`# Memoria del proyecto
|
|
742
|
+
|
|
743
|
+
Hechos estables que cualquier agente debería saber…`,agents_title:"Memorias de agentes",agents_desc:"Memoria individual por agente. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"Sin agentes en este proyecto.",saved:"Memoria guardada.",empty:"(memoria vacía)",chars:"chars · Markdown",save_btn:"Guardar"}},base:{title:"Base",subtitle:"Espacio general · super-agente",nav_general:"General",nav_activity:"Actividad",nav_system:"Sistema",workspaces_title:"Workspaces",workspaces_desc:"Todos los proyectos registrados en APX.",workspaces_new:"Nuevo proyecto",workspaces_empty:"Sin proyectos. Agregá uno con el botón de arriba.",sessions_title:"Sessions",sessions_desc:"Sesiones de todos los engines (apx · claude · codex), más nuevas primero.",sessions_desc_scoped:"Sesiones en la carpeta de este proyecto ({path}), todos los engines, más nuevas primero.",sessions_all:"Todos los engines",sessions_empty:"Sin sesiones.",sessions_error:"No pude leer las sesiones: {msg}",sessions_search_ph:"Buscar sesiones…",sessions_deep:"Profundo",sessions_deep_tip:"También busca dentro de los transcripts (más lento)",sessions_clear:"Limpiar filtros",sessions_refresh:"Refrescar lista",sessions_no_match:"Ninguna sesión coincide con «{q}».",sessions_act_cmd:"Copiar comando apx",sessions_act_ask:"Pedir a {name} que continúe",sessions_act_folder:"Abrir carpeta",sessions_act_path:"Copiar ruta",sessions_cmd_copied:"Comando copiado — pegalo en tu terminal",sessions_path_copied:"Ruta copiada",sessions_copy_failed:"No se pudo copiar",sessions_no_folder:"Esta sesión no tiene carpeta",sessions_no_path:"Esta sesión no tiene ruta",sessions_folder_failed:"No se pudo abrir la carpeta: {msg}",defaults_title:"Agent defaults",defaults_desc:"Plantillas globales del vault. Las bundled vienen con APX y siempre están; las que crees o edites quedan en ~/.apx/agents y se superponen. Importalas a un proyecto desde Agents › Importar.",defaults_show_removed:"Mostrar removidos",defaults_new:"Nuevo",defaults_empty:"Sin plantillas en el vault.",defaults_hide:"Ocultar",defaults_restore:"Restaurar",defaults_edit:"Editar",defaults_remove:"Ocultar",defaults_delete:"Borrar",defaults_tombstone_msg:'Ocultar el default "{slug}"? Es bundled — quedá tombstoneado y lo recuperás con Restaurar.',defaults_delete_msg:'Borrar el template "{slug}"?',defaults_hidden:"Ocultado.",defaults_deleted:"Borrado.",defaults_restored:"Restaurado.",defaults_new_title:"Nuevo template",defaults_new_desc:"POST /agents/vault — se guarda en ~/.apx/agents/<slug>.md",defaults_edit_title:'Editar "{slug}"',defaults_bundled_desc:"Es un default bundled. Al guardar se hace copy-on-write a ~/.apx/agents/<slug>.md (queda como override).",defaults_user_desc:"PATCH /agents/vault/:slug — edita el archivo en ~/.apx/agents.",defaults_master_label:"Agente master",defaults_slug_invalid:"slug inválido (debe matchear /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" creado.',defaults_saved:'Template "{slug}" guardado.'},logs:{title:"Logs",desc_global:"Actividad del daemon (canales globales: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Actividad del proyecto. ~/.apx/projects/<id>/messages/.",filter_channel:"filtrar canal (ej. telegram)",filter_dir:"dirección",all_directions:"Todas las direcciones",in:"Entrada (in)",out:"Salida (out)",filter_type:"tipo",all_types:"Todos los tipos",search_text:"buscar en el texto…",count_of:"de",no_activity:"Sin actividad.",no_activity_ch:'Sin actividad en el canal "{ch}".',error:"No pude leer los mensajes: {msg}",show_more:"ver más",show_less:"ver menos",daemon_errors:"Errores del daemon (~/.apx/logs/errors.jsonl)",no_errors:"Sin errores registrados. 🎉"},telegram_contacts:{title:"Contactos de Telegram",desc:"Quién le escribe a los bots. El rol define qué herramientas puede usar; un invitado no tiene permisos hasta que le asignes un rol.",empty:"Todavía no hay contactos — se registran solos cuando alguien escribe a un bot.",owner_badge:"dueño",assign_role:"Asignar rol",owner_hint:"Es dueño de un canal — cambialo desde el canal",removed:"Contacto eliminado.",delete_confirm:"¿Borrar el contacto {name}?",last_seen:"visto:",tools_all:"tools: todas",tools_none:"tools: ninguna",tools_label:"tools:"},telegram_channels:{title:"Canales",desc:"Cada canal es un bot que el daemon polea. Acá podés añadir/quitar canales, cambiar el agente que contesta, el proyecto al que pertenece y su dueño.",new_btn:"Nuevo canal",empty:"Todavía no hay canales — agregá el primero.",removed:"Canal eliminado.",delete_confirm:"¿Borrar el canal {name}?",no_owner:"sin dueño (se reclama al primer DM)",owner_label:"dueño:"},telegram_channel_dialog:{new_title:"Nuevo canal de Telegram",edit_title:"Editar canal: {name}",name_label:"name (slug interno)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug o id del proyecto al que pinear este canal (opcional).",route_label:"route_to_agent",route_hint:"Agente que contesta; vacío = super-agent APX.",owner_label:"owner_user_id",owner_hint:"user_id de Telegram del dueño de este canal. Override del rol global a 'owner' acá. Si lo dejás vacío, el primer mensaje privado lo reclama.",owner_ph:"889721252",respond_label:"Responder con engine (no echo)",name_required:"name requerido",saved:"Canal guardado."},telegram_send_dialog:{title:"Enviar a {name}",default_msg:"Mensaje de prueba desde el panel de APX ✅"},telegram_roles:{title:"Roles",desc:"Cada rol define qué herramientas del super-agent puede usar quien lo tenga asignado. 'owner' siempre = todas; 'guest' siempre = ninguna (solo chat).",empty:"No hay roles definidos.",tools_all:"todas las herramientas",tools_none:"ninguna herramienta",builtin:"built-in",delete_confirm:'¿Borrar el rol "{name}"?',removed:"Rol eliminado.",saved:'Rol "{name}" guardado.',name_required:"Nombre requerido.",builtin_error:'"{name}" es un rol built-in.',new_title:"Nuevo rol o reemplazar uno custom",name_label:"Nombre",name_ph:"editor",tools_label:"Tools (separadas por coma)",tools_hint:"Vacío = ninguna. Ejemplos: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Acceso total (todas las tools)",save_btn:"Guardar rol",delete_btn:"Borrar"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Conversación rápida con tu super-agente. Tiene acceso a tools (proyectos, tasks, mcps, agentes); para un hilo más largo y persistente, abrí Chats.",empty:"Mandale un mensaje a {persona} para arrancar.",thinking:"{persona} está pensando…",talk:"Hablar con {persona}",new_chat:"Nuevo chat",placeholder:"Escribí y enter para enviar (shift+enter = nueva línea)…"},not_found:{title:"404",message:"Roby se perdió: esta página no existe o se movió.",home:"Volver al inicio"},ask_panel:{answers_header:"Respuestas",other:"Otro",other_placeholder:"Escribí tu propia respuesta acá",text_placeholder:"Escribí tu respuesta…",back:"Atrás",skip:"Omitir",next:"Siguiente",submit:"Enviar",status_waiting:"Esperando respuesta…",status_received:"Respuestas recibidas"},code_module:{title:"Code",badge:"super-agent",desc:"Sesiones de código estilo OpenCode. Elegí un proyecto, abrí una sesión y pedile que lea, planifique, edite o ejecute.",no_projects:"No hay proyectos registrados. Registrá uno con `apx project add` para usar Code.",sessions:"Sesiones",new_session:"Nueva sesión",untitled:"Nueva sesión",no_sessions:"Todavía no hay sesiones — creá una para empezar a codear.",pick_project:"Elegí un proyecto para ver sus sesiones.",rename:"Renombrar",delete:"Eliminar",delete_confirm:"¿Eliminar esta sesión? Se borra la transcripción; tus archivos quedan intactos.",empty_chat:"Mandá una instrucción de código para arrancar.",placeholder:"Pedí un cambio… (enter envía, shift+enter = nueva línea)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edita archivos y ejecuta comandos",mode_plan_hint:"Plan — solo lectura, propone cambios sin tocar archivos",tab_context:"Contexto",tab_changes:"Cambios",tab_artifacts:"Artifacts",artifacts_none:"Todavía no hay artifacts. Pedile al agente que cree un script en `artifacts/<nombre>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copiar path",artifacts_run:"Run",artifacts_run_hint:"Para ejecutarlo desde la terminal:",artifacts_delete:"Eliminar",artifacts_delete_confirm:"¿Eliminar este artifact? El archivo se borra del disco.",ctx_model:"Modelo",ctx_tokens:"Tokens",ctx_input:"Entrada",ctx_output:"Salida",ctx_messages:"Mensajes",ctx_breakdown:"Desglose de contexto",ctx_none:"Sin uso todavía — mandá un turno para ver tokens.",seg_system:"Sistema",seg_user:"Usuario",seg_assistant:"Asistente",seg_tool:"Tools",seg_other:"Otro",changes_none:"Todavía no hay cambios en esta sesión.",changes_no_git:"Los cambios necesitan un repo git. Este proyecto no lo es.",changes_files:"{n} archivo(s) cambiados",stopped:"[detenido]",close:"Cerrar",reload:"Recargar",discard_changes:"Descartar cambios",save_shortcut_hint:"Guardar (Cmd/Ctrl+S)",artifacts_rename:"Renombrar",artifacts_view:"Ver contenido",artifacts_edit:"Editar contenido",artifacts_preview:"Previsualizar",artifacts_preview_hint:"Abrir una previsualización en vivo en una pestaña local",artifacts_share:"Compartir",artifacts_share_hint:"Crear una URL pública por túnel para compartir esta preview",artifacts_stop_preview:"Detener preview",artifacts_preview_local:"Preview local",artifacts_preview_public:"URL pública",artifacts_copy_url:"Copiar URL",artifacts_preview_started:"Preview activa en {url}",tree_collapse_all:"Colapsar todo",terminal_clear:"Limpiar",terminal_close:"Cerrar terminal"},desktop_screen:{status_title:"Estado",autostart_title:"Arranque automático",shortcut_title:"Atajo de teclado",appearance_title:"Apariencia",activation_title:"Activación + transcripción",last_conv_title:"Última conversación",open_config:"Configuración"},voice_screen:{providers_title:"Proveedores de voz (TTS)",test_title:"Probar voz",stt_title:"Transcripción (STT)",configure_provider:"Configurar {name}"},deck_screen:{widgets_title:"Widgets",context_title:"Contexto APX",reload_manifest:"Recargar manifest",widget_native:"Widget nativo APX",widget_external:"Widget externo",preview_badge:"Vista previa",preview_title:"Deck — Próximamente",preview_body:"El módulo Deck todavía está en desarrollo y no fue lanzado aún. Lo volveremos a activar cuando Deck salga en una versión estable. Por ahora todo acá es de solo lectura y no se guardará ningún cambio."},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Modelo que vectoriza el historial de todos los canales para la memoria relevante. Igual que TTS/STT: elegí un proveedor y un modelo. 'Automático' prueba local primero y cae a offline si no hay nada disponible.",provider_label:"Proveedor",provider_hint:"Ollama es local y gratis. Gemini/OpenAI usan la API key de su sección en Modelos (o la de abajo).",mode_label:"Modo de selección",mode_hint:"Cadena cae al siguiente si uno falla; Único usa exactamente el proveedor elegido.",available:"disponible",unavailable:"no disp.",test_btn:"Probar embedding",reindex_btn:"Reindexar memoria",test_ok:"Embedding OK con {embedder}",test_failed:"Test falló: {msg}",reindexed:"Reindexado: {indexed} chunks (limpiados {cleared}).",reindex_failed:"Reindex falló: {msg}",save_failed:"No se pudo guardar: {msg}",provider_auto:"Automático (cadena: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, sin API key (nomic-embed-text)",provider_gemini:"Gemini — free tier con key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, sin modelo — degradado)",mode_chain:"Cadena (fallback automático)",mode_single:"Único (usa solo el elegido)",ollama_title:"Ollama (local)",ollama_desc:"Sin API key. Corre nomic-embed-text en tu Ollama local o cloud.",model_label:"Modelo",base_url_label:"Base URL",ollama_base_url_hint:"Vacío usa engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) u otro modelo compatible.",api_key_label:"API key",openai_key_hint:"Vacío reusa engines.openai.api_key. Dejalo en blanco para mantener la guardada.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier con API key de Google.",gemini_key_hint:"Vacío reusa engines.gemini.api_key.",compaction_title:"Compactación de historial",compaction_desc:"Cuando un chat supera el umbral de turnos, los más viejos se resumen con un LLM liviano (local) y se guardan como [RESUMEN COMPACTADO], manteniendo el contexto acotado. Corre fuera del hot-path: el turno actual usa el resumen que ya exista.",threshold_label:"Umbral de compactación",threshold_hint:"Compactar una vez que el chat supera estos turnos (por defecto 60).",keep_recent_label:"Turnos recientes a preservar",keep_recent_hint:"Turnos verbatim que NUNCA se compactan (por defecto 40). Debe ser menor al umbral.",compact_model_label:"Modelo de compactación",compact_model_hint:"LLM liviano para resumir. Ideal uno local (Ollama) para no gastar. Formato proveedor:modelo.",compact_fallback_label:"Modelo de fallback",compact_fallback_hint:"Se usa si el de compactación falla. Vacío cae al modelo del super-agente.",compact_fallback_ph:"(vacío → modelo del super-agente)"},router_panel:{title:"Router de modelos",description:"Un único router general (sin casos por tarea). Elegí un proveedor y un modelo; si el activo falla, prueba la cadena de fallback en orden.",badge_default:"default",no_providers:"Agregá un proveedor abajo para poder elegir modelos.",active_model_label:"Modelo activo (default)",active_model_hint:"Proveedor + modelo. Se guarda como proveedor:modelo.",fallback_title:"Cadena de fallback",fallback_desc:"Si el modelo activo falla, prueba estos en orden. Click en uno para editarlo.",fallback_empty:"Sin fallback configurado.",add_to_chain:"Agregar a la cadena",done:"listo",save:"Guardar router",saved:"Guardado",saved_toast:"Router guardado.",provider_ph:"— proveedor —",provider_not_found:"⚠ {name} (no encontrado)",provider_not_configured:'El proveedor "{name}" no está configurado.'},routing_panel:{title:"Ruteo por contenido",description:"Elegí un modelo distinto por mensaje según su contenido (imagen, tamaño, canal, keywords). Aparte de la cadena de fallback de arriba.",signal_on:"Ruteo por contenido: ON ({n} reglas)",signal_on_empty:"Ruteo por contenido: ON (todavía sin reglas)",signal_off:"Ruteo por contenido: OFF",how_it_works:"¿Cómo funciona?",enable_label:"Activar ruteo por contenido",rules_title:"Reglas de ruteo",rules_desc:"Se evalúan de arriba hacia abajo; gana la primera regla que cumpla todas sus condiciones.",rules_empty:"Todavía sin reglas. Agregá algunas en el editor.",edit_rules:"Editar reglas (JSON)",hide_editor:"Ocultar editor",editor_label:"Reglas (array JSON)",json_hint:"Array de { model, when }. Claves de when: has_image, min_prompt_chars, max_prompt_chars, min_context_chars, channels[], keywords[]. when vacío = matchea todos los mensajes.",json_error:"JSON inválido: {msg}",json_not_array:"Las reglas tienen que ser un array JSON.",insert_example:"Insertar un ejemplo",when_any:"cualquier mensaje",when_image:"tiene imagen",when_no_image:"sin imagen",when_min_prompt:"prompt ≥ {n} chars",when_max_prompt:"prompt ≤ {n} chars",when_min_context:"contexto ≥ {n} chars",when_channels:"canales: {list}",when_keywords:"keywords: {list}",helper:"El ruteo elige un modelo por mensaje (imagen, tamaño, canal, keywords). Se compone con el failover: un modelo ruteado que esté caído cae por la cadena. Un override de modelo explícito por request siempre gana.",save:"Guardar ruteo",saved:"Guardado",saved_toast:"Ruteo por contenido guardado.",confirm_title:"¿Aplicar los cambios de ruteo?",confirm_body:"Esto cambia qué modelo atiende cada mensaje. El failover sigue aplicando si un modelo ruteado está caído.",confirm_on:"El ruteo por contenido va a quedar ON con {n} reglas.",confirm_off:"El ruteo por contenido va a quedar OFF (cada mensaje usa el router default).",confirm_apply:"Aplicar",cancel:"Cancelar"},engines_panel:{title:"Proveedores",new_btn:"Nuevo proveedor",description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",empty:"Sin providers. Agregá uno con el botón de arriba.",add_card:"Agregar provider",saved:"Provider guardado.",saved_json:"Provider guardado (JSON).",deleted:"Provider borrado.",delete_confirm:"¿Borrar provider {name}?"},providers_modal:{new_title:"Nuevo proveedor",edit_title:"Editar {name}",description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",list_models_hint:"Listar los modelos reales del proveedor",toggle_active:"Activo · click para desactivar",toggle_inactive:"Inactivo · click para activar",delete:"Borrar",custom:"Custom",json_mode:"JSON",form_mode:"Volver al formulario",json_label:"Config del provider (JSON)",json_hint:"Se guarda como engines.{slug} en config.json",json_help:"Debe ser un objeto JSON válido con al menos engine. El slug se toma del formulario.",name_label:"Nombre",name_ph:"Mi provider",engine_label:"Motor (engine)",base_url_label:"URL base (base_url)",base_url_hint:"Se completa sola al elegir un proveedor.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Dejá en blanco para mantener la actual.",api_key_hint_env:"Se guarda como secreto. Env sugerida: {env}",api_key_hint:"Se guarda como secreto.",api_key_set:"…{suffix} (ya seteada)",model_label:"Modelo por defecto",load_models:"Cargar modelos",max_tokens_label:"Máx. tokens (max_tokens)",temperature_label:"Temperatura: {value}",pricing_summary:"Análisis de tokens / pricing (opcional)",context_limit_label:"Límite de contexto (tokens)",price_input:"$ entrada / 1M",price_output:"$ salida / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Límites de contexto por modelo (JSON)",active_label:"Activo (los agentes pueden usarlo)",err_slug_required:"Slug requerido.",err_slug_required_form:"Slug requerido (en el formulario).",err_slug_exists:'Ya existe un provider "{slug}".',err_model_limits_json:"Límites de contexto por modelo: JSON inválido.",err_json_invalid:"JSON inválido: revisá la sintaxis.",err_json_object:"El JSON debe ser un objeto con la config del provider.",err_engine_missing:'Falta "engine" (ej. "anthropic", "ollama").',err_save:"Error al guardar.",err_no_models:"Sin modelos. ¿Key/URL correctas?",err_list_models:"No se pudo listar modelos."},providers_card:{active:"Activo",off:"Off",model:"Modelo",base_url:"Base URL",api_key:"API key",key_set:"✓ seteada",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copiar",stop:"Detener",send:"Enviar",pick_model:"Elegir modelo (o Auto)",insert_variable:"Insertar variable"},sidebar_ui:{toggle:"Mostrar/ocultar sidebar"},models_ui:{invalid_hint:"Modelo/proveedor no disponible"},global_config:{title:"Config APX"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (ya seteada)",api_key_keep_hint:"Dejá en blanco para mantener la actual.",api_key_secret_hint:"Se guarda como secreto. Env: {env}",api_key_reuse_hint:"Si lo dejás vacío, reusa {engine}. Env: {env}",err_save:"Error al guardar.",model_label:"Modelo",voice_label:"Voz",format_label:"Formato",output_format_label:"Formato de salida",voice_id_label:"Voice ID",voice_id_hint:"Voice id de ElevenLabs (vacío = default).",gemini_model_hint:"El TTS de Gemini todavía está en preview.",base_url_label:"Base URL (opcional)",base_url_hint:"Endpoint compatible con OpenAI. Vacío = OpenAI. Apuntalo a un servidor local (ej. un daemon QVox / Qwen3-TTS) para usar ese en su lugar.",openai_model_hint:"tts-1 / tts-1-hd para OpenAI. Dejalo vacío para que un servidor custom elija.",openai_voice_hint:"Preset de OpenAI (alloy…) o preset de tu servidor custom (ej. custom). Vacío = default del servidor.",openai_style_hint:"Voz base / instruct, usada por endpoints custom (la persona que se mantiene en todo el audio). El tts-1 de OpenAI la ignora.",style_label:"Estilo (cómo debería hablar)",style_hint:"Instrucción en lenguaje natural. Vacío = sin estilo. Ej.: 'hablá en un tono alegre y pausado'.",style_ph:"hablá en un tono alegre y enérgico",temperature_label:"Temperatura (opcional)",temperature_hint:"Temperatura de sampleo para endpoints custom. Vacío = default del servidor.",emotions_short:"Emociones",emotions_label:"Tags de emoción inline",emotions_hint:"Cuando hable este motor, deja que el agente meta tags tipo [happy]/[whisper] en las respuestas de voz para darles color. Activalo solo si este motor entiende los tags (ej. un endpoint QVox/Qwen3-TTS) — si no, se quitan antes de sintetizar.",emotions_tags_label:"Tags permitidos",emotions_tags_hint:"Separados por coma. Vacío = el set por defecto.",piper_bin_label:"Binario (bin)",piper_bin_hint:"Ruta o nombre del CLI de piper (PATH).",piper_model_label:"Modelo (.onnx)",piper_model_hint:"Ruta absoluta al modelo de voz de piper.",piper_speaker_label:"Speaker (opcional)",piper_speaker_hint:"Speaker id para modelos multi-voz.",mock_desc:"El engine mock genera un WAV de prueba en silencio. No tiene parámetros: sirve como fallback garantizado cuando no hay ningún otro engine configurado.",selection_mode:"Modo de selección",mode_chain_desc:"Cadena con fallback: usa el primer engine disponible siguiendo el orden de abajo.",mode_single_desc:"Solo engine default: siempre usa el elegido; el resto queda configurado para otros usos.",mode_chain_btn:"Cadena (router)",mode_single_btn:"Solo engine default",move_up:"Subir",move_down:"Bajar",badge_local:"local",badge_available:"disponible",badge_unavailable:"configurado, no disponible",badge_not_configured:"sin configurar",badge_default:"default",badge_custom:"custom",set_as_default:"Usar como default",configure:"Configurar",remove:"Quitar",remove_confirm:"¿Quitar este proveedor custom?",add_provider:"Agregar proveedor",new_provider:"Nuevo proveedor",custom_note:"Endpoint custom compatible con OpenAI.",custom_desc:"Cualquier endpoint de voz compatible con OpenAI (ej. un servidor local QVox / Qwen3-TTS).",label_label:"Nombre",label_hint:"Nombre para mostrar de este proveedor.",base_url_req_label:"Base URL",base_url_req_hint:"Requerido. El endpoint compatible con OpenAI, ej. http://127.0.0.1:5111/v1",api_key_optional_hint:"Opcional — solo si tu servidor pide key.",advanced:"Avanzado",custom_model_hint:"Opcional. La mayoría de los servidores locales lo ignoran (ej. QVox).",custom_voice_hint:"Opcional. Un preset que entienda tu servidor (ej. custom). Vacío = default del servidor.",custom_optional_ph:"(opcional)",stt_engine_label:"Engine de transcripción",stt_engine_hint:"Local usa faster-whisper (requiere python3 + faster-whisper). OpenAI usa la key de engines.openai.",stt_model_label:"Modelo local (whisper)",stt_model_hint:"Más grande = más preciso y más lento.",stt_language_label:"Idioma",stt_language_hint:'Para español, elegir "Español" mejora la precisión.',stt_provider_auto:"Automático (local, después remoto)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",stt_provider_custom:"Custom — server OpenAI-compatible",stt_openai_model_label:"Modelo OpenAI",stt_openai_model_hint:"Por defecto whisper-1.",stt_custom_baseurl_label:"URL base (OpenAI-compatible)",stt_custom_baseurl_hint:"Ej: http://localhost:8000/v1 (mlx-audio en Metal) o http://192.168.1.50:9000/v1 (Radeon/NVIDIA en la red).",stt_custom_model_label:"Modelo",stt_custom_model_hint:"Ej: mlx-community/whisper-large-v3-turbo o large-v3.",stt_custom_key_hint:"Opcional — la mayoría de los servers locales no requieren key.",stt_hw_label:"Hardware detectado",stt_hw_recommended:"Recomendado",stt_hw_limited:"aceleración GPU limitada, se usa CPU",stt_backend_label:"Aceleración / Motor",stt_backend_hint:"Auto elige según tu hardware. Metal corre en la GPU (mlx); CPU usa faster-whisper.",stt_backend_auto:"Automático (recomendado)",stt_model_needs_download:"Falta descargar (~{size}). Hay que bajar el modelo para usar este motor.",lang_auto:"Detección automática",lang_es:"Español",lang_en:"Inglés",lang_pt:"Portugués",lang_fr:"Francés",lang_it:"Italiano",lang_de:"Alemán",test_default_text:"Hola, soy APX. Esto es una prueba de voz.",test_default_engine:"Default ({name})",test_default_chain:"Default (cadena)",test_unavailable_suffix:" · no disponible",test_empty_error:"Escribí algo para decir.",test_synth_error:"No se pudo sintetizar.",test_engine_label:"Engine",test_engine_hint:"Override del default para probar.",test_style_label:"Estilo (solo Gemini)",test_style_hint:"Cómo debería hablar. Vacío = sin estilo.",test_text_label:"Texto a decir",test_text_ph:"Escribí lo que querés que diga…",say_this:"Decir esto",stop:"Detener",replay:"Repetir",engine_result:"Engine",providers_desc:"Engines de síntesis, en orden de fallback. El estado lo reporta el daemon en vivo. Agregá tus propios endpoints compatibles con OpenAI.",providers_load_error:"No pude cargar los proveedores: {msg}",test_desc:"Elegí con qué engine sintetizar y, si aplica, cómo debería hablar.",stt_desc:"Engine de speech-to-text que usan el deck, Telegram y la CLI al escuchar.",toast_default_engine:"Engine default: {id}.",toast_mode_chain:"Modo: cadena con fallback.",toast_mode_single:"Modo: solo engine default.",toast_config_saved:"Configuración de voz guardada.",toast_provider_removed:"Proveedor eliminado.",err_label_required:"Falta el nombre.",err_base_url_required:"Falta la base URL.",toast_transcription_updated:"Transcripción actualizada."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (parcial).",bot_token_hint:"Token de BotFather. Se guarda en ~/.apx/config.json.",bot_token_hint_short:"Token de BotFather.",secret_set_replace:"(seteado — escribí para reemplazar)",secret_already_set:"(ya seteado)",empty_keep:"— vacío = mantener",message_sent:"Mensaje enviado.",message_label:"Texto",send_chat_id:"chat_id: {id}",default_apx:"APX por defecto",yes:"sí",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_form:{emoji:"Emoji",area:"Área",role:"Rol",no_role:"— sin rol —",autonomy:"Autonomía",autonomy_hint:"Cuánto puede hacer el agente sin pedir confirmación.",auto_total:"Total",auto_automatico:"Auto",auto_permiso:"Permiso"},structure:{title:"Estructura",subtitle:"Áreas y roles de la empresa. Las áreas agrupan agentes; los roles definen su función.",info:"Las áreas son agrupaciones opcionales. Los roles definen la función de un agente y pueden pertenecer a un área.",empty:"Todavía no hay áreas ni roles. Creá el primero arriba.",new_area:"Nueva área",new_role:"Nuevo rol",edit_area:"Editar área",edit_role:"Editar rol",create_area:"Crear área",create_role:"Crear rol",name:"Nombre",slug:"Slug",goal:"Objetivo",goal_hint:"Para qué existe esta área (opcional).",area:"Área",description:"Descripción",no_area:"— sin área —",roles:"Roles",add_role:"rol",no_roles:"sin roles",general_roles:"Roles generales",delete_area:"Borrar área",delete_role:"Borrar rol",delete_area_desc:'¿Borrar el área "{name}"? Sus roles quedan sin área, no se eliminan.',delete_role_desc:'¿Borrar el rol "{name}"?'},files:{docs_label:"Docs",files_label:"Archivos",new_doc:"Nuevo documento",new_doc_hint:"Podés usar carpetas: cases/onboarding/spec.md",empty:"No hay archivos.",docs_empty:"Todavía no hay documentación. Creá el primer documento.",truncated:"Listado recortado (demasiados archivos).",select_prompt:"Elegí un archivo para verlo.",save:"Guardar",saved:"Guardado.",deleted:"Eliminado.",created:"Documento creado.",edit:"Editar",preview:"Preview",discard:"Descartar",no_preview:"No hay preview para este archivo.",too_large:"Archivo demasiado grande para mostrar.",path_label:"Ruta del archivo",path_example:"ej. cases/onboarding/spec.md",create:"Crear"},tasks:{state_open:"abiertas",state_done:"hechas",state_dropped:"descartadas",status_pending:"pendiente",status_running:"corriendo",status_in_review:"en revisión",status_blocked:"bloqueada",done_label:"hecha",dropped_label:"descartada",detail_title:"Detalle de task",field_title:"Título",field_prompt:"Prompt",field_status:"Estado",field_agent:"Agente",field_creator:"Creada por",field_source:"Origen",field_created:"Creada",field_updated:"Actualizada",field_done:"Completada",prompt_ph:"Descripción / prompt de la task…",toggle_prompt:"Prompt",view_thread:"Ver conversación",mark_done:"Completar"},agents_ui:{model_router_default:"modelo: default del router",slug_kebab_hint:"kebab-case, ej. reviewer, my-agent, content-writer",comma_separated:"separadas por coma",body_hint:"markdown — extiende el system prompt del agente",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorador",type_none:"— sin tipo —",type_orchestrator:"Orquestador",type_orchestrator_desc:"Coordina el equipo y delega.",type_specialist:"Especialista",type_specialist_desc:"Experto en el dominio; corre tareas.",type_assistant:"Asistente",type_assistant_desc:"Ayudante conversacional.",type_worker:"Worker",type_worker_desc:"Corre tareas autónomas.",type_monitor:"Monitor",type_monitor_desc:"Vigila el estado y reporta.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definición (frontmatter + system prompt).",memory_durable_desc:"hechos durables que el agente recuerda.",running:"running",paused:"pausada",last_error:"última: error",field_tick:"Tick",field_next_tick:"Próximo tick",field_last_tick:"Último tick",field_last_run:"Última corrida",tools_label:"Tools",kind_agent:"agente",kind_memory:"memoria",kind_thread:"thread",kind_task:"task",kind_routine:"rutina",kind_hierarchy:"jerarquía",nodes_drag_hint:"{n} nodos · arrastrá para reordenar",kind_exec_agent:"Agente del proyecto",kind_exec_agent_desc:"Corre un agente del proyecto con un prompt. Vos elegís cuál.",kind_super_agent:"Super-agente",kind_super_agent_desc:"Llama al super-agente APX con un prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Manda un mensaje fijo a un canal de Telegram. Sin modelo ni agente.",kind_shell:"Shell",kind_shell_desc:"Corre un comando shell. Sin prompt ni pre/post — el comando es la acción.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"No hace nada salvo escribir una línea en los logs cada vez que corre. Sirve para confirmar que el scheduler está vivo. Si no sabés si lo necesitás, no lo uses.",unit_seconds:"segundos",unit_minutes:"minutos",unit_hours:"horas",unit_days:"días",every_n_unit:"cada {n} {unit}",every_v:"cada {v}",preset_every_10m:"cada 10 min",preset_hourly:"cada hora",preset_daily_9am:"diario 9am",preset_weekdays_9am:"días hábiles 9am",preset_manual:"Manual",var_pre_output_prompt:"Salida de texto de los pre-commands. Se reemplaza dentro del prompt/texto antes de enviarlo. Útil para inyectar datos frescos (clima, una API) en la instrucción.",var_llm_output:"Respuesta final del agente o super-agente. Disponible en los post-commands como variable de entorno. Ej: reenviarla por Telegram.",var_status:"Resultado de la acción: ok o error. Disponible en los post-commands para decidir qué hacer después.",var_skipped:"Vale 1 si la acción se salteó (por skip_prompt_on), 0 si corrió. Disponible en los post-commands.",var_pre_output:"Salida completa de los pre-commands, como variable de entorno en los post-commands (hasta 32k).",var_pre_output_file:"Ruta a un archivo temporal con la salida de los pre-commands. Para salidas grandes que no convienen como variable.",var_pre_exit:"Código de salida del último pre-command (0 = ok). Disponible en los post-commands.",var_routine:"Nombre de esta rutina. Disponible como variable de entorno en los comandos.",summary_runs_agent:'Corre el agente "{agent}"',summary_runs_agent_none:"Corre un agente (todavía no elegiste cuál)",summary_super_agent:"Llama al super-agente",summary_telegram:'Manda Telegram a "{channel}"',summary_runs_cmd:"Corre: {cmd}",summary_shell:"Corre un comando shell",summary_heartbeat:"Deja un heartbeat en los logs",action_agent_answers:'El agente "{agent}" responde el prompt',action_agent_pick_answers:"El agente (elegí uno) responde el prompt",action_super_answers:"El super-agente responde el prompt",action_telegram_channel:'Manda Telegram al canal "{channel}"',action_runs_shell:"Corre el comando shell",step_pre:"Pre",step_post:"Post",last_label:"última:",tg_chat_id_ph:"(usa el del canal)",tg_text_ph:"mensaje a enviar",hb_message_ph:"sigo vivo",arg_placeholder:"--flag o valor",remove_arg:"quitar arg",super_agent_label:"{persona} (super-agente)",super_agent_badge:"super-agente"},modules_ui:{desktop_pos_left:"Izquierda",desktop_pos_center:"Centro",desktop_pos_right:"Derecha",desktop_theme_system:"Sistema",desktop_theme_light:"Claro",desktop_theme_dark:"Oscuro",desktop_status_desc:"La ventana se abre desde la terminal o por arranque automático.",desktop_running:"Corriendo",desktop_stopped:"Detenida",desktop_refresh:"refrescar",desktop_start:"Iniciar",desktop_stop:"Detener",desktop_restart:"Reiniciar",desktop_restart_hint:"Recarga la ventana abierta para aplicar ya los cambios de config (tema, posición).",desktop_restart_done:"Reiniciando la ventana — aplicando la última config.",desktop_restart_none:"No hay ninguna ventana de desktop conectada.",desktop_start_done:"Ventana de desktop iniciada.",desktop_start_already:"La ventana de desktop ya estaba corriendo.",desktop_stop_done:"Ventana de desktop detenida.",desktop_stop_none:"No había ninguna ventana de desktop corriendo.",desktop_from_terminal:"Desde la terminal:",desktop_autostart_desc:"Abre la ventana al iniciar sesión. Equivale a `apx desktop install` (no requiere sudo).",desktop_platform:"plataforma: {platform}",desktop_shortcut_desc:"Atajo global que muestra/oculta la ventana y empieza a escuchar.",desktop_accelerator:"Acelerador",desktop_accelerator_hint:"Hacé clic en el campo y apretá tu combinación de teclas. Reiniciá la ventana para aplicar.",desktop_shortcut_record:"Hacé clic para definir un atajo",desktop_shortcut_recording:"Apretá tu combinación…",desktop_shortcut_change:"clic para cambiar",desktop_shortcut_esc:"Esc para cancelar",desktop_shortcut_saved:"Atajo guardado. Reiniciá la ventana (apx desktop stop && start) para aplicarlo.",desktop_autostart_on:"Arranque automático habilitado para el próximo inicio de sesión.",desktop_autostart_off:"Arranque automático deshabilitado.",desktop_appearance_desc:"Tema de la ventana y posición en la pantalla.",desktop_theme:"Tema",desktop_restart_apply:"Reiniciá la ventana para aplicar.",desktop_theme_set:"Tema: {value}.",desktop_position:"Posición",desktop_position_hint:'"izquierda" / "centro" / "derecha" del borde superior.',desktop_position_set:"Posición: {value}.",desktop_activation_desc:"El plugin del daemon procesa los mensajes. El STT se configura en Voces.",desktop_enabled_toast:"Escritorio habilitado.",desktop_disabled_toast:"Escritorio deshabilitado.",desktop_plugin_on:"Plugin habilitado (responde mensajes)",desktop_plugin_off:"Plugin deshabilitado",desktop_stt_engine:"Motor de speech-to-text:",desktop_stt_engine_suffix:"(whisper local, idioma, modelo).",desktop_last_conv_desc:"El último intercambio con el agente desde la ventana flotante.",desktop_no_messages:"Todavía no hay mensajes. Mandá algo a la ventana de escritorio para que aparezca acá.",desktop_you:"Vos",desktop_roby:"Roby",desktop_empty_msg:"(vacío)",deck_widget_enabled:"Widget {id} habilitado.",deck_widget_disabled:"Widget {id} deshabilitado.",deck_save_error:"Error al guardar",deck_loading_manifest:"Cargando manifest…",deck_manifest_error:"Error al cargar el manifest.",deck_widgets_summary:"{count} widgets · {enabled} externos habilitados",deck_loading_manifest_full:"Cargando el manifest del Deck…",deck_manifest_load_failed:"No se pudo cargar el manifest del Deck.",deck_retry:"Reintentar",deck_no_widgets:"No hay widgets en el manifest.",deck_context_desc:"Información que el Deck ve desde el daemon.",deck_active_project:"Proyecto activo:",deck_none:"ninguno",deck_registered_projects:"Proyectos registrados:",deck_active_plugins:"Plugins activos:",deck_daemon_active:"activo · {uptime}",deck_daemon_started:"iniciado",deck_safety_no_shell:"sin shell directo",deck_safety_no_arbitrary:"comandos arbitrarios bloqueados",deck_safety_confirm:"las acciones peligrosas requieren confirmación",code_copied:"Copiado.",code_saved:"Guardado.",code_file_empty:"(vacío)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Agente principal con todas las tools",code_chat_tab:"Chat",code_panel_sessions:"Lista de sesiones",code_panel_tree:"Árbol de archivos",code_panel_terminal:"Terminal",code_panel_context:"Panel de contexto",code_ctx_auto:"auto",code_ctx_mode:"Modo",code_ctx_agent:"Agente",code_ctx_msgs_value:"{user} usuario · {assistant} asistente",code_ctx_tokens_total:"Tokens Total",code_ctx_created:"Creado",code_ctx_activity:"Actividad",code_project_fallback:"proyecto {id}",code_pick_project_ph:"Elegí un proyecto…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"Ver",code_artifact_edit_short:"Editar",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncado"},settings_ui:{bearer_label:"Bearer",global_config_desc:"Config general en ~/.apx/config.json. Editable por tabs; el JSON queda separado.",global_json_desc:"Los secretos redacted no se sobrescriben.",save_json:"Guardar JSON",expand_menu:"Expandir menú",collapse_menu:"Colapsar menú",documentation:"Documentación",kind_personal:"Personal",kind_company:"Empresa",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Otro",base_menu_view:"Vista del menú Base (workspace general).",coming_soon:"Próximamente",inspector_title:"Skill Inspector (RAG por turno)",inspector_desc:"Función experimental. Cuando está activa, el agente NO recibe la lista completa de skills en su prompt; en cada mensaje un RAG local decide qué skill(s) cargar — el cuerpo completo si hay match fuerte, una sugerencia si es medio, nada si no aplica. Se reevalúa en cada turno: una skill que dejó de ser relevante desaparece del contexto.",enable_inspector:"Habilitar inspector",enable_inspector_hint:"Off = comportamiento clásico (lista de slugs + sugerencia pasiva). On = el RAG decide por turno.",on:"On",off:"Off",index_count:"Índice: {n} skills",not_indexed:"sin indexar",dim:"dim {dim}",updated_at:"actualizado {date}",reindex:"Reindexar",reindex_forced:"Reindexar (forzado)",embedder_source:"El embedder viene de Memoria (RAG). Local con Ollama, u offline si no hay proveedor configurado.",thresholds_title:"Umbrales y límites",thresholds_desc:"Ajustá qué tan agresivo es el inspector. Subir los umbrales = menos falsos positivos pero más riesgo de perderte una skill; bajarlos = al revés.",test_title:"Probar (dry-run)",test_desc:"Escribí un mensaje como lo haría un usuario y mirá qué skills cargaría/sugeriría el inspector — sin llamar al modelo. Fuerza el inspector aunque esté apagado arriba.",test_placeholder:"ej.: necesito crear un video promocional con voz en off",test_btn:"Probar",jit_empty_index:"JIT (índice vacío)",loaded_label:"Cargadas:",suggested_label:"Sugeridas:",could_not_save:"No se pudo guardar: {msg}",indexed_with:"Indexado con {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Falló el indexado: {msg}",dry_run_failed:"Falló el dry-run: {msg}",knob_load_threshold:"Umbral de carga",knob_load_threshold_hint:"Similaridad mínima para inyectar el CUERPO de la skill (alto = más estricto).",knob_hint_threshold:"Umbral de sugerencia",knob_hint_threshold_hint:"Similaridad mínima para solo SUGERIR la skill (así el agente la carga si quiere).",knob_margin:"Margen sobre la 2da",knob_margin_hint:"La primera tiene que superar a la segunda por este margen para cargar su cuerpo (evita empates flojos).",knob_max_loaded:"Máx. cuerpos cargados",knob_max_loaded_hint:"Cuántas skills se inyectan completas por turno.",knob_max_hints:"Máx. sugerencias",knob_max_hints_hint:"Cuántas skills extra se nombran como sugerencia.",knob_prompt_floor:"Largo mínimo del prompt",knob_prompt_floor_hint:"Los mensajes más cortos que esto se ignoran (evita 'ok', 'hola').",knob_body_char_cap:"Tope de chars del cuerpo",knob_body_char_cap_hint:"Recorta los cuerpos largos para que no inflen el contexto.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Solo valores específicos del proyecto; vacío hereda del global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Modelo del super-agente",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Prompt extra",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Responder con engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Proyecto",cfg_project_desc:".apc/project.json. Metadata APC portable; sin secretos, sin runtime.",cfg_name:"Nombre",cfg_version:"Versión",cfg_apc_spec:"APC spec",cfg_apx_install:"Estado de instalación APX",cfg_apx_storage_id:"ID de storage APX"},skills_page:{title:"Skills",desc:"Activá o desactivá qué skills carga cada agente. Elegí el scope: el super-agent (global) o un proyecto puntual.",list_title:"Skills instaladas",list_desc:"Las privadas de APX están siempre activas y no se pueden tocar.",scope_label:"Scope",scope_super_agent:"Super-agent (global)",scope_hint:"El super-agent usa el scope global. Cada proyecto puede sobrescribir skills de forma independiente.",count_label:"{n} skills · {on} activas",empty:"No hay skills. Creá una abajo o instalá con la CLI.",source_builtin:"APX",source_global:"Global",source_project:"Proyecto",private_badge:"Privada",private_hint:"Skill interna de APX — siempre activa, no se puede desactivar ni borrar.",overridden_badge:"Override",inherited_hint:"Heredada del global",reset_to_global:"Volver al global",on:"activa",off:"inactiva",toggle_failed:"No se pudo cambiar el estado: {msg}",add_title:"Agregar skill",add_desc:"Crea una skill de usuario en ~/.apx/skills/<slug>/SKILL.md. Queda disponible para todos los scopes.",add_slug_label:"Slug",add_slug_ph:"mi-skill",add_desc_label:"Descripción",add_desc_ph:"Una línea que explique cuándo usarla",add_body_label:"Cuerpo (Markdown)",add_body_ph:`# Mi skill
|
|
744
|
+
|
|
745
|
+
Instrucciones para el agente…`,add_btn:"Crear skill",created_ok:'Skill "{slug}" creada.',create_failed:"No se pudo crear: {msg}",delete_btn:"Borrar",delete_confirm:'¿Borrar la skill "{slug}"? No se puede deshacer.',deleted_ok:'Skill "{slug}" borrada.',delete_failed:"No se pudo borrar: {msg}",inspector_section_title:"Skill Inspector (RAG por turno)",inspector_section_desc:"Config avanzada: RAG local que inyecta solo las skills que el mensaje necesita.",scope_ph:"— elegir scope —",select_a_skill:"Elegí una skill de la lista para ver su contenido.",added_by:"Agregado por",activator:"Activador",by_apx:"APX (built-in)",by_you:"Vos",activator_value:"Coincidencia semántica (RAG)",tab_preview:"Vista",tab_source:"Fuente",add_menu:"Agregar",add_online:"Crear con el editor",add_online_hint:"Escribí slug + descripción + contenido",add_zip:"Subir .zip",add_zip_hint:"Importar una skill empaquetada",add_repo:"Desde repo git",add_repo_hint:"Clonar desde una URL",create_dialog_title:"Crear skill",repo_dialog_title:"Importar desde repo git",repo_url_label:"URL del repo",repo_url_ph:"https://github.com/usuario/mi-skill.git",repo_url_hint:"El repo (o su subcarpeta) debe tener un SKILL.md.",import_btn:"Importar",imported_ok:'Skill "{slug}" importada.',import_failed:"No se pudo importar: {msg}",cancel:"Cancelar",manager_tab:"Skills",rag_tab:"Config (RAG)"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) eligió estas skills para este turno",tools_count:"{n} tools",tool_read_file:"Leer archivo",tool_write_file:"Escribir archivo",tool_edit_file:"Editar archivo",tool_list_files:"Listar archivos",tool_search_files:"Buscar en archivos",tool_search_messages:"Buscar mensajes",tool_tail_messages:"Últimos mensajes",tool_run_shell:"Correr shell",tool_send_telegram:"Enviar Telegram",tool_call_agent:"Llamar agente",tool_call_mcp:"Llamar MCP",tool_call_runtime:"Llamar runtime",tool_create_task:"Crear task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (decide el router)",model_filter_ph:"filtrar o escribir modelo…",loading_models:"cargando modelos…",use_value:"usar “{value}”",model_combobox_ph:"elegí o escribí un modelo…",search_variable_ph:"buscar variable…",no_matches:"sin coincidencias",create_variable:"Crear nueva variable…",kv_key_ph:"CLAVE",kv_value_ph:"valor",remove_row:"quitar fila",add_row:"Agregar fila",err_chat_failed:"Falló el chat.",err_stream_failed:"Falló el stream.",err_load_conversation:"No se pudo cargar la conversación.",err_stream:"Error de stream."},integrations:{title:"Integrations",description:"Plugins y tools disponibles para este proyecto",tab_plugins:"Plugins",tab_tools:"Tools",scope_label:"Ámbito:",scope_project:"Este proyecto",scope_global:"Global (default)",plugins_hint:"Plugins de canal y servicio instalables por proyecto. Se guardan en el ámbito seleccionado arriba.",more_soon:"Más plugins próximamente…",tools_hint:"Tools que los plugins conectados exponen a los agentes de este proyecto.",tools_empty:"No hay tools de integraciones. Conectá un plugin para habilitarlas.",tool_active:"activo",tool_inactive:"inactivo",status_active:"Activo",status_error:"Error",status_unconfigured:"No configurado",connected:"Conectado",connect:"Conectar",deactivate:"Desactivar",saving:"Guardando...",validating:"Validando...",verifying:"Verificando token...",confirm:"Confirmar",select_placeholder:"Seleccionar...",reveal:"Ver",hide:"Ocultar",credentials:"Credenciales {name}",coming_soon:"Próximamente",coming_soon_body:"Este plugin está declarado en el catálogo pero todavía no está conectable en APX. Se va a portar de forma nativa en una próxima iteración.",tools_for_agents:"Tools para agentes",tools_available_note:"Disponibles para los agentes que las tengan permitidas, o vía discover_tools.",err_connect:"Error al conectar",err_generic:"Ocurrió un error",asana:{select_label:"Seleccioná el workspace a usar",connected:{user_name:"Conectado como",user_email:"Email",workspace_name:"Workspace"},fields:{personal_access_token:{label:"Personal Access Token",help_label:"¿Cómo obtener el token?",help_steps:`Abrí app.asana.com/0/my-apps en el navegador.
|
|
746
|
+
Bajá hasta la sección "Personal access tokens" (no tus apps OAuth).
|
|
747
|
+
Hacé clic en "+ New access token".
|
|
748
|
+
Dale un nombre y confirmá.
|
|
749
|
+
Copiá el token completo — empieza con "1/..." y tiene un ":" en el medio.
|
|
750
|
+
Pegalo en el campo de abajo.`}}},github:{connected:{user_login:"Conectado como",user_name:"Nombre"},fields:{token:{label:"Personal Access Token",help_label:"¿Cómo obtener el token?",help_steps:`Abrí github.com/settings/tokens.
|
|
751
|
+
Generá un token (classic o fine-grained) con scope "repo".
|
|
752
|
+
Copiá el token — empieza con ghp_ o github_pat_.
|
|
753
|
+
Pegalo en el campo de abajo.`}}}}},kP={common:{loading:"Loading…",saving:"Saving…",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",create:"Create",add:"Add",remove:"Remove",reload:"Reload",shutdown:"Shut down",enabled:"Enabled",disabled:"Disabled",enable:"Enable",disable:"Disable",open:"Open",close:"Close",confirm:"Confirm",optional:"(optional)",none:"—",none_yet:"Nothing here yet.",error_generic:"Something went wrong.",search:"Search",new:"New",restore:"Restore",show:"Show",hide:"Hide",copy:"Copy",run:"Run",refresh:"Refresh",view_all:"View all",saved:"Saved.",deleted:"Deleted.",pager_prev:"Previous",pager_next:"Next",pager_page:"Page {page} of {total}",pager_range:"{from}–{to} of {total}",pager_per_page:"Per page"},daemon:{connecting:"Connecting to the daemon…",unreachable:"Could not reach the daemon at localhost:7430.",unreachable_hint:"Start APX with `apx daemon start` and refresh.",version:"Version",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — reloads ~/.apx/config.json without restarting.",shutdown_confirm:"Shut down the daemon? Upcoming requests will fail until it restarts.",shutdown_done:"Daemon stopped."},pairing:{title:"Pair this device",subtitle:"You are connecting from outside this machine. For security, pair this browser with a pairing code.",steps_title:"How to get the code",step_1:"On the PC where APX is running, open a terminal.",step_2:"Run `apx pair` (or scan the QR with APX Deck).",step_3:"Copy the code shown below the QR and paste it here.",code_label:"Pairing code",code_ph:"e.g. 7f3a1c9e-…",label_label:"Device name",label_ph:"e.g. Living room laptop",submit:"Pair",linking:"Pairing…",success:"Device paired ✓",err_required:"Paste the pairing code.",err_expired:"The code expired. Run `apx pair` again and try again.",err_unknown:"Unknown or already-used code. Generate a new one with `apx pair`.",err_generic:"Could not pair. Check the code and try again.",revoke_hint:"You can revoke this device at any time from Settings or with `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Project",add_project:"Add project",all_projects:"All projects",more_projects:"{count} more",collapse_projects:"Hide projects",expand_projects:"Show projects",modules:{voice:"Voices",desktop:"Desktop",deck:"Deck",code:"Code",web:"Web"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Project",breadcrumb_base:"Base",breadcrumb_projects:"Projects",light:"Switch to light",dark:"Switch to dark",lang_toggle:"Language"},admin:{title:"APX",subtitle:"Admin panel. Global config, channels and projects.",engines_title:"Engines",engines_subtitle:"Available LLM adapters. API keys live in ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Configured channels. Each one can be pinned to a project.",telegram_polling_on:"Polling active",telegram_polling_off:"Disabled",telegram_add_channel:"Channel",telegram_send_test:"Test",telegram_send_test_title:"Send to",telegram_default_message:"Test message from APX panel ✅",projects_title:"Registered projects",projects_subtitle:"Click a project to open its panel.",unregister:"Unregister",unregister_confirm:"Remove {label} from APX? The folder is not deleted; only unregistered.",reload_success:"Config reloaded.",telegram_polling_started:"Polling started.",telegram_polling_stopped:"Polling stopped.",telegram_channel_removed:"Channel deleted.",agents_badge:"agents",engine_badge:"yes",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Add project",subtitle:"APX will index .apc/, agents and AGENTS.md in that folder.",path_label:"Absolute path",path_hint:"Equivalent to apx project add /path/to/project",path_placeholder:"/path/to/my-project",register:"Register",path_required:"Path required.",registered:"Project #{id} registered.",search_btn:"Browse",picker_prompt:"Pick the project folder",browser_unavailable:"Browser unavailable until daemon restarts. Paste path manually.",no_folders:"No folders."},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",structure:"Structure",docs:"Docs",files:"Files"},sections:{workspace:"Workspace",content:"Content",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",routines_active:"Active routines",agents:"Agents",mcps:"MCPs",artifacts:"Artifacts",chat:"Chat (super-agent)",chat_value:"open",roster:"Team",no_agents:"No agents yet.",orchestrators:"Orchestrators",specialists:"Specialists",recent_tasks:"Recent tasks",no_activity:"No open tasks."},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",tools_count:"{n} tools",logs_title:"Logs · {name}",logs_empty:"No logs yet. Start the MCP by calling a tool or running Test.",logs_events:"Recent events",logs_stderr:"stderr (last 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"pick an MCP",logs_panel_hint:"Click an MCP in the list to see what's happening live.",logs_panel_idle:"No activity. Hit Test to spin it up.",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",source_runtime:"Runtime",source_apc:"APC / Shared",source_claude:"Claude",source_codex:"Codex",source_cursor:"Cursor",source_vscode:"VS Code",source_roo:"Roo",source_gemini:"Gemini",scope_runtime_desc:"This project only · with secrets · not committed (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"This project only · committeable · no secrets (.apc/mcps.json)",scope_global_desc:"All projects on this machine (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Local process — `command` + args",transport_http_desc:"Remote endpoint — URL + headers",args_hint_tokens:"One entry per arg. Use the + button to insert a variable.",env_hint_tokens:"Key/value pairs. Values accept ${var.NAME} (+ button on the right).",env_empty:"No env vars.",headers_label:"Headers",headers_hint:"Key/value pairs — typically Authorization: Bearer ${var.TOKEN}.",headers_empty:"No headers."},vars:{title:"Variables",subtitle_project:"Replace ${var.NAME} when loading MCPs and templates. Project vars beat globals. Stored outside the repo (~/.apx/, chmod 0600).",subtitle_base:"Global variables — available to every project. Stored in ~/.apx/vars.json (chmod 0600).",empty:"No variables yet.",new:"Variable",new_title:"New variable",edit_title:"Edit variable",new_desc:"Referenced as ${var.NAME} in any field that supports interpolation.",reveal_all:"Show values",reveal:"Show",hide:"Hide",filter_label:"Show:",filter_all:"All",filter_project:"Project only",filter_global:"Globals only",scope_label:"Scope",scope_project:"project",scope_project_desc:"This project only. Beats the global with the same name.",scope_global:"global",scope_global_desc:"Available to every project.",name_label:"Name",name_hint:"Uppercase, digits and _. E.g. MY_API_KEY, GITHUB_TOKEN.",value_label:"Value",value_hint:"Stored on disk with 0600 perms. Never committed.",value_edit_ph:"(leave empty to keep current… not yet supported, paste the value again)",add_btn:"Add",save_btn:"Save",edit_btn:"Edit",delete_btn:"Delete",delete_confirm:"Delete {name} ({scope})?",removed:"Variable removed.",added:"Variable added.",updated:"Variable updated.",name_required:"Name required.",value_required:"Value required."},threads:{title:"Chats",subtitle:"Conversations per agent (empty = no logs persisted yet).",no_agents:"No agents. Conversations require a configured agent.",pick:"Pick an agent to view its conversations.",empty:"No conversations for {slug}.",conversation_title:"Conversation {id}",messages:"messages",via:"via"},config:{title:"Quick config",subtitle:"Project override. Written to {path}.",model:"super_agent.model",model_hint:"e.g. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug of the agent that handles this project by default.",use_global:"(uses global)",saved:"Saved.",nothing:"Nothing to save.",raw_title:"Config (raw JSON)",raw_subtitle:"Paste the entire object — equivalent to PUT the file.",raw_save:"Replace config",raw_done:"Config overwritten.",effective:"Effective config (read-only)",effective_sub:"What the daemon actually sees (global ⊕ override).",section_title:"Project config",section_desc:"APC metadata and overrides separated. General APX lives in Settings > Config.",effective_read:"Read: global APX + project override.",save_project:".apc/project.json saved.",save_override:".apc/config.json saved.",save_fields_success:"Overrides saved.",save_meta_success:"Project metadata saved.",no_data:"No data.",tab_settings:"Settings",tab_project:"Project"},telegram:{title:"Telegram channel (override)",subtitle:"If you set a channel here, messages from this project go there instead of the default.",use_default:"Use default channel",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override saved.",cleared:"Override removed — falls back to default.",override_active:"override active",channel_badge:"Channel {name}",no_override:"No override. Messages from this project go to the default channel.",respond_engine:"Respond with engine",route_agent:"route_to_agent",route_hint:"Slug of the agent that handles messages (empty = super-agent).",bot_hint_none:"If empty, inherits from default."},memories:{sidebar_title:"Memories",general_group:"General",general_item:"Project memory",project_title:"Project memory",project_desc:"Durable facts at the project level. .apc/memory.md — read by agents and the super-agent.",project_ph:`# Project Memory
|
|
754
|
+
|
|
755
|
+
Stable facts that any agent should know…`,agents_title:"Agent memories",agents_desc:"Individual memory per agent. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"No agents in this project.",saved:"Memory saved.",empty:"(empty memory)",chars:"chars · Markdown",save_btn:"Save"}},base:{title:"Base",subtitle:"General workspace · super-agent",nav_general:"General",nav_activity:"Activity",nav_system:"System",workspaces_title:"Workspaces",workspaces_desc:"All projects registered in APX.",workspaces_new:"New project",workspaces_empty:"No projects. Add one with the button above.",sessions_title:"Sessions",sessions_desc:"Sessions from all engines (apx · claude · codex), newest first.",sessions_desc_scoped:"Sessions in this project's folder ({path}), all engines, newest first.",sessions_all:"All engines",sessions_empty:"No sessions.",sessions_error:"Could not read sessions: {msg}",sessions_search_ph:"Search sessions…",sessions_deep:"Deep",sessions_deep_tip:"Also search inside transcripts (slower)",sessions_clear:"Clear filters",sessions_refresh:"Refresh list",sessions_no_match:"No sessions match “{q}”.",sessions_act_cmd:"Copy apx command",sessions_act_ask:"Ask {name} to continue",sessions_act_folder:"Open folder",sessions_act_path:"Copy path",sessions_cmd_copied:"Command copied — paste it in your terminal",sessions_path_copied:"Path copied",sessions_copy_failed:"Could not copy",sessions_no_folder:"This session has no folder",sessions_no_path:"This session has no path",sessions_folder_failed:"Could not open folder: {msg}",defaults_title:"Agent defaults",defaults_desc:"Global vault templates. Bundled ones come with APX and are always present; ones you create or edit go in ~/.apx/agents and override. Import them into a project from Agents › Import.",defaults_show_removed:"Show removed",defaults_new:"New",defaults_empty:"No templates in the vault.",defaults_hide:"Hide",defaults_restore:"Restore",defaults_edit:"Edit",defaults_remove:"Hide",defaults_delete:"Delete",defaults_tombstone_msg:`Hide the default "{slug}"? It's bundled — tombstoned and recoverable with Restore.`,defaults_delete_msg:'Delete the template "{slug}"?',defaults_hidden:"Hidden.",defaults_deleted:"Deleted.",defaults_restored:"Restored.",defaults_new_title:"New template",defaults_new_desc:"POST /agents/vault — saved to ~/.apx/agents/<slug>.md",defaults_edit_title:'Edit "{slug}"',defaults_bundled_desc:"This is a bundled default. Saving does a copy-on-write to ~/.apx/agents/<slug>.md (becomes an override).",defaults_user_desc:"PATCH /agents/vault/:slug — edits the file in ~/.apx/agents.",defaults_master_label:"Master agent",defaults_slug_invalid:"invalid slug (must match /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" created.',defaults_saved:'Template "{slug}" saved.'},logs:{title:"Logs",desc_global:"Daemon activity (global channels: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Project activity. ~/.apx/projects/<id>/messages/.",filter_channel:"filter channel (e.g. telegram)",filter_dir:"direction",all_directions:"All directions",in:"Incoming (in)",out:"Outgoing (out)",filter_type:"type",all_types:"All types",search_text:"search text…",count_of:"of",no_activity:"No activity.",no_activity_ch:'No activity in channel "{ch}".',error:"Could not read messages: {msg}",show_more:"show more",show_less:"show less",daemon_errors:"Daemon errors (~/.apx/logs/errors.jsonl)",no_errors:"No errors recorded. 🎉"},telegram_contacts:{title:"Telegram contacts",desc:"Who writes to the bots. The role defines which tools they can use; a guest has no permissions until you assign a role.",empty:"No contacts yet — they register automatically when someone writes to a bot.",owner_badge:"owner",assign_role:"Assign role",owner_hint:"Channel owner — change it from the channel",removed:"Contact deleted.",delete_confirm:"Delete contact {name}?",last_seen:"seen:",tools_all:"tools: all",tools_none:"tools: none",tools_label:"tools:"},telegram_channels:{title:"Channels",desc:"Each channel is a bot the daemon polls. Here you can add/remove channels, change the answering agent, the project it belongs to and its owner.",new_btn:"New channel",empty:"No channels yet — add the first one.",removed:"Channel deleted.",delete_confirm:"Delete channel {name}?",no_owner:"no owner (claimed on first DM)",owner_label:"owner:"},telegram_channel_dialog:{new_title:"New Telegram channel",edit_title:"Edit channel: {name}",name_label:"name (internal slug)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug or id of the project to pin this channel to (optional).",route_label:"route_to_agent",route_hint:"Answering agent; empty = APX super-agent.",owner_label:"owner_user_id",owner_hint:"Telegram user_id of the channel owner. Overrides global role to 'owner' here. Leave empty — first private message claims it.",owner_ph:"889721252",respond_label:"Respond with engine (not echo)",name_required:"name required",saved:"Channel saved."},telegram_send_dialog:{title:"Send to {name}",default_msg:"Test message from APX panel ✅"},telegram_roles:{title:"Roles",desc:"Each role defines which super-agent tools the assigned user can invoke. 'owner' always = all; 'guest' always = none (chat only).",empty:"No roles defined.",tools_all:"all tools",tools_none:"no tools",builtin:"built-in",delete_confirm:'Delete role "{name}"?',removed:"Role deleted.",saved:'Role "{name}" saved.',name_required:"Name required.",builtin_error:'"{name}" is a built-in role.',new_title:"New role or replace a custom one",name_label:"Name",name_ph:"editor",tools_label:"Tools (comma-separated)",tools_hint:"Empty = none. Examples: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Full access (all tools)",save_btn:"Save role",delete_btn:"Delete"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Quick chat with your super-agent. Has access to tools (projects, tasks, mcps, agents); for a longer persistent thread, open Chats.",empty:"Send {persona} a message to get started.",thinking:"{persona} is thinking…",talk:"Talk to {persona}",new_chat:"New chat",placeholder:"Type and press enter to send (shift+enter = new line)…"},not_found:{title:"404",message:"Roby got lost: this page doesn't exist or has moved.",home:"Back to home"},ask_panel:{answers_header:"Answers",other:"Other",other_placeholder:"Write your own answer here",text_placeholder:"Type your answer…",back:"Back",skip:"Skip",next:"Next",submit:"Send",status_waiting:"Waiting for your answer…",status_received:"Answers received"},code_module:{title:"Code",badge:"super-agent",desc:"OpenCode-style coding sessions. Pick a project, open a session, and ask it to read, plan, edit or run.",no_projects:"No registered projects. Register one with `apx project add` to use Code.",sessions:"Sessions",new_session:"New session",untitled:"New session",no_sessions:"No sessions yet — create one to start coding.",pick_project:"Pick a project to see its sessions.",rename:"Rename",delete:"Delete",delete_confirm:"Delete this session? The transcript is removed; your files are untouched.",empty_chat:"Send a coding instruction to get started.",placeholder:"Ask for a change… (enter sends, shift+enter = new line)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edits files and runs commands",mode_plan_hint:"Plan — read-only, proposes changes without touching files",tab_context:"Context",tab_changes:"Changes",tab_artifacts:"Artifacts",artifacts_none:"No artifacts yet. Ask the agent to create a script under `artifacts/<name>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copy path",artifacts_run:"Run",artifacts_run_hint:"Run it from your terminal:",artifacts_delete:"Delete",artifacts_delete_confirm:"Delete this artifact? The file will be removed from disk.",ctx_model:"Model",ctx_tokens:"Tokens",ctx_input:"Input",ctx_output:"Output",ctx_messages:"Messages",ctx_breakdown:"Context breakdown",ctx_none:"No usage yet — send a turn to see tokens.",seg_system:"System",seg_user:"User",seg_assistant:"Assistant",seg_tool:"Tools",seg_other:"Other",changes_none:"No changes in this session yet.",changes_no_git:"Changes need a git repository. This project isn't one.",changes_files:"{n} file(s) changed",stopped:"[stopped]",close:"Close",reload:"Reload",discard_changes:"Discard changes",save_shortcut_hint:"Save (Cmd/Ctrl+S)",artifacts_rename:"Rename",artifacts_view:"View contents",artifacts_edit:"Edit contents",artifacts_preview:"Preview",artifacts_preview_hint:"Open a live preview in a local browser tab",artifacts_share:"Share",artifacts_share_hint:"Create a public tunnel URL to share this preview",artifacts_stop_preview:"Stop preview",artifacts_preview_local:"Local preview",artifacts_preview_public:"Public URL",artifacts_copy_url:"Copy URL",artifacts_preview_started:"Preview running at {url}",tree_collapse_all:"Collapse all",terminal_clear:"Clear",terminal_close:"Close terminal"},desktop_screen:{status_title:"Status",autostart_title:"Auto-start",shortcut_title:"Keyboard shortcut",appearance_title:"Appearance",activation_title:"Activation + transcription",last_conv_title:"Last conversation",open_config:"Configuration"},voice_screen:{providers_title:"Voice providers (TTS)",test_title:"Test voice",stt_title:"Transcription (STT)",configure_provider:"Configure {name}"},deck_screen:{widgets_title:"Widgets",context_title:"APX context",reload_manifest:"Reload manifest",widget_native:"Native APX widget",widget_external:"External widget",preview_badge:"Preview",preview_title:"Deck — Coming soon",preview_body:"The Deck module is still in development and not released yet. We'll re-enable it once Deck ships in a stable release. For now everything here is read-only and no changes will be saved."},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Model that vectorizes the history of all channels for relevant memory. Just like TTS/STT: pick a provider and model. 'Automatic' tries local first and falls back to offline if nothing is available.",provider_label:"Provider",provider_hint:"Ollama is local and free. Gemini/OpenAI use the API key from their section in Models (or the one below).",mode_label:"Selection mode",mode_hint:"Chain falls back to the next if one fails; Single uses exactly the chosen provider.",available:"available",unavailable:"unavail.",test_btn:"Test embedding",reindex_btn:"Reindex memory",test_ok:"Embedding OK with {embedder}",test_failed:"Test failed: {msg}",reindexed:"Reindexed: {indexed} chunks (cleared {cleared}).",reindex_failed:"Reindex failed: {msg}",save_failed:"Could not save: {msg}",provider_auto:"Automatic (chain: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, no API key (nomic-embed-text)",provider_gemini:"Gemini — free tier with key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, no model — degraded)",mode_chain:"Chain (automatic fallback)",mode_single:"Single (uses only the chosen one)",ollama_title:"Ollama (local)",ollama_desc:"No API key. Runs nomic-embed-text on your local or cloud Ollama.",model_label:"Model",base_url_label:"Base URL",ollama_base_url_hint:"Empty uses engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) or another compatible model.",api_key_label:"API key",openai_key_hint:"Empty reuses engines.openai.api_key. Leave it blank to keep the saved one.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier with a Google API key.",gemini_key_hint:"Empty reuses engines.gemini.api_key.",compaction_title:"History compaction",compaction_desc:"When a chat exceeds the turn threshold, the oldest turns are summarized with a lightweight (local) LLM and saved as [COMPACTED SUMMARY], keeping context bounded. Runs off the hot-path: the current turn uses whatever summary already exists.",threshold_label:"Compaction threshold",threshold_hint:"Compact once the chat exceeds these turns (default 60).",keep_recent_label:"Recent turns to preserve",keep_recent_hint:"Verbatim turns that are NEVER compacted (default 40). Must be lower than the threshold.",compact_model_label:"Compaction model",compact_model_hint:"Lightweight LLM for summarizing. Ideally a local one (Ollama) to avoid cost. Format provider:model.",compact_fallback_label:"Fallback model",compact_fallback_hint:"Used if the compaction one fails. Empty falls back to the super-agent model.",compact_fallback_ph:"(empty → super-agent model)"},router_panel:{title:"Model router",description:"A single general router (no per-task cases). Pick a provider and model; if the active one fails, it tries the fallback chain in order.",badge_default:"default",no_providers:"Add a provider below to be able to pick models.",active_model_label:"Active model (default)",active_model_hint:"Provider + model. Saved as provider:model.",fallback_title:"Fallback chain",fallback_desc:"If the active model fails, it tries these in order. Click one to edit it.",fallback_empty:"No fallback configured.",add_to_chain:"Add to the chain",done:"done",save:"Save router",saved:"Saved",saved_toast:"Router saved.",provider_ph:"— provider —",provider_not_found:"⚠ {name} (not found)",provider_not_configured:'The provider "{name}" is not configured.'},routing_panel:{title:"Content routing",description:"Prefer a different model per message based on its content (image, size, channel, keywords). Separate from the fallback chain above.",signal_on:"Content routing: ON ({n} rules)",signal_on_empty:"Content routing: ON (no rules yet)",signal_off:"Content routing: OFF",how_it_works:"How does it work?",enable_label:"Enable content routing",rules_title:"Routing rules",rules_desc:"Evaluated top to bottom; the first rule whose conditions all match wins.",rules_empty:"No rules yet. Add some in the editor.",edit_rules:"Edit rules (JSON)",hide_editor:"Hide editor",editor_label:"Rules (JSON array)",json_hint:"Array of { model, when }. when keys: has_image, min_prompt_chars, max_prompt_chars, min_context_chars, channels[], keywords[]. Empty when = matches every message.",json_error:"Invalid JSON: {msg}",json_not_array:"The rules must be a JSON array.",insert_example:"Insert an example",when_any:"any message",when_image:"has image",when_no_image:"no image",when_min_prompt:"prompt ≥ {n} chars",when_max_prompt:"prompt ≤ {n} chars",when_min_context:"context ≥ {n} chars",when_channels:"channels: {list}",when_keywords:"keywords: {list}",helper:"Routing picks a model per message (image, size, channel, keywords). It composes with failover: a routed model that is down falls back down the chain. An explicit per-request model override always wins.",save:"Save routing",saved:"Saved",saved_toast:"Content routing saved.",confirm_title:"Apply routing changes?",confirm_body:"This changes which model handles each message. Failover still applies if a routed model is down.",confirm_on:"Content routing will be ON with {n} rules.",confirm_off:"Content routing will be OFF (every message uses the default router).",confirm_apply:"Apply",cancel:"Cancel"},engines_panel:{title:"Providers",new_btn:"New provider",description:"LLM providers (API). Each provider uses an engine/adapter (openai, ollama, …) with its key and URL.",empty:"No providers. Add one with the button above.",add_card:"Add provider",saved:"Provider saved.",saved_json:"Provider saved (JSON).",deleted:"Provider deleted.",delete_confirm:"Delete provider {name}?"},providers_modal:{new_title:"New provider",edit_title:"Edit {name}",description:"LLM provider. The engine defines which adapter it uses (openai, ollama, …).",list_models_hint:"List the provider's actual models",toggle_active:"Active · click to deactivate",toggle_inactive:"Inactive · click to activate",delete:"Delete",custom:"Custom",json_mode:"JSON",form_mode:"Back to form",json_label:"Provider config (JSON)",json_hint:"Saved as engines.{slug} in config.json",json_help:"Must be a valid JSON object with at least engine. The slug is taken from the form.",name_label:"Name",name_ph:"My provider",engine_label:"Engine",base_url_label:"Base URL (base_url)",base_url_hint:"Auto-filled when you pick a provider.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Leave blank to keep the current one.",api_key_hint_env:"Stored as a secret. Suggested env: {env}",api_key_hint:"Stored as a secret.",api_key_set:"…{suffix} (already set)",model_label:"Default model",load_models:"Load models",max_tokens_label:"Max tokens (max_tokens)",temperature_label:"Temperature: {value}",pricing_summary:"Token analysis / pricing (optional)",context_limit_label:"Context limit (tokens)",price_input:"$ input / 1M",price_output:"$ output / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Per-model context limits (JSON)",active_label:"Active (agents can use it)",err_slug_required:"Slug required.",err_slug_required_form:"Slug required (in the form).",err_slug_exists:'A provider "{slug}" already exists.',err_model_limits_json:"Per-model context limits: invalid JSON.",err_json_invalid:"Invalid JSON: check the syntax.",err_json_object:"The JSON must be an object with the provider config.",err_engine_missing:'Missing "engine" (e.g. "anthropic", "ollama").',err_save:"Error saving.",err_no_models:"No models. Correct key/URL?",err_list_models:"Could not list models."},providers_card:{active:"Active",off:"Off",model:"Model",base_url:"Base URL",api_key:"API key",key_set:"✓ set",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copy",stop:"Stop",send:"Send",pick_model:"Pick model (or Auto)",insert_variable:"Insert variable"},sidebar_ui:{toggle:"Toggle sidebar"},models_ui:{invalid_hint:"Model/provider unavailable"},global_config:{title:"APX config"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (already set)",api_key_keep_hint:"Leave blank to keep the current one.",api_key_secret_hint:"Stored as a secret. Env: {env}",api_key_reuse_hint:"Reuses {engine} if left blank. Env: {env}",err_save:"Error while saving.",model_label:"Model",voice_label:"Voice",format_label:"Format",output_format_label:"Output format",voice_id_label:"Voice ID",voice_id_hint:"ElevenLabs voice id (empty = default).",gemini_model_hint:"Gemini TTS is still in preview.",base_url_label:"Base URL (optional)",base_url_hint:"OpenAI-compatible endpoint. Empty = OpenAI. Point it at a local server (e.g. a QVox / Qwen3-TTS daemon) to use that instead.",openai_model_hint:"tts-1 / tts-1-hd for OpenAI. Leave blank to let a custom server pick.",openai_voice_hint:"OpenAI preset (alloy…) or a custom server's preset (e.g. custom). Empty = server default.",openai_style_hint:"Base voice / instruct, used by custom endpoints (the persona kept across the audio). Ignored by stock OpenAI tts-1.",style_label:"Style (how it should speak)",style_hint:"Natural-language instruction. Empty = no style. E.g.: 'speak in a cheerful, unhurried tone'.",style_ph:"speak in a cheerful, energetic tone",temperature_label:"Temperature (optional)",temperature_hint:"Sampling temperature for custom endpoints. Empty = server default.",emotions_short:"Emotions",emotions_label:"Inline emotion tags",emotions_hint:"When this engine speaks, let the agent drop [happy]/[whisper]-style tags into voice replies to color the delivery. Only enable it if this engine understands the tags (e.g. a QVox/Qwen3-TTS endpoint) — otherwise they're stripped before synthesis.",emotions_tags_label:"Allowed tags",emotions_tags_hint:"Comma-separated. Empty = the default set.",piper_bin_label:"Binary (bin)",piper_bin_hint:"Path or name of the piper CLI (PATH).",piper_model_label:"Model (.onnx)",piper_model_hint:"Absolute path to the piper voice model.",piper_speaker_label:"Speaker (optional)",piper_speaker_hint:"Speaker id for multi-voice models.",mock_desc:"The mock engine generates a silent test WAV. It has no parameters: it serves as a guaranteed fallback when no other engine is configured.",selection_mode:"Selection mode",mode_chain_desc:"Chain with fallback: uses the first available engine following the order below.",mode_single_desc:"Default engine only: always uses the chosen one; the rest stay configured for other purposes.",mode_chain_btn:"Chain (router)",mode_single_btn:"Default engine only",move_up:"Move up",move_down:"Move down",badge_local:"local",badge_available:"available",badge_unavailable:"configured, unavailable",badge_not_configured:"not configured",badge_default:"default",badge_custom:"custom",set_as_default:"Set as default",configure:"Configure",remove:"Remove",remove_confirm:"Remove this custom provider?",add_provider:"Add provider",new_provider:"New provider",custom_note:"Custom OpenAI-compatible endpoint.",custom_desc:"Any OpenAI-compatible speech endpoint (e.g. a local QVox / Qwen3-TTS server).",label_label:"Name",label_hint:"Display name for this provider.",base_url_req_label:"Base URL",base_url_req_hint:"Required. The OpenAI-compatible endpoint, e.g. http://127.0.0.1:5111/v1",api_key_optional_hint:"Optional — only if your server requires a key.",advanced:"Advanced",custom_model_hint:"Optional. Most local servers ignore it (e.g. QVox).",custom_voice_hint:"Optional. A preset your server understands (e.g. custom). Empty = server default.",custom_optional_ph:"(optional)",stt_engine_label:"Transcription engine",stt_engine_hint:"Local uses faster-whisper (requires python3 + faster-whisper). OpenAI uses the engines.openai key.",stt_model_label:"Local model (whisper)",stt_model_hint:"Bigger = more accurate and slower.",stt_language_label:"Language",stt_language_hint:'For Spanish, setting "Spanish" improves accuracy.',stt_provider_auto:"Automatic (local, then remote)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",stt_provider_custom:"Custom — OpenAI-compatible server",stt_openai_model_label:"OpenAI model",stt_openai_model_hint:"Defaults to whisper-1.",stt_custom_baseurl_label:"Base URL (OpenAI-compatible)",stt_custom_baseurl_hint:"e.g. http://localhost:8000/v1 (mlx-audio on Metal) or http://192.168.1.50:9000/v1 (Radeon/NVIDIA on the LAN).",stt_custom_model_label:"Model",stt_custom_model_hint:"e.g. mlx-community/whisper-large-v3-turbo or large-v3.",stt_custom_key_hint:"Optional — most local servers need no key.",stt_hw_label:"Detected hardware",stt_hw_recommended:"Recommended",stt_hw_limited:"limited GPU acceleration, using CPU",stt_backend_label:"Acceleration / Engine",stt_backend_hint:"Auto adapts to your hardware. Metal runs on the GPU (mlx); CPU uses faster-whisper.",stt_backend_auto:"Automatic (recommended)",stt_model_needs_download:"Not downloaded (~{size}). The model must be downloaded to use this engine.",lang_auto:"Auto-detect",lang_es:"Spanish",lang_en:"English",lang_pt:"Portuguese",lang_fr:"French",lang_it:"Italian",lang_de:"German",test_default_text:"Hi, I'm APX. This is a voice test.",test_default_engine:"Default ({name})",test_default_chain:"Default (chain)",test_unavailable_suffix:" · unavailable",test_empty_error:"Type something to say.",test_synth_error:"Could not synthesize.",test_engine_label:"Engine",test_engine_hint:"Override the default for testing.",test_style_label:"Style (Gemini only)",test_style_hint:"How it should speak. Empty = no style.",test_text_label:"Text to say",test_text_ph:"Type what you want it to say…",say_this:"Say this",stop:"Stop",replay:"Replay",engine_result:"Engine",providers_desc:"Synthesis engines, in fallback order. Status is reported live by the daemon. Add your own OpenAI-compatible endpoints.",providers_load_error:"Could not load providers: {msg}",test_desc:"Pick which engine to synthesize with and, if applicable, how it should speak.",stt_desc:"Speech-to-text engine used by the deck, Telegram, and the CLI when listening.",toast_default_engine:"Default engine: {id}.",toast_mode_chain:"Mode: chain with fallback.",toast_mode_single:"Mode: default engine only.",toast_config_saved:"Voice configuration saved.",toast_provider_removed:"Provider removed.",err_label_required:"A name is required.",err_base_url_required:"A base URL is required.",toast_transcription_updated:"Transcription updated."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (partial).",bot_token_hint:"BotFather token. Stored in ~/.apx/config.json.",bot_token_hint_short:"BotFather token.",secret_set_replace:"(set — type to replace)",secret_already_set:"(already set)",empty_keep:"— empty = keep",message_sent:"Message sent.",message_label:"Text",send_chat_id:"chat_id: {id}",default_apx:"default APX",yes:"yes",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_form:{emoji:"Emoji",area:"Area",role:"Role",no_role:"— no role —",autonomy:"Autonomy",autonomy_hint:"How much the agent can do without asking for confirmation.",auto_total:"Total",auto_automatico:"Auto",auto_permiso:"Permission"},structure:{title:"Structure",subtitle:"Company areas and roles. Areas group agents; roles define their function.",info:"Areas are optional groupings. Roles define an agent's function and may belong to an area.",empty:"No areas or roles yet. Create the first one above.",new_area:"New area",new_role:"New role",edit_area:"Edit area",edit_role:"Edit role",create_area:"Create area",create_role:"Create role",name:"Name",slug:"Slug",goal:"Goal",goal_hint:"What this area exists for (optional).",area:"Area",description:"Description",no_area:"— no area —",roles:"Roles",add_role:"role",no_roles:"no roles",general_roles:"General roles",delete_area:"Delete area",delete_role:"Delete role",delete_area_desc:'Delete area "{name}"? Its roles are detached, not deleted.',delete_role_desc:'Delete role "{name}"?'},files:{docs_label:"Docs",files_label:"Files",new_doc:"New document",new_doc_hint:"Folders allowed: cases/onboarding/spec.md",empty:"No files.",docs_empty:"No documentation yet. Create the first document.",truncated:"Listing truncated (too many files).",select_prompt:"Pick a file to view it.",save:"Save",saved:"Saved.",deleted:"Deleted.",created:"Document created.",edit:"Edit",preview:"Preview",discard:"Discard",no_preview:"No preview for this file.",too_large:"File too large to display.",path_label:"File path",path_example:"e.g. cases/onboarding/spec.md",create:"Create"},tasks:{state_open:"open",state_done:"done",state_dropped:"dropped",status_pending:"pending",status_running:"running",status_in_review:"in review",status_blocked:"blocked",done_label:"done",dropped_label:"dropped",detail_title:"Task detail",field_title:"Title",field_prompt:"Prompt",field_status:"Status",field_agent:"Agent",field_creator:"Created by",field_source:"Source",field_created:"Created",field_updated:"Updated",field_done:"Completed",prompt_ph:"Task description / prompt…",toggle_prompt:"Prompt",view_thread:"View thread",mark_done:"Complete"},agents_ui:{model_router_default:"model: router default",slug_kebab_hint:"kebab-case, e.g. reviewer, my-agent, content-writer",comma_separated:"comma-separated",body_hint:"markdown — extends the agent's system prompt",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorer",type_none:"— no type —",type_orchestrator:"Orchestrator",type_orchestrator_desc:"Coordinates the team and delegates.",type_specialist:"Specialist",type_specialist_desc:"Domain expert; runs tasks.",type_assistant:"Assistant",type_assistant_desc:"Conversational helper.",type_worker:"Worker",type_worker_desc:"Runs autonomous tasks.",type_monitor:"Monitor",type_monitor_desc:"Watches state and reports.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definition (frontmatter + system prompt).",memory_durable_desc:"durable facts the agent remembers.",running:"running",paused:"paused",last_error:"last: error",field_tick:"Tick",field_next_tick:"Next tick",field_last_tick:"Last tick",field_last_run:"Last run",tools_label:"Tools",kind_agent:"agent",kind_memory:"memory",kind_thread:"thread",kind_task:"task",kind_routine:"routine",kind_hierarchy:"hierarchy",nodes_drag_hint:"{n} nodes · drag to rearrange",kind_exec_agent:"Project agent",kind_exec_agent_desc:"Runs a project agent with a prompt. You pick which one.",kind_super_agent:"Super-agent",kind_super_agent_desc:"Calls the APX super-agent with a prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Sends a fixed message to a Telegram channel. No model or agent.",kind_shell:"Shell",kind_shell_desc:"Runs a shell command. No prompt or pre/post — the command is the action.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"Does nothing except write a line to the logs each time it runs. Useful to confirm the scheduler is alive. If you don't know whether you need it, don't use it.",unit_seconds:"seconds",unit_minutes:"minutes",unit_hours:"hours",unit_days:"days",every_n_unit:"every {n} {unit}",every_v:"every {v}",preset_every_10m:"every 10 min",preset_hourly:"hourly",preset_daily_9am:"daily 9am",preset_weekdays_9am:"weekdays 9am",preset_manual:"Manual",var_pre_output_prompt:"Text output of the pre-commands. Replaced inside the prompt/text before it is sent. Use it to inject fresh data (weather, an API) into the instruction.",var_llm_output:"Final answer from the agent or super-agent. Available in the post-commands as an env var — e.g. forward it via Telegram.",var_status:"Action result: ok or error. Available in the post-commands to branch on what happened.",var_skipped:"1 if the action was skipped (via skip_prompt_on), 0 if it ran. Available in the post-commands.",var_pre_output:"Full pre-commands output, as an env var in the post-commands (up to 32k).",var_pre_output_file:"Path to a temp file with the pre-commands output. For large outputs not suited to an env var.",var_pre_exit:"Exit code of the last pre-command (0 = ok). Available in the post-commands.",var_routine:"Name of this routine. Available as an env var in the commands.",summary_runs_agent:'Runs the agent "{agent}"',summary_runs_agent_none:"Runs an agent (none chosen yet)",summary_super_agent:"Calls the super-agent",summary_telegram:'Sends Telegram to "{channel}"',summary_runs_cmd:"Runs: {cmd}",summary_shell:"Runs a shell command",summary_heartbeat:"Leaves a heartbeat in the logs",action_agent_answers:'Agent "{agent}" answers the prompt',action_agent_pick_answers:"Agent (pick one) answers the prompt",action_super_answers:"The super-agent answers the prompt",action_telegram_channel:'Sends Telegram to channel "{channel}"',action_runs_shell:"Runs the shell command",step_pre:"Pre",step_post:"Post",last_label:"last:",tg_chat_id_ph:"(uses the channel's)",tg_text_ph:"message to send",hb_message_ph:"still alive",arg_placeholder:"--flag or value",remove_arg:"remove arg",super_agent_label:"{persona} (super-agent)",super_agent_badge:"super-agent"},modules_ui:{desktop_pos_left:"Left",desktop_pos_center:"Center",desktop_pos_right:"Right",desktop_theme_system:"System",desktop_theme_light:"Light",desktop_theme_dark:"Dark",desktop_status_desc:"The window launches from the terminal or via autostart.",desktop_running:"Running",desktop_stopped:"Stopped",desktop_refresh:"refresh",desktop_start:"Start",desktop_stop:"Stop",desktop_restart:"Restart",desktop_restart_hint:"Reload the open window so config changes (theme, position) apply now.",desktop_restart_done:"Restarting the window — applying the latest config.",desktop_restart_none:"No desktop window is connected.",desktop_start_done:"Desktop window launched.",desktop_start_already:"Desktop window is already running.",desktop_stop_done:"Desktop window stopped.",desktop_stop_none:"No desktop window was running.",desktop_from_terminal:"From terminal:",desktop_autostart_desc:"Launches the window at user login. Equivalent to `apx desktop install` (no sudo required).",desktop_platform:"platform: {platform}",desktop_shortcut_desc:"Global hotkey that shows/hides the window and starts listening.",desktop_accelerator:"Accelerator",desktop_accelerator_hint:"Click the field and press your key combo. Restart the window to apply.",desktop_shortcut_record:"Click to set a shortcut",desktop_shortcut_recording:"Press your combo…",desktop_shortcut_change:"click to change",desktop_shortcut_esc:"Esc to cancel",desktop_shortcut_saved:"Shortcut saved. Restart the window (apx desktop stop && start) to apply it.",desktop_autostart_on:"Autostart enabled for the next login.",desktop_autostart_off:"Autostart disabled.",desktop_appearance_desc:"Window theme and position on the screen.",desktop_theme:"Theme",desktop_restart_apply:"Restart the window to apply.",desktop_theme_set:"Theme: {value}.",desktop_position:"Position",desktop_position_hint:'"left" / "center" / "right" of the top edge.',desktop_position_set:"Position: {value}.",desktop_activation_desc:"The daemon plugin processes the messages. STT is configured in Voices.",desktop_enabled_toast:"Desktop enabled.",desktop_disabled_toast:"Desktop disabled.",desktop_plugin_on:"Plugin enabled (replies to messages)",desktop_plugin_off:"Plugin disabled",desktop_stt_engine:"Speech-to-text engine:",desktop_stt_engine_suffix:"(local whisper, language, model).",desktop_last_conv_desc:"The latest exchange with the agent from the floating window.",desktop_no_messages:"No messages yet. Send something to the desktop window for it to appear here.",desktop_you:"You",desktop_roby:"Roby",desktop_empty_msg:"(empty)",deck_widget_enabled:"Widget {id} enabled.",deck_widget_disabled:"Widget {id} disabled.",deck_save_error:"Error while saving",deck_loading_manifest:"Loading manifest…",deck_manifest_error:"Error loading the manifest.",deck_widgets_summary:"{count} widgets · {enabled} external enabled",deck_loading_manifest_full:"Loading the Deck manifest…",deck_manifest_load_failed:"Could not load the Deck manifest.",deck_retry:"Retry",deck_no_widgets:"No widgets in the manifest.",deck_context_desc:"Information the Deck sees from the daemon.",deck_active_project:"Active project:",deck_none:"none",deck_registered_projects:"Registered projects:",deck_active_plugins:"Active plugins:",deck_daemon_active:"active · {uptime}",deck_daemon_started:"started",deck_safety_no_shell:"no direct shell",deck_safety_no_arbitrary:"arbitrary commands blocked",deck_safety_confirm:"dangerous actions require confirmation",code_copied:"Copied.",code_saved:"Saved.",code_file_empty:"(empty)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Main agent with all tools",code_chat_tab:"Chat",code_panel_sessions:"Session list",code_panel_tree:"File tree",code_panel_terminal:"Terminal",code_panel_context:"Context panel",code_ctx_auto:"auto",code_ctx_mode:"Mode",code_ctx_agent:"Agent",code_ctx_msgs_value:"{user} user · {assistant} assistant",code_ctx_tokens_total:"Total Tokens",code_ctx_created:"Created",code_ctx_activity:"Activity",code_project_fallback:"project {id}",code_pick_project_ph:"Pick a project…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"View",code_artifact_edit_short:"Edit",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncated"},settings_ui:{bearer_label:"Bearer",global_config_desc:"General config in ~/.apx/config.json. Editable by tabs; JSON stays separate.",global_json_desc:"Redacted secrets are not overwritten.",save_json:"Save JSON",expand_menu:"Expand menu",collapse_menu:"Collapse menu",documentation:"Documentation",kind_personal:"Personal",kind_company:"Company",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Other",base_menu_view:"Base menu view (general workspace).",coming_soon:"Coming soon",inspector_title:"Skill Inspector (per-turn RAG)",inspector_desc:"Experimental feature. When active, the agent does NOT receive the full skill list in its prompt; on each message a local RAG decides which skill(s) to load — the full body on a strong match, a suggestion on a medium match, nothing if it doesn't apply. It is re-evaluated every turn: a skill that stopped being relevant disappears from the context.",enable_inspector:"Enable inspector",enable_inspector_hint:"Off = classic behavior (slug list + passive suggestion). On = the RAG decides per turn.",on:"On",off:"Off",index_count:"Index: {n} skills",not_indexed:"not indexed",dim:"dim {dim}",updated_at:"updated {date}",reindex:"Reindex",reindex_forced:"Reindex (forced)",embedder_source:"The embedder comes from Memory (RAG). Local with Ollama, or offline if no provider is set.",thresholds_title:"Thresholds and limits",thresholds_desc:"Tune how aggressive the inspector is. Raising the thresholds = fewer false positives but more risk of missing a skill; lowering them = the opposite.",test_title:"Test (dry-run)",test_desc:"Type a message the way a user would and see which skills the inspector would load/suggest — without calling the model. Forces the inspector on even if it's off above.",test_placeholder:"e.g.: I need to create a promo video with voiceover",test_btn:"Test",jit_empty_index:"JIT (empty index)",loaded_label:"Loaded:",suggested_label:"Suggested:",could_not_save:"Could not save: {msg}",indexed_with:"Indexed with {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Index failed: {msg}",dry_run_failed:"Dry-run failed: {msg}",knob_load_threshold:"Load threshold",knob_load_threshold_hint:"Minimum similarity to inject the skill's BODY (high = stricter).",knob_hint_threshold:"Hint threshold",knob_hint_threshold_hint:"Minimum similarity to only SUGGEST the skill (so the agent loads it if it wants).",knob_margin:"Margin over the 2nd",knob_margin_hint:"The top must beat the second by this margin to load its body (avoids weak ties).",knob_max_loaded:"Max. loaded bodies",knob_max_loaded_hint:"How many skills are injected in full per turn.",knob_max_hints:"Max. hints",knob_max_hints_hint:"How many extra skills are named as a suggestion.",knob_prompt_floor:"Minimum prompt length",knob_prompt_floor_hint:"Messages shorter than this are ignored (avoids 'ok', 'hi').",knob_body_char_cap:"Body char cap",knob_body_char_cap_hint:"Trims long skill bodies so they don't bloat the context.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Only project-specific values; empty inherits global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Super-agent model",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Extra prompt",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Respond with engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Project",cfg_project_desc:".apc/project.json. Portable APC metadata; no secrets, no runtime.",cfg_name:"Name",cfg_version:"Version",cfg_apc_spec:"APC spec",cfg_apx_install:"APX install state",cfg_apx_storage_id:"APX storage id"},skills_page:{title:"Skills",desc:"Turn skills on or off per agent. Pick a scope: the super-agent (global) or a specific project.",list_title:"Installed skills",list_desc:"APX's private skills are always active and can't be changed.",scope_label:"Scope",scope_super_agent:"Super-agent (global)",scope_hint:"The super-agent uses the global scope. Each project can override skills independently.",count_label:"{n} skills · {on} on",empty:"No skills yet. Create one below or install via the CLI.",source_builtin:"APX",source_global:"Global",source_project:"Project",private_badge:"Private",private_hint:"Built-in APX skill — always active, can't be disabled or deleted.",overridden_badge:"Override",inherited_hint:"Inherited from global",reset_to_global:"Reset to global",on:"on",off:"off",toggle_failed:"Could not change state: {msg}",add_title:"Add a skill",add_desc:"Creates a user skill at ~/.apx/skills/<slug>/SKILL.md. Available across all scopes.",add_slug_label:"Slug",add_slug_ph:"my-skill",add_desc_label:"Description",add_desc_ph:"One line describing when to use it",add_body_label:"Body (Markdown)",add_body_ph:`# My skill
|
|
756
|
+
|
|
757
|
+
Instructions for the agent…`,add_btn:"Create skill",created_ok:'Skill "{slug}" created.',create_failed:"Could not create: {msg}",delete_btn:"Delete",delete_confirm:`Delete skill "{slug}"? This can't be undone.`,deleted_ok:'Skill "{slug}" deleted.',delete_failed:"Could not delete: {msg}",inspector_section_title:"Skill Inspector (per-turn RAG)",inspector_section_desc:"Advanced: local RAG that injects only the skills a message needs.",scope_ph:"— choose scope —",select_a_skill:"Pick a skill from the list to see its content.",added_by:"Added by",activator:"Activator",by_apx:"APX (built-in)",by_you:"You",activator_value:"Semantic match (RAG)",tab_preview:"Preview",tab_source:"Source",add_menu:"Add",add_online:"Create with editor",add_online_hint:"Write slug + description + content",add_zip:"Upload .zip",add_zip_hint:"Import a packaged skill",add_repo:"From git repo",add_repo_hint:"Clone from a URL",create_dialog_title:"Create skill",repo_dialog_title:"Import from git repo",repo_url_label:"Repo URL",repo_url_ph:"https://github.com/user/my-skill.git",repo_url_hint:"The repo (or its subfolder) must contain a SKILL.md.",import_btn:"Import",imported_ok:'Skill "{slug}" imported.',import_failed:"Could not import: {msg}",cancel:"Cancel",manager_tab:"Skills",rag_tab:"Config (RAG)"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) chose these skills for this turn",tools_count:"{n} tools",tool_read_file:"Read file",tool_write_file:"Write file",tool_edit_file:"Edit file",tool_list_files:"List files",tool_search_files:"Search in files",tool_search_messages:"Search messages",tool_tail_messages:"Latest messages",tool_run_shell:"Run shell",tool_send_telegram:"Send Telegram",tool_call_agent:"Call agent",tool_call_mcp:"Call MCP",tool_call_runtime:"Call runtime",tool_create_task:"Create task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (router decides)",model_filter_ph:"filter or type a model…",loading_models:"loading models…",use_value:"use “{value}”",model_combobox_ph:"pick or type a model…",search_variable_ph:"search variable…",no_matches:"no matches",create_variable:"Create new variable…",kv_key_ph:"KEY",kv_value_ph:"value",remove_row:"remove row",add_row:"Add row",err_chat_failed:"Chat failed.",err_stream_failed:"Stream failed.",err_load_conversation:"Could not load conversation.",err_stream:"Stream error."},integrations:{title:"Integrations",description:"Plugins and tools available for this project",tab_plugins:"Plugins",tab_tools:"Tools",scope_label:"Scope:",scope_project:"This project",scope_global:"Global (default)",plugins_hint:"Channel & service plugins installable per project. Saved in the scope selected above.",more_soon:"More plugins coming soon…",tools_hint:"Tools that connected plugins expose to this project's agents.",tools_empty:"No integration tools yet. Connect a plugin to enable them.",tool_active:"active",tool_inactive:"inactive",status_active:"Active",status_error:"Error",status_unconfigured:"Not configured",connected:"Connected",connect:"Connect",deactivate:"Deactivate",saving:"Saving...",validating:"Validating...",verifying:"Verifying token...",confirm:"Confirm",select_placeholder:"Select...",reveal:"Show",hide:"Hide",credentials:"{name} credentials",coming_soon:"Coming soon",coming_soon_body:"This plugin is declared in the catalog but isn't connectable in APX yet. It will be ported natively in a future iteration.",tools_for_agents:"Agent tools",tools_available_note:"Available to agents that allow them, or via discover_tools.",err_connect:"Failed to connect",err_generic:"Something went wrong",asana:{select_label:"Select the workspace to use",connected:{user_name:"Connected as",user_email:"Email",workspace_name:"Workspace"},fields:{personal_access_token:{label:"Personal Access Token",help_label:"How to get the token?",help_steps:`Open app.asana.com/0/my-apps in your browser.
|
|
758
|
+
Scroll to the "Personal access tokens" section (not your OAuth apps).
|
|
759
|
+
Click "+ New access token".
|
|
760
|
+
Give it a name and confirm.
|
|
761
|
+
Copy the full token — it starts with "1/..." and has a ":" in the middle.
|
|
762
|
+
Paste it in the field below.`}}},github:{connected:{user_login:"Connected as",user_name:"Name"},fields:{token:{label:"Personal Access Token",help_label:"How to get the token?",help_steps:`Open github.com/settings/tokens.
|
|
763
|
+
Generate a token (classic or fine-grained) with the "repo" scope.
|
|
764
|
+
Copy the token — it starts with ghp_ or github_pat_.
|
|
765
|
+
Paste it in the field below.`}}}}},w_={es:wP,en:kP};function SP(){try{const e=localStorage.getItem(zn.language);if(e&&e in w_)return e}catch{}return"en"}let kp=SP();function sN(e){kp=e;try{localStorage.setItem(zn.language,e)}catch{}}const aN=[{value:"es",label:"Español"},{value:"en",label:"English"}];function k_(){return kp}function CP(e){const t=w_[kp],a=e.split(".");let o=t;for(const l of a)if(o&&typeof o=="object"&&l in o)o=o[l];else return;return typeof o=="string"?o:void 0}function NP(e,t){return t?e.replace(/\{(\w+)\}/g,(a,o)=>o in t?String(t[o]):`{${o}}`):e}function EP(e){const t=CP(e);if(t!==void 0)return t;if(kp!=="es"){const a=w_.es,o=e.split(".");let l=a;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 u(e,t){const a=EP(e);return a===void 0?e:NP(a,t)}function S_(e){const[t,a]=x.useState(!1);x.useEffect(()=>{try{a(localStorage.getItem(e)==="true")}catch{}},[e]);const o=x.useCallback(()=>a(l=>{const c=!l;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:t,toggle:o}}function RP({collapsed:e,onToggle:t}){return s.jsx($e,{content:u(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),side:"bottom",children:s.jsx("button",{type:"button",onClick:t,"aria-label":u(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:s.jsx(WS,{className:he("size-4 transition-transform",e&&"rotate-180")})})})}function TP({sections:e,active:t,onChange:a,collapsed:o=!1}){return s.jsx("nav",{className:he("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)=>s.jsxs("div",{className:he("w-full",c>0&&"mt-2"),children:[!o&&l.title&&s.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:l.title}),s.jsx("div",{className:"space-y-0.5",children:l.items.map(({key:d,label:p,icon:m,badge:g})=>{const h=t===d,b=s.jsxs("button",{type:"button",onClick:()=>a(d),"data-testid":`tabnav-${d||"index"}`,className:he("flex cursor-pointer items-center rounded-lg transition-colors",o?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",h?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[s.jsx(m,{className:"size-4 shrink-0"}),!o&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"flex-1 truncate text-left text-xs",children:p}),g!==void 0&&s.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:g})]})]});return o?s.jsx($e,{content:p,side:"right",children:b},d):s.jsx(x.Fragment,{children:b},d)})})]},c))})}const rN=0,oN=1,lN=2,mw=3;var gw=Object.prototype.hasOwnProperty;function Ax(e,t){var a,o;if(e===t)return!0;if(e&&t&&(a=e.constructor)===t.constructor){if(a===Date)return e.getTime()===t.getTime();if(a===RegExp)return e.toString()===t.toString();if(a===Array){if((o=e.length)===t.length)for(;o--&&Ax(e[o],t[o]););return o===-1}if(!a||typeof e=="object"){o=0;for(a in e)if(gw.call(e,a)&&++o&&!gw.call(t,a)||!(a in t)||!Ax(e[a],t[a]))return!1;return Object.keys(t).length===o}}return e!==e&&t!==t}const Qa=new WeakMap,Za=()=>{},Hn=Za(),Mx=Object,St=e=>e===Hn,fa=e=>typeof e=="function",Vr=(e,t)=>({...e,...t}),iN=e=>fa(e.then),gh={},Id={},C_="undefined",iu=typeof window!=C_,Ox=typeof document!=C_,AP=iu&&"Deno"in window,MP=()=>iu&&typeof window.requestAnimationFrame!=C_,cN=(e,t)=>{const a=Qa.get(e);return[()=>!St(t)&&e.get(t)||gh,o=>{if(!St(t)){const l=e.get(t);t in Id||(Id[t]=l),a[5](t,Vr(l,o),l||gh)}},a[6],()=>!St(t)&&t in Id?Id[t]:!St(t)&&e.get(t)||gh]};let zx=!0;const OP=()=>zx,[Dx,Px]=iu&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Za,Za],zP=()=>{const e=Ox&&document.visibilityState;return St(e)||e!=="hidden"},DP=e=>(Ox&&document.addEventListener("visibilitychange",e),Dx("focus",e),()=>{Ox&&document.removeEventListener("visibilitychange",e),Px("focus",e)}),PP=e=>{const t=()=>{zx=!0,e()},a=()=>{zx=!1};return Dx("online",t),Dx("offline",a),()=>{Px("online",t),Px("offline",a)}},LP={isOnline:OP,isVisible:zP},IP={initFocus:DP,initReconnect:PP},hw=!Wc.useId,Vl=!iu||AP,BP=e=>MP()?window.requestAnimationFrame(e):setTimeout(e,1),hh=Vl?x.useEffect:x.useLayoutEffect,xh=typeof navigator<"u"&&navigator.connection,xw=!Vl&&xh&&(["slow-2g","2g"].includes(xh.effectiveType)||xh.saveData),Bd=new WeakMap,UP=e=>Mx.prototype.toString.call(e),bh=(e,t)=>e===`[object ${t}]`;let $P=0;const Lx=e=>{const t=typeof e,a=UP(e),o=bh(a,"Date"),l=bh(a,"RegExp"),c=bh(a,"Object");let d,p;if(Mx(e)===e&&!o&&!l){if(d=Bd.get(e),d)return d;if(d=++$P+"~",Bd.set(e,d),Array.isArray(e)){for(d="@",p=0;p<e.length;p++)d+=Lx(e[p])+",";Bd.set(e,d)}if(c){d="#";const m=Mx.keys(e).sort();for(;!St(p=m.pop());)St(e[p])||(d+=p+":"+Lx(e[p])+",");Bd.set(e,d)}}else d=o?e.toJSON():t=="symbol"?e.toString():t=="string"?JSON.stringify(e):""+e;return d},N_=e=>{if(fa(e))try{e=e()}catch{e=""}const t=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Lx(e):"",[e,t]};let HP=0;const Ix=()=>++HP;async function uN(...e){const[t,a,o,l]=e,c=Vr({populateCache:!0,throwOnError:!0},typeof l=="boolean"?{revalidate:l}:l||{});let d=c.populateCache;const p=c.rollbackOnError;let m=c.optimisticData;const g=_=>typeof p=="function"?p(_):p!==!1,h=c.throwOnError;if(fa(a)){const _=a,j=[],N=t.keys();for(const y of N)!/^\$(inf|sub)\$/.test(y)&&_(t.get(y)._k)&&j.push(y);return Promise.all(j.map(b))}return b(a);async function b(_){const[j]=N_(_);if(!j)return;const[N,y]=cN(t,j),[w,S,k,E]=Qa.get(t),R=()=>{const V=w[j];return(fa(c.revalidate)?c.revalidate(N().data,_):c.revalidate!==!1)&&(delete k[j],delete E[j],V&&V[0])?V[0](lN).then(()=>N().data):N().data};if(e.length<3)return R();let A=o,T,z=!1;const O=Ix();S[j]=[O,0];const B=!St(m),P=N(),U=P.data,D=P._c,L=St(D)?U:D;if(B&&(m=fa(m)?m(L,U):m,y({data:m,_c:L})),fa(A))try{A=A(L)}catch(V){T=V,z=!0}if(A&&iN(A))if(A=await A.catch(V=>{T=V,z=!0}),O!==S[j][0]){if(z)throw T;return A}else z&&B&&g(T)&&(d=!0,y({data:L,_c:Hn}));if(d&&!z)if(fa(d)){const V=d(A,L);y({data:V,error:Hn,_c:Hn})}else y({data:A,error:Hn,_c:Hn});if(S[j][1]=Ix(),Promise.resolve(R()).then(()=>{y({_c:Hn})}),z){if(h)throw T;return}return A}}const bw=(e,t)=>{for(const a in e)e[a][0]&&e[a][0](t)},qP=(e,t)=>{if(!Qa.has(e)){const a=Vr(IP,t),o=Object.create(null),l=uN.bind(Hn,e);let c=Za;const d=Object.create(null),p=(h,b)=>{const _=d[h]||[];return d[h]=_,_.push(b),()=>{const j=_.indexOf(b);j>=0&&(_[j]=_[_.length-1],_.pop())}},m=(h,b,_)=>{e.set(h,b);const j=d[h];if(j)for(const N of j)N(b,_)},g=()=>{if(!Qa.has(e)&&(Qa.set(e,[o,Object.create(null),Object.create(null),Object.create(null),l,m,p]),!Vl)){const h=a.initFocus(setTimeout.bind(Hn,bw.bind(Hn,o,rN))),b=a.initReconnect(setTimeout.bind(Hn,bw.bind(Hn,o,oN)));c=()=>{h&&h(),b&&b(),Qa.delete(e)}}};return g(),[e,l,g,c]}return[e,Qa.get(e)[4]]},VP=(e,t,a,o,l)=>{const c=a.errorRetryCount,d=l.retryCount,p=~~((Math.random()+.5)*(1<<(d<8?d:8)))*a.errorRetryInterval;!St(c)&&d>c||setTimeout(o,p,l)},FP=Ax,[dN,Af]=qP(new Map),GP=Vr({onLoadingSlow:Za,onSuccess:Za,onError:Za,onErrorRetry:VP,onDiscarded:Za,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:xw?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:xw?5e3:3e3,compare:FP,isPaused:()=>!1,cache:dN,mutate:Af,fallback:{}},LP),YP=(e,t)=>{const a=Vr(e,t);if(t){const{use:o,fallback:l}=e,{use:c,fallback:d}=t;o&&c&&(a.use=o.concat(c)),l&&d&&(a.fallback=Vr(l,d))}return a},KP=x.createContext({}),XP="$inf$",fN=iu&&window.__SWR_DEVTOOLS_USE__,QP=fN?window.__SWR_DEVTOOLS_USE__:[],WP=()=>{fN&&(window.__SWR_DEVTOOLS_REACT__=Wc)},ZP=e=>fa(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],pN=()=>{const e=x.useContext(KP);return x.useMemo(()=>Vr(GP,e),[e])},JP=e=>(t,a,o)=>e(t,a&&((...c)=>{const[d]=N_(t),[,,,p]=Qa.get(dN);if(d.startsWith(XP))return a(...c);const m=p[d];return St(m)?a(...c):(delete p[d],m)}),o),eL=QP.concat(JP),tL=e=>function(...a){const o=pN(),[l,c,d]=ZP(a),p=YP(o,d);let m=e;const{use:g}=p,h=(g||[]).concat(eL);for(let b=h.length;b--;)m=h[b](m);return m(l,c||p.fetcher||null,p)},nL=(e,t,a)=>{const o=t[e]||(t[e]=[]);return o.push(a),()=>{const l=o.indexOf(a);l>=0&&(o[l]=o[o.length-1],o.pop())}};WP();const _h=Wc.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}}),vh={dedupe:!0},Mf=Promise.resolve(Hn);Mf.status="fulfilled";Mf.value=Hn;const sL=()=>Za,aL=(e,t,a)=>{const{cache:o,compare:l,suspense:c,fallbackData:d,revalidateOnMount:p,revalidateIfStale:m,refreshInterval:g,refreshWhenHidden:h,refreshWhenOffline:b,keepPreviousData:_,strictServerPrefetchWarning:j}=a,[N,y,w,S]=Qa.get(o),[k,E]=N_(e),R=x.useRef(!1),A=x.useRef(!1),T=x.useRef(k),z=x.useRef(t),O=x.useRef(a),B=()=>O.current,P=()=>B().isVisible()&&B().isOnline(),[U,D,L,V]=cN(o,k),H=x.useRef({}).current,$=St(d)?St(a.fallback)?Hn:a.fallback[k]:d,F=(Se,Te)=>{for(const je in H){const Ee=je;if(Ee==="data"){if(!l(Se[Ee],Te[Ee])&&(!St(Se[Ee])||!l(te,Te[Ee])))return!1}else if(Te[Ee]!==Se[Ee])return!1}return!0},Y=!R.current,G=x.useMemo(()=>{const Se=U(),Te=V(),je=Ie=>{const ue=Vr(Ie);return delete ue._k,(()=>{if(!k||!t||B().isPaused())return!1;if(Y&&!St(p))return p;const Ge=St($)?ue.data:$;return St(Ge)||m})()?{isValidating:!0,isLoading:!0,...ue}:ue},Ee=je(Se),De=Se===Te?Ee:je(Te);let Le=Ee;return[()=>{const Ie=je(U());return F(Ie,Le)?(Le.data=Ie.data,Le.isLoading=Ie.isLoading,Le.isValidating=Ie.isValidating,Le.error=Ie.error,Le):(Le=Ie,Ie)},()=>De]},[o,k]),K=Sf.useSyncExternalStore(x.useCallback(Se=>L(k,(Te,je)=>{F(je,Te)||Se()}),[o,k]),G[0],G[1]),I=N[k]&&N[k].length>0,X=K.data,Z=St(X)?$&&iN($)?_h($):$:X,W=K.error,fe=x.useRef(Z),te=_?St(X)?St(fe.current)?Z:fe.current:X:Z,re=k&&St(Z),le=x.useRef(null);!Vl&&Sf.useSyncExternalStore(sL,()=>(le.current=!1,le),()=>(le.current=!0,le));const me=le.current;j&&me&&!c&&re&&console.warn(`Missing pre-initiated data for serialized key "${k}" 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=!k||!t||B().isPaused()||I&&!St(W)?!1:Y&&!St(p)?p:c?St(Z)?!1:m:St(Z)||m,de=Y&&Me,ge=St(K.isValidating)?de:K.isValidating,Ce=St(K.isLoading)?de:K.isLoading,ke=x.useCallback(async Se=>{const Te=z.current;if(!k||!Te||A.current||B().isPaused())return!1;let je,Ee,De=!0;const Le=Se||{},Ie=!w[k]||!Le.dedupe,ue=()=>hw?!A.current&&k===T.current&&R.current:k===T.current,ye={isValidating:!1,isLoading:!1},Ge=()=>{D(ye)},Re=()=>{const tt=w[k];tt&&tt[1]===Ee&&delete w[k]},Oe={isValidating:!0};St(U().data)&&(Oe.isLoading=!0);try{if(Ie&&(D(Oe),a.loadingTimeout&&St(U().data)&&setTimeout(()=>{De&&ue()&&B().onLoadingSlow(k,a)},a.loadingTimeout),w[k]=[Te(E),Ix()]),[je,Ee]=w[k],je=await je,Ie&&setTimeout(Re,a.dedupingInterval),!w[k]||w[k][1]!==Ee)return Ie&&ue()&&B().onDiscarded(k),!1;ye.error=Hn;const tt=y[k];if(!St(tt)&&(Ee<=tt[0]||Ee<=tt[1]||tt[1]===0))return Ge(),Ie&&ue()&&B().onDiscarded(k),!1;const ot=U().data;ye.data=l(ot,je)?ot:je,Ie&&ue()&&B().onSuccess(je,k,a)}catch(tt){Re();const ot=B(),{shouldRetryOnError:vt}=ot;ot.isPaused()||(ye.error=tt,Ie&&ue()&&(ot.onError(tt,k,ot),(vt===!0||fa(vt)&&vt(tt))&&(!B().revalidateOnFocus||!B().revalidateOnReconnect||P())&&ot.onErrorRetry(tt,k,ot,Mt=>{const lt=N[k];lt&<[0]&<[0](mw,Mt)},{retryCount:(Le.retryCount||0)+1,dedupe:!0})))}return De=!1,Ge(),!0},[k,o]),Be=x.useCallback((...Se)=>uN(o,T.current,...Se),[]);if(hh(()=>{z.current=t,O.current=a,St(X)||(fe.current=X)}),hh(()=>{if(!k)return;const Se=ke.bind(Hn,vh);let Te=0;B().revalidateOnFocus&&(Te=Date.now()+B().focusThrottleInterval);const Ee=nL(k,N,(De,Le={})=>{if(De==rN){const Ie=Date.now();B().revalidateOnFocus&&Ie>Te&&P()&&(Te=Ie+B().focusThrottleInterval,Se())}else if(De==oN)B().revalidateOnReconnect&&P()&&Se();else{if(De==lN)return ke();if(De==mw)return ke(Le)}});return A.current=!1,T.current=k,R.current=!0,D({_k:E}),Me&&(w[k]||(St(Z)||Vl?Se():BP(Se))),()=>{A.current=!0,Ee()}},[k]),hh(()=>{let Se;function Te(){const Ee=fa(g)?g(U().data):g;Ee&&Se!==-1&&(Se=setTimeout(je,Ee))}function je(){!U().error&&(h||B().isVisible())&&(b||B().isOnline())?ke(vh).then(Te):Te()}return Te(),()=>{Se&&(clearTimeout(Se),Se=-1)}},[g,h,b,k]),x.useDebugValue(te),c){if(!hw&&Vl&&re)throw new Error("Fallback data is required when using Suspense in SSR.");re&&(z.current=t,O.current=a,A.current=!1);const Se=S[k],Te=!St(Se)&&re?Be(Se):Mf;if(_h(Te),!St(W)&&re)throw W;const je=re?ke(vh):Mf;!St(te)&&re&&(je.status="fulfilled",je.value=!0),_h(je)}return{mutate:Be,get data(){return H.data=!0,te},get error(){return H.error=!0,W},get isValidating(){return H.isValidating=!0,ge},get isLoading(){return H.isLoading=!0,Ce}}},qe=tL(aL);let ti=null;function So(e){ti=e}function E_(){return ti}class cu extends Error{status;body;constructor(t,a,o){super(a),this.status=t,this.body=o}}async function dc(e,t,a,o={}){const l={"content-type":"application/json",...ti?{authorization:`Bearer ${ti}`}:{},...o.headers||{}},c=await fetch(t,{...o,method:e,headers:l,body:a!==void 0?JSON.stringify(a):void 0});if(!c.ok){let d="",p=null;try{p=await c.json(),d=p?.error||JSON.stringify(p)}catch{d=await c.text()}throw new cu(c.status,`${e} ${t} → ${c.status}: ${d}`,p)}if(c.status!==204)return await c.json()}function Pl(e){const t=e;if(Array.isArray(e))return{items:e,total:e.length};if(t&&Array.isArray(t.data)){const a=t.data;return{items:a,total:typeof t.meta?.total=="number"?t.meta.total:a.length}}if(t&&Array.isArray(t.sessions)){const a=t.sessions;return{items:a,total:a.length}}return{items:[],total:0}}const ne={get:e=>dc("GET",e),post:(e,t)=>dc("POST",e,t),put:(e,t)=>dc("PUT",e,t),patch:(e,t)=>dc("PATCH",e,t),del:e=>dc("DELETE",e)};async function mN(e,t,a,o){const l=await fetch(e,{method:"POST",signal:o,headers:{"content-type":"application/json",...ti?{authorization:`Bearer ${ti}`}:{}},body:JSON.stringify(t)});if(!l.ok||!l.body){const m=await l.text().catch(()=>"");throw new cu(l.status,`POST ${e} → ${l.status}: ${m||"stream failed"}`)}const c=l.body.getReader(),d=new TextDecoder("utf-8");let p="";for(;;){const{value:m,done:g}=await c.read();if(g)break;p+=d.decode(m,{stream:!0});let h=p.indexOf(`
|
|
766
|
+
`);for(;h>=0;){const b=p.slice(0,h).trim();if(p=p.slice(h+1),b)try{a(JSON.parse(b))}catch{}h=p.indexOf(`
|
|
767
|
+
`)}}if(p.trim())try{a(JSON.parse(p.trim()))}catch{}}const rL={get:()=>ne.get("/health")},Qn={list:()=>ne.get("/projects"),register:e=>ne.post("/projects",{path:e}),remove:e=>ne.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>ne.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>ne.get(`/projects/${e}/config`),set:(e,t)=>ne.patch(`/projects/${e}/config`,{set:t}),unset:(e,t)=>ne.patch(`/projects/${e}/config`,{unset:t}),put:(e,t)=>ne.put(`/projects/${e}/config`,t)},apcProject:{set:(e,t,a)=>ne.patch(`/projects/${e}/apc-project`,{set:t,unset:a}),put:(e,t)=>ne.put(`/projects/${e}/apc-project`,t)},memory:{get:e=>ne.get(`/projects/${e}/memory`),put:(e,t)=>ne.put(`/projects/${e}/memory`,{body:t})}},cn={list:e=>ne.get(`/projects/${e}/agents`),get:(e,t)=>ne.get(`/projects/${e}/agents/${t}`),create:(e,t)=>ne.post(`/projects/${e}/agents`,t),update:(e,t,a)=>ne.patch(`/projects/${e}/agents/${encodeURIComponent(t)}`,a),remove:(e,t)=>ne.del(`/projects/${e}/agents/${encodeURIComponent(t)}`),chat:(e,t,a)=>ne.post(`/projects/${e}/agents/${encodeURIComponent(t)}/chat`,a),memory:{get:(e,t)=>ne.get(`/projects/${e}/agents/${t}/memory`),put:(e,t,a)=>ne.put(`/projects/${e}/agents/${t}/memory`,{body:a})},vault:e=>ne.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,t={},a="")=>ne.post("/agents/vault",{slug:e,fields:t,body:a}),vaultPatch:(e,t)=>ne.patch(`/agents/vault/${encodeURIComponent(e)}`,t),vaultRemove:e=>ne.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>ne.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,t)=>ne.post(`/projects/${e}/agents/import`,{slug:t})},zo={list:(e,t)=>ne.get(`/projects/${e}/agents/${t}/conversations`),get:(e,t,a)=>ne.get(`/projects/${e}/agents/${t}/conversations/${a}`),threads:e=>ne.get(`/projects/${e}/super-agent/threads`),thread:(e,t,a)=>ne.get(`/projects/${e}/super-agent/threads/${t}/${a}`),remove:(e,t,a)=>ne.del(`/projects/${e}/agents/${t}/conversations/${a}`),removeThread:(e,t,a)=>ne.del(`/projects/${e}/super-agent/threads/${t}/${a}`),compact:(e,t,a)=>ne.post(a?`/projects/${e}/agents/${t}/conversations/${a}/compact`:`/projects/${e}/agents/${t}/compact`,{})},zr={list:e=>ne.get(`/projects/${e}/routines`),get:(e,t)=>ne.get(`/projects/${e}/routines/${t}`),run:(e,t)=>ne.post(`/projects/${e}/routines/${t}/run`),enable:(e,t)=>ne.post(`/projects/${e}/routines/${t}/enable`),disable:(e,t)=>ne.post(`/projects/${e}/routines/${t}/disable`),upsert:(e,t)=>ne.post(`/projects/${e}/routines`,t),remove:(e,t)=>ne.del(`/projects/${e}/routines/${encodeURIComponent(t)}`)},Wn={list:(e,t="open")=>ne.get(`/projects/${e}/tasks?state=${t}`).then(a=>Pl(a).items),global:(e="open")=>ne.get(`/tasks?state=${e}`).then(t=>Pl(t).items),listPage:(e,{state:t,limit:a,offset:o})=>ne.get(`/projects/${e}/tasks?state=${t}&limit=${a}&offset=${o}`).then(l=>Pl(l)),globalPage:({state:e,limit:t,offset:a})=>ne.get(`/tasks?state=${e}&limit=${t}&offset=${a}`).then(o=>Pl(o)),get:(e,t)=>ne.get(`/projects/${e}/tasks/${t}`),add:(e,t)=>ne.post(`/projects/${e}/tasks`,t),patch:(e,t,a)=>ne.patch(`/projects/${e}/tasks/${t}`,{patch:a}),status:(e,t,a)=>ne.post(`/projects/${e}/tasks/${t}/status`,{status:a}),done:(e,t)=>ne.post(`/projects/${e}/tasks/${t}/done`),drop:(e,t)=>ne.post(`/projects/${e}/tasks/${t}/drop`),reopen:(e,t)=>ne.post(`/projects/${e}/tasks/${t}/reopen`),summary:e=>ne.get(`/projects/${e}/tasks-summary`)},Dr={list:e=>ne.get(`/projects/${e}/mcps`),check:e=>ne.get(`/projects/${e}/mcps/check`),add:(e,t,a)=>ne.post(`/projects/${e}/mcps?scope=${t}`,a),remove:(e,t,a="shared")=>ne.del(`/projects/${e}/mcps/${encodeURIComponent(t)}?scope=${a}`),test:(e,t)=>ne.post(`/projects/${e}/mcps/${encodeURIComponent(t)}/test`,{}),logs:(e,t)=>ne.get(`/projects/${e}/mcps/${encodeURIComponent(t)}/logs`)},bo=e=>`?scope=${e}`,Is={catalog:e=>ne.get(`/projects/${e}/integrations/catalog`),list:(e,t="project")=>ne.get(`/projects/${e}/integrations${bo(t)}`),status:(e,t,a="project")=>ne.get(`/projects/${e}/integrations/${t}${bo(a)}`),configure:(e,t,a,o)=>ne.post(`/projects/${e}/integrations/${t}/configure${bo(a)}`,o),validate:(e,t,a="project")=>ne.post(`/projects/${e}/integrations/${t}/validate${bo(a)}`,{}),deactivate:(e,t,a="project")=>ne.post(`/projects/${e}/integrations/${t}/deactivate${bo(a)}`,{}),action:(e,t,a,o="project")=>ne.post(`/projects/${e}/integrations/${t}/action/${a}${bo(o)}`,{}),remove:(e,t,a="project")=>ne.del(`/projects/${e}/integrations/${t}${bo(a)}`),asanaConfigure:(e,t,a)=>Is.configure(e,"asana",t,{personal_access_token:a.personalAccessToken,workspace_gid:a.workspaceGid}),asanaValidate:(e,t)=>Is.validate(e,"asana",t),asanaWorkspaces:(e,t)=>Is.action(e,"asana","workspaces",t)},Fc={list:(e,t={})=>ne.get(`/projects/${e}/vars${t.reveal?"?reveal=1":""}`),get:(e,t,a={})=>ne.get(`/projects/${e}/vars/${encodeURIComponent(t)}${a.reveal?"?reveal=1":""}`),upsert:(e,t)=>ne.post(`/projects/${e}/vars`,t),remove:(e,t,a="project")=>ne.del(`/projects/${e}/vars/${encodeURIComponent(t)}?scope=${a}`)},yh=e=>{const t=new URLSearchParams;for(const[o,l]of Object.entries(e))l!==void 0&&l!==""&&t.set(o,String(l));const a=t.toString();return a?`?${a}`:""},Of={global:(e={})=>ne.get(`/messages/global${yh(e)}`),project:(e,t={})=>ne.get(`/projects/${e}/messages${yh(t)}`),search:(e,t,a=50)=>ne.get(`/projects/${e}/messages/search${yh({q:t,limit:a})}`)},oL={global:e=>ne.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`).then(t=>({sessions:Pl(t).items})),page:({engine:e,q:t,deep:a,cwd:o,limit:l,offset:c})=>{const d=new URLSearchParams({limit:String(l),offset:String(c)});return e&&d.set("engine",e),t?.trim()&&d.set("q",t.trim()),a&&d.set("deep","1"),o?.trim()&&d.set("cwd",o.trim()),ne.get(`/sessions?${d.toString()}`).then(p=>Pl(p))}},lL={list:()=>ne.get("/tools")},Dn={channels:{list:()=>ne.get("/telegram/channels"),upsert:e=>ne.post("/telegram/channels",e),patch:(e,t)=>ne.patch(`/telegram/channels/${e}`,t),remove:e=>ne.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>ne.get("/telegram/contacts"),patch:(e,t)=>ne.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,t),remove:e=>ne.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>ne.get("/telegram/roles"),set:(e,t)=>ne.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:t}),remove:e=>ne.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>ne.get("/telegram/status"),start:()=>ne.post("/telegram/start"),stop:()=>ne.post("/telegram/stop"),send:e=>ne.post("/telegram/send",e)},Gc={list:()=>ne.get("/engines"),presets:()=>ne.get("/engines/presets"),models:e=>ne.post("/engines/models",e)},iL=Object.freeze(Object.defineProperty({__proto__:null,Engines:Gc},Symbol.toStringTag,{value:"Module"})),ni={reload:()=>ne.post("/admin/reload"),shutdown:()=>ne.post("/admin/shutdown"),config:{get:()=>ne.get("/admin/config"),patch:e=>ne.patch("/admin/config",e)},superAgent:()=>ne.get("/admin/super-agent"),logs:(e="errors",t=200)=>ne.get(`/admin/logs?file=${e}&limit=${t}`)},si={list:()=>ne.get("/pair/list"),revoke:e=>ne.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>ne.post("/pair/init",{}),status:e=>ne.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>ne.post("/pair/confirm",e)},_w={get:()=>ne.get("/identity"),patch:e=>ne.patch("/identity",e)},gN={send:(e,t)=>ne.post(`/projects/${e}/super-agent/chat`,t),stream:(e,t,a,o)=>mN(`/projects/${e}/super-agent/chat/stream`,t,a,o),summarize:e=>ne.post("/super-agent/summarize",e)},vw={dirs:e=>ne.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`),pickDir:e=>ne.get(`/admin/fs/pick-dir${e?`?prompt=${encodeURIComponent(e)}`:""}`)},cL=["alloy","echo","fable","onyx","nova","shimmer"],uL=["Kore","Puck","Charon","Fenrir","Aoede"],dL=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],fL=["tts-1","tts-1-hd"],pL=["happy","sad","excited","angry","calm","whisper","shout","laugh","cry","narrator","neutral"],mL=["tiny","base","small","medium","large-v2","large-v3","large-v3-turbo"],zf={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 gL(e){const t=E_(),a=await fetch(`/voice/tts?path=${encodeURIComponent(e)}`,{headers:t?{authorization:`Bearer ${t}`}:{}});if(!a.ok){const l=await a.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${a.status}): ${l.slice(0,160)}`)}const o=await a.blob();return URL.createObjectURL(o)}const Df={providers:()=>ne.get("/tts/providers"),sttHardware:()=>ne.get("/transcribe/hardware"),sttModels:e=>ne.get(`/transcribe/models?backend=${e}`),say:e=>ne.post("/tts/say",e),turn:e=>ne.post("/voice/turn",e)},hN={manifest:()=>ne.get("/deck/manifest"),setWidget:(e,t)=>ne.patch(`/deck/widgets/${encodeURIComponent(e)}`,t),exec:e=>ne.post("/deck/exec",e)},_o=e=>`/projects/${e}/code/sessions`,Ya={sessions:{list:e=>ne.get(_o(e)).then(t=>t.sessions),get:(e,t)=>ne.get(`${_o(e)}/${t}`),create:(e,t={})=>ne.post(_o(e),t),update:(e,t,a)=>ne.patch(`${_o(e)}/${t}`,a),remove:(e,t)=>ne.del(`${_o(e)}/${t}`)},changes:(e,t)=>ne.get(`${_o(e)}/${t}/changes`),stream:(e,t,a,o,l)=>mN(`${_o(e)}/${t}/chat/stream`,a,o,l)},Xs={list:e=>ne.get(`/projects/${encodeURIComponent(e)}/artifacts`),read:(e,t)=>ne.get(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),run:(e,t,a=[])=>ne.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/run`,{args:a}),remove:(e,t)=>ne.del(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`),write:(e,t,a)=>ne.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{content:a}),rename:(e,t,a)=>ne.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}`,{newName:a}),preview:(e,t,a=!0)=>ne.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(t)}/preview`,{watch:a}),previews:e=>ne.get(`/projects/${encodeURIComponent(e)}/previews`),stopPreview:e=>ne.del(`/previews/${encodeURIComponent(e)}`),openTunnel:(e,t)=>ne.post(`/previews/${encodeURIComponent(e)}/tunnel`,{provider:t}),closeTunnel:e=>ne.del(`/previews/${encodeURIComponent(e)}/tunnel`)},Bs={list:e=>{const t=new URLSearchParams;e&&(t.set("project_path",e),t.set("scope",e));const a=t.toString();return ne.get(a?`/skills?${a}`:"/skills")},detail:(e,t)=>{const a=t?`?project_path=${encodeURIComponent(t)}`:"";return ne.get(`/skills/${encodeURIComponent(e)}/detail${a}`)},setEnabled:e=>ne.put("/skills/enabled",e),create:e=>ne.post("/skills",e),importZip:e=>ne.post("/skills/import/zip",e),importRepo:e=>ne.post("/skills/import/repo",e),remove:(e,t)=>{const a=t?`?project_path=${encodeURIComponent(t)}`:"";return ne.del(`/skills/${encodeURIComponent(e)}${a}`)},inspector:()=>ne.get("/skills/inspector"),updateInspector:e=>ne.put("/skills/inspector",e),index:(e={})=>ne.post("/skills/index",e),inspect:(e,t)=>ne.post("/skills/inspect",{prompt:e,project_path:t})},Br={get:e=>ne.get(`/projects/${e}/organization`),createArea:(e,t)=>ne.post(`/projects/${e}/organization/areas`,t),updateArea:(e,t,a)=>ne.patch(`/projects/${e}/organization/areas/${encodeURIComponent(t)}`,a),removeArea:(e,t)=>ne.del(`/projects/${e}/organization/areas/${encodeURIComponent(t)}`),createRole:(e,t)=>ne.post(`/projects/${e}/organization/roles`,t),updateRole:(e,t,a)=>ne.patch(`/projects/${e}/organization/roles/${encodeURIComponent(t)}`,a),removeRole:(e,t)=>ne.del(`/projects/${e}/organization/roles/${encodeURIComponent(t)}`)},kc={tree:(e,t="project")=>ne.get(`/projects/${e}/fs/tree?scope=${t}`),read:(e,t,a="project")=>ne.get(`/projects/${e}/fs/file?scope=${a}&path=${encodeURIComponent(t)}`),write:(e,t,a,o="project")=>ne.put(`/projects/${e}/fs/file`,{scope:o,path:t,content:a}),mkdir:(e,t,a="project")=>ne.post(`/projects/${e}/fs/dir`,{scope:a,path:t}),remove:(e,t,a="project")=>ne.del(`/projects/${e}/fs/entry?scope=${a}&path=${encodeURIComponent(t)}`)};function uu(){const{data:e,error:t,isLoading:a,mutate:o}=qe("/projects",()=>Qn.list(),{refreshInterval:Zf.projects});return{projects:(e||[]).slice().sort((c,d)=>{const p=Number(c.id),m=Number(d.id);return p===0&&m!==0?-1:m===0&&p!==0?1:p-m}),error:t,isLoading:a,mutate:o}}function du(e){const{projects:t,isLoading:a,mutate:o}=uu();return{project:t.find(c=>String(c.id)===e)??null,isLoading:a,mutate:o}}function R_(){const{data:e,error:t,isLoading:a,mutate:o}=qe("/identity",()=>_w.get());return{identity:e||{},error:t,isLoading:a,mutate:o,save:async c=>{const d=await _w.patch(c);return await o(d,{revalidate:!1}),d}}}function Sp(){const{identity:e}=R_();return e?.agent_name?.trim()||"APX"}function hL(){return[{id:"desktop",label:u("nav.modules.desktop"),href:"/m/desktop",icon:vb},{id:"code",label:u("nav.modules.code"),href:"/m/code",icon:ba}]}function xL(e,t,a){const[o,l]=x.useState(t);return x.useLayoutEffect(()=>{const c=e.current;if(!c||!a)return;const d=()=>{const m=getComputedStyle(c),g=(parseFloat(m.paddingTop)||0)+(parseFloat(m.paddingBottom)||0),h=c.clientHeight-g;if(h<=0)return;const b=parseFloat(m.rowGap)||12,j=(c.querySelector("[data-rail-probe]")?.offsetHeight??56)+b,y=Math.max(0,Math.floor((h+b)/j))-1;l(y>=t?t:Math.max(0,y-1))};d();const p=new ResizeObserver(d);return p.observe(c),()=>p.disconnect()},[e,t,a]),a?Math.min(o,t):t}function yw({projects:e,label:t,sublabel:a,icon:o,tooltip:l,header:c,active:d,testId:p,onSelect:m,isActive:g}){return s.jsxs(v_,{children:[s.jsxs(y_,{"data-testid":p,title:l,"aria-label":l,className:"group flex w-full cursor-pointer flex-col items-center gap-1",children:[s.jsx("span",{className:he("flex size-10 items-center justify-center rounded-xl text-xs font-bold transition-all","bg-muted/40 text-muted-fg hover:bg-accent hover:text-foreground",d&&"ring-2 ring-foreground ring-offset-2 ring-offset-card"),children:o??t}),a&&s.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:a})]}),s.jsxs(j_,{side:"right",align:"start",sideOffset:8,className:"max-h-[70vh] w-64",children:[s.jsx("div",{className:"px-1.5 py-1 text-xs font-medium text-muted-foreground",children:c}),e.map(h=>{const b=h.name||h.path.split("/").pop()||String(h.id),_=`/p/${h.id}`,{initials:j,idleClass:N}=kD(b);return s.jsxs(lf,{"data-testid":`project-menu-item-${h.id}`,onClick:()=>m(_),className:he(g(_)&&"bg-accent/60 text-foreground"),children:[s.jsx("span",{className:he("flex size-6 shrink-0 items-center justify-center rounded-md text-[10px] font-bold",N),children:j}),s.jsx("span",{className:"truncate",children:b})]},h.id)})]})]})}function bL({onSelect:e,onOpenRoby:t,onOpenAddProject:a}){const{projects:o,isLoading:l}=uu(),c=ts(),d=hL(),p=Sp(),m=x.useRef(null),{collapsed:g,toggle:h}=S_(zn.sidebarCollapsed+".projects"),b=k=>c.pathname===k||c.pathname.startsWith(`${k}/`),_=o.find(k=>String(k.id)==="0"),j=o.filter(k=>String(k.id)!=="0").sort((k,E)=>Number(E.id)-Number(k.id)),N=xL(m,j.length,!g&&j.length>0),y=j.slice(0,N),w=j.slice(N),S=w.some(k=>b(`/p/${k.id}`));return s.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-hidden bg-transparent py-3",children:[s.jsx($e,{content:u("nav.apx_admin"),side:"right",children:s.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:s.jsx(C3,{size:36})})}),l&&s.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),_&&s.jsx(Al,{label:u("base.title"),testId:"project-avatar-0",title:u("base.subtitle"),active:b("/p/0"),isDefault:!0,icon:s.jsx("img",{src:"/modules/superagent.png",alt:u("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),d.map(k=>s.jsx(Al,{label:k.label,testId:`module-avatar-${k.id}`,title:k.label,active:b(k.href),icon:s.jsx(k.icon,{size:18}),onClick:()=>e(k.href)},k.id)),s.jsxs("div",{className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3",children:[j.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),s.jsx($e,{content:u(g?"nav.expand_projects":"nav.collapse_projects"),side:"right",children:s.jsx("button",{type:"button",onClick:h,"data-testid":"nav-toggle-projects","aria-label":u(g?"nav.expand_projects":"nav.collapse_projects"),"aria-expanded":!g,className:"flex h-5 w-8 cursor-pointer items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:s.jsx(ms,{className:he("size-3.5 transition-transform",g&&"-rotate-90")})})})]}),s.jsxs("div",{ref:m,className:"flex min-h-0 w-full flex-1 flex-col items-center gap-3 overflow-hidden py-1.5",children:[j.length>0&&g&&s.jsx(yw,{projects:j,icon:s.jsx(VM,{size:18}),sublabel:String(j.length),tooltip:u("nav.all_projects"),header:u("nav.all_projects"),active:j.some(k=>b(`/p/${k.id}`)),testId:"nav-projects-folder",onSelect:e,isActive:b}),j.length>0&&!g&&s.jsxs(s.Fragment,{children:[s.jsx("div",{"data-rail-probe":!0,"aria-hidden":!0,className:"invisible absolute w-full",children:s.jsx(Al,{label:"Ag",active:!1,onClick:()=>{}})}),y.map(k=>{const E=k.name||k.path.split("/").pop()||String(k.id),R=`/p/${k.id}`;return s.jsx("div",{"data-rail-item":!0,className:"w-full",children:s.jsx(Al,{label:E,testId:`project-avatar-${k.id}`,title:`${E} — ${k.path}`,active:b(R),onClick:()=>e(R)})},k.id)}),w.length>0&&s.jsx(yw,{projects:w,label:`+${w.length}`,tooltip:u("nav.more_projects",{count:w.length}),header:u("nav.more_projects",{count:w.length}),active:S,testId:"nav-projects-overflow",onSelect:e,isActive:b})]}),s.jsx(Al,{label:u("nav.add_project"),isAdd:!0,testId:"nav-add-project",icon:s.jsx(It,{size:18}),active:!1,onClick:()=>a?a():e("/?action=add-project"),title:u("nav.add_project")})]})]}),s.jsx(Al,{label:u("nav.settings"),isSettings:!0,testId:"nav-settings",icon:s.jsx(Wf,{size:16}),active:c.pathname==="/settings"||c.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:u("nav.settings")}),s.jsx($e,{content:u("settings_ui.documentation"),side:"right",children:s.jsx("a",{href:"https://agentprojectcontext.github.io/apx/docs/",target:"_blank",rel:"noopener noreferrer","data-testid":"nav-docs","aria-label":u("settings_ui.documentation"),className:"flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:s.jsx(vM,{size:18})})}),s.jsx($e,{content:u("superagent.talk",{persona:p}),side:"right",children:s.jsx("button",{type:"button",onClick:t,"data-testid":"nav-roby","aria-label":u("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:s.jsx(un,{size:18})})})]})}function xN(e){switch(e){case"personal":return u("settings_ui.kind_personal");case"company":return u("settings_ui.kind_company");case"app":return u("settings_ui.kind_app");case"software":return u("settings_ui.kind_software");case"default":return u("settings_ui.kind_default");case"other":return u("settings_ui.kind_other");default:return u("nav.project")}}function Ye({title:e,description:t,action:a,className:o,children:l,fullHeight:c}){return s.jsxs("section",{className:he("rounded-xl border border-border bg-card p-5",c&&"flex h-full min-h-0 flex-col",o),children:[s.jsxs("header",{className:he("mb-4 flex items-start justify-between gap-4",c&&"shrink-0"),children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),t&&s.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:t})]}),a]}),s.jsx("div",{className:he(c&&"flex min-h-0 flex-1 flex-col"),children:l})]})}function jw({children:e}){return s.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 fu({ok:e}){return s.jsx("span",{className:he("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const _L=x.forwardRef(function(t,a){const{render:o,className:l,disabled:c=!1,focusableWhenDisabled:d=!1,nativeButton:p=!0,style:m,...g}=t,{getButtonProps:h,buttonRef:b}=Zr({disabled:c,focusableWhenDisabled:d,native:p});return Et("button",t,{state:{disabled:c},ref:[a,b],props:[g,h]})}),ww=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,kw=Uc,T_=(e,t)=>a=>{var o;if(t?.variants==null)return kw(e,a?.class,a?.className);const{variants:l,defaultVariants:c}=t,d=Object.keys(l).map(g=>{const h=a?.[g],b=c?.[g];if(h===null)return null;const _=ww(h)||ww(b);return l[g][_]}),p=a&&Object.entries(a).reduce((g,h)=>{let[b,_]=h;return _===void 0||(g[b]=_),g},{}),m=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((g,h)=>{let{class:b,className:_,...j}=h;return Object.entries(j).every(N=>{let[y,w]=N;return Array.isArray(w)?w.includes({...c,...p}[y]):{...c,...p}[y]===w})?[...g,b,_]:g},[]);return kw(e,d,m,a?.class,a?.className)},vL=T_("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 ar({className:e,variant:t="default",size:a="default",...o}){return s.jsx(_L,{"data-slot":"button",className:Ct(vL({variant:t,size:a,className:e})),...o})}let Sw=(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 yL={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Sc={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},jL={disabled:!1,...Sc},A_={valid(e){return e===null?null:e?{[Sw.valid]:""}:{[Sw.invalid]:""}}},wL={invalid:void 0,name:void 0,validityData:{state:yL,errors:[],error:"",value:"",initialValue:null},setValidityData:Mn,disabled:void 0,touched:Sc.touched,setTouched:Mn,dirty:Sc.dirty,setDirty:Mn,filled:Sc.filled,setFilled:Mn,focused:Sc.focused,setFocused:Mn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:jL,markedDirtyRef:{current:!1},registerFieldControl:Mn,validation:{getValidationProps:(e,t=Xt)=>t,inputRef:{current:null},registerInput:Mn,commit:async()=>{},change:Mn}},kL=x.createContext(wL);function pu(e=!0){const t=x.useContext(kL);if(t.setValidityData===Mn&&!e)throw new Error(ln(28));return t}const SL=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Mn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function M_(){return x.useContext(SL)}const CL=x.createContext({controlId:void 0,registerControlId:Mn,labelId:void 0,setLabelId:Mn,messageIds:[],setMessageIds:Mn,getDescriptionProps:e=>e});function Cp(){return x.useContext(CL)}function NL(e,t,a,o=!0,l){const[c,d]=x.useState(),p=na(l?`${l}-label`:void 0),m=e??t??c;return ze(()=>{const g=e||t||!o?void 0:EL(a.current,p);c!==g&&d(g)}),m}function EL(e,t){const a=RL(e);if(a)return!a.id&&t&&(a.id=t),a.id||void 0}function RL(e){if(!e)return;const t=e.parentElement;if(t&&t.tagName==="LABEL")return t;const a=e.id;if(a){const l=e.nextElementSibling;if(l&&l.htmlFor===a)return l}const o=e.labels;return o&&o[0]}function Np(e={}){const{id:t,implicit:a=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=Cp(),d=na(t),p=a?l:void 0,m=es(()=>Symbol("labelable-control")),g=x.useRef(!1),h=x.useRef(t!=null),b=Ue(()=>{!g.current||c===Mn||(g.current=!1,c(m.current,void 0))});return ze(()=>{if(c===Mn)return;let _;if(a){const j=o?.current;bt(j)&&j.closest("label")!=null?_=t??null:_=p??d}else if(t!=null)h.current=!0,_=t;else if(h.current)_=d;else{b();return}if(_===void 0){b();return}g.current=!0,c(m.current,_)},[t,o,p,c,a,d,m,b]),x.useEffect(()=>b,[b]),l??d}function O_(e,t,a,o,l=!0,c){const{registerFieldControl:d}=pu(),p=x.useRef(null);p.current||(p.current=Symbol()),ze(()=>{const m=p.current;return!m||!l?void 0:(d(m,{controlRef:e,getValue:o,id:t,name:c,value:a}),()=>{d(m,void 0)})},[e,l,o,t,c,d,a])}const TL=x.forwardRef(function(t,a){const{render:o,className:l,id:c,name:d,value:p,disabled:m=!1,onValueChange:g,defaultValue:h,autoFocus:b=!1,style:_,...j}=t,{state:N,name:y,disabled:w,setTouched:S,setDirty:k,validityData:E,setFocused:R,setFilled:A,validationMode:T,validation:z}=pu(),{clearErrors:O}=M_(),B=w||m,P=y??d,U={...N,disabled:B},{labelId:D}=Cp(),L=Np({id:c});ze(()=>{const K=p!=null;z.inputRef.current?.value||K&&p!==""?A(!0):K&&p===""&&A(!1)},[z.inputRef,A,p]);const V=x.useRef(null);ze(()=>{b&&V.current===Gn(xt(V.current))&&R(!0)},[b,R]);const[H]=ei({controlled:p,default:h,name:"FieldControl",state:"value"}),$=p!==void 0,F=$?H:void 0,Y=Ue(()=>z.inputRef.current?.value);return O_(z.inputRef,L,F,Y,!B,d),Et("input",t,{ref:[a,V],state:U,props:[{id:L,disabled:B,name:P,ref:z.inputRef,"aria-labelledby":D,autoFocus:b,...$?{value:F}:{defaultValue:h},onChange(K){const I=K.currentTarget.value;g?.(I,st(va,K.nativeEvent)),k(I!==E.initialValue),A(I!==""),K.nativeEvent.defaultPrevented||(O(P),z.change(I))},onFocus(){R(!0)},onBlur(K){S(!0),R(!1),T==="onBlur"&&z.commit(K.currentTarget.value)},onKeyDown(K){K.currentTarget.tagName==="INPUT"&&K.key==="Enter"&&(S(!0),z.commit(K.currentTarget.value))}},j,K=>z.getValidationProps(B,K)],stateAttributesMapping:A_})}),AL=x.forwardRef(function(t,a){return s.jsx(TL,{ref:a,...t})});function ML({className:e,type:t,...a}){return s.jsx(AL,{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),...a})}function OL({className:e,...t}){return s.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 zL(e){return Et(e.defaultTagName??"div",e,e)}const DL=T_("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 PL({className:e,variant:t="default",render:a,...o}){return zL({defaultTagName:"span",props:Kn({className:Ct(DL({variant:t}),e)},o),render:a,state:{slot:"badge",variant:t}})}const bN=x.createContext(void 0);function LL(){const e=x.useContext(bN);if(e===void 0)throw new Error(ln(63));return e}let Cw=(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 _N={...A_,checked(e){return e?{[Cw.checked]:""}:{[Cw.unchecked]:""}}},IL=x.forwardRef(function(t,a){const{checked:o,className:l,defaultChecked:c,"aria-labelledby":d,form:p,id:m,inputRef:g,name:h,nativeButton:b=!1,onCheckedChange:_,readOnly:j=!1,required:N=!1,disabled:y=!1,render:w,uncheckedValue:S,value:k,style:E,...R}=t,{clearErrors:A}=M_(),{state:T,setTouched:z,setDirty:O,validityData:B,setFilled:P,setFocused:U,validationMode:D,disabled:L,name:V,validation:H}=pu(),{labelId:$}=Cp(),F=L||y,Y=V??h,G=x.useRef(null),K=nr(G,g,H.inputRef),I=x.useRef(null),X=na(),Z=Np({id:m,implicit:!1,controlRef:I}),W=b?void 0:Z,[fe,te]=ei({controlled:o,default:!!c,name:"Switch",state:"checked"});O_(I,X,fe,void 0,!F,h),ze(()=>{G.current&&P(G.current.checked)},[G,P]),b_(fe,()=>{A(Y),O(fe!==B.initialValue),P(fe),H.change(fe)});const{getButtonProps:re,buttonRef:le}=Zr({disabled:F,native:b}),me=NL(d,$,G,!b,W),Me={id:b?Z:X,role:"switch","aria-checked":fe,"aria-readonly":j||void 0,"aria-required":N||void 0,"aria-labelledby":me,onFocus(){F||U(!0)},onBlur(){const ke=G.current;!ke||F||(z(!0),U(!1),D==="onBlur"&&H.commit(ke.checked))},onClick(ke){if(j||F)return;ke.preventDefault();const Be=G.current;Be&&Be.dispatchEvent(new(Wt(Be)).PointerEvent("click",{bubbles:!0,shiftKey:ke.shiftKey,ctrlKey:ke.ctrlKey,altKey:ke.altKey,metaKey:ke.metaKey}))}},de=Kn({checked:fe,disabled:F,form:p,id:W,name:Y,required:N,style:Y?j2:Bb,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:K,onChange(ke){if(ke.nativeEvent.defaultPrevented)return;if(j){ke.preventDefault();return}const Be=ke.currentTarget.checked,Ve=st(va,ke.nativeEvent);_?.(Be,Ve),!Ve.isCanceled&&te(Be)},onFocus(){I.current?.focus()}},ke=>H.getValidationProps(F,ke),k!==void 0?{value:k}:Xt),ge=x.useMemo(()=>({...T,checked:fe,disabled:F,readOnly:j,required:N}),[T,fe,F,j,N]),Ce=Et("span",t,{state:ge,ref:[a,I,le],props:[Me,R,re,ke=>H.getValidationProps(F,ke)],stateAttributesMapping:_N});return s.jsxs(bN.Provider,{value:ge,children:[Ce,!fe&&Y&&S!==void 0&&s.jsx("input",{type:"hidden",form:p,name:Y,value:S,disabled:F}),s.jsx("input",{...de,suppressHydrationWarning:!0})]})}),BL=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...d}=t,p=LL();return Et("span",t,{state:p,ref:a,stateAttributesMapping:_N,props:d})});function UL({className:e,size:t="default",...a}){return s.jsx(IL,{"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),...a,children:s.jsx(BL,{"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 $L({className:e,...t}){return s.jsx(Ir,{role:"status","aria-label":"Loading",className:Ct("size-4 animate-spin",e),...t})}const vN=x.createContext(!1),yN=x.createContext(void 0);function qo(e){const t=x.useContext(yN);if(e===!1&&t===void 0)throw new Error(ln(27));return t}const HL={...Ho,...or},jN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,forceRender:d=!1,...p}=t,{store:m}=qo(),g=m.useState("open"),h=m.useState("nested"),b=m.useState("mounted"),_=m.useState("transitionStatus");return Et("div",t,{state:{open:g,transitionStatus:_},ref:[m.context.backdropRef,a],stateAttributesMapping:HL,props:[{role:"presentation",hidden:!b,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:d||!h})}),Ep=x.forwardRef(function(t,a){const{render:o,className:l,style:c,disabled:d=!1,nativeButton:p=!0,...m}=t,{store:g}=qo(),h=g.useState("open"),{getButtonProps:b,buttonRef:_}=Zr({disabled:d,native:p}),j={disabled:d};function N(y){h&&g.setOpen(!1,st(N4,y.nativeEvent))}return Et("button",t,{state:j,ref:[a,_],props:[{onClick:N},m,b]})}),wN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,id:d,...p}=t,{store:m}=qo(),g=na(d);return m.useSyncedValueWithCleanup("descriptionElementId",g),Et("p",t,{ref:a,props:[{id:g},p]})});let qL=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),VL=(function(e){return e[e.open=Co.open]="open",e[e.closed=Co.closed]="closed",e[e.startingStyle=Co.startingStyle]="startingStyle",e[e.endingStyle=Co.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const kN=x.createContext(void 0);function FL(){const e=x.useContext(kN);if(e===void 0)throw new Error(ln(26));return e}const GL={...Ho,...or,nestedDialogOpen(e){return e?{[VL.nestedDialogOpen]:""}:null}},SN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,finalFocus:d,initialFocus:p,...m}=t,{store:g}=qo(),h=g.useState("descriptionElementId"),b=g.useState("disablePointerDismissal"),_=g.useState("floatingRootContext"),j=g.useState("popupProps"),N=g.useState("modal"),y=g.useState("mounted"),w=g.useState("nested"),S=g.useState("nestedOpenDialogCount"),k=g.useState("open"),E=g.useState("openMethod"),R=g.useState("titleElementId"),A=g.useState("transitionStatus"),T=g.useState("role"),z=_.useState("floatingId"),O=m.id??z;FL(),ka({open:k,ref:g.context.popupRef,onComplete(){k&&g.context.onOpenChangeComplete?.(!0)}});const B=p===void 0?Mz(g.context.popupRef):p,P=S>0,U=g.useStateSetter("popupElement"),L=Et("div",t,{state:{open:k,nested:w,transitionStatus:A,nestedDialogOpen:P},props:[j,{id:O,"aria-labelledby":R??void 0,"aria-describedby":h??void 0,role:T,...mp,hidden:!y,onKeyDown(V){jp.has(V.key)&&V.stopPropagation()},style:{[qL.nestedDialogs]:S}},m],ref:[a,g.context.popupRef,U],stateAttributesMapping:GL});return s.jsx(Wb,{context:_,openInteractionType:E,disabled:!y,closeOnFocusOut:!b,initialFocus:B,returnFocus:d,modal:N!==!1,restoreFocus:"popup",children:L})}),CN=x.forwardRef(function(t,a){const{keepMounted:o=!1,...l}=t,{store:c}=qo(),d=c.useState("mounted"),p=c.useState("modal"),m=c.useState("open");return d||o?s.jsx(kN.Provider,{value:o,children:s.jsxs(Kb,{ref:a,...l,children:[d&&p===!0&&s.jsx(x_,{ref:c.context.internalBackdropRef,inert:bp(!m)}),t.children]})}):null});function YL(e){const{store:t,actionsRef:a}=e,o=t.useState("open");Dz(t,o),t_(t);const{forceUnmount:l}=n_(o,t),c=x.useCallback(()=>{t.setOpen(!1,st(Lb))},[t]);x.useImperativeHandle(a,()=>({unmount:l,close:c}),[l,c])}function KL({store:e,parentContext:t,isDrawer:a}){const o=e.useState("open"),l=e.useState("disablePointerDismissal"),c=e.useState("modal"),d=e.useState("popupElement"),p=e.useState("floatingRootContext"),[m,g]=x.useState(0),[h,b]=x.useState(0),_=m===0,j=up(p,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:c==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(S){if(!e.context.outsidePressEnabledRef.current||"button"in S&&S.button!==0||"touches"in S&&S.touches.length!==1)return!1;const k=qn(S);return _&&!l?c&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===k||e.context.backdropRef.current===k||We(k,d)&&!k?.hasAttribute("data-base-ui-portal"):!0:!1},escapeKey:_});YC(o&&c===!0,d),e.useContextCallback("onNestedDialogOpen",(S,k)=>{g(S),b(k)}),e.useContextCallback("onNestedDialogClose",()=>{g(0),b(0)}),x.useEffect(()=>(t?.onNestedDialogOpen&&o&&t.onNestedDialogOpen(m+1,h+(a?1:0)),t?.onNestedDialogClose&&!o&&t.onNestedDialogClose(),()=>{t?.onNestedDialogClose&&o&&t.onNestedDialogClose()}),[a,o,m,h,t]);const N=j.reference??Xt,y=j.trigger??Xt,w=j.floating??Xt;return s_(e,{activeTriggerProps:N,inactiveTriggerProps:y,popupProps:w,nestedOpenDialogCount:m,nestedOpenDrawerCount:h}),null}const XL={...o_,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 z_ extends fp{constructor(t,a,o=!1){const l=new ou,c=QL(t);c.floatingRootContext=pC(l,a,o),super(c,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:l,onOpenChange:void 0,onOpenChangeComplete:void 0},XL)}setOpen=(t,a)=>{if(a.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&a.trigger==null&&this.state.activeTriggerId!=null&&(a.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(t,a),a.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(t,a);const o={open:t};e_(o,t,a.trigger),this.update(o)};static useStore(t,a){return cC(t,(l,c)=>new z_(a,l,c),!0).store}}function QL(e={}){return{...a_(),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 WL(e,t="dialog"){const{children:a,open:o,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:d,disablePointerDismissal:p=!1,modal:m=!0,actionsRef:g,handle:h,triggerId:b,defaultTriggerId:_=null}=e,j=t==="drawer",N=t==="alert-dialog",y=N?!0:m,w=N||p,S=N?"alertdialog":"dialog",k=qo(!0),R={modal:y,disablePointerDismissal:w,nested:!!k,role:S},A=z_.useStore(h?.store,{open:l,openProp:o,activeTriggerId:_,triggerIdProp:b,...R});Jb(()=>{const U=o===void 0&&A.state.open===!1&&l===!0?{open:!0,activeTriggerId:_}:null;N?A.update(U?{...R,...U}:R):U&&A.update(U)}),A.useControlledProp("openProp",o),A.useControlledProp("triggerIdProp",b),A.useSyncedValues(R),A.useContextCallback("onOpenChange",c),A.useContextCallback("onOpenChangeComplete",d);const T=A.useState("open"),z=A.useState("mounted"),O=A.useState("payload");YL({store:A,actionsRef:g});const B=T||z,P=x.useMemo(()=>({store:A}),[A]);return s.jsx(vN.Provider,{value:!1,children:s.jsxs(yN.Provider,{value:P,children:[B&&s.jsx(KL,{store:A,parentContext:k?.store.context,isDrawer:j}),typeof a=="function"?a({payload:O}):a]})})}function NN(e){const t=x.useContext(vN)?"drawer":"dialog";return WL(e,t)}const EN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,id:d,...p}=t,{store:m}=qo(),g=na(d);return m.useSyncedValueWithCleanup("titleElementId",g),Et("h2",t,{ref:a,props:[{id:g},p]})});function Bx({...e}){return s.jsx(NN,{"data-slot":"dialog",...e})}function ZL({...e}){return s.jsx(CN,{"data-slot":"dialog-portal",...e})}function JL({...e}){return s.jsx(Ep,{"data-slot":"dialog-close",...e})}function e6({className:e,...t}){return s.jsx(jN,{"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 Ux({className:e,children:t,showCloseButton:a=!0,...o}){return s.jsxs(ZL,{children:[s.jsx(e6,{}),s.jsxs(SN,{"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,a&&s.jsxs(Ep,{"data-slot":"dialog-close",render:s.jsx(ar,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[s.jsx(Ss,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function $x({className:e,...t}){return s.jsx("div",{"data-slot":"dialog-header",className:Ct("flex flex-col gap-2",e),...t})}function Nw({className:e,showCloseButton:t=!1,children:a,...o}){return s.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:[a,t&&s.jsx(Ep,{render:s.jsx(ar,{variant:"outline"}),children:"Close"})]})}function Hx({className:e,...t}){return s.jsx(EN,{"data-slot":"dialog-title",className:Ct("font-heading text-base leading-none font-medium",e),...t})}function t6({className:e,...t}){return s.jsx(wN,{"data-slot":"dialog-description",className:Ct("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}const n6={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},s6={sm:"sm",md:"default"};function se({variant:e="secondary",size:t="md",loading:a,className:o,children:l,disabled:c,type:d="button",...p}){return s.jsxs(ar,{type:d,variant:n6[e],size:s6[t],disabled:c||a,className:o,...p,children:[a?s.jsx(_n,{size:14}):null,l]})}function Ne(e){return s.jsx(ML,{...e})}function on(e){return s.jsx(OL,{...e})}function a6(e){return s.jsx("select",{...e,className:he("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 ae({label:e,hint:t,badge:a,children:o}){return s.jsxs("div",{className:"block space-y-1",children:[s.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,a&&s.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:a})]}),o,t&&s.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:t})]})}function Bt({checked:e,onChange:t,label:a,disabled:o}){return s.jsxs("label",{className:he("inline-flex items-center gap-2",o&&"opacity-50"),children:[s.jsx(UL,{checked:e,onCheckedChange:t,disabled:o}),a&&s.jsx("span",{className:"text-sm",children:a})]})}function He({children:e,tone:t="muted",className:a}){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 s.jsx(PL,{variant:o,className:he("rounded-md",l[t],a),children:e})}function Zt({open:e,onClose:t,title:a,description:o,children:l,footer:c,size:d="md"}){const p={sm:"sm:max-w-md",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl"};return s.jsx(Bx,{open:e,onOpenChange:m=>{m||t()},children:s.jsxs(Ux,{className:he("flex max-h-[88vh] w-full flex-col gap-0 p-0",p[d]),children:[(a||o)&&s.jsxs($x,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[a&&s.jsx(Hx,{children:a}),o&&s.jsx(t6,{children:o})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:l}),c&&s.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function _n({size:e=14}){return s.jsx($L,{style:{width:e,height:e}})}function pt({children:e}){return s.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 s.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[s.jsx(_n,{})," ",e]})}const RN=x.createContext(null);let r6=1;function o6({children:e}){const[t,a]=x.useState([]),o=x.useCallback((c,d)=>{const p=r6++;a(m=>[...m,{id:p,kind:c,message:d}]),setTimeout(()=>{a(m=>m.filter(g=>g.id!==p))},4500)},[]),l=x.useMemo(()=>({show:o,success:c=>o("success",c),error:c=>o("error",c),info:c=>o("info",c)}),[o]);return x.useEffect(()=>(window.__apxToast=l,()=>{delete window.__apxToast}),[l]),s.jsxs(RN.Provider,{value:l,children:[e,s.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=>s.jsx("div",{className:he("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:s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("span",{className:he("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")}),s.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function Ze(){const e=x.useContext(RN);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function TN(){const{data:e,error:t,isLoading:a}=qe("/health",()=>rL.get(),{refreshInterval:Zf.health});return{health:e,error:t,isLoading:a,isUp:!t&&!!e}}function l6(){const{data:e,error:t,isLoading:a,mutate:o}=qe("/engines",()=>Gc.list());return{engines:e?.engines||[],error:t,isLoading:a,mutate:o}}function i6(){const{data:e,error:t,isLoading:a,mutate:o}=qe("/telegram/status",()=>Dn.status(),{refreshInterval:Zf.telegramStatus});return{status:e,error:t,isLoading:a,mutate:o}}function D_(){const{data:e,error:t,isLoading:a,mutate:o}=qe("/telegram/channels",()=>Dn.channels.list());return{channels:e?.channels||[],error:t,isLoading:a,mutate:o}}function P_(){const{data:e,error:t,isLoading:a,mutate:o}=qe("/telegram/contacts",()=>Dn.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:t,isLoading:a,mutate:o}}function ds(e){return typeof e=="string"&&e.startsWith("*** set ***")}function Ur(e,t="(no seteada)"){return ds(e)?e:t}function Do(e){if(typeof e!="string")return null;const t=e.match(/\(\.\.\.([^)]+)\)/);return t?t[1]:null}function AN({channel:e,onClose:t,onSaved:a}){const o=Ze(),[l,c]=x.useState(!1),[d,p]=x.useState({name:""});x.useEffect(()=>{p(e?{...e,bot_token:""}:{name:""})},[e?.name]);const m=async()=>{if(!d.name?.trim()){o.error(u("telegram_channel_dialog.name_required"));return}c(!0);try{e&&e.name!==""&&e?.name===d.name?await Dn.channels.patch(e.name,d):await Dn.channels.upsert(d),o.success(u("telegram_channel_dialog.saved")),a()}catch(g){o.error(g.message)}finally{c(!1)}};return s.jsx(Zt,{open:!!e,onClose:t,title:e?.name?u("telegram_channel_dialog.edit_title",{name:e.name}):u("telegram_channel_dialog.new_title"),description:u("telegram_ui.channel_dialog_desc"),footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:l,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:m,loading:l,children:u("common.save")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("telegram_channel_dialog.name_label"),children:s.jsx(Ne,{value:d.name,onChange:g=>p({...d,name:g.target.value}),disabled:!!e?.name})}),s.jsx(ae,{label:u("telegram_channel_dialog.token_label"),hint:e?.bot_token?Ur(e.bot_token):u("telegram_ui.bot_token_hint"),children:s.jsx(Ne,{type:"password",value:d.bot_token||"",onChange:g=>p({...d,bot_token:g.target.value}),placeholder:e?.bot_token?Ur(e.bot_token):""})}),s.jsx(ae,{label:u("telegram_channel_dialog.chat_id"),children:s.jsx(Ne,{value:d.chat_id||"",onChange:g=>p({...d,chat_id:g.target.value})})}),s.jsx(ae,{label:u("telegram_channel_dialog.project_label"),hint:u("telegram_channel_dialog.project_hint"),children:s.jsx(Ne,{value:d.project||"",onChange:g=>p({...d,project:g.target.value})})}),s.jsx(ae,{label:u("telegram_channel_dialog.route_label"),hint:u("telegram_channel_dialog.route_hint"),children:s.jsx(Ne,{value:d.route_to_agent||"",onChange:g=>p({...d,route_to_agent:g.target.value})})}),s.jsx(ae,{label:u("telegram_channel_dialog.owner_label"),hint:u("telegram_channel_dialog.owner_hint"),children:s.jsx(Ne,{value:d.owner_user_id!=null?String(d.owner_user_id):"",onChange:g=>{const h=g.target.value.trim();p({...d,owner_user_id:h===""?void 0:/^\d+$/.test(h)?Number(h):h})},placeholder:"889721252"})}),s.jsx(Bt,{checked:!!d.respond_with_engine,onChange:g=>p({...d,respond_with_engine:g}),label:u("telegram_channel_dialog.respond_label")})]})})}function MN({channel:e,onClose:t}){const a=Ze(),[o,l]=x.useState(u("admin.telegram_default_message")),[c,d]=x.useState(!1),p=async()=>{if(!(!o.trim()||!e)){d(!0);try{await Dn.send({text:o,channel:e.name}),a.success(u("telegram_ui.message_sent")),t()}catch(m){a.error(m.message)}finally{d(!1)}}};return s.jsx(Zt,{open:!!e,onClose:t,title:e?u("telegram_send_dialog.title",{name:e.name}):"",description:e?u("telegram_ui.send_chat_id",{id:e.chat_id||"—"}):"",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:c,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:p,loading:c,children:u("chat_ui.send")})]}),children:s.jsx(ae,{label:u("telegram_ui.message_label"),children:s.jsx(on,{rows:4,value:o,onChange:m=>l(m.target.value)})})})}function ON({bare:e=!1}){const t=Ze(),{contacts:a,roles:o,channelOwners:l,isLoading:c,mutate:d}=P_(),p=new Set(l.filter(_=>_.owner_user_id!=null).map(_=>String(_.owner_user_id))),m=Array.from(new Set(["owner","guest",...Object.keys(o)])),g=async(_,j)=>{try{await Dn.contacts.patch(_.user_id,{role:j}),t.success(u("telegram_ui.role_assigned",{name:_.name||_.user_id,role:j})),d()}catch(N){t.error(N.message)}},h=async _=>{if(confirm(u("telegram_contacts.delete_confirm",{name:_.name||String(_.user_id)})))try{await Dn.contacts.remove(_.user_id),t.success(u("telegram_contacts.removed")),d()}catch(j){t.error(j.message)}},b=s.jsxs(s.Fragment,{children:[c&&s.jsx(rt,{}),!c&&a.length===0&&s.jsx(pt,{children:u("telegram_contacts.empty")}),a.length>0&&s.jsx("ul",{className:"space-y-2 text-sm",children:a.map(_=>{const j=p.has(String(_.user_id)),N=j?"owner":_.role||"guest";return s.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"font-medium",children:_.name||"—"}),_.username&&s.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",_.username]}),j&&s.jsx(He,{tone:"success",children:u("telegram_contacts.owner_badge")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx($e,{content:u(j?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:s.jsx(a6,{value:N,disabled:j,onChange:y=>g(_,y.target.value),children:m.map(y=>s.jsx("option",{value:y,children:y},y))})}),s.jsx(se,{size:"sm",variant:"destructive",onClick:()=>h(_),children:u("common.delete")})]})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[s.jsxs("span",{children:["user_id: ",String(_.user_id)]}),s.jsxs("span",{children:[u("telegram_contacts.last_seen")," ",_.last_seen?_.last_seen.slice(0,10):"—"]}),s.jsx("span",{children:c6(o[N])})]})]},String(_.user_id))})})]});return e?b:s.jsx(Ye,{title:u("telegram_contacts.title"),description:u("telegram_contacts.desc"),children:b})}function c6(e){return!e||e.tools===void 0?"":e.tools==="*"?u("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${u("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:u("telegram_contacts.tools_none"):""}function u6(){const e=Pn(),[t,a]=$o(),o=Ze(),{health:l,isUp:c}=TN(),{projects:d,isLoading:p,mutate:m}=uu(),{engines:g,isLoading:h}=l6(),{status:b,mutate:_}=i6(),{channels:j,isLoading:N,mutate:y}=D_(),[w,S]=x.useState(null),[k,E]=x.useState(null),R=async()=>{try{await ni.reload(),o.success(u("admin.reload_success"))}catch(O){o.error(O.message)}},A=async()=>{try{b?.enabled?(await Dn.stop(),o.info(u("admin.telegram_polling_stopped"))):(await Dn.start(),o.success(u("admin.telegram_polling_started"))),_()}catch(O){o.error(O.message)}},T=async O=>{if(confirm(u("telegram_channels.delete_confirm",{name:O})))try{await Dn.channels.remove(O),o.success(u("admin.telegram_channel_removed")),y()}catch(B){o.error(B.message)}},z=async(O,B)=>{if(confirm(u("admin.unregister_confirm",{label:B})))try{await Qn.remove(O),o.success(u("project.unregistered")),m()}catch(P){o.error(P.message)}};return s.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[s.jsxs("header",{className:"flex items-end justify-between",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:u("admin.title")}),s.jsx("p",{className:"text-sm text-muted-fg",children:u("admin.subtitle")})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx($e,{content:u("daemon.reload_hint"),children:s.jsxs(se,{size:"sm",onClick:R,children:[u("common.reload")," config"]})}),s.jsxs(se,{size:"sm",variant:"primary",onClick:()=>{const O=new URLSearchParams(t);O.set("action","add-project"),a(O)},children:[s.jsx(It,{size:14})," ",u("nav.project")]})]})]}),s.jsx(Ye,{title:u("daemon.version"),children:s.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[s.jsx(jh,{label:u("daemon.version"),value:l?.version||"—"}),s.jsx(jh,{label:u("daemon.uptime"),value:l?`${l.uptime_s}s`:"—"}),s.jsx(jh,{label:u("daemon.status"),value:u(c?"daemon.running":"daemon.down"),ok:c})]})}),s.jsxs(Ye,{title:u("admin.engines_title"),description:u("admin.engines_subtitle"),children:[h&&s.jsx(rt,{}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:g.map(O=>s.jsx(He,{tone:"info",children:O},O))})]}),s.jsxs(Ye,{title:u("admin.telegram_title"),description:u("admin.telegram_subtitle"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Bt,{checked:!!b?.enabled,onChange:A,label:b?.enabled?u("admin.telegram_polling_on"):u("admin.telegram_polling_off")}),s.jsxs(se,{size:"sm",onClick:()=>S({name:""}),children:[s.jsx(It,{size:14})," ",u("admin.telegram_add_channel")]})]}),children:[N&&s.jsx(rt,{}),j.length===0&&s.jsx(pt,{children:u("common.none_yet")}),s.jsx("ul",{className:"space-y-2 text-sm",children:j.map(O=>s.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"font-medium",children:O.name}),s.jsxs("div",{className:"flex items-center gap-2",children:[O.project&&s.jsxs(He,{tone:"success",children:["project = ",O.project]}),s.jsxs(se,{size:"sm",variant:"ghost",onClick:()=>E(O),children:[s.jsx(ja,{size:13})," ",u("admin.telegram_send_test")]}),s.jsx(se,{size:"sm",variant:"secondary",onClick:()=>S(O),children:u("common.edit")}),s.jsx(se,{size:"sm",variant:"destructive",onClick:()=>T(O.name),children:u("common.delete")})]})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[s.jsxs("span",{children:["chat_id: ",O.chat_id||"—"]}),s.jsxs("span",{children:["route_to_agent: ",O.route_to_agent||"default APX"]}),s.jsxs("span",{children:["engine: ",O.respond_with_engine?u("admin.engine_badge"):u("admin.engine_badge_no")]})]})]},O.name))})]}),s.jsx(ON,{}),s.jsxs(Ye,{title:u("admin.projects_title"),description:u("admin.projects_subtitle"),children:[p&&s.jsx(rt,{}),s.jsx("ul",{className:"divide-y divide-border",children:d.map(O=>s.jsxs("li",{className:"flex items-center gap-3 py-2",children:[s.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",O.id]}),s.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${O.id}`),children:[s.jsx("span",{className:"font-medium",children:O.name||O.path.split("/").pop()}),s.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:O.path})]}),s.jsxs(He,{children:[O.agents??0," ",u("admin.agents_badge")]}),Number(O.id)!==0&&s.jsx(se,{size:"sm",variant:"destructive",onClick:()=>z(String(O.id),O.name||O.path),children:u("admin.unregister")})]},O.id))})]}),s.jsx(AN,{channel:w,onClose:()=>S(null),onSaved:()=>{S(null),y()}}),s.jsx(MN,{channel:k,onClose:()=>E(null)})]})}function jh({label:e,value:t,ok:a}){return s.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[s.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),s.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[a!==void 0&&s.jsx(fu,{ok:a}),s.jsx("span",{children:t})]})]})}const zN=x.createContext(null),DN=x.createContext(null),PN=x.createContext(""),LN=x.createContext(null),IN=x.createContext(null),BN=x.createContext(null);function d6({children:e}){const[t,a]=x.useState(null),[o,l]=x.useState(""),[c,d]=x.useState(null);return s.jsx(DN.Provider,{value:a,children:s.jsx(zN.Provider,{value:t,children:s.jsx(LN.Provider,{value:l,children:s.jsx(PN.Provider,{value:o,children:s.jsx(BN.Provider,{value:d,children:s.jsx(IN.Provider,{value:c,children:e})})})})})})}function f6(){return x.useContext(zN)}function p6(e,t){const a=x.useContext(DN);x.useEffect(()=>(a?.({collapsed:e,toggle:t}),()=>a?.(null)),[e,t,a])}function m6(){return x.useContext(PN)}function g6(e){const t=x.useContext(LN);x.useEffect(()=>(t?.(e),()=>t?.("")),[e,t])}function h6(){return x.useContext(IN)}function x6(e){const t=x.useContext(BN);x.useEffect(()=>(t?.(e),()=>t?.(null)),[e,t])}function UN({sections:e,active:t,onChange:a,collapsed:o,onToggleCollapse:l,actions:c,contentClassName:d,testId:p,children:m}){return p6(o,l),s.jsxs("div",{className:"flex h-full",children:[s.jsx(TP,{sections:e,active:t,onChange:a,collapsed:o}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[c?s.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 px-6 pt-3",children:c}):null,s.jsx("div",{className:he("flex-1 min-h-0 overflow-y-auto",d),"data-testid":p,children:m})]})]})}const Ew={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 $N({mood:e="happy",className:t}){const a=Ew[e]??Ew.happy,[o,l]=a.eyes,c="text-emerald-700 dark:text-emerald-600/70";return s.jsxs("div",{"aria-hidden":!0,className:Ct("select-none whitespace-pre font-mono leading-none text-emerald-400",t),children:[a.top&&s.jsx("div",{children:s.jsx("span",{className:c,children:` ${a.top}`})}),s.jsx("div",{children:" ▄███████▄"}),s.jsxs("div",{children:[" █ ",s.jsx("span",{className:c,children:"██"})," ",s.jsx("span",{className:c,children:"██"})," █"]}),s.jsx("div",{children:` █ ${o} ${l} █`}),s.jsx("div",{children:` █ ${a.mouth} █`}),s.jsx("div",{children:" ▀███████▀"})]})}function HN({mood:e="confused",title:t,titleClassName:a,message:o,action:l,className:c,testId:d}){return s.jsx("div",{className:Ct("grid h-full place-items-center p-8",c),"data-testid":d,children:s.jsxs("div",{className:"flex flex-col items-center text-center",children:[s.jsx($N,{mood:e,className:"mb-6 text-sm"}),t!=null&&s.jsx("div",{className:Ct("font-mono font-semibold leading-none tracking-tight text-foreground",a),children:t}),o!=null&&s.jsx("p",{className:"mt-4 max-w-sm text-sm text-muted-fg",children:o}),l&&s.jsx("div",{className:"mt-6",children:l})]})})}const L_={pending:{labelKey:"tasks.status_pending",color:"text-amber-500",dot:"bg-amber-400",Icon:EM},running:{labelKey:"tasks.status_running",color:"text-sky-500",dot:"bg-sky-400",Icon:Ir,spin:!0},in_review:{labelKey:"tasks.status_in_review",color:"text-violet-500",dot:"bg-violet-400",Icon:BS},blocked:{labelKey:"tasks.status_blocked",color:"text-slate-400",dot:"bg-slate-400",Icon:RM}},qN=["pending","running","in_review","blocked"];function Pf(e){return e.state==="done"?"done":e.state==="dropped"?"dropped":e.status??"pending"}function I_(e){return u(L_[e].labelKey)}function Lf({status:e,className:t}){if(e==="done")return s.jsx(fb,{className:he("size-4 text-emerald-500",t)});if(e==="dropped")return s.jsx(IS,{className:he("size-4 text-muted-foreground",t)});const a=L_[e];return s.jsx(a.Icon,{className:he("size-4",a.color,a.spin&&"animate-spin",t)})}function B_({status:e}){const t=e==="done"?u("tasks.done_label"):e==="dropped"?u("tasks.dropped_label"):I_(e),a=e==="done"?"text-emerald-500 border-emerald-500/30":e==="dropped"?"text-muted-foreground border-border":`${L_[e].color} border-current/30`;return s.jsxs("span",{className:he("inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium capitalize",a),children:[s.jsx(Lf,{status:e,className:"size-3"}),t]})}function Rw({pid:e}){const t=Pn(),a=qe(`/projects/${e}/tasks?state=open`,()=>Wn.list(e),{refreshInterval:2e4}),o=qe(`/projects/${e}/tasks-summary`,()=>Wn.summary(e),{refreshInterval:2e4}),l=qe(`/projects/${e}/routines`,()=>zr.list(e)),c=qe(`/projects/${e}/agents`,()=>cn.list(e)),d=qe(`/projects/${e}/mcps`,()=>Dr.list(e)),p=qe(`/projects/${e}/artifacts`,()=>Xs.list(e)),m=c.data??[],g=m.filter(j=>j.is_master||j.type==="orchestrator"),h=m.filter(j=>!(j.is_master||j.type==="orchestrator")),b=(l.data??[]).filter(j=>j.enabled).length,_=[...a.data??[]].sort((j,N)=>(N.created_at||"").localeCompare(j.created_at||"")).slice(0,6);return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4",children:[s.jsx(vo,{title:u("project.overview.agents"),value:m.length,href:`/p/${e}/agents`,icon:un}),s.jsx(vo,{title:u("project.overview.tasks_open"),value:o.data?.open??a.data?.length??"…",href:`/p/${e}/tasks`,icon:su}),s.jsx(vo,{title:u("project.overview.routines_active"),value:b,href:`/p/${e}/routines`,icon:Kl}),s.jsx(vo,{title:u("project.overview.artifacts"),value:p.data?.length??"…",href:`/p/${e}/artifacts`,icon:gb})]}),o.data&&s.jsx("div",{className:"flex flex-wrap gap-2",children:qN.map(j=>s.jsxs(mf,{to:`/p/${e}/tasks`,className:"flex items-center gap-1.5 rounded-lg border border-border bg-card px-3 py-1.5 text-xs hover:bg-accent/40",children:[s.jsx(Lf,{status:j,className:"size-3.5"}),s.jsx("span",{className:"capitalize text-muted-foreground",children:I_(j)}),s.jsx("span",{className:"font-semibold",children:o.data.status?.[j]??0})]},j))}),s.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[s.jsx(Ye,{title:u("project.overview.roster"),className:"!p-4",children:m.length===0?s.jsx("p",{className:"text-sm text-muted-fg",children:u("project.overview.no_agents")}):s.jsxs("div",{className:"space-y-3",children:[g.length>0&&s.jsx(Tw,{label:u("project.overview.orchestrators"),icon:xa,agents:g,pid:e,navigate:t}),h.length>0&&s.jsx(Tw,{label:u("project.overview.specialists"),icon:un,agents:h,pid:e,navigate:t})]})}),s.jsx(Ye,{title:u("project.overview.recent_tasks"),className:"!p-4",action:s.jsx(mf,{to:`/p/${e}/tasks`,className:"text-xs text-sky-500 hover:text-sky-400",children:u("common.view_all")}),children:_.length===0?s.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-fg",children:[s.jsx(ub,{className:"size-4"}),u("project.overview.no_activity")]}):s.jsx("ul",{className:"space-y-1.5",children:_.map(j=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>t(`/p/${e}/tasks?task=${j.id}`),className:"flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-left hover:bg-accent/40",children:[s.jsx(Lf,{status:Pf(j),className:"size-3.5 shrink-0"}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm",children:j.title}),s.jsx(B_,{status:Pf(j)})]})},j.id))})})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[s.jsx(vo,{title:u("project.overview.chat"),value:u("project.overview.chat_value"),href:`/p/${e}/chat`,icon:bb}),s.jsx(vo,{title:u("project.overview.mcps"),value:d.data?.length??"…",href:`/p/${e}/mcps`,icon:Qf}),s.jsx(vo,{title:u("project.overview.routines"),value:l.data?.length??"…",href:`/p/${e}/routines`,icon:Kl})]})]})}function Tw({label:e,icon:t,agents:a,pid:o,navigate:l}){return s.jsxs("div",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[s.jsx(t,{className:"size-3.5"}),e," (",a.length,")"]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:a.map(c=>s.jsxs("button",{type:"button",onClick:()=>l(`/p/${o}/agents/${c.slug}`),className:he("inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-2 py-1 text-xs hover:border-muted-fg/50"),children:[s.jsx("span",{className:"text-sm leading-none",children:c.emoji||"🤖"}),s.jsx("span",{className:"truncate",children:c.slug})]},c.slug))})]})}function vo({title:e,value:t,href:a,icon:o}){return s.jsxs(mf,{to:a,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[s.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:s.jsx(o,{size:20})}),s.jsxs("div",{children:[s.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),s.jsx("div",{className:"text-2xl font-semibold",children:t})]})]})}function b6(){const e=Pn(),{projects:t,isLoading:a}=uu();return s.jsxs(Ye,{title:u("base.workspaces_title"),description:u("base.workspaces_desc"),action:s.jsxs(se,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[s.jsx(It,{size:14})," ",u("base.workspaces_new")]}),children:[a&&s.jsx(rt,{}),!a&&t.length===0&&s.jsx(pt,{children:u("base.workspaces_empty")}),s.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?u("base.title"):o.name||o.path.split("/").pop()||String(o.id);return s.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:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(qS,{className:"size-4 text-muted-fg"}),s.jsx("span",{className:"truncate text-sm font-semibold",children:c}),s.jsx(He,{tone:l?"success":"info",children:l?u("base.title"):xN(o.kind)})]}),s.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}const VN=x.createContext(null),FN=x.createContext(null);function Sa(){const e=x.useContext(VN);if(e===null)throw new Error(ln(60));return e}function GN(){const e=x.useContext(FN);if(e===null)throw new Error(ln(61));return e}const _6=(e,t)=>Object.is(e,t);function Po(e,t,a){return e==null||t==null?Object.is(e,t):a(e,t)}function v6(e,t,a){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:Po(t,o,a))}function Pc(e,t,a){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:Po(o,t,a))}function y6(e,t,a){return e.filter(o=>!Po(t,o,a))}function qx(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function YN(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function j6(e){if(!Array.isArray(e))return e!=null&&"null"in e;const t=e;if(YN(t)){for(const a of t)for(const o of a.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const a of t)if(a&&a.value==null&&a.label!=null)return!0;return!1}function KN(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 qx(e)}function wo(e,t){return t&&e!=null?t(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?qx(e.value):qx(e)}function XN(e,t,a){function o(){return KN(e,a)}if(a&&e!=null)return a(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??o();if(Array.isArray(t)){const l=t,c=YN(l)?l.flatMap(d=>d.items):l;if(e==null||typeof e!="object"){const d=c.find(p=>p.value===e);return d&&d.label!=null?d.label:o()}if("value"in e){const d=c.find(p=>p&&p.value===e.value);if(d&&d.label!=null)return d.label}}return o()}function w6(e,t,a){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(s.jsx(x.Fragment,{children:XN(l,t,a)},c)),o),[])}const et={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:a,itemToStringValue:o}=e;return t==null?!1:a&&Array.isArray(t)?t.length>0:wo(t,o)!==""}),hasNullItemLabel:Ae((e,t)=>t?j6(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 a=e.isItemEqualToValue,o=e.value;return e.multiple?Array.isArray(o)&&o.some(l=>Po(t,l,a)):Po(t,o,a)}),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 k6(e,t,a=(o,l)=>o===l){return e.length===t.length&&e.every((o,l)=>a(o,t[l]))}function Cc(e,t=Number.MIN_SAFE_INTEGER,a=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,a))}const Qs=1;function U_(e,t){return Math.max(0,e-t)}function If(e,t){if(t<=0)return 0;const a=Cc(e,0,t),o=a,l=t-a,c=o<=Qs,d=l<=Qs;return c&&d?o<=l?0:t:c?0:d?t:a}function S6(e){const{id:t,value:a,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:d=!1,onOpenChange:p,name:m,form:g,autoComplete:h,disabled:b=!1,readOnly:_=!1,required:j=!1,modal:N=!0,actionsRef:y,inputRef:w,onOpenChangeComplete:S,items:k,multiple:E=!1,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:T=_6,highlightItemOnHover:z=!0,children:O}=e,{clearErrors:B}=M_(),{setDirty:P,setTouched:U,setFocused:D,validityData:L,setFilled:V,name:H,disabled:$,validation:F,validationMode:Y}=pu(),G=Np({id:t}),K=$||b,I=H??m,[X,Z]=ei({controlled:a,default:E?o??tr:o,name:"Select",state:"value"}),[W,fe]=ei({controlled:c,default:d,name:"Select",state:"open"}),te=x.useRef([]),re=x.useRef([]),le=x.useRef(null),me=x.useRef(null),Me=x.useRef(0),de=x.useRef(null),ge=x.useRef([]),Ce=x.useRef(!1),ke=x.useRef(null),Be=x.useRef(null),Ve=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),Se=x.useRef(!1),{mounted:Te,setMounted:je,transitionStatus:Ee}=pi(W),{openMethod:De,triggerProps:Le}=ZC(W),Ie=es(()=>new oC({id:G,labelId:void 0,modal:N,multiple:E,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:T,value:X,open:W,mounted:Te,transitionStatus:Ee,items:k,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,ue=nt(Ie,et.activeIndex),ye=nt(Ie,et.selectedIndex),Ge=nt(Ie,et.triggerElement),Re=nt(Ie,et.positionerElement),Oe=bD(De),tt=De??Oe??null,ot=x.useMemo(()=>E?"":wo(X,A),[E,X,A]),vt=x.useMemo(()=>E&&Array.isArray(X)?X.map(dt=>wo(dt,A)):wo(X,A),[E,X,A]),Mt=pn(Ie.state.triggerElement),lt=Ue(()=>vt);O_(Mt,G,X,lt,!K,m);const Rt=x.useRef(X),_e=E?Array.isArray(X)&&X.length>0:X!=null&&wo(X,A)!=="";ze(()=>{X!==Rt.current&&Ie.set("forceMount",!0)},[Ie,X]),ze(()=>{V(_e)},[_e,V]),ze(function(){const Ut=ge.current;let hn;if(E){const Rn=Array.isArray(X)?X:[];if(Rn.length===0)hn=null;else{const Sn=Rn[Rn.length-1],Yt=Pc(Ut,Sn,T);hn=Yt===-1?null:Yt}}else{const Rn=Pc(Ut,X,T);hn=Rn===-1?null:Rn}hn===null&&(Be.current=null),!W&&Ie.set("selectedIndex",hn)},[_e,E,W,X,ge,T,Ie,Be]);function Pe(dt){const Ut=L.initialValue;return Array.isArray(dt)&&Array.isArray(Ut)?!k6(dt,Ut,(hn,Rn)=>Po(hn,Rn,T)):dt!==Ut}b_(X,()=>{B(I),P(Pe(X)),F.change(X)});const Xe=Ue((dt,Ut)=>{p?.(dt,Ut),!Ut.isCanceled&&(fe(dt),!dt&&(Ut.reason===To||Ut.reason===lp)&&(U(!0),D(!1),Y==="onBlur"&&F.commit(X)))}),it=Ue(()=>{je(!1),Ie.update({activeIndex:null,openMethod:null}),S?.(!1)});ka({enabled:!y,open:W,ref:le,onComplete(){W||it()}}),x.useImperativeHandle(y,()=>({unmount:it}),[it]);const Qe=Ue((dt,Ut)=>{l?.(dt,Ut),!Ut.isCanceled&&Z(dt)}),mt=Ue(()=>{const dt=Ie.state.listElement||le.current;if(!dt)return;const Ut=U_(dt.scrollHeight,dt.clientHeight),hn=If(dt.scrollTop,Ut),Rn=hn>0,Sn=hn<Ut;Ie.state.scrollUpArrowVisible!==Rn&&Ie.set("scrollUpArrowVisible",Rn),Ie.state.scrollDownArrowVisible!==Sn&&Ie.set("scrollDownArrowVisible",Sn)}),Ot=gC({open:W,onOpenChange:Xe,elements:{reference:Ge,floating:Re}}),Jt=X2(Ot,{enabled:!_&&!K,event:"mousedown"}),Qt=up(Ot),en=vC(Ot,{enabled:!_&&!K,listRef:te,activeIndex:ue,selectedIndex:ye,disabledIndices:tr,onNavigate(dt){dt===null&&!W||Ie.set("activeIndex",dt)},focusItemOnHover:z}),mn=yC(Ot,{enabled:!_&&!K&&(W||!E),listRef:re,activeIndex:ue,selectedIndex:ye,disabledIndices:dt=>nN(te.current[dt]),onMatch(dt){W?Ie.set("activeIndex",dt):Qe(ge.current[dt],st("none"))},onTyping(dt){Ce.current=dt}}),ss=x.useMemo(()=>{const dt=Kn(mn.reference,en.reference,Qt.reference,Jt.reference,Le);return G&&(dt.id=G),dt},[Jt.reference,mn.reference,en.reference,Qt.reference,Le,G]),gs=x.useMemo(()=>Kn(mp,mn.floating,en.floating,Qt.floating),[mn.floating,en.floating,Qt.floating]),Cs=en.item??Xt;Jb(()=>{Ie.update({popupProps:gs,triggerProps:ss})}),ze(()=>{Ie.update({id:G,modal:N,multiple:E,value:X,open:W,mounted:Te,transitionStatus:Ee,popupProps:gs,triggerProps:ss,items:k,itemToStringLabel:R,itemToStringValue:A,isItemEqualToValue:T,openMethod:tt})},[Ie,G,N,E,X,W,Te,Ee,gs,ss,k,R,A,T,tt]);const gn=x.useMemo(()=>({store:Ie,name:I,required:j,disabled:K,readOnly:_,multiple:E,highlightItemOnHover:z,setValue:Qe,setOpen:Xe,listRef:te,popupRef:le,scrollHandlerRef:me,handleScrollArrowVisibility:mt,scrollArrowsMountedCountRef:Me,itemProps:Cs,valueRef:de,valuesRef:ge,labelsRef:re,typingRef:Ce,selectionRef:Ve,firstItemTextRef:ke,selectedItemTextRef:Be,validation:F,onOpenChangeComplete:S,alignItemWithTriggerActiveRef:Se,initialValueRef:Rt}),[Ie,I,j,K,_,E,z,Qe,Xe,Cs,F,S,mt]),Ns=nr(w,F.inputRef),Ca=E&&Array.isArray(X)&&X.length>0,Fs=E?void 0:I,Na=x.useMemo(()=>!E||!Array.isArray(X)||!I?null:X.map(dt=>{const Ut=wo(dt,A);return s.jsx("input",{type:"hidden",form:g,name:I,value:Ut,disabled:K},Ut)}),[E,X,g,I,A,K]);return s.jsx(VN.Provider,{value:gn,children:s.jsxs(FN.Provider,{value:Ot,children:[O,s.jsx("input",{...F.getValidationProps(K,{onFocus(){Ie.state.triggerElement?.focus({focusVisible:!0})},onChange(dt){if(dt.nativeEvent.defaultPrevented||K||_)return;const Ut=dt.currentTarget.value,hn=st(va,dt.nativeEvent);function Rn(){if(E)return;const Sn=Ut.toLowerCase();let Yt=ge.current.findIndex(sa=>wo(sa,A).toLowerCase()===Sn||KN(sa,R).toLowerCase()===Sn);Yt===-1&&(Yt=ge.current.findIndex((sa,mi)=>{const mu=re.current[mi];return mu!=null&&mu.toLowerCase()===Sn}));const Ln=Yt===-1?void 0:ge.current[Yt];Ln!=null&&Qe(Ln,hn)}Ie.set("forceMount",!0),queueMicrotask(Rn)}}),id:G&&Fs==null?`${G}-hidden-input`:void 0,form:g,name:Fs,autoComplete:h,value:ot,disabled:K,required:j&&!Ca,readOnly:_,ref:Ns,style:I?j2:Bb,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Na]})})}function C6(e,t){return e??t}const Ud=2,N6=400,E6={...Tx,...A_,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},R6=x.forwardRef(function(t,a){const{render:o,className:l,id:c,disabled:d=!1,nativeButton:p=!0,style:m,...g}=t,{setTouched:h,setFocused:b,validationMode:_,state:j,disabled:N}=pu(),{labelId:y}=Cp(),{store:w,setOpen:S,selectionRef:k,validation:E,readOnly:R,required:A,alignItemWithTriggerActiveRef:T,disabled:z}=Sa(),O=N||z||d,B=nt(w,et.open),P=nt(w,et.mounted),U=nt(w,et.value),D=nt(w,et.triggerProps),L=nt(w,et.positionerElement),V=nt(w,et.listElement),H=nt(w,et.popupSide),$=nt(w,et.id),F=nt(w,et.labelId),Y=nt(w,et.hasSelectedValue),G=P&&L?H:null,K=c??$,I=C6(y,F);Np({id:K});const X=pn(L),Z=x.useRef(null),{getButtonProps:W,buttonRef:fe}=Zr({disabled:O,native:p}),te=Ue(Ce=>{w.set("triggerElement",Ce)}),re=En(),le=En(),me=En();x.useEffect(()=>{if(B)return me.start(N6,()=>{k.current.allowUnselectedMouseUp=!0,k.current.allowSelectedMouseUp=!0}),()=>{me.clear()};k.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},le.clear()},[B,k,le,me]);const Me=Kn(D,{id:K,role:"combobox","aria-expanded":B?"true":"false","aria-haspopup":"listbox","aria-controls":B?V?.id??bf(L)?.id:void 0,"aria-labelledby":I,"aria-readonly":R||void 0,"aria-required":A||void 0,tabIndex:O?-1:0,onFocus(Ce){b(!0),B&&T.current&&S(!1,st(va,Ce.nativeEvent)),re.start(0,()=>{w.set("forceMount",!0)})},onBlur(Ce){We(L,Ce.relatedTarget)||(h(!0),b(!1),_==="onBlur"&&E.commit(U))},onMouseDown(Ce){if(B)return;const ke=xt(Ce.currentTarget);function Be(Ve){if(!Z.current)return;const Se=Ve.target;if(We(Z.current,Se)||We(X.current,Se))return;const Te=JC(Z.current);Ve.clientX>=Te.left-Ud&&Ve.clientX<=Te.right+Ud&&Ve.clientY>=Te.top-Ud&&Ve.clientY<=Te.bottom+Ud||S(!1,st(h2,Ve))}le.start(0,()=>{ke.addEventListener("mouseup",Be,{once:!0})})}},g,W),de=E.getValidationProps(O,Me);de.role="combobox";const ge={...j,open:B,disabled:O,value:U,readOnly:R,popupSide:G,placeholder:!Y};return Et("button",t,{ref:[a,Z,fe,te],state:ge,stateAttributesMapping:E6,props:de})}),T6={value:()=>null},A6=x.forwardRef(function(t,a){const{className:o,render:l,children:c,placeholder:d,style:p,...m}=t,{store:g,valueRef:h}=Sa(),b=nt(g,et.value),_=nt(g,et.items),j=nt(g,et.itemToStringLabel),N=nt(g,et.hasSelectedValue),y=!N&&d!=null&&c==null,w=nt(g,et.hasNullItemLabel,y),S={value:b,placeholder:!N};let k=null;return typeof c=="function"?k=c(b):c!=null?k=c:!N&&d!=null&&!w?k=d:Array.isArray(b)?k=w6(b,_,j):k=XN(b,_,j),Et("span",t,{state:S,ref:[a,h],props:[{children:k},m],stateAttributesMapping:T6})}),M6=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...d}=t,{store:p}=Sa(),g={open:nt(p,et.open)};return Et("span",t,{state:g,ref:a,props:[{"aria-hidden":!0,children:"▼"},d],stateAttributesMapping:wC})}),O6=x.createContext(void 0),z6=x.forwardRef(function(t,a){const{store:o}=Sa(),l=nt(o,et.mounted),c=nt(o,et.forceMount);return l||c?s.jsx(O6.Provider,{value:!0,children:s.jsx(Kb,{ref:a,...t})}):null}),QN=x.createContext(void 0);function $_(){const e=x.useContext(QN);if(!e)throw new Error(ln(59));return e}function Bf(e,t){e&&Object.assign(e.style,t)}const WN={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},D6={position:"fixed"},P6=x.forwardRef(function(t,a){const{anchor:o,positionMethod:l="absolute",className:c,render:d,side:p="bottom",align:m="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:b="clipping-ancestors",collisionPadding:_,arrowPadding:j=5,sticky:N=!1,disableAnchorTracking:y,alignItemWithTrigger:w=!0,collisionAvoidance:S=U2,style:k,...E}=t,{store:R,listRef:A,labelsRef:T,alignItemWithTriggerActiveRef:z,selectedItemTextRef:O,valuesRef:B,initialValueRef:P,popupRef:U,setValue:D}=Sa(),L=GN(),V=nt(R,et.open),H=nt(R,et.mounted),$=nt(R,et.modal),F=nt(R,et.value),Y=nt(R,et.openMethod),G=nt(R,et.positionerElement),K=nt(R,et.triggerElement),I=nt(R,et.isItemEqualToValue),X=nt(R,et.transitionStatus),Z=x.useRef(null),W=x.useRef(null),[fe,te]=x.useState(w),re=H&&fe&&Y!=="touch";!H&&fe!==w&&te(w),ze(()=>{H||(et.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),et.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,H]),x.useImperativeHandle(z,()=>re),KC((re||$)&&V,Y==="touch",G,K);const le=u_({anchor:o,floatingRootContext:L,positionMethod:l,mounted:H,side:p,sideOffset:g,align:m,alignOffset:h,arrowPadding:j,collisionBoundary:b,collisionPadding:_,sticky:N,disableAnchorTracking:y??re,collisionAvoidance:S,keepMounted:!0}),me=re?"none":le.side,Me=re?D6:le.positionerStyles,de={open:V,side:me,align:le.align,anchorHidden:le.anchorHidden};ze(()=>{R.set("popupSide",le.side)},[R,le.side]);const ge=Ue(Se=>{R.set("positionerElement",Se)}),Ce=d_(t,de,{styles:Me,transitionStatus:X,props:E,refs:[a,ge],hidden:!H,inert:!V}),ke=x.useRef(0),Be=Ue(Se=>{if(Se.size===0&&ke.current===0||B.current.length===0)return;const Te=ke.current;if(ke.current=Se.size,Se.size===Te)return;const je=st(va);if(Te!==0&&!R.state.multiple&&F!==null&&Pc(B.current,F,I)===-1){const De=P.current,Ie=De!=null&&Pc(B.current,De,I)!==-1?De:null;D(Ie,je),Ie===null&&(R.set("selectedIndex",null),O.current=null)}if(Te!==0&&R.state.multiple&&Array.isArray(F)){const Ee=Le=>Pc(B.current,Le,I)!==-1,De=F.filter(Le=>Ee(Le));(De.length!==F.length||De.some(Le=>!v6(F,Le,I)))&&(D(De,je),De.length===0&&(R.set("selectedIndex",null),O.current=null))}if(V&&re){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Ee={height:""};Bf(G,Ee),Bf(U.current,Ee)}}),Ve=x.useMemo(()=>({...le,side:me,alignItemWithTriggerActive:re,setControlledAlignItemWithTrigger:te,scrollUpArrowRef:Z,scrollDownArrowRef:W}),[le,me,re,te]);return s.jsx(wp,{elementsRef:A,labelsRef:T,onMapChange:Be,children:s.jsxs(QN.Provider,{value:Ve,children:[H&&$&&s.jsx(x_,{inert:bp(!V),cutout:K}),Ce]})})}),$d="base-ui-disable-scrollbar",Vx={className:$d,getElement(e){return s.jsx("style",{nonce:e,href:$d,precedence:"base-ui:low",children:`.${$d}{scrollbar-width:none}.${$d}::-webkit-scrollbar{display:none}`})}},L6=x.createContext(void 0),I6={disableStyleElements:!1};function B6(){return x.useContext(L6)??I6}const U6={...Ho,...or},$6=x.forwardRef(function(t,a){const{render:o,className:l,style:c,finalFocus:d,...p}=t,{store:m,popupRef:g,onOpenChangeComplete:h,setOpen:b,valueRef:_,firstItemTextRef:j,selectedItemTextRef:N,multiple:y,handleScrollArrowVisibility:w,scrollHandlerRef:S,listRef:k,highlightItemOnHover:E}=Sa(),{side:R,align:A,alignItemWithTriggerActive:T,isPositioned:z,setControlledAlignItemWithTrigger:O}=$_(),B=HC()!=null,P=GN(),U=hp(),{nonce:D,disableStyleElements:L}=B6(),V=nt(m,et.id),H=nt(m,et.open),$=nt(m,et.openMethod),F=nt(m,et.mounted),Y=nt(m,et.popupProps),G=nt(m,et.transitionStatus),K=nt(m,et.triggerElement),I=nt(m,et.positionerElement),X=nt(m,et.listElement),Z=x.useRef(!1),W=x.useRef(!1),fe=x.useRef({}),te=Wl(),re=Ue(de=>{if(!I||!g.current||!W.current)return;if(Z.current||!T){w();return}const ge=I.style.top==="0px",Ce=I.style.bottom==="0px";if(!ge&&!Ce){w();return}const ke=Mw(I),Be=Nc(I.getBoundingClientRect().height,"y",ke),Ve=xt(I),Se=Wt(I),Te=Se.getComputedStyle(I),je=parseFloat(Te.marginTop),Ee=parseFloat(Te.marginBottom),De=Aw(Se.getComputedStyle(g.current)),Le=Math.min(Ve.documentElement.clientHeight-je-Ee,De),Ie=de.scrollTop,ue=Hd(de);let ye=0,Ge=null,Re=!1,Oe=!1;const tt=lt=>{I.style.height=`${lt}px`},ot=(lt,Rt)=>{const _e=Cc(lt,0,Le-Be);_e>0&&tt(Be+_e),de.scrollTop=Rt,Le-(Be+_e)<=Qs&&(Z.current=!0),w()},vt=ge?ue-Ie:Ie,Mt=Math.min(Be+vt,Le);if(ye=Mt,vt<=Qs){ot(vt,ge?ue:0);return}if(Le-Mt>Qs)ge?Oe=!0:Ge=0;else if(Re=!0,Ce&&Ie<ue){const lt=Be+vt-Le;Ge=Ie-(vt-lt)}if(ye=Math.ceil(ye),ye!==0&&tt(ye),Oe||Ge!=null){const lt=Hd(de),Rt=Oe?lt:Cc(Ge,0,lt);Math.abs(de.scrollTop-Rt)>Qs&&(de.scrollTop=Rt)}(Re||ye>=Le-Qs)&&(Z.current=!0),w()});x.useImperativeHandle(S,()=>re,[re]),ka({open:H,ref:g,onComplete(){H&&h?.(!0)}});const le={open:H,transitionStatus:G,side:R,align:A};ze(()=>{!I||!g.current||Object.keys(fe.current).length||(fe.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})},[g,I]),ze(()=>{H||T||(W.current=!1,Z.current=!1,Bf(I,fe.current))},[H,T,I,g]),ze(()=>{const de=g.current;if(!H||!K||!I||!de||T&&!z||m.state.transitionStatus==="ending")return;if(!T){W.current=!0,te.request(w),de.style.removeProperty("--transform-origin");return}const ge=H6(de);de.style.removeProperty("--transform-origin");try{let Ce=N.current;Ce?.isConnected||(Ce=!et.hasSelectedValue(m.state)&&j.current?.isConnected?j.current:null);const ke=_.current,Be=Wt(I),Ve=Be.getComputedStyle(I),Se=Be.getComputedStyle(de),Te=xt(K),je=Mw(K),Ee=qd(K.getBoundingClientRect(),je),De=qd(I.getBoundingClientRect(),je),Le=Ee.height,Ie=X||de,ue=Ie.scrollHeight,ye=parseFloat(Se.borderBottomWidth),Ge=parseFloat(Ve.marginTop)||10,Re=parseFloat(Ve.marginBottom)||10,Oe=parseFloat(Ve.minHeight)||100,tt=Aw(Se),ot=5,vt=5,Mt=20,lt=Te.documentElement.clientHeight-Ge-Re,Rt=Te.documentElement.clientWidth,_e=lt-Ee.bottom+Le;let Pe,Xe=U==="rtl"?Ee.right-De.width:Ee.left,it=0;if(Ce&&ke){const gn=qd(ke.getBoundingClientRect(),je);Pe=qd(Ce.getBoundingClientRect(),je),Xe=De.left+(U==="rtl"?gn.right-Pe.right:gn.left-Pe.left);const Ns=gn.top-Ee.top+gn.height/2;it=Pe.top-De.top+Pe.height/2-Ns}const Qe=_e+it+Re+ye;let mt=Math.min(lt,Qe);const Ot=lt-Ge-Re,Jt=Qe-mt,Qt=Rt-vt;I.style.left=`${Cc(Xe,ot,Qt-De.width)}px`,I.style.height=`${mt}px`,I.style.maxHeight="none",I.style.marginTop=`${Ge}px`,I.style.marginBottom=`${Re}px`,de.style.height="100%";const en=Hd(Ie),mn=Jt>=en-Qs;mn&&(mt=Math.min(lt,De.height)-(Jt-en));const ss=Ee.top<Mt||Ee.bottom>lt-Mt||Math.ceil(mt)+Qs<Math.min(ue,Oe),gs=(Be.visualViewport?.scale??1)!==1&&Gr;if(ss||gs){W.current=!0,Bf(I,fe.current),O(!1);return}const Cs=Math.max(Oe,mt);if(mn){const gn=Math.max(0,lt-Qe);I.style.top=De.height>=Ot?"0":`${gn}px`,I.style.height=`${mt}px`,Ie.scrollTop=Hd(Ie)}else I.style.bottom="0",Ie.scrollTop=Jt;if(Pe){const gn=De.top,Ns=De.height,Ca=Pe.top+Pe.height/2,Fs=Ns>0?(Ca-gn)/Ns*100:50,Na=Cc(Fs,0,100);de.style.setProperty("--transform-origin",`50% ${Na}%`)}(Cs===lt||mt>=tt)&&(Z.current=!0),w(),E&&m.state.selectedIndex===null&&m.state.activeIndex===null&&k.current[0]!=null&&m.set("activeIndex",0),W.current=!0}finally{ge()}},[m,H,I,K,_,j,N,g,w,T,O,te,X,k,E,U,z]),x.useEffect(()=>{if(!T||!I||!H)return;const de=Wt(I);function ge(Ce){b(!1,st(E4,Ce))}return _t(de,"resize",ge)},[b,T,I,H]);const me={...X?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":y||void 0,id:`${V}-list`},onKeyDown(de){B&&jp.has(de.key)&&de.stopPropagation()},onScroll(de){X||re(de.currentTarget)},...T&&{style:X?{height:"100%"}:WN}},Me=Et("div",t,{ref:[a,g],state:le,stateAttributesMapping:U6,props:[Y,me,xp(G),{className:!X&&T?Vx.className:void 0},p]});return s.jsxs(x.Fragment,{children:[!L&&Vx.getElement(D),s.jsx(Wb,{context:P,modal:!1,disabled:!F,openInteractionType:$,returnFocus:d,restoreFocus:!0,children:Me})]})});function Aw(e){const t=e.maxHeight||"";return t.endsWith("px")&&parseFloat(t)||1/0}function Hd(e){return U_(e.scrollHeight,e.clientHeight)}function Mw(e){return nC.getScale(e)}function Nc(e,t,a){return e/a[t]}function qd(e,t){return qc({x:Nc(e.x,"x",t),y:Nc(e.y,"y",t),width:Nc(e.width,"x",t),height:Nc(e.height,"y",t)})}const Ow=[["transform","none"],["scale","1"],["translate","0 0"]];function H6(e){const{style:t}=e,a={};for(const[o,l]of Ow)a[o]=t.getPropertyValue(o),t.setProperty(o,l,"important");return()=>{for(const[o]of Ow){const l=a[o];l?t.setProperty(o,l):t.removeProperty(o)}}}const q6=x.forwardRef(function(t,a){const{render:o,className:l,style:c,...d}=t,{store:p,scrollHandlerRef:m}=Sa(),{alignItemWithTriggerActive:g}=$_(),h=nt(p,et.hasScrollArrows),b=nt(p,et.openMethod),_=nt(p,et.multiple),N={id:`${nt(p,et.id)}-list`,role:"listbox","aria-multiselectable":_||void 0,onScroll(w){m.current?.(w.currentTarget)},...g&&{style:WN},className:h&&b!=="touch"?Vx.className:void 0},y=Ue(w=>{p.set("listElement",w)});return Et("div",t,{ref:[a,y],props:[N,d]})}),ZN=x.createContext(void 0);function H_(){const e=x.useContext(ZN);if(!e)throw new Error(ln(57));return e}const V6=x.memo(x.forwardRef(function(t,a){const{render:o,className:l,style:c,value:d=null,label:p,disabled:m=!1,nativeButton:g=!1,...h}=t,b=x.useRef(null),_=lu({label:p,textRef:b,indexGuessBehavior:UC.GuessFromOrder}),{store:j,itemProps:N,setOpen:y,setValue:w,selectionRef:S,typingRef:k,valuesRef:E,multiple:R,selectedItemTextRef:A,disabled:T,readOnly:z}=Sa(),O=nt(j,et.isActive,_.index),B=nt(j,et.open),P=nt(j,et.isSelected,d),U=nt(j,et.isSelectedByFocus,_.index),D=nt(j,et.isItemEqualToValue),L=_.index,V=L!==-1,H=x.useRef(null);ze(()=>{if(!V)return;const re=E.current;return re[L]=d,()=>{delete re[L]}},[V,L,d,E]),ze(()=>{if(!V)return;const re=j.state.value;let le=re;R&&Array.isArray(re)&&(le=re.length>0?re[re.length-1]:void 0),le!==void 0&&Po(d,le,D)&&(j.set("selectedIndex",L),b.current&&(A.current=b.current))},[V,L,R,D,j,d,A]);const $=x.useRef(null),F=x.useRef("mouse"),Y=x.useRef(!1),{getButtonProps:G,buttonRef:K}=Zr({disabled:m,focusableWhenDisabled:!0,native:g,composite:!0}),I={disabled:m,selected:P,highlighted:O};function X(re){if(T||z)return;const le=j.state.value;if(R){const me=Array.isArray(le)?le:[],Me=P?y6(me,d,D):[...me,d];w(Me,st($l,re))}else w(d,st($l,re)),y(!1,st($l,re))}function Z(){S.current.dragY=0}const W={role:"option","aria-selected":P,tabIndex:B&&O?0:-1,onKeyDown(re){$.current=re.key,j.set("activeIndex",L),re.key===" "&&k.current&&re.preventDefault()},onClick(re){const le=re.type==="click"&&F.current!=="touch",me=re.nativeEvent.pointerType,Me=le&&Mb(re.nativeEvent)&&(me!==void 0||O),de=le&&!Me&&!Y.current;Y.current=!1,!(re.type==="keydown"&&$.current===null)&&(m||re.type==="keydown"&&$.current===" "&&k.current||de||($.current=null,X(re.nativeEvent)))},onPointerEnter(re){F.current=re.pointerType},onPointerMove(re){if(re.pointerType==="mouse"&&re.buttons===1){const le=S.current;le.dragY+=re.movementY,le.dragY**2>=64&&(le.allowUnselectedMouseUp=!0)}},onPointerDown(re){F.current=re.pointerType,Y.current=!0,Z()},onMouseUp(){if(Z(),m||F.current==="touch"||Y.current)return;const re=!S.current.allowSelectedMouseUp&&P,le=!S.current.allowUnselectedMouseUp&&!P;re||le||(Y.current=!0,H.current?.click(),Y.current=!1)}},fe=Et("div",t,{ref:[K,a,_.ref,H],state:I,props:[N,W,h,G]}),te=x.useMemo(()=>({selected:P,index:L,textRef:b,selectedByFocus:U,hasRegistered:V}),[P,L,b,U,V]);return s.jsx(ZN.Provider,{value:te,children:fe})})),F6=x.forwardRef(function(t,a){const o=t.keepMounted??!1,{selected:l}=H_();return o||l?s.jsx(G6,{...t,ref:a}):null}),G6=x.memo(x.forwardRef((e,t)=>{const{render:a,className:o,style:l,keepMounted:c,...d}=e,{selected:p}=H_(),m=x.useRef(null),{transitionStatus:g,setMounted:h}=pi(p),_=Et("span",e,{ref:[t,m],state:{selected:p,transitionStatus:g},props:[{"aria-hidden":!0,children:"✔️"},d],stateAttributesMapping:or});return ka({open:p,ref:m,onComplete(){p||h(!1)}}),_})),Y6=x.memo(x.forwardRef(function(t,a){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:d}=H_(),{firstItemTextRef:p,selectedItemTextRef:m}=Sa(),{render:g,className:h,style:b,..._}=t,j=x.useCallback(y=>{y&&(d&&o===0&&(p.current=y),d&&c&&(m.current=y))},[p,m,o,c,d]);return Et("div",t,{ref:[j,a,l],props:_})})),JN=x.forwardRef(function(t,a){const{render:o,className:l,style:c,direction:d,keepMounted:p=!1,...m}=t,g=d==="up",{store:h,popupRef:b,listRef:_,handleScrollArrowVisibility:j,scrollArrowsMountedCountRef:N}=Sa(),{side:y,scrollDownArrowRef:w,scrollUpArrowRef:S}=$_(),k=g?et.scrollUpArrowVisible:et.scrollDownArrowVisible,E=nt(h,k),R=nt(h,et.openMethod),A=E&&R!=="touch",T=En(),z=g?S:w,{mounted:O,transitionStatus:B,setMounted:P}=pi(A);ze(()=>(N.current+=1,h.state.hasScrollArrows||h.set("hasScrollArrows",!0),()=>{N.current=Math.max(0,N.current-1),N.current===0&&h.state.hasScrollArrows&&h.set("hasScrollArrows",!1)}),[h,N]),ka({open:A,ref:z,onComplete(){A||P(!1)}});const L=Et("div",t,{ref:[a,z],state:{direction:d,visible:A,side:y,transitionStatus:B},props:[{"aria-hidden":!0,children:g?"▲":"▼",style:{position:"absolute"},onMouseMove(H){if(H.movementX===0&&H.movementY===0||T.isStarted())return;h.set("activeIndex",null);function $(){const F=h.state.listElement??b.current;if(!F)return;h.set("activeIndex",null),j();const Y=U_(F.scrollHeight,F.clientHeight),G=If(F.scrollTop,Y),K=G===(g?0:Y),I=_.current;if(G!==F.scrollTop&&(F.scrollTop=G),I.length===0&&h.set(g?"scrollUpArrowVisible":"scrollDownArrowVisible",!K),K){T.clear();return}if(I.length>0){const X=z.current?.offsetHeight||0;F.scrollTop=K6(I,g,G,F.clientHeight,X,Y)}T.start(40,$)}T.start(40,$)},onMouseLeave(){T.clear()}},m],stateAttributesMapping:or});return O||p?L:null});function K6(e,t,a,o,l,c){if(t){let h=0;const b=a+l-Qs;for(let N=0;N<e.length;N+=1){const y=e[N];if(y&&y.offsetTop>=b){h=N;break}}const _=Math.max(0,h-1),j=e[_];return _<h&&j?If(j.offsetTop-l,c):0}let d=e.length-1;const p=a+o-l+Qs;for(let h=0;h<e.length;h+=1){const b=e[h];if(b&&b.offsetTop+b.offsetHeight>p){d=Math.max(0,h-1);break}}const m=Math.min(e.length-1,d+1),g=e[m];return m>d&&g?If(g.offsetTop+g.offsetHeight-o+l,c):c}const X6=x.forwardRef(function(t,a){return s.jsx(JN,{...t,ref:a,direction:"down"})}),Q6=x.forwardRef(function(t,a){return s.jsx(JN,{...t,ref:a,direction:"up"})}),W6=S6;function Z6({className:e,...t}){return s.jsx(A6,{"data-slot":"select-value",className:Ct("flex flex-1 text-left",e),...t})}function J6({className:e,size:t="default",children:a,...o}){return s.jsxs(R6,{"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:[a,s.jsx(M6,{render:s.jsx(ms,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function eI({className:e,children:t,side:a="bottom",sideOffset:o=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:d=!0,...p}){return s.jsx(z6,{children:s.jsx(P6,{side:a,sideOffset:o,align:l,alignOffset:c,alignItemWithTrigger:d,className:"isolate z-50",children:s.jsxs($6,{"data-slot":"select-content","data-align-trigger":d,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:[s.jsx(nI,{}),s.jsx(q6,{children:t}),s.jsx(sI,{})]})})})}function tI({className:e,children:t,...a}){return s.jsxs(V6,{"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),...a,children:[s.jsx(Y6,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:t}),s.jsx(F6,{render:s.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:s.jsx(Hr,{className:"pointer-events-none"})})]})}function nI({className:e,...t}){return s.jsx(Q6,{"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:s.jsx(db,{})})}function sI({className:e,...t}){return s.jsx(X6,{"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:s.jsx(ms,{})})}function ut({value:e,onChange:t,options:a,placeholder:o="— elegir —",disabled:l,className:c,showIcon:d=!1}){return s.jsxs(W6,{value:e,onValueChange:p=>t(p??""),disabled:l,children:[s.jsx(J6,{className:he("h-9 w-full",c),children:s.jsx(Z6,{placeholder:o,children:p=>{const m=a.find(h=>h.value===p),g=d?m?.icon:void 0;return s.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g&&s.jsx(g,{className:"size-3.5 shrink-0"}),s.jsx("span",{className:"truncate",children:m?.label??p})]})}})}),s.jsx(eI,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:a.map(p=>{const m=p.icon;return s.jsx(tI,{value:p.value,disabled:p.disabled,children:s.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m?s.jsx(m,{className:"size-4 shrink-0 text-muted-fg"}):null,p.description?s.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[s.jsx("span",{className:"truncate font-medium",children:p.label}),s.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:p.description})]}):s.jsx("span",{className:"truncate",children:p.label})]})},p.value)})})]})}const zw=320;function aI(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 rI(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function oI({m:e}){const[t,a]=x.useState(!1),o=(e.body?.length||0)>zw,l=!o||t?e.body:`${e.body.slice(0,zw)}…`;return s.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?s.jsx(zS,{size:14,className:"text-blue-400"}):s.jsx(PS,{size:14,className:"text-emerald-400"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[s.jsx("span",{className:"font-mono",children:aI(e.ts)}),s.jsx(He,{tone:"info",children:e.channel}),e.type&&s.jsx(He,{children:e.type}),s.jsx("span",{className:"font-medium text-foreground",children:rI(e)})]}),e.body&&s.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:l}),o&&s.jsx("button",{type:"button",onClick:()=>a(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:u(t?"logs.show_less":"logs.show_more")})]})]})}function lI(){const[e,t]=x.useState(!1),a=qe(e?"/admin/logs?errors":null,()=>ni.logs("errors",200)),o=a.data?.entries||[];return s.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:l=>t(l.target.open),children:[s.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[u("logs.daemon_errors"),o.length?` · ${o.length}`:""]}),s.jsxs("div",{className:"border-t border-border p-3",children:[a.isLoading&&s.jsx(rt,{}),e&&!a.isLoading&&o.length===0&&s.jsx("p",{className:"text-xs text-muted-fg",children:u("logs.no_errors")}),s.jsx("ul",{className:"space-y-1",children:o.map((l,c)=>s.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[s.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof l.ts=="string"&&s.jsx("span",{className:"font-mono",children:new Date(l.ts).toLocaleString()}),typeof l.level=="string"&&s.jsx("span",{className:"text-destructive",children:l.level})]}),s.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 iI({pid:e}){const t=!e||String(e)==="0",[a,o]=x.useState(""),[l,c]=x.useState(""),[d,p]=x.useState(""),[m,g]=x.useState(""),h=a.trim()||void 0,b=t?`/messages/global?channel=${h??""}`:`/projects/${e}/messages?channel=${h??""}`,_=qe(b,()=>t?Of.global({channel:h,limit:300}):Of.project(e,{channel:h,limit:300})),j=x.useMemo(()=>[..._.data||[]].sort((w,S)=>(S.ts||"").localeCompare(w.ts||"")),[_.data]),N=x.useMemo(()=>Array.from(new Set(j.map(w=>w.type).filter(Boolean))),[j]),y=x.useMemo(()=>j.filter(w=>!(l&&w.direction!==l||d&&w.type!==d||m&&!(w.body||"").toLowerCase().includes(m.toLowerCase()))),[j,l,d,m]);return s.jsxs(Ye,{title:u("logs.title"),description:u(t?"logs.desc_global":"logs.desc_project"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ne,{placeholder:u("logs.filter_channel"),value:a,onChange:w=>o(w.target.value),className:"w-44"}),s.jsx(se,{size:"sm",variant:"secondary",onClick:()=>_.mutate(),children:s.jsx(Vs,{size:13})})]}),children:[t&&s.jsx(lI,{}),s.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[s.jsx("div",{className:"w-36",children:s.jsx(ut,{value:l,onChange:c,placeholder:u("logs.filter_dir"),options:[{value:"",label:u("logs.all_directions")},{value:"in",label:u("logs.in")},{value:"out",label:u("logs.out")}]})}),s.jsx("div",{className:"w-40",children:s.jsx(ut,{value:d,onChange:p,placeholder:u("logs.filter_type"),options:[{value:"",label:u("logs.all_types")},...N.map(w=>({value:w,label:w}))]})}),s.jsx(Ne,{placeholder:u("logs.search_text"),value:m,onChange:w=>g(w.target.value),className:"w-56"}),s.jsxs("span",{className:"text-[11px] text-muted-fg",children:[y.length," ",u("logs.count_of")," ",j.length]})]}),_.isLoading&&s.jsx(rt,{}),_.error&&s.jsx(pt,{children:u("logs.error",{msg:_.error.message})}),!_.isLoading&&!_.error&&y.length===0&&s.jsx(pt,{children:h?u("logs.no_activity_ch",{ch:h}):u("logs.no_activity")}),s.jsx("ul",{className:"space-y-1 text-sm",children:y.map((w,S)=>s.jsx(oI,{m:w},`${w.ts}-${S}`))})]})}function eE({value:e,onChange:t,options:a,placeholder:o=u("shared_ui.model_combobox_ph"),invalid:l,invalidHint:c,className:d}){const[p,m]=x.useState(!1),[g,h]=x.useState(e),b=x.useRef(null),_=x.useRef(null),[j,N]=x.useState(null);x.useEffect(()=>{h(e)},[e]),x.useLayoutEffect(()=>{if(!p)return;const E=()=>{const R=b.current;if(!R)return;const A=R.getBoundingClientRect();N({top:A.bottom+4,left:A.left,width:A.width})};return E(),window.addEventListener("scroll",E,!0),window.addEventListener("resize",E),()=>{window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",E)}},[p]),x.useEffect(()=>{if(!p)return;const E=R=>{const A=R.target;b.current?.contains(A)||_.current?.contains(A)||m(!1)};return document.addEventListener("mousedown",E),()=>document.removeEventListener("mousedown",E)},[p]);const y=g.trim().toLowerCase(),S=y&&!(g===e)?a.filter(E=>E.toLowerCase().includes(y)):a,k=E=>{t(E),h(E),m(!1)};return s.jsxs("div",{ref:b,className:he("relative",d),children:[s.jsxs("div",{className:he("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&&s.jsx($e,{content:c||u("models_ui.invalid_hint"),children:s.jsx("span",{children:s.jsx(JS,{className:"size-3.5 shrink-0 text-amber-400"})})}),s.jsx("input",{value:g,placeholder:o,onChange:E=>{h(E.target.value),t(E.target.value),m(!0)},onFocus:()=>m(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),s.jsx("button",{type:"button",tabIndex:-1,onClick:()=>m(E=>!E),className:"shrink-0 text-muted-fg hover:text-foreground",children:s.jsx(ms,{className:"size-4"})})]}),p&&S.length>0&&j&&qs.createPortal(s.jsx("ul",{ref:_,style:{position:"fixed",top:j.top,left:j.left,width:j.width},className:"z-[1000] max-h-56 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:S.map(E=>s.jsx("li",{children:s.jsx("button",{type:"button",onMouseDown:R=>{R.preventDefault(),k(E)},className:he("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",E===e&&"bg-accent/50"),children:s.jsx("span",{className:"truncate font-mono text-xs",children:E})})},E))}),document.body)]})}function lr(){const{data:e,error:t,isLoading:a,mutate:o}=qe("/admin/config",()=>ni.config.get()),l=async(c,d)=>{const p=await ni.config.patch({set:c,unset:d});return await o({config:p.config},{revalidate:!1}),p.config};return{config:e?.config||{},error:t,isLoading:a,mutate:o,patch:l}}function tE(){const{data:e,error:t,isLoading:a,mutate:o}=qe("/admin/super-agent",()=>ni.superAgent());return{superAgent:e,error:t,isLoading:a,mutate:o}}const cI="modulepreload",uI=function(e){return"/"+e},Dw={},dI=function(t,a,o){let l=Promise.resolve();if(a&&a.length>0){let d=function(g){return Promise.all(g.map(h=>Promise.resolve(h).then(b=>({status:"fulfilled",value:b}),b=>({status:"rejected",reason:b}))))};document.getElementsByTagName("link");const p=document.querySelector("meta[property=csp-nonce]"),m=p?.nonce||p?.getAttribute("nonce");l=d(a.map(g=>{if(g=uI(g),g in Dw)return;Dw[g]=!0;const h=g.endsWith(".css"),b=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${g}"]${b}`))return;const _=document.createElement("link");if(_.rel=h?"stylesheet":cI,h||(_.as="script"),_.crossOrigin="",_.href=g,m&&_.setAttribute("nonce",m),document.head.appendChild(_),h)return new Promise((j,N)=>{_.addEventListener("load",j),_.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${g}`)))})}))}function c(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return l.then(d=>{for(const p of d||[])p.status==="rejected"&&c(p.reason);return t().catch(c)})},fI={anthropic:"from-orange-600 to-amber-600",openai:"from-emerald-600 to-teal-600",gemini:"from-blue-600 to-indigo-600",groq:"from-cyan-600 to-teal-600",openrouter:"from-violet-600 to-indigo-600",ollama:"from-amber-600 to-orange-600",azure:"from-blue-600 to-cyan-600",mock:"from-slate-600 to-gray-600",custom:"from-slate-600 to-gray-600"},pI={anthropic:"bg-orange-500/20 text-orange-300 border border-orange-500/40",openai:"bg-emerald-500/20 text-emerald-300 border border-emerald-500/40",gemini:"bg-blue-500/20 text-blue-300 border border-blue-500/40",groq:"bg-cyan-500/20 text-cyan-300 border border-cyan-500/40",openrouter:"bg-violet-500/20 text-violet-300 border border-violet-500/40",ollama:"bg-amber-500/20 text-amber-300 border border-amber-500/40",azure:"bg-blue-500/20 text-blue-300 border border-blue-500/40",mock:"bg-slate-500/20 text-slate-300 border border-slate-500/40",custom:"bg-slate-500/20 text-slate-300 border border-slate-500/40"},Lc=[{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 wh(e,t){return t&&t in e?e[t]:e.custom}const Uf={anthropic:ea,openai:un,gemini:FM,groq:su,openrouter:tu,ollama:ZS,azure:AM,mock:mx,custom:ta},Ja={anthropic:{base_url:"",default_model:"claude-sonnet-5",api_key_env:"ANTHROPIC_API_KEY",known_models:["claude-opus-4-8","claude-sonnet-5","claude-haiku-4-5","claude-fable-5"]},openai:{base_url:"https://api.openai.com/v1",default_model:"gpt-5.4-mini",api_key_env:"OPENAI_API_KEY",known_models:["gpt-5.5","gpt-5.4-mini","gpt-5.4-nano","gpt-5.1","gpt-4.1-mini"]},gemini:{base_url:"https://generativelanguage.googleapis.com/v1beta/openai",default_model:"gemini-2.5-flash",api_key_env:"GEMINI_API_KEY",known_models:["gemini-3.5-flash","gemini-3.1-pro-preview","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"]},groq:{base_url:"https://api.groq.com/openai/v1",default_model:"openai/gpt-oss-20b",api_key_env:"GROQ_API_KEY",known_models:["openai/gpt-oss-120b","openai/gpt-oss-20b","qwen/qwen3.6-27b","groq/compound","groq/compound-mini","whisper-large-v3-turbo"]},openrouter:{base_url:"https://openrouter.ai/api/v1",default_model:"openrouter/auto",api_key_env:"OPENROUTER_API_KEY",known_models:["openrouter/auto","openrouter/free","anthropic/claude-sonnet-5","openai/gpt-5.4-mini","google/gemini-2.5-flash"]},ollama:{base_url:"http://127.0.0.1:11434",default_model:"gemma2:9b",api_key_env:"",known_models:[]},azure:{base_url:"",default_model:"",api_key_env:"AZURE_OPENAI_API_KEY",known_models:[]},mock:{base_url:"",default_model:"mock",api_key_env:"",known_models:["mock"]},custom:{base_url:"",default_model:"",api_key_env:"",known_models:[]}};let Pw=!1;async function mI(){if(!Pw)try{const{Engines:e}=await dI(async()=>{const{Engines:a}=await Promise.resolve().then(()=>iL);return{Engines:a}},[]),{presets:t}=await e.presets();for(const[a,o]of Object.entries(t||{}))a in Ja&&o&&Object.assign(Ja[a],o);Pw=!0}catch{}}function nE(e){const t=e.indexOf(":");return t<0?{provider:e,model:""}:{provider:e.slice(0,t),model:e.slice(t+1)}}function kh({value:e,onChange:t,providers:a}){const{provider:o,model:l}=nE(e),c=a.find(h=>h.slug===o),d=!!o&&!c,p=x.useMemo(()=>{const h=c?Ja[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...h]))},[c]),m=h=>{const b=a.find(j=>j.slug===h),_=b?.default_model||Ja[b?.engine]?.default_model||"";t(_?`${h}:${_}`:`${h}:`)},g=h=>t(`${o}:${h}`);return s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(ut,{value:o,onChange:m,placeholder:d?u("router_panel.provider_not_found",{name:o}):u("router_panel.provider_ph"),options:a.map(h=>({value:h.slug,label:h.slug,icon:Uf[h.engine]}))}),s.jsx(eE,{value:l,onChange:g,options:p,invalid:d,invalidHint:u("router_panel.provider_not_configured",{name:o})})]})}function gI(){const e=Ze(),{superAgent:t,isLoading:a,mutate:o}=tE(),{config:l,patch:c}=lr(),[d,p]=x.useState(""),[m,g]=x.useState([]),[h,b]=x.useState(""),[_,j]=x.useState(null),[N,y]=x.useState(!1),[w,S]=x.useState({model:"",fallback:[]});x.useEffect(()=>{if(!t)return;const P=t.model_fallback?.models||[],U=Array.isArray(P)?P:[];p(t.model||""),g(U),S({model:t.model||"",fallback:U})},[t]);const k=x.useMemo(()=>{const P=l.engines||{};return Object.entries(P).map(([U,D])=>({slug:U,engine:D?.engine||U,default_model:D?.default_model||Ja[D?.engine||U]?.default_model}))},[l.engines]),E=P=>{const{provider:U}=nE(P);return k.some(D=>D.slug===U)};if(a||!t)return s.jsx(rt,{});const R=d!==w.model||JSON.stringify(m)!==JSON.stringify(w.fallback),A=async()=>{y(!0);try{await c({"super_agent.model":d,"super_agent.model_fallback.enabled":m.length>0,"super_agent.model_fallback.models":m}),e.success(u("router_panel.saved_toast")),S({model:d,fallback:m}),o()}catch(P){e.error(P.message)}finally{y(!1)}},T=()=>{const P=h.trim().replace(/:$/,"");!P||!P.includes(":")||m.includes(P)||(g([...m,P]),b(""))},z=(P,U)=>{const D=[...m];D[P]=U,g(D)},O=P=>{g(m.filter((U,D)=>D!==P)),_===P&&j(null)},B=(P,U)=>{const D=P+U;if(D<0||D>=m.length)return;const L=[...m];[L[P],L[D]]=[L[D],L[P]],g(L)};return s.jsx(Ye,{title:u("router_panel.title"),description:u("router_panel.description"),children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs(He,{tone:"success",children:[s.jsx(tu,{size:11})," ",u("router_panel.badge_default")]}),s.jsx("span",{className:`font-mono text-xs ${!E(d)&&d?"text-amber-400":""}`,children:d||"—"}),m.map(P=>s.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[s.jsx(DS,{size:12}),s.jsx("span",{className:`font-mono text-xs ${E(P)?"":"text-amber-400"}`,children:P})]},P))]}),k.length===0?s.jsx("p",{className:"text-xs text-muted-fg",children:u("router_panel.no_providers")}):s.jsx(ae,{label:u("router_panel.active_model_label"),hint:u("router_panel.active_model_hint"),children:s.jsx(kh,{value:d,onChange:p,providers:k})}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs("div",{className:"mb-2",children:[s.jsx("div",{className:"text-sm font-medium",children:u("router_panel.fallback_title")}),s.jsx("div",{className:"text-xs text-muted-fg",children:u("router_panel.fallback_desc")})]}),s.jsxs("ul",{className:"mb-3 space-y-1",children:[m.map((P,U)=>{const D=!E(P),L=_===U;return s.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"w-6 text-muted-fg",children:["#",U+1]}),L?s.jsx("div",{className:"flex-1",children:s.jsx(kh,{value:P,onChange:V=>z(U,V),providers:k})}):s.jsxs("button",{type:"button",onClick:()=>j(U),className:"flex flex-1 items-center gap-1.5 text-left",children:[D&&s.jsx(JS,{size:12,className:"text-amber-400"}),s.jsx("span",{className:`font-mono ${D?"text-amber-400":""}`,children:P})]}),L?s.jsx(se,{size:"sm",variant:"secondary",onClick:()=>j(null),children:u("router_panel.done")}):s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>j(U),children:s.jsx(ya,{size:12})}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>B(U,-1),disabled:U===0,children:"↑"}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>B(U,1),disabled:U===m.length-1,children:"↓"}),s.jsx(se,{size:"sm",variant:"destructive",onClick:()=>O(U),children:s.jsx(vn,{size:12})})]})},`${U}-${P}`)}),m.length===0&&s.jsx("li",{className:"text-xs text-muted-fg",children:u("router_panel.fallback_empty")})]}),k.length>0&&s.jsxs("div",{className:"space-y-2",children:[s.jsx("div",{className:"text-xs text-muted-fg",children:u("router_panel.add_to_chain")}),s.jsx(kh,{value:h,onChange:b,providers:k}),s.jsxs(se,{size:"sm",variant:"secondary",onClick:T,disabled:!h.includes(":")||h.endsWith(":"),children:[s.jsx(It,{size:13})," ",u("router_panel.add_to_chain")]})]})]}),s.jsx(se,{variant:"primary",loading:N,disabled:!R,onClick:A,children:u(R?"router_panel.save":"router_panel.saved")})]})})}const hI=[{model:"openai:gpt-4o",when:{has_image:!0}},{model:"anthropic:claude-3-5-haiku",when:{max_prompt_chars:400}}];function xI({when:e}){const t=[];return!e||Object.keys(e).length===0?t.push({icon:s.jsx(Fr,{size:11}),label:u("routing_panel.when_any")}):(e.has_image===!0&&t.push({icon:s.jsx(gx,{size:11}),label:u("routing_panel.when_image")}),e.has_image===!1&&t.push({icon:s.jsx(gx,{size:11}),label:u("routing_panel.when_no_image")}),Number.isFinite(e.min_prompt_chars)&&t.push({icon:s.jsx(Wg,{size:11}),label:u("routing_panel.when_min_prompt",{n:String(e.min_prompt_chars)})}),Number.isFinite(e.max_prompt_chars)&&t.push({icon:s.jsx(Wg,{size:11}),label:u("routing_panel.when_max_prompt",{n:String(e.max_prompt_chars)})}),Number.isFinite(e.min_context_chars)&&t.push({icon:s.jsx(Wg,{size:11}),label:u("routing_panel.when_min_context",{n:String(e.min_context_chars)})}),Array.isArray(e.channels)&&e.channels.length>0&&t.push({icon:s.jsx(u3,{size:11}),label:u("routing_panel.when_channels",{list:e.channels.join(", ")})}),Array.isArray(e.keywords)&&e.keywords.length>0&&t.push({icon:s.jsx(KM,{size:11}),label:u("routing_panel.when_keywords",{list:e.keywords.join(", ")})})),s.jsx("div",{className:"flex flex-wrap items-center gap-1.5",children:t.map((a,o)=>s.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-muted px-1.5 py-0.5 text-[11px] text-muted-fg",children:[a.icon," ",a.label]},o))})}function bI(){const e=Ze(),{config:t,isLoading:a,patch:o}=lr(),[l,c]=x.useState(!1),[d,p]=x.useState("[]"),[m,g]=x.useState(!1),[h,b]=x.useState(!1),[_,j]=x.useState(!1),[N,y]=x.useState({enabled:!1,rulesText:"[]"});x.useEffect(()=>{const O=t.super_agent?.routing||{},B=Array.isArray(O.rules)?O.rules:[],P=JSON.stringify(B,null,2);c(O.enabled===!0),p(P),y({enabled:O.enabled===!0,rulesText:P})},[t.super_agent?.routing]);const w=x.useMemo(()=>{try{const O=JSON.parse(d);return Array.isArray(O)?{rules:O,error:null}:{rules:[],error:u("routing_panel.json_not_array")}}catch(O){return{rules:[],error:u("routing_panel.json_error",{msg:O.message})}}},[d]);if(a)return s.jsx(rt,{});const S=w.rules,k=S.length,E=w.error?d:JSON.stringify(S),R=(()=>{try{return JSON.stringify(JSON.parse(N.rulesText))}catch{return N.rulesText}})(),A=l!==N.enabled||E!==R,T=async()=>{if(!w.error){b(!0);try{await o({"super_agent.routing":{enabled:l,rules:S}}),e.success(u("routing_panel.saved_toast"));const O=JSON.stringify(S,null,2);p(O),y({enabled:l,rulesText:O})}catch(O){e.error(O.message)}finally{b(!1),j(!1)}}},z=l&&k>0;return s.jsxs("div",{"data-testid":"routing-panel",children:[s.jsx(Ye,{title:u("routing_panel.title"),description:u("routing_panel.description"),children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[s.jsx("span",{"data-testid":"routing-signal",children:z?s.jsxs(He,{tone:"success",children:[s.jsx(Qg,{size:11})," ",u("routing_panel.signal_on",{n:String(k)})]}):l?s.jsxs(He,{tone:"warning",children:[s.jsx(Qg,{size:11})," ",u("routing_panel.signal_on_empty")]}):s.jsxs(He,{tone:"muted",children:[s.jsx(Qg,{size:11})," ",u("routing_panel.signal_off")]})}),s.jsx($e,{content:u("routing_panel.helper"),children:s.jsx("span",{className:"text-xs text-muted-fg underline decoration-dotted underline-offset-2",children:u("routing_panel.how_it_works")})})]}),s.jsx(Bt,{checked:l,onChange:c,label:u("routing_panel.enable_label")}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm font-medium",children:u("routing_panel.rules_title")}),s.jsx("div",{className:"text-xs text-muted-fg",children:u("routing_panel.rules_desc")})]}),s.jsx(se,{size:"sm",variant:"secondary",onClick:()=>g(O=>!O),children:u(m?"routing_panel.hide_editor":"routing_panel.edit_rules")})]}),s.jsxs("ul",{className:"space-y-1.5",children:[S.map((O,B)=>s.jsxs("li",{className:"rounded-md bg-card px-2.5 py-2 text-xs",children:[s.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[s.jsxs("span",{className:"w-6 text-muted-fg",children:["#",B+1]}),s.jsx("span",{className:"font-mono text-[12px]",children:O.model||"—"})]}),s.jsx("div",{className:"pl-8",children:s.jsx(xI,{when:O.when})})]},B)),k===0&&!w.error&&s.jsx("li",{className:"text-xs text-muted-fg",children:u("routing_panel.rules_empty")})]})]}),m&&s.jsxs(ae,{label:u("routing_panel.editor_label"),hint:u("routing_panel.json_hint"),children:[s.jsx(on,{rows:10,className:"font-mono text-xs",value:d,onChange:O=>p(O.target.value),spellCheck:!1}),w.error?s.jsx("span",{className:"mt-1 block text-[11px] text-red-400",children:w.error}):s.jsx("button",{type:"button",className:"mt-1 text-[11px] text-muted-fg underline decoration-dotted underline-offset-2",onClick:()=>p(JSON.stringify(hI,null,2)),children:u("routing_panel.insert_example")})]}),s.jsx("p",{className:"text-[11px] leading-relaxed text-muted-fg",children:u("routing_panel.helper")}),s.jsx(se,{variant:"primary",loading:h,disabled:!A||!!w.error,onClick:()=>j(!0),children:u(A?"routing_panel.save":"routing_panel.saved")})]})}),s.jsx(Zt,{open:_,onClose:()=>j(!1),title:u("routing_panel.confirm_title"),description:u("routing_panel.confirm_body"),footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:()=>j(!1),children:u("routing_panel.cancel")}),s.jsx(se,{variant:"primary",loading:h,onClick:T,children:u("routing_panel.confirm_apply")})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:l?u("routing_panel.confirm_on",{n:String(k)}):u("routing_panel.confirm_off")})})]})}function _I({provider:e,onEdit:t,onDelete:a,onToggle:o}){const l=wh(fI,e.engine),c=wh(pI,e.engine),d=wh(Uf,e.engine),p=Lc.find(b=>b.value===e.engine)?.label||e.engine,m=typeof e.api_key=="string"&&e.api_key.length>0,g=Do(e.api_key),h=e.is_active!==!1;return s.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:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:he("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",l),children:s.jsx(d,{className:"size-5 text-white"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),s.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),s.jsxs("span",{className:he("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[s.jsx(d,{className:"size-3"})," ",p]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[s.jsx($e,{content:u(h?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:s.jsxs("button",{type:"button",onClick:b=>{b.stopPropagation(),o()},className:he("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",h?"border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10":"border-border text-muted-fg hover:text-foreground"),children:[s.jsx("span",{className:he("size-1.5 rounded-full",h?"bg-emerald-400":"bg-muted-fg/40")}),u(h?"providers_card.active":"providers_card.off")]})}),s.jsx($e,{content:u("providers_modal.delete"),children:s.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),a()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:s.jsx(vn,{className:"size-3.5"})})})]})]}),s.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[s.jsx(fc,{label:u("providers_card.model"),value:e.default_model||"—",mono:!0}),e.base_url&&s.jsx(fc,{label:u("providers_card.base_url"),value:e.base_url,mono:!0,truncate:!0}),s.jsx(fc,{label:u("providers_card.api_key"),value:m?g?`…${g}`:u("providers_card.key_set"):"—",mono:!!g}),e.default_temperature!==void 0&&s.jsx(fc,{label:u("providers_card.temp"),value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&s.jsx(fc,{label:u("providers_card.price_io"),value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function fc({label:e,value:t,mono:a,truncate:o}){return s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:e}),s.jsx("span",{className:he("text-foreground",a&&"font-mono",o&&"max-w-[180px] truncate"),children:t})]})}const Lw={name:"",slug:"",engine:"anthropic",base_url:"",api_key_value:"",default_model:"",default_temperature:.7,default_max_tokens:4096,is_active:!0,context_limit_tokens:2e5,model_context_limits_json:"",p_input:"",p_output:"",p_cache_read:"",p_cache_write:""},vI=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function pc(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Vd(e){if(e==null)return"";const t=Number(e);return Number.isFinite(t)?String(t):""}function yI(e){return{name:e.name||e.slug,slug:e.slug,engine:e.engine||"custom",base_url:e.base_url||"",api_key_value:"",default_model:e.default_model||"",default_temperature:e.default_temperature??.7,default_max_tokens:e.default_max_tokens??4096,is_active:e.is_active!==!1,context_limit_tokens:e.context_limit_tokens??2e5,model_context_limits_json:e.model_context_limits?JSON.stringify(e.model_context_limits,null,2):"",p_input:Vd(e.pricing?.input_per_million),p_output:Vd(e.pricing?.output_per_million),p_cache_read:Vd(e.pricing?.cache_read_per_million),p_cache_write:Vd(e.pricing?.cache_write_per_million)}}function jI({open:e,initial:t,existingSlugs:a,onClose:o,onSave:l}){const c=!!t,[d,p]=x.useState(Lw),[m,g]=x.useState(!1),[h,b]=x.useState(null),[_,j]=x.useState([]),[N,y]=x.useState(!1),[w,S]=x.useState(null),[k,E]=x.useState(!1),[R,A]=x.useState("");x.useEffect(()=>{if(!e)return;const G=t?yI(t):Lw;p(G),b(null),S(null),E(!1);const K=Ja[G.engine];j(K?.known_models||[])},[e,t]);const T=G=>p(K=>({...K,...G})),z=G=>{const K=Ja[G];T({engine:G,name:G==="custom"?d.name:Lc.find(I=>I.value===G)?.label||G,slug:G==="custom"?d.slug:G,base_url:K.base_url,default_model:K.default_model}),j(K.known_models),S(null)},O=G=>{const K=Ja[G];T({engine:G,base_url:d.base_url||K.base_url,default_model:d.default_model||K.default_model}),j(K.known_models)},B=async()=>{y(!0),S(null);try{const G=await Gc.models({engine:d.engine,slug:d.slug||pc(d.name),base_url:d.base_url||void 0,api_key:d.api_key_value||void 0});if(G.error){S(G.error);return}j(G.models),G.models.length===0&&S(u("providers_modal.err_no_models"))}catch(G){S(G.message||u("providers_modal.err_list_models"))}finally{y(!1)}},P=x.useMemo(()=>d.default_model&&!_.includes(d.default_model)?[d.default_model,..._]:_,[_,d.default_model]),U=()=>{const G=(d.slug||pc(d.name)).trim();if(!G)return b(u("providers_modal.err_slug_required")),null;if(!c&&a.includes(G))return b(u("providers_modal.err_slug_exists",{slug:G})),null;let K;if(d.model_context_limits_json.trim())try{const Z=JSON.parse(d.model_context_limits_json);if(!Z||typeof Z!="object"||Array.isArray(Z))throw new Error;K=Z}catch{return b(u("providers_modal.err_model_limits_json")),null}const X=[d.p_input,d.p_output,d.p_cache_read,d.p_cache_write].map(Z=>Z.trim()).some(Boolean)?{input_per_million:Number(d.p_input||0),output_per_million:Number(d.p_output||0),cache_read_per_million:Number(d.p_cache_read||0),cache_write_per_million:Number(d.p_cache_write||0)}:void 0;return{provider:{slug:G,name:d.name.trim()||G,engine:d.engine,base_url:d.base_url.trim()||void 0,default_model:d.default_model.trim()||void 0,default_temperature:d.default_temperature,default_max_tokens:d.default_max_tokens,is_active:d.is_active,context_limit_tokens:d.context_limit_tokens||void 0,model_context_limits:K,pricing:X},modelLimits:K}},D=()=>{const G=U();if(!G)return;const{provider:K}=G,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),d.api_key_value.trim()&&(I.api_key=d.api_key_value.trim()),A(JSON.stringify(I,null,2)),b(null),E(!0)},L=async()=>{g(!0),b(null);try{if(k){const K=(d.slug||pc(d.name)).trim();if(!K){b(u("providers_modal.err_slug_required_form"));return}let I;try{I=JSON.parse(R)}catch{b(u("providers_modal.err_json_invalid"));return}if(!I||typeof I!="object"||Array.isArray(I)){b(u("providers_modal.err_json_object"));return}const X=I;if(!X.engine||typeof X.engine!="string"){b(u("providers_modal.err_engine_missing"));return}const Z={slug:K,name:typeof X.name=="string"?X.name:K,engine:String(X.engine),base_url:typeof X.base_url=="string"?X.base_url:void 0,default_model:typeof X.default_model=="string"?X.default_model:void 0,is_active:X.is_active!==!1};await l({provider:Z,raw:X,originalSlug:t?.slug}),o();return}const G=U();if(!G)return;await l({provider:G.provider,apiKeyValue:d.api_key_value.trim()||void 0,originalSlug:t?.slug}),o()}catch(G){b(G.message||u("providers_modal.err_save"))}finally{g(!1)}},V=c&&ds(t?.api_key),H=Do(t?.api_key),$=V?u("providers_modal.api_key_set",{suffix:H??""}):"sk-…",F=d.engine==="ollama",Y=Ja[d.engine]?.api_key_env;return s.jsx(Zt,{open:e,onClose:o,title:c?u("providers_modal.edit_title",{name:t?.name||t?.slug||""}):u("providers_modal.new_title"),description:u("providers_modal.description"),size:"lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:o,disabled:m,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:L,loading:m,children:u(c?"common.save":"common.create")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[c?s.jsx("span",{}):s.jsx("div",{className:"flex flex-wrap gap-1.5",children:vI.map(G=>{const K=Uf[G],I=G==="custom"?u("providers_modal.custom"):Lc.find(Z=>Z.value===G)?.label||G,X=d.engine===G;return s.jsxs("button",{type:"button",onClick:()=>z(G),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${X?"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:[s.jsx(K,{className:"size-3.5"})," ",I]},G)})}),s.jsxs("button",{type:"button",onClick:()=>k?E(!1):D(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${k?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[s.jsx(jM,{className:"size-3.5"})," ",u(k?"providers_modal.form_mode":"providers_modal.json_mode")]})]}),k?s.jsxs("div",{className:"space-y-2",children:[s.jsx(ae,{label:u("providers_modal.json_label"),hint:u("providers_modal.json_hint",{slug:d.slug||pc(d.name)||"<slug>"}),children:s.jsx(on,{rows:14,className:"font-mono text-xs",value:R,onChange:G=>A(G.target.value),spellCheck:!1})}),s.jsx("p",{className:"text-[11px] text-muted-fg",children:u("providers_modal.json_help")})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("providers_modal.name_label"),children:s.jsx(Ne,{value:d.name,onChange:G=>T({name:G.target.value,slug:c?d.slug:pc(G.target.value)}),placeholder:u("providers_modal.name_ph")})}),s.jsx(ae,{label:u("providers_modal.engine_label"),children:s.jsx(ut,{value:d.engine,onChange:G=>O(G),options:Lc.map(G=>({value:G.value,label:G.label,icon:Uf[G.value]}))})})]}),s.jsx(ae,{label:u("providers_modal.base_url_label"),hint:u("providers_modal.base_url_hint"),children:s.jsx(Ne,{value:d.base_url,onChange:G=>T({base_url:G.target.value}),placeholder:u("providers_modal.base_url_ph")})}),!F&&s.jsx(ae,{label:u("providers_modal.api_key_label"),hint:V?u("providers_modal.api_key_hint_existing"):Y?u("providers_modal.api_key_hint_env",{env:Y}):u("providers_modal.api_key_hint"),children:s.jsx(Ne,{type:"password",autoComplete:"new-password",value:d.api_key_value,onChange:G=>T({api_key_value:G.target.value}),placeholder:$})}),s.jsx(ae,{label:u("providers_modal.model_label"),children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(eE,{value:d.default_model,onChange:G=>T({default_model:G}),options:P,className:"flex-1"}),s.jsx($e,{content:u("providers_modal.list_models_hint"),children:s.jsxs(se,{size:"sm",variant:"secondary",onClick:B,disabled:N,"aria-label":u("providers_modal.list_models_hint"),children:[N?s.jsx(Ir,{className:"size-3.5 animate-spin"}):s.jsx(Vs,{className:"size-3.5"}),u("providers_modal.load_models")]})})]}),w&&s.jsx("p",{className:"text-[11px] text-amber-400",children:w})]})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("providers_modal.max_tokens_label"),children:s.jsx(Ne,{type:"number",min:256,step:256,value:d.default_max_tokens,onChange:G=>T({default_max_tokens:parseInt(G.target.value)||4096})})}),s.jsx(ae,{label:u("providers_modal.temperature_label",{value:d.default_temperature.toFixed(1)}),children:s.jsx("input",{type:"range",min:0,max:2,step:.1,value:d.default_temperature,onChange:G=>T({default_temperature:parseFloat(G.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),s.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[s.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:u("providers_modal.pricing_summary")}),s.jsxs("div",{className:"mt-3 space-y-3",children:[s.jsx(ae,{label:u("providers_modal.context_limit_label"),children:s.jsx(Ne,{type:"number",min:0,step:1024,value:d.context_limit_tokens,onChange:G=>T({context_limit_tokens:parseInt(G.target.value)||0})})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("providers_modal.price_input"),children:s.jsx(Ne,{type:"number",min:0,step:1e-4,value:d.p_input,onChange:G=>T({p_input:G.target.value}),placeholder:"0.15"})}),s.jsx(ae,{label:u("providers_modal.price_output"),children:s.jsx(Ne,{type:"number",min:0,step:1e-4,value:d.p_output,onChange:G=>T({p_output:G.target.value}),placeholder:"0.60"})}),s.jsx(ae,{label:u("providers_modal.price_cache_read"),children:s.jsx(Ne,{type:"number",min:0,step:1e-4,value:d.p_cache_read,onChange:G=>T({p_cache_read:G.target.value}),placeholder:"0.03"})}),s.jsx(ae,{label:u("providers_modal.price_cache_write"),children:s.jsx(Ne,{type:"number",min:0,step:1e-4,value:d.p_cache_write,onChange:G=>T({p_cache_write:G.target.value}),placeholder:"0.00"})})]}),s.jsx(ae,{label:u("providers_modal.model_limits_label"),hint:'{"gpt-4o-mini":128000}',children:s.jsx(on,{rows:3,className:"font-mono text-xs",value:d.model_context_limits_json,onChange:G=>T({model_context_limits_json:G.target.value})})})]})]}),s.jsx(Bt,{checked:d.is_active,onChange:G=>T({is_active:G}),label:u("providers_modal.active_label")})]}),h&&s.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:h})]})})}const wI=new Set(Lc.map(e=>e.value));function kI(e,t){const a=typeof t.engine=="string"&&t.engine||(wI.has(e)?e:"custom");return{slug:e,name:typeof t.name=="string"?t.name:void 0,engine:a,base_url:typeof t.base_url=="string"?t.base_url:void 0,api_key:typeof t.api_key=="string"?t.api_key:void 0,default_model:typeof t.default_model=="string"?t.default_model:void 0,default_temperature:typeof t.default_temperature=="number"?t.default_temperature:void 0,default_max_tokens:typeof t.default_max_tokens=="number"?t.default_max_tokens:void 0,is_active:typeof t.is_active=="boolean"?t.is_active:void 0,context_limit_tokens:typeof t.context_limit_tokens=="number"?t.context_limit_tokens:void 0,model_context_limits:t.model_context_limits||void 0,pricing:t.pricing||void 0}}function SI(){const e=Ze(),{config:t,isLoading:a,patch:o,mutate:l}=lr(),[c,d]=x.useState(!1),[p,m]=x.useState(null);if(a)return s.jsx(rt,{});const g=t.engines||{},h=Object.entries(g).map(([S,k])=>kI(S,k||{})),b=h.map(S=>S.slug),_=()=>{m(null),d(!0)},j=S=>{m(S),d(!0)},N=async({provider:S,apiKeyValue:k,raw:E})=>{if(E){await o({[`engines.${S.slug}`]:E}),e.success(u("engines_panel.saved_json")),l();return}const R=`engines.${S.slug}`,A={[`${R}.name`]:S.name,[`${R}.engine`]:S.engine,[`${R}.is_active`]:S.is_active!==!1,[`${R}.default_temperature`]:S.default_temperature,[`${R}.default_max_tokens`]:S.default_max_tokens},T=[],z=(O,B)=>{B===void 0||B===""?T.push(`${R}.${O}`):A[`${R}.${O}`]=B};z("base_url",S.base_url),z("default_model",S.default_model),z("context_limit_tokens",S.context_limit_tokens),z("pricing",S.pricing),z("model_context_limits",S.model_context_limits),k&&(A[`${R}.api_key`]=k),await o(A,T),e.success(u("engines_panel.saved")),l()},y=async S=>{try{await o({[`engines.${S.slug}.is_active`]:S.is_active===!1}),l()}catch(k){e.error(k.message)}},w=async S=>{if(confirm(u("engines_panel.delete_confirm",{name:S.name||S.slug})))try{await o(void 0,[`engines.${S.slug}`]),e.success(u("engines_panel.deleted")),l()}catch(k){e.error(k.message)}};return s.jsxs(Ye,{title:u("engines_panel.title"),description:u("engines_panel.description"),action:s.jsxs(se,{size:"sm",variant:"primary",onClick:_,children:[s.jsx(It,{size:14})," ",u("engines_panel.new_btn")]}),children:[h.length===0?s.jsx(pt,{children:u("engines_panel.empty")}):s.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[h.map(S=>s.jsx(_I,{provider:S,onEdit:()=>j(S),onDelete:()=>w(S),onToggle:()=>y(S)},S.slug)),s.jsxs("button",{type:"button",onClick:_,className:"flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border text-muted-fg transition-colors hover:border-muted-fg/60 hover:text-foreground",children:[s.jsx(It,{size:20}),s.jsx("span",{className:"text-sm font-medium",children:u("engines_panel.add_card")})]})]}),s.jsx(jI,{open:c,initial:p,existingSlugs:b,onClose:()=>{d(!1),m(null)},onSave:N})]})}function sE(){return s.jsxs("div",{className:"space-y-6",children:[s.jsx(gI,{}),s.jsx(bI,{}),s.jsx(SI,{})]})}function CI(){const e=Ze(),[t,a]=x.useState(!1),l=qe(t?"/agents/vault?include_removed=1":"/agents/vault",()=>cn.vault({includeRemoved:t})),c=l.data||[],[d,p]=x.useState(null),m=async h=>{const b=h.source!=="user",_=b?u("base.defaults_tombstone_msg",{slug:h.slug}):u("base.defaults_delete_msg",{slug:h.slug});if(confirm(_))try{await cn.vaultRemove(h.slug),e.success(u(b?"base.defaults_hidden":"base.defaults_deleted")),l.mutate()}catch(j){e.error(j.message)}},g=async h=>{try{await cn.vaultRestore(h),e.success(u("base.defaults_restored")),l.mutate()}catch(b){e.error(b.message)}};return s.jsxs(Ye,{title:u("base.defaults_title"),description:u("base.defaults_desc"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Bt,{checked:t,onChange:a,label:u("base.defaults_show_removed")}),s.jsxs(se,{size:"sm",onClick:()=>p("new"),children:[s.jsx(It,{size:14})," ",u("base.defaults_new")]})]}),children:[l.isLoading&&s.jsx(rt,{}),!l.isLoading&&c.length===0&&s.jsx(pt,{children:u("base.defaults_empty")}),s.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(h=>{const b=t&&h.tombstoned;return s.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:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-slate-600 to-gray-600",children:h.is_master?s.jsx(xa,{className:"size-4 text-white"}):s.jsx(un,{className:"size-4 text-white"})}),s.jsx("span",{className:"truncate text-sm font-semibold",children:h.slug}),s.jsx(NI,{source:h.source})]}),s.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:b?s.jsx(Sh,{label:u("base.defaults_restore"),onClick:()=>g(h.slug),variant:"secondary",children:s.jsx(ui,{size:13})}):s.jsxs(s.Fragment,{children:[s.jsx(Sh,{label:u("base.defaults_edit"),onClick:()=>p(h),variant:"ghost",children:s.jsx(ya,{size:13})}),s.jsx(Sh,{label:h.source==="user"?u("base.defaults_delete"):u("base.defaults_hide"),onClick:()=>m(h),variant:"ghost-destructive",children:s.jsx(vn,{size:13})})]})})]}),h.model?s.jsx(He,{tone:"info",children:h.model}):s.jsx("span",{className:"text-[10px] text-muted-fg",children:u("agents_ui.model_router_default")}),h.description&&s.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:h.description}),s.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.role&&s.jsx(He,{children:h.role}),h.skills?.map(_=>s.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[s.jsx(ea,{size:9})," ",_]},_)),h.tools?.map(_=>s.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[s.jsx(ta,{size:9})," ",_]},_))]})]},h.slug)})}),d!==null&&s.jsx(EI,{agent:d==="new"?null:d,onClose:()=>p(null),onSaved:()=>{p(null),l.mutate()}})]})}function NI({source:e}){return e==="user"?s.jsx(He,{tone:"success",children:u("agents_ui.source_user")}):e==="user-override"?s.jsx(He,{tone:"warning",children:u("agents_ui.source_override")}):s.jsx(He,{tone:"muted",children:u("agents_ui.source_bundled")})}function Sh({label:e,onClick:t,variant:a="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 s.jsxs(f_,{children:[s.jsx(p_,{render:s.jsx("button",{type:"button",onClick:t,"aria-label":e,className:`${l} ${c[a]}`,children:o})}),s.jsx(m_,{children:e})]})}function EI({agent:e,onClose:t,onSaved:a}){const o=Ze(),[l,c]=x.useState(!1),d=!e,[p,m]=x.useState(e?.slug??""),[g,h]=x.useState(e?.role??""),[b,_]=x.useState(e?.model??""),[j,N]=x.useState(e?.description??""),[y,w]=x.useState(e?.language??"es"),[S,k]=x.useState((e?.skills??[]).join(", ")),[E,R]=x.useState((e?.tools??[]).join(", ")),[A,T]=x.useState(!!e?.is_master),[z,O]=x.useState(e?.body??""),B=async()=>{const P={role:g||void 0,model:b||void 0,description:j||void 0,language:y||void 0,skills:S,tools:E,is_master:A};c(!0);try{if(d){if(!/^[a-z][a-z0-9_-]*$/.test(p))throw new Error(u("base.defaults_slug_invalid"));await cn.vaultCreate(p,P,z),o.success(u("base.defaults_created",{slug:p}))}else await cn.vaultPatch(e.slug,{fields:P,body:z}),o.success(u("base.defaults_saved",{slug:e.slug}));a()}catch(U){o.error(U.message)}finally{c(!1)}};return s.jsx(Zt,{open:!0,onClose:t,title:d?u("base.defaults_new_title"):u("base.defaults_edit_title",{slug:e.slug}),description:d?u("base.defaults_new_desc"):e.source==="bundled"?u("base.defaults_bundled_desc"):u("base.defaults_user_desc"),size:"lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:l,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:B,loading:l,children:u("common.save")})]}),children:s.jsxs("div",{className:"space-y-3",children:[d&&s.jsx(ae,{label:"slug",hint:u("agents_ui.slug_kebab_hint"),children:s.jsx(Ne,{autoFocus:!0,value:p,onChange:P=>m(P.target.value),placeholder:"reviewer"})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:"role",children:s.jsx(Ne,{value:g,onChange:P=>h(P.target.value),placeholder:"Code reviewer"})}),s.jsx(ae,{label:"model",children:s.jsx(Ne,{value:b,onChange:P=>_(P.target.value),placeholder:"openrouter:..."})}),s.jsx(ae,{label:"language",children:s.jsx(Ne,{value:y,onChange:P=>w(P.target.value),placeholder:"es"})}),s.jsx(ae,{label:"is_master",children:s.jsx("div",{className:"flex h-9 items-center",children:s.jsx(Bt,{checked:A,onChange:T,label:u("base.defaults_master_label")})})})]}),s.jsx(ae,{label:"description",children:s.jsx(Ne,{value:j,onChange:P=>N(P.target.value)})}),s.jsx(ae,{label:"skills",hint:u("agents_ui.comma_separated"),children:s.jsx(Ne,{value:S,onChange:P=>k(P.target.value),placeholder:"code-review, git"})}),s.jsx(ae,{label:"tools",hint:u("agents_ui.comma_separated"),children:s.jsx(Ne,{value:E,onChange:P=>R(P.target.value),placeholder:"read, write, run"})}),s.jsx(ae,{label:"body",hint:u("agents_ui.body_hint"),children:s.jsx(on,{value:z,onChange:P=>O(P.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const RI=20,Iw=[10,20,50,100];function q_({key:e,fetchPage:t,resetKey:a,initialPageSize:o=RI,swr:l}){const[c,d]=x.useState(1),[p,m]=x.useState(o);x.useEffect(()=>{d(1)},[a]);const g=(c-1)*p,h=qe(e==null?null:[e,p,g],()=>t(p,g),{keepPreviousData:!0,...l}),b=h.data?.total??0,_=Math.max(1,Math.ceil(b/p)),j=Math.min(c,_);x.useEffect(()=>{c!==j&&d(j)},[c,j]);const N=b===0?0:g,y=Math.min(g+p,b);return{items:h.data?.items??[],isLoading:h.isLoading,error:h.error,mutate:h.mutate,page:j,pageCount:_,total:b,start:N,end:y,pageSize:p,setPage:d,setPageSize:w=>{m(w),d(1)}}}function TI({page:e,pageCount:t,total:a,start:o,end:l,pageSize:c,onPage:d,onPageSize:p}){return a<=Iw[0]?null:s.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-between gap-3 text-xs text-muted-fg",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"tabular-nums",children:u("common.pager_range",{from:o+1,to:l,total:a})}),s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{children:u("common.pager_per_page")}),s.jsx("div",{className:"w-[4.5rem]",children:s.jsx(ut,{value:String(c),onChange:m=>p(Number(m)),options:Iw.map(m=>({value:String(m),label:String(m)}))})})]})]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(se,{size:"sm",variant:"ghost",disabled:e<=1,onClick:()=>d(e-1),"aria-label":u("common.pager_prev"),children:s.jsx(SM,{size:14})}),s.jsx("span",{className:"px-1 tabular-nums",children:u("common.pager_page",{page:e,total:t})}),s.jsx(se,{size:"sm",variant:"ghost",disabled:e>=t,onClick:()=>d(e+1),"aria-label":u("common.pager_next"),children:s.jsx(Fr,{size:14})})]})]})}function V_({paged:e,fullHeight:t,className:a,children:o}){const l=s.jsx(TI,{page:e.page,pageCount:e.pageCount,total:e.total,start:e.start,end:e.end,pageSize:e.pageSize,onPage:e.setPage,onPageSize:e.setPageSize});return t?s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[s.jsx("div",{className:he("min-h-0 flex-1 overflow-y-auto",a),children:o}),s.jsx("div",{className:"shrink-0",children:l})]}):s.jsxs("div",{className:a,children:[o,l]})}const AI={apx:"success",claude:"info",codex:"warning"};function MI({pid:e}={}){const t=Ze(),a=Sp(),o=!e||String(e)==="0",{project:l}=du(o?"":e),c=o?void 0:l?.path||void 0,[d,p]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(!1);x.useEffect(()=>{const R=setTimeout(()=>b(m.trim()),350);return()=>clearTimeout(R)},[m]);const N=q_({key:`/sessions?engine=${d}&q=${h}&deep=${_?1:0}&cwd=${c||""}`,fetchPage:(R,A)=>oL.page({engine:d||void 0,q:h||void 0,deep:_,cwd:c,limit:R,offset:A}),resetKey:`${d}|${h}|${_?1:0}|${c||""}`}),y=()=>{g(""),b(""),p(""),j(!1)},w=async R=>{try{await navigator.clipboard.writeText(`apx session resume ${R.id} --continue`),t.success(u("base.sessions_cmd_copied"))}catch{t.error(u("base.sessions_copy_failed"))}},S=R=>{const A=`Continue this session: ${R.id} (engine: ${R.engine}${R.title?`, title: "${R.title}"`:""}${R.cwd?`, folder: ${R.cwd}`:""}). With these instructions: `;window.dispatchEvent(new CustomEvent("apx:roby-prompt",{detail:{prompt:A}}))},k=async R=>{if(!R.cwd){t.error(u("base.sessions_no_folder"));return}try{await hN.exec({kind:"open_path",target:R.cwd})}catch(A){t.error(u("base.sessions_folder_failed",{msg:A.message}))}},E=async R=>{const A=R.path||R.cwd;if(!A){t.error(u("base.sessions_no_path"));return}try{await navigator.clipboard.writeText(A),t.success(u("base.sessions_path_copied"))}catch{t.error(u("base.sessions_copy_failed"))}};return s.jsxs(Ye,{fullHeight:!0,title:u("base.sessions_title"),description:o?u("base.sessions_desc"):u("base.sessions_desc_scoped",{path:c||"…"}),action:s.jsx($e,{content:u("base.sessions_refresh"),children:s.jsx(se,{size:"sm",variant:"secondary",onClick:()=>N.mutate(),children:s.jsx(Vs,{size:13})})}),children:[s.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[s.jsxs("div",{className:"relative flex-1",children:[s.jsx(Ac,{size:14,className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-fg"}),s.jsx(Ne,{className:"pl-8",placeholder:u("base.sessions_search_ph"),value:m,onChange:R=>g(R.target.value)})]}),s.jsx($e,{content:u("base.sessions_deep_tip"),children:s.jsx(se,{size:"sm",variant:_?"primary":"secondary",onClick:()=>j(R=>!R),children:u("base.sessions_deep")})}),s.jsx("div",{className:"w-36",children:s.jsx(ut,{value:d,onChange:p,options:[{value:"",label:u("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),s.jsx($e,{content:u("base.sessions_clear"),children:s.jsx(se,{size:"sm",variant:"ghost",onClick:y,children:s.jsx(Ss,{size:14})})})]}),N.isLoading&&s.jsx(rt,{}),N.error&&s.jsx(pt,{children:u("base.sessions_error",{msg:N.error.message})}),!N.isLoading&&!N.error&&N.total===0&&s.jsx(pt,{children:h?u("base.sessions_no_match",{q:h}):u("base.sessions_empty")}),s.jsx(V_,{paged:N,fullHeight:!0,children:s.jsx("ul",{className:"space-y-1 text-sm",children:N.items.map((R,A)=>s.jsxs("li",{className:"group flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx(He,{tone:AI[R.engine]||"muted",children:R.engine}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate",children:R.title||R.id}),s.jsxs("div",{className:"flex items-center gap-2 font-mono text-[10px] text-muted-fg",children:[s.jsx("span",{className:"shrink-0",children:R.id}),R.cwd&&s.jsxs("span",{className:"truncate",children:["· ",R.cwd]})]})]}),R.mtime>0&&s.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(R.mtime).toLocaleString()}),s.jsxs("div",{className:"flex shrink-0 items-center gap-0.5 opacity-60 transition-opacity group-hover:opacity-100",children:[s.jsx($e,{content:u("base.sessions_act_cmd"),children:s.jsx(se,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_cmd"),onClick:()=>w(R),children:s.jsx(ba,{size:13})})}),s.jsx($e,{content:u("base.sessions_act_ask",{name:a}),children:s.jsx(se,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_ask",{name:a}),onClick:()=>S(R),children:s.jsx(un,{size:13})})}),s.jsx($e,{content:u("base.sessions_act_folder"),children:s.jsx(se,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_folder"),onClick:()=>k(R),children:s.jsx(ci,{size:13})})}),s.jsx($e,{content:u("base.sessions_act_path"),children:s.jsx(se,{size:"sm",variant:"ghost","aria-label":u("base.sessions_act_path"),onClick:()=>E(R),children:s.jsx(No,{size:13})})})]})]},`${R.engine}-${R.id}-${A}`))})})]})}function OI(){const e=Pn(),[t,a]=x.useState("open"),o=q_({key:`/tasks?state=${t}`,fetchPage:(l,c)=>Wn.globalPage({state:t,limit:l,offset:c}),resetKey:t});return s.jsxs(Ye,{fullHeight:!0,title:u("project.global_tasks.title"),description:u("project.global_tasks.subtitle"),action:s.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(l=>s.jsx(se,{size:"sm",variant:t===l?"primary":"ghost",onClick:()=>a(l),children:l},l))}),children:[o.isLoading&&s.jsx(rt,{}),!o.isLoading&&o.total===0&&s.jsx(pt,{children:u("project.global_tasks.empty")}),s.jsx(V_,{paged:o,fullHeight:!0,children:s.jsx("ul",{className:"space-y-2 text-sm",children:o.items.map(l=>s.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("button",{type:"button",onClick:()=>e(`/p/${l.project_id}/tasks`),title:u("project.global_tasks.go_project"),children:s.jsx(He,{tone:"info",children:(l.project_name||"").split("/").pop()||l.project_id})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"font-medium",children:l.title}),s.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[s.jsx("span",{children:l.state}),l.agent&&s.jsxs(He,{tone:"muted",children:["@",l.agent]}),l.tags?.map(c=>s.jsxs("span",{children:["#",c]},c)),l.due&&s.jsxs("span",{children:[u("project.global_tasks.due")," ",l.due]})]})]})]},`${l.project_id}-${l.id}`))})})]})}const aE=x.createContext(void 0);function F_(){const e=x.useContext(aE);if(e===void 0)throw new Error(ln(64));return e}let zI=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const Rp={tabActivationDirection:e=>({[zI.activationDirection]:e})},DI=x.forwardRef(function(t,a){const{className:o,defaultValue:l=0,onValueChange:c,orientation:d="horizontal",render:p,value:m,style:g,...h}=t,b=t.defaultValue!==void 0,_=x.useRef([]),[j,N]=x.useState(()=>new Map),[y,w]=ei({controlled:m,default:l,name:"Tabs",state:"value"}),S=m!==void 0,[k,E]=x.useState(()=>new Map),R=x.useRef(void 0),A=x.useCallback(me=>{if(me===void 0)return null;for(const[Me,de]of k.entries())if(de!=null&&me===(de.value??de.index))return Me;return null},[k]),[T,z]=x.useState(()=>({previousValue:y,tabActivationDirection:"none"})),{previousValue:O,tabActivationDirection:B}=T;let P=B,U=!1;O!==y&&(P=Bw(O,y,d,k),U=O!=null&&y!=null&&A(y)==null);const D=U?O:y,L=O!==D||B!==P;ze(()=>{L&&z({previousValue:D,tabActivationDirection:P})},[D,L,P]);const V=Ue((me,Me)=>{const de=Bw(y,me,d,k);Me.activationDirection=de,c?.(me,Me),!Me.isCanceled&&w(me)}),H=Ue((me,Me)=>{c?.(me,st(Me,void 0,void 0,{activationDirection:"none"}))}),$=Ue((me,Me)=>{N(de=>{if(de.get(me)===Me)return de;const ge=new Map(de);return ge.set(me,Me),ge})}),F=Ue((me,Me)=>{N(de=>{if(!de.has(me)||de.get(me)!==Me)return de;const ge=new Map(de);return ge.delete(me),ge})}),Y=x.useCallback(me=>j.get(me),[j]),G=x.useCallback(me=>{for(const Me of k.values())if(me===Me?.value)return Me?.id},[k]),K=x.useMemo(()=>({getTabElementBySelectedValue:A,getTabIdByPanelValue:G,getTabPanelIdByValue:Y,onValueChange:V,orientation:d,registerMountedTabPanel:$,setTabMap:E,unregisterMountedTabPanel:F,tabActivationDirection:P,value:y}),[A,G,Y,V,d,$,E,F,P,y]),I=x.useMemo(()=>{for(const me of k.values())if(me!=null&&me.value===y)return me},[k,y]),X=x.useMemo(()=>{for(const me of k.values())if(me!=null&&!me.disabled)return me.value},[k]),Z=x.useRef(!b),W=x.useRef(l),fe=x.useRef(b),te=x.useRef(!1);ze(()=>{if(S)return;function me(Ce,ke){w(Ce),z(Be=>Be.previousValue===Ce&&Be.tabActivationDirection==="none"?Be:{previousValue:Ce,tabActivationDirection:"none"}),H(Ce,ke),Z.current=!1}if(k.size===0){te.current&&y!==null&&!R.current?.isConnected&&me(null,Sj);return}te.current=!0,R.current=k.keys().next().value;const Me=I?.disabled,de=I==null&&y!==null;if(!Me&&y===W.current&&(fe.current=!1),fe.current&&Me&&y===W.current)return;const ge=Z.current;if(Me||de){const Ce=X??null;if(y===Ce){Z.current=!1;return}let ke=Sj;ge?ke=Cj:Me&&(ke=x2),me(Ce,ke);return}ge&&I!=null&&(H(y,Cj),Z.current=!1)},[X,S,H,I,w,k,y]);const le=Et("div",t,{state:{orientation:d,tabActivationDirection:P},ref:a,props:h,stateAttributesMapping:Rp});return s.jsx(aE.Provider,{value:K,children:s.jsx(wp,{elementsRef:_,children:le})})});function Bw(e,t,a,o){if(e==null||t==null)return"none";let l=null,c=null;for(const[m,g]of o.entries()){if(g==null)continue;const h=g.value??g.index;if(e===h&&(l=m),t===h&&(c=m),l!=null&&c!=null)break}if(l==null||c==null)return l!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof t?a==="horizontal"?t>e?"right":"left":t>e?"down":"up":"none";const d=l.getBoundingClientRect(),p=c.getBoundingClientRect();if(a==="horizontal"){if(p.left<d.left)return"left";if(p.left>d.left)return"right"}else{if(p.top<d.top)return"up";if(p.top>d.top)return"down"}return"none"}const rE="data-composite-item-active",oE=x.createContext(void 0);function PI(){const e=x.useContext(oE);if(e===void 0)throw new Error(ln(65));return e}const LI=x.forwardRef(function(t,a){const{className:o,disabled:l=!1,render:c,value:d,id:p,nativeButton:m=!0,style:g,...h}=t,{value:b,getTabPanelIdByValue:_,orientation:j,tabActivationDirection:N}=F_(),{activateOnFocus:y,highlightedTabIndex:w,onTabActivation:S,registerTabResizeObserverElement:k,setHighlightedTabIndex:E,tabsListElement:R}=PI(),A=na(p),T=x.useMemo(()=>({disabled:l,id:A,value:d}),[l,A,d]),{compositeProps:z,compositeRef:O,index:B}=eN({metadata:T}),P=d===b,U=x.useRef(!1),D=x.useRef(null);ze(()=>{const Z=D.current;if(Z)return k(Z)},[k]),ze(()=>{if(U.current){U.current=!1;return}if(!(P&&B>-1&&w!==B))return;const Z=R;if(Z!=null){const W=Gn(xt(Z));if(W&&We(Z,W))return}l||E(B)},[P,B,w,E,l,R]);const{getButtonProps:L,buttonRef:V}=Zr({disabled:l,native:m,focusableWhenDisabled:!0}),H=_(d),$=x.useRef(!1),F=x.useRef(!1);function Y(Z){P||l||S(d,st(va,Z.nativeEvent,void 0,{activationDirection:"none"}))}function G(Z){P||(B>-1&&!l&&E(B),!l&&y&&(!$.current||$.current&&F.current)&&S(d,st(va,Z.nativeEvent,void 0,{activationDirection:"none"})))}function K(Z){if(P||l)return;$.current=!0;function W(){$.current=!1,F.current=!1}(!Z.button||Z.button===0)&&(F.current=!0,xt(Z.currentTarget).addEventListener("pointerup",W,{once:!0}))}return Et("button",t,{state:{disabled:l,active:P,orientation:j,tabActivationDirection:N},ref:[a,V,O,D],props:[z,{role:"tab","aria-controls":H,"aria-selected":P,id:A,onClick:Y,onFocus:G,onPointerDown:K,[rE]:P?"":void 0,onKeyDownCapture(){U.current=!0}},h,L],stateAttributesMapping:Rp})});let II=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=Oo.startingStyle]="startingStyle",e[e.endingStyle=Oo.endingStyle]="endingStyle",e})({});const BI={...Rp,...or},UI=x.forwardRef(function(t,a){const{className:o,value:l,render:c,keepMounted:d=!1,style:p,...m}=t,{value:g,getTabIdByPanelValue:h,orientation:b,tabActivationDirection:_,registerMountedTabPanel:j,unregisterMountedTabPanel:N}=F_(),y=na(),w=x.useMemo(()=>({id:y,value:l}),[y,l]),{ref:S,index:k}=lu({metadata:w}),E=l===g,{mounted:R,transitionStatus:A,setMounted:T}=pi(E),z=!R,O=h(l),B={hidden:z,orientation:b,tabActivationDirection:_,transitionStatus:A},P=x.useRef(null),U=Et("div",t,{state:B,ref:[a,S,P],props:[{"aria-labelledby":O,hidden:z,id:y,role:"tabpanel",tabIndex:E?0:-1,inert:bp(!E),[II.index]:k},m],stateAttributesMapping:BI});return ka({open:E,ref:P,onComplete(){E||T(!1)}}),ze(()=>{if(!(z&&!d)&&y!=null)return j(l,y),()=>{N(l,y)}},[z,d,l,y,j,N]),d||R?U:null}),$I=[];function HI(e){const{loopFocus:t=!0,orientation:a="both",grid:o,onLoop:l,direction:c,highlightedIndex:d,onHighlightedIndexChange:p,rootRef:m,enableHomeAndEndKeys:g=!1,stopEventPropagation:h=!1,disabledIndices:b,modifierKeys:_=$I}=e,[j,N]=x.useState(0),y=o!=null,w=x.useRef(null),S=nr(w,m),k=x.useRef([]),E=x.useRef(!1),R=d??j,A=Ue((P,U=!1)=>{if((p??N)(P),U){const D=k.current[P];cw(w.current,D,c,a)}}),T=Ue(P=>{if(P.size===0||E.current)return;E.current=!0;const U=Array.from(P.keys()),D=U.find(V=>V?.hasAttribute(rE))??null,L=D?U.indexOf(D):-1;if(L!==-1)A(L);else if(yf(U,R,b)){const V=Wa(U,{disabledIndices:b});Mc(U,V)||A(V)}cw(w.current,D,c,a)});ze(()=>{if(b==null||d!=null||!E.current)return;const P=k.current;if(yf(P,R,b)){const U=Wa(P,{disabledIndices:b});Mc(P,U)||A(U)}},[b,d,R,k,A]);const z=Ue((P,U,D)=>l?l(P,U,D,k):D),O=Ue(P=>{const U=g?jp:FC;if(!U.has(P.key)||qI(P,_)||!w.current)return;const L=c==="rtl",V=L?Rf:Tf,H={horizontal:V,vertical:Dc,both:V}[a],$=L?Tf:Rf,F={horizontal:$,vertical:zc,both:$}[a],Y=qn(P.nativeEvent);if(Y!=null&&iw(Y)&&!nN(Y)){const fe=Y.selectionStart,te=Y.selectionEnd,re=Y.value??"";if(fe==null||P.shiftKey||fe!==te||P.key!==F&&fe<re.length||P.key!==H&&fe>0)return}let G=R;const K=sf(k,b),I=Cx(k,b);o!=null&&(G=o({disabledIndices:b,elementsRef:k,event:P,highlightedIndex:R,loopFocus:t,maxIndex:I,minIndex:K,onLoop:z,orientation:a,rtl:L}));const X={horizontal:[V],vertical:[Dc],both:[V,Dc]}[a],Z={horizontal:[$],vertical:[zc],both:[$,zc]}[a],W=y?U:{horizontal:g?OD:qC,vertical:g?zD:VC,both:U}[a];g&&(P.key===vp?G=K:P.key===yp&&(G=I)),G===R&&(X.includes(P.key)||Z.includes(P.key))&&(t&&G===I&&X.includes(P.key)?(G=K,l&&(G=l(P,R,G,k))):t&&G===K&&Z.includes(P.key)?(G=I,l&&(G=l(P,R,G,k))):G=Wa(k.current,{startingIndex:G,decrement:Z.includes(P.key),disabledIndices:b})),G!==R&&!Mc(k.current,G)&&(h&&P.stopPropagation(),W.has(P.key)&&P.preventDefault(),A(G,!0),queueMicrotask(()=>{k.current[G]?.focus()}))});return{props:{ref:S,onFocus(P){const U=w.current,D=qn(P.nativeEvent);!U||D==null||!iw(D)||D.setSelectionRange(0,D.value.length??0)},onKeyDown:O},highlightedIndex:R,onHighlightedIndexChange:A,elementsRef:k,disabledIndices:b,onMapChange:T,relayKeyboardEvent:O}}function qI(e,t){for(const a of BD.values())if(!t.includes(a)&&e.getModifierState(a))return!0;return!1}function VI(e){const{render:t,className:a,style:o,refs:l=tr,props:c=tr,state:d=Xt,stateAttributesMapping:p,highlightedIndex:m,onHighlightedIndexChange:g,orientation:h,grid:b,loopFocus:_,onLoop:j,enableHomeAndEndKeys:N,onMapChange:y,stopEventPropagation:w=!0,rootRef:S,disabledIndices:k,modifierKeys:E,highlightItemOnHover:R=!1,tag:A="div",...T}=e,z=hp(),{props:O,highlightedIndex:B,onHighlightedIndexChange:P,elementsRef:U,onMapChange:D,relayKeyboardEvent:L}=HI({grid:b,loopFocus:_,onLoop:j,orientation:h,highlightedIndex:m,onHighlightedIndexChange:g,rootRef:S,stopEventPropagation:w,enableHomeAndEndKeys:N,direction:z,disabledIndices:k,modifierKeys:E}),V=Et(A,e,{state:d,ref:l,props:[O,...c,T],stateAttributesMapping:p}),H=x.useMemo(()=>({highlightedIndex:B,onHighlightedIndexChange:P,highlightItemOnHover:R,relayKeyboardEvent:L}),[B,P,R,L]);return s.jsx(PC.Provider,{value:H,children:s.jsx(wp,{elementsRef:U,onMapChange:$=>{y?.($),D($)},children:V})})}const FI=x.forwardRef(function(t,a){const{activateOnFocus:o=!1,className:l,loopFocus:c=!0,render:d,style:p,...m}=t,{onValueChange:g,orientation:h,value:b,setTabMap:_,tabActivationDirection:j}=F_(),[N,y]=x.useState(0),[w,S]=x.useState(null),k=x.useRef(new Set),E=x.useRef(new Set),R=x.useRef(null);ze(()=>{if(typeof ResizeObserver>"u")return;const U=new ResizeObserver(()=>{k.current.forEach(D=>{D()})});return R.current=U,w&&U.observe(w),E.current.forEach(D=>{U.observe(D)}),()=>{U.disconnect(),R.current=null}},[w]);const A=Ue(U=>(k.current.add(U),()=>{k.current.delete(U)})),T=Ue(U=>(E.current.add(U),R.current?.observe(U),()=>{E.current.delete(U),R.current?.unobserve(U)})),z=Ue((U,D)=>{U!==b&&g(U,D)}),O={orientation:h,tabActivationDirection:j},B={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},P=x.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:N,registerIndicatorUpdateListener:A,registerTabResizeObserverElement:T,onTabActivation:z,setHighlightedTabIndex:y,tabsListElement:w}),[o,N,A,T,z,y,w]);return s.jsx(oE.Provider,{value:P,children:s.jsx(VI,{render:d,className:l,style:p,state:O,refs:[a,S],props:[B,m],stateAttributesMapping:Rp,highlightedIndex:N,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:y,onMapChange:_,disabledIndices:tr})})});function Tp({className:e,...t}){return s.jsx(DI,{"data-slot":"tabs",className:Ct("flex flex-col gap-4",e),...t})}const GI=T_("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 Ap({className:e,variant:t="default",...a}){return s.jsx(FI,{"data-slot":"tabs-list","data-variant":t,className:Ct(GI({variant:t}),e),...a})}function Us({className:e,...t}){return s.jsx(LI,{"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 us({className:e,...t}){return s.jsx(UI,{"data-slot":"tabs-content",className:Ct("text-sm outline-none",e),...t})}function Uw(e,t){let a=e;for(const o of t.split(".")){if(!a||typeof a!="object"||Array.isArray(a))return;a=a[o]}return a}function G_(e,t=""){const a={};for(const[o,l]of Object.entries(e)){const c=t?`${t}.${o}`:o;l&&typeof l=="object"&&!Array.isArray(l)?Object.assign(a,G_(l,c)):a[c]=l}return a}function lE(e){const t=JSON.parse(e);if(!t||typeof t!="object"||Array.isArray(t))throw new Error("JSON debe ser objeto.");return t}function cf({sections:e,source:t,placeholderSource:a,jsonTitle:o,jsonDescription:l,saveLabel:c=u("common.save"),onSaveFields:d,onSaveJson:p,busy:m,hideJson:g=!1}){const h=e[0]?.key||"json",[b,_]=x.useState({}),[j,N]=x.useState(""),[y,w]=x.useState("");x.useEffect(()=>{const A={};for(const T of e.flatMap(z=>z.fields))A[T.path]=Uw(t,T.path)??"";_(A),N(JSON.stringify(t||{},null,2)),w("")},[t,e]);const S=x.useMemo(()=>new Set(e.flatMap(A=>A.fields.map(T=>T.path))),[e]),k=async()=>{const A={},T=[];for(const z of e.flatMap(O=>O.fields)){const O=b[z.path];if(!ds(O)){if(O===""||O===void 0||O===null){T.push(z.path);continue}if(z.kind==="number"){const B=Number(O);Number.isFinite(B)&&(A[z.path]=B)}else A[z.path]=O}}await d(A,T.filter(z=>S.has(z)))},E=async()=>{w("");try{await p(lE(j))}catch(A){w(A.message)}},R=A=>s.jsxs("div",{className:"space-y-4",children:[A.description&&s.jsx("p",{className:"text-sm text-muted-fg",children:A.description}),s.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:A.fields.map(T=>s.jsx(YI,{field:T,value:b[T.path],inherited:Uw(a,T.path),onChange:z=>_(O=>({...O,[T.path]:z}))},T.path))}),s.jsx(se,{variant:"primary",loading:m,onClick:k,children:c})]});return g&&e.length<=1?e[0]?R(e[0]):null:s.jsxs(Tp,{defaultValue:h,className:"space-y-4",children:[s.jsxs(Ap,{className:"flex flex-wrap",children:[e.map(A=>s.jsx(Us,{value:A.key,children:A.label},A.key)),!g&&s.jsx(Us,{value:"json",children:"JSON"})]}),e.map(A=>s.jsx(us,{value:A.key,children:R(A)},A.key)),!g&&s.jsx(us,{value:"json",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium",children:o}),l&&s.jsx("p",{className:"text-xs text-muted-fg",children:l})]}),s.jsx(on,{rows:18,className:"font-mono text-xs",value:j,onChange:A=>N(A.target.value)}),y&&s.jsx("p",{className:"text-xs text-destructive",children:y}),s.jsx(se,{variant:"primary",loading:m,onClick:E,children:u("settings_ui.save_json")})]})})]})}function YI({field:e,value:t,inherited:a,onChange:o}){const l=e.placeholder||$w(a)||(ds(t)?Ur(t):""),c=e.hint||(a!==void 0?`Heredado: ${$w(a)}`:void 0);return e.kind==="boolean"?s.jsx("div",{className:"flex items-end pb-1",children:s.jsx(Bt,{checked:t===!0,onChange:o,label:e.label})}):s.jsx(ae,{label:e.label,hint:c,children:e.kind==="select"?s.jsx(ut,{value:String(t||""),onChange:o,placeholder:l||"(sin override)",options:[{value:"",label:l||"(sin override)"},...(e.options||[]).map(d=>({value:String(d.value),label:d.label}))]}):e.kind==="textarea"?s.jsx(on,{rows:4,value:String(t||""),placeholder:l,onChange:d=>o(d.target.value)}):s.jsx(Ne,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(ds(t)?"":t||""),placeholder:e.kind==="password"&&ds(t)?Ur(t):e.kind==="password"&&ds(a)?Ur(a):l,onChange:d=>o(d.target.value)})})}function $w(e){return e==null||e===""?"":ds(e)?Ur(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function KI(){return[{key:"routing",label:u("settings_ui.cfg_overrides_label"),description:u("settings_ui.cfg_overrides_desc"),fields:[{path:"route_to_agent",label:u("settings_ui.cfg_route_to_agent"),placeholder:"master"},{path:"super_agent.model",label:u("settings_ui.cfg_super_agent_model")},{path:"super_agent.permission_mode",label:u("settings_ui.cfg_permission_mode"),kind:"select",options:Sb.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:u("settings_ui.cfg_extra_prompt"),kind:"textarea"}]}]}function XI(){return[{key:"engines",label:u("settings_ui.cfg_engines_label"),fields:[{path:"engines.ollama.base_url",label:u("settings_ui.cfg_ollama_url")},{path:"engines.anthropic.api_key",label:u("settings_ui.cfg_anthropic_key"),kind:"password"},{path:"engines.openai.api_key",label:u("settings_ui.cfg_openai_key"),kind:"password"},{path:"engines.groq.api_key",label:u("settings_ui.cfg_groq_key"),kind:"password"},{path:"engines.openrouter.api_key",label:u("settings_ui.cfg_openrouter_key"),kind:"password"},{path:"engines.gemini.api_key",label:u("settings_ui.cfg_gemini_key"),kind:"password"}]}]}function QI(){return[{key:"identity",label:u("settings_ui.cfg_project_label"),description:u("settings_ui.cfg_project_desc"),fields:[{path:"name",label:u("settings_ui.cfg_name")},{path:"version",label:u("settings_ui.cfg_version")},{path:"apf",label:u("settings_ui.cfg_apc_spec")},{path:"apx",label:u("settings_ui.cfg_apx_install")},{path:"apx_id",label:u("settings_ui.cfg_apx_storage_id")}]}]}function iE({pid:e}){const t=Ze(),{project:a}=du(e),{channels:o,isLoading:l,mutate:c}=D_(),d=String(e),p=a?.name||a?.path?.split("/").pop()||d,m=`proj-${d}`,g=o.find(z=>z.project===d||z.project===p||z.name===m),[h,b]=x.useState(!!g),[_,j]=x.useState(""),[N,y]=x.useState(""),[w,S]=x.useState(""),[k,E]=x.useState(!0),[R,A]=x.useState(!1);if(x.useEffect(()=>{g?(b(!0),j(""),y(g.chat_id||""),S(g.route_to_agent||""),E(g.respond_with_engine??!0)):(b(!1),j(""),y(""),S(""),E(!0))},[g?.name,g?.chat_id,g?.route_to_agent]),l)return s.jsx(rt,{});const T=async()=>{A(!0);try{if(!h){g&&(await Dn.channels.remove(g.name),t.success(u("project.telegram.cleared"))),await c();return}const z={name:g?.name||m,project:d,chat_id:N,route_to_agent:w,respond_with_engine:k,..._?{bot_token:_}:{}};g?await Dn.channels.patch(g.name,z):await Dn.channels.upsert(z),t.success(u("project.telegram.saved")),await c(),j("")}catch(z){t.error(z.message)}finally{A(!1)}};return s.jsx(Ye,{title:u("project.telegram.title"),description:u("project.telegram.subtitle"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Bt,{checked:h,onChange:b,label:u(h?"project.telegram.override_active":"project.telegram.use_default")}),g&&s.jsx(He,{tone:"success",children:u("project.telegram.channel_badge",{name:g.name})})]}),h&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("project.telegram.bot_token"),hint:g?.bot_token?`${Ur(g.bot_token)} ${u("telegram_ui.empty_keep")}`:u("project.telegram.bot_hint_none"),children:s.jsx(Ne,{type:"password",value:_,onChange:z=>j(z.target.value),placeholder:g?.bot_token?Ur(g.bot_token):""})}),s.jsx(ae,{label:u("project.telegram.chat_id"),children:s.jsx(Ne,{value:N,onChange:z=>y(z.target.value)})}),s.jsx(ae,{label:u("project.telegram.route_agent"),hint:u("project.telegram.route_hint"),children:s.jsx(Ne,{value:w,onChange:z=>S(z.target.value)})})]}),s.jsx(Bt,{checked:k,onChange:E,label:u("project.telegram.respond_engine")})]}),s.jsx("div",{className:"pt-2",children:s.jsx(se,{variant:"primary",loading:R,onClick:T,children:u("common.save")})}),!h&&!g&&s.jsx(pt,{children:u("project.telegram.no_override")})]})})}function WI({pid:e}){const t=Ze(),a=Pn(),{project:o,mutate:l}=du(e),c=qe(`/projects/${e}/config`,()=>Qn.config.show(e)),d=String(e)==="0";if(c.isLoading)return s.jsx(rt,{});if(!c.data)return s.jsx(pt,{children:u("project.config.no_data")});const p=async h=>{await Qn.apcProject.put(e,h),t.success(u("project.config.save_project")),c.mutate()},m=async h=>{await Qn.config.put(e,h),t.success(u("project.config.save_override")),c.mutate()},g=async(h,b)=>{await Qn.config.set(e,h),b.length&&await Qn.config.unset(e,b),t.success(u("project.config.save_fields_success")),c.mutate()};return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ye,{title:u("project.config.section_title"),description:u("project.config.section_desc"),children:s.jsxs(Tp,{defaultValue:"settings",className:"space-y-4",children:[s.jsxs(Ap,{className:"flex flex-wrap",children:[s.jsx(Us,{value:"settings",children:u("project.config.tab_settings")}),s.jsx(Us,{value:"engines",children:u("settings_ui.cfg_engines_label")}),!d&&s.jsx(Us,{value:"telegram",children:u("project.nav.telegram")}),s.jsx(Us,{value:"project",children:u("project.config.tab_project")}),s.jsx(Us,{value:"json",children:"JSON"})]}),s.jsx(us,{value:"settings",children:s.jsx(cf,{sections:KI(),source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,onSaveFields:g,onSaveJson:m,hideJson:!0})}),s.jsx(us,{value:"engines",children:s.jsx(cf,{sections:XI(),source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,onSaveFields:g,onSaveJson:m,hideJson:!0})}),!d&&s.jsx(us,{value:"telegram",children:s.jsx(iE,{pid:e})}),s.jsx(us,{value:"project",children:s.jsx(cf,{sections:QI(),source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,onSaveFields:async(h,b)=>{await Qn.apcProject.set(e,JI(h),b),t.success(u("project.config.save_meta_success")),c.mutate()},onSaveJson:p,hideJson:!0})}),s.jsx(us,{value:"json",children:s.jsxs("div",{className:"space-y-6",children:[s.jsx(Hw,{title:c.data.project_config_path,description:".apc/config.json — overrides del proyecto.",source:c.data.project_only,onSave:m}),s.jsx(Hw,{title:c.data.project_json_path,description:".apc/project.json — metadata APC portable.",source:c.data.apc_project||{},onSave:p}),s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{className:"text-xs text-muted-fg",children:u("project.config.effective_read")}),s.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg border border-border bg-muted/40 p-3 text-xs",children:JSON.stringify(c.data.effective,null,2)})]})]})})]})}),!d&&o?s.jsx(ZI,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{l(),a("/")}}):null]})}function ZI({pid:e,label:t,onRebuilt:a,onUnregistered:o}){const l=Ze(),[c,d]=x.useState(null),[p,m]=x.useState(null),g=async()=>{d("rebuild");try{await Qn.rebuild(e),l.success(u("project.rebuild_done")),a()}catch(b){l.error(b.message)}finally{d(null),m(null)}},h=async()=>{d("unregister");try{await Qn.remove(e),l.success(u("project.unregistered")),o()}catch(b){l.error(b.message)}finally{d(null),m(null)}};return s.jsxs(s.Fragment,{children:[s.jsx(Ye,{title:u("project.danger.title"),description:u("project.danger.subtitle"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:u("project.rebuild")}),s.jsx("div",{className:"text-xs text-muted-fg",children:u("project.danger.rebuild_desc")})]}),s.jsxs(se,{size:"sm",variant:"secondary",onClick:()=>m("rebuild"),children:[s.jsx(Vs,{size:13})," ",u("project.rebuild")]})]}),s.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:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:u("admin.unregister")}),s.jsx("div",{className:"text-xs text-muted-fg",children:u("project.danger.unregister_desc")})]}),s.jsxs(se,{size:"sm",variant:"destructive",onClick:()=>m("unregister"),children:[s.jsx(vn,{size:13})," ",u("admin.unregister")]})]})]})}),s.jsx(Zt,{open:p==="rebuild",onClose:()=>c?null:m(null),title:u("project.danger.rebuild_confirm_title"),description:u("project.danger.rebuild_confirm_desc",{label:t}),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:g,loading:c==="rebuild",children:u("project.rebuild")})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:u("project.danger.rebuild_long")})}),s.jsx(Zt,{open:p==="unregister",onClose:()=>c?null:m(null),title:u("project.danger.unregister_confirm_title"),description:u("project.unregister_confirm",{label:t}),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:u("common.cancel")}),s.jsx(se,{variant:"destructive",onClick:h,loading:c==="unregister",children:u("admin.unregister")})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:u("project.danger.unregister_long")})})]})}function Hw({title:e,description:t,source:a,onSave:o}){const[l,c]=x.useState(""),[d,p]=x.useState(""),[m,g]=x.useState(!1);x.useEffect(()=>{c(JSON.stringify(a||{},null,2)),p("")},[a]);const h=async()=>{p(""),g(!0);try{await o(lE(l))}catch(b){p(b.message)}finally{g(!1)}};return s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{children:[s.jsx("h3",{className:"text-sm font-medium",children:e}),t&&s.jsx("p",{className:"text-xs text-muted-fg",children:t})]}),s.jsx(on,{rows:14,className:"font-mono text-xs",value:l,onChange:b=>c(b.target.value)}),d&&s.jsx("p",{className:"text-xs text-destructive",children:d}),s.jsx(se,{variant:"primary",loading:m,onClick:h,children:u("settings_ui.save_json")})]})}function JI(e){const t={};for(const[a,o]of Object.entries(G_(e)))ds(o)||(t[a]=o);return t}function Fl(e){return String(e||"").trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-")}function cE({open:e,onClose:t,pid:a,editing:o,onSaved:l}){const c=Ze(),[d,p]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(!1);x.useEffect(()=>{e&&(p(o?.name??""),g(o?.slug??""),b(o?.goal??""))},[e,o]);const N=async()=>{if(d.trim()){j(!0);try{o?await Br.updateArea(a,o.slug,{name:d,goal:h}):await Br.createArea(a,{name:d,slug:m||Fl(d),goal:h}),c.success(u("common.saved")),l(),t()}catch(y){c.error(y instanceof Error?y.message:String(y))}finally{j(!1)}}};return s.jsx(Zt,{open:e,onClose:t,title:u(o?"structure.edit_area":"structure.new_area"),footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,children:u("common.cancel")}),s.jsx(se,{variant:"primary","data-testid":"area-create",onClick:()=>void N(),loading:_,disabled:!d.trim(),children:u(o?"common.save":"structure.create_area")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("structure.name"),children:s.jsx(Ne,{autoFocus:!0,"data-testid":"area-name",value:d,onChange:y=>{p(y.target.value),o||g(Fl(y.target.value))},placeholder:"Engineering"})}),!o&&s.jsx(ae,{label:u("structure.slug"),children:s.jsx(Ne,{value:m,onChange:y=>g(Fl(y.target.value)),className:"font-mono",placeholder:"engineering"})}),s.jsx(ae,{label:u("structure.goal"),hint:u("structure.goal_hint"),children:s.jsx(on,{value:h,onChange:y=>b(y.target.value),rows:2})})]})})}function uE({open:e,onClose:t,pid:a,areas:o,editing:l,presetArea:c,onSaved:d}){const p=Ze(),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(""),[N,y]=x.useState(""),[w,S]=x.useState(!1);x.useEffect(()=>{e&&(g(l?.name??""),b(l?.slug??""),j(l?.area??c??""),y(l?.description??""))},[e,l,c]);const k=async()=>{if(m.trim()){S(!0);try{l?await Br.updateRole(a,l.slug,{name:m,area:_||null,description:N}):await Br.createRole(a,{name:m,slug:h||Fl(m),area:_||null,description:N}),p.success(u("common.saved")),d(),t()}catch(R){p.error(R instanceof Error?R.message:String(R))}finally{S(!1)}}},E=[{value:"",label:u("structure.no_area")},...o.map(R=>({value:R.slug,label:R.name}))];return s.jsx(Zt,{open:e,onClose:t,title:u(l?"structure.edit_role":"structure.new_role"),footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:()=>void k(),loading:w,disabled:!m.trim(),children:u(l?"common.save":"structure.create_role")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("structure.name"),children:s.jsx(Ne,{autoFocus:!0,value:m,onChange:R=>{g(R.target.value),l||b(Fl(R.target.value))},placeholder:"Tech Lead"})}),!l&&s.jsx(ae,{label:u("structure.slug"),children:s.jsx(Ne,{value:h,onChange:R=>b(Fl(R.target.value)),className:"font-mono",placeholder:"tech-lead"})}),s.jsx(ae,{label:u("structure.area"),children:s.jsx(ut,{value:_,onChange:j,options:E,placeholder:u("structure.no_area")})}),s.jsx(ae,{label:u("structure.description"),children:s.jsx(on,{value:N,onChange:R=>y(R.target.value),rows:2})})]})})}function dE({value:e,onChange:t}){return s.jsx(Ne,{value:e,onChange:a=>t([...a.target.value].slice(-2).join("")),className:"text-center text-lg",placeholder:"🤖","aria-label":u("agents_form.emoji")})}const e8=[{value:"total",labelKey:"auto_total"},{value:"automatico",labelKey:"auto_automatico"},{value:"permiso",labelKey:"auto_permiso"}];function fE({value:e,onChange:t}){return s.jsx("div",{className:"inline-flex w-full rounded-lg border border-border p-0.5",children:e8.map(a=>s.jsx("button",{type:"button",onClick:()=>t(a.value),className:he("flex-1 rounded-md px-2 py-1 text-[12px] font-medium capitalize transition-colors",e===a.value?"bg-primary/15 text-foreground":"text-muted-foreground hover:text-foreground"),children:u(`agents_form.${a.labelKey}`)},a.value))})}function pE({pid:e,area:t,role:a,onArea:o,onRole:l}){const c=qe(`/projects/${e}/organization`,()=>Br.get(e)),[d,p]=x.useState(!1),[m,g]=x.useState(!1),h=c.data?.areas??[],_=(c.data?.roles??[]).filter(y=>t?y.area===t||y.area===null:!0),j=[{value:"",label:u("structure.no_area")},...h.map(y=>({value:y.slug,label:y.name}))],N=[{value:"",label:u("agents_form.no_role")},..._.map(y=>({value:y.slug,label:y.name}))];return s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("agents_form.area"),children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ut,{value:t,onChange:y=>{o(y)},options:j,placeholder:u("structure.no_area"),className:"flex-1"}),s.jsx(qw,{label:u("structure.new_area"),onClick:()=>p(!0)})]})}),s.jsx(ae,{label:u("agents_form.role"),children:s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ut,{value:a,onChange:l,options:N,placeholder:u("agents_form.no_role"),className:"flex-1"}),s.jsx(qw,{label:u("structure.new_role"),onClick:()=>g(!0)})]})})]}),s.jsx(cE,{open:d,onClose:()=>p(!1),pid:e,onSaved:()=>void c.mutate()}),s.jsx(uE,{open:m,onClose:()=>g(!1),pid:e,areas:h,presetArea:t||null,onSaved:()=>void c.mutate()})]})}function qw({label:e,onClick:t}){return s.jsx("button",{type:"button",onClick:t,title:e,"aria-label":e,className:"flex size-9 shrink-0 items-center justify-center rounded-lg border border-border text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(It,{className:"size-4"})})}function mE({open:e,onClose:t,onConfirm:a,title:o,description:l,confirmLabel:c,destructive:d=!0}){const[p,m]=x.useState(!1),g=async()=>{m(!0);try{await a(),t()}finally{m(!1)}};return s.jsx(Zt,{open:e,onClose:t,title:o,footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:p,children:u("common.cancel")}),s.jsx(se,{variant:d?"destructive":"primary",onClick:()=>void g(),loading:p,children:c??u("common.confirm")})]}),children:s.jsx("p",{className:"text-sm text-muted-foreground",children:l})})}function t8(e,t){var a,o=1;e==null&&(e=0),t==null&&(t=0);function l(){var c,d=a.length,p,m=0,g=0;for(c=0;c<d;++c)p=a[c],m+=p.x,g+=p.y;for(m=(m/d-e)*o,g=(g/d-t)*o,c=0;c<d;++c)p=a[c],p.x-=m,p.y-=g}return l.initialize=function(c){a=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 n8(e){const t=+this._x.call(null,e),a=+this._y.call(null,e);return gE(this.cover(t,a),t,a,e)}function gE(e,t,a,o){if(isNaN(t)||isNaN(a))return e;var l,c=e._root,d={data:o},p=e._x0,m=e._y0,g=e._x1,h=e._y1,b,_,j,N,y,w,S,k;if(!c)return e._root=d,e;for(;c.length;)if((y=t>=(b=(p+g)/2))?p=b:g=b,(w=a>=(_=(m+h)/2))?m=_:h=_,l=c,!(c=c[S=w<<1|y]))return l[S]=d,e;if(j=+e._x.call(null,c.data),N=+e._y.call(null,c.data),t===j&&a===N)return d.next=c,l?l[S]=d:e._root=d,e;do l=l?l[S]=new Array(4):e._root=new Array(4),(y=t>=(b=(p+g)/2))?p=b:g=b,(w=a>=(_=(m+h)/2))?m=_:h=_;while((S=w<<1|y)===(k=(N>=_)<<1|j>=b));return l[k]=c,l[S]=d,e}function s8(e){var t,a,o=e.length,l,c,d=new Array(o),p=new Array(o),m=1/0,g=1/0,h=-1/0,b=-1/0;for(a=0;a<o;++a)isNaN(l=+this._x.call(null,t=e[a]))||isNaN(c=+this._y.call(null,t))||(d[a]=l,p[a]=c,l<m&&(m=l),l>h&&(h=l),c<g&&(g=c),c>b&&(b=c));if(m>h||g>b)return this;for(this.cover(m,g).cover(h,b),a=0;a<o;++a)gE(this,d[a],p[a],e[a]);return this}function a8(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var a=this._x0,o=this._y0,l=this._x1,c=this._y1;if(isNaN(a))l=(a=Math.floor(e))+1,c=(o=Math.floor(t))+1;else{for(var d=l-a||1,p=this._root,m,g;a>e||e>=l||o>t||t>=c;)switch(g=(t<o)<<1|e<a,m=new Array(4),m[g]=p,p=m,d*=2,g){case 0:l=a+d,c=o+d;break;case 1:a=l-d,c=o+d;break;case 2:l=a+d,o=c-d;break;case 3:a=l-d,o=c-d;break}this._root&&this._root.length&&(this._root=p)}return this._x0=a,this._y0=o,this._x1=l,this._y1=c,this}function r8(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function o8(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 Zn(e,t,a,o,l){this.node=e,this.x0=t,this.y0=a,this.x1=o,this.y1=l}function l8(e,t,a){var o,l=this._x0,c=this._y0,d,p,m,g,h=this._x1,b=this._y1,_=[],j=this._root,N,y;for(j&&_.push(new Zn(j,l,c,h,b)),a==null?a=1/0:(l=e-a,c=t-a,h=e+a,b=t+a,a*=a);N=_.pop();)if(!(!(j=N.node)||(d=N.x0)>h||(p=N.y0)>b||(m=N.x1)<l||(g=N.y1)<c))if(j.length){var w=(d+m)/2,S=(p+g)/2;_.push(new Zn(j[3],w,S,m,g),new Zn(j[2],d,S,w,g),new Zn(j[1],w,p,m,S),new Zn(j[0],d,p,w,S)),(y=(t>=S)<<1|e>=w)&&(N=_[_.length-1],_[_.length-1]=_[_.length-1-y],_[_.length-1-y]=N)}else{var k=e-+this._x.call(null,j.data),E=t-+this._y.call(null,j.data),R=k*k+E*E;if(R<a){var A=Math.sqrt(a=R);l=e-A,c=t-A,h=e+A,b=t+A,o=j.data}}return o}function i8(e){if(isNaN(h=+this._x.call(null,e))||isNaN(b=+this._y.call(null,e)))return this;var t,a=this._root,o,l,c,d=this._x0,p=this._y0,m=this._x1,g=this._y1,h,b,_,j,N,y,w,S;if(!a)return this;if(a.length)for(;;){if((N=h>=(_=(d+m)/2))?d=_:m=_,(y=b>=(j=(p+g)/2))?p=j:g=j,t=a,!(a=a[w=y<<1|N]))return this;if(!a.length)break;(t[w+1&3]||t[w+2&3]||t[w+3&3])&&(o=t,S=w)}for(;a.data!==e;)if(l=a,!(a=a.next))return this;return(c=a.next)&&delete a.next,l?(c?l.next=c:delete l.next,this):t?(c?t[w]=c:delete t[w],(a=t[0]||t[1]||t[2]||t[3])&&a===(t[3]||t[2]||t[1]||t[0])&&!a.length&&(o?o[S]=a:this._root=a),this):(this._root=c,this)}function c8(e){for(var t=0,a=e.length;t<a;++t)this.remove(e[t]);return this}function u8(){return this._root}function d8(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function f8(e){var t=[],a,o=this._root,l,c,d,p,m;for(o&&t.push(new Zn(o,this._x0,this._y0,this._x1,this._y1));a=t.pop();)if(!e(o=a.node,c=a.x0,d=a.y0,p=a.x1,m=a.y1)&&o.length){var g=(c+p)/2,h=(d+m)/2;(l=o[3])&&t.push(new Zn(l,g,h,p,m)),(l=o[2])&&t.push(new Zn(l,c,h,g,m)),(l=o[1])&&t.push(new Zn(l,g,d,p,h)),(l=o[0])&&t.push(new Zn(l,c,d,g,h))}return this}function p8(e){var t=[],a=[],o;for(this._root&&t.push(new Zn(this._root,this._x0,this._y0,this._x1,this._y1));o=t.pop();){var l=o.node;if(l.length){var c,d=o.x0,p=o.y0,m=o.x1,g=o.y1,h=(d+m)/2,b=(p+g)/2;(c=l[0])&&t.push(new Zn(c,d,p,h,b)),(c=l[1])&&t.push(new Zn(c,h,p,m,b)),(c=l[2])&&t.push(new Zn(c,d,b,h,g)),(c=l[3])&&t.push(new Zn(c,h,b,m,g))}a.push(o)}for(;o=a.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function m8(e){return e[0]}function g8(e){return arguments.length?(this._x=e,this):this._x}function h8(e){return e[1]}function x8(e){return arguments.length?(this._y=e,this):this._y}function Y_(e,t,a){var o=new K_(t??m8,a??h8,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function K_(e,t,a,o,l,c){this._x=e,this._y=t,this._x0=a,this._y0=o,this._x1=l,this._y1=c,this._root=void 0}function Vw(e){for(var t={data:e.data},a=t;e=e.next;)a=a.next={data:e.data};return t}var ns=Y_.prototype=K_.prototype;ns.copy=function(){var e=new K_(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,a,o;if(!t)return e;if(!t.length)return e._root=Vw(t),e;for(a=[{source:t,target:e._root=new Array(4)}];t=a.pop();)for(var l=0;l<4;++l)(o=t.source[l])&&(o.length?a.push({source:o,target:t.target[l]=new Array(4)}):t.target[l]=Vw(o));return e};ns.add=n8;ns.addAll=s8;ns.cover=a8;ns.data=r8;ns.extent=o8;ns.find=l8;ns.remove=i8;ns.removeAll=c8;ns.root=u8;ns.size=d8;ns.visit=f8;ns.visitAfter=p8;ns.x=g8;ns.y=x8;function Eo(e){return function(){return e}}function Lr(e){return(e()-.5)*1e-6}function b8(e){return e.x+e.vx}function _8(e){return e.y+e.vy}function v8(e){var t,a,o,l=1,c=1;typeof e!="function"&&(e=Eo(e==null?1:+e));function d(){for(var g,h=t.length,b,_,j,N,y,w,S=0;S<c;++S)for(b=Y_(t,b8,_8).visitAfter(p),g=0;g<h;++g)_=t[g],y=a[_.index],w=y*y,j=_.x+_.vx,N=_.y+_.vy,b.visit(k);function k(E,R,A,T,z){var O=E.data,B=E.r,P=y+B;if(O){if(O.index>_.index){var U=j-O.x-O.vx,D=N-O.y-O.vy,L=U*U+D*D;L<P*P&&(U===0&&(U=Lr(o),L+=U*U),D===0&&(D=Lr(o),L+=D*D),L=(P-(L=Math.sqrt(L)))/L*l,_.vx+=(U*=L)*(P=(B*=B)/(w+B)),_.vy+=(D*=L)*P,O.vx-=U*(P=1-P),O.vy-=D*P)}return}return R>j+P||T<j-P||A>N+P||z<N-P}}function p(g){if(g.data)return g.r=a[g.data.index];for(var h=g.r=0;h<4;++h)g[h]&&g[h].r>g.r&&(g.r=g[h].r)}function m(){if(t){var g,h=t.length,b;for(a=new Array(h),g=0;g<h;++g)b=t[g],a[b.index]=+e(b,g,t)}}return d.initialize=function(g,h){t=g,o=h,m()},d.iterations=function(g){return arguments.length?(c=+g,d):c},d.strength=function(g){return arguments.length?(l=+g,d):l},d.radius=function(g){return arguments.length?(e=typeof g=="function"?g:Eo(+g),m(),d):e},d}function y8(e){return e.index}function Fw(e,t){var a=e.get(t);if(!a)throw new Error("node not found: "+t);return a}function j8(e){var t=y8,a=b,o,l=Eo(30),c,d,p,m,g,h=1;e==null&&(e=[]);function b(w){return 1/Math.min(p[w.source.index],p[w.target.index])}function _(w){for(var S=0,k=e.length;S<h;++S)for(var E=0,R,A,T,z,O,B,P;E<k;++E)R=e[E],A=R.source,T=R.target,z=T.x+T.vx-A.x-A.vx||Lr(g),O=T.y+T.vy-A.y-A.vy||Lr(g),B=Math.sqrt(z*z+O*O),B=(B-c[E])/B*w*o[E],z*=B,O*=B,T.vx-=z*(P=m[E]),T.vy-=O*P,A.vx+=z*(P=1-P),A.vy+=O*P}function j(){if(d){var w,S=d.length,k=e.length,E=new Map(d.map((A,T)=>[t(A,T,d),A])),R;for(w=0,p=new Array(S);w<k;++w)R=e[w],R.index=w,typeof R.source!="object"&&(R.source=Fw(E,R.source)),typeof R.target!="object"&&(R.target=Fw(E,R.target)),p[R.source.index]=(p[R.source.index]||0)+1,p[R.target.index]=(p[R.target.index]||0)+1;for(w=0,m=new Array(k);w<k;++w)R=e[w],m[w]=p[R.source.index]/(p[R.source.index]+p[R.target.index]);o=new Array(k),N(),c=new Array(k),y()}}function N(){if(d)for(var w=0,S=e.length;w<S;++w)o[w]=+a(e[w],w,e)}function y(){if(d)for(var w=0,S=e.length;w<S;++w)c[w]=+l(e[w],w,e)}return _.initialize=function(w,S){d=w,g=S,j()},_.links=function(w){return arguments.length?(e=w,j(),_):e},_.id=function(w){return arguments.length?(t=w,_):t},_.iterations=function(w){return arguments.length?(h=+w,_):h},_.strength=function(w){return arguments.length?(a=typeof w=="function"?w:Eo(+w),N(),_):a},_.distance=function(w){return arguments.length?(l=typeof w=="function"?w:Eo(+w),y(),_):l},_}var w8={value:()=>{}};function hE(){for(var e=0,t=arguments.length,a={},o;e<t;++e){if(!(o=arguments[e]+"")||o in a||/[\s.]/.test(o))throw new Error("illegal type: "+o);a[o]=[]}return new uf(a)}function uf(e){this._=e}function k8(e,t){return e.trim().split(/^|\s+/).map(function(a){var o="",l=a.indexOf(".");if(l>=0&&(o=a.slice(l+1),a=a.slice(0,l)),a&&!t.hasOwnProperty(a))throw new Error("unknown type: "+a);return{type:a,name:o}})}uf.prototype=hE.prototype={constructor:uf,on:function(e,t){var a=this._,o=k8(e+"",a),l,c=-1,d=o.length;if(arguments.length<2){for(;++c<d;)if((l=(e=o[c]).type)&&(l=S8(a[l],e.name)))return l;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++c<d;)if(l=(e=o[c]).type)a[l]=Gw(a[l],e.name,t);else if(t==null)for(l in a)a[l]=Gw(a[l],e.name,null);return this},copy:function(){var e={},t=this._;for(var a in t)e[a]=t[a].slice();return new uf(e)},call:function(e,t){if((l=arguments.length-2)>0)for(var a=new Array(l),o=0,l,c;o<l;++o)a[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,a)},apply:function(e,t,a){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,a)}};function S8(e,t){for(var a=0,o=e.length,l;a<o;++a)if((l=e[a]).name===t)return l.value}function Gw(e,t,a){for(var o=0,l=e.length;o<l;++o)if(e[o].name===t){e[o]=w8,e=e.slice(0,o).concat(e.slice(o+1));break}return a!=null&&e.push({name:t,value:a}),e}var ai=0,Ec=0,mc=0,xE=1e3,$f,Rc,Hf=0,Lo=0,Mp=0,Yc=typeof performance=="object"&&performance.now?performance:Date,bE=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function _E(){return Lo||(bE(C8),Lo=Yc.now()+Mp)}function C8(){Lo=0}function Fx(){this._call=this._time=this._next=null}Fx.prototype=vE.prototype={constructor:Fx,restart:function(e,t,a){if(typeof e!="function")throw new TypeError("callback is not a function");a=(a==null?_E():+a)+(t==null?0:+t),!this._next&&Rc!==this&&(Rc?Rc._next=this:$f=this,Rc=this),this._call=e,this._time=a,Gx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Gx())}};function vE(e,t,a){var o=new Fx;return o.restart(e,t,a),o}function N8(){_E(),++ai;for(var e=$f,t;e;)(t=Lo-e._time)>=0&&e._call.call(void 0,t),e=e._next;--ai}function Yw(){Lo=(Hf=Yc.now())+Mp,ai=Ec=0;try{N8()}finally{ai=0,R8(),Lo=0}}function E8(){var e=Yc.now(),t=e-Hf;t>xE&&(Mp-=t,Hf=e)}function R8(){for(var e,t=$f,a,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(a=t._next,t._next=null,t=e?e._next=a:$f=a);Rc=e,Gx(o)}function Gx(e){if(!ai){Ec&&(Ec=clearTimeout(Ec));var t=e-Lo;t>24?(e<1/0&&(Ec=setTimeout(Yw,e-Yc.now()-Mp)),mc&&(mc=clearInterval(mc))):(mc||(Hf=Yc.now(),mc=setInterval(E8,xE)),ai=1,bE(Yw))}}const T8=1664525,A8=1013904223,Kw=4294967296;function M8(){let e=1;return()=>(e=(T8*e+A8)%Kw)/Kw}function O8(e){return e.x}function z8(e){return e.y}var D8=10,P8=Math.PI*(3-Math.sqrt(5));function L8(e){var t,a=1,o=.001,l=1-Math.pow(o,1/300),c=0,d=.6,p=new Map,m=vE(b),g=hE("tick","end"),h=M8();e==null&&(e=[]);function b(){_(),g.call("tick",t),a<o&&(m.stop(),g.call("end",t))}function _(y){var w,S=e.length,k;y===void 0&&(y=1);for(var E=0;E<y;++E)for(a+=(c-a)*l,p.forEach(function(R){R(a)}),w=0;w<S;++w)k=e[w],k.fx==null?k.x+=k.vx*=d:(k.x=k.fx,k.vx=0),k.fy==null?k.y+=k.vy*=d:(k.y=k.fy,k.vy=0);return t}function j(){for(var y=0,w=e.length,S;y<w;++y){if(S=e[y],S.index=y,S.fx!=null&&(S.x=S.fx),S.fy!=null&&(S.y=S.fy),isNaN(S.x)||isNaN(S.y)){var k=D8*Math.sqrt(.5+y),E=y*P8;S.x=k*Math.cos(E),S.y=k*Math.sin(E)}(isNaN(S.vx)||isNaN(S.vy))&&(S.vx=S.vy=0)}}function N(y){return y.initialize&&y.initialize(e,h),y}return j(),t={tick:_,restart:function(){return m.restart(b),t},stop:function(){return m.stop(),t},nodes:function(y){return arguments.length?(e=y,j(),p.forEach(N),t):e},alpha:function(y){return arguments.length?(a=+y,t):a},alphaMin:function(y){return arguments.length?(o=+y,t):o},alphaDecay:function(y){return arguments.length?(l=+y,t):+l},alphaTarget:function(y){return arguments.length?(c=+y,t):c},velocityDecay:function(y){return arguments.length?(d=1-y,t):1-d},randomSource:function(y){return arguments.length?(h=y,p.forEach(N),t):h},force:function(y,w){return arguments.length>1?(w==null?p.delete(y):p.set(y,N(w)),t):p.get(y)},find:function(y,w,S){var k=0,E=e.length,R,A,T,z,O;for(S==null?S=1/0:S*=S,k=0;k<E;++k)z=e[k],R=y-z.x,A=w-z.y,T=R*R+A*A,T<S&&(O=z,S=T);return O},on:function(y,w){return arguments.length>1?(g.on(y,w),t):g.on(y)}}}function I8(){var e,t,a,o,l=Eo(-30),c,d=1,p=1/0,m=.81;function g(j){var N,y=e.length,w=Y_(e,O8,z8).visitAfter(b);for(o=j,N=0;N<y;++N)t=e[N],w.visit(_)}function h(){if(e){var j,N=e.length,y;for(c=new Array(N),j=0;j<N;++j)y=e[j],c[y.index]=+l(y,j,e)}}function b(j){var N=0,y,w,S=0,k,E,R;if(j.length){for(k=E=R=0;R<4;++R)(y=j[R])&&(w=Math.abs(y.value))&&(N+=y.value,S+=w,k+=w*y.x,E+=w*y.y);j.x=k/S,j.y=E/S}else{y=j,y.x=y.data.x,y.y=y.data.y;do N+=c[y.data.index];while(y=y.next)}j.value=N}function _(j,N,y,w){if(!j.value)return!0;var S=j.x-t.x,k=j.y-t.y,E=w-N,R=S*S+k*k;if(E*E/m<R)return R<p&&(S===0&&(S=Lr(a),R+=S*S),k===0&&(k=Lr(a),R+=k*k),R<d&&(R=Math.sqrt(d*R)),t.vx+=S*j.value*o/R,t.vy+=k*j.value*o/R),!0;if(j.length||R>=p)return;(j.data!==t||j.next)&&(S===0&&(S=Lr(a),R+=S*S),k===0&&(k=Lr(a),R+=k*k),R<d&&(R=Math.sqrt(d*R)));do j.data!==t&&(E=c[j.data.index]*o/R,t.vx+=S*E,t.vy+=k*E);while(j=j.next)}return g.initialize=function(j,N){e=j,a=N,h()},g.strength=function(j){return arguments.length?(l=typeof j=="function"?j:Eo(+j),h(),g):l},g.distanceMin=function(j){return arguments.length?(d=j*j,g):Math.sqrt(d)},g.distanceMax=function(j){return arguments.length?(p=j*j,g):Math.sqrt(p)},g.theta=function(j){return arguments.length?(m=j*j,g):Math.sqrt(m)},g}const gc={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"};function B8(){return{agent:u("agents_ui.kind_agent"),memory:u("agents_ui.kind_memory"),thread:u("agents_ui.kind_thread"),task:u("agents_ui.kind_task"),routine:u("agents_ui.kind_routine"),agentlink:u("agents_ui.kind_hierarchy")}}const hc=760,xc=460;function U8({center:e,nodes:t}){const a=x.useRef(null),o=x.useRef(null),l=x.useRef([]),c=x.useRef([]),d=x.useRef(null),[,p]=x.useState(0),[m,g]=x.useState(null);x.useEffect(()=>{const w={id:"__center",label:e,kind:"agent",relation:"self",x:hc/2,y:xc/2,fx:hc/2,fy:xc/2},S=[w,...t.map(R=>({...R}))],k=S.slice(1).map(R=>({source:w,target:R}));l.current=S,c.current=k;const E=L8(S).force("link",j8(k).distance(120).strength(.5)).force("charge",I8().strength(-220)).force("center",t8(hc/2,xc/2).strength(.05)).force("collide",v8(26)).on("tick",()=>p(R=>R+1));return o.current=E,()=>{E.stop()}},[e,t]);const h=w=>{const S=a.current.getBoundingClientRect();return{x:(w.clientX-S.left)/S.width*hc,y:(w.clientY-S.top)/S.height*xc}},b=w=>S=>{w.id!=="__center"&&(d.current=w,S.target.setPointerCapture?.(S.pointerId),o.current?.alphaTarget(.3).restart())},_=w=>{const S=d.current;if(!S)return;const{x:k,y:E}=h(w);S.fx=k,S.fy=E},j=()=>{const w=d.current;w&&(w.fx=null,w.fy=null),d.current=null,o.current?.alphaTarget(0)},N=l.current,y=c.current;return s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-muted/10",children:s.jsxs("svg",{ref:a,viewBox:`0 0 ${hc} ${xc}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:_,onPointerUp:j,onPointerLeave:j,children:[y.map((w,S)=>s.jsx("line",{x1:w.source.x,y1:w.source.y,x2:w.target.x,y2:w.target.y,stroke:gc[w.target.kind],strokeOpacity:.22,strokeWidth:1.5},S)),N.map(w=>{if(w.id==="__center")return s.jsxs("g",{transform:`translate(${w.x},${w.y})`,children:[s.jsx("circle",{r:22,fill:gc.agent}),s.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},w.id);const S=m?.id===w.id;return s.jsxs("g",{transform:`translate(${w.x},${w.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:b(w),onClick:()=>g(w),children:[s.jsx("circle",{r:S?9:6,fill:gc[w.kind],fillOpacity:S?1:.9,stroke:S?"#fff":"none",strokeWidth:S?2:0}),s.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:w.label.length>22?`${w.label.slice(0,22)}…`:w.label})]},w.id)})]})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[(()=>{const w=B8();return Object.keys(w).filter(S=>S!=="agent").map(S=>s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("span",{className:"size-2 rounded-full",style:{background:gc[S]}})," ",w[S]]},S))})(),s.jsx("span",{className:"ml-auto",children:u("agents_ui.nodes_drag_hint",{n:String(t.length)})})]}),m&&s.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-xs",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"size-2 rounded-full",style:{background:gc[m.kind]}}),s.jsx("span",{className:"font-medium",children:m.label}),s.jsxs("span",{className:"text-muted-fg",children:["· ",m.relation]})]}),m.detail&&s.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:m.detail})]})]})}function $8(){return[{key:"overview",label:u("agents_ui.tab_explorer"),icon:Xf},{key:"memories",label:u("project.nav.memories"),icon:gf},{key:"records",label:u("project.agent_detail.records_title"),icon:ub},{key:"sleep",label:u("project.agent_detail.sleep_title"),icon:Kl},{key:"brain",label:u("project.agent_detail.brain_title"),icon:ea},{key:"config",label:u("settings.tabs.advanced"),icon:Wf}]}function yE(){return[{value:"",label:u("agents_ui.type_none")},{value:"orchestrator",label:u("agents_ui.type_orchestrator"),description:u("agents_ui.type_orchestrator_desc")},{value:"specialist",label:u("agents_ui.type_specialist"),description:u("agents_ui.type_specialist_desc")},{value:"assistant",label:u("agents_ui.type_assistant"),description:u("agents_ui.type_assistant_desc")},{value:"worker",label:u("agents_ui.type_worker"),description:u("agents_ui.type_worker_desc")},{value:"monitor",label:u("agents_ui.type_monitor"),description:u("agents_ui.type_monitor_desc")}]}const Yx=e=>e.split(",").map(t=>t.trim()).filter(Boolean),H8=(e,t)=>e.filter(a=>a.spec?.agent===t||t==="super-agent"&&a.kind==="super_agent");function q8(e){return e.split(`
|
|
768
|
+
`).map(t=>t.replace(/^[-*#>\s]+/,"").trim()).filter(t=>t.length>2&&!t.startsWith("```")).slice(0,12)}function V8({pid:e}){const{slug:t=""}=CS(),a=Pn(),[o,l]=x.useState("overview"),c=$8(),d=qe(`/projects/${e}/agents/${t}`,()=>cn.get(e,t)),p=qe(`/projects/${e}/agents`,()=>cn.list(e)),m=qe(`/projects/${e}/routines`,()=>zr.list(e)),g=qe(`/projects/${e}/messages?agent=${t}`,()=>Of.project(e,{agent:t,limit:200})),h=qe(`/projects/${e}/agents/${t}/conversations`,()=>zo.list(e,t)),b=qe(`/projects/${e}/tasks?all`,()=>Wn.list(e,"all")),_=d.data,j=H8(m.data||[],t),N=(b.data||[]).filter(S=>S.agent===t),y=(p.data||[]).filter(S=>S.parent===t);if(d.isLoading)return s.jsx(rt,{});if(!_)return s.jsx("div",{className:"text-sm text-muted-fg",children:u("project.agent_detail.not_found")});const w=_.is_master?xa:un;return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("button",{onClick:()=>a(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:s.jsx(xM,{size:16})}),s.jsx("div",{className:he("flex size-11 items-center justify-center rounded-xl bg-gradient-to-br",_.is_master?"from-violet-600 to-indigo-600":"from-slate-600 to-gray-600"),children:s.jsx(w,{className:"size-5 text-white"})}),s.jsxs("div",{children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("h1",{className:"text-lg font-semibold",children:_.slug}),_.is_master&&s.jsxs(He,{tone:"success",children:[s.jsx(xa,{size:10})," ",u("project.agents.orchestrator")]}),_.role&&s.jsx(He,{children:_.role}),_.model&&s.jsx(He,{tone:"info",children:_.model}),_.parent&&s.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${_.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[u("project.agent_detail.reports_to")," ",_.parent]})]}),_.description&&s.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:_.description})]})]}),s.jsxs(se,{size:"sm",variant:"primary",onClick:()=>a(`/p/${e}/chat?agent=${t}`),children:[s.jsx(ja,{size:13})," ",u("project.agent_detail.chat_btn",{slug:_.slug})]})]}),s.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:S,label:k,icon:E})=>s.jsxs("button",{onClick:()=>l(S),className:he("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",o===S?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[s.jsx(E,{size:14})," ",k]},S))}),o==="overview"&&s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[s.jsx(Fd,{label:u("agents_ui.stat_threads"),value:h.data?.length??0,icon:bb}),s.jsx(Fd,{label:u("agents_ui.stat_records"),value:g.data?.length??0,icon:ub}),s.jsx(Fd,{label:u("agents_ui.stat_tasks"),value:N.length,icon:Xf}),s.jsx(Fd,{label:u("agents_ui.stat_heartbeats"),value:j.length,icon:Kl})]}),s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsx(Ye,{title:u("agent_detail_extra.skills_title"),description:"",children:s.jsxs("div",{className:"flex flex-wrap gap-1",children:[_.skills?.map(S=>s.jsxs(He,{tone:"info",children:[s.jsx(ea,{size:10})," ",S]},S)),_.tools?.map(S=>s.jsxs(He,{children:[s.jsx(ta,{size:10})," ",S]},S)),!_.skills?.length&&!_.tools?.length&&s.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),s.jsx(Ye,{title:u("project.agent_detail.threads_recent"),description:"",children:s.jsxs("ul",{className:"space-y-1 text-xs",children:[(h.data||[]).slice(0,6).map(S=>s.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[s.jsx("span",{className:"truncate",children:S.title||S.filename}),s.jsxs("span",{className:"shrink-0 text-muted-fg",children:[S.messages??0," ",u("project.agent_detail.msgs_count")]})]},S.id)),!h.data?.length&&s.jsx("li",{className:"text-muted-fg",children:u("project.agent_detail.no_threads")})]})})]}),y.length>0&&s.jsx(Ye,{title:u("project.agent_detail.subagents"),description:u("project.agent_detail.subagents_desc"),children:s.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(S=>s.jsxs("button",{onClick:()=>a(`/p/${e}/agents/${S.slug}`),className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-1.5 text-sm hover:border-muted-fg/50",children:[s.jsx(un,{size:14,className:"text-muted-fg"})," ",S.slug]},S.slug))})})]}),o==="memories"&&s.jsx(G8,{pid:e,slug:t,initial:_.memory||"",onSaved:()=>d.mutate()}),o==="records"&&s.jsx(Y8,{records:g.data||[],loading:g.isLoading}),o==="sleep"&&s.jsx(K8,{routines:j}),o==="brain"&&s.jsx(Q8,{slug:t,memory:_.memory||"",threads:(h.data||[]).map(S=>({id:S.id,label:S.title||S.filename})),tasks:N.map(S=>({id:S.id,label:S.title,detail:S.body||void 0})),routines:j,parent:_.parent||null,children:y.map(S=>S.slug)}),o==="config"&&s.jsx(F8,{pid:e,agent:_,agents:p.data||[],onSaved:()=>{d.mutate(),p.mutate()},onDeleted:()=>{p.mutate(),a(`/p/${e}/agents`)}})]})}function F8({pid:e,agent:t,agents:a,onSaved:o,onDeleted:l}){const c=Ze(),[d,p]=x.useState(t.emoji||""),[m,g]=x.useState(t.type||""),[h,b]=x.useState(t.area||""),[_,j]=x.useState(t.role||""),[N,y]=x.useState(t.autonomy||""),[w,S]=x.useState(t.model||""),[k,E]=x.useState(t.parent||""),[R,A]=x.useState(!!t.is_master),[T,z]=x.useState((t.skills||[]).join(", ")),[O,B]=x.useState((t.tools||[]).join(", ")),[P,U]=x.useState(t.description||""),[D,L]=x.useState(t.system||""),[V,H]=x.useState(!1),[$,F]=x.useState(!1),Y=async()=>{H(!0);try{await cn.update(e,t.slug,{emoji:d||null,type:m||null,area:h||null,role:_||null,autonomy:N||null,model:w||null,parent:k||null,is_master:R||m==="orchestrator",skills:Yx(T),tools:Yx(O),description:P||null,system:D}),c.success(u("project.agent_detail.update_success")),o()}catch(K){c.error(K.message)}finally{H(!1)}},G=async()=>{await cn.remove(e,t.slug),c.success(u("project.agent_detail.delete_success")),l()};return s.jsxs(Ye,{title:u("project.agent_detail.config_title"),description:`.apc/agents/${t.slug}.md — ${u("agents_ui.config_def_desc")}`,children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-[80px_1fr] gap-3",children:[s.jsx(ae,{label:u("agents_form.emoji"),children:s.jsx(dE,{value:d,onChange:p})}),s.jsx(ae,{label:u("project.agent_detail.type_label"),children:s.jsx(ut,{value:m,onChange:g,options:yE()})})]}),s.jsx(pE,{pid:e,area:h,role:_,onArea:b,onRole:j}),s.jsx(ae,{label:u("agents_form.autonomy"),hint:u("agents_form.autonomy_hint"),children:s.jsx(fE,{value:N,onChange:y})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("project.agent_detail.parent_label"),children:s.jsx(ut,{value:k,onChange:E,placeholder:u("project.agent_detail.none_parent"),options:[{value:"",label:u("project.agent_detail.none_parent")},...a.filter(K=>K.slug!==t.slug).map(K=>({value:K.slug,label:K.slug}))]})}),s.jsx(ae,{label:u("project.agent_detail.model_label"),hint:u("project.agent_detail.model_hint"),children:s.jsx(Ne,{value:w,onChange:K=>S(K.target.value),placeholder:u("project.agent_detail.model_ph")})})]}),s.jsx(ae,{label:u("project.agent_detail.skills_label"),children:s.jsx(Ne,{value:T,onChange:K=>z(K.target.value),placeholder:"skill-a, skill-b"})}),s.jsx(X8,{value:O,onChange:B}),s.jsx(ae,{label:u("project.agent_detail.bio_label"),children:s.jsx(on,{rows:2,value:P,onChange:K=>U(K.target.value)})}),s.jsx(ae,{label:u("project.agent_detail.system_label"),hint:u("project.agent_detail.system_hint"),children:s.jsx(on,{rows:10,className:"font-mono text-xs",value:D,onChange:K=>L(K.target.value),placeholder:"You are…"})}),s.jsx(Bt,{checked:R,onChange:A,label:u("project.agent_detail.master_label")}),s.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[s.jsxs(se,{variant:"destructive",onClick:()=>F(!0),children:[s.jsx(vn,{size:13})," ",u("project.agent_detail.delete_btn")]}),s.jsxs(se,{variant:"primary",loading:V,onClick:Y,children:[s.jsx(nu,{size:13})," ",u("project.agent_detail.save_btn")]})]})]}),s.jsx(mE,{open:$,onClose:()=>F(!1),onConfirm:G,title:u("project.agent_detail.delete_btn"),description:u("project.agent_detail.delete_confirm",{slug:t.slug}),confirmLabel:u("project.agent_detail.delete_btn")})]})}function Fd({label:e,value:t,icon:a}){return s.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[s.jsx(a,{size:13})," ",e]}),s.jsx("div",{className:"mt-1 text-2xl font-semibold",children:t})]})}function G8({pid:e,slug:t,initial:a,onSaved:o}){const l=Ze(),[c,d]=x.useState(a),[p,m]=x.useState(!1);x.useEffect(()=>{d(a)},[a]);const g=c!==a,h=async()=>{m(!0);try{await cn.memory.put(e,t,c),l.success(u("project.agent_detail.memory_saved")),o()}catch(b){l.error(b.message)}finally{m(!1)}};return s.jsxs(Ye,{title:u("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${t}/memory.md — ${u("agents_ui.memory_durable_desc")}`,children:[s.jsx(on,{rows:16,className:"font-mono text-xs",value:c,onChange:b=>d(b.target.value),placeholder:u("project.agent_detail.memory_empty")}),s.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[s.jsxs("span",{className:"text-[11px] text-muted-fg",children:[c.length," ",u("project.memories.chars")]}),s.jsxs(se,{size:"sm",variant:"primary",loading:p,disabled:!g,onClick:h,children:[s.jsx(nu,{size:12})," ",u("project.memories.save_btn")]})]})]})}function Y8({records:e,loading:t}){const a=x.useMemo(()=>[...e].sort((o,l)=>(l.ts||"").localeCompare(o.ts||"")),[e]);return s.jsxs(Ye,{title:u("project.agent_detail.records_title"),description:u("project.agent_detail.records_desc"),children:[t&&s.jsx(rt,{}),!t&&a.length===0&&s.jsx("p",{className:"text-xs text-muted-fg",children:u("project.agent_detail.no_activity")}),s.jsx("ul",{className:"space-y-1 text-sm",children:a.map((o,l)=>s.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("span",{className:"mt-0.5 shrink-0",children:o.direction==="in"?s.jsx(zS,{size:13,className:"text-blue-400"}):s.jsx(PS,{size:13,className:"text-emerald-400"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[s.jsx("span",{className:"font-mono",children:new Date(o.ts).toLocaleString()}),s.jsx(He,{tone:"info",children:o.channel}),o.type&&s.jsx(He,{children:o.type})]}),o.body&&s.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 K8({routines:e}){return e.length===0?s.jsx(Ye,{title:u("project.agent_detail.sleep_title"),description:u("project.agent_detail.sleep_desc"),children:s.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[s.jsx("div",{className:"font-medium text-amber-400",children:u("project.agent_detail.sleep_deep")}),s.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:u("project.agent_detail.sleep_deep_desc")})]})}):s.jsx(Ye,{title:u("project.agent_detail.sleep_title"),description:u("project.agent_detail.sleep_desc"),children:s.jsx("div",{className:"space-y-3",children:e.map(t=>{const a=t.enabled,o=t.last_status==="error";return s.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:he("size-2 rounded-full",o?"bg-destructive":a?"bg-emerald-400":"bg-muted-fg/40")}),s.jsx("span",{className:"text-sm font-medium",children:t.name}),s.jsx(He,{tone:a?"success":"muted",children:u(a?"agents_ui.running":"agents_ui.paused")}),o&&s.jsx(He,{tone:"danger",children:u("agents_ui.last_error")})]}),s.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[s.jsx(Gd,{label:u("agents_ui.field_tick"),value:t.schedule}),s.jsx(Gd,{label:u("agents_ui.field_next_tick"),value:t.next_run_at?new Date(t.next_run_at).toLocaleString():"—"}),s.jsx(Gd,{label:u("agents_ui.field_last_tick"),value:t.last_run_at?new Date(t.last_run_at).toLocaleString():"—"}),s.jsx(Gd,{label:u("agents_ui.field_last_run"),value:t.last_status||"—"})]}),t.last_error&&s.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:t.last_error})]},t.name)})})})}function Gd({label:e,value:t}){return s.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[s.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),s.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:t})]})}function X8({value:e,onChange:t}){const a=qe("/tools",()=>lL.list()),o=Yx(e),l=a.data||[],c=p=>{const m=new Set(o);m.has(p)?m.delete(p):m.add(p),t([...m].join(", "))},d=o.filter(p=>!l.some(m=>m.name===p));return s.jsxs(ae,{label:u("agents_ui.tools_label"),hint:u("project.agent_detail.tools_hint"),children:[s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map(p=>{const m=o.includes(p.name);return s.jsx($e,{content:p.description||p.name,children:s.jsx("button",{type:"button",onClick:()=>c(p.name),className:he("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)}),d.map(p=>s.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))]}),s.jsx(Ne,{className:"mt-2",value:e,onChange:p=>t(p.target.value),placeholder:u("project.agent_detail.tools_custom_ph")})]})}function Q8({slug:e,memory:t,threads:a,tasks:o,routines:l,parent:c,children:d}){const p=x.useMemo(()=>{const m=[];return q8(t).forEach((g,h)=>m.push({id:`m${h}`,label:g,kind:"memory",relation:"knows",detail:g})),a.slice(0,8).forEach(g=>m.push({id:`th-${g.id}`,label:g.label,kind:"thread",relation:"in_thread"})),o.slice(0,8).forEach(g=>m.push({id:`ts-${g.id}`,label:g.label,kind:"task",relation:"handles_task",detail:g.detail})),l.forEach(g=>m.push({id:`rt-${g.name}`,label:g.name,kind:"routine",relation:"ticks",detail:`schedule: ${g.schedule}`})),c&&m.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),d.forEach(g=>m.push({id:`c-${g}`,label:g,kind:"agentlink",relation:"orchestrates"})),m},[t,a,o,l,c,d]);return s.jsx(Ye,{title:u("project.agent_detail.brain_title"),description:u("project.agent_detail.brain_desc"),children:p.length===0?s.jsx("p",{className:"text-xs text-muted-fg",children:u("project.agent_detail.brain_empty")}):s.jsx(U8,{center:e,nodes:p})})}const W8=["","es","en","pt","fr","it","de"],Xw=e=>e.split(",").map(t=>t.trim()).filter(Boolean);function jE(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:xa}:{gradient:"from-slate-600 to-gray-600",Icon:un}}function Z8(e){const t=e.filter(d=>d.is_master),a=t.length===1?t[0]:null,o=d=>d.parent?d.parent:a&&!d.is_master&&d.slug!==a.slug?a.slug:null,l=new Map,c=[];for(const d of e){const p=o(d);p&&e.some(m=>m.slug===p)?(l.has(p)||l.set(p,[]),l.get(p).push(d)):c.push(d)}return{roots:c,childrenByParent:l}}function J8({pid:e}){const t=Pn();Ze();const a=qe(`/projects/${e}/agents`,()=>cn.list(e)),[o,l]=x.useState("hierarchy"),[c,d]=x.useState(!1),[p,m]=x.useState(!1),g=a.data||[],h=N=>t(`/p/${e}/agents/${N}`),b=N=>t(N?`/p/${e}/chat?agent=${N}`:`/p/${e}/chat`),{roots:_,childrenByParent:j}=x.useMemo(()=>Z8(g),[g]);return s.jsxs(Ye,{title:u("project.agents.title"),description:u("project.agents.subtitle_full"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[s.jsxs("button",{onClick:()=>l("hierarchy"),className:he("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[s.jsx(tu,{size:13})," ",u("project.agents.hierarchy")]}),s.jsxs("button",{onClick:()=>l("list"),className:he("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[s.jsx(t3,{size:13})," ",u("project.agents.list_view")]})]}),s.jsxs(se,{size:"sm",variant:"ghost",onClick:()=>m(!0),children:[s.jsx(e2,{size:13})," ",u("project.agents.import")]}),s.jsxs(se,{size:"sm",variant:"secondary",onClick:()=>b(),children:[s.jsx(ja,{size:13})," ",u("project.agents.chat")]}),s.jsxs(se,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>d(!0),children:[s.jsx(It,{size:14})," ",u("project.agents.new")]})]}),children:[a.isLoading&&s.jsx(rt,{}),!a.isLoading&&g.length===0&&s.jsx(pt,{children:u("project.agents.empty_text")}),!a.isLoading&&g.length>0&&(o==="hierarchy"?s.jsx(t7,{roots:_,childrenByParent:j,onOpen:h,onChat:b}):s.jsx(n7,{agents:g,onOpen:h,onChat:b})),s.jsx(s7,{open:c,pid:e,agents:g,onClose:()=>d(!1),onCreated:()=>{d(!1),a.mutate()}}),s.jsx(e7,{open:p,pid:e,existing:g.map(N=>N.slug),onClose:()=>m(!1),onImported:()=>a.mutate()})]})}function e7({open:e,onClose:t,onImported:a,pid:o,existing:l}){const c=Ze(),d=qe(e?"/agents/vault":null,()=>cn.vault()),[p,m]=x.useState(""),g=d.data||[],h=async b=>{m(b);try{await cn.import(o,b),c.success(u("project.agents.import_success",{slug:b})),a()}catch(_){c.error(_.message)}finally{m("")}};return s.jsxs(Zt,{open:e,onClose:t,title:u("project.agents.import_title"),description:u("project.agents.import_desc"),size:"lg",footer:s.jsx(se,{variant:"ghost",onClick:t,children:u("common.close")}),children:[d.isLoading&&s.jsx(rt,{}),!d.isLoading&&g.length===0&&s.jsx(pt,{children:u("project.agents.import_empty")}),s.jsx("ul",{className:"space-y-2",children:g.map(b=>{const _=l.includes(b.slug);return s.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[s.jsx(un,{size:16,className:"shrink-0 text-muted-fg"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:b.slug}),b.is_master&&s.jsxs(He,{tone:"success",children:[s.jsx(xa,{size:9})," ",u("project.agents.orchestrator")]}),b.model&&s.jsx(He,{tone:"info",children:b.model})]}),b.description&&s.jsx("p",{className:"truncate text-xs text-muted-fg",children:b.description})]}),s.jsx(se,{size:"sm",variant:"primary",disabled:_||p===b.slug,loading:p===b.slug,onClick:()=>h(b.slug),children:u(_?"project.agents.import_already":"project.agents.import_btn")})]},b.slug)})})]})}function t7({roots:e,childrenByParent:t,onOpen:a,onChat:o}){return s.jsx("div",{className:"space-y-8",children:e.map(l=>{const c=t.get(l.slug)||[];return s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx(Ch,{agent:l,onOpen:a,onChat:o,wide:!0}),c.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-5 w-px bg-border"}),s.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4 border-t border-border pt-5",children:c.map(d=>s.jsxs("div",{className:"flex flex-col items-center",children:[s.jsx(Ch,{agent:d,onOpen:a,onChat:o}),(t.get(d.slug)||[]).length>0&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"h-4 w-px bg-border"}),s.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(t.get(d.slug)||[]).map(p=>s.jsx(Ch,{agent:p,onOpen:a,onChat:o,compact:!0},p.slug))})]})]},d.slug))})]})]},l.slug)})})}function Ch({agent:e,onOpen:t,onChat:a,wide:o,compact:l}){const{gradient:c,Icon:d}=jE(e);return s.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:he("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:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:he("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:e.emoji?s.jsx("span",{className:"text-base leading-none",children:e.emoji}):s.jsx(d,{className:"size-4 text-white"})}),s.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),s.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&s.jsxs(He,{tone:"success",children:[s.jsx(xa,{size:9})," ",u("project.agents.orchestrator")]}),e.role&&s.jsx(He,{children:e.role}),e.model&&!l&&s.jsx(He,{tone:"info",children:e.model})]}),s.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:[s.jsxs("button",{onClick:()=>t(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[s.jsx(eu,{size:12})," ",u("project.agents.view")]}),s.jsxs("button",{onClick:()=>a(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[s.jsx(ja,{size:12})," ",u("project.agents.chat")]})]})]})}function n7({agents:e,onOpen:t,onChat:a}){const o=[...e].sort((l,c)=>+!!c.is_master-+!!l.is_master||l.slug.localeCompare(c.slug));return s.jsx("div",{className:"space-y-2",children:o.map(l=>{const{gradient:c,Icon:d}=jE(l);return s.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:[s.jsx("div",{className:he("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:l.emoji?s.jsx("span",{className:"text-lg leading-none",children:l.emoji}):s.jsx(d,{className:"size-4 text-white"})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"text-sm font-semibold",children:l.slug}),l.is_master&&s.jsxs(He,{tone:"success",children:[s.jsx(xa,{size:10})," ",u("project.agents.orchestrator")]}),l.role&&s.jsx(He,{children:l.role}),l.model&&s.jsx(He,{tone:"info",children:l.model}),l.parent&&s.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",l.parent]})]}),l.description&&s.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:l.description}),s.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[l.skills?.map(p=>s.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[s.jsx(ea,{size:9})," ",p]},p)),l.tools?.map(p=>s.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[s.jsx(ta,{size:9})," ",p]},p))]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:p=>p.stopPropagation(),children:[s.jsxs("button",{onClick:()=>t(l.slug),className:"flex items-center gap-1 hover:text-foreground",children:[s.jsx(eu,{size:12})," ",u("project.agents.view")]}),s.jsxs("button",{onClick:()=>a(l.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[s.jsx(ja,{size:12})," ",u("project.agents.chat")]})]})]},l.slug)})})}function s7({open:e,onClose:t,onCreated:a,pid:o,agents:l}){const c=Ze(),[d,p]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(""),[N,y]=x.useState(""),[w,S]=x.useState(""),[k,E]=x.useState(""),[R,A]=x.useState(""),[T,z]=x.useState(""),[O,B]=x.useState(""),[P,U]=x.useState(""),[D,L]=x.useState(!1),[V,H]=x.useState(""),[$,F]=x.useState(!1),Y=()=>{p(""),g(""),b(""),j(""),y(""),S(""),E(""),A(""),z(""),B(""),U(""),L(!1),H("")},G=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(d)){c.error(u("project.agents.slug_invalid"));return}F(!0);try{await cn.create(o,{slug:d,emoji:m||void 0,type:h||void 0,role:_||void 0,area:N||void 0,autonomy:w||void 0,model:k||void 0,language:R||void 0,description:T||void 0,skills:Xw(O),tools:Xw(P),is_master:D||h==="orchestrator",parent:V||void 0}),c.success(u("project.agents.create_success",{slug:d})),a(),Y()}catch(K){c.error(K?.message||u("project.agents.create_error"))}finally{F(!1)}};return s.jsx(Zt,{open:e,onClose:t,title:u("project.agents.new_title"),description:u("project.agents.new_desc"),size:"lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:$,children:u("common.cancel")}),s.jsx(se,{variant:"primary","data-testid":"agent-create-submit",onClick:G,loading:$,children:u("common.create")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-[80px_1fr_1fr] gap-3",children:[s.jsx(ae,{label:u("agents_form.emoji"),children:s.jsx(dE,{value:m,onChange:g})}),s.jsx(ae,{label:u("project.agents.slug_label"),children:s.jsx(Ne,{autoFocus:!0,"data-testid":"agent-slug",value:d,onChange:K=>p(K.target.value),placeholder:u("project.agents.slug_ph")})}),s.jsx(ae,{label:u("project.agent_detail.type_label"),children:s.jsx(ut,{value:h,onChange:b,options:yE()})})]}),s.jsx(pE,{pid:o,area:N,role:_,onArea:y,onRole:j}),s.jsx(ae,{label:u("agents_form.autonomy"),hint:u("agents_form.autonomy_hint"),children:s.jsx(fE,{value:w,onChange:S})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("project.agents.model_label"),hint:u("project.agents.model_hint"),children:s.jsx(Ne,{value:k,onChange:K=>E(K.target.value)})}),s.jsx(ae,{label:u("project.agents.lang_label"),children:s.jsx(ut,{value:R,onChange:A,options:W8.map(K=>({value:K,label:K||"—"}))})})]}),s.jsx(ae,{label:u("project.agents.desc_label"),children:s.jsx(on,{rows:2,value:T,onChange:K=>z(K.target.value),placeholder:u("project.agents.desc_ph")})}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("project.agents.skills_label"),children:s.jsx(Ne,{value:O,onChange:K=>B(K.target.value),placeholder:u("project.agents.skills_ph")})}),s.jsx(ae,{label:u("project.agents.tools_label"),children:s.jsx(Ne,{value:P,onChange:K=>U(K.target.value),placeholder:u("project.agents.tools_ph")})})]}),s.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[s.jsx(ae,{label:u("project.agents.parent_label"),hint:u("project.agents.parent_hint"),children:s.jsx(ut,{value:V,onChange:H,placeholder:u("project.agents.none_parent"),options:[{value:"",label:u("project.agents.none_parent")},...l.filter(K=>K.slug!==d).map(K=>({value:K.slug,label:K.slug}))]})}),s.jsx(Bt,{checked:D,onChange:L,label:u("project.agents.master_label")})]})]})})}function Yd(e){return e.split(`
|
|
769
|
+
`).map(t=>t.trim()).filter(Boolean)}function Kc(){return{exec_agent:{label:u("agents_ui.kind_exec_agent"),desc:u("agents_ui.kind_exec_agent_desc"),icon:un},super_agent:{label:u("agents_ui.kind_super_agent"),desc:u("agents_ui.kind_super_agent_desc"),icon:xa},telegram:{label:u("agents_ui.kind_telegram"),desc:u("agents_ui.kind_telegram_desc"),icon:ja},shell:{label:u("agents_ui.kind_shell"),desc:u("agents_ui.kind_shell_desc"),icon:ba},heartbeat:{label:u("agents_ui.kind_heartbeat"),desc:u("agents_ui.kind_heartbeat_desc"),icon:Kl}}}function a7(e){const t=Kc();return Object.keys(t).filter(a=>a!=="heartbeat"||e==="heartbeat").map(a=>({value:a,label:t[a].label,description:t[a].desc,icon:t[a].icon}))}function X_(e){if(!e)return"—";if(e.startsWith("every:")){const t=e.slice(6),a=t.match(/^(\d+)(s|m|h|d)$/);if(a){const o=a[1],l={s:u("agents_ui.unit_seconds"),m:u("agents_ui.unit_minutes"),h:u("agents_ui.unit_hours"),d:u("agents_ui.unit_days")}[a[2]]||a[2];return u("agents_ui.every_n_unit",{n:o,unit:l})}return u("agents_ui.every_v",{v:t})}return e.startsWith("once:")?`once · ${new Date(e.slice(5)).toLocaleString()}`:e.startsWith("cron ")?`cron · ${e.slice(5)}`:e}function r7(){return[{label:u("agents_ui.preset_every_10m"),value:"every:10m"},{label:u("agents_ui.preset_hourly"),value:"every:1h"},{label:u("agents_ui.preset_daily_9am"),value:"cron 0 9 * * *"},{label:u("agents_ui.preset_weekdays_9am"),value:"cron 0 9 * * 1-5"}]}function wE(){return[{v:"{{pre_output}}",where:"prompt",desc:u("agents_ui.var_pre_output_prompt")},{v:"$APX_LLM_OUTPUT",where:"post",desc:u("agents_ui.var_llm_output")},{v:"$APX_STATUS",where:"post",desc:u("agents_ui.var_status")},{v:"$APX_SKIPPED",where:"post",desc:u("agents_ui.var_skipped")},{v:"$APX_PRE_OUTPUT",where:"post",desc:u("agents_ui.var_pre_output")},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:u("agents_ui.var_pre_output_file")},{v:"$APX_PRE_EXIT",where:"post",desc:u("agents_ui.var_pre_exit")},{v:"$APX_ROUTINE",where:"pre/post",desc:u("agents_ui.var_routine")}]}function bc(e){return wE().filter(t=>e==="pre"?t.where.includes("pre"):e==="prompt"?t.where==="prompt":t.where==="post"||t.where==="pre/post")}function o7({routines:e,selectedName:t,onSelect:a}){return s.jsxs("aside",{className:"flex h-full min-h-0 flex-col border-r border-border",children:[s.jsx("div",{className:"shrink-0 px-3 py-2.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:u("project.routines.list_title")}),s.jsx("ul",{className:"min-h-0 flex-1 space-y-1 overflow-y-auto p-2 pt-0",children:e.map(o=>{const l=Kc()[o.kind],c=l?.icon||su,d=o.name===t;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>a(o.name),"aria-current":d,className:he("w-full rounded-lg border px-2.5 py-2 text-left transition-colors",d?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:he("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:s.jsx(c,{size:13})}),s.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium",children:o.name}),!o.enabled&&s.jsx("span",{className:"shrink-0 text-[10px] text-muted-fg",children:u("project.routines.paused")}),s.jsx(fu,{ok:o.last_status==="ok"?!0:o.last_status==="error"?!1:null})]}),s.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 pl-8 text-[10px] text-muted-fg",children:[s.jsx("span",{className:"truncate",children:l?.label||o.kind}),s.jsxs("span",{className:"shrink-0",children:["⏱ ",X_(o.schedule)]})]})]})},o.name)})})]})}function l7({title:e,body:t,mono:a}){return s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),s.jsx("div",{className:he("max-h-44 overflow-auto whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 text-xs",a&&"font-mono"),children:t.trim()?t:s.jsx("span",{className:"text-muted-fg",children:u("project.routines.block_empty")})})]})}function kE(e){const t=e.meta||{};return t.skipped?"skipped":t.status==="error"?"error":"ok"}function SE(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 CE({st:e}){return e==="ok"?s.jsx(Hr,{size:13,className:"shrink-0 text-emerald-500"}):e==="error"?s.jsx(Ss,{size:13,className:"shrink-0 text-destructive"}):s.jsx(_M,{size:13,className:"shrink-0 text-amber-500"})}function NE(e){return u(e==="ok"?"project.routines.status_ok":e==="error"?"project.routines.status_error":"project.routines.status_skipped")}function Nh({title:e,children:t}){return s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:e}),t]})}const Eh="whitespace-pre-wrap break-words rounded-lg border border-border bg-muted/20 px-3 py-2 font-mono text-[11px]";function i7({m:e,onClose:t}){const a=kE(e),o=e.meta||{},l=o.result||{},c=o.flow||null,d=String(l.reply??l.text??l.stdout??""),p=String(l.error??l.stderr??""),m=String(l.note??""),g=s.jsx("span",{className:"text-muted-fg",children:u("project.routines.block_empty")});return s.jsxs("div",{className:"flex min-h-0 flex-col border-l border-border",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-2 px-4 py-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[s.jsx(CE,{st:a}),s.jsx("span",{className:he("font-medium",a==="ok"&&"text-emerald-500",a==="error"&&"text-destructive",a==="skipped"&&"text-amber-500"),children:NE(a)}),s.jsx("span",{className:"font-mono text-muted-fg",children:SE(e.ts)})]}),s.jsx("button",{type:"button",onClick:t,"aria-label":u("project.routines.runs_close"),className:"rounded-md p-1 text-muted-fg hover:bg-muted hover:text-foreground",children:s.jsx(Ss,{size:14})})]}),s.jsxs("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 pb-4 text-xs",children:[e.body&&s.jsx("div",{className:"text-muted-fg",children:e.body}),c?.pre&&s.jsx(Nh,{title:u("project.routines.block_pre"),children:c.pre.output?.trim()?s.jsx("pre",{className:Eh,children:c.pre.output}):g}),s.jsx(Nh,{title:u("project.routines.runs_output"),children:d?s.jsx("pre",{className:Eh,children:d}):p?s.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?s.jsx("div",{className:"text-muted-fg",children:m}):g}),c?.post&&c.post.length>0&&s.jsx(Nh,{title:u("project.routines.block_post"),children:s.jsx("div",{className:"space-y-1.5",children:c.post.map((h,b)=>s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"font-mono text-[10px] text-muted-fg",children:["$ ",h.cmd," ",s.jsxs("span",{className:"opacity-70",children:["· exit ",h.exit]})]}),(h.stdout||h.stderr)&&s.jsx("pre",{className:Eh,children:h.stdout||h.stderr})]},b))})})]})]})}function c7({pid:e,name:t,running:a}){const o=qe(`/projects/${e}/routines/${t}/runs`,async()=>(await Of.project(e,{channel:"routine",limit:200})).filter(g=>g.meta?.routine===t&&(g.actor_id==="apx:routine"||g.type==="system"))),l=(o.data||[]).slice(0,50),[c,d]=x.useState(null),p=c&&l.find(m=>m.ts===c)||null;return s.jsxs("div",{className:"flex min-h-0 flex-1 flex-col border-t border-border",children:[s.jsx("div",{className:"shrink-0 px-4 pb-1.5 pt-3 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:u("project.routines.runs_title")}),s.jsxs("div",{className:he("grid min-h-0 flex-1 overflow-hidden",p?"grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]":"grid-cols-1"),children:[s.jsxs("div",{className:"min-h-0 overflow-y-auto px-4 pb-4",children:[o.isLoading&&s.jsx(rt,{}),!o.isLoading&&l.length===0&&s.jsx("div",{className:"text-xs text-muted-fg",children:u("project.routines.runs_empty")}),s.jsxs("ul",{className:"space-y-1",children:[a&&s.jsx("li",{children:s.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:[s.jsx(_n,{size:12}),s.jsx("span",{className:"text-muted-fg",children:u("project.routines.running")})]})}),l.map((m,g)=>{const h=kE(m),b=c===m.ts;return s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>d(b?null:m.ts),"aria-current":b,className:he("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:[s.jsx(CE,{st:h}),s.jsx("span",{className:"font-mono text-muted-fg",children:SE(m.ts)}),s.jsx("span",{className:he("font-medium",h==="ok"&&"text-emerald-500",h==="error"&&"text-destructive",h==="skipped"&&"text-amber-500"),children:NE(h)})]})},`${m.ts}-${g}`)})]})]}),p&&s.jsx(i7,{m:p,onClose:()=>d(null)})]})]})}function u7({pid:e,routine:t,onEdit:a,onRun:o,onToggle:l,onDelete:c,running:d}){const p=Kc()[t.kind],m=p?.icon||su,g=t.spec||{},h=t.pre_commands||[],b=t.post_commands||[],_=[];return h.length&&_.push({title:u("project.routines.block_pre"),body:h.join(`
|
|
770
|
+
`),mono:!0}),t.kind==="exec_agent"||t.kind==="super_agent"?_.push({title:u("project.routines.block_prompt"),body:String(g.prompt||"")}):t.kind==="telegram"?_.push({title:u("project.routines.block_text"),body:String(g.text||"")}):t.kind==="shell"?_.push({title:u("project.routines.block_command"),body:String(g.command||""),mono:!0}):t.kind==="heartbeat"&&_.push({title:u("project.routines.block_text"),body:String(g.message||"")}),b.length&&_.push({title:u("project.routines.block_post"),body:b.join(`
|
|
771
|
+
`),mono:!0}),s.jsxs("div",{className:"flex h-full min-h-0 flex-col",children:[s.jsxs("div",{className:"min-h-0 shrink space-y-4 overflow-y-auto p-4",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[s.jsx("span",{className:he("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:s.jsx(m,{size:14})}),s.jsx("h3",{className:"truncate text-base font-semibold",children:t.name}),s.jsx(He,{tone:t.kind==="shell"?"warning":"info",children:p?.label||t.kind})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsx(Bt,{checked:t.enabled,onChange:l}),s.jsx($e,{content:u("common.run"),children:s.jsx(se,{size:"sm",variant:"secondary",onClick:o,loading:d,children:s.jsx(yb,{size:13})})}),s.jsx($e,{content:u("project.routines.edit_hint"),children:s.jsxs(se,{size:"sm",variant:"secondary",onClick:a,children:[s.jsx(ya,{size:13})," ",u("project.routines.edit_btn")]})}),s.jsx($e,{content:u("common.delete"),children:s.jsx(se,{size:"sm",variant:"destructive",onClick:c,children:s.jsx(vn,{size:13})})})]})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[s.jsxs("span",{children:["⏱ ",X_(t.schedule)]}),t.next_run_at&&s.jsxs("span",{children:[u("project.routines.next_run")," ",new Date(t.next_run_at).toLocaleString()]}),t.last_run_at&&s.jsxs("span",{children:[u("project.routines.last_run")," ",new Date(t.last_run_at).toLocaleString()]}),s.jsxs("span",{className:he(t.last_status==="ok"&&"text-emerald-500",t.last_status==="error"&&"text-destructive"),children:[u("agents_ui.last_label")," ",t.last_status||"—"]})]}),t.last_error&&s.jsx("div",{className:"rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:t.last_error}),s.jsx("div",{className:"space-y-3",children:_.map(j=>s.jsx(l7,{title:j.title,body:j.body,mono:j.mono},j.title))})]}),s.jsx(c7,{pid:e,name:t.name,running:d})]})}function Ml({label:e,hint:t,value:a,onChange:o,vars:l,rows:c=3,mono:d,placeholder:p}){const m=x.useRef(null),g=h=>{const b=m.current?.querySelector("textarea");if(!b){o(a?`${a}${h}`:h);return}const _=b.selectionStart??a.length,j=b.selectionEnd??a.length,N=a.slice(0,_)+h+a.slice(j);o(N),requestAnimationFrame(()=>{b.focus();const y=_+h.length;b.setSelectionRange(y,y)})};return s.jsxs("div",{className:"space-y-1",children:[s.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:e}),t&&s.jsx("div",{className:"text-[11px] text-muted-foreground/70",children:t}),s.jsxs("div",{ref:m,className:"space-y-1.5",children:[s.jsx(on,{rows:c,className:he(d&&"font-mono text-xs"),value:a,onChange:h=>o(h.target.value),placeholder:p}),l.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1",children:l.map(h=>s.jsx("button",{type:"button",onClick:()=>g(h.v),className:"inline-flex items-center rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px] text-muted-fg transition-colors hover:border-muted-fg/50 hover:text-foreground",children:h.v},h.v))})]})]})}function d7(){return s.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[s.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:u("project.routines.vars_title")}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:wE().map(e=>s.jsx($e,{content:s.jsx("span",{className:"block max-w-[240px] whitespace-normal leading-snug",children:e.desc}),children:s.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,s.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",e.where]})]})},e.v))})]})}function f7({draft:e,onClose:t,onSaved:a,pid:o}){const l=Ze(),c=qe(e?`/projects/${o}/agents`:null,()=>cn.list(o)),[d,p]=x.useState(!1),[m,g]=x.useState(""),[h,b]=x.useState("super_agent"),[_,j]=x.useState("every:10m"),[N,y]=x.useState(!0),[w,S]=x.useState(""),[k,E]=x.useState(""),[R,A]=x.useState("default"),[T,z]=x.useState(""),[O,B]=x.useState(""),[P,U]=x.useState(""),[D,L]=x.useState("heartbeat"),[V,H]=x.useState(""),[$,F]=x.useState(""),[Y,G]=x.useState(""),K=qe(e&&h==="telegram"?"/telegram/channels":null,()=>Dn.channels.list());x.useEffect(()=>{if(!e)return;const de=e.spec&&typeof e.spec=="object"?e.spec:{};g(e.name||""),b(e.kind||"super_agent"),j(e.schedule||"every:10m"),y(e.enabled??!0),S(de.agent||""),E(de.prompt||""),A(de.channel||"default"),z(de.chat_id?String(de.chat_id):""),B(de.text||""),U(de.command||""),L(de.channel||"heartbeat"),H(de.message||""),F((e.pre_commands||[]).join(`
|
|
772
|
+
`)),G((e.post_commands||[]).join(`
|
|
773
|
+
`))},[e]);const I=h==="exec_agent"||h==="super_agent"||h==="telegram",X=()=>{switch(h){case"exec_agent":return{agent:w,prompt:k};case"super_agent":return{prompt:k};case"telegram":return{channel:R,...T?{chat_id:T}:{},text:O};case"shell":return{command:P};case"heartbeat":return{channel:D,message:V}}},Z=async()=>{if(!m){l.error(u("project.routines.name_required"));return}p(!0);try{await zr.upsert(o,{name:m,kind:h,schedule:_,enabled:N,spec:X(),pre_commands:I?Yd($):[],post_commands:I?Yd(Y):[]}),l.success(u("project.routines.saved")),a()}catch(de){l.error(de?.message||u("project.routines.save_error"))}finally{p(!1)}},W=(()=>{const de=K.data?.channels||[],ge=["default",...de.map(ke=>ke.name)];R&&!ge.includes(R)&&ge.push(R);const Ce=new Set;return ge.filter(ke=>Ce.has(ke)?!1:(Ce.add(ke),!0)).map(ke=>{const Be=de.find(Se=>Se.name===ke),Ve=Be?.project?`proyecto ${Be.project}`:Be?.chat_id?`chat ${Be.chat_id}`:void 0;return{value:ke,label:ke,description:Ve}})})(),fe=I?Yd($):[],te=I?Yd(Y):[],re=(()=>{switch(h){case"exec_agent":return w?u("agents_ui.action_agent_answers",{agent:w}):u("agents_ui.action_agent_pick_answers");case"super_agent":return u("agents_ui.action_super_answers");case"telegram":return u("agents_ui.action_telegram_channel",{channel:R});case"shell":return P?u("agents_ui.summary_runs_cmd",{cmd:P.slice(0,48)}):u("agents_ui.action_runs_shell");case"heartbeat":return u("agents_ui.summary_heartbeat")}})(),le=h==="telegram"?O:h==="shell"?P:h==="heartbeat"?V:k,me=Kc()[h].icon,Me=[...fe.map((de,ge)=>({id:`pre-${ge}`,icon:ba,label:u("agents_ui.step_pre"),detail:de,action:!1})),{id:"action",icon:me,label:re,detail:le?le.slice(0,90):u("project.routines.block_empty"),action:!0},...te.map((de,ge)=>({id:`post-${ge}`,icon:ba,label:u("agents_ui.step_post"),detail:de,action:!1}))];return s.jsx(Zt,{open:!!e,onClose:t,title:e?.name?u("project.routines.edit_title",{name:e.name}):u("project.routines.new_title"),description:u("project.routines.dialog_desc"),size:"xl",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:d,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:Z,loading:d,children:u("common.save")})]}),children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[s.jsx(Bt,{checked:N,onChange:y,label:u("project.routines.enabled_label")}),s.jsx("span",{className:"text-[11px] text-muted-fg",children:u(N?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),s.jsx(ae,{label:u("project.routines.name_field"),hint:e?.name?u("project.routines.name_no_edit"):void 0,children:s.jsx(Ne,{value:m,disabled:!!e?.name,onChange:de=>g(de.target.value),placeholder:"resumen-diario"})}),s.jsx(ae,{label:u("project.routines.kind_field"),children:s.jsx(ut,{value:h,onChange:de=>b(de),options:a7(h)})}),s.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:Kc()[h].desc}),h==="exec_agent"&&s.jsx(ae,{label:u("project.routines.agent_field"),hint:u("project.routines.agent_hint"),children:s.jsx(ut,{value:w,onChange:S,placeholder:c.isLoading?u("project.routines.agent_loading"):u("project.routines.agent_pick"),options:(c.data||[]).map(de=>({value:de.slug,label:de.slug,description:[de.role,de.model].filter(Boolean).join(" · ")||void 0}))})}),s.jsx(ae,{label:u("project.routines.schedule_field"),hint:u("project.routines.schedule_hint"),children:s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap gap-1",children:[r7().map(de=>s.jsx("button",{type:"button",onClick:()=>j(de.value),className:he("rounded-md border px-2 py-0.5 text-[11px]",_===de.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:de.label},de.value)),s.jsx("button",{type:"button",onClick:()=>j("manual"),className:he("rounded-md border px-2 py-0.5 text-[11px]",_==="manual"?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:u("agents_ui.preset_manual")})]}),s.jsx(Ne,{value:_,onChange:de=>j(de.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})}),s.jsx(d7,{})]}),s.jsxs("div",{className:"space-y-3",children:[I&&s.jsx(Ml,{label:u("project.routines.pre_field"),hint:u("project.routines.pre_hint"),rows:2,mono:!0,value:$,onChange:F,vars:bc("pre"),placeholder:"curl -s https://wttr.in/Bariloche"}),h==="exec_agent"&&s.jsx(Ml,{label:u("project.routines.prompt_exec"),rows:4,value:k,onChange:E,vars:bc("prompt"),placeholder:u("project.routines.prompt_exec_ph")}),h==="super_agent"&&s.jsx(Ml,{label:u("project.routines.prompt_super"),rows:4,value:k,onChange:E,vars:bc("prompt"),placeholder:u("project.routines.prompt_super_ph")}),h==="telegram"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("project.routines.tg_channel"),children:s.jsx(ut,{value:R,onChange:A,options:W})}),s.jsx(ae,{label:u("project.routines.tg_chat_id"),children:s.jsx(Ne,{value:T,onChange:de=>z(de.target.value),placeholder:u("agents_ui.tg_chat_id_ph")})})]}),s.jsx(Ml,{label:u("project.routines.tg_text"),hint:u("project.routines.tg_text_hint"),rows:6,value:O,onChange:B,vars:bc("prompt"),placeholder:u("agents_ui.tg_text_ph")})]}),h==="shell"&&s.jsx(Ml,{label:u("project.routines.shell_field"),hint:u("project.routines.shell_hint"),rows:11,mono:!0,value:P,onChange:U,vars:[],placeholder:"cd /repo && git pull && npm test"}),h==="heartbeat"&&s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("project.routines.hb_channel"),children:s.jsx(Ne,{value:D,onChange:de=>L(de.target.value),placeholder:"heartbeat"})}),s.jsx(ae,{label:u("project.routines.hb_message"),children:s.jsx(Ne,{value:V,onChange:de=>H(de.target.value),placeholder:u("agents_ui.hb_message_ph")})})]}),I&&s.jsx(Ml,{label:u("project.routines.post_field"),hint:u("project.routines.post_hint"),rows:2,mono:!0,value:Y,onChange:G,vars:bc("post"),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})]})]}),s.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[u("project.routines.what_happens")," ",s.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",X_(_)]})]}),s.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:Me.map((de,ge)=>s.jsxs("div",{className:"flex items-stretch gap-2",children:[s.jsxs("div",{className:he("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",de.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[s.jsxs("div",{className:he("flex items-center gap-1.5 text-[11px] font-medium",de.action?"text-emerald-400":"text-muted-fg"),children:[s.jsx(de.icon,{size:12})," ",de.label]}),de.detail&&s.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:de.detail})]}),ge<Me.length-1&&s.jsx(DS,{size:14,className:"shrink-0 self-center text-muted-fg"})]},de.id))})]})]})})}function p7({pid:e}){const t=Ze(),a=qe(`/projects/${e}/routines`,()=>zr.list(e)),[o,l]=$o(),[c,d]=x.useState(null),[p,m]=x.useState(null),[g,h]=x.useState(!1),[b,_]=x.useState(null),[j,N]=x.useState(null),y=a.data||[],w=o.get("r_id"),S=y.find(T=>T.name===w)||null,k=T=>l(z=>{const O=new URLSearchParams(z);return T?O.set("r_id",T):O.delete("r_id"),O},{replace:!0});x.useEffect(()=>{y.length!==0&&(w&&y.some(T=>T.name===w)||k(y[0].name))},[y,w]);const E=async T=>{try{await(T.enabled?zr.disable:zr.enable)(e,T.name),a.mutate()}catch(z){t.error(z?.message||u("project.routines.toggle_error"))}},R=async()=>{if(!b)return;const T=b;_(null),N(T.name);try{await zr.run(e,T.name),t.success(u("project.routines.run_success",{name:T.name})),await Promise.all([a.mutate(),Af(`/projects/${e}/routines/${T.name}/runs`)])}catch(z){t.error(z?.message||u("project.routines.run_error"))}finally{N(null)}},A=async()=>{if(p){h(!0);try{await zr.remove(e,p.name),t.success(u("project.routines.delete_success")),w===p.name&&k(null),m(null),a.mutate()}catch(T){t.error(T?.message||u("project.routines.delete_error"))}finally{h(!1)}}};return s.jsxs("div",{className:"flex h-full min-h-0 flex-col gap-3",children:[s.jsxs("div",{className:"flex shrink-0 items-start justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:u("project.routines.title")}),s.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:u("project.routines.subtitle")})]}),s.jsxs(se,{size:"sm",variant:"primary",onClick:()=>d({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[s.jsx(It,{size:14})," ",u("project.routines.new_btn")]})]}),a.isLoading&&s.jsx(rt,{}),!a.isLoading&&y.length===0&&s.jsx(pt,{children:u("project.routines.empty")}),y.length>0&&s.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:[s.jsx(o7,{routines:y,selectedName:S?.name??null,onSelect:k}),s.jsx("div",{className:"min-h-0 min-w-0 overflow-hidden",children:S?s.jsx(u7,{pid:e,routine:S,onEdit:()=>d({...S}),onRun:()=>_(S),onToggle:()=>E(S),onDelete:()=>m(S),running:j===S.name},S.name):s.jsx("div",{className:"flex h-full items-center justify-center p-8",children:s.jsx("p",{className:"text-sm text-muted-fg",children:u("project.routines.detail_empty")})})})]}),s.jsx(f7,{draft:c,onClose:()=>d(null),onSaved:()=>{d(null),a.mutate()},pid:e}),s.jsx(Zt,{open:!!p,onClose:()=>g?null:m(null),title:u("project.routines.delete_confirm",{name:p?.name||""}),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:()=>m(null),disabled:g,children:u("common.cancel")}),s.jsx(se,{variant:"destructive",onClick:A,loading:g,children:u("common.delete")})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:u("project.routines.delete_confirm_body")})}),s.jsx(Zt,{open:!!b,onClose:()=>_(null),title:u("project.routines.run_confirm",{name:b?.name||""}),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:()=>_(null),children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:R,children:u("common.run")})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:u("project.routines.run_confirm_body")})})]})}function yo({label:e,children:t}){return s.jsxs("div",{className:"flex items-baseline justify-between gap-3 text-xs",children:[s.jsx("span",{className:"text-muted-foreground",children:e}),s.jsx("span",{className:"text-right font-mono text-foreground/90",children:t})]})}function m7({pid:e,taskId:t,onClose:a,onChanged:o}){const l=Ze(),c=Pn(),{data:d,isLoading:p,mutate:m}=qe(`/projects/${e}/tasks/${t}`,()=>Wn.get(e,t)),[g,h]=x.useState(""),[b,_]=x.useState(!1);x.useEffect(()=>{h(d?.body??"")},[d?.id,d?.body]);const j=()=>{m(),o()},N=async k=>{_(!0);try{await k(),j()}catch(E){l.error(E instanceof Error?E.message:String(E))}finally{_(!1)}};if(p)return s.jsx("div",{className:"flex w-80 items-center justify-center border-l border-border",children:s.jsx(_n,{})});if(!d)return null;const y=Pf(d),w=d.state==="open",S=g!==(d.body??"");return s.jsxs("div",{className:"flex w-80 shrink-0 flex-col border-l border-border bg-card/40","data-testid":"task-detail",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-4 py-2.5",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("tasks.detail_title")}),s.jsx("button",{type:"button",onClick:a,"aria-label":u("common.close"),className:"text-muted-foreground hover:text-foreground",children:s.jsx(Ss,{className:"size-4"})})]}),s.jsxs("div",{className:"min-h-0 flex-1 space-y-4 overflow-y-auto px-4 py-4",children:[s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:u("tasks.field_title")}),s.jsx("div",{className:"text-sm font-semibold",children:d.title})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(B_,{status:y}),s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:d.id})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"mb-1 flex items-center justify-between",children:[s.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:u("tasks.field_prompt")}),S&&s.jsxs("button",{type:"button",onClick:()=>N(async()=>{await Wn.patch(e,d.id,{body:g}),l.success(u("common.saved"))}),className:"flex items-center gap-1 text-[10px] text-emerald-500 hover:text-emerald-400",children:[s.jsx(nu,{className:"size-3"}),u("files.save")]})]}),s.jsx(on,{rows:4,value:g,onChange:k=>h(k.target.value),placeholder:u("tasks.prompt_ph"),className:"text-xs"})]}),w&&s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:u("tasks.field_status")}),s.jsx(ut,{value:d.status??"pending",onChange:k=>N(()=>Wn.status(e,d.id,k)),options:qN.map(k=>({value:k,label:I_(k)}))})]}),s.jsxs("div",{className:"space-y-1.5 rounded-lg border border-border bg-background/40 p-2.5",children:[d.agent&&s.jsxs(yo,{label:u("tasks.field_agent"),children:["@",d.agent]}),d.created_by&&s.jsx(yo,{label:u("tasks.field_creator"),children:d.created_by}),d.source&&s.jsx(yo,{label:u("tasks.field_source"),children:d.source}),d.due&&s.jsx(yo,{label:u("project.tasks.due"),children:d.due}),s.jsx(yo,{label:u("tasks.field_created"),children:new Date(d.created_at).toLocaleString()}),s.jsx(yo,{label:u("tasks.field_updated"),children:new Date(d.updated_at).toLocaleString()}),d.done_at&&s.jsx(yo,{label:u("tasks.field_done"),children:new Date(d.done_at).toLocaleString()})]}),d.thread&&s.jsxs("button",{type:"button",onClick:()=>c(`/p/${e}/chat?thread=${d.thread}`),className:"flex w-full items-center justify-center gap-1.5 rounded-lg border border-sky-500/30 bg-sky-500/5 px-3 py-2 text-xs text-sky-500 hover:bg-sky-500/10",children:[s.jsx(mb,{className:"size-3.5"}),u("tasks.view_thread")]})]}),s.jsx("div",{className:"flex shrink-0 gap-2 border-t border-border px-4 py-3",children:w?s.jsxs(s.Fragment,{children:[s.jsxs(se,{size:"sm",variant:"primary",className:"flex-1",loading:b,onClick:()=>N(()=>Wn.done(e,d.id)),children:[s.jsx(Hr,{size:13}),u("tasks.mark_done")]}),s.jsx(se,{size:"sm",variant:"destructive",loading:b,onClick:()=>N(()=>Wn.drop(e,d.id)),"aria-label":u("project.tasks.aria_drop"),children:s.jsx(vn,{size:13})})]}):s.jsxs(se,{size:"sm",variant:"secondary",className:"flex-1",loading:b,onClick:()=>N(()=>Wn.reopen(e,d.id)),children:[s.jsx(ui,{size:13}),u("project.tasks.reopen")]})})]})}function g7({pid:e}){const[t,a]=x.useState("open"),[o,l]=$o(),c=o.get("task"),d=Ze(),p=q_({key:`/projects/${e}/tasks?state=${t}`,fetchPage:(E,R)=>Wn.listPage(e,{state:t,limit:E,offset:R}),resetKey:t,swr:{dedupingInterval:0,revalidateOnFocus:!0}}),[m,g]=x.useState(""),[h,b]=x.useState(""),[_,j]=x.useState(!1),[N,y]=x.useState(!1),w=E=>{const R=new URLSearchParams(o);E?R.set("task",E):R.delete("task"),l(R,{replace:!0})},S=async()=>{if(m.trim()){y(!0);try{await Wn.add(e,{title:m.trim(),body:h.trim()||null,source:"web"}),g(""),b(""),j(!1),d.success(u("project.tasks.created")),p.mutate()}catch(E){d.error(E?.message||u("project.tasks.create_error"))}finally{y(!1)}}},k=async(E,R)=>{try{await E(),d.success(R),p.mutate()}catch(A){d.error(A?.message||u("common.error_generic"))}};return s.jsxs(Ye,{fullHeight:!0,title:u("project.tasks.title"),description:u("project.tasks.subtitle"),action:s.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(E=>s.jsx(se,{size:"sm","data-testid":`task-filter-${E}`,variant:t===E?"primary":"ghost",onClick:()=>a(E),children:u(`tasks.state_${E}`)},E))}),children:[s.jsxs("div",{className:"mb-4 shrink-0 space-y-2",children:[s.jsxs("div",{className:"flex items-end gap-2",children:[s.jsx(ae,{label:u("project.tasks.add_label"),children:s.jsx(Ne,{"data-testid":"task-input",placeholder:u("project.tasks.add_placeholder"),value:m,onChange:E=>g(E.target.value),onKeyDown:E=>{E.key==="Enter"&&!_&&S()}})}),s.jsxs(se,{variant:"ghost",size:"sm",onClick:()=>j(E=>!E),"aria-label":u("tasks.toggle_prompt"),children:[_?s.jsx(db,{size:14}):s.jsx(ms,{size:14})," ",u("tasks.field_prompt")]}),s.jsxs(se,{variant:"primary","data-testid":"task-add",onClick:S,loading:N,children:[s.jsx(It,{size:14})," ",u("project.tasks.add")]})]}),_&&s.jsx(on,{rows:3,value:h,onChange:E=>b(E.target.value),placeholder:u("tasks.prompt_ph"),className:"text-xs"})]}),s.jsxs("div",{className:"flex min-h-0 flex-1 gap-4",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[p.isLoading&&s.jsx(rt,{}),!p.isLoading&&p.total===0&&s.jsxs(pt,{children:[t==="open"?u("project.tasks.empty_open"):u("project.tasks.empty",{state:t})," ",s.jsx("code",{children:'apx task add "…"'})]}),s.jsx(V_,{paged:p,fullHeight:!0,children:s.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:p.items.map(E=>{const R=Pf(E);return s.jsxs("li",{"data-testid":`task-${E.id}`,onClick:()=>w(E.id),className:`flex cursor-pointer items-start gap-3 rounded-md border px-3 py-2 hover:border-muted-fg/50 ${c===E.id?"border-primary/50 bg-primary/5":"border-border bg-muted/30"}`,children:[s.jsx(Lf,{status:R,className:"mt-0.5 shrink-0"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"truncate font-medium",children:E.title}),s.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[E.state==="open"&&s.jsx(B_,{status:R}),E.tags?.map(A=>s.jsxs(He,{children:["#",A]},A)),E.agent&&s.jsxs(He,{tone:"info",children:["@",E.agent]}),E.due&&s.jsxs("span",{children:[u("project.tasks.due")," ",E.due]})]})]}),s.jsx("div",{className:"flex shrink-0 gap-1",onClick:A=>A.stopPropagation(),children:E.state==="open"?s.jsxs(s.Fragment,{children:[s.jsx(se,{size:"sm",variant:"secondary","aria-label":u("project.tasks.aria_done"),"data-testid":`task-done-${E.id}`,onClick:()=>k(()=>Wn.done(e,E.id),u("project.tasks.done")),children:s.jsx(Hr,{size:13})}),s.jsx(se,{size:"sm",variant:"destructive","aria-label":u("project.tasks.aria_drop"),"data-testid":`task-drop-${E.id}`,onClick:()=>k(()=>Wn.drop(e,E.id),u("project.tasks.drop")),children:s.jsx(vn,{size:13})})]}):s.jsx(se,{size:"sm",variant:"ghost","aria-label":u("project.tasks.aria_reopen"),"data-testid":`task-reopen-${E.id}`,onClick:()=>k(()=>Wn.reopen(e,E.id),u("project.tasks.reopen")),children:s.jsx(ui,{size:13})})})]},E.id)})})})]}),c&&s.jsx(m7,{pid:e,taskId:c,onClose:()=>w(null),onChanged:()=>p.mutate()})]})]})}const h7="\\$\\{var\\.([^}\\s]+)\\}";function EE(e="g"){return new RegExp(h7,e)}function RE(e){return EE("").test(e)}function x7(e){const t=[];let a=0;for(const o of e.matchAll(EE("g"))){const l=o.index??0;l>a&&t.push({type:"text",value:e.slice(a,l)}),t.push({type:"var",value:o[1]}),a=l+o[0].length}return a<e.length&&t.push({type:"text",value:e.slice(a)}),t}function Rh(e){let t="";for(const a of Array.from(e.childNodes))if(a.nodeType===Node.TEXT_NODE)t+=a.textContent??"";else if(a instanceof HTMLElement){const o=a.dataset.varName;o?t+=`\${var.${o}}`:a.tagName==="BR"?t+="":t+=a.textContent??""}return t.replace(/[\u200B-\u200F\u202A-\u202E\u2060\uFEFF]/g,"").replace(/\u00A0/g," ")}function Qw(e,t){e.replaceChildren();const a=x7(t);for(const o of a)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(TE(o.value));(a.length===0||a[a.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function TE(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 b7(e,t){e.deleteContents(),e.insertNode(t),e.setStartAfter(t),e.collapse(!0);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(e)}function _7(e){const t=document.createRange();t.selectNodeContents(e),t.collapse(!1);const a=window.getSelection();a?.removeAllRanges(),a?.addRange(t)}const Q_=x.forwardRef(function({value:t,onChange:a,placeholder:o,className:l,varNames:c=[],onCreateVar:d},p){const m=x.useRef(null),g=x.useRef(null),h=x.useRef(null),[b,_]=x.useState(!1),[j,N]=x.useState(""),y=x.useRef(t);x.useEffect(()=>{const T=m.current;T&&(t===y.current&&T.childNodes.length>0||(Qw(T,t),y.current=t))},[t]);const w=x.useCallback(()=>{const T=m.current;if(!T)return;const z=Rh(T);y.current=z,z!==t&&a(z)},[a,t]),S=x.useCallback(()=>{const T=m.current;if(!T)return;const z=Rh(T);if(RE(z)&&y7(T)){const O=j7(T);Qw(T,z),O!=null&&w7(T,O)}y.current=Rh(T),y.current!==t&&a(y.current)},[a,t]),k=x.useCallback(()=>{const T=window.getSelection();if(!T||T.rangeCount===0)return;const z=T.getRangeAt(0),O=m.current;O&&O.contains(z.startContainer)&&(h.current=z.cloneRange())},[]),E=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 O=z.getRangeAt(0);if(!O.collapsed)return;const{startContainer:B,startOffset:P}=O;if(B.nodeType===Node.TEXT_NODE&&P===0){const U=B.previousSibling;if(U instanceof HTMLElement&&U.dataset.varName){T.preventDefault(),U.remove(),w();return}}else if(B===m.current){const U=B.childNodes[P-1];if(U instanceof HTMLElement&&U.dataset.varName){T.preventDefault(),U.remove(),w();return}}}},[w]),R=x.useCallback(T=>{const z=m.current;if(!z)return;const O=h.current;z.focus();let B;O&&z.contains(O.startContainer)?B=O:(B=document.createRange(),B.selectNodeContents(z),B.collapse(!1)),b7(B,TE(T)),h.current=null,w()},[w]);x.useImperativeHandle(p,()=>({insertVar:R,focus:()=>m.current?.focus()}),[R]);const A=c.filter(T=>T.toLowerCase().includes(j.toLowerCase()));return s.jsxs("div",{className:he("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:[s.jsxs("div",{className:"relative flex-1 min-w-0",children:[s.jsx("div",{ref:m,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:S,onKeyDown:E,onBlur:w,onFocus:k,onMouseUp:k,onKeyUp:k,className:he("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&&s.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})]}),s.jsxs("div",{ref:g,className:"relative flex",children:[s.jsx($e,{content:u("chat_ui.insert_variable"),children:s.jsx("button",{type:"button",onMouseDown:T=>{T.preventDefault(),k()},onClick:()=>_(T=>!T),"aria-label":u("chat_ui.insert_variable"),className:he("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:s.jsx(It,{size:14})})}),b&&s.jsx(v7,{anchorRef:g,query:j,onQuery:N,varNames:A,onPick:T=>{R(T),_(!1),N("")},onClose:()=>{_(!1),N("")},onCreateVar:d})]})]})});function v7({anchorRef:e,query:t,onQuery:a,varNames:o,onPick:l,onClose:c,onCreateVar:d}){const p=x.useRef(null),m=x.useRef(null),[g,h]=x.useState(null),b=x.useCallback(()=>{const _=e.current;if(!_)return;const j=_.getBoundingClientRect(),N=256,y=4,w=8,S=window.innerWidth-N-w,k=Math.max(w,Math.min(j.right-N,S)),E=j.bottom+y,R=p.current?.offsetHeight??260,A=E+R<=window.innerHeight-w?E:Math.max(w,j.top-R-y);h({left:k,top:A,width:N})},[e]);return x.useLayoutEffect(()=>{b()},[b,t,o.length]),x.useEffect(()=>(b(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}),[b]),x.useEffect(()=>{m.current?.focus({preventScroll:!0})},[]),x.useEffect(()=>{function _(j){const N=j.target;p.current?.contains(N)||e.current?.contains(N)||c()}return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[e,c]),g?qs.createPortal(s.jsxs("div",{ref:p,style:g,className:"fixed z-[1000] rounded-md border border-border bg-popover shadow-lg",children:[s.jsx("div",{className:"border-b border-border p-2",children:s.jsx("input",{ref:m,value:t,onChange:_=>a(_.target.value),placeholder:u("shared_ui.search_variable_ph"),className:"w-full rounded bg-muted/40 px-2 py-1 text-xs font-mono outline-none"})}),s.jsxs("ul",{className:"max-h-44 overflow-auto p-1 text-xs",children:[o.length===0&&s.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:u("shared_ui.no_matches")}),o.map(_=>s.jsx("li",{children:s.jsx("button",{type:"button",onMouseDown:j=>j.preventDefault(),onClick:()=>l(_),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:_})},_))]}),d&&s.jsx("div",{className:"border-t border-border p-1",children:s.jsxs("button",{type:"button",onMouseDown:_=>_.preventDefault(),onClick:()=>{d(),c()},className:"flex w-full items-center gap-1 rounded px-2 py-1.5 text-left text-xs hover:bg-muted/60",children:[s.jsx(It,{size:12})," ",u("shared_ui.create_variable")]})})]}),document.body):null}function y7(e){for(const t of Array.from(e.childNodes))if(t.nodeType===Node.TEXT_NODE&&RE(t.textContent??""))return!0;return!1}function j7(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const a=t.getRangeAt(0);if(!e.contains(a.startContainer))return null;const o=a.cloneRange();return o.selectNodeContents(e),o.setEnd(a.startContainer,a.startOffset),o.toString().length}function w7(e,t){const a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=t,l=a.nextNode();for(;l;){const c=(l.textContent??"").length;if(o<=c){const d=document.createRange();d.setStart(l,o),d.collapse(!0);const p=window.getSelection();p?.removeAllRanges(),p?.addRange(d);return}o-=c,l=a.nextNode()}_7(e)}function Ww(e){return e?Object.entries(e).map(([t,a])=>({key:t,value:String(a)})):[]}function Zw(e){const t={};for(const a of e)a.key.trim()&&(t[a.key.trim()]=a.value);return t}function Jw({rows:e,onChange:t,keyPlaceholder:a=u("shared_ui.kv_key_ph"),valuePlaceholder:o=u("shared_ui.kv_value_ph"),varNames:l,onCreateVar:c,emptyLabel:d}){const p=(h,b)=>{const _=e.slice();_[h]={..._[h],...b},t(_)},m=h=>t(e.filter((b,_)=>_!==h)),g=()=>t([...e,{key:"",value:""}]);return s.jsxs("div",{className:"space-y-2",children:[e.length===0&&d&&s.jsx("p",{className:"text-[11px] text-muted-foreground",children:d}),e.map((h,b)=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(Ne,{value:h.key,onChange:_=>p(b,{key:_.target.value}),placeholder:a,className:"w-40 font-mono text-xs"}),s.jsx("div",{className:"flex-1",children:s.jsx(Q_,{value:h.value,onChange:_=>p(b,{value:_}),placeholder:o,varNames:l,onCreateVar:c})}),s.jsx(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(b),"aria-label":u("shared_ui.remove_row"),children:s.jsx(vn,{size:13})})]},b)),s.jsxs(se,{type:"button",size:"sm",variant:"ghost",onClick:g,children:[s.jsx(It,{size:12})," ",u("shared_ui.add_row")]})]})}function k7(e){const t=e.raw||{};if(typeof t.description=="string"&&t.description.trim())return t.description.trim();if(e.transport==="http"&&e.url)return e.url.length>64?e.url.slice(0,61)+"…":e.url;const a=[e.command,...e.args||[]].filter(Boolean).join(" ");return a?"$ "+(a.length>64?a.slice(0,61)+"…":a):""}function S7(e,t){return t?.busy?"bg-amber-400 animate-pulse":t?.ok===!1?"bg-red-400":t?.ok?"bg-emerald-400":e?"bg-emerald-500/70":"bg-slate-500"}const C7={apc:"info",runtime:"success",global:"muted"};function Kx(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function Th(e){return e==="runtime"?u("project.mcps.source_runtime"):e==="apc"?u("project.mcps.source_apc"):e==="claude"?u("project.mcps.source_claude"):e==="codex"?u("project.mcps.source_codex"):e==="cursor"?u("project.mcps.source_cursor"):e==="vscode"?u("project.mcps.source_vscode"):e==="roo"?u("project.mcps.source_roo"):e==="gemini"?u("project.mcps.source_gemini"):e==="global"?u("project.mcps.scope_global"):e}function N7({pid:e}){const t=Ze(),a=qe(`/projects/${e}/mcps`,()=>Dr.list(e)),o=qe(`/projects/${e}/mcps/check`,()=>Dr.check(e)),l=qe(`/projects/${e}/vars`,()=>Fc.list(e)),[c,d]=x.useState(null),[p,m]=x.useState(null),[g,h]=x.useState({}),[b,_]=x.useState({}),j=x.useMemo(()=>l.data?Object.keys(l.data.effective).sort():[],[l.data]),N=async(S,k)=>{if(confirm(u("project.mcps.delete_confirm",{name:S,scope:k})))try{await Dr.remove(e,S,k),t.success(u("project.mcps.removed")),a.mutate(),p===S&&m(null)}catch(E){t.error(E?.message||u("common.error_generic"))}},y=async S=>{try{await Dr.add(e,Kx(S.source),{name:S.name,enabled:!S.enabled}),a.mutate()}catch(k){t.error(k?.message||u("common.error_generic"))}},w=async S=>{m(S),h(k=>({...k,[S]:{busy:!0}})),_(k=>({...k,[S]:!0}));try{const k=await Dr.test(e,S);h(E=>({...E,[S]:{ok:k.ok,error:k.error,tools:k.tools}}))}catch(k){h(E=>({...E,[S]:{ok:!1,error:k?.message||"error"}}))}};return s.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[s.jsx("div",{className:"lg:col-span-3",children:s.jsxs(Ye,{title:u("project.mcps.title"),description:u("project.mcps.subtitle"),action:s.jsxs(se,{size:"sm",variant:"primary",onClick:()=>d({kind:"new"}),children:[s.jsx(It,{size:14})," ",u("project.mcps.new")]}),children:[o.data?.conflicts?.length?s.jsxs("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:[s.jsx("div",{className:"font-medium",children:u("project.mcps.conflicts",{names:o.data.conflicts.map(S=>S.name).join(", ")})}),s.jsx("ul",{className:"mt-1 space-y-1 text-muted-fg",children:o.data.conflicts.map(S=>s.jsxs("li",{className:"flex gap-2",children:[s.jsx("span",{"aria-hidden":"true",children:"•"}),s.jsx("span",{children:u("project.mcps.conflict_detail",{name:S.name,winner:Th(S.winner),loser:Th(S.loser)})})]},`${S.name}-${S.winner}-${S.loser}`))})]}):null,a.isLoading&&s.jsx(rt,{}),!a.isLoading&&(a.data?.length??0)===0&&s.jsx(pt,{children:u("project.mcps.empty")}),s.jsx("ul",{className:"space-y-2 text-sm",children:(a.data||[]).map(S=>{const k=S.source==="apc"||S.source==="runtime"||S.source==="global",E=Kx(S.source),R=p===S.name,A=S.enabled!==!1,T=g[S.name],z=T?.tools||[],O=!!b[S.name],B=k7(S),P=S.transport==="http"?GS:a3;return s.jsx("li",{className:"rounded-md border px-3 py-2 transition-colors "+(R?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>m(S.name),role:"button",children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsxs("div",{className:"relative mt-0.5 flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg border border-border bg-background",children:[s.jsx(P,{size:16,className:"text-muted-fg"}),s.jsx("span",{className:he("absolute -bottom-0.5 -right-0.5 h-2.5 w-2.5 rounded-full border-2 border-card",S7(A,T))})]}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("span",{className:"font-medium",children:S.name}),s.jsx(He,{tone:C7[S.source]??"muted",children:Th(S.source)}),s.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(S.transport||"stdio").toUpperCase()}),s.jsx("div",{onClick:U=>U.stopPropagation(),children:s.jsx(Bt,{checked:A,onChange:()=>y(S),label:""})}),s.jsx($e,{content:u("project.mcps.test_btn"),children:s.jsx(se,{size:"sm",variant:"ghost",onClick:U=>{U.stopPropagation(),w(S.name)},"aria-label":u("project.mcps.test_btn"),children:T?.busy?s.jsx(mx,{size:13,className:"animate-pulse"}):s.jsx(mx,{size:13})})}),s.jsx($e,{content:u("project.mcps.logs_btn"),children:s.jsx(se,{size:"sm",variant:"ghost",onClick:U=>{U.stopPropagation(),m(S.name)},"aria-label":u("project.mcps.logs_btn"),children:s.jsx(jb,{size:13})})}),k&&s.jsx($e,{content:u("project.mcps.edit_btn"),children:s.jsx(se,{size:"sm",variant:"ghost",onClick:U=>{U.stopPropagation(),d({kind:"edit",entry:S})},"aria-label":u("project.mcps.edit_btn"),children:s.jsx(ya,{size:13})})}),k&&s.jsx(se,{size:"sm",variant:"destructive",onClick:U=>{U.stopPropagation(),N(S.name,E)},children:s.jsx(vn,{size:13})})]}),B&&s.jsx("p",{className:"mt-0.5 truncate font-mono text-xs text-muted-fg",children:B}),T?.ok===!1&&T.error&&s.jsxs("p",{className:"mt-1 flex items-start gap-1 text-xs text-red-400",children:[s.jsx(IS,{size:12,className:"mt-0.5 flex-shrink-0"})," ",s.jsx("span",{className:"break-words",children:T.error})]}),z.length>0&&s.jsxs("div",{className:"mt-1.5",onClick:U=>U.stopPropagation(),children:[s.jsxs("button",{type:"button",onClick:()=>_(U=>({...U,[S.name]:!U[S.name]})),className:"flex items-center gap-1 text-xs text-muted-fg transition-colors hover:text-fg",children:[s.jsx(ta,{size:12})," ",u("project.mcps.tools_count",{n:z.length}),s.jsx(ms,{size:12,className:he("transition-transform",O&&"rotate-180")})]}),O&&s.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[z.slice(0,40).map(U=>s.jsx($e,{content:U.description||"—",children:s.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-background px-1.5 py-0.5 font-mono text-[10px] text-muted-fg",children:[s.jsx(ba,{size:10})," ",U.name]})},U.name)),z.length>40&&s.jsxs("span",{className:"text-[10px] text-muted-fg",children:["… +",z.length-40]})]})]})]})]})},`${S.source}-${S.name}`)})}),c&&s.jsx(R7,{mode:c,pid:e,varNames:j,onClose:()=>d(null),onSaved:()=>{d(null),a.mutate()},onVarsChanged:()=>l.mutate()})]})}),s.jsx("div",{className:"lg:col-span-1",children:s.jsx(E7,{pid:e,mcpName:p,runningTest:!!(p&&g[p]?.busy)})})]})}function E7({pid:e,mcpName:t,runningTest:a}){const[o,l]=x.useState(null),[c,d]=x.useState(null),p=x.useRef(null);x.useEffect(()=>{if(!t){l(null),d(null);return}p.current!==t&&(l(null),d(null),p.current=t);let g=!1;const h=async()=>{try{const j=await Dr.logs(e,t);g||(l(j),d(null))}catch(j){g||d(j?.message||"error")}};h();const _=setInterval(h,a?1200:4e3);return()=>{g=!0,clearInterval(_)}},[e,t,a]);const m=x.useRef(null);return x.useEffect(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[o?.events?.length,o?.stderr_tail]),s.jsxs("div",{className:"sticky top-3 flex h-[calc(100vh-7rem)] min-h-[24rem] flex-col rounded-xl border border-border bg-card",children:[s.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs",children:[s.jsx(ba,{size:13,className:"text-muted-fg"}),s.jsx("span",{className:"font-medium",children:u("project.mcps.logs_panel_title")}),t?s.jsx(He,{tone:"info",children:t}):s.jsxs("span",{className:"text-muted-fg",children:["— ",u("project.mcps.logs_panel_pick")]})]}),s.jsxs("div",{ref:m,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!t&&s.jsx("p",{className:"text-muted-fg",children:u("project.mcps.logs_panel_hint")}),t&&c&&s.jsx("p",{className:"text-red-400",children:c}),t&&!c&&o&&s.jsxs(s.Fragment,{children:[s.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&&s.jsx("p",{className:"text-muted-fg",children:o.note}),(!o.events||o.events.length===0)&&!o.stderr_tail&&!o.note&&s.jsx("p",{className:"text-muted-fg",children:u("project.mcps.logs_panel_idle")}),o.events?.map((g,h)=>s.jsxs("div",{className:"flex gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:g.ts.slice(11,19)}),s.jsx("span",{className:g.level==="error"?"text-red-400":g.level==="stderr"?"text-amber-400":"text-emerald-400",children:g.level}),s.jsx("span",{className:"flex-1 break-all",children:g.msg})]},h)),o.stderr_tail&&s.jsxs("div",{className:"mt-2 border-t border-border/60 pt-2",children:[s.jsx("div",{className:"mb-1 text-muted-fg",children:"stderr"}),s.jsx("pre",{className:"whitespace-pre-wrap break-all text-amber-300/80",children:o.stderr_tail})]})]})]})]})}function R7({mode:e,pid:t,varNames:a,onClose:o,onSaved:l,onVarsChanged:c}){const d=Ze(),p=e.kind==="edit",m=p?e.entry:null,[g,h]=x.useState(!1),[b,_]=x.useState(m?Kx(m.source):"runtime"),[j,N]=x.useState(m?.name||""),[y,w]=x.useState(m?.transport==="http"||m?.url?"http":"stdio"),[S,k]=x.useState(m?.command||""),[E,R]=x.useState(m?.args&&m.args.length?m.args:[""]),[A,T]=x.useState(Ww(m?.env)),[z,O]=x.useState(m?.url||""),[B,P]=x.useState(Ww(m?.headers)),[U,D]=x.useState(m?.enabled!==!1),[L,V]=x.useState(!1),H=async()=>{if(!j.trim()){d.error(u("project.mcps.name_required"));return}h(!0);try{const $=E.map(Y=>Y.trim()).filter(Boolean),F=y==="stdio"?{name:j.trim(),command:S.trim(),args:$.length?$:void 0,env:A.length?Zw(A):void 0,enabled:U}:{name:j.trim(),url:z.trim(),headers:B.length?Zw(B):void 0,enabled:U};await Dr.add(t,b,F),d.success(u(p?"project.mcps.updated":"project.mcps.added")),l()}catch($){d.error($?.message||u("common.error_generic"))}finally{h(!1)}};return s.jsxs(s.Fragment,{children:[s.jsx(Zt,{open:!0,onClose:()=>g?null:o(),title:u(p?"project.mcps.edit_title":"project.mcps.new_title"),description:p?m?.name:u("project.mcps.new_desc"),size:"lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:o,disabled:g,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:H,loading:g,children:u(p?"project.mcps.save_btn":"project.mcps.add_btn")})]}),children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("project.mcps.scope_label"),children:s.jsx(ut,{value:b,onChange:$=>_($),options:[{value:"runtime",label:u("project.mcps.scope_runtime"),description:u("project.mcps.scope_runtime_desc")},{value:"shared",label:u("project.mcps.scope_shared"),description:u("project.mcps.scope_shared_desc")},{value:"global",label:u("project.mcps.scope_global"),description:u("project.mcps.scope_global_desc")}]})}),s.jsx(ae,{label:u("project.mcps.transport_label"),children:s.jsx(ut,{value:y,onChange:$=>w($),options:[{value:"stdio",label:u("project.mcps.transport_stdio"),description:u("project.mcps.transport_stdio_desc")},{value:"http",label:u("project.mcps.transport_http"),description:u("project.mcps.transport_http_desc")}]})})]}),s.jsx(ae,{label:u("project.mcps.name_label"),children:s.jsx(Ne,{value:j,onChange:$=>N($.target.value),placeholder:u("project.mcps.name_ph"),disabled:p})}),y==="stdio"?s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("project.mcps.cmd_label"),children:s.jsx(Ne,{value:S,onChange:$=>k($.target.value),placeholder:u("project.mcps.cmd_ph")})}),s.jsx(ae,{label:u("project.mcps.args_label"),hint:u("project.mcps.args_hint_tokens"),children:s.jsx(T7,{args:E,onChange:R,varNames:a,onCreateVar:()=>V(!0)})}),s.jsx(ae,{label:u("project.mcps.env_label"),hint:u("project.mcps.env_hint_tokens"),children:s.jsx(Jw,{rows:A,onChange:T,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:a,onCreateVar:()=>V(!0),emptyLabel:u("project.mcps.env_empty")})})]}):s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("project.mcps.url_label"),children:s.jsx(Q_,{value:z,onChange:O,placeholder:u("project.mcps.url_ph"),varNames:a,onCreateVar:()=>V(!0)})}),s.jsx(ae,{label:u("project.mcps.headers_label"),hint:u("project.mcps.headers_hint"),children:s.jsx(Jw,{rows:B,onChange:P,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:a,onCreateVar:()=>V(!0),emptyLabel:u("project.mcps.headers_empty")})})]}),s.jsx(Bt,{checked:U,onChange:D,label:u("project.mcps.enabled_label")})]})}),L&&s.jsx(A7,{pid:t,onClose:()=>V(!1),onCreated:()=>{V(!1),c()}})]})}function T7({args:e,onChange:t,varNames:a,onCreateVar:o}){const l=(p,m)=>{const g=e.slice();g[p]=m,t(g)},c=p=>t(e.filter((m,g)=>g!==p)),d=()=>t([...e,""]);return s.jsxs("div",{className:"space-y-2",children:[e.map((p,m)=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx(Q_,{value:p,onChange:g=>l(m,g),placeholder:u("agents_ui.arg_placeholder"),varNames:a,onCreateVar:o})}),s.jsx(se,{type:"button",size:"sm",variant:"ghost",onClick:()=>c(m),"aria-label":u("agents_ui.remove_arg"),children:s.jsx(vn,{size:13})})]},m)),s.jsxs(se,{type:"button",size:"sm",variant:"ghost",onClick:d,children:[s.jsx(It,{size:12})," ",u("project.mcps.add_arg")]})]})}function A7({pid:e,onClose:t,onCreated:a}){const o=Ze(),l=String(e)==="0",[c,d]=x.useState(""),[p,m]=x.useState(""),[g,h]=x.useState(!1),[b,_]=x.useState(l?"global":"project"),j=async()=>{if(!c.trim()){o.error(u("project.vars.name_required"));return}if(!p){o.error(u("project.vars.value_required"));return}h(!0);try{await Fc.upsert(e,{name:c.trim(),value:p,scope:b}),o.success(u("project.vars.added")),a()}catch(N){o.error(N?.message||u("common.error_generic"))}finally{h(!1)}};return s.jsx(Zt,{open:!0,onClose:()=>g?null:t(),title:u("project.vars.new_title"),description:u("project.vars.new_desc"),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:g,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:j,loading:g,children:u("project.vars.add_btn")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("project.vars.scope_label"),children:s.jsx(ut,{value:b,onChange:N=>_(N),options:[...l?[]:[{value:"project",label:u("project.vars.scope_project"),description:u("project.vars.scope_project_desc")}],{value:"global",label:u("project.vars.scope_global"),description:u("project.vars.scope_global_desc")}]})}),s.jsx(ae,{label:u("project.vars.name_label"),hint:u("project.vars.name_hint"),children:s.jsx(Ne,{value:c,onChange:N=>d(N.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),s.jsx(ae,{label:u("project.vars.value_label"),hint:u("project.vars.value_hint"),children:s.jsx(Ne,{type:"password",value:p,onChange:N=>m(N.target.value),className:"font-mono text-xs"})})]})})}function AE({icon:e,title:t,description:a,badges:o,rightContent:l,hasTools:c,expanded:d,onToggle:p,children:m}){return s.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:[s.jsxs("button",{type:"button",className:"flex w-full items-center gap-4 p-4 text-left transition-colors hover:bg-muted/40",onClick:p,children:[e,s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("p",{className:"text-sm font-semibold text-foreground",children:t}),o,c&&s.jsx($e,{content:"Esta integración expone tools para los agentes",children:s.jsx("span",{children:s.jsx(ta,{className:"h-3 w-3 text-muted-foreground"})})})]}),s.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:a})]}),s.jsxs("div",{className:"flex flex-shrink-0 items-center gap-2",children:[l,s.jsx(Fr,{className:he("h-4 w-4 text-muted-foreground transition-transform",d&&"rotate-90")})]})]}),d&&m&&s.jsx("div",{className:"border-t border-border",children:m})]})}function M7({tools:e,isActive:t}){return t?s.jsxs("div",{className:"space-y-2.5 rounded-xl border border-border bg-muted/30 p-3",children:[s.jsx("div",{className:"flex items-center justify-between",children:s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("integrations.tools_for_agents")})}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(a=>s.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg border border-border bg-background px-2 py-1",children:[s.jsx(ta,{className:"h-2.5 w-2.5 flex-shrink-0 text-muted-foreground"}),s.jsx("span",{className:"font-mono text-[10px] text-foreground",children:a.slug}),s.jsx("span",{className:"text-[10px] text-muted-foreground/60",children:"·"}),s.jsx("span",{className:"text-[10px] text-muted-foreground",children:a.desc})]},a.slug))}),s.jsx("p",{className:"text-[10px] text-muted-foreground/70",children:u("integrations.tools_available_note")})]}):null}const _c=(e,t)=>u(e,t);function O7({className:e}){return s.jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"currentColor",children:s.jsx("path",{d:"M18.833 9.637a4.167 4.167 0 1 1 0 8.333 4.167 4.167 0 0 1 0-8.333zm-13.666 0a4.167 4.167 0 1 1 0 8.333 4.167 4.167 0 0 1 0-8.333zM12 2a4.167 4.167 0 1 1 0 8.333A4.167 4.167 0 0 1 12 2z"})})}const ek={rose:{text:"text-rose-400",border:"border-rose-700/50",hover:"hover:bg-rose-900/20",ring:"focus:border-rose-500/50",wrap:"border-rose-500/30 from-rose-500/20 to-pink-500/20"},slate:{text:"text-slate-200",border:"border-slate-600/60",hover:"hover:bg-slate-700/30",ring:"focus:border-slate-400/60",wrap:"border-slate-500/30 from-slate-500/20 to-slate-700/20"}};function z7(e,t){return e==="github"?s.jsx(FS,{className:he("h-6 w-6",t.text)}):e==="asana"?s.jsx(O7,{className:he("h-6 w-6",t.text)}):s.jsx("span",{className:he("text-lg",t.text),children:"◆"})}function D7({pid:e,scope:t,entry:a}){const o=a.ui,l=ek[o.accent||"rose"]||ek.rose,[c,d]=x.useState(!1),[p,m]=x.useState({}),[g,h]=x.useState({}),[b,_]=x.useState(null),[j,N]=x.useState("idle"),[y,w]=x.useState(null),[S,k]=x.useState([]),[E,R]=x.useState(""),{data:A,mutate:T,isLoading:z}=qe(`integration-status-${a.slug}-${e}-${t}`,()=>Is.status(e,a.slug,t),{shouldRetryOnError:!1}),O=A?.status==="active"&&A.is_enabled===!0,B=j==="saving"||j==="validating",P=!O&&S.length===0;async function U(){if(!o.configFields.some(H=>!p[H.key]?.trim())){N("saving"),w(null);try{await Is.configure(e,a.slug,t,{...p}),N("validating");const H=await Is.validate(e,a.slug,t);if(await T(),o.select&&!H[o.select.key]){const F=(await Is.action(e,a.slug,o.select.action,t))[o.select.listKey]||[];F.length>1&&k(F.map(Y=>({value:String(Y[o.select.valueKey]),label:String(Y[o.select.labelKey])})))}N("done"),m({})}catch(H){w(H instanceof Error?H.message:u("integrations.err_connect")),N("idle")}}}async function D(){if(!(!E||!o.select)){N("saving"),w(null);try{await Is.configure(e,a.slug,t,{[o.select.key]:E}),await Is.validate(e,a.slug,t),await T(),k([]),N("done")}catch(H){w(H instanceof Error?H.message:u("integrations.err_generic")),N("idle")}}}async function L(){w(null);try{await Is.deactivate(e,a.slug,t),await T()}catch(H){w(H instanceof Error?H.message:u("integrations.err_generic"))}}const V=z?"…":O?u("integrations.status_active"):A?.status==="error"?u("integrations.status_error"):u("integrations.status_unconfigured");return s.jsx(AE,{icon:s.jsx("div",{className:he("flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-2xl border bg-gradient-to-br",l.wrap),children:z7(a.slug,l)}),title:a.name,description:a.description,hasTools:(a.tools?.length??0)>0,badges:s.jsxs("span",{className:he("flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-[10px]",O?"border-emerald-700 bg-emerald-900/20 text-emerald-400":"border-border bg-muted text-muted-foreground"),children:[s.jsx("span",{className:he("h-1.5 w-1.5 rounded-full",O?"bg-emerald-400":"bg-muted-foreground")}),V]}),expanded:c,onToggle:()=>d(H=>!H),children:s.jsxs("div",{className:"space-y-4 p-4",children:[y&&s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-red-700/30 bg-red-900/20 px-3 py-2.5 text-xs text-red-300",children:[s.jsx(NM,{className:"h-3.5 w-3.5 flex-shrink-0"}),s.jsx("span",{className:"flex-1",children:y}),s.jsx("button",{onClick:()=>w(null),children:s.jsx(Ss,{className:"h-3.5 w-3.5"})})]}),O&&S.length===0&&s.jsxs("div",{className:"space-y-1 rounded-xl border border-emerald-700/30 bg-emerald-900/10 p-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(fb,{className:"h-3.5 w-3.5 text-emerald-400"}),s.jsx("span",{className:"text-xs font-medium text-emerald-300",children:u("integrations.connected")})]}),(o.connectedFields||[]).map(H=>{const $=A?.[H];return $?s.jsxs("p",{className:"pl-5 text-[10px] text-muted-foreground",children:[_c(`integrations.${a.slug}.connected.${H}`),": ",String($)]},H):null})]}),S.length>1&&o.select&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[_c(`integrations.${a.slug}.select_label`),":"]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("select",{value:E,onChange:H=>R(H.target.value),className:he("flex-1 rounded-lg border border-border bg-background px-2 py-1.5 text-xs outline-none",l.ring),children:[s.jsx("option",{value:"",children:u("integrations.select_placeholder")}),S.map(H=>s.jsx("option",{value:H.value,children:H.label},H.value))]}),s.jsx("button",{onClick:D,disabled:!E||B,className:he("rounded-lg border px-3 py-1.5 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",l.border,l.text,l.hover),children:B?s.jsx(Ir,{className:"h-3.5 w-3.5 animate-spin"}):u("integrations.confirm")})]})]}),P&&s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-xs font-semibold text-foreground",children:u("integrations.credentials",{name:a.name})}),o.configFields.map(H=>s.jsxs("div",{className:"space-y-2",children:[H.help_url&&s.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[s.jsxs("button",{type:"button",onClick:()=>_($=>$===H.key?null:H.key),className:"flex w-full items-center justify-between px-3 py-2 text-left transition-colors hover:bg-muted/40",children:[s.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[_c(`integrations.${a.slug}.fields.${H.key}.help_label`)," ·"," ",s.jsxs("a",{href:H.help_url,target:"_blank",rel:"noreferrer",onClick:$=>$.stopPropagation(),className:he("inline-flex items-center gap-0.5 hover:underline",l.text),children:[H.help_url_label," ",s.jsx(mb,{className:"h-2.5 w-2.5"})]})]}),s.jsx(ms,{className:he("h-3.5 w-3.5 flex-shrink-0 text-muted-foreground transition-transform",b===H.key&&"rotate-180")})]}),b===H.key&&s.jsx("div",{className:"space-y-1.5 border-t border-border px-3 pb-3 pt-2.5",children:_c(`integrations.${a.slug}.fields.${H.key}.help_steps`).split(`
|
|
774
|
+
`).map(($,F)=>s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("span",{className:he("mt-0.5 flex-shrink-0 font-mono text-[10px]",l.text),children:[F+1,"."]}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:$})]},F))})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-1 block text-[10px] text-muted-foreground",children:_c(`integrations.${a.slug}.fields.${H.key}.label`)}),s.jsxs("div",{className:"relative",children:[s.jsx("input",{type:H.type==="password"&&!g[H.key]?"password":"text",placeholder:H.placeholder,value:p[H.key]||"",onChange:$=>m(F=>({...F,[H.key]:$.target.value})),onKeyDown:$=>$.key==="Enter"&&U(),className:he("w-full rounded-lg border border-border bg-background px-3 py-2 font-mono text-xs outline-none placeholder:text-muted-foreground/60",H.type==="password"&&"pr-14",l.ring)}),H.type==="password"&&s.jsxs("button",{type:"button",onClick:()=>h($=>({...$,[H.key]:!$[H.key]})),className:"absolute right-2.5 top-1/2 flex -translate-y-1/2 items-center gap-0.5 text-[10px] text-muted-foreground transition-colors hover:text-foreground",children:[g[H.key]?s.jsx($S,{className:"h-3 w-3"}):s.jsx(eu,{className:"h-3 w-3"}),g[H.key]?u("integrations.hide"):u("integrations.reveal")]})]})]})]},H.key)),j==="validating"&&s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx(Ir,{className:"h-3.5 w-3.5 animate-spin"})," ",u("integrations.verifying")]}),s.jsx("button",{onClick:U,disabled:o.configFields.some(H=>!p[H.key]?.trim())||B,className:he("flex w-full items-center justify-center gap-1.5 rounded-lg border px-3 py-2 text-xs transition-all disabled:cursor-not-allowed disabled:opacity-50",l.border,l.text,l.hover),children:B?s.jsxs(s.Fragment,{children:[s.jsx(Ir,{className:"h-3.5 w-3.5 animate-spin"}),u(j==="saving"?"integrations.saving":"integrations.validating")]}):u("integrations.connect")})]}),a.tools&&a.tools.length>0&&s.jsx(M7,{pid:e,tools:a.tools,isActive:O}),O&&s.jsx("div",{className:"flex justify-end border-t border-border pt-2",children:s.jsxs("button",{onClick:L,className:"flex items-center gap-1.5 rounded-lg border border-red-700/50 px-3 py-1.5 text-xs text-red-400 transition-all hover:bg-red-900/20",children:[s.jsx(v3,{className:"h-3.5 w-3.5"})," ",u("integrations.deactivate")]})})]})})}const P7={github:{icon:FS,className:"text-slate-200",wrap:"border-slate-500/30 from-slate-500/20 to-slate-700/20"},whatsapp:{icon:n3,className:"text-[#25D366]",wrap:"border-[#25D366]/30 from-[#25D366]/20 to-[#128C7E]/20"},"local-transcription":{icon:_b,className:"text-orange-400",wrap:"border-orange-500/30 from-orange-500/20 to-amber-500/20"}};function L7({entry:e}){const[t,a]=x.useState(!1),o=P7[e.slug]||{icon:Qf,className:"text-muted-foreground",wrap:"border-border from-muted to-muted"},l=o.icon;return s.jsx(AE,{icon:s.jsx("div",{className:`flex h-12 w-12 flex-shrink-0 items-center justify-center rounded-2xl border bg-gradient-to-br ${o.wrap}`,children:s.jsx(l,{className:`h-6 w-6 ${o.className}`})}),title:e.name,description:e.description,badges:s.jsx("span",{className:"rounded-full border border-border bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:u("integrations.coming_soon")}),expanded:t,onToggle:()=>a(c=>!c),children:s.jsx("div",{className:"p-4 text-xs text-muted-foreground",children:u("integrations.coming_soon_body")})})}const I7=[{value:"plugins",labelKey:"integrations.tab_plugins",icon:Qf},{value:"tools",labelKey:"integrations.tab_tools",icon:ta}];function B7({pid:e,scope:t,entry:a}){return a.coming_soon||!a.ui?s.jsx(L7,{entry:a}):s.jsx(D7,{pid:e,scope:t,entry:a})}function U7({pid:e,scope:t}){const{data:a,isLoading:o}=qe(`integrations-catalog-${e}`,()=>Is.catalog(e));return s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:u("integrations.plugins_hint")}),o&&s.jsx(rt,{}),(a||[]).map(l=>s.jsx(B7,{pid:e,scope:t,entry:l},l.slug)),s.jsx("div",{className:"rounded-xl border border-dashed border-border p-6 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:u("integrations.more_soon")})})]})}function $7({pid:e}){const{data:t}=qe(`integrations-catalog-${e}`,()=>Is.catalog(e)),a=(t||[]).filter(o=>!o.coming_soon&&(o.tools?.length??0)>0).flatMap(o=>(o.tools||[]).map(l=>({...l,plugin:o.name,active:o.status.is_enabled})));return s.jsxs("div",{className:"space-y-3",children:[s.jsx("p",{className:"text-xs text-muted-foreground",children:u("integrations.tools_hint")}),a.length===0?s.jsx(pt,{children:u("integrations.tools_empty")}):s.jsx("ul",{className:"space-y-2",children:a.map(o=>s.jsxs("li",{className:he("rounded-md border border-border bg-muted/30 px-3 py-2",!o.active&&"opacity-55"),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ta,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.jsx("span",{className:"font-mono text-xs text-foreground",children:o.slug}),s.jsx("span",{className:"ml-auto text-[10px] text-muted-foreground",children:o.plugin}),s.jsx("span",{className:he("rounded border px-1.5 py-0.5 text-[10px]",o.active?"border-emerald-700/40 bg-emerald-900/20 text-emerald-400":"border-border bg-muted text-muted-foreground"),children:o.active?u("integrations.tool_active"):u("integrations.tool_inactive")})]}),s.jsx("p",{className:"mt-0.5 pl-5 text-[10px] text-muted-foreground",children:o.desc})]},o.slug))})]})}function H7({pid:e}){const t=String(e)==="0",[a,o]=x.useState("plugins"),[l,c]=x.useState(t?"global":"project");return s.jsxs(Ye,{title:u("integrations.title"),description:u("integrations.description"),children:[!t&&s.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:u("integrations.scope_label")}),["project","global"].map(d=>s.jsx("button",{onClick:()=>c(d),className:he("rounded-md border px-2.5 py-1 text-xs transition-colors",l===d?"border-primary/50 bg-primary/10 text-foreground":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/50"),children:u(d==="project"?"integrations.scope_project":"integrations.scope_global")},d))]}),s.jsx("div",{className:"mb-4 inline-flex rounded-lg border border-border bg-muted/30 p-0.5",children:I7.map(d=>{const p=d.icon;return s.jsxs("button",{onClick:()=>o(d.value),className:he("flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs transition-colors",a===d.value?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[s.jsx(p,{className:"h-3.5 w-3.5"})," ",u(d.labelKey)]},d.value)})}),a==="plugins"&&s.jsx(U7,{pid:e,scope:l}),a==="tools"&&s.jsx($7,{pid:e})]})}function q7({pid:e}){const t=Ze(),a=String(e)==="0",[o,l]=x.useState(a?"global":"all"),[c,d]=x.useState(!1),p=qe(`/projects/${e}/vars?reveal=${c?1:0}`,()=>Fc.list(e,{reveal:c})),[m,g]=x.useState(null),h=x.useMemo(()=>{if(!p.data)return[];const _=[],j=p.data.project||{},N=p.data.global||{};for(const[y,w]of Object.entries(j))_.push({name:y,scope:"project",masked:w});for(const[y,w]of Object.entries(N))j[y]===void 0&&_.push({name:y,scope:"global",masked:w});return _.filter(y=>o==="all"?!0:y.scope===o).sort((y,w)=>y.name.localeCompare(w.name))},[p.data,o]),b=async(_,j)=>{if(confirm(u("project.vars.delete_confirm",{name:_,scope:j})))try{await Fc.remove(e,_,j),t.success(u("project.vars.removed")),p.mutate()}catch(N){t.error(N?.message||u("common.error_generic"))}};return s.jsxs(Ye,{title:u("project.vars.title"),description:u(a?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Bt,{checked:c,onChange:d,label:u("project.vars.reveal_all")}),s.jsxs(se,{size:"sm",variant:"primary",onClick:()=>g({}),children:[s.jsx(It,{size:14})," ",u("project.vars.new")]})]}),children:[!a&&s.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[s.jsx("span",{className:"text-muted-fg",children:u("project.vars.filter_label")}),s.jsx(Ah,{active:o==="all",onClick:()=>l("all"),children:u("project.vars.filter_all")}),s.jsx(Ah,{active:o==="project",onClick:()=>l("project"),children:u("project.vars.filter_project")}),s.jsx(Ah,{active:o==="global",onClick:()=>l("global"),children:u("project.vars.filter_global")})]}),p.isLoading&&s.jsx(rt,{}),!p.isLoading&&h.length===0&&s.jsx(pt,{children:u("project.vars.empty")}),h.length>0&&s.jsx("ul",{className:"space-y-2 text-sm",children:h.map(_=>s.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("span",{className:"font-mono text-xs font-medium",children:_.name}),s.jsx(He,{tone:_.scope==="project"?"info":"muted",children:_.scope==="project"?u("project.vars.scope_project"):u("project.vars.scope_global")}),s.jsx("span",{className:"ml-2 font-mono text-xs text-muted-fg",children:_.masked}),s.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>g({name:_.name,scope:_.scope}),"aria-label":u("project.vars.edit_btn"),children:s.jsx(ya,{size:13})}),!(a&&_.scope==="project")&&s.jsx(se,{size:"sm",variant:"destructive",onClick:()=>b(_.name,_.scope),"aria-label":u("project.vars.delete_btn"),children:s.jsx(vn,{size:13})})]})]},`${_.scope}-${_.name}`))}),s.jsx(V7,{open:m!==null,initial:m||void 0,onClose:()=>g(null),pid:e,isBase:a,onSaved:()=>{g(null),p.mutate()}})]})}function Ah({active:e,onClick:t,children:a}){return s.jsx("button",{type:"button",onClick:t,className:e?"rounded-full border border-primary/50 bg-primary/10 px-2 py-0.5 text-xs":"rounded-full border border-border bg-muted/30 px-2 py-0.5 text-xs hover:bg-muted/60",children:a})}function V7({open:e,onClose:t,pid:a,isBase:o,initial:l,onSaved:c}){const d=Ze(),[p,m]=x.useState(!1),[g,h]=x.useState(!1),[b,_]=x.useState(l?.name||""),[j,N]=x.useState(l?.value||""),[y,w]=x.useState(l?.scope||(o?"global":"project")),S=!!l?.name;x.useEffect(()=>{e&&(_(l?.name||""),N(l?.value||""),w(l?.scope||(o?"global":"project")),h(!1))},[e,l?.name,l?.scope,l?.value,o]);const k=async()=>{if(!b.trim()){d.error(u("project.vars.name_required"));return}if(!j){d.error(u("project.vars.value_required"));return}m(!0);try{await Fc.upsert(a,{name:b.trim(),value:j,scope:y}),d.success(u(S?"project.vars.updated":"project.vars.added")),c()}catch(E){d.error(E?.message||u("common.error_generic"))}finally{m(!1)}};return s.jsx(Zt,{open:e,onClose:()=>p?null:t(),title:u(S?"project.vars.edit_title":"project.vars.new_title"),description:u("project.vars.new_desc"),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:p,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:k,loading:p,children:u(S?"project.vars.save_btn":"project.vars.add_btn")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("project.vars.scope_label"),children:s.jsx(ut,{value:y,onChange:E=>w(E),options:[...o?[]:[{value:"project",label:u("project.vars.scope_project"),description:u("project.vars.scope_project_desc")}],{value:"global",label:u("project.vars.scope_global"),description:u("project.vars.scope_global_desc")}]})}),s.jsx(ae,{label:u("project.vars.name_label"),hint:u("project.vars.name_hint"),children:s.jsx(Ne,{value:b,onChange:E=>_(E.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:S,autoFocus:!S})}),s.jsx(ae,{label:u("project.vars.value_label"),hint:u("project.vars.value_hint"),children:s.jsxs("div",{className:"relative",children:[s.jsx(Ne,{type:g?"text":"password",value:j,onChange:E=>N(E.target.value),placeholder:S?u("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:S}),s.jsx("button",{type:"button",onClick:()=>h(E=>!E),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":u(g?"project.vars.hide":"project.vars.reveal"),children:g?s.jsx($S,{size:14}):s.jsx(eu,{size:14})})]})})]})})}function W_({value:e,onValueChange:t,onSubmit:a,onStop:o,busy:l=!1,disabled:c=!1,placeholder:d,autoFocus:p,minRows:m=2,maxRows:g=8,footer:h,className:b}){const _=x.useRef(null);x.useLayoutEffect(()=>{const N=_.current;if(!N)return;const y=()=>{N.style.height="auto",N.offsetHeight;const S=parseFloat(getComputedStyle(N).lineHeight)||20,k=S*m,E=S*g;N.style.height=`${Math.min(Math.max(N.scrollHeight,k),E)}px`,N.style.overflowY=N.scrollHeight>E?"auto":"hidden"};y();const w=requestAnimationFrame(y);return()=>cancelAnimationFrame(w)},[e,m,g]);const j=e.trim().length>0&&!c;return s.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:[s.jsx("textarea",{ref:_,rows:m,value:e,autoFocus:p,disabled:c,placeholder:d,onChange:N=>t(N.target.value),onKeyDown:N=>{if(N.key==="Enter"&&!N.shiftKey){if(N.preventDefault(),l||!j)return;a()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),s.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[s.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:h}),l&&o?s.jsx($e,{content:u("chat_ui.stop"),children:s.jsx(ar,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":u("chat_ui.stop"),children:s.jsx(wb,{className:"size-3.5",fill:"currentColor"})})}):s.jsx($e,{content:u("chat_ui.send"),children:s.jsx(ar,{type:"button",size:"icon-sm",variant:"default",onClick:a,disabled:!j,"aria-label":u("chat_ui.send"),children:s.jsx(bM,{className:"size-4"})})})]})]})}function Z_({value:e,onChange:t,disabled:a}){const[o,l]=x.useState(!1),[c,d]=x.useState(""),[p,m]=x.useState([]),[g,h]=x.useState(!1),b=x.useRef(null);x.useEffect(()=>{if(!o)return;const w=S=>{b.current&&!b.current.contains(S.target)&&l(!1)};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[o]),x.useEffect(()=>{if(!o||g)return;let w=!1;return(async()=>{try{const{engines:S}=await Gc.list(),k=await Promise.all(S.map(E=>Gc.models({engine:E}).then(R=>(R.models||[]).map(A=>A.includes(":")?A:`${E}:${A}`)).catch(()=>[])));if(!w){const E=Array.from(new Set(k.flat())).sort();m(E),h(!0)}}catch{w||h(!0)}})(),()=>{w=!0}},[o,g]);const _=c.trim().toLowerCase(),j=_?p.filter(w=>w.toLowerCase().includes(_)):p,N=e||u("shared_ui.auto"),y=w=>{t(w),l(!1),d("")};return s.jsxs("div",{ref:b,className:"relative",children:[s.jsx($e,{content:u("chat_ui.pick_model"),children:s.jsxs("button",{type:"button",disabled:a,onClick:()=>l(w=>!w),"data-testid":"chat-model-picker",className:he("flex max-w-[200px] items-center gap-1 rounded-md border border-transparent px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors","hover:bg-accent/60 hover:text-foreground",e&&"text-foreground"),"aria-label":u("chat_ui.pick_model"),children:[s.jsx(ZS,{className:"size-3 shrink-0"}),s.jsx("span",{className:"truncate font-mono",children:N}),s.jsx(ms,{className:"size-3 shrink-0 opacity-60"})]})}),o&&s.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:[s.jsx("input",{autoFocus:!0,value:c,placeholder:u("shared_ui.model_filter_ph"),onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Enter"&&c.trim()&&y(c.trim())},className:"mb-1 w-full rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus:border-foreground/30"}),s.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[s.jsx("li",{children:s.jsxs("button",{type:"button",onMouseDown:w=>{w.preventDefault(),y("")},className:he("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:[s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx(Ss,{className:"size-3"})," ",u("shared_ui.auto_router")]}),!e&&s.jsx(Hr,{className:"size-3"})]})}),!g&&s.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:u("shared_ui.loading_models")}),g&&j.length===0&&c.trim()&&s.jsx("li",{children:s.jsx("button",{type:"button",onMouseDown:w=>{w.preventDefault(),y(c.trim())},className:"w-full rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",children:u("shared_ui.use_value",{value:c.trim()})})}),j.map(w=>s.jsx("li",{children:s.jsxs("button",{type:"button",onMouseDown:S=>{S.preventDefault(),y(w)},className:he("flex w-full items-center justify-between rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",w===e&&"bg-accent/50"),children:[s.jsx("span",{className:"truncate",children:w}),w===e&&s.jsx(Hr,{className:"size-3 shrink-0"})]})},w))]})]})]})}function F7({onSend:e,onStop:t,streaming:a,model:o,onModelChange:l}){const[c,d]=x.useState(""),p=()=>{const m=c.trim();m&&(d(""),e(m))};return s.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:s.jsx(W_,{value:c,onValueChange:d,onSubmit:p,onStop:t,busy:a,placeholder:u("project.chat.placeholder"),maxRows:12,footer:l?s.jsx(Z_,{value:o||"",onChange:l,disabled:a}):void 0})})}function G7(){return{read_file:{icon:Kf,label:u("shared_ui.tool_read_file")},write_file:{icon:UM,label:u("shared_ui.tool_write_file")},edit_file:{icon:hf,label:u("shared_ui.tool_edit_file")},list_files:{icon:hb,label:u("shared_ui.tool_list_files")},search_files:{icon:Ac,label:u("shared_ui.tool_search_files")},search_messages:{icon:Ac,label:u("shared_ui.tool_search_messages")},tail_messages:{icon:Ac,label:u("shared_ui.tool_tail_messages")},run_shell:{icon:ba,label:u("shared_ui.tool_run_shell")},send_telegram:{icon:ja,label:u("shared_ui.tool_send_telegram")},call_agent:{icon:un,label:u("shared_ui.tool_call_agent")},call_mcp:{icon:i3,label:u("shared_ui.tool_call_mcp")},call_runtime:{icon:un,label:u("shared_ui.tool_call_runtime")},create_task:{icon:e3,label:u("shared_ui.tool_create_task")}}}const ME=new Set(["write_file","edit_file"]);function Y7(e){return G7()[e]||{icon:ta,label:e}}function K7(e,t){if(!t)return"";const a=l=>typeof t[l]=="string"?t[l]:void 0,o=a("path")||a("file")||a("pattern")||a("query")||a("command")||a("slug")||a("name")||a("agent");return o?String(o):""}function tk(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function X7({status:e}){return e==="running"?s.jsx(Ir,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?s.jsx(Ss,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?s.jsx(PM,{className:"size-3 shrink-0 text-amber-400"}):s.jsx(Hr,{className:"size-3 shrink-0 text-emerald-400"})}function Q7({part:e}){const[t,a]=x.useState(!1),{icon:o,label:l}=Y7(e.tool),c=K7(e.tool,e.args),d=ME.has(e.tool),p=!!e.args||e.result!==void 0;return s.jsxs("div",{className:he("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[s.jsxs("button",{type:"button",onClick:()=>p&&a(m=>!m),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[p?s.jsx(Fr,{className:he("size-3 shrink-0 text-muted-foreground transition-transform",t&&"rotate-90")}):s.jsx("span",{className:"size-3 shrink-0"}),s.jsx(o,{className:he("size-3.5 shrink-0",d?"text-violet-400":"text-muted-foreground")}),s.jsx("span",{className:"shrink-0 font-medium",children:l}),c&&s.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),s.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&s.jsx("span",{className:"text-[10px] text-amber-400",children:u("shared_ui.dedup")}),s.jsx(X7,{status:e.status})]})]}),t&&p&&s.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&&s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:u("shared_ui.args")}),s.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:tk(e.args)})]}),e.result!==void 0&&s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:u("shared_ui.result")}),s.jsx("pre",{className:he("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:tk(e.result)})]})]})]})}function W7(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 Z7({part:e,pending:t}){const a=W7(e),o=u(t?"ask_panel.status_waiting":"ask_panel.status_received");return s.jsxs("div",{className:he("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:[s.jsxs("div",{className:"flex items-center gap-2",children:[t?s.jsx(Ir,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):s.jsx(fb,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),s.jsx(QS,{className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"text-[12px] font-medium",children:o}),a.length>1&&s.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[a.length," preguntas"]})]}),a.length>0&&s.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:a.map((l,c)=>s.jsx("li",{className:"list-disc",children:l},c))})]})}function OE(e){const t=e.split(`
|
|
775
|
+
`),a=[];let o=null;for(const l of t)if(l.startsWith("- "))o&&a.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&&a.push(o),a.length>0?a:null}function J7({text:e}){const t=OE(e);return t?s.jsx("div",{className:"flex w-full justify-center",children:s.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:[s.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[s.jsx(QS,{className:"size-3.5"}),s.jsx("span",{children:u("ask_panel.answers_header")})]}),s.jsx("ul",{className:"space-y-2.5",children:t.map((a,o)=>s.jsxs("li",{className:"space-y-0.5",children:[s.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:a.question}),s.jsx("div",{className:he("whitespace-pre-wrap text-[13px] leading-snug",a.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:a.answer})]},o))})]})}):null}function Xx(e){return e.parts.filter(t=>t.kind==="text").map(t=>t.text).join(`
|
|
776
|
+
|
|
777
|
+
`).trim()}function eB(e){const t=e.args?.questions;if(!Array.isArray(t)||t.length===0)return null;const a=t.map(o=>{if(typeof o=="string")return`- ${o}`;if(!o||typeof o!="object")return null;const l=o;if(typeof l.question!="string")return null;const d=(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 d?`- ${l.question} (opciones: ${d})`:`- ${l.question}`}).filter(o=>!!o);return a.length===0?null:`[ask_questions]
|
|
778
|
+
${a.join(`
|
|
779
|
+
`)}`}function tB(e){const t=[];for(const a of e.parts)if(a.kind==="text"&&a.text)t.push(a.text);else if(a.kind==="tool"&&a.tool==="ask_questions"){const o=eB(a);o&&t.push(o)}return t.join(`
|
|
780
|
+
|
|
781
|
+
`).trim()}const zE=e=>[{kind:"text",text:e}];function DE(e){if(!e||typeof e!="object")return!1;const t=e;return"error"in t&&!!t.error}function nB(e){const t=[];let a=null,o=0;for(const l of e){const c=l.ts||new Date().toISOString();l.role==="user"?(a=null,t.push({role:"user",parts:zE(l.content),ts:c})):(l.role==="assistant"||l.role==="tool")&&(a||(a={role:"assistant",parts:[],ts:c},t.push(a)),l.role==="tool"?a.parts.push({kind:"tool",id:`hist-${o++}`,tool:l.tool||"tool",args:l.args,result:l.result,status:DE(l.result)?"error":"done"}):l.content&&a.parts.push({kind:"text",text:l.content}))}return t}function J_(e,t){const a=o=>({...e,notes:[...e.notes||[],o]});switch(t.type){case"model_start":return t.model?{...e,model:t.model}:e;case"model_routed":{const o=t.model?{...e,model:t.model}:e;return t.from_fallback?{...o,notes:[...o.notes||[],`routing fell back → ${t.model}`]}:o}case"engine_failed":return a(`engine ${t.model||"?"} failed → ${t.retry_with||"retry"}`);case"model_retry":return a(`retry (${t.reason||"?"})`);case"tools_suppressed":return a(`tools suppressed: ${(t.tools||[]).join(", ")}`);case"skill_inspector":{const o=t.inspector;return!o||!o.loaded?.length&&!o.hinted?.length?e:{...e,inspector:{embedder:o.embedder,loaded:o.loaded||[],hinted:o.hinted||[]}}}case"assistant_text":return t.text?{...e,parts:[...e.parts,{kind:"text",text:t.text}]}:e;case"tool_start":return t.trace?{...e,parts:[...e.parts,{kind:"tool",id:t.trace.id,tool:t.trace.tool,args:t.trace.args,status:"running"}]}:e;case"tool_deduped":return t.trace?{...e,parts:e.parts.map(o=>o.kind==="tool"&&o.id===t.trace.id?{...o,status:"deduped"}:o)}:e;case"tool_result":if(!t.trace)return e;{const o=DE(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 sB(e,t){const[a,o]=x.useState([]),[l,c]=x.useState(!1),[d,p]=x.useState(void 0),m=x.useRef(null),g=x.useRef(void 0),h=x.useRef(0),b=x.useCallback(k=>{o(E=>{const R=[...E],A=R[R.length-1];return A&&A.role==="assistant"&&(R[R.length-1]=k(A)),R})},[]),_=x.useCallback(k=>{if(k.type==="error"){t?.(k.error||u("shared_ui.err_stream"));return}b(E=>J_(E,k))},[b,t]),j=x.useCallback(async(k,E={})=>{const R=k.trim();if(!R||l)return;const A=()=>new Date().toISOString(),T=a.map(O=>({role:O.role,content:tB(O)}));if(o(O=>[...O,{role:"user",parts:zE(R),ts:A()},{role:"assistant",parts:[],ts:A(),pending:!0}]),c(!0),E.agentSlug){try{const O=await cn.chat(e,E.agentSlug,{prompt:R,conversation_id:g.current,model:E.model||void 0,channel:"web"});g.current=O.conversation_id,p(O.conversation_id),b(B=>({...B,pending:!1,model:O.engine,parts:[{kind:"text",text:O.text}]}))}catch(O){t?.(O?.message||u("shared_ui.err_chat_failed")),o(B=>B.filter((P,U)=>U!==B.length-1))}finally{c(!1)}return}const z=new AbortController;m.current=z;try{await gN.stream(e,{prompt:R,previousMessages:T,model:E.model||void 0,channel:"web"},_,z.signal),b(O=>({...O,pending:!1}))}catch(O){z.signal.aborted?b(B=>({...B,pending:!1,parts:[...B.parts,{kind:"text",text:u("code_module.stopped")}]})):(t?.(O?.message||u("shared_ui.err_stream_failed")),o(B=>B.filter((P,U)=>U!==B.length-1)))}finally{c(!1),m.current=null}},[e,a,l,_,b,t]),N=x.useCallback(()=>m.current?.abort(),[]),y=x.useCallback(()=>{l||(h.current++,g.current=void 0,p(void 0),o([]))},[l]),w=x.useCallback(async(k,E)=>{if(l)return;const R=++h.current;o([]);try{const A=await zo.get(e,k,E);if(R!==h.current)return;const T=(A.messages??[]).filter(z=>z.role==="user"||z.role==="assistant").map(z=>({role:z.role,parts:[{kind:"text",text:z.content}],ts:z.ts||new Date().toISOString()}));g.current=E,p(E),o(T)}catch(A){if(R!==h.current)return;g.current=void 0,p(void 0),o([]),t?.(A?.message||u("shared_ui.err_load_conversation"))}},[e,l,t]),S=x.useCallback(async(k,E)=>{if(l)return;const R=++h.current;o([]);try{const A=await zo.thread(e,k,E);if(R!==h.current)return;const T=nB(A.messages??[]);g.current=void 0,p(void 0),o(T)}catch(A){if(R!==h.current)return;g.current=void 0,p(void 0),o([]),t?.(A?.message||u("shared_ui.err_load_conversation"))}},[e,l,t]);return{msgs:a,send:j,stop:N,clear:y,load:w,loadThread:S,streaming:l,conversationId:d}}function aB({msg:e,isLast:t,isAskAnswer:a,onCopy:o}){const l=e.role==="user",c=Xx(e),d=e.parts.some(p=>p.kind==="tool");if(l&&a){const p=Xx(e);if(OE(p))return s.jsx(J7,{text:p})}return s.jsxs("div",{className:he("group flex items-start gap-2",l?"justify-end":"justify-start"),children:[!l&&s.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:s.jsx(un,{size:14})}),s.jsxs("div",{className:he("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&&s.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((p,m)=>s.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[s.jsx(YS,{size:10})," ",p]},m))}),!l&&e.inspector&&(e.inspector.loaded?.length||e.inspector.hinted?.length)?s.jsx($e,{content:u("shared_ui.skill_inspector_title",{embedder:e.inspector.embedder||"RAG"}),children:s.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] text-sky-400/90",children:[s.jsx(ea,{size:10}),e.inspector.loaded?.map(p=>s.jsx("span",{className:"rounded bg-sky-500/15 px-1 py-0.5 font-mono",children:p},`l-${p}`)),e.inspector.hinted?.map(p=>s.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?s.jsx(Z7,{part:p,pending:!!t},`${p.id}-${m}`):s.jsx(Q7,{part:p},`${p.id}-${m}`):p.text?s.jsx("div",{className:he("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&&s.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),s.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[s.jsx("span",{children:rB(e.ts)}),!l&&e.model&&s.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!l&&d&&s.jsxs("span",{children:["· ",u("shared_ui.tools_count",{n:e.parts.filter(p=>p.kind==="tool").length})]}),o&&c&&s.jsx($e,{content:u("chat_ui.copy"),children:s.jsxs("button",{type:"button",onClick:()=>o(c),className:"inline-flex items-center gap-1 hover:text-foreground","aria-label":u("chat_ui.copy"),children:[s.jsx(No,{size:10})," ",u("chat_ui.copy")]})})]})]}),l&&s.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:s.jsx(kb,{size:14})})]})}function rB(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function ev({msgs:e,onCopy:t}){const a=x.useRef(null);if(x.useEffect(()=>{a.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return s.jsx("div",{className:"grid h-full place-items-center p-6",children:s.jsx(pt,{children:u("project.chat.empty")})});const o=e.length-1;return s.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((l,c)=>s.jsx(aB,{msg:l,isLast:c===o,isAskAnswer:oB(e,c),onCopy:t},c)),s.jsx("div",{ref:a})]})}function oB(e,t){const a=e[t];if(!a||a.role!=="user")return!1;const o=e[t-1];if(!o||o.role!=="assistant")return!1;for(let 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 lB(e){if(!e)return;const t=e.path??e.file??e.filename;return typeof t=="string"?t:void 0}function PE({msgs:e}){const[t,a]=x.useState(!1),{inTok:o,outTok:l,toolCount:c,changed:d,model:p}=x.useMemo(()=>{let g=0,h=0,b=0,_;const j=new Set,N=[];for(const y of e)if(y.role==="assistant"){y.usage&&(g+=y.usage.input_tokens||0,h+=y.usage.output_tokens||0),y.model&&(_=y.model);for(const w of y.parts)if(w.kind==="tool"&&(b+=1,ME.has(w.tool)&&w.status!=="error")){const S=lB(w.args);S&&!j.has(S)&&(j.add(S),N.push({path:S,tool:w.tool}))}}return{inTok:g,outTok:h,toolCount:b,changed:N,model:_}},[e]),m=o+l;return m===0&&c===0?null:s.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[s.jsxs("button",{type:"button",onClick:()=>d.length>0&&a(g=>!g),className:he("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",d.length>0&&"hover:text-foreground"),children:[s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Xf,{size:12})," ",Mh(m)," tok",s.jsxs("span",{className:"text-muted-foreground/60",children:["(",Mh(o),"↑ / ",Mh(l),"↓)"]})]}),c>0&&s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(ta,{size:12})," ",c," tools"]}),d.length>0&&s.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[s.jsx(hf,{size:12})," ",d.length," archivos"]}),p&&s.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:p}),d.length>0&&s.jsx(ms,{className:he("size-3 shrink-0 transition-transform",t&&"rotate-180")})]}),t&&d.length>0&&s.jsx("ul",{className:"max-h-40 space-y-0.5 overflow-y-auto border-t border-border/60 px-4 py-2",children:d.map(g=>s.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[s.jsx(hf,{size:11,className:"shrink-0 text-violet-400"}),s.jsx("span",{className:"truncate",children:g.path}),s.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:g.tool==="write_file"?"write":"edit"})]},g.path))})]})}function Mh(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Dl(){return{picked:new Set,text:"",skipped:!1}}function nk(e,t){const a=[];return e.forEach((o,l)=>{const c=t[l]||Dl();if(c.skipped){a.push(`- ${o.question}
|
|
782
|
+
→ (omitido)`);return}const d=[];if(o.options&&o.options.length>0){const g=[...c.picked].sort((h,b)=>h-b).map(h=>o.options[h]?.label).filter(Boolean);g.length>0&&d.push(g.join(", "))}const p=c.text.trim();p&&d.push(o.options&&o.options.length>0?`(Otro: ${p})`:p);const m=d.length>0?d.join(" "):"(sin respuesta)";a.push(`- ${o.question}
|
|
783
|
+
→ ${m}`)}),a.join(`
|
|
784
|
+
`)}function LE({turnKey:e,questions:t,onSubmit:a,onDismiss:o,disabled:l}){const c=t.length,[d,p]=x.useState(0),[m,g]=x.useState(()=>t.map(()=>Dl()));x.useEffect(()=>{p(0),g(t.map(()=>Dl()))},[e,t]);const h=t[d],b=m[d]||Dl(),_=!!h?.options&&h.options.length>0,j=!!h?.multiSelect,N=h?.allowText!==!1,y=T=>{g(z=>{const O=[...z],B=O[d]||Dl();return O[d]={...B,...T,skipped:!1},O})},w=T=>{g(z=>{const O=[...z],B=O[d]||Dl(),P=new Set(B.picked);return j?P.has(T)?P.delete(T):P.add(T):(P.clear(),P.add(T)),O[d]={...B,picked:P,skipped:!1},O})},S=x.useMemo(()=>!0,[]),k=d===c-1,E=()=>p(T=>Math.max(0,T-1)),R=()=>{if(k){a(nk(t,m));return}p(T=>Math.min(c-1,T+1))},A=()=>{if(g(T=>{const z=[...T];return z[d]={picked:new Set,text:"",skipped:!0},z}),k){const T=m.map((z,O)=>O===d?{picked:new Set,text:"",skipped:!0}:z);a(nk(t,T))}else p(T=>Math.min(c-1,T+1))};return x.useEffect(()=>{const T=z=>{if(l)return;const O=z.target?.tagName?.toLowerCase(),B=O==="input"||O==="textarea";if(z.key==="Enter"&&(z.metaKey||z.ctrlKey)){z.preventDefault(),R();return}if(!B&&_&&/^[1-9]$/.test(z.key)){const P=parseInt(z.key,10)-1;P<(h?.options?.length||0)&&(z.preventDefault(),w(P))}};return window.addEventListener("keydown",T),()=>window.removeEventListener("keydown",T)}),!h||c===0?null:s.jsxs("div",{className:he("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:[s.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[s.jsxs("span",{className:"mt-0.5 shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-mono font-medium text-amber-700 dark:text-amber-300",children:[d+1,"/",c]}),h.header&&s.jsx("span",{className:"mt-0.5 shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:h.header}),s.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:h.question}),o&&s.jsx("button",{type:"button",onClick:o,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":u("common.close"),children:s.jsx(Ss,{className:"size-3.5"})})]}),s.jsxs("div",{className:"space-y-1 px-2 py-2",children:[_&&h.options.map((T,z)=>{const O=b.picked.has(z);return s.jsxs("button",{type:"button",onClick:()=>w(z),className:he("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",O?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("div",{className:"text-xs font-medium",children:T.label}),T.description&&s.jsx("div",{className:"text-[11px] text-muted-foreground",children:T.description})]}),j?s.jsx("span",{className:he("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",O?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:O&&s.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):s.jsx("span",{className:he("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",O?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:z+1})]},`${z}:${T.label}`)}),(N||!_)&&s.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[_&&s.jsx("div",{className:"mb-1 text-xs font-medium",children:u("ask_panel.other")}),s.jsx("input",{type:"text",value:b.text,onChange:T=>y({text:T.target.value}),placeholder:u(_?"ask_panel.other_placeholder":"ask_panel.text_placeholder"),className:"w-full rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:border-emerald-500"})]})]}),s.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[s.jsx("button",{type:"button",onClick:E,disabled:d===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:u("ask_panel.back")}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{type:"button",onClick:A,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:u("ask_panel.skip")}),s.jsxs("button",{type:"button",onClick:R,disabled:!S,className:"inline-flex items-center gap-1 rounded bg-emerald-500/15 px-2 py-1 text-[11px] font-medium text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[u(k?"ask_panel.submit":"ask_panel.next"),s.jsx(DM,{className:"size-3 opacity-60"})]})]})]})]})}function iB(e){if(typeof e=="string")return{question:e,options:[],multiSelect:!1,allowText:!0};if(!e||typeof e!="object")return null;const t=e,a=typeof t.question=="string"?t.question:"";if(!a)return null;const 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 d=c;return{label:d.label,description:typeof d.description=="string"?d.description:void 0}}return null}).filter(c=>c!==null);return{question:a,header:typeof t.header=="string"?t.header:void 0,options:l,multiSelect:t.multiSelect===!0,allowText:t.allowText!==!1}}function IE(e){if(!e.length)return null;const t=e[e.length-1];if(t.role!=="assistant")return null;let a=null,o=-1;for(let g=t.parts.length-1;g>=0;g--){const h=t.parts[g];if(h.kind==="tool"&&h.tool==="ask_questions"){a=h,o=g;break}}if(!a||o<0)return null;let l=null;if(typeof a.result=="string")try{l=JSON.parse(a.result)}catch{l=null}else a.result&&typeof a.result=="object"&&(l=a.result);const c=[];Array.isArray(a.args?.questions)&&c.push(a.args.questions),l&&Array.isArray(l.questions)&&c.push(l.questions);let d=[];for(const g of c)if(d=g.map(iB).filter(h=>!!h),d.length>0)break;return d.length?{turnKey:`${t.ts||""}#${o}`,questions:d}:null}const Qx={web:{label:"Web",icon:xb,order:0},telegram:{label:"Telegram",icon:ja,order:1},desktop:{label:"Desktop",icon:vb,order:2},voice:{label:"Voice",icon:_b,order:3},a2a:{label:"Agent ↔ Agent",icon:un,order:4},schedule:{label:"Schedule",icon:x3,order:5},other:{label:"Other",icon:ci,order:6}};function sk(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 cB({pid:e,slug:t,onLoaded:a}){const{data:o}=qe(`/projects/${e}/agents/${t}/conversations`,()=>zo.list(e,t),{revalidateOnFocus:!1});return x.useEffect(()=>{a(t,o)},[t,o]),null}function uB({pid:e,agents:t,superAgentSlug:a,superAgentLabel:o,selected:l,onSelect:c,onNewChat:d}){const[p,m]=x.useState(""),[g,h]=x.useState(""),[b,_]=x.useState({}),[j,N]=x.useState({}),[y,w]=x.useState(!1),S=String(e)==="0",k=qe(S?`/projects/${e}/super-agent/threads`:null,()=>zo.threads(e),{revalidateOnFocus:!1}),E=(D,L)=>{L&&N(V=>{const H=V[D];return H&&H.length===L.length&&H===L?V:{...V,[D]:L}})},R=x.useMemo(()=>{const D=[];for(const L of t)for(const V of j[L.slug]||[])D.push({...V,agent_slug:V.agent_slug||L.slug});return D},[t,j]),A=x.useMemo(()=>{const D=p.trim().toLowerCase();return R.filter(L=>!(g&&L.agent_slug!==g||D&&!`${L.title||""} ${L.id} ${L.agent_slug}`.toLowerCase().includes(D)))},[R,p,g]),T=x.useMemo(()=>{if(g&&g!==a)return[];const D=p.trim().toLowerCase();return(k.data||[]).filter(L=>D?`${L.title} ${L.id} ${L.channel}`.toLowerCase().includes(D):!0)},[k.data,p,g,a]),z=x.useMemo(()=>{const D=new Map,L=(V,H)=>{const $=D.get(V);$?$.push(H):D.set(V,[H])};for(const V of A)L(sk(V.channel),{type:"conv",conv:V,sortTs:V.started_at||""});for(const V of T)L(sk(V.channel),{type:"thread",thread:V,sortTs:V.last_ts||V.started_at||""});return Array.from(D.entries()).map(([V,H])=>({key:V,items:H.sort(($,F)=>new Date(F.sortTs||0).getTime()-new Date($.sortTs||0).getTime())})).sort((V,H)=>Qx[V.key].order-Qx[H.key].order)},[A,T]),O=x.useMemo(()=>[{slug:a,label:o},...t.map(D=>({slug:D.slug,label:D.slug}))],[t,a,o]),B=x.useMemo(()=>[{value:"",label:u("project.chat.list.all_agents")},{value:a,label:o},...t.map(D=>({value:D.slug,label:D.slug}))],[t,a,o]),P=R.length+(k.data?.length||0),U=Object.keys(j).length>0||t.length===0||!!k.data;return s.jsxs("aside",{className:"flex h-full w-72 shrink-0 flex-col border-r border-border bg-card/30",children:[t.map(D=>s.jsx(cB,{pid:e,slug:D.slug,onLoaded:E},D.slug)),s.jsxs("header",{className:"flex h-[57px] shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"truncate text-sm font-semibold",children:u("project.chat.list.title")}),s.jsx("p",{className:"text-[10px] text-muted-fg",children:u("project.chat.list.count",{n:P})})]}),s.jsxs("div",{className:"relative",children:[s.jsxs("button",{type:"button",onClick:()=>w(D=>!D),className:"inline-flex items-center gap-1 rounded-md border border-border bg-accent/60 px-2 py-1 text-[11px] font-medium hover:bg-accent",children:[s.jsx(It,{className:"size-3"})," ",u("project.chat.list.new")]}),y&&s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button","aria-hidden":!0,tabIndex:-1,className:"fixed inset-0 z-10 cursor-default",onClick:()=>w(!1)}),s.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:[s.jsx("p",{className:"px-2 py-1 text-[10px] font-semibold uppercase tracking-wider text-muted-fg",children:u("project.chat.list.pick_agent")}),s.jsx("div",{className:"max-h-64 overflow-y-auto",children:O.map(D=>s.jsxs("button",{type:"button",onClick:()=>{w(!1),d(D.slug)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs hover:bg-accent/50",children:[s.jsx(un,{className:"size-3 shrink-0 text-muted-fg"}),s.jsx("span",{className:"truncate",children:D.label})]},`new-${D.slug}`))})]})]})]})]}),s.jsxs("div",{className:"space-y-2 border-b border-border p-2",children:[s.jsx(Ne,{value:p,onChange:D=>m(D.target.value),placeholder:u("project.chat.list.search")}),s.jsx(ut,{value:g,onChange:h,options:B})]}),s.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-2",children:[!U&&s.jsx("div",{className:"px-2 py-1",children:s.jsx(rt,{})}),z.map(D=>s.jsx(dB,{keyName:D.key,count:D.items.length,collapsed:!!b[D.key],onToggle:()=>_(L=>({...L,[D.key]:!L[D.key]})),children:D.items.map(L=>{if(L.type==="thread"){const $=L.thread,F=l.kind==="thread"&&l.channel===$.channel&&l.threadId===$.id;return s.jsx(ak,{title:$.title,subtitle:[$.channel,`${$.messages} msg`].join(" · "),badge:"super",timeAgo:$.last_ts,selected:F,onClick:()=>c({kind:"thread",channel:$.channel,threadId:$.id},{channel:$.channel,createdAt:$.started_at,title:$.title})},`thread-${$.channel}-${$.id}`)}const V=L.conv,H=l.kind==="conv"&&l.agentSlug===V.agent_slug&&l.convId===V.id;return s.jsx(ak,{title:V.title||V.id,subtitle:[V.agent_slug,`${V.messages??0} msg`].filter(Boolean).join(" · "),badge:V.agent_slug,timeAgo:V.started_at,selected:H,onClick:()=>c({kind:"conv",agentSlug:V.agent_slug,convId:V.id},{channel:V.channel,createdAt:V.started_at,title:V.title})},`${V.agent_slug}-${V.id}`)})},D.key)),U&&R.length===0&&T.length===0&&s.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:u("project.chat.list.empty")})]})]})}function dB({keyName:e,count:t,collapsed:a,onToggle:o,children:l}){const c=Qx[e],d=c.icon;return s.jsxs("section",{className:"space-y-1",children:[s.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:[s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a?s.jsx(Fr,{className:"size-3"}):s.jsx(ms,{className:"size-3"}),s.jsx(d,{className:"size-3"}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:c.label})]}),s.jsx("span",{className:"text-[10px]",children:t})]}),!a&&s.jsx("div",{className:"space-y-0.5",children:l})]})}function ak({title:e,subtitle:t,badge:a,timeAgo:o,selected:l,onClick:c}){return s.jsxs("button",{type:"button",onClick:c,className:Uc("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:[s.jsxs("div",{className:"flex items-start justify-between gap-2",children:[s.jsx("p",{className:Uc("truncate text-sm",l?"font-semibold":"font-medium"),children:e}),o&&s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-fg",children:[s.jsx(BS,{className:"size-2.5"}),fB(o)]})]}),s.jsxs("div",{className:"mt-0.5 flex items-center justify-between gap-2 text-[10px] text-muted-fg",children:[s.jsx("span",{className:"truncate",children:t}),a&&s.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-accent/50 px-1.5 py-0.5",children:[s.jsx(kb,{className:"size-2.5"}),a]})]})]})}function fB(e){if(!e)return"";const t=new Date(e).getTime();if(!Number.isFinite(t))return"";const a=Date.now()-t,o=Math.floor(a/6e4);if(o<1)return"now";if(o<60)return`${o}m`;const l=Math.floor(o/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}const Kd="__super_agent__";function pB({pid:e}){const t=Ze(),[a,o]=$o(),l=qe(`/projects/${e}/agents`,()=>cn.list(e)),[c,d]=x.useState(!1),[p,m]=x.useState(""),[g,h]=x.useState(null),{msgs:b,send:_,stop:j,clear:N,load:y,loadThread:w,streaming:S}=sB(e,te=>t.error(te)),k=Sp(),[E,R]=x.useState(()=>{const te=a.get("agent"),re=a.get("conv"),le=a.get("channel"),me=a.get("thread");return le&&me?{kind:"thread",channel:le,threadId:me}:te&&re?{kind:"conv",agentSlug:te,convId:re}:te?{kind:"live",agentSlug:te}:{kind:"live",agentSlug:Kd}}),[A,T]=x.useState(void 0),[z,O]=x.useState(!1),[B,P]=x.useState(!1),U=(te,re)=>{R(te),T(re);const le=new URLSearchParams;te.kind==="conv"?(le.set("agent",te.agentSlug),le.set("conv",te.convId)):te.kind==="thread"?(le.set("channel",te.channel),le.set("thread",te.threadId)):le.set("agent",te.agentSlug),o(le,{replace:!0})},D=l.data||[],L=te=>te===Kd,V=x.useMemo(()=>E.kind==="thread"?void 0:D.find(te=>te.slug===E.agentSlug),[D,E]),H=E.kind==="thread"||L(E.agentSlug);x.useEffect(()=>{E.kind==="conv"?y(E.agentSlug,E.convId):E.kind==="thread"?w(E.channel,E.threadId):N()},[E.kind,E.kind==="conv"?E.convId:E.kind==="thread"?`${E.channel}:${E.threadId}`:E.agentSlug]);const $=async te=>{if(H){await _(te,{model:p||void 0});return}V&&await _(te,{model:p||void 0,agentSlug:V.slug})},F=async te=>{try{await navigator.clipboard.writeText(te),t.info(u("project.chat.copied"))}catch{}},Y=te=>{U({kind:"live",agentSlug:te}),N()},G=()=>{const te=H?Kd:V?.slug??E.agentSlug;U({kind:"live",agentSlug:te}),N()},K=async()=>{P(!0);try{E.kind==="conv"?(await zo.remove(e,E.agentSlug,E.convId),Af(`/projects/${e}/agents/${E.agentSlug}/conversations`)):E.kind==="thread"&&(await zo.removeThread(e,E.channel,E.threadId),Af(`/projects/${e}/super-agent/threads`)),t.success(u("project.chat.deleted")),O(!1),G()}catch(te){t.error(te?.message||u("shared_ui.err_chat_failed"))}finally{P(!1)}},I=H?k:V?.slug??E.agentSlug,X=E.kind==="thread"?E.channel:A?.channel||"web",Z=E.kind==="thread"?E.threadId:A?.createdAt,W=E.kind==="live"?u("project.chat.live_title",{agent:I}):A?.title||(E.kind==="thread"?E.threadId:E.convId),fe=Z?u("project.chat.meta_created",{date:mB(Z),channel:X}):u("project.chat.meta_new",{channel:X});return l.isLoading?s.jsx(rt,{}):s.jsxs("div",{className:"flex h-full overflow-hidden rounded-xl border border-border bg-card/40",children:[s.jsx(uB,{pid:e,agents:D,superAgentSlug:Kd,superAgentLabel:u("agents_ui.super_agent_label",{persona:k}),selected:E,onSelect:U,onNewChat:Y}),s.jsxs("section",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h2",{className:"truncate text-sm font-semibold",children:W}),s.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:fe})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[H?s.jsx(He,{tone:"success",children:u("agents_ui.super_agent_badge")}):s.jsx(He,{tone:"info",children:I}),!D.length&&!H&&s.jsxs(se,{variant:"primary",size:"sm",onClick:()=>d(!0),children:[s.jsx(It,{size:14})," ",u("project.chat.create_agent")]}),s.jsxs(se,{variant:"ghost",size:"sm",disabled:S||b.length===0,onClick:G,children:[s.jsx(ui,{size:13})," ",u("project.chat.new_session")]}),(E.kind==="conv"||E.kind==="thread")&&s.jsxs(se,{variant:"destructive",size:"sm",disabled:S,onClick:()=>O(!0),children:[s.jsx(vn,{size:13})," ",u("project.chat.delete")]})]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:b.length?s.jsx(ev,{msgs:b,onCopy:F}):s.jsx("div",{className:"flex h-full items-center justify-center p-8",children:s.jsx("p",{className:"text-sm text-muted-fg",children:u("project.chat.empty")})})}),s.jsx(PE,{msgs:b}),(()=>{const te=S?null:IE(b);return!te||te.turnKey===g?null:s.jsx(LE,{turnKey:te.turnKey,questions:te.questions,onSubmit:re=>void $(re),onDismiss:()=>h(te.turnKey),disabled:S})})(),s.jsx(F7,{onSend:$,onStop:j,streaming:S,model:p,onModelChange:m})]}),s.jsx(gB,{open:c,pid:e,onClose:()=>d(!1),onCreated:()=>{d(!1),l.mutate()}}),s.jsx(Zt,{open:z,onClose:()=>O(!1),title:u("project.chat.delete_confirm_title"),description:u("project.chat.delete_confirm_desc"),size:"sm",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:()=>O(!1),disabled:B,children:u("common.cancel")}),s.jsxs(se,{variant:"destructive",onClick:K,loading:B,children:[s.jsx(vn,{size:14})," ",u("project.chat.delete")]})]}),children:s.jsx("p",{className:"text-sm text-muted-fg",children:W})})]})}function mB(e){if(!e)return"";const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString()}function gB({open:e,onClose:t,onCreated:a,pid:o}){const l=Ze(),[c,d]=x.useState(""),[p,m]=x.useState("master"),[g,h]=x.useState(""),[b,_]=x.useState(!0),[j,N]=x.useState(!1),y=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){l.error(u("project.agents.slug_invalid"));return}N(!0);try{await cn.create(o,{slug:c,role:p,model:g||void 0,is_master:b}),l.success(u("project.agents.created",{slug:c})),d(""),m("master"),h(""),_(!0),a()}catch(w){l.error(w.message)}finally{N(!1)}};return s.jsx(Zt,{open:e,onClose:t,title:u("project.chat.create_agent_title"),description:u("project.chat.create_agent_desc"),footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:j,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:y,loading:j,children:u("common.create")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:"slug",children:s.jsx(Ne,{autoFocus:!0,value:c,onChange:w=>d(w.target.value),placeholder:"master"})}),s.jsx(ae,{label:u("project.chat.role_label"),children:s.jsx(Ne,{value:p,onChange:w=>m(w.target.value),placeholder:"master"})}),s.jsx(ae,{label:u("project.chat.model_label"),hint:u("project.chat.model_hint"),children:s.jsx(Ne,{value:g,onChange:w=>h(w.target.value)})}),s.jsx(Bt,{checked:b,onChange:_,label:u("project.chat.master_label")})]})})}function Xd(e,t){const a=[],o=/(\*\*([^*]+)\*\*)|(\*([^*]+)\*)|(`([^`]+)`)|(\[([^\]]+)\]\(([^)]+)\))/g;let l=0,c,d=0;for(;c=o.exec(e);)c.index>l&&a.push(s.jsx(x.Fragment,{children:e.slice(l,c.index)},`${t}-t${d}`)),c[2]!==void 0?a.push(s.jsx("strong",{children:c[2]},`${t}-b${d}`)):c[4]!==void 0?a.push(s.jsx("em",{children:c[4]},`${t}-i${d}`)):c[6]!==void 0?a.push(s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]",children:c[6]},`${t}-c${d}`)):c[8]!==void 0&&a.push(s.jsx("a",{href:c[9],target:"_blank",rel:"noreferrer",className:"text-sky-500 underline underline-offset-2 hover:text-sky-400",children:c[8]},`${t}-l${d}`)),l=o.lastIndex,d+=1;return l<e.length&&a.push(s.jsx(x.Fragment,{children:e.slice(l)},`${t}-tend`)),a}function BE({content:e,className:t}){const a=e.replace(/\r\n/g,`
|
|
785
|
+
`).split(`
|
|
786
|
+
`),o=[];let l=0,c=0;const d=(p,m)=>{const g=m?"ol":"ul";o.push(s.jsx(g,{className:he("my-2 space-y-1 pl-5",m?"list-decimal":"list-disc"),children:p.map((h,b)=>s.jsx("li",{children:Xd(h,`li${c}-${b}`)},b))},`k${c++}`))};for(;l<a.length;){const p=a[l];if(/^```/.test(p.trim())){const h=[];for(l+=1;l<a.length&&!/^```/.test(a[l].trim());)h.push(a[l++]);l+=1,o.push(s.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg bg-muted/60 p-3 font-mono text-[12px] leading-[1.6]",children:s.jsx("code",{children:h.join(`
|
|
787
|
+
`)})},`k${c++}`));continue}if(p.trim()===""){l+=1;continue}const m=p.match(/^(#{1,6})\s+(.*)$/);if(m){const h=m[1].length,b=["text-2xl","text-xl","text-lg","text-base","text-sm","text-sm"];o.push(s.jsx("div",{className:he("mt-3 mb-1 font-semibold text-foreground",b[h-1]),children:Xd(m[2],`h${c}`)},`k${c++}`)),l+=1;continue}if(/^(-{3,}|\*{3,}|_{3,})$/.test(p.trim())){o.push(s.jsx("hr",{className:"my-3 border-border"},`k${c++}`)),l+=1;continue}if(/^>\s?/.test(p)){const h=[];for(;l<a.length&&/^>\s?/.test(a[l]);)h.push(a[l++].replace(/^>\s?/,""));o.push(s.jsx("blockquote",{className:"my-2 border-l-2 border-border pl-3 text-muted-foreground",children:Xd(h.join(" "),`q${c}`)},`k${c++}`));continue}if(/^\s*[-*+]\s+/.test(p)){const h=[];for(;l<a.length&&/^\s*[-*+]\s+/.test(a[l]);)h.push(a[l++].replace(/^\s*[-*+]\s+/,""));d(h,!1);continue}if(/^\s*\d+\.\s+/.test(p)){const h=[];for(;l<a.length&&/^\s*\d+\.\s+/.test(a[l]);)h.push(a[l++].replace(/^\s*\d+\.\s+/,""));d(h,!0);continue}const g=[];for(;l<a.length&&a[l].trim()!==""&&!/^(#{1,6})\s/.test(a[l])&&!/^```/.test(a[l].trim())&&!/^>\s?/.test(a[l])&&!/^\s*[-*+]\s+/.test(a[l])&&!/^\s*\d+\.\s+/.test(a[l]);)g.push(a[l++]);o.push(s.jsx("p",{className:"my-2 leading-relaxed",children:Xd(g.join(" "),`p${c}`)},`k${c++}`))}return s.jsx("div",{className:he("text-sm text-foreground/90",t),children:o})}function hB({value:e,onChange:t,showPreview:a=!1,placeholder:o,onSave:l,className:c}){return s.jsxs("div",{className:he("flex min-h-0 flex-1",c),children:[s.jsx("textarea",{value:e,onChange:d=>t(d.target.value),onKeyDown:d=>{l&&(d.metaKey||d.ctrlKey)&&d.key==="s"&&(d.preventDefault(),l())},placeholder:o,spellCheck:!1,className:he("min-h-0 resize-none bg-transparent p-4 font-mono text-[13px] leading-[1.7] text-foreground/90 outline-none",a?"w-1/2 border-r border-border":"w-full")}),a&&s.jsx("div",{className:"min-h-0 w-1/2 overflow-y-auto p-4",children:s.jsx(BE,{content:e})})]})}function Qd({onClick:e,active:t,disabled:a,children:o}){return s.jsx("button",{type:"button",onClick:e,disabled:a,className:he("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[11px] font-medium transition-colors disabled:opacity-40",t?"bg-primary/15 text-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground"),children:o})}function xB({content:e}){return s.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:s.jsx("tbody",{children:e.split(`
|
|
788
|
+
`).map((t,a)=>s.jsxs("tr",{className:"hover:bg-accent/20",children:[s.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:a+1}),s.jsx("td",{className:"whitespace-pre px-4 align-top text-foreground/90",children:t||" "})]},a))})})})}function UE({file:e,loading:t,onSave:a}){const o=typeof a=="function",[l,c]=x.useState(""),[d,p]=x.useState(!1),[m,g]=x.useState(!0),[h,b]=x.useState(!1);if(x.useEffect(()=>{c(e?.content??""),p(!1),g(!0)},[e?.path,e?.content]),t)return s.jsx("div",{className:"flex flex-1 items-center justify-center",children:s.jsx(_n,{size:16})});if(!e)return s.jsx("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:u("files.select_prompt")});const _=e.kind==="markdown",j=e.kind==="text"||e.kind==="markdown",N=d&&l!==(e.content??""),y=async()=>{if(!(!a||!N)){b(!0);try{await a(l),p(!1)}finally{b(!1)}}};return s.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"file-viewer",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[s.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e.path,N&&s.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),_&&d&&s.jsxs(Qd,{onClick:()=>g(w=>!w),active:m,children:[s.jsx(OM,{className:"size-3"}),u("files.preview")]}),o&&j&&(d?s.jsxs(s.Fragment,{children:[s.jsxs(Qd,{onClick:()=>{c(e.content??""),p(!1)},disabled:h,children:[s.jsx(ui,{className:"size-3"}),u("files.discard")]}),s.jsxs(Qd,{onClick:()=>void y(),disabled:!N||h,active:N,children:[h?s.jsx(_n,{size:10}):s.jsx(nu,{className:"size-3"}),u("files.save")]})]}):s.jsxs(Qd,{onClick:()=>p(!0),children:[s.jsx(ya,{className:"size-3"}),u("files.edit")]}))]}),_?d?s.jsx(hB,{value:l,onChange:c,showPreview:m,onSave:()=>void y()}):s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-4",children:s.jsx(BE,{content:e.content??""})}):e.kind==="text"?d?s.jsx("textarea",{value:l,onChange:w=>c(w.target.value),onKeyDown:w=>{(w.metaKey||w.ctrlKey)&&w.key==="s"&&(w.preventDefault(),y())},spellCheck:!1,className:"min-h-0 flex-1 resize-none bg-transparent p-4 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none"}):s.jsx(xB,{content:e.content??""}):e.kind==="image"&&e.encoding==="base64"?s.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-auto p-4",children:s.jsx("img",{src:`data:${e.mime};base64,${e.content}`,alt:e.name,className:"max-h-full max-w-full rounded object-contain"})}):s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-2 text-sm text-muted-foreground",children:[s.jsx($M,{className:"size-8 opacity-50"}),s.jsx("span",{children:e.too_large?u("files.too_large"):u("files.no_preview")}),s.jsxs("span",{className:"flex items-center gap-1 text-xs opacity-70",children:[s.jsx(LM,{className:"size-3"}),(e.size/1024).toFixed(1)," KB"]})]})]})}function bB(e){return e.kind==="project"?"project":`agent:${e.slug}`}function _B(e){return e.kind==="project"?".apc/memory.md":`agents/${e.slug}/memory.md`}function vB(e,t){return t.kind==="project"?Qn.memory.get(e).then(a=>a.body):cn.memory.get(e,t.slug).then(a=>a.body)}function yB(e,t,a){return t.kind==="project"?Qn.memory.put(e,a).then(()=>{}):cn.memory.put(e,t.slug,a).then(()=>{})}function rk({active:e,onClick:t,icon:a,iconClass:o,label:l,sub:c}){return s.jsxs("button",{type:"button",onClick:t,className:he("flex w-full items-center gap-2 rounded px-1.5 py-1 text-left text-[13px]",e?"bg-primary/15 text-foreground":"text-foreground/80 hover:bg-accent/40"),children:[s.jsx(a,{className:he("size-3.5 shrink-0",o??"text-muted-foreground")}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:l}),c&&s.jsx("span",{className:"shrink-0 truncate text-[11px] text-muted-foreground",children:c})]})}function jB({pid:e}){const t=Ze(),[a,o]=x.useState({kind:"project"}),l=qe(`/projects/${e}/agents`,()=>cn.list(e)),c=`/memory/${e}/${bB(a)}`,d=qe(c,()=>vB(e,a)),p=x.useMemo(()=>{if(d.data===void 0)return null;const h=d.data??"";return{path:_B(a),name:"memory.md",kind:"markdown",size:h.length,modified:"",encoding:"utf8",content:h}},[d.data,a]),m=async h=>{await yB(e,a,h),t.success(u("project.memories.saved")),d.mutate(h,{revalidate:!1})},g=l.data||[];return s.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden rounded-xl border border-border bg-card",children:[s.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-border",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[s.jsx(gf,{className:"size-4 text-muted-foreground"}),s.jsx("span",{className:"flex-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u("project.memories.sidebar_title")}),s.jsx("button",{type:"button",onClick:()=>{l.mutate(),d.mutate()},className:"text-muted-foreground hover:text-foreground","aria-label":u("common.refresh"),children:s.jsx(Vs,{className:l.isValidating?"size-3.5 animate-spin":"size-3.5"})})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:[s.jsx("p",{className:"px-1.5 pb-1 pt-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:u("project.memories.general_group")}),s.jsx(rk,{active:a.kind==="project",onClick:()=>o({kind:"project"}),icon:gf,iconClass:"text-sky-500",label:u("project.memories.general_item")}),s.jsx("p",{className:"px-1.5 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/60",children:u("project.memories.agents_title")}),l.isLoading?s.jsx("div",{className:"flex justify-center py-4",children:s.jsx(_n,{size:14})}):g.length===0?s.jsx("div",{className:"px-1.5 py-2",children:s.jsx(pt,{children:u("project.memories.no_agents")})}):g.map(h=>s.jsx(rk,{active:a.kind==="agent"&&a.slug===h.slug,onClick:()=>o({kind:"agent",slug:h.slug}),icon:h.is_master?xa:un,iconClass:h.is_master?"text-violet-400":"text-muted-foreground",label:h.slug,sub:h.role||void 0},h.slug))]})]}),s.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:s.jsx(UE,{file:p,loading:d.isLoading,onSave:m})})]})}function wB({pid:e}){return s.jsx("div",{className:"h-full",children:s.jsx(jB,{pid:e})})}const kB=/\.(html?|jsx|tsx|js)$/i;function SB({pid:e,entry:t,onDeleted:a,onRenamed:o,onRunInTerminal:l,onEditArtifact:c}){const[d,p]=x.useState(!1),[m,g]=x.useState(null),h=Ze(),[b,_]=x.useState(null),[j,N]=x.useState(!1),[y,w]=x.useState(!1),S=kB.test(t.name),[k,E]=x.useState(!1),[R,A]=x.useState(t.name),T=x.useRef(null),[z,O]=x.useState(!1),[B,P]=x.useState(!1),[U,D]=x.useState(!1),L=z?["artifact",e,t.name]:null,V=qe(L,()=>Xs.read(e,t.name),{revalidateOnFocus:!1}),H=!V.data?.content||V.data.content.startsWith("#!"),$=async W=>{try{await navigator.clipboard.writeText(W),h.info(u("modules_ui.code_copied"))}catch{}},F=async()=>{p(!0),g(null);try{const W=await Xs.run(e,t.name);g(W),W.ok?h.info(u("modules_ui.code_artifact_exit_ok",{ms:W.durationMs??0})):h.error(u("modules_ui.code_artifact_exit_fail",{code:W.exitCode??W.signal??"?",timeout:W.timedOut?u("modules_ui.code_artifact_timeout_suffix"):""}))}catch(W){h.error(W.message)}finally{p(!1)}},Y=async()=>{N(!0);try{const W=await Xs.preview(e,t.name);_(W),window.open(W.url,"_blank","noopener,noreferrer")}catch(W){h.error(W.message)}finally{N(!1)}},G=async()=>{if(b){w(!0);try{const W=await Xs.openTunnel(b.id);_({...b,tunnel:{id:W.id,url:W.url,provider:W.provider}}),window.open(W.url,"_blank","noopener,noreferrer")}catch(W){h.error(W.message)}finally{w(!1)}}},K=async()=>{if(b){try{await Xs.stopPreview(b.id)}catch{}_(null)}},I=async()=>{D(!0);try{await Xs.remove(e,t.name),P(!1),a()}catch(W){h.error(W.message)}finally{D(!1)}},X=()=>{A(t.name),E(!0),requestAnimationFrame(()=>T.current?.select())},Z=async()=>{const W=R.trim();if(E(!1),!(!W||W===t.name))try{await Xs.rename(e,t.name,W),o()}catch(fe){h.error(fe.message)}};return s.jsxs("li",{className:"rounded-md border border-border",children:[s.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1.5 text-xs",children:[s.jsx(gb,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),k?s.jsx("input",{ref:T,value:R,onChange:W=>A(W.target.value),onBlur:()=>void Z(),onKeyDown:W=>{W.key==="Enter"&&Z(),W.key==="Escape"&&E(!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"}):s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:t.name}),s.jsx($e,{content:u("code_module.artifacts_rename"),children:s.jsx("button",{type:"button",onClick:X,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(ya,{className:"size-3"})})}),s.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[t.size,"b"]})]}),s.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5",children:[s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted-foreground",children:t.path}),s.jsx($e,{content:u("code_module.artifacts_copy_path"),children:s.jsx("button",{type:"button",onClick:()=>void $(t.path),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(No,{className:"size-3"})})})]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[s.jsxs(Bx,{open:z,onOpenChange:O,children:[s.jsx($e,{content:u("code_module.artifacts_view"),children:s.jsxs("button",{type:"button",onClick:()=>O(!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:[s.jsx(eu,{className:"size-3"}),u("modules_ui.code_artifact_view_short")]})}),s.jsxs(Ux,{className:"sm:max-w-lg",children:[s.jsx($x,{children:s.jsx(Hx,{className:"font-mono text-sm",children:t.name})}),V.isLoading?s.jsx("div",{className:"flex justify-center py-6",children:s.jsx(_n,{size:16})}):s.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:V.data?.content??""}),s.jsx(Nw,{showCloseButton:!0})]})]}),c&&s.jsx($e,{content:u("code_module.artifacts_edit"),children:s.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:[s.jsx(g3,{className:"size-3"}),u("modules_ui.code_artifact_edit_short")]})}),H&&s.jsx($e,{content:u("code_module.artifacts_run"),children:s.jsxs("button",{type:"button",disabled:d,onClick:()=>l?l(`apx artifact run ${t.name}`):void F(),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 disabled:opacity-60 dark:text-emerald-300",children:[d?s.jsx(_n,{size:10}):s.jsx(yb,{className:"size-3"}),u("code_module.artifacts_run")]})}),S&&s.jsx($e,{content:u("code_module.artifacts_preview_hint"),children:s.jsxs("button",{type:"button",disabled:j,onClick:()=>void Y(),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-sky-500/15 text-sky-700 hover:bg-sky-500/25 disabled:opacity-60 dark:text-sky-300",children:[j?s.jsx(_n,{size:10}):s.jsx(mb,{className:"size-3"}),u("code_module.artifacts_preview")]})}),b&&!b.tunnel&&s.jsx($e,{content:u("code_module.artifacts_share_hint"),children:s.jsxs("button",{type:"button",disabled:y,onClick:()=>void G(),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-amber-500/15 text-amber-700 hover:bg-amber-500/25 disabled:opacity-60 dark:text-amber-300",children:[y?s.jsx(_n,{size:10}):s.jsx(f3,{className:"size-3"}),u("code_module.artifacts_share")]})}),s.jsxs(Bx,{open:B,onOpenChange:P,children:[s.jsx($e,{content:u("code_module.artifacts_delete"),children:s.jsx("button",{type:"button",onClick:()=>P(!0),className:"ml-auto rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:s.jsx(vn,{className:"size-3"})})}),s.jsxs(Ux,{className:"sm:max-w-sm",children:[s.jsx($x,{children:s.jsxs(Hx,{className:"font-mono text-sm",children:[u("code_module.artifacts_delete")," — ",t.name]})}),s.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:u("code_module.artifacts_delete_confirm")}),s.jsxs(Nw,{children:[s.jsx(JL,{render:s.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:u("common.cancel")}),s.jsxs("button",{type:"button",onClick:()=>void I(),disabled:U,className:he("inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-xs font-medium",U?"bg-muted text-muted-foreground":"bg-rose-500/15 text-rose-700 hover:bg-rose-500/25 dark:text-rose-300"),children:[U&&s.jsx(_n,{size:10}),u("code_module.delete")]})]})]})]})]}),s.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[u("code_module.artifacts_run_hint")," ",s.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",t.name]})]}),b&&s.jsxs("div",{className:"space-y-1 rounded border border-sky-500/30 bg-sky-500/5 p-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"shrink-0 text-[10px] font-medium text-muted-foreground",children:u("code_module.artifacts_preview_local")}),s.jsx("a",{href:b.url,target:"_blank",rel:"noopener noreferrer",className:"min-w-0 flex-1 truncate font-mono text-[10px] text-sky-700 underline hover:text-sky-900 dark:text-sky-300",children:b.url}),s.jsx($e,{content:u("code_module.artifacts_copy_url"),children:s.jsx("button",{type:"button",onClick:()=>void $(b.url),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(No,{className:"size-3"})})}),s.jsx($e,{content:u("code_module.artifacts_stop_preview"),children:s.jsx("button",{type:"button",onClick:()=>void K(),className:"shrink-0 rounded p-0.5 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:s.jsx(wb,{className:"size-3"})})})]}),b.tunnel&&s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"shrink-0 text-[10px] font-medium text-amber-700 dark:text-amber-300",children:u("code_module.artifacts_preview_public")}),s.jsx("a",{href:b.tunnel.url,target:"_blank",rel:"noopener noreferrer",className:"min-w-0 flex-1 truncate font-mono text-[10px] text-amber-700 underline hover:text-amber-900 dark:text-amber-300",children:b.tunnel.url}),s.jsx("span",{className:"shrink-0 font-mono text-[9px] text-muted-foreground",children:b.tunnel.provider}),s.jsx($e,{content:u("code_module.artifacts_copy_url"),children:s.jsx("button",{type:"button",onClick:()=>void $(b.tunnel.url),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(No,{className:"size-3"})})})]})]}),m&&s.jsxs("div",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[s.jsx("span",{className:he("rounded px-1.5 py-0.5 font-mono",m.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-rose-500/15 text-rose-700 dark:text-rose-300"),children:u("modules_ui.code_artifact_exit_badge",{code:m.exitCode??m.signal??"?"})}),m.timedOut&&s.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:u("modules_ui.code_artifact_timeout")}),m.truncated&&s.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:u("modules_ui.code_artifact_truncated")}),s.jsxs("span",{className:"font-mono text-muted-foreground",children:[m.durationMs,"ms"]})]}),m.stdout&&s.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:m.stdout}),m.stderr&&s.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 $E({pid:e,onRunInTerminal:t,onEditArtifact:a}){const o=qe(e?["artifacts",e]:null,()=>Xs.list(e)),l=o.data||[];return s.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:l.length>0?u("code_module.artifacts_count",{n:l.length}):""}),s.jsx($e,{content:u("code_module.reload"),children:s.jsx("button",{type:"button",onClick:()=>void o.mutate(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o.isLoading?s.jsx(_n,{size:12}):s.jsx(Vs,{className:"size-3"})})})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:l.length===0?s.jsx(pt,{children:u("code_module.artifacts_none")}):s.jsx("ul",{className:"space-y-1.5",children:l.map(c=>s.jsx(SB,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:t,onEditArtifact:a},c.name))})})]})}function CB({pid:e}){const t=Pn(),a=o=>{const l=new URLSearchParams({pid:e,...o}).toString();t(`/m/code?${l}`)};return s.jsx(Ye,{title:u("project.artifacts.title"),description:u("project.artifacts.subtitle"),fullHeight:!0,className:"min-h-[24rem]",children:s.jsx($E,{pid:e,onRunInTerminal:o=>a({cmd:o}),onEditArtifact:o=>a({edit:o})})})}function NB({pid:e}){const t=Ze(),a=qe(`/projects/${e}/organization`,()=>Br.get(e)),[o,l]=x.useState(null),[c,d]=x.useState(null),[p,m]=x.useState(null),g=()=>void a.mutate(),h=a.data?.areas??[],b=a.data?.roles??[],_=N=>b.filter(y=>y.area===N),j=async()=>{p&&(p.kind==="area"?await Br.removeArea(e,p.slug):await Br.removeRole(e,p.slug),t.success(u("common.deleted")),g())};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ye,{title:u("structure.title"),description:u("structure.subtitle"),action:s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(se,{size:"sm",variant:"secondary","data-testid":"structure-new-area",onClick:()=>l({}),children:[s.jsx(It,{className:"size-3.5"}),u("structure.new_area")]}),s.jsxs(se,{size:"sm",variant:"primary",onClick:()=>d({}),children:[s.jsx(It,{className:"size-3.5"}),u("structure.new_role")]})]}),children:[s.jsxs("div",{className:"mb-4 flex items-start gap-2 rounded-lg border border-sky-500/20 bg-sky-500/5 px-3 py-2 text-[13px] text-muted-foreground",children:[s.jsx(YS,{className:"mt-0.5 size-4 shrink-0 text-sky-500"}),s.jsx("span",{children:u("structure.info")})]}),a.isLoading?s.jsx(rt,{}):h.length===0&&b.length===0?s.jsx(pt,{children:u("structure.empty")}):s.jsxs("div",{className:"grid gap-3 md:grid-cols-2 xl:grid-cols-3",children:[h.map(N=>s.jsxs("div",{className:"group rounded-lg border border-border bg-card/50 p-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(qS,{className:"mt-0.5 size-4 shrink-0 text-emerald-500"}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"truncate text-sm font-semibold",children:N.name}),s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:N.slug})]}),N.goal&&s.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:N.goal})]}),s.jsxs("div",{className:"flex shrink-0 gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[s.jsx("button",{type:"button",onClick:()=>l({editing:N}),className:"text-muted-foreground hover:text-foreground","aria-label":u("common.edit"),children:s.jsx(ya,{className:"size-3.5"})}),s.jsx("button",{type:"button",onClick:()=>m({kind:"area",slug:N.slug,name:N.name}),className:"text-muted-foreground hover:text-red-500","aria-label":u("common.delete"),children:s.jsx(vn,{className:"size-3.5"})})]})]}),s.jsxs("div",{className:"mt-3 border-t border-border/60 pt-2",children:[s.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[s.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[u("structure.roles")," (",_(N.slug).length,")"]}),s.jsxs("button",{type:"button",onClick:()=>d({presetArea:N.slug}),className:"text-[11px] text-sky-500 hover:text-sky-400",children:["+ ",u("structure.add_role")]})]}),s.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[_(N.slug).map(y=>s.jsx(ok,{role:y,onEdit:()=>d({editing:y}),onDelete:()=>m({kind:"role",slug:y.slug,name:y.name})},y.slug)),_(N.slug).length===0&&s.jsx("span",{className:"text-[11px] text-muted-foreground/60",children:u("structure.no_roles")})]})]})]},N.slug)),_(null).length>0&&s.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-card/30 p-3",children:[s.jsxs("div",{className:"mb-2 flex items-center gap-2 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:[s.jsx(LS,{className:"size-3.5"}),u("structure.general_roles")]}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:_(null).map(N=>s.jsx(ok,{role:N,onEdit:()=>d({editing:N}),onDelete:()=>m({kind:"role",slug:N.slug,name:N.name})},N.slug))})]})]})]}),s.jsx(cE,{open:!!o,onClose:()=>l(null),pid:e,editing:o?.editing,onSaved:g}),s.jsx(uE,{open:!!c,onClose:()=>d(null),pid:e,areas:h,editing:c?.editing,presetArea:c?.presetArea,onSaved:g}),s.jsx(mE,{open:!!p,onClose:()=>m(null),onConfirm:j,title:p?.kind==="area"?u("structure.delete_area"):u("structure.delete_role"),description:p?.kind==="area"?u("structure.delete_area_desc",{name:p?.name??""}):u("structure.delete_role_desc",{name:p?.name??""}),confirmLabel:u("common.delete")})]})}function ok({role:e,onEdit:t,onDelete:a}){return s.jsxs("span",{className:"group/chip inline-flex items-center gap-1 rounded-md border border-border bg-background px-1.5 py-0.5 text-[11px]",children:[s.jsx(LS,{className:"size-3 text-muted-foreground"}),s.jsx("span",{children:e.name}),s.jsx("button",{type:"button",onClick:t,className:"opacity-0 transition-opacity group-hover/chip:opacity-100 text-muted-foreground hover:text-foreground","aria-label":u("common.edit"),children:s.jsx(ya,{className:"size-2.5"})}),s.jsx("button",{type:"button",onClick:a,className:"opacity-0 transition-opacity group-hover/chip:opacity-100 text-muted-foreground hover:text-red-500","aria-label":u("common.delete"),children:s.jsx(vn,{className:"size-2.5"})})]})}function EB(e){switch(e){case"markdown":return{Icon:Kf,color:"text-sky-500"};case"text":return{Icon:BM,color:"text-amber-500"};case"image":return{Icon:gx,color:"text-pink-500"};default:return{Icon:HS,color:"text-muted-foreground"}}}function RB(e){const t=e.split("/"),a=[];for(let o=1;o<t.length;o++)a.push(t.slice(0,o).join("/"));return a}function HE({node:e,depth:t,selectedPath:a,expanded:o,toggle:l,onSelect:c,onDelete:d}){const p=e.type==="dir",m=o.has(e.path),g=a===e.path,{Icon:h,color:b}=p?{Icon:m?ci:VS,color:"text-muted-foreground"}:EB(e.kind);return s.jsxs("div",{children:[s.jsxs("div",{className:he("group flex items-center gap-1 rounded px-1.5 py-1 text-[13px] cursor-pointer",g?"bg-primary/15 text-foreground":"hover:bg-accent/40 text-foreground/80"),style:{paddingLeft:t*12+6},onClick:()=>p?l(e.path):c(e),children:[p?m?s.jsx(ms,{className:"size-3.5 shrink-0 text-muted-foreground"}):s.jsx(Fr,{className:"size-3.5 shrink-0 text-muted-foreground"}):s.jsx("span",{className:"w-3.5 shrink-0"}),s.jsx(h,{className:he("size-3.5 shrink-0",b)}),s.jsx("span",{className:"min-w-0 flex-1 truncate",children:e.name}),d&&!p&&s.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),d(e)},className:"opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-red-500","aria-label":`delete ${e.name}`,children:s.jsx(vn,{className:"size-3.5"})})]}),p&&m&&e.children?.map(_=>s.jsx(HE,{node:_,depth:t+1,selectedPath:a,expanded:o,toggle:l,onSelect:c,onDelete:d},_.path))]})}function TB({nodes:e,selectedPath:t,onSelect:a,onDelete:o,className:l}){const[c,d]=x.useState(()=>new Set);x.useEffect(()=>{t&&d(m=>{const g=new Set(m);for(const h of RB(t))g.add(h);return g})},[t]);const p=m=>d(g=>{const h=new Set(g);return h.has(m)?h.delete(m):h.add(m),h});return s.jsx("div",{className:he("select-none",l),children:e.map(m=>s.jsx(HE,{node:m,depth:0,selectedPath:t,expanded:c,toggle:p,onSelect:a,onDelete:o},m.path))})}function AB({open:e,onClose:t,pid:a,scope:o,onCreated:l}){const c=Ze(),[d,p]=x.useState(""),[m,g]=x.useState(!1),h=async()=>{let b=d.trim().replace(/^\/+/,"");if(b){/\.[a-z0-9]+$/i.test(b)||(b+=".md"),g(!0);try{await kc.write(a,b,"",o),c.success(u("files.created")),p(""),l(b)}catch(_){c.error(_ instanceof Error?_.message:String(_))}finally{g(!1)}}};return s.jsx(Zt,{open:e,onClose:t,title:u("files.new_doc"),description:u("files.new_doc_hint"),footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,children:u("common.cancel")}),s.jsx(se,{variant:"primary","data-testid":"new-file-create",onClick:()=>void h(),loading:m,disabled:!d.trim(),children:u("files.create")})]}),children:s.jsx(ae,{label:u("files.path_label"),hint:u("files.path_example"),children:s.jsx(Ne,{autoFocus:!0,"data-testid":"new-file-path",value:d,onChange:b=>p(b.target.value),onKeyDown:b=>{b.key==="Enter"&&h()},placeholder:"cases/onboarding/spec.md"})})})}function qE({pid:e,scope:t,editable:a=!1,emptyHint:o}){const l=Ze(),[c,d]=x.useState(null),[p,m]=x.useState(!1),g=`/projects/${e}/fs/tree?scope=${t}`,h=qe(g,()=>kc.tree(e,t)),b=c?`/projects/${e}/fs/file?scope=${t}&path=${c}`:null,_=qe(b,()=>c?kc.read(e,c,t):null),j=E=>d(E.path),N=a?async E=>{c&&(await kc.write(e,c,E,t),l.success(u("files.saved")),_.mutate())}:void 0,y=a?async E=>{await kc.remove(e,E.path,t),c===E.path&&d(null),l.success(u("files.deleted")),h.mutate()}:void 0,w=E=>{m(!1),d(E),h.mutate()},S=h.data?.tree??[],k=!h.isLoading&&S.length===0;return s.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden rounded-xl border border-border bg-card",children:[s.jsxs("div",{className:"flex w-64 shrink-0 flex-col border-r border-border",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-2",children:[s.jsx(ci,{className:"size-4 text-muted-foreground"}),s.jsx("span",{className:"flex-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:u(t==="docs"?"files.docs_label":"files.files_label")}),a&&s.jsx("button",{type:"button","data-testid":"docs-new",onClick:()=>m(!0),className:"text-muted-foreground hover:text-foreground","aria-label":u("files.new_doc"),title:u("files.new_doc"),children:s.jsx(px,{className:"size-4"})}),s.jsx("button",{type:"button",onClick:()=>void h.mutate(),className:"text-muted-foreground hover:text-foreground","aria-label":u("common.refresh"),children:s.jsx(Vs,{className:h.isValidating?"size-3.5 animate-spin":"size-3.5"})})]}),s.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto p-1.5",children:[h.isLoading?s.jsx("div",{className:"flex justify-center py-6",children:s.jsx(_n,{size:14})}):k?s.jsx("div",{className:"p-3",children:s.jsx(pt,{children:s.jsxs("div",{className:"space-y-2",children:[s.jsx("p",{children:o??u("files.empty")}),a&&s.jsxs(se,{size:"sm",variant:"secondary",onClick:()=>m(!0),children:[s.jsx(px,{className:"size-3.5"}),u("files.new_doc")]})]})})}):s.jsx(TB,{nodes:S,selectedPath:c,onSelect:j,onDelete:y}),h.data?.truncated&&s.jsx("p",{className:"px-2 py-1 text-[10px] text-muted-foreground/60",children:u("files.truncated")})]})]}),s.jsx("div",{className:"flex min-w-0 flex-1 flex-col",children:s.jsx(UE,{file:_.data??null,loading:!!b&&_.isLoading,onSave:N})}),a&&s.jsx(AB,{open:p,onClose:()=>m(!1),pid:e,scope:t,onCreated:w})]})}function MB({pid:e}){return s.jsx("div",{className:"h-full",children:s.jsx(qE,{pid:e,scope:"docs",editable:!0,emptyHint:u("files.docs_empty")})})}function OB({pid:e}){return s.jsx("div",{className:"h-full",children:s.jsx(qE,{pid:e,scope:"project"})})}const Oh="default";function zB(e){const t=e.replace(/\/+$/,"").split("/");return t[t.length-1]||e}function VE(e){return e==="builtin"?{label:u("skills_page.source_builtin"),tone:"info"}:e==="project"?{label:u("skills_page.source_project"),tone:"success"}:{label:u("skills_page.source_global"),tone:"muted"}}function zh(e){const t=[],a=/(\*\*[^*]+\*\*|`[^`]+`)/g;let o=0,l,c=0;for(;l=a.exec(e);){l.index>o&&t.push(e.slice(o,l.index));const d=l[0];d.startsWith("**")?t.push(s.jsx("strong",{children:d.slice(2,-2)},c++)):t.push(s.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-[0.85em]",children:d.slice(1,-1)},c++)),o=l.index+d.length}return o<e.length&&t.push(e.slice(o)),t}function DB(e){const t=e.split(`
|
|
789
|
+
`),a=[];let o=0,l=0;for(;o<t.length;){const c=t[o];if(c.trim().startsWith("```")){const m=[];for(o++;o<t.length&&!t[o].trim().startsWith("```");)m.push(t[o]),o++;o++,a.push(s.jsx("pre",{className:"my-2 overflow-x-auto rounded-md border border-border bg-muted/50 p-3 text-xs",children:s.jsx("code",{children:m.join(`
|
|
790
|
+
`)})},l++));continue}const d=c.match(/^(#{1,4})\s+(.*)$/);if(d){const m=d[1].length,g=m===1?"mt-4 mb-1 text-lg font-semibold":m===2?"mt-3 mb-1 text-base font-semibold":"mt-2 mb-0.5 text-sm font-semibold";a.push(s.jsx("div",{className:g,children:zh(d[2])},l++)),o++;continue}if(/^\s*[-*]\s+/.test(c)){const m=[];for(;o<t.length&&/^\s*[-*]\s+/.test(t[o]);)m.push(s.jsx("li",{children:zh(t[o].replace(/^\s*[-*]\s+/,""))},m.length)),o++;a.push(s.jsx("ul",{className:"my-1 list-disc space-y-0.5 pl-5 text-sm",children:m},l++));continue}if(c.trim()===""){o++;continue}const p=[];for(;o<t.length&&t[o].trim()!==""&&!/^(#{1,4})\s/.test(t[o])&&!/^\s*[-*]\s+/.test(t[o])&&!t[o].trim().startsWith("```");)p.push(t[o]),o++;a.push(s.jsx("p",{className:"my-1.5 text-sm leading-relaxed",children:zh(p.join(" "))},l++))}return a}function PB(e){return new Promise((t,a)=>{const o=new FileReader;o.onload=()=>t(String(o.result).replace(/^data:.*;base64,/,"")),o.onerror=()=>a(new Error("read failed")),o.readAsDataURL(e)})}function FE({scope:e,selectable:t=!1}){const a=Ze(),[o,l]=x.useState(e??Oh),c=e??o,d=c===Oh?void 0:c,[p,m]=x.useState(!1),[g,h]=x.useState(null),[b,_]=x.useState("preview"),[j,N]=x.useState(!1),[y,w]=x.useState(!1),S=x.useRef(null),{data:k}=qe(t?"/projects":null,()=>Qn.list()),E=x.useMemo(()=>[{value:Oh,label:u("skills_page.scope_super_agent")},...(k??[]).map(F=>({value:F.path,label:F.name||zB(F.path)}))],[k]),{data:R,mutate:A,isLoading:T}=qe(["/skills",c],()=>Bs.list(d)),z=x.useMemo(()=>R?.skills??[],[R]),O=z.filter(F=>F.enabled!==!1).length,B=g&&z.some(F=>F.slug===g)?g:z[0]?.slug??null,{data:P}=qe(B?["/skill-detail",c,B]:null,()=>Bs.detail(B,d)),U=async(F,Y)=>{m(!0);try{await Bs.setEnabled({slug:F,enabled:Y,scope:c}),await A()}catch(G){a.error(u("skills_page.toggle_failed",{msg:G.message}))}finally{m(!1)}},D=async F=>{if(window.confirm(u("skills_page.delete_confirm",{slug:F}))){m(!0);try{await Bs.remove(F,d),a.success(u("skills_page.deleted_ok",{slug:F})),g===F&&h(null),await A()}catch(Y){a.error(u("skills_page.delete_failed",{msg:Y.message}))}finally{m(!1)}}},L=async(F,Y)=>{a.success(Y),h(F),await A()},V=async(F,Y,G)=>{await Bs.create({slug:F,description:Y,body:G,project_path:d}),await L(F,u("skills_page.created_ok",{slug:F}))},H=async F=>{const Y=await Bs.importRepo({url:F,project_path:d});await L(Y.slug,u("skills_page.imported_ok",{slug:Y.slug}))},$=async F=>{if(F){m(!0);try{const Y=await PB(F),G=await Bs.importZip({data:Y,project_path:d});await L(G.slug,u("skills_page.imported_ok",{slug:G.slug}))}catch(Y){a.error(u("skills_page.import_failed",{msg:Y.message}))}finally{m(!1),S.current&&(S.current.value="")}}};return s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[t?s.jsx("div",{className:"w-64",children:s.jsx(ut,{value:c,onChange:F=>{l(F),h(null)},options:E,placeholder:u("skills_page.scope_ph")})}):null,s.jsx(He,{tone:"muted",children:u("skills_page.count_label",{n:z.length,on:O})})]}),s.jsxs(v_,{children:[s.jsxs(y_,{disabled:p,className:"inline-flex h-9 items-center gap-1.5 rounded-md bg-primary px-3 text-sm font-medium text-primary-foreground hover:opacity-90 disabled:opacity-50",children:[s.jsx(It,{size:15})," ",u("skills_page.add_menu")," ",s.jsx(ms,{size:14})]}),s.jsxs(j_,{align:"end",sideOffset:6,className:"w-72",children:[s.jsxs(lf,{onClick:()=>N(!0),children:[s.jsx(l3,{size:15,className:"text-muted-fg"}),s.jsx(Dh,{title:u("skills_page.add_online"),hint:u("skills_page.add_online_hint")})]}),s.jsxs(lf,{onClick:()=>S.current?.click(),children:[s.jsx(e2,{size:15,className:"text-muted-fg"}),s.jsx(Dh,{title:u("skills_page.add_zip"),hint:u("skills_page.add_zip_hint")})]}),s.jsxs(lf,{onClick:()=>w(!0),children:[s.jsx(tu,{size:15,className:"text-muted-fg"}),s.jsx(Dh,{title:u("skills_page.add_repo"),hint:u("skills_page.add_repo_hint")})]})]})]}),s.jsx("input",{ref:S,type:"file",accept:".zip",className:"hidden",onChange:F=>$(F.target.files?.[0])})]}),T||!R?s.jsx(rt,{}):s.jsxs("div",{className:"grid min-h-[62vh] gap-4 lg:grid-cols-[20rem_1fr]",children:[s.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:s.jsx("ul",{className:"max-h-[62vh] divide-y divide-border overflow-y-auto",children:z.length===0?s.jsx("li",{className:"px-3 py-4 text-sm text-muted-fg",children:u("skills_page.empty")}):z.map(F=>s.jsx(LB,{skill:F,active:F.slug===B,busy:p,onSelect:()=>h(F.slug),onToggle:Y=>U(F.slug,Y)},F.slug))})}),s.jsx("div",{className:"min-w-0 overflow-hidden rounded-xl border border-border bg-card",children:B?P?s.jsxs("div",{className:"flex h-full max-h-[62vh] flex-col",children:[s.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border px-5 py-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx("code",{className:"text-sm font-semibold",children:P.slug}),(()=>{const F=VE(P.source);return s.jsx(He,{tone:F.tone,children:F.label})})(),P.private&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-fg",children:[s.jsx(XS,{size:11})," ",u("skills_page.private_badge")]})]}),P.description&&s.jsx("p",{className:"mt-1 text-sm text-muted-fg",children:P.description}),s.jsxs("div",{className:"mt-2 flex flex-wrap gap-x-6 gap-y-1 text-xs text-muted-fg",children:[s.jsxs("span",{children:[u("skills_page.added_by"),": ",s.jsx("span",{className:"text-foreground",children:P.private?u("skills_page.by_apx"):u("skills_page.by_you")})]}),s.jsxs("span",{children:[u("skills_page.activator"),": ",s.jsx("span",{className:"text-foreground",children:u("skills_page.activator_value")})]})]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[(P.source==="global"||P.source==="project")&&s.jsx($e,{content:u("skills_page.delete_btn"),children:s.jsx(se,{variant:"ghost",size:"sm",disabled:p,onClick:()=>D(P.slug),"aria-label":u("skills_page.delete_btn"),children:s.jsx(vn,{size:14})})}),s.jsx(Bt,{checked:P.private?!0:P.enabled,disabled:p||P.private,onChange:F=>U(P.slug,F),label:P.private||P.enabled?u("skills_page.on"):u("skills_page.off")})]})]}),s.jsxs("div",{className:"flex items-center gap-1 border-b border-border px-4 py-2",children:[s.jsx(lk,{active:b==="preview",onClick:()=>_("preview"),icon:Kf,label:u("skills_page.tab_preview")}),s.jsx(lk,{active:b==="source",onClick:()=>_("source"),icon:MM,label:u("skills_page.tab_source")})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:b==="preview"?s.jsx("div",{className:"prose-none",children:DB(P.body||"")}):s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-xs leading-relaxed text-muted-fg",children:P.body})})]}):s.jsx("div",{className:"p-6",children:s.jsx(rt,{})}):s.jsx("div",{className:"grid h-full place-items-center p-8 text-sm text-muted-fg",children:u("skills_page.select_a_skill")})})]}),s.jsx(IB,{open:j,onClose:()=>N(!1),onCreate:V}),s.jsx(BB,{open:y,onClose:()=>w(!1),onImport:H})]})}function Dh({title:e,hint:t}){return s.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[s.jsx("span",{className:"font-medium",children:e}),s.jsx("span",{className:"text-[11px] text-muted-fg",children:t})]})}function lk({active:e,onClick:t,icon:a,label:o}){return s.jsxs("button",{type:"button",onClick:t,className:`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition ${e?"bg-accent text-foreground":"text-muted-fg hover:text-foreground"}`,children:[s.jsx(a,{size:13})," ",o]})}function LB({skill:e,active:t,busy:a,onSelect:o,onToggle:l}){const c=VE(e.source),d=e.private?!0:e.enabled!==!1;return s.jsx("li",{children:s.jsxs("div",{className:`flex items-center gap-2 px-3 py-2.5 ${t?"bg-accent/50":"hover:bg-accent/25"}`,children:[s.jsxs("button",{type:"button",onClick:o,className:"min-w-0 flex-1 text-left",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("code",{className:"truncate text-[13px] font-medium",children:e.slug}),e.private&&s.jsx(XS,{size:10,className:"shrink-0 text-muted-fg"})]}),s.jsxs("div",{className:"mt-0.5 flex items-center gap-1.5",children:[s.jsx(He,{tone:c.tone,children:c.label}),e.overridden&&s.jsx(He,{tone:"warning",children:u("skills_page.overridden_badge")})]})]}),s.jsx(Bt,{checked:d,disabled:a||e.private,onChange:l})]})})}function IB({open:e,onClose:t,onCreate:a}){const o=Ze(),[l,c]=x.useState(""),[d,p]=x.useState(""),[m,g]=x.useState(""),[h,b]=x.useState(!1),_=/^[a-z0-9][a-z0-9-]*$/.test(l),j=()=>{c(""),p(""),g("")},N=async()=>{if(_){b(!0);try{await a(l,d,m),j(),t()}catch(y){o.error(u("skills_page.create_failed",{msg:y.message}))}finally{b(!1)}}};return s.jsx(Zt,{open:e,onClose:t,title:u("skills_page.create_dialog_title"),description:u("skills_page.add_desc"),size:"lg",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:h,children:u("skills_page.cancel")}),s.jsxs(se,{variant:"primary",onClick:N,disabled:h||!_,loading:h,children:[s.jsx(It,{size:14})," ",u("skills_page.add_btn")]})]}),children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[s.jsx(ae,{label:u("skills_page.add_slug_label"),children:s.jsx(Ne,{value:l,placeholder:u("skills_page.add_slug_ph"),disabled:h,onChange:y=>c(y.target.value.toLowerCase())})}),s.jsx(ae,{label:u("skills_page.add_desc_label"),children:s.jsx(Ne,{value:d,placeholder:u("skills_page.add_desc_ph"),disabled:h,onChange:y=>p(y.target.value)})})]}),s.jsx(ae,{label:u("skills_page.add_body_label"),children:s.jsx(on,{value:m,placeholder:u("skills_page.add_body_ph"),disabled:h,rows:10,onChange:y=>g(y.target.value)})})]})})}function BB({open:e,onClose:t,onImport:a}){const o=Ze(),[l,c]=x.useState(""),[d,p]=x.useState(!1),m=/^(https?:\/\/|git@|ssh:\/\/|git:\/\/)\S+$/.test(l.trim()),g=async()=>{if(m){p(!0);try{await a(l.trim()),c(""),t()}catch(h){o.error(u("skills_page.import_failed",{msg:h.message}))}finally{p(!1)}}};return s.jsx(Zt,{open:e,onClose:t,title:u("skills_page.repo_dialog_title"),size:"md",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:d,children:u("skills_page.cancel")}),s.jsxs(se,{variant:"primary",onClick:g,disabled:d||!m,loading:d,children:[s.jsx(tu,{size:14})," ",u("skills_page.import_btn")]})]}),children:s.jsx(ae,{label:u("skills_page.repo_url_label"),hint:u("skills_page.repo_url_hint"),children:s.jsx(Ne,{value:l,placeholder:u("skills_page.repo_url_ph"),disabled:d,onChange:h=>c(h.target.value),onKeyDown:h=>{h.key==="Enter"&&g()}})})})}function UB({pid:e}){const{project:t}=du(e),a=e==="0"?"default":t?.path;return a?s.jsx(FE,{scope:a}):s.jsx(rt,{})}function $B(){const e=Pn(),t=ts(),{pid:a=""}=CS(),{project:o}=du(a),{collapsed:l,toggle:c}=S_(zn.sidebarCollapsed+".project"),d=String(a)==="0",p=x.useMemo(()=>{const h=!d&&o?.kind==="company";return[d?{title:u("base.nav_general"),items:[{key:"workspaces",label:u("base.workspaces_title"),icon:yM},{key:"models",label:u("settings.tabs.engines"),icon:pb},{key:"agent-defaults",label:u("base.defaults_title"),icon:un}]}:null,{title:u("project.sections.workspace"),items:[{key:"",label:u("project.nav.overview"),icon:ZM},...h?[{key:"structure",label:u("project.nav.structure"),icon:wM}]:[],{key:"agents",label:u("project.nav.agents"),icon:un},{key:"memories",label:u("project.nav.memories"),icon:gf},{key:"skills",label:u("skills_page.title"),icon:ea},{key:"artifacts",label:u("project.nav.artifacts"),icon:gb}]},{title:u("base.nav_activity"),items:[{key:"chat",label:u("project.nav.chat"),icon:bb},{key:"sessions",label:u("base.sessions_title"),icon:XM},{key:"logs",label:u("project.nav.logs"),icon:jb}]},d?null:{title:u("project.sections.content"),items:[{key:"docs",label:u("project.nav.docs"),icon:Kf},{key:"files",label:u("project.nav.files"),icon:hb}]},{title:u("project.sections.automation"),items:[{key:"routines",label:u("project.nav.routines"),icon:Kl},{key:"tasks",label:u("project.nav.tasks"),icon:su},{key:"mcps",label:u("project.nav.mcps"),icon:Qf},{key:"integrations",label:"Integrations",icon:kM},{key:"vars",label:u("project.nav.vars"),icon:KS}]},{title:u("project.sections.config"),items:[{key:"config",label:u("project.nav.config"),icon:Wf}]}].filter(Boolean)},[d,o?.kind]),m=t.pathname.replace(`/p/${a}`,"").replace(/^\//,"").split("/")[0];if(!o)return s.jsx(HN,{testId:"screen-project-not-found",mood:"confused",message:u("project.not_found",{pid:a}),action:s.jsx(ar,{variant:"outline",onClick:()=>e("/"),children:u("not_found.home")})});const g=h=>{const b=h?`/p/${a}/${h}`:`/p/${a}`;e(b)};return s.jsx(UN,{sections:p,active:m,onChange:g,collapsed:l,onToggleCollapse:c,contentClassName:"w-full space-y-6 py-6 pt-3 pr-6 pl-1",testId:`project-tab-${m||"overview"}`,children:s.jsxs(TS,{children:[s.jsx(Dt,{index:!0,element:s.jsx(Rw,{pid:a})}),s.jsx(Dt,{path:"workspaces",element:s.jsx(b6,{})}),s.jsx(Dt,{path:"models",element:s.jsx(sE,{})}),s.jsx(Dt,{path:"agent-defaults",element:s.jsx(CI,{})}),s.jsx(Dt,{path:"sessions",element:s.jsx(MI,{pid:a})}),s.jsx(Dt,{path:"logs",element:s.jsx(iI,{pid:a})}),s.jsx(Dt,{path:"config",element:s.jsx(WI,{pid:a})}),s.jsx(Dt,{path:"telegram",element:s.jsx(iE,{pid:a})}),s.jsx(Dt,{path:"agents",element:s.jsx(J8,{pid:a})}),s.jsx(Dt,{path:"agents/:slug",element:s.jsx(V8,{pid:a})}),s.jsx(Dt,{path:"structure",element:s.jsx(NB,{pid:a})}),s.jsx(Dt,{path:"docs",element:s.jsx(MB,{pid:a})}),s.jsx(Dt,{path:"files",element:s.jsx(OB,{pid:a})}),s.jsx(Dt,{path:"memories",element:s.jsx(wB,{pid:a})}),s.jsx(Dt,{path:"skills",element:s.jsx(UB,{pid:a})}),s.jsx(Dt,{path:"routines",element:s.jsx(p7,{pid:a})}),s.jsx(Dt,{path:"tasks",element:d?s.jsx(OI,{}):s.jsx(g7,{pid:a})}),s.jsx(Dt,{path:"mcps",element:s.jsx(N7,{pid:a})}),s.jsx(Dt,{path:"integrations",element:s.jsx(H7,{pid:a})}),s.jsx(Dt,{path:"artifacts",element:s.jsx(CB,{pid:a})}),s.jsx(Dt,{path:"vars",element:s.jsx(q7,{pid:a})}),s.jsx(Dt,{path:"threads",element:s.jsx(O5,{to:`/p/${a}/chat`,replace:!0})}),s.jsx(Dt,{path:"chat",element:s.jsx(pB,{pid:a})}),s.jsx(Dt,{path:"*",element:s.jsx(Rw,{pid:a})})]})})}function HB({value:e,onChange:t,options:a,placeholder:o,className:l}){const c=k=>a.find(E=>E.value===k)?.label??k,[d,p]=x.useState(!1),[m,g]=x.useState(c(e)),h=x.useRef(null),b=x.useRef(null),[_,j]=x.useState(null);x.useEffect(()=>{g(c(e))},[e,a]),x.useLayoutEffect(()=>{if(!d)return;const k=()=>{const E=h.current;if(!E)return;const R=E.getBoundingClientRect();j({top:R.bottom+4,left:R.left,width:R.width})};return k(),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),()=>{window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)}},[d]),x.useEffect(()=>{if(!d)return;const k=E=>{const R=E.target;h.current?.contains(R)||b.current?.contains(R)||(g(c(e)),p(!1))};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[d,e,a]);const N=m.trim().toLowerCase(),y=m===c(e),w=N&&!y?a.filter(k=>k.label.toLowerCase().includes(N)||k.value.toLowerCase().includes(N)):a,S=k=>{t(k.value),g(k.label),p(!1)};return s.jsxs("div",{ref:h,className:he("relative",l),children:[s.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:[s.jsx("input",{value:m,placeholder:o,onChange:k=>{g(k.target.value),p(!0)},onFocus:()=>p(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),s.jsx("button",{type:"button",tabIndex:-1,onClick:()=>p(k=>!k),className:"shrink-0 text-muted-fg hover:text-foreground",children:s.jsx(ms,{className:"size-4"})})]}),d&&w.length>0&&_&&qs.createPortal(s.jsx("ul",{ref:b,style:{position:"fixed",top:_.top,left:_.left,width:_.width},className:"z-[1000] max-h-60 overflow-y-auto rounded-lg bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:w.map(k=>s.jsx("li",{children:s.jsx("button",{type:"button",onMouseDown:E=>{E.preventDefault(),S(k)},className:he("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",k.value===e&&"bg-accent/50"),children:s.jsx("span",{className:"truncate font-mono text-xs",children:k.label})})},k.value))}),document.body)]})}const qB=["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 VB(e){return e&&e.charAt(0).toLocaleUpperCase()+e.slice(1)}function FB(){const e=k_();let t=null;try{t=new Intl.DisplayNames([e],{type:"language"})}catch{t=null}return qB.map(a=>{const o=t?.of(a);return{value:a,label:o?VB(o):a}}).sort((a,o)=>a.label.localeCompare(o.label,e))}const GB=["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 YB(){try{const e=Intl.supportedValuesOf;if(typeof e=="function")return e("timeZone")}catch{}return GB}function ik(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function KB(e,t){try{const a=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).formatToParts(t).find(c=>c.type==="timeZoneName")?.value??"GMT",o=/GMT([+-])(\d{1,2})(?::(\d{2}))?/.exec(a);return o?(o[1]==="-"?-1:1)*(parseInt(o[2],10)*60+(o[3]?parseInt(o[3],10):0)):0}catch{return 0}}function XB(e){const t=e<0?"-":"+",a=Math.abs(e),o=String(Math.floor(a/60)).padStart(2,"0"),l=String(a%60).padStart(2,"0");return`GMT${t}${o}:${l}`}let Wd=null;function QB(){if(Wd)return Wd;const e=new Date;return Wd=YB().map(t=>({value:t,label:t,off:KB(t,e)})).sort((t,a)=>t.off-a.off||t.value.localeCompare(a.value)).map(({value:t,off:a})=>({value:t,label:`(${XB(a)}) ${t}`})),Wd}function WB(){const e=Ze(),{identity:t,isLoading:a,save:o}=R_(),[l,c]=x.useState({}),[d,p]=x.useState(!1),m=x.useMemo(()=>QB(),[]);if(x.useEffect(()=>{c({...t,timezone:t?.timezone||ik()})},[t]),a)return s.jsx(rt,{});const g=async()=>{p(!0);try{await o({owner_name:l.owner_name,owner_context:l.owner_context,language:l.language,timezone:l.timezone}),e.success(u("settings.identity.saved"))}catch(h){e.error(h.message)}finally{p(!1)}};return s.jsxs(Ye,{title:u("settings.identity.title"),description:u("settings.identity.subtitle"),children:[t?null:s.jsx(pt,{children:u("common.none_yet")}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("settings.identity.owner_name"),children:s.jsx(Ne,{value:l.owner_name||"",onChange:h=>c({...l,owner_name:h.target.value})})}),s.jsx(ae,{label:u("settings.identity.language"),children:s.jsx(ut,{value:l.language||"es",onChange:h=>c({...l,language:h}),options:FB()})}),s.jsx(ae,{label:u("settings.identity.timezone"),hint:u("settings.identity.timezone_hint"),children:s.jsx(HB,{value:l.timezone||ik(),onChange:h=>c({...l,timezone:h}),options:m})})]}),s.jsx("div",{className:"mt-3",children:s.jsx(ae,{label:u("settings.identity.owner_context"),hint:u("settings.identity.owner_context_hint"),children:s.jsx(on,{rows:3,value:l.owner_context||"",onChange:h=>c({...l,owner_context:h.target.value})})})}),s.jsx("div",{className:"mt-4",children:s.jsx(se,{variant:"primary",loading:d,onClick:g,children:u("common.save")})})]})}function ZB(){const e=Ze(),t=Pn(),{superAgent:a,isLoading:o,mutate:l}=tE(),{patch:c}=lr(),{identity:d,save:p}=R_(),[m,g]=x.useState(!0),[h,b]=x.useState(""),[_,j]=x.useState(""),[N,y]=x.useState("permiso"),[w,S]=x.useState(!1);if(x.useEffect(()=>{a&&(g(!!a.enabled),b(a.system||""),y(a.permission_mode||"permiso"))},[a]),x.useEffect(()=>{j(d.personality||"")},[d.personality]),o||!a)return s.jsx(rt,{});const k=async()=>{S(!0);try{await c({"super_agent.enabled":m,"super_agent.system":h,"super_agent.permission_mode":N},["super_agent.name"]),await p({personality:_}),e.success(u("settings.super_agent.saved")),l()}catch(E){e.error(E.message)}finally{S(!1)}};return s.jsx(Ye,{title:u("settings.super_agent.title"),description:u("settings.super_agent.behavior_subtitle"),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsx(Bt,{checked:m,onChange:g,label:u("settings.super_agent.enabled_label")})}),s.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("div",{className:"text-sm font-medium",children:u("settings.super_agent.model_active")}),s.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:a.model||"—"})]}),s.jsxs(se,{size:"sm",variant:"secondary",onClick:()=>t("/p/0/models"),children:[s.jsx(pb,{size:13})," ",u("settings.super_agent.model_configure")]})]}),s.jsx(ae,{label:u("settings.super_agent.permission_mode"),children:s.jsx(ut,{value:N,onChange:y,options:Sb.map(E=>({value:E,label:E}))})}),s.jsx(ae,{label:u("settings.super_agent.personality"),children:s.jsx(on,{rows:2,value:_,onChange:E=>j(E.target.value)})}),s.jsx(ae,{label:u("settings.super_agent.system"),hint:u("settings.super_agent.system_hint"),children:s.jsx(on,{rows:6,className:"font-mono text-xs",value:h,onChange:E=>b(E.target.value),placeholder:u("settings.super_agent.system_ph")})}),s.jsx(se,{variant:"primary",loading:w,onClick:k,children:u("common.save")})]})})}const Ph={providers:()=>ne.get("/embeddings/providers"),test:(e={})=>ne.post("/embeddings/test",e),reindex:()=>ne.post("/embeddings/reindex",{})},JB=()=>[{value:"auto",label:u("memory_panel.provider_auto")},{value:"ollama",label:u("memory_panel.provider_ollama")},{value:"gemini",label:u("memory_panel.provider_gemini")},{value:"openai",label:u("memory_panel.provider_openai")},{value:"tf",label:u("memory_panel.provider_tf")}],e9=()=>[{value:"chain",label:u("memory_panel.mode_chain")},{value:"single",label:u("memory_panel.mode_single")}],ck=e=>e.startsWith("***");function t9(){const e=Ze(),{config:t,isLoading:a,patch:o}=lr(),{data:l,mutate:c}=qe("/embeddings/providers",()=>Ph.providers()),[d,p]=x.useState(!1),[m,g]=x.useState(null);if(a)return s.jsx(rt,{});const h=t.memory||{},b=h.embeddings||{},_=l?.configured_provider||b.provider||"auto",j=l?.mode||b.mode||"chain",N=l?.engines||[],y=async k=>{p(!0);try{await o(k),await c()}catch(E){e.error(u("memory_panel.save_failed",{msg:E.message}))}finally{p(!1)}},w=async()=>{p(!0),g(null);try{const k=await Ph.test({});g(`${k.embedder} · dim ${k.dim} · ${k.ms}ms`),e.success(u("memory_panel.test_ok",{embedder:k.embedder}))}catch(k){e.error(u("memory_panel.test_failed",{msg:k.message}))}finally{p(!1)}},S=async()=>{p(!0);try{const k=await Ph.reindex();e.success(u("memory_panel.reindexed",{indexed:k.indexed,cleared:k.cleared}))}catch(k){e.error(u("memory_panel.reindex_failed",{msg:k.message}))}finally{p(!1)}};return s.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[s.jsx(Ye,{title:u("memory_panel.embeddings_title"),description:u("memory_panel.embeddings_desc"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("memory_panel.provider_label"),hint:u("memory_panel.provider_hint"),children:s.jsx(ut,{value:_,onChange:k=>y({"memory.embeddings.provider":k}),options:JB(),disabled:d,className:"max-w-xl"})}),s.jsx(ae,{label:u("memory_panel.mode_label"),hint:u("memory_panel.mode_hint"),children:s.jsx(ut,{value:j,onChange:k=>y({"memory.embeddings.mode":k}),options:e9(),disabled:d,className:"max-w-md"})}),s.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:N.map(k=>s.jsxs(He,{tone:k.available?"success":"muted",children:[k.id,": ",k.available?u("memory_panel.available"):u("memory_panel.unavailable")]},k.id))}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[s.jsxs(se,{variant:"secondary",onClick:w,loading:d,children:[s.jsx(ea,{size:14})," ",u("memory_panel.test_btn")]}),s.jsxs(se,{variant:"secondary",onClick:S,loading:d,children:[s.jsx(US,{size:14})," ",u("memory_panel.reindex_btn")]}),m&&s.jsx("span",{className:"text-sm text-muted-foreground",children:m})]})]})}),s.jsxs(Ye,{title:u("memory_panel.ollama_title"),description:u("memory_panel.ollama_desc"),children:[s.jsx(ae,{label:u("memory_panel.model_label"),children:s.jsx(Ne,{defaultValue:b.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:d,onBlur:k=>{const E=k.target.value.trim();E&&E!==b.ollama?.model&&y({"memory.embeddings.ollama.model":E})},className:"max-w-md"})}),s.jsx(ae,{label:u("memory_panel.base_url_label"),hint:u("memory_panel.ollama_base_url_hint"),children:s.jsx(Ne,{defaultValue:b.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:d,onBlur:k=>y({"memory.embeddings.ollama.base_url":k.target.value.trim()}),className:"max-w-md"})})]}),s.jsxs(Ye,{title:u("memory_panel.openai_title"),description:u("memory_panel.openai_desc"),children:[s.jsx(ae,{label:u("memory_panel.model_label"),children:s.jsx(Ne,{defaultValue:b.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:d,onBlur:k=>{const E=k.target.value.trim();E&&E!==b.openai?.model&&y({"memory.embeddings.openai.model":E})},className:"max-w-md"})}),s.jsx(ae,{label:u("memory_panel.api_key_label"),hint:u("memory_panel.openai_key_hint"),children:s.jsx(Ne,{type:"password",defaultValue:b.openai?.api_key||"",placeholder:"sk-…",disabled:d,onBlur:k=>{const E=k.target.value;E&&!ck(E)&&y({"memory.embeddings.openai.api_key":E})},className:"max-w-md"})})]}),s.jsxs(Ye,{title:u("memory_panel.gemini_title"),description:u("memory_panel.gemini_desc"),children:[s.jsx(ae,{label:u("memory_panel.model_label"),children:s.jsx(Ne,{defaultValue:b.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:d,onBlur:k=>{const E=k.target.value.trim();E&&E!==b.gemini?.model&&y({"memory.embeddings.gemini.model":E})},className:"max-w-md"})}),s.jsx(ae,{label:u("memory_panel.api_key_label"),hint:u("memory_panel.gemini_key_hint"),children:s.jsx(Ne,{type:"password",defaultValue:b.gemini?.api_key||"",placeholder:"AIza…",disabled:d,onBlur:k=>{const E=k.target.value;E&&!ck(E)&&y({"memory.embeddings.gemini.api_key":E})},className:"max-w-md"})})]}),s.jsxs(Ye,{title:u("memory_panel.compaction_title"),description:u("memory_panel.compaction_desc"),children:[s.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[s.jsx(ae,{label:u("memory_panel.threshold_label"),hint:u("memory_panel.threshold_hint"),children:s.jsx(Ne,{type:"number",min:1,defaultValue:h.compact_threshold??60,placeholder:"60",disabled:d,onBlur:k=>{const E=parseInt(k.target.value,10);Number.isFinite(E)&&E>0&&E!==h.compact_threshold&&y({"memory.compact_threshold":E})},className:"max-w-[10rem]"})}),s.jsx(ae,{label:u("memory_panel.keep_recent_label"),hint:u("memory_panel.keep_recent_hint"),children:s.jsx(Ne,{type:"number",min:1,defaultValue:h.keep_recent??40,placeholder:"40",disabled:d,onBlur:k=>{const E=parseInt(k.target.value,10);Number.isFinite(E)&&E>0&&E!==h.keep_recent&&y({"memory.keep_recent":E})},className:"max-w-[10rem]"})})]}),s.jsx(ae,{label:u("memory_panel.compact_model_label"),hint:u("memory_panel.compact_model_hint"),children:s.jsx(Ne,{defaultValue:h.compact_model||"ollama:gemma4:31b-cloud",placeholder:"ollama:gemma4:31b-cloud",disabled:d,onBlur:k=>{const E=k.target.value.trim();E&&E!==h.compact_model&&y({"memory.compact_model":E})},className:"max-w-md"})}),s.jsx(ae,{label:u("memory_panel.compact_fallback_label"),hint:u("memory_panel.compact_fallback_hint"),children:s.jsx(Ne,{defaultValue:h.compact_fallback_model||"",placeholder:u("memory_panel.compact_fallback_ph"),disabled:d,onBlur:k=>{const E=k.target.value.trim();E!==(h.compact_fallback_model||"")&&y({"memory.compact_fallback_model":E})},className:"max-w-md"})})]})]})}function n9(){return[{key:"load_threshold",label:u("settings_ui.knob_load_threshold"),hint:u("settings_ui.knob_load_threshold_hint"),step:.01,min:0,max:1},{key:"hint_threshold",label:u("settings_ui.knob_hint_threshold"),hint:u("settings_ui.knob_hint_threshold_hint"),step:.01,min:0,max:1},{key:"margin",label:u("settings_ui.knob_margin"),hint:u("settings_ui.knob_margin_hint"),step:.01,min:0,max:1},{key:"max_loaded",label:u("settings_ui.knob_max_loaded"),hint:u("settings_ui.knob_max_loaded_hint"),step:1,min:0,max:5},{key:"max_hints",label:u("settings_ui.knob_max_hints"),hint:u("settings_ui.knob_max_hints_hint"),step:1,min:0,max:8},{key:"prompt_floor",label:u("settings_ui.knob_prompt_floor"),hint:u("settings_ui.knob_prompt_floor_hint"),step:1,min:0,max:40},{key:"body_char_cap",label:u("settings_ui.knob_body_char_cap"),hint:u("settings_ui.knob_body_char_cap_hint"),step:500,min:500,max:2e4}]}function s9(){const e=Ze(),{data:t,mutate:a,isLoading:o}=qe("/skills/inspector",()=>Bs.inspector()),[l,c]=x.useState(!1),[d,p]=x.useState(""),[m,g]=x.useState(null);if(o||!t)return s.jsx(rt,{});const h=t.config,b=t.index,_=async y=>{c(!0);try{await Bs.updateInspector(y),await a()}catch(w){e.error(u("settings_ui.could_not_save",{msg:w.message}))}finally{c(!1)}},j=async(y=!1)=>{c(!0);try{const w=await Bs.index({force:y});e.success(u("settings_ui.indexed_with",{embedder:w.embedder,dim:w.dim,added:w.changed.added,refreshed:w.changed.refreshed,removed:w.changed.removed})),await a()}catch(w){e.error(u("settings_ui.index_failed",{msg:w.message}))}finally{c(!1)}},N=async()=>{if(d.trim()){c(!0),g(null);try{const y=await Bs.inspect(d.trim());g(y.trace)}catch(y){e.error(u("settings_ui.dry_run_failed",{msg:y.message}))}finally{c(!1)}}};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs("div",{className:"grid gap-6 lg:grid-cols-2 lg:items-start",children:[s.jsx(Ye,{title:u("settings_ui.inspector_title"),description:u("settings_ui.inspector_desc"),children:s.jsxs("div",{className:"space-y-4",children:[s.jsx(ae,{label:u("settings_ui.enable_inspector"),hint:u("settings_ui.enable_inspector_hint"),children:s.jsx(Bt,{checked:h.enabled,disabled:l,onChange:y=>_({enabled:y}),label:h.enabled?u("settings_ui.on"):u("settings_ui.off")})}),s.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[s.jsx(He,{tone:b.count>0?"success":"warning",children:u("settings_ui.index_count",{n:b.count})}),s.jsx(He,{tone:"muted",children:b.embedder||u("settings_ui.not_indexed")}),b.dim?s.jsx(He,{tone:"muted",children:u("settings_ui.dim",{dim:b.dim})}):null,b.updated_at?s.jsx("span",{className:"text-xs text-muted-foreground",children:u("settings_ui.updated_at",{date:new Date(b.updated_at).toLocaleString()})}):null]}),s.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[s.jsxs(se,{variant:"secondary",onClick:()=>j(!1),loading:l,children:[s.jsx(Vs,{size:14})," ",u("settings_ui.reindex")]}),s.jsxs(se,{variant:"secondary",onClick:()=>j(!0),loading:l,children:[s.jsx(Vs,{size:14})," ",u("settings_ui.reindex_forced")]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:u("settings_ui.embedder_source")})]})]})}),s.jsx(Ye,{title:u("settings_ui.test_title"),description:u("settings_ui.test_desc"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsx(Ne,{value:d,placeholder:u("settings_ui.test_placeholder"),disabled:l,onChange:y=>p(y.target.value),onKeyDown:y=>{y.key==="Enter"&&N()},className:"max-w-xl flex-1"}),s.jsxs(se,{variant:"primary",onClick:N,loading:l,children:[s.jsx(_3,{size:14})," ",u("settings_ui.test_btn")]})]}),m&&s.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-sm",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[s.jsx(ea,{size:14,className:"text-muted-foreground"}),s.jsx("span",{className:"text-muted-foreground",children:m.embedder||"—"}),m.jit?s.jsx(He,{tone:"warning",children:u("settings_ui.jit_empty_index")}):null,m.reason&&!m.loaded?.length&&!m.hinted?.length?s.jsx(He,{tone:"muted",children:m.reason}):null]}),m.loaded?.length?s.jsxs("div",{className:"mb-1",children:[s.jsxs("span",{className:"text-muted-foreground",children:[u("settings_ui.loaded_label")," "]}),m.loaded.map(y=>s.jsx(He,{tone:"success",className:"mr-1",children:y},y))]}):null,m.hinted?.length?s.jsxs("div",{className:"mb-1",children:[s.jsxs("span",{className:"text-muted-foreground",children:[u("settings_ui.suggested_label")," "]}),m.hinted.map(y=>s.jsx(He,{tone:"info",className:"mr-1",children:y},y))]}):null,m.scored?.length?s.jsx("div",{className:"mt-2 space-y-0.5 font-mono text-xs text-muted-foreground",children:m.scored.map(y=>s.jsxs("div",{children:[y.sim.toFixed(3)," ",y.slug]},y.slug))}):null]})]})})]}),s.jsx(Ye,{title:u("settings_ui.thresholds_title"),description:u("settings_ui.thresholds_desc"),children:s.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 xl:grid-cols-4",children:n9().map(y=>s.jsx(ae,{label:y.label,hint:y.hint,children:s.jsx(Ne,{type:"number",step:y.step,min:y.min,max:y.max,defaultValue:String(h[y.key]),disabled:l,onBlur:w=>{const S=Number(w.target.value);Number.isFinite(S)&&S!==h[y.key]&&_({[y.key]:S})},className:"max-w-[12rem]"})},y.key))})})]})}function a9(){const[e,t]=$o(),a=e.get("tab")==="rag"?"rag":"manager",o=l=>{const c=new URLSearchParams(e);c.set("tab",l),t(c,{replace:!0})};return s.jsxs("div",{className:"space-y-5",children:[s.jsxs("div",{className:"flex items-center gap-1 border-b border-border",children:[s.jsx(uk,{active:a==="manager",onClick:()=>o("manager"),icon:ea,label:u("skills_page.manager_tab")}),s.jsx(uk,{active:a==="rag",onClick:()=>o("rag"),icon:p3,label:u("skills_page.rag_tab")})]}),a==="manager"?s.jsx(FE,{selectable:!0}):s.jsx(s9,{})]})}function uk({active:e,onClick:t,icon:a,label:o}){return s.jsxs("button",{type:"button",onClick:t,className:`-mb-px inline-flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm font-medium transition ${e?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"}`,children:[s.jsx(a,{size:15})," ",o]})}function r9(){const e=Ze(),{config:t,isLoading:a,patch:o,mutate:l}=lr(),c=t.telegram?.channels||[],d=Math.max(0,c.findIndex(A=>A.name==="default")),p=c[d],[m,g]=x.useState(!0),[h,b]=x.useState(1500),[_,j]=x.useState(!0),[N,y]=x.useState(""),[w,S]=x.useState(""),[k,E]=x.useState(!1);if(x.useEffect(()=>{g(!!t.telegram?.enabled),b(Number(t.telegram?.poll_interval_ms||1500)),j(!!t.telegram?.respond_with_engine),y(""),S(p?.chat_id||"")},[t,p?.chat_id]),a)return s.jsx(rt,{});const R=async()=>{E(!0);try{const A=c.slice(),T={name:"default",chat_id:w,respond_with_engine:_,...N?{bot_token:N}:{}};c.length===0?A.push(T):A[d]={...p,...T},await o({"telegram.enabled":m,"telegram.poll_interval_ms":h,"telegram.respond_with_engine":_,"telegram.channels":A}),e.success(u("settings.telegram_global.saved")),l(),y("")}catch(A){e.error(A.message)}finally{E(!1)}};return s.jsx(Ye,{title:u("settings.telegram_global.title"),description:u("settings.telegram_global.subtitle"),children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Bt,{checked:m,onChange:g,label:u("settings.telegram_global.enabled")}),s.jsx(Bt,{checked:_,onChange:j,label:u("settings.telegram_global.respond_with_engine")})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("settings.telegram_global.bot_token"),hint:p?.bot_token?`…${Do(p.bot_token)??""} ${u("telegram_ui.secret_set_replace")}`:u("telegram_ui.bot_token_hint_short"),children:s.jsx(Ne,{type:"password",value:N,onChange:A=>y(A.target.value),placeholder:p?.bot_token?`…${Do(p.bot_token)??""} ${u("telegram_ui.secret_already_set")}`:""})}),s.jsx(ae,{label:u("settings.telegram_global.chat_id"),children:s.jsx(Ne,{value:w,onChange:A=>S(A.target.value),placeholder:"889721252"})}),s.jsx(ae,{label:u("settings.telegram_global.poll_interval"),children:s.jsx(Ne,{type:"number",value:String(h),onChange:A=>b(Number(A.target.value)||1500)})})]}),s.jsx(se,{variant:"primary",loading:k,onClick:R,children:u("common.save")})]})})}function o9(){const e=Ze(),{channels:t,isLoading:a,mutate:o}=D_(),{contacts:l}=P_(),[c,d]=x.useState(null),[p,m]=x.useState(null),g=new Map;for(const b of l)g.set(String(b.user_id),b.name||`@${b.username||b.user_id}`);const h=async b=>{if(confirm(u("telegram_channels.delete_confirm",{name:b})))try{await Dn.channels.remove(b),e.success(u("telegram_channels.removed")),o()}catch(_){e.error(_.message)}};return s.jsxs(Ye,{title:u("telegram_channels.title"),description:u("telegram_channels.desc"),action:s.jsxs(se,{size:"sm",onClick:()=>d({name:""}),children:[s.jsx(It,{size:14})," ",u("telegram_channels.new_btn")]}),children:[a&&s.jsx(rt,{}),!a&&t.length===0&&s.jsx(pt,{children:u("telegram_channels.empty")}),s.jsx("ul",{className:"space-y-2 text-sm",children:t.map(b=>{const _=b.owner_user_id!=null?g.get(String(b.owner_user_id))||u("telegram_ui.user_id_fallback",{id:b.owner_user_id}):u("telegram_channels.no_owner");return s.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("span",{className:"font-medium",children:b.name}),s.jsxs("div",{className:"flex items-center gap-2",children:[b.project&&s.jsxs(He,{tone:"success",children:["project = ",b.project]}),s.jsxs(se,{size:"sm",variant:"ghost",onClick:()=>m(b),children:[s.jsx(ja,{size:13})," ",u("admin.telegram_send_test")]}),s.jsx(se,{size:"sm",variant:"secondary",onClick:()=>d(b),children:u("common.edit")}),s.jsx(se,{size:"sm",variant:"destructive",onClick:()=>h(b.name),children:u("common.delete")})]})]}),s.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[s.jsxs("span",{children:["chat_id: ",b.chat_id||"—"]}),s.jsxs("span",{children:["bot_token: ",b.bot_token?`…${Do(b.bot_token)??""}`:"—"]}),s.jsxs("span",{children:["route_to_agent: ",b.route_to_agent||u("telegram_ui.default_apx")]}),s.jsxs("span",{children:["engine: ",b.respond_with_engine?u("telegram_ui.yes"):u("telegram_ui.no")]}),s.jsxs("span",{className:"col-span-2",children:[u("telegram_channels.owner_label")," ",_]})]})]},b.name)})}),s.jsx(AN,{channel:c,onClose:()=>d(null),onSaved:()=>{d(null),o()}}),s.jsx(MN,{channel:p,onClose:()=>m(null)})]})}const dk=new Set(["owner","guest"]);function l9(){const e=Ze(),{roles:t,mutate:a,isLoading:o}=P_(),[l,c]=x.useState(""),[d,p]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState(!1),_=async()=>{const y=l.trim();if(!y){e.error(u("telegram_roles.name_required"));return}if(dk.has(y)){e.error(u("telegram_roles.builtin_error",{name:y}));return}b(!0);try{const w=m?"*":d.split(",").map(S=>S.trim()).filter(Boolean);await Dn.roles.set(y,w),e.success(u("telegram_roles.saved",{name:y})),c(""),p(""),g(!1),a()}catch(w){e.error(w.message)}finally{b(!1)}},j=async y=>{if(confirm(u("telegram_roles.delete_confirm",{name:y})))try{await Dn.roles.remove(y),e.success(u("telegram_roles.removed")),a()}catch(w){e.error(w.message)}},N=Object.entries(t);return s.jsxs(Ye,{title:u("telegram_roles.title"),description:u("telegram_roles.desc"),children:[o&&s.jsx(rt,{}),N.length===0&&!o&&s.jsx(pt,{children:u("telegram_roles.empty")}),N.length>0&&s.jsx("ul",{className:"space-y-2 text-sm",children:N.map(([y,w])=>{const S=dk.has(y),k=w?.tools==="*"?u("telegram_roles.tools_all"):Array.isArray(w?.tools)&&w.tools.length>0?w.tools.join(", "):u("telegram_roles.tools_none");return s.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("span",{className:"font-medium",children:y}),S&&s.jsx(He,{tone:"info",children:u("telegram_roles.builtin")})]}),!S&&s.jsx(se,{size:"sm",variant:"destructive",onClick:()=>j(y),children:u("telegram_roles.delete_btn")})]}),s.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[u("telegram_contacts.tools_label")," ",k]})]},y)})}),s.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[s.jsx(It,{size:14})," ",u("telegram_roles.new_title")]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsx(ae,{label:u("telegram_roles.name_label"),children:s.jsx(Ne,{value:l,onChange:y=>c(y.target.value),placeholder:u("telegram_roles.name_ph")})}),s.jsx(ae,{label:u("telegram_roles.tools_label"),hint:u("telegram_roles.tools_hint"),children:s.jsx(Ne,{value:d,onChange:y=>p(y.target.value),disabled:m,placeholder:u("telegram_roles.tools_ph")})})]}),s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Bt,{checked:m,onChange:g,label:u("telegram_roles.full_access")}),s.jsx(se,{variant:"primary",loading:h,onClick:_,children:u("telegram_roles.save_btn")})]})]})]})}const GE="apx.settings.telegramTab";function i9(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(GE);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function c9(){const[e,t]=x.useState("default");x.useEffect(()=>{t(i9())},[]);const a=o=>{const l=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";t(l);try{window.localStorage.setItem(GE,l)}catch{}};return s.jsxs(Tp,{value:e,onValueChange:a,className:"w-full",children:[s.jsxs(Ap,{children:[s.jsx(Us,{value:"default",children:u("settings.telegram_global.title")}),s.jsx(Us,{value:"channels",children:u("telegram_channels.title")}),s.jsx(Us,{value:"contacts",children:u("telegram_contacts.title")}),s.jsx(Us,{value:"roles",children:u("telegram_roles.title")})]}),s.jsx(us,{value:"default",className:"mt-4",children:s.jsx(r9,{})}),s.jsx(us,{value:"channels",className:"mt-4",children:s.jsx(o9,{})}),s.jsx(us,{value:"contacts",className:"mt-4",children:s.jsx(ON,{})}),s.jsx(us,{value:"roles",className:"mt-4",children:s.jsx(l9,{})})]})}function u9(){const{data:e,error:t,isLoading:a,mutate:o}=qe("/pair/list",()=>si.list(),{refreshInterval:Zf.pairList});return{clients:e?.clients||[],error:t,isLoading:a,mutate:o}}var Ol={},Lh,fk;function d9(){return fk||(fk=1,Lh=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Lh}var Ih={},Or={},pk;function Vo(){if(pk)return Or;pk=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 Or.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},Or.getSymbolTotalCodewords=function(o){return t[o]},Or.getBCHDigit=function(a){let o=0;for(;a!==0;)o++,a>>>=1;return o},Or.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},Or.isKanjiModeEnabled=function(){return typeof e<"u"},Or.toSJIS=function(o){return e(o)},Or}var Bh={},mk;function tv(){return mk||(mk=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(a){if(typeof a!="string")throw new Error("Param is not a string");switch(a.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+a)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,l){if(e.isValid(o))return o;try{return t(o)}catch{return l}}})(Bh)),Bh}var Uh,gk;function f9(){if(gk)return Uh;gk=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const a=Math.floor(t/8);return(this.buffer[a]>>>7-t%8&1)===1},put:function(t,a){for(let o=0;o<a;o++)this.putBit((t>>>a-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const a=Math.floor(this.length/8);this.buffer.length<=a&&this.buffer.push(0),t&&(this.buffer[a]|=128>>>this.length%8),this.length++}},Uh=e,Uh}var $h,hk;function p9(){if(hk)return $h;hk=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,a,o,l){const c=t*this.size+a;this.data[c]=o,l&&(this.reservedBit[c]=!0)},e.prototype.get=function(t,a){return this.data[t*this.size+a]},e.prototype.xor=function(t,a,o){this.data[t*this.size+a]^=o},e.prototype.isReserved=function(t,a){return this.reservedBit[t*this.size+a]},$h=e,$h}var Hh={},xk;function m9(){return xk||(xk=1,(function(e){const t=Vo().getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const l=Math.floor(o/7)+2,c=t(o),d=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]-d;return p.push(6),p.reverse()},e.getPositions=function(o){const l=[],c=e.getRowColCoords(o),d=c.length;for(let p=0;p<d;p++)for(let m=0;m<d;m++)p===0&&m===0||p===0&&m===d-1||p===d-1&&m===0||l.push([c[p],c[m]]);return l}})(Hh)),Hh}var qh={},bk;function g9(){if(bk)return qh;bk=1;const e=Vo().getSymbolSize,t=7;return qh.getPositions=function(o){const l=e(o);return[[0,0],[l-t,0],[0,l-t]]},qh}var Vh={},_k;function h9(){return _k||(_k=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 d=0,p=0,m=0,g=null,h=null;for(let b=0;b<c;b++){p=m=0,g=h=null;for(let _=0;_<c;_++){let j=l.get(b,_);j===g?p++:(p>=5&&(d+=t.N1+(p-5)),g=j,p=1),j=l.get(_,b),j===h?m++:(m>=5&&(d+=t.N1+(m-5)),h=j,m=1)}p>=5&&(d+=t.N1+(p-5)),m>=5&&(d+=t.N1+(m-5))}return d},e.getPenaltyN2=function(l){const c=l.size;let d=0;for(let p=0;p<c-1;p++)for(let m=0;m<c-1;m++){const g=l.get(p,m)+l.get(p,m+1)+l.get(p+1,m)+l.get(p+1,m+1);(g===4||g===0)&&d++}return d*t.N2},e.getPenaltyN3=function(l){const c=l.size;let d=0,p=0,m=0;for(let g=0;g<c;g++){p=m=0;for(let h=0;h<c;h++)p=p<<1&2047|l.get(g,h),h>=10&&(p===1488||p===93)&&d++,m=m<<1&2047|l.get(h,g),h>=10&&(m===1488||m===93)&&d++}return d*t.N3},e.getPenaltyN4=function(l){let c=0;const d=l.data.length;for(let m=0;m<d;m++)c+=l.data[m];return Math.abs(Math.ceil(c*100/d/5)-10)*t.N4};function a(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 d=c.size;for(let p=0;p<d;p++)for(let m=0;m<d;m++)c.isReserved(m,p)||c.xor(m,p,a(l,m,p))},e.getBestMask=function(l,c){const d=Object.keys(e.Patterns).length;let p=0,m=1/0;for(let g=0;g<d;g++){c(g),e.applyMask(g,l);const h=e.getPenaltyN1(l)+e.getPenaltyN2(l)+e.getPenaltyN3(l)+e.getPenaltyN4(l);e.applyMask(g,l),h<m&&(m=h,p=g)}return p}})(Vh)),Vh}var Zd={},vk;function YE(){if(vk)return Zd;vk=1;const e=tv(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],a=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Zd.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}},Zd.getTotalCodewordsCount=function(l,c){switch(c){case e.L:return a[(l-1)*4+0];case e.M:return a[(l-1)*4+1];case e.Q:return a[(l-1)*4+2];case e.H:return a[(l-1)*4+3];default:return}},Zd}var Fh={},vc={},yk;function x9(){if(yk)return vc;yk=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]})(),vc.log=function(o){if(o<1)throw new Error("log("+o+")");return t[o]},vc.exp=function(o){return e[o]},vc.mul=function(o,l){return o===0||l===0?0:e[t[o]+t[l]]},vc}var jk;function b9(){return jk||(jk=1,(function(e){const t=x9();e.mul=function(o,l){const c=new Uint8Array(o.length+l.length-1);for(let d=0;d<o.length;d++)for(let p=0;p<l.length;p++)c[d+p]^=t.mul(o[d],l[p]);return c},e.mod=function(o,l){let c=new Uint8Array(o);for(;c.length-l.length>=0;){const d=c[0];for(let m=0;m<l.length;m++)c[m]^=t.mul(l[m],d);let p=0;for(;p<c.length&&c[p]===0;)p++;c=c.slice(p)}return c},e.generateECPolynomial=function(o){let l=new Uint8Array([1]);for(let c=0;c<o;c++)l=e.mul(l,new Uint8Array([1,t.exp(c)]));return l}})(Fh)),Fh}var Gh,wk;function _9(){if(wk)return Gh;wk=1;const e=b9();function t(a){this.genPoly=void 0,this.degree=a,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(o){this.degree=o,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(o){if(!this.genPoly)throw new Error("Encoder not initialized");const l=new Uint8Array(o.length+this.degree);l.set(o);const c=e.mod(l,this.genPoly),d=this.degree-c.length;if(d>0){const p=new Uint8Array(this.degree);return p.set(c,d),p}return c},Gh=t,Gh}var Yh={},Kh={},Xh={},kk;function KE(){return kk||(kk=1,Xh.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Xh}var ia={},Sk;function XE(){if(Sk)return ia;Sk=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let a="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";a=a.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+a+`)(?:.|[\r
|
|
791
|
+
]))+`;ia.KANJI=new RegExp(a,"g"),ia.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),ia.BYTE=new RegExp(o,"g"),ia.NUMERIC=new RegExp(e,"g"),ia.ALPHANUMERIC=new RegExp(t,"g");const l=new RegExp("^"+a+"$"),c=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return ia.testKanji=function(m){return l.test(m)},ia.testNumeric=function(m){return c.test(m)},ia.testAlphanumeric=function(m){return d.test(m)},ia}var Ck;function Fo(){return Ck||(Ck=1,(function(e){const t=KE(),a=XE();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(c,d){if(!c.ccBits)throw new Error("Invalid mode: "+c);if(!t.isValid(d))throw new Error("Invalid version: "+d);return d>=1&&d<10?c.ccBits[0]:d<27?c.ccBits[1]:c.ccBits[2]},e.getBestModeForData=function(c){return a.testNumeric(c)?e.NUMERIC:a.testAlphanumeric(c)?e.ALPHANUMERIC:a.testKanji(c)?e.KANJI:e.BYTE},e.toString=function(c){if(c&&c.id)return c.id;throw new Error("Invalid mode")},e.isValid=function(c){return c&&c.bit&&c.ccBits};function o(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,d){if(e.isValid(c))return c;try{return o(c)}catch{return d}}})(Kh)),Kh}var Nk;function v9(){return Nk||(Nk=1,(function(e){const t=Vo(),a=YE(),o=tv(),l=Fo(),c=KE(),d=7973,p=t.getBCHDigit(d);function m(_,j,N){for(let y=1;y<=40;y++)if(j<=e.getCapacity(y,N,_))return y}function g(_,j){return l.getCharCountIndicator(_,j)+4}function h(_,j){let N=0;return _.forEach(function(y){const w=g(y.mode,j);N+=w+y.getBitsLength()}),N}function b(_,j){for(let N=1;N<=40;N++)if(h(_,N)<=e.getCapacity(N,j,l.MIXED))return N}e.from=function(j,N){return c.isValid(j)?parseInt(j,10):N},e.getCapacity=function(j,N,y){if(!c.isValid(j))throw new Error("Invalid QR Code version");typeof y>"u"&&(y=l.BYTE);const w=t.getSymbolTotalCodewords(j),S=a.getTotalCodewordsCount(j,N),k=(w-S)*8;if(y===l.MIXED)return k;const E=k-g(y,j);switch(y){case l.NUMERIC:return Math.floor(E/10*3);case l.ALPHANUMERIC:return Math.floor(E/11*2);case l.KANJI:return Math.floor(E/13);case l.BYTE:default:return Math.floor(E/8)}},e.getBestVersionForData=function(j,N){let y;const w=o.from(N,o.M);if(Array.isArray(j)){if(j.length>1)return b(j,w);if(j.length===0)return 1;y=j[0]}else y=j;return m(y.mode,y.getLength(),w)},e.getEncodedBits=function(j){if(!c.isValid(j)||j<7)throw new Error("Invalid QR Code version");let N=j<<12;for(;t.getBCHDigit(N)-p>=0;)N^=d<<t.getBCHDigit(N)-p;return j<<12|N}})(Yh)),Yh}var Qh={},Ek;function y9(){if(Ek)return Qh;Ek=1;const e=Vo(),t=1335,a=21522,o=e.getBCHDigit(t);return Qh.getEncodedBits=function(c,d){const p=c.bit<<3|d;let m=p<<10;for(;e.getBCHDigit(m)-o>=0;)m^=t<<e.getBCHDigit(m)-o;return(p<<10|m)^a},Qh}var Wh={},Zh,Rk;function j9(){if(Rk)return Zh;Rk=1;const e=Fo();function t(a){this.mode=e.NUMERIC,this.data=a.toString()}return t.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(o){let l,c,d;for(l=0;l+3<=this.data.length;l+=3)c=this.data.substr(l,3),d=parseInt(c,10),o.put(d,10);const p=this.data.length-l;p>0&&(c=this.data.substr(l),d=parseInt(c,10),o.put(d,p*3+1))},Zh=t,Zh}var Jh,Tk;function w9(){if(Tk)return Jh;Tk=1;const e=Fo(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function a(o){this.mode=e.ALPHANUMERIC,this.data=o}return a.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(l){let c;for(c=0;c+2<=this.data.length;c+=2){let d=t.indexOf(this.data[c])*45;d+=t.indexOf(this.data[c+1]),l.put(d,11)}this.data.length%2&&l.put(t.indexOf(this.data[c]),6)},Jh=a,Jh}var ex,Ak;function k9(){if(Ak)return ex;Ak=1;const e=Fo();function t(a){this.mode=e.BYTE,typeof a=="string"?this.data=new TextEncoder().encode(a):this.data=new Uint8Array(a)}return t.getBitsLength=function(o){return o*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(a){for(let o=0,l=this.data.length;o<l;o++)a.put(this.data[o],8)},ex=t,ex}var tx,Mk;function S9(){if(Mk)return tx;Mk=1;const e=Fo(),t=Vo();function a(o){this.mode=e.KANJI,this.data=o}return a.getBitsLength=function(l){return l*13},a.prototype.getLength=function(){return this.data.length},a.prototype.getBitsLength=function(){return a.getBitsLength(this.data.length)},a.prototype.write=function(o){let 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]+`
|
|
792
|
+
Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},tx=a,tx}var nx={exports:{}},Ok;function C9(){return Ok||(Ok=1,(function(e){var t={single_source_shortest_paths:function(a,o,l){var c={},d={};d[o]=0;var p=t.PriorityQueue.make();p.push(o,0);for(var m,g,h,b,_,j,N,y,w;!p.empty();){m=p.pop(),g=m.value,b=m.cost,_=a[g]||{};for(h in _)_.hasOwnProperty(h)&&(j=_[h],N=b+j,y=d[h],w=typeof d[h]>"u",(w||y>N)&&(d[h]=N,p.push(h,N),c[h]=g))}if(typeof l<"u"&&typeof d[l]>"u"){var S=["Could not find a path from ",o," to ",l,"."].join("");throw new Error(S)}return c},extract_shortest_path_from_predecessor_list:function(a,o){for(var l=[],c=o;c;)l.push(c),a[c],c=a[c];return l.reverse(),l},find_path:function(a,o,l){var c=t.single_source_shortest_paths(a,o,l);return t.extract_shortest_path_from_predecessor_list(c,l)},PriorityQueue:{make:function(a){var o=t.PriorityQueue,l={},c;a=a||{};for(c in o)o.hasOwnProperty(c)&&(l[c]=o[c]);return l.queue=[],l.sorter=a.sorter||o.default_sorter,l},default_sorter:function(a,o){return a.cost-o.cost},push:function(a,o){var l={value:a,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})(nx)),nx.exports}var zk;function N9(){return zk||(zk=1,(function(e){const t=Fo(),a=j9(),o=w9(),l=k9(),c=S9(),d=XE(),p=Vo(),m=C9();function g(S){return unescape(encodeURIComponent(S)).length}function h(S,k,E){const R=[];let A;for(;(A=S.exec(E))!==null;)R.push({data:A[0],index:A.index,mode:k,length:A[0].length});return R}function b(S){const k=h(d.NUMERIC,t.NUMERIC,S),E=h(d.ALPHANUMERIC,t.ALPHANUMERIC,S);let R,A;return p.isKanjiModeEnabled()?(R=h(d.BYTE,t.BYTE,S),A=h(d.KANJI,t.KANJI,S)):(R=h(d.BYTE_KANJI,t.BYTE,S),A=[]),k.concat(E,R,A).sort(function(z,O){return z.index-O.index}).map(function(z){return{data:z.data,mode:z.mode,length:z.length}})}function _(S,k){switch(k){case t.NUMERIC:return a.getBitsLength(S);case t.ALPHANUMERIC:return o.getBitsLength(S);case t.KANJI:return c.getBitsLength(S);case t.BYTE:return l.getBitsLength(S)}}function j(S){return S.reduce(function(k,E){const R=k.length-1>=0?k[k.length-1]:null;return R&&R.mode===E.mode?(k[k.length-1].data+=E.data,k):(k.push(E),k)},[])}function N(S){const k=[];for(let E=0;E<S.length;E++){const R=S[E];switch(R.mode){case t.NUMERIC:k.push([R,{data:R.data,mode:t.ALPHANUMERIC,length:R.length},{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.ALPHANUMERIC:k.push([R,{data:R.data,mode:t.BYTE,length:R.length}]);break;case t.KANJI:k.push([R,{data:R.data,mode:t.BYTE,length:g(R.data)}]);break;case t.BYTE:k.push([{data:R.data,mode:t.BYTE,length:g(R.data)}])}}return k}function y(S,k){const E={},R={start:{}};let A=["start"];for(let T=0;T<S.length;T++){const z=S[T],O=[];for(let B=0;B<z.length;B++){const P=z[B],U=""+T+B;O.push(U),E[U]={node:P,lastCount:0},R[U]={};for(let D=0;D<A.length;D++){const L=A[D];E[L]&&E[L].node.mode===P.mode?(R[L][U]=_(E[L].lastCount+P.length,P.mode)-_(E[L].lastCount,P.mode),E[L].lastCount+=P.length):(E[L]&&(E[L].lastCount=P.length),R[L][U]=_(P.length,P.mode)+4+t.getCharCountIndicator(P.mode,k))}}A=O}for(let T=0;T<A.length;T++)R[A[T]].end=0;return{map:R,table:E}}function w(S,k){let E;const R=t.getBestModeForData(S);if(E=t.from(k,R),E!==t.BYTE&&E.bit<R.bit)throw new Error('"'+S+'" cannot be encoded with mode '+t.toString(E)+`.
|
|
793
|
+
Suggested mode is: `+t.toString(R));switch(E===t.KANJI&&!p.isKanjiModeEnabled()&&(E=t.BYTE),E){case t.NUMERIC:return new a(S);case t.ALPHANUMERIC:return new o(S);case t.KANJI:return new c(S);case t.BYTE:return new l(S)}}e.fromArray=function(k){return k.reduce(function(E,R){return typeof R=="string"?E.push(w(R,null)):R.data&&E.push(w(R.data,R.mode)),E},[])},e.fromString=function(k,E){const R=b(k,p.isKanjiModeEnabled()),A=N(R),T=y(A,E),z=m.find_path(T.map,"start","end"),O=[];for(let B=1;B<z.length-1;B++)O.push(T.table[z[B]].node);return e.fromArray(j(O))},e.rawSplit=function(k){return e.fromArray(b(k,p.isKanjiModeEnabled()))}})(Wh)),Wh}var Dk;function E9(){if(Dk)return Ih;Dk=1;const e=Vo(),t=tv(),a=f9(),o=p9(),l=m9(),c=g9(),d=h9(),p=YE(),m=_9(),g=v9(),h=y9(),b=Fo(),_=N9();function j(T,z){const O=T.size,B=c.getPositions(z);for(let P=0;P<B.length;P++){const U=B[P][0],D=B[P][1];for(let L=-1;L<=7;L++)if(!(U+L<=-1||O<=U+L))for(let V=-1;V<=7;V++)D+V<=-1||O<=D+V||(L>=0&&L<=6&&(V===0||V===6)||V>=0&&V<=6&&(L===0||L===6)||L>=2&&L<=4&&V>=2&&V<=4?T.set(U+L,D+V,!0,!0):T.set(U+L,D+V,!1,!0))}}function N(T){const z=T.size;for(let O=8;O<z-8;O++){const B=O%2===0;T.set(O,6,B,!0),T.set(6,O,B,!0)}}function y(T,z){const O=l.getPositions(z);for(let B=0;B<O.length;B++){const P=O[B][0],U=O[B][1];for(let D=-2;D<=2;D++)for(let L=-2;L<=2;L++)D===-2||D===2||L===-2||L===2||D===0&&L===0?T.set(P+D,U+L,!0,!0):T.set(P+D,U+L,!1,!0)}}function w(T,z){const O=T.size,B=g.getEncodedBits(z);let P,U,D;for(let L=0;L<18;L++)P=Math.floor(L/3),U=L%3+O-8-3,D=(B>>L&1)===1,T.set(P,U,D,!0),T.set(U,P,D,!0)}function S(T,z,O){const B=T.size,P=h.getEncodedBits(z,O);let U,D;for(U=0;U<15;U++)D=(P>>U&1)===1,U<6?T.set(U,8,D,!0):U<8?T.set(U+1,8,D,!0):T.set(B-15+U,8,D,!0),U<8?T.set(8,B-U-1,D,!0):U<9?T.set(8,15-U-1+1,D,!0):T.set(8,15-U-1,D,!0);T.set(B-8,8,1,!0)}function k(T,z){const O=T.size;let B=-1,P=O-1,U=7,D=0;for(let L=O-1;L>0;L-=2)for(L===6&&L--;;){for(let V=0;V<2;V++)if(!T.isReserved(P,L-V)){let H=!1;D<z.length&&(H=(z[D]>>>U&1)===1),T.set(P,L-V,H),U--,U===-1&&(D++,U=7)}if(P+=B,P<0||O<=P){P-=B,B=-B;break}}}function E(T,z,O){const B=new a;O.forEach(function(V){B.put(V.mode.bit,4),B.put(V.getLength(),b.getCharCountIndicator(V.mode,T)),V.write(B)});const P=e.getSymbolTotalCodewords(T),U=p.getTotalCodewordsCount(T,z),D=(P-U)*8;for(B.getLengthInBits()+4<=D&&B.put(0,4);B.getLengthInBits()%8!==0;)B.putBit(0);const L=(D-B.getLengthInBits())/8;for(let V=0;V<L;V++)B.put(V%2?17:236,8);return R(B,T,z)}function R(T,z,O){const B=e.getSymbolTotalCodewords(z),P=p.getTotalCodewordsCount(z,O),U=B-P,D=p.getBlocksCount(z,O),L=B%D,V=D-L,H=Math.floor(B/D),$=Math.floor(U/D),F=$+1,Y=H-$,G=new m(Y);let K=0;const I=new Array(D),X=new Array(D);let Z=0;const W=new Uint8Array(T.buffer);for(let me=0;me<D;me++){const Me=me<V?$:F;I[me]=W.slice(K,K+Me),X[me]=G.encode(I[me]),K+=Me,Z=Math.max(Z,Me)}const fe=new Uint8Array(B);let te=0,re,le;for(re=0;re<Z;re++)for(le=0;le<D;le++)re<I[le].length&&(fe[te++]=I[le][re]);for(re=0;re<Y;re++)for(le=0;le<D;le++)fe[te++]=X[le][re];return fe}function A(T,z,O,B){let P;if(Array.isArray(T))P=_.fromArray(T);else if(typeof T=="string"){let H=z;if(!H){const $=_.rawSplit(T);H=g.getBestVersionForData($,O)}P=_.fromString(T,H||40)}else throw new Error("Invalid data");const U=g.getBestVersionForData(P,O);if(!U)throw new Error("The amount of data is too big to be stored in a QR Code");if(!z)z=U;else if(z<U)throw new Error(`
|
|
794
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
795
|
+
Minimum version required to store current data is: `+U+`.
|
|
796
|
+
`);const D=E(z,O,P),L=e.getSymbolSize(z),V=new o(L);return j(V,z),N(V),y(V,z),S(V,O,0),z>=7&&w(V,z),k(V,D),isNaN(B)&&(B=d.getBestMask(V,S.bind(null,V,O))),d.applyMask(B,V),S(V,O,B),{modules:V,version:z,errorCorrectionLevel:O,maskPattern:B,segments:P}}return Ih.create=function(z,O){if(typeof z>"u"||z==="")throw new Error("No input text");let B=t.M,P,U;return typeof O<"u"&&(B=t.from(O.errorCorrectionLevel,t.M),P=g.from(O.version),U=d.from(O.maskPattern),O.toSJISFunc&&e.setToSJISFunction(O.toSJISFunc)),A(z,P,B,U)},Ih}var sx={},ax={},Pk;function QE(){return Pk||(Pk=1,(function(e){function t(a){if(typeof a=="number"&&(a=a.toString()),typeof a!="string")throw new Error("Color should be defined as hex string");let o=a.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+a);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(c){return[c,c]}))),o.length===6&&o.push("F","F");const 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,d=o.scale||4;return{width:c,scale:c?4:d,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 d=l.modules.size,p=l.modules.data,m=e.getScale(d,c),g=Math.floor((d+c.margin*2)*m),h=c.margin*m,b=[c.color.light,c.color.dark];for(let _=0;_<g;_++)for(let j=0;j<g;j++){let N=(_*g+j)*4,y=c.color.light;if(_>=h&&j>=h&&_<g-h&&j<g-h){const w=Math.floor((_-h)/m),S=Math.floor((j-h)/m);y=b[p[w*d+S]?1:0]}o[N++]=y.r,o[N++]=y.g,o[N++]=y.b,o[N]=y.a}}})(ax)),ax}var Lk;function R9(){return Lk||(Lk=1,(function(e){const t=QE();function a(l,c,d){l.clearRect(0,0,c.width,c.height),c.style||(c.style={}),c.height=d,c.width=d,c.style.height=d+"px",c.style.width=d+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(c,d,p){let m=p,g=d;typeof m>"u"&&(!d||!d.getContext)&&(m=d,d=void 0),d||(g=o()),m=t.getOptions(m);const h=t.getImageWidth(c.modules.size,m),b=g.getContext("2d"),_=b.createImageData(h,h);return t.qrToImageData(_.data,c,m),a(b,g,h),b.putImageData(_,0,0),g},e.renderToDataURL=function(c,d,p){let m=p;typeof m>"u"&&(!d||!d.getContext)&&(m=d,d=void 0),m||(m={});const g=e.render(c,d,m),h=m.type||"image/png",b=m.rendererOpts||{};return g.toDataURL(h,b.quality)}})(sx)),sx}var rx={},Ik;function T9(){if(Ik)return rx;Ik=1;const e=QE();function t(l,c){const d=l.a/255,p=c+'="'+l.hex+'"';return d<1?p+" "+c+'-opacity="'+d.toFixed(2).slice(1)+'"':p}function a(l,c,d){let p=l+c;return typeof d<"u"&&(p+=" "+d),p}function o(l,c,d){let p="",m=0,g=!1,h=0;for(let b=0;b<l.length;b++){const _=Math.floor(b%c),j=Math.floor(b/c);!_&&!g&&(g=!0),l[b]?(h++,b>0&&_>0&&l[b-1]||(p+=g?a("M",_+d,.5+j+d):a("m",m,0),m=0,g=!1),_+1<c&&l[b+1]||(p+=a("h",h),h=0)):m++}return p}return rx.render=function(c,d,p){const m=e.getOptions(d),g=c.modules.size,h=c.modules.data,b=g+m.margin*2,_=m.color.light.a?"<path "+t(m.color.light,"fill")+' d="M0 0h'+b+"v"+b+'H0z"/>':"",j="<path "+t(m.color.dark,"stroke")+' d="'+o(h,g,m.margin)+'"/>',N='viewBox="0 0 '+b+" "+b+'"',w='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+N+' shape-rendering="crispEdges">'+_+j+`</svg>
|
|
797
|
+
`;return typeof p=="function"&&p(null,w),w},rx}var Bk;function A9(){if(Bk)return Ol;Bk=1;const e=d9(),t=E9(),a=R9(),o=T9();function l(c,d,p,m,g){const h=[].slice.call(arguments,1),b=h.length,_=typeof h[b-1]=="function";if(!_&&!e())throw new Error("Callback required as last argument");if(_){if(b<2)throw new Error("Too few arguments provided");b===2?(g=p,p=d,d=m=void 0):b===3&&(d.getContext&&typeof g>"u"?(g=m,m=void 0):(g=m,m=p,p=d,d=void 0))}else{if(b<1)throw new Error("Too few arguments provided");return b===1?(p=d,d=m=void 0):b===2&&!d.getContext&&(m=p,p=d,d=void 0),new Promise(function(j,N){try{const y=t.create(p,m);j(c(y,d,m))}catch(y){N(y)}})}try{const j=t.create(p,m);g(null,c(j,d,m))}catch(j){g(j)}}return Ol.create=t.create,Ol.toCanvas=l.bind(null,a.render),Ol.toDataURL=l.bind(null,a.renderToDataURL),Ol.toString=l.bind(null,function(c,d,p){return o.render(c,p)}),Ol}var M9=A9();const O9=tb(M9);function z9({value:e,size:t=200}){const[a,o]=x.useState(null);return x.useEffect(()=>{let l=!0;return O9.toDataURL(e,{margin:2,width:t*2,errorCorrectionLevel:"M"}).then(c=>{l&&o(c)}).catch(()=>{l&&o(null)}),()=>{l=!1}},[e,t]),s.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:t+24,height:t+24},children:a?s.jsx("img",{src:a,width:t,height:t,alt:"QR"}):s.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function D9(e){return e.find(t=>!t.includes("127.0.0.1")&&!t.includes("localhost"))||e[0]||window.location.origin}function P9({open:e,onClose:t,onPaired:a}){const o=Ze(),[l,c]=x.useState(null),[d,p]=x.useState(null),[m,g]=x.useState(0),[h,b]=x.useState(!1),_=x.useRef(null),j=x.useCallback(async()=>{c(null),p(null),b(!1);try{const k=await si.init();c(k),g(Math.round((k.ttl_ms||9e4)/1e3))}catch(k){k instanceof cu&&k.status===403?p(u("settings.devices_pair_localhost_only")):p(k.message)}},[]);x.useEffect(()=>{e?j():(c(null),p(null),b(!1))},[e,j]),x.useEffect(()=>{if(!l||h||m<=0)return;const k=window.setTimeout(()=>g(E=>E-1),1e3);return()=>window.clearTimeout(k)},[l,m,h]),x.useEffect(()=>{if(!e||!l||h)return;let k=!0;const E=async()=>{try{const R=await si.status(l.pairing_id);if(!k)return;if(R.status==="confirmed"){b(!0),o.success(u("settings.devices_pair_done")),a(),window.setTimeout(()=>{k&&t()},900);return}if(R.status==="expired"||R.status==="unknown"){g(0);return}}catch{}_.current=window.setTimeout(E,1500)};return _.current=window.setTimeout(E,1500),()=>{k=!1,_.current&&window.clearTimeout(_.current)}},[e,l,h,t,a,o]);const N=!!l&&!h&&m<=0,y=l?D9(l.lan_urls):"",w=l?`${y}/#pair=${l.pairing_id}`:"",S=async(k,E)=>{try{await navigator.clipboard.writeText(k),o.success(E)}catch{o.error(k)}};return s.jsxs(Zt,{open:e,onClose:t,title:u("settings.devices_pair_title"),description:u("settings.devices_pair_desc"),footer:s.jsx(se,{variant:"secondary",onClick:t,children:u("common.close")}),children:[d&&s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:d}),!d&&!l&&s.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[s.jsx(_n,{})," ",u("common.loading")]}),!d&&l&&s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx("div",{className:N?"opacity-40":"",children:s.jsx(z9,{value:w,size:196})}),h?s.jsx("p",{className:"text-sm font-medium text-emerald-500",children:u("settings.devices_pair_done")}):N?s.jsxs("div",{className:"flex flex-col items-center gap-2",children:[s.jsx("p",{className:"text-sm text-muted-fg",children:u("settings.devices_pair_expired")}),s.jsx(se,{variant:"primary",onClick:()=>void j(),children:u("settings.devices_pair_regen")})]}):s.jsxs(s.Fragment,{children:[s.jsx("p",{className:"text-center text-xs text-muted-fg",children:u("settings.devices_pair_scan")}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[s.jsx(_n,{size:12}),s.jsx("span",{children:u("settings.devices_pair_waiting")}),s.jsxs("span",{className:"tabular-nums",children:["· ",u("settings.devices_pair_expires",{s:m})]})]}),s.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs text-muted-fg",children:u("settings.devices_pair_link")}),s.jsxs("div",{className:"flex items-stretch gap-2",children:[s.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:w}),s.jsx($e,{content:u("settings.devices_pair_copy"),children:s.jsx(se,{size:"sm",variant:"secondary",onClick:()=>S(w,u("settings.devices_pair_copied")),children:s.jsx(No,{size:14})})})]})]}),s.jsxs("div",{className:"space-y-1",children:[s.jsx("p",{className:"text-xs text-muted-fg",children:u("settings.devices_pair_code")}),s.jsxs("div",{className:"flex items-stretch gap-2",children:[s.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}),s.jsx($e,{content:u("settings.devices_pair_copy"),children:s.jsx(se,{size:"sm",variant:"secondary",onClick:()=>S(l.pairing_id,u("settings.devices_pair_copied_code")),children:s.jsx(No,{size:14})})})]})]})]})]})]})]})}function L9(){const e=Ze(),{clients:t,isLoading:a,mutate:o}=u9(),[l,c]=x.useState(!1),[d,p]=x.useState(""),m=async h=>{if(confirm(u("settings.devices_revoke_confirm",{id:h})))try{await si.revoke(h),e.success(u("settings.devices_revoke_success")),o()}catch(b){e.error(b.message)}},g=()=>{const h=d.trim();if(h){So(h);try{localStorage.setItem(zn.token,h)}catch{}p(""),e.success(u("settings.token_saved"))}};return s.jsxs("div",{className:"space-y-6",children:[s.jsxs(Ye,{title:u("settings.devices"),description:u("settings.devices_sub"),action:s.jsxs(se,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[s.jsx(c3,{size:14})," ",u("settings.devices_pair_btn")]}),children:[a&&s.jsx(rt,{}),!a&&t.length===0&&s.jsx(pt,{children:u("settings.devices_empty")}),t.length>0&&s.jsx("ul",{className:"space-y-2 text-sm",children:t.map(h=>s.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[s.jsx("span",{className:"font-medium",children:h.label||h.id}),s.jsx(He,{tone:h.kind==="web"?"info":h.kind==="deck"?"success":"muted",children:h.kind}),s.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",h.token_suffix]}),s.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[u("settings.devices_last_seen")," ",h.last_seen?new Date(h.last_seen).toLocaleString():u("settings.devices_never")]}),s.jsx(se,{size:"sm",variant:"destructive",onClick:()=>m(h.id),children:u("settings.devices_revoke")})]},h.id))}),s.jsx(P9,{open:l,onClose:()=>c(!1),onPaired:()=>o()})]}),s.jsxs(Ye,{title:u("settings.token"),description:u("settings.token_sub"),children:[s.jsx(ae,{label:u("settings_ui.bearer_label"),children:s.jsx(Ne,{type:"password",placeholder:E_()?u("settings.token_active"):u("settings.token_paste"),value:d,onChange:h=>p(h.target.value),className:"font-mono",onKeyDown:h=>{h.key==="Enter"&&g()}})}),s.jsx("div",{className:"mt-2",children:s.jsx(se,{variant:"primary",onClick:g,children:u("common.save")})})]})]})}const I9=[{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:Sb.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 B9(){const{config:e,isLoading:t,patch:a,mutate:o}=lr();if(t)return s.jsx(rt,{});const l=async c=>{const d={};for(const[p,m]of Object.entries(G_(c)))ds(m)||(d[p]=m);await a(d),o()};return s.jsx(Ye,{title:u("global_config.title"),description:u("settings_ui.global_config_desc"),children:s.jsx(cf,{sections:I9,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:u("settings_ui.global_json_desc"),onSaveFields:async(c,d)=>{await a(c,d),o()},onSaveJson:l})})}function U9(){const e=Ze(),{health:t,isUp:a}=TN(),o=async()=>{try{await ni.reload(),e.success(u("settings.advanced.reload_success"))}catch(l){e.error(l.message)}};return s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ye,{title:u("daemon.version"),action:s.jsx(se,{size:"sm",onClick:o,children:u("common.reload")}),children:s.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[s.jsx(ox,{label:u("daemon.version"),value:t?.version||"—"}),s.jsx(ox,{label:u("daemon.uptime"),value:t?`${t.uptime_s}s`:"—"}),s.jsx(ox,{label:u("daemon.status"),value:u(a?"daemon.running":"daemon.down"),ok:a})]})}),s.jsx(B9,{})]})}function ox({label:e,value:t,ok:a}){return s.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[s.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),s.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[a!==void 0&&s.jsx(fu,{ok:a}),s.jsx("span",{children:t})]})]})}function $9(){const{preference:e,set:t}=Cb(),[a,o]=x.useState(k_()),l=c=>{sN(c),o(c),window.location.reload()};return s.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[s.jsx(Ye,{title:u("settings.appearance"),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{variant:e==="light"?"primary":"secondary",onClick:()=>t("light"),children:u("settings.light_mode")}),s.jsx(se,{variant:e==="dark"?"primary":"secondary",onClick:()=>t("dark"),children:u("settings.dark_mode")}),s.jsx(se,{variant:e==="system"?"primary":"secondary",onClick:()=>t("system"),children:u("settings.system_mode")})]})}),s.jsx(Ye,{title:u("settings.language"),children:s.jsx("div",{className:"flex items-center gap-2",children:aN.map(c=>s.jsx(se,{variant:a===c.value?"primary":"secondary",onClick:()=>l(c.value),children:c.label},c.value))})})]})}function H9({className:e,...t}){return s.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 Wx=typeof navigator<"u"&&/mac/i.test(navigator.platform||"");function q9(e){return(Wx?{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 V9(e){return(e||"").split("+").map(t=>t.trim()).filter(Boolean)}function F9(e){const t=e.code;if(/^(Shift|Control|Alt|Meta|OS)(Left|Right)?$/.test(t))return null;let a;if((a=t.match(/^Key([A-Z])$/))||(a=t.match(/^Digit(\d)$/))||(a=t.match(/^Numpad(\d)$/))||(a=t.match(/^(F\d{1,2})$/))||(a=t.match(/^Arrow(Up|Down|Left|Right)$/)))return a[1];const o={Space:"Space",Enter:"Enter",Tab:"Tab",Backspace:"Backspace",Delete:"Delete",Home:"Home",End:"End",PageUp:"PageUp",PageDown:"PageDown",Insert:"Insert",Minus:"-",Equal:"=",BracketLeft:"[",BracketRight:"]",Backslash:"\\",Semicolon:";",Quote:"'",Comma:",",Period:".",Slash:"/",Backquote:"`"};return o[t]?o[t]:e.key&&e.key.length===1?e.key.toUpperCase():null}function G9(e){const t=F9(e);if(!t)return null;const a=[];(Wx?e.metaKey:e.ctrlKey)&&a.push("CommandOrControl"),Wx&&e.ctrlKey&&a.push("Control"),e.altKey&&a.push("Alt"),e.shiftKey&&a.push("Shift");const o=a.length>0,l=/^F\d{1,2}$/.test(t);return!o&&!l?null:(a.push(t),a.join("+"))}function Y9({value:e,onChange:t,disabled:a,className:o,trailing:l}){const[c,d]=x.useState(!1),p=x.useRef(null);x.useEffect(()=>{if(!c)return;const g=h=>{if(h.preventDefault(),h.stopPropagation(),h.key==="Escape"){d(!1);return}const b=G9(h);b&&(t(b),d(!1))};return window.addEventListener("keydown",g,!0),()=>window.removeEventListener("keydown",g,!0)},[c,t]);const m=V9(e);return s.jsxs("div",{className:he("flex h-9 w-full max-w-md items-center rounded-md border border-border bg-transparent transition",c&&"ring-2 ring-ring",a&&"opacity-50",o),children:[s.jsxs("button",{ref:p,type:"button",disabled:a,onClick:()=>d(g=>!g),onBlur:()=>d(!1),"aria-label":u("modules_ui.desktop_shortcut_record"),className:"flex h-full min-w-0 flex-1 items-center gap-1.5 rounded-l-md px-3 text-sm outline-none hover:bg-muted/40 focus-visible:bg-muted/40",children:[c?s.jsx("span",{className:"text-muted-fg",children:u("modules_ui.desktop_shortcut_recording")}):m.length?s.jsx("span",{className:"flex min-w-0 flex-wrap items-center gap-1",children:m.map((g,h)=>s.jsxs("span",{className:"flex items-center gap-1",children:[h>0&&s.jsx("span",{className:"text-xs text-muted-fg",children:"+"}),s.jsx(H9,{className:"h-6 min-w-6 border border-border bg-muted px-1.5 text-[13px] font-semibold text-fg shadow-sm",children:q9(g)})]},h))}):s.jsx("span",{className:"text-muted-fg",children:u("modules_ui.desktop_shortcut_record")}),s.jsx("span",{className:"ml-auto whitespace-nowrap pl-2 text-xs text-muted-fg",children:u(c?"modules_ui.desktop_shortcut_esc":"modules_ui.desktop_shortcut_change")})]}),l?s.jsx("div",{className:"flex h-full items-center border-l border-border px-1",children:l}):null]})}const Ll={status:()=>ne.get("/desktop/status"),start:()=>ne.post("/desktop/start",{}),stop:()=>ne.post("/desktop/stop",{}),restart:()=>ne.post("/desktop/restart",{}),autostartGet:()=>ne.get("/desktop/autostart"),autostartSet:e=>ne.post("/desktop/autostart",{enable:e})};function K9(e=30){return ne.get(`/messages/global?channel=desktop&limit=${e}`)}function WE({showConfigLink:e=!1}){const t=Ze(),{data:a,isLoading:o,mutate:l}=qe("/desktop/status",()=>Ll.status(),{refreshInterval:5e3}),c=!!a?.running,[d,p]=x.useState(null),m=async(_,j)=>{p(_);try{await j()}catch(N){t.error(N.message)}finally{p(null),setTimeout(()=>l(),1200)}},g=()=>m("start",async()=>{const _=await Ll.start();t.success(_.already?u("modules_ui.desktop_start_already"):u("modules_ui.desktop_start_done"))}),h=()=>m("stop",async()=>{const _=await Ll.stop();t.success(_.stopped?u("modules_ui.desktop_stop_done"):u("modules_ui.desktop_stop_none"))}),b=()=>m("restart",async()=>{(await Ll.restart()).reloaded>0?t.success(u("modules_ui.desktop_restart_done")):t.info(u("modules_ui.desktop_restart_none"))});return s.jsx(Ye,{title:u("desktop_screen.status_title"),description:u("modules_ui.desktop_status_desc"),action:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(se,{variant:"primary",size:"sm",onClick:g,loading:d==="start",disabled:c||d!==null&&d!=="start",children:u("modules_ui.desktop_start")}),s.jsx(se,{variant:"secondary",size:"sm",onClick:h,loading:d==="stop",disabled:!c||d!==null&&d!=="stop",children:u("modules_ui.desktop_stop")}),s.jsx(se,{variant:"secondary",size:"sm",onClick:b,loading:d==="restart",disabled:!c||d!==null&&d!=="restart",title:u("modules_ui.desktop_restart_hint"),children:u("modules_ui.desktop_restart")}),e&&s.jsx(Yf,{to:"/settings/desktop",children:s.jsxs(se,{size:"sm",variant:"ghost",children:[s.jsx(Wf,{size:14})," ",u("desktop_screen.open_config")]})})]}),children:o?s.jsx(rt,{}):s.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm",children:[s.jsx(fu,{ok:c}),s.jsx("span",{className:"font-medium",children:u(c?"modules_ui.desktop_running":"modules_ui.desktop_stopped")}),s.jsx("button",{type:"button",onClick:()=>l(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:u("modules_ui.desktop_refresh")}),s.jsxs("span",{className:"text-xs text-muted-fg",children:["(",u("modules_ui.desktop_from_terminal")," ",s.jsx(jw,{children:"apx desktop start"})," · ",s.jsx(jw,{children:"apx desktop --debug"}),")"]})]})})}const X9="CommandOrControl+G",Q9=()=>[{value:"left",label:u("modules_ui.desktop_pos_left")},{value:"center",label:u("modules_ui.desktop_pos_center")},{value:"right",label:u("modules_ui.desktop_pos_right")}],W9=()=>[{value:"system",label:u("modules_ui.desktop_theme_system")},{value:"light",label:u("modules_ui.desktop_theme_light")},{value:"dark",label:u("modules_ui.desktop_theme_dark")}];function Z9(){const e=Ze(),{config:t,isLoading:a,patch:o}=lr(),l=t,c=l.desktop?.shortcut||l.overlay?.shortcut||X9,d=l.desktop?.enabled!==!1,p=l.desktop?.theme||"system",m=l.desktop?.position||"right",{data:g,mutate:h}=qe("/desktop/autostart",()=>Ll.autostartGet()),[b,_]=x.useState(c),[j,N]=x.useState(!1),[y,w]=x.useState(!1);x.useEffect(()=>_(c),[c]);const S=async()=>{const R=b.trim();if(!(!R||R===c)){N(!0);try{await o({"desktop.shortcut":R}),e.success(u("modules_ui.desktop_shortcut_saved"))}catch(A){e.error(A.message)}finally{N(!1)}}},k=async(R,A,T)=>{N(!0);try{await o({[R]:A}),e.success(T)}catch(z){e.error(z.message)}finally{N(!1)}},E=async R=>{w(!0);try{await Ll.autostartSet(R),await h(),e.success(u(R?"modules_ui.desktop_autostart_on":"modules_ui.desktop_autostart_off"))}catch(A){e.error(A.message)}finally{w(!1)}};return s.jsxs("div",{className:"space-y-6","data-testid":"settings-desktop",children:[s.jsx(WE,{}),s.jsx(Ye,{title:u("desktop_screen.autostart_title"),description:u("modules_ui.desktop_autostart_desc"),children:g?s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsx(Bt,{checked:g.enabled,onChange:E,disabled:y,label:g.enabled?u("common.enabled"):u("common.disabled")}),s.jsx("span",{className:"text-xs text-muted-fg",children:u("modules_ui.desktop_platform",{platform:g.platform})})]}):s.jsx(rt,{})}),s.jsx(Ye,{title:u("desktop_screen.shortcut_title"),description:u("modules_ui.desktop_shortcut_desc"),children:a?s.jsx(rt,{}):s.jsx(ae,{label:u("modules_ui.desktop_accelerator"),hint:u("modules_ui.desktop_accelerator_hint"),children:s.jsx(Y9,{value:b,onChange:_,disabled:j,trailing:s.jsx(se,{variant:"primary",size:"sm",onClick:S,loading:j,disabled:!b.trim()||b.trim()===c,children:u("common.save")})})})}),s.jsx(Ye,{title:u("desktop_screen.appearance_title"),description:u("modules_ui.desktop_appearance_desc"),children:a?s.jsx(rt,{}):s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(ae,{label:u("modules_ui.desktop_theme"),hint:u("modules_ui.desktop_restart_apply"),children:s.jsx(ut,{value:p,onChange:R=>k("desktop.theme",R,u("modules_ui.desktop_theme_set",{value:R})),options:W9(),disabled:j})}),s.jsx(ae,{label:u("modules_ui.desktop_position"),hint:u("modules_ui.desktop_position_hint"),children:s.jsx(ut,{value:m,onChange:R=>k("desktop.position",R,u("modules_ui.desktop_position_set",{value:R})),options:Q9(),disabled:j})})]})}),s.jsx(Ye,{title:u("desktop_screen.activation_title"),description:u("modules_ui.desktop_activation_desc"),children:a?s.jsx(rt,{}):s.jsxs("div",{className:"space-y-3",children:[s.jsx(Bt,{checked:d,onChange:R=>k("desktop.enabled",R,u(R?"modules_ui.desktop_enabled_toast":"modules_ui.desktop_disabled_toast")),disabled:j,label:u(d?"modules_ui.desktop_plugin_on":"modules_ui.desktop_plugin_off")}),s.jsxs("p",{className:"text-xs text-muted-fg",children:[u("modules_ui.desktop_stt_engine")," ",s.jsx(Yf,{to:"/settings/voice",className:"font-medium text-fg underline underline-offset-2",children:u("nav.modules.voice")})," ",u("modules_ui.desktop_stt_engine_suffix")]})]})})]})}function J9({engines:e,order:t,onToggleEnabled:a,onToggleEmotions:o,onReorder:l,onConfigure:c,onRemove:d,onAddNew:p,busy:m}){const g=e.filter(j=>j.id!=="mock"),h=new Map(g.map(j=>[j.id,j])),b=[...t.filter(j=>h.has(j)),...g.map(j=>j.id).filter(j=>!t.includes(j))],_=(j,N)=>{const y=b.indexOf(j),w=y+N;if(y<0||w<0||w>=b.length)return;const S=[...b];[S[y],S[w]]=[S[w],S[y]],l(S)};return s.jsxs("div",{className:"space-y-2",children:[b.map((j,N)=>{const y=h.get(j),w=zf[j],S=y.custom?y.label||j:w?.name||j,k=y.custom?y.note||u("voice_ui.custom_note"):w?.note||"";return s.jsxs("div",{"data-testid":`voice-provider-${j}`,className:he("flex items-center gap-3 rounded-lg border px-3 py-2.5 border-border",!y.enabled&&"opacity-60"),children:[s.jsxs("div",{className:"flex flex-col",children:[s.jsx("button",{type:"button",onClick:()=>_(j,-1),disabled:m||N===0,"aria-label":u("voice_ui.move_up"),"data-testid":`voice-provider-${j}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:s.jsx(db,{className:"size-3.5"})}),s.jsx("button",{type:"button",onClick:()=>_(j,1),disabled:m||N===b.length-1,"aria-label":u("voice_ui.move_down"),"data-testid":`voice-provider-${j}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:s.jsx(ms,{className:"size-3.5"})})]}),s.jsx(fu,{ok:y.available?!0:y.configured?!1:null}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-sm font-medium",children:S}),y.custom&&s.jsx(He,{tone:"info",children:u("voice_ui.badge_custom")}),w?.local&&s.jsx(He,{tone:"info",children:u("voice_ui.badge_local")}),y.available?s.jsx(He,{tone:"success",children:u("voice_ui.badge_available")}):y.configured?s.jsx(He,{tone:"warning",children:u("voice_ui.badge_unavailable")}):s.jsx(He,{tone:"muted",children:u("voice_ui.badge_not_configured")})]}),s.jsx("div",{className:"truncate text-xs text-muted-fg",children:k})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.emotionsApplicable&&s.jsx("button",{type:"button",onClick:()=>o(j,!y.emotionsOn),disabled:m,title:u("voice_ui.emotions_hint"),"data-testid":`voice-provider-${j}-emotions`,className:he("rounded-md border px-2 py-1 text-xs font-medium transition-colors disabled:opacity-50",y.emotionsOn?"border-emerald-500/50 bg-emerald-500/10 text-emerald-300":"border-border text-muted-fg hover:text-fg"),children:u("voice_ui.emotions_short")}),s.jsx(Bt,{checked:y.enabled,onChange:E=>a(j,E),disabled:m}),s.jsxs(se,{size:"sm",variant:"secondary",onClick:()=>c(j),"data-testid":`voice-provider-${j}-config`,children:[s.jsx(d3,{className:"size-3.5"})," ",u("voice_ui.configure")]}),y.custom&&s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>d(j),disabled:m,"aria-label":u("voice_ui.remove"),"data-testid":`voice-provider-${j}-remove`,children:s.jsx(vn,{className:"size-3.5"})})]})]},j)}),s.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:[s.jsx(It,{className:"size-4"})," ",u("voice_ui.add_provider")]})]})}function Nn(e){return typeof e=="string"?e:e==null?"":String(e)}function eU(e){return e.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Uk({on:e,setOn:t,tags:a,setTags:o}){return s.jsxs("div",{className:"rounded-md border border-border/60 p-3 space-y-2",children:[s.jsx(Bt,{checked:e,onChange:t,label:u("voice_ui.emotions_label")}),s.jsx("p",{className:"text-xs text-muted-fg",children:u("voice_ui.emotions_hint")}),e&&s.jsx(ae,{label:u("voice_ui.emotions_tags_label"),hint:u("voice_ui.emotions_tags_hint"),children:s.jsx(Ne,{value:a,onChange:l=>o(l.target.value),placeholder:pL.join(", ")})})]})}function tU({open:e,providerId:t,config:a,onClose:o,onSave:l}){const[c,d]=x.useState(!1),[p,m]=x.useState(null),[g,h]=x.useState(""),[b,_]=x.useState({}),[j,N]=x.useState(!1),[y,w]=x.useState(""),[S,k]=x.useState(!1);if(x.useEffect(()=>{if(!e||!t)return;m(null),h("");const D=a||{},L=D.emotions;if(N(!!L?.enabled),w(Array.isArray(L?.tags)?L.tags.join(", "):""),k(!1),t==="__new__"||t.startsWith("custom:")){const H=D;_({label:Nn(H.label),base_url:Nn(H.base_url),model:Nn(H.model),voice:Nn(H.voice),format:Nn(H.format),style:Nn(H.style),temperature:Nn(H.temperature)})}else if(t==="piper"){const H=D;_({bin:Nn(H.bin),model:Nn(H.model),speaker:Nn(H.speaker)})}else if(t==="elevenlabs"){const H=D;_({model:Nn(H.model),voice_id:Nn(H.voice_id),output_format:Nn(H.output_format)})}else if(t==="openai"){const H=D;_({model:Nn(H.model)||"tts-1",voice:Nn(H.voice)||"alloy",format:Nn(H.format)||"mp3"})}else if(t==="gemini"){const H=D;_({model:Nn(H.model),voice:Nn(H.voice)||"Kore",style:Nn(H.style)})}else _({})},[e,t,a]),!t)return null;const E=t==="__new__",R=E||t.startsWith("custom:"),A=zf[t],T=D=>_(L=>({...L,...D})),z=t!=="piper"&&t!=="mock",O=z&&ds(a?.api_key),B=O?u("voice_ui.api_key_set",{suffix:Do(a?.api_key)??""}):u("voice_ui.api_key_label"),P=E?u("voice_ui.new_provider"):R?b.label||t.slice(7):A?.name||t,U=async()=>{d(!0),m(null);try{const D=E?eU(b.label):R?t.slice(7):"";if(R){if(!b.label.trim())throw new Error(u("voice_ui.err_label_required"));if(!b.base_url.trim())throw new Error(u("voice_ui.err_base_url_required"));if(!D)throw new Error(u("voice_ui.err_label_required"))}const L=R?`voice.tts.custom.${D}`:`voice.tts.${t}`,V={},H=[],$=(F,Y)=>{Y.trim()?V[`${L}.${F}`]=Y.trim():H.push(`${L}.${F}`)};if(R?(V[`${L}.label`]=b.label.trim(),V[`${L}.base_url`]=b.base_url.trim(),$("style",b.style),b.temperature.trim()&&!Number.isNaN(Number(b.temperature))?V[`${L}.temperature`]=Number(b.temperature):H.push(`${L}.temperature`),$("model",b.model),$("voice",b.voice)):t==="piper"?($("bin",b.bin),$("model",b.model),b.speaker.trim()?V[`${L}.speaker`]=b.speaker.trim():H.push(`${L}.speaker`)):t==="elevenlabs"?($("model",b.model),$("voice_id",b.voice_id),$("output_format",b.output_format)):t==="openai"?($("model",b.model),$("voice",b.voice),$("format",b.format)):t==="gemini"&&($("model",b.model),$("voice",b.voice),$("style",b.style)),R||t==="gemini"){V[`${L}.emotions.enabled`]=j;const F=y.split(",").map(Y=>Y.trim().toLowerCase()).filter(Boolean);F.length?V[`${L}.emotions.tags`]=F:H.push(`${L}.emotions.tags`)}z&&g.trim()&&(V[`${L}.api_key`]=g.trim()),await l({set:V,unset:H}),o()}catch(D){m(D.message||u("voice_ui.err_save"))}finally{d(!1)}};return s.jsx(Zt,{open:e,onClose:o,title:u("voice_screen.configure_provider",{name:P}),description:R?u("voice_ui.custom_desc"):A?.note,size:"md",footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:o,disabled:c,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:U,loading:c,"data-testid":"voice-provider-save",children:u("common.save")})]}),children:s.jsxs("div",{className:"space-y-3",children:[t==="piper"&&s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("voice_ui.piper_bin_label"),hint:u("voice_ui.piper_bin_hint"),children:s.jsx(Ne,{value:b.bin,onChange:D=>T({bin:D.target.value}),placeholder:"piper"})}),s.jsx(ae,{label:u("voice_ui.piper_model_label"),hint:u("voice_ui.piper_model_hint"),children:s.jsx(Ne,{value:b.model,onChange:D=>T({model:D.target.value}),placeholder:"/abs/path/voice.onnx"})}),s.jsx(ae,{label:u("voice_ui.piper_speaker_label"),hint:u("voice_ui.piper_speaker_hint"),children:s.jsx(Ne,{value:b.speaker,onChange:D=>T({speaker:D.target.value}),placeholder:"0"})})]}),t==="elevenlabs"&&s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("voice_ui.api_key_label"),hint:O?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_secret_hint",{env:"ELEVENLABS_API_KEY"}),children:s.jsx(Ne,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:B})}),s.jsx(ae,{label:u("voice_ui.model_label"),children:s.jsx(ut,{value:b.model||"",onChange:D=>T({model:D}),options:dL.map(D=>({value:D,label:D})),placeholder:"eleven_multilingual_v2"})}),s.jsx(ae,{label:u("voice_ui.voice_id_label"),hint:u("voice_ui.voice_id_hint"),children:s.jsx(Ne,{value:b.voice_id,onChange:D=>T({voice_id:D.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),s.jsx(ae,{label:u("voice_ui.output_format_label"),children:s.jsx(Ne,{value:b.output_format,onChange:D=>T({output_format:D.target.value}),placeholder:"mp3_44100_128"})})]}),t==="openai"&&s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("voice_ui.api_key_label"),hint:O?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:s.jsx(Ne,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:B})}),s.jsx(ae,{label:u("voice_ui.model_label"),children:s.jsx(ut,{value:b.model||"tts-1",onChange:D=>T({model:D}),options:fL.map(D=>({value:D,label:D}))})}),s.jsx(ae,{label:u("voice_ui.voice_label"),children:s.jsx(ut,{value:b.voice||"alloy",onChange:D=>T({voice:D}),options:cL.map(D=>({value:D,label:D}))})}),s.jsx(ae,{label:u("voice_ui.format_label"),children:s.jsx(ut,{value:b.format||"mp3",onChange:D=>T({format:D}),options:["mp3","opus","aac","flac","wav"].map(D=>({value:D,label:D}))})})]}),R&&s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("voice_ui.label_label"),hint:u("voice_ui.label_hint"),children:s.jsx(Ne,{value:b.label,onChange:D=>T({label:D.target.value}),placeholder:"QVox"})}),s.jsx(ae,{label:u("voice_ui.base_url_req_label"),hint:u("voice_ui.base_url_req_hint"),children:s.jsx(Ne,{value:b.base_url,onChange:D=>T({base_url:D.target.value}),placeholder:"http://127.0.0.1:5111/v1"})}),s.jsx(ae,{label:u("voice_ui.api_key_label"),hint:u(O?"voice_ui.api_key_keep_hint":"voice_ui.api_key_optional_hint"),children:s.jsx(Ne,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:B})}),s.jsx(ae,{label:u("voice_ui.style_label"),hint:u("voice_ui.openai_style_hint"),children:s.jsx(on,{rows:2,value:b.style||"",onChange:D=>T({style:D.target.value}),placeholder:u("voice_ui.style_ph")})}),s.jsx(ae,{label:u("voice_ui.temperature_label"),hint:u("voice_ui.temperature_hint"),children:s.jsx(Ne,{value:b.temperature,onChange:D=>T({temperature:D.target.value}),inputMode:"decimal",placeholder:"0.7"})}),s.jsx(Uk,{on:j,setOn:N,tags:y,setTags:w}),s.jsxs("div",{children:[s.jsxs("button",{type:"button",onClick:()=>k(D=>!D),className:"text-xs text-muted-fg hover:text-fg",children:[S?"▾ ":"▸ ",u("voice_ui.advanced")]}),S&&s.jsxs("div",{className:"mt-2 space-y-3",children:[s.jsx(ae,{label:u("voice_ui.model_label"),hint:u("voice_ui.custom_model_hint"),children:s.jsx(Ne,{value:b.model,onChange:D=>T({model:D.target.value}),placeholder:u("voice_ui.custom_optional_ph")})}),s.jsx(ae,{label:u("voice_ui.voice_label"),hint:u("voice_ui.custom_voice_hint"),children:s.jsx(Ne,{value:b.voice,onChange:D=>T({voice:D.target.value}),placeholder:u("voice_ui.custom_optional_ph")})})]})]})]}),t==="gemini"&&s.jsxs(s.Fragment,{children:[s.jsx(ae,{label:u("voice_ui.api_key_label"),hint:O?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_reuse_hint",{engine:"engines.gemini.api_key",env:"GEMINI_API_KEY"}),children:s.jsx(Ne,{type:"password",autoComplete:"new-password",value:g,onChange:D=>h(D.target.value),placeholder:B})}),s.jsx(ae,{label:u("voice_ui.model_label"),hint:u("voice_ui.gemini_model_hint"),children:s.jsx(Ne,{value:b.model,onChange:D=>T({model:D.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),s.jsx(ae,{label:u("voice_ui.voice_label"),children:s.jsx(ut,{value:b.voice||"Kore",onChange:D=>T({voice:D}),options:uL.map(D=>({value:D,label:D}))})}),s.jsx(ae,{label:u("voice_ui.style_label"),hint:u("voice_ui.style_hint"),children:s.jsx(on,{rows:2,value:b.style||"",onChange:D=>T({style:D.target.value}),placeholder:u("voice_ui.style_ph")})}),s.jsx(Uk,{on:j,setOn:N,tags:y,setTags:w})]}),t==="mock"&&s.jsx("p",{className:"text-sm text-muted-fg",children:u("voice_ui.mock_desc")}),p&&s.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p})]})})}function nU(){const e=x.useRef(null),t=x.useRef(null),[a,o]=x.useState(!1),[l,c]=x.useState(!1),d=x.useCallback(()=>{t.current&&(URL.revokeObjectURL(t.current),t.current=null)},[]);x.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),d()},[d]);const p=x.useCallback(async g=>{c(!0);try{d();const h=await gL(g);t.current=h,e.current||(e.current=new Audio);const b=e.current;b.src=h,b.onended=()=>o(!1),b.onerror=()=>o(!1),await b.play(),o(!0)}finally{c(!1)}},[d]),m=x.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),o(!1)},[]);return{play:p,stop:m,playing:a,loading:l}}function sU({engines:e,defaultProvider:t,mode:a}){const o=Ze(),{play:l,stop:c,playing:d,loading:p}=nU(),[m,g]=x.useState(u("voice_ui.test_default_text")),[h,b]=x.useState(""),[_,j]=x.useState(!1),[N,y]=x.useState(null),S=[{value:"",label:a==="single"&&t&&t!=="auto"?u("voice_ui.test_default_engine",{name:zf[t]?.name||t}):u("voice_ui.test_default_chain")},...e.filter(E=>E.id!=="mock").map(E=>({value:E.id,label:E.custom?E.label||E.id:zf[E.id]?.name||E.id,disabled:!E.available}))],k=async()=>{const E=m.trim();if(!E){o.error(u("voice_ui.test_empty_error"));return}j(!0);try{const R=await Df.say({text:E,provider:h||void 0});y(R),await l(R.audio_path)}catch(R){o.error(R.message||u("voice_ui.test_synth_error"))}finally{j(!1)}};return s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("voice_ui.test_engine_label"),hint:u("voice_ui.test_engine_hint"),children:s.jsx(ut,{value:h,onChange:b,options:S})}),s.jsx(ae,{label:u("voice_ui.test_text_label"),children:s.jsx(on,{rows:2,value:m,onChange:E=>g(E.target.value),placeholder:u("voice_ui.test_text_ph"),"data-testid":"voice-test-input"})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(se,{variant:"primary",onClick:k,loading:_,disabled:p,"data-testid":"voice-test-say",children:[s.jsx(b3,{className:"size-4"})," ",u("voice_ui.say_this")]}),d?s.jsxs(se,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[s.jsx(wb,{className:"size-4"})," ",u("voice_ui.stop")]}):N?s.jsxs(se,{variant:"secondary",onClick:()=>l(N.audio_path),loading:p,"data-testid":"voice-test-replay",children:[s.jsx(yb,{className:"size-4"})," ",u("voice_ui.replay")]}):null,N&&s.jsxs("span",{className:"text-xs text-muted-fg",children:[u("voice_ui.engine_result"),": ",s.jsx("strong",{children:N.provider}),N.duration_s?` · ${N.duration_s.toFixed(1)}s`:""]})]})]})}const $k={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 Hk({gpu:e}){const t=$k[e]??$k.none;return s.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 aU(e){return e.backend==="mlx"?"Metal · mlx-whisper":e.backend==="faster"?(e.device==="cuda"?"CUDA":"CPU")+" · faster-whisper":e.backend}const rU=()=>[{value:"auto",label:u("voice_ui.stt_provider_auto")},{value:"local",label:u("voice_ui.stt_provider_local")},{value:"openai",label:u("voice_ui.stt_provider_openai")},{value:"custom",label:u("voice_ui.stt_provider_custom")}],qk=()=>[{value:"auto",label:u("voice_ui.lang_auto")},{value:"es",label:u("voice_ui.lang_es")},{value:"en",label:u("voice_ui.lang_en")},{value:"pt",label:u("voice_ui.lang_pt")},{value:"fr",label:u("voice_ui.lang_fr")},{value:"it",label:u("voice_ui.lang_it")},{value:"de",label:u("voice_ui.lang_de")}];function oU({config:e,onPatch:t,busy:a}){const[o,l]=x.useState(null);x.useEffect(()=>{let L=!0;return Df.sttHardware().then(V=>{L&&l(V)}).catch(()=>{}),()=>{L=!1}},[]);const c=e.provider||"auto",d=e.local||{},p=e.openai||{},m=e.custom||{},g=d.model||"small",h=d.language||"auto",b=c==="auto"||c==="local",_=(L,V,H)=>{const $=H.trim();$!==(V||"").trim()&&t({[L]:$})},j=(L,V)=>{const H=V.trim();!H||ds(H)||t({[L]:H})},N=L=>ds(L)?u("voice_ui.api_key_set",{suffix:Do(L)??""}):u("voice_ui.api_key_label"),y=d.backend||"auto",w=o?.hardware.gpu||"none",S=y==="auto"?o?.recommended.backend||"faster":y,k=S==="mlx",E=k?"metal":S==="faster"&&w==="cuda"?"cuda":"none",R=()=>{const L=[{value:"auto",label:u("voice_ui.stt_backend_auto")}];return w==="metal"&&L.push({value:"mlx",label:"Metal — mlx-whisper"}),L.push({value:"faster",label:w==="cuda"?"CUDA — faster-whisper":"CPU — faster-whisper"}),L},[A,T]=x.useState([]);x.useEffect(()=>{let L=!0;return Df.sttModels(S).then(V=>{L&&T(V.models)}).catch(()=>{L&&T([])}),()=>{L=!1}},[S]);const z=L=>`${L.id} · ${L.downloaded?"✓ "+L.size:L.size}`,O=()=>A.length?A.map(L=>({value:k?L.repo:L.id,label:z(L)})):mL.map(L=>({value:L,label:L})),B=k?d.mlx_model||o?.recommended.model||"":g,P=k?"transcription.local.mlx_model":"transcription.local.model",U=A.find(L=>(k?L.repo:L.id)===B),D=!!U&&!U.downloaded;return s.jsxs("div",{className:"space-y-3",children:[o&&s.jsxs("div",{className:"rounded-lg border border-border bg-muted px-3 py-2 text-sm",children:[s.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[s.jsxs("span",{className:"text-muted-fg",children:[u("voice_ui.stt_hw_label"),":"]}),s.jsx(Hk,{gpu:o.hardware.gpu}),s.jsx("span",{className:"font-medium text-fg",children:o.hardware.gpuName||o.hardware.platform}),o.hardware.mem_gb?s.jsxs("span",{className:"text-muted-fg",children:["· ",o.hardware.mem_gb," GB",o.hardware.unified_memory?" unified":""]}):null]}),s.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[u("voice_ui.stt_hw_recommended"),":"," ",s.jsx("span",{className:"text-fg",children:o.recommended.model})," ","(",aU(o.recommended),")",o.recommended.limited?` — ${u("voice_ui.stt_hw_limited")}`:""]})]}),s.jsx(ae,{label:u("voice_ui.stt_engine_label"),hint:u("voice_ui.stt_engine_hint"),children:s.jsx(ut,{value:c,onChange:L=>t({"transcription.provider":L}),options:rU(),disabled:a,className:"max-w-md"})}),b&&s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("voice_ui.stt_backend_label"),hint:u("voice_ui.stt_backend_hint"),children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ut,{value:y,onChange:L=>t({"transcription.local.backend":L}),options:R(),disabled:a,className:"max-w-xs"}),s.jsx(Hk,{gpu:E})]})}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(ae,{label:u("voice_ui.stt_model_label"),hint:D?u("voice_ui.stt_model_needs_download",{size:U.size}):u("voice_ui.stt_model_hint"),children:s.jsx(ut,{value:B,onChange:L=>t({[P]:L}),options:O(),disabled:a})}),s.jsx(ae,{label:u("voice_ui.stt_language_label"),hint:u("voice_ui.stt_language_hint"),children:s.jsx(ut,{value:h,onChange:L=>t({"transcription.local.language":L}),options:qk(),disabled:a})})]})]}),c==="openai"&&s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(ae,{label:u("voice_ui.api_key_label"),hint:ds(p.api_key)?u("voice_ui.api_key_keep_hint"):u("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:s.jsx(Ne,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:N(p.api_key),onBlur:L=>j("transcription.openai.api_key",L.target.value),disabled:a})}),s.jsx(ae,{label:u("voice_ui.stt_openai_model_label"),hint:u("voice_ui.stt_openai_model_hint"),children:s.jsx(Ne,{defaultValue:p.model||"",placeholder:"whisper-1",onBlur:L=>_("transcription.openai.model",p.model,L.target.value),disabled:a})})]}),c==="custom"&&s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("voice_ui.stt_custom_baseurl_label"),hint:u("voice_ui.stt_custom_baseurl_hint"),children:s.jsx(Ne,{defaultValue:m.base_url||"",placeholder:"http://localhost:8000/v1",onBlur:L=>_("transcription.custom.base_url",m.base_url,L.target.value),disabled:a})}),s.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[s.jsx(ae,{label:u("voice_ui.stt_custom_model_label"),hint:u("voice_ui.stt_custom_model_hint"),children:s.jsx(Ne,{defaultValue:m.model||"",placeholder:"mlx-community/whisper-large-v3-turbo",onBlur:L=>_("transcription.custom.model",m.model,L.target.value),disabled:a})}),s.jsx(ae,{label:u("voice_ui.stt_language_label"),hint:u("voice_ui.stt_language_hint"),children:s.jsx(ut,{value:m.language||"auto",onChange:L=>t({"transcription.custom.language":L}),options:qk(),disabled:a})})]}),s.jsx(ae,{label:u("voice_ui.api_key_label"),hint:u("voice_ui.stt_custom_key_hint"),children:s.jsx(Ne,{type:"password",autoComplete:"new-password",defaultValue:"",placeholder:N(m.api_key),onBlur:L=>j("transcription.custom.api_key",L.target.value),disabled:a})})]})]})}function lU(){const e=Ze(),{config:t,isLoading:a,patch:o,mutate:l}=lr(),{data:c,isLoading:d,error:p,mutate:m}=qe("/tts/providers",()=>Df.providers()),[g,h]=x.useState(null),[b,_]=x.useState(!1),j=t,N=j.voice?.tts||{},y=j.transcription||{},w=c?.configured_provider||N.provider||"auto",S=c?.mode||N.mode||"chain",k=c?.order||[],E=(c?.engines||[]).map(U=>{if(!(!!U.custom||U.id==="gemini"))return U;const L=U.custom?N.custom?.[U.id.slice(7)]:N.gemini;return{...U,emotionsApplicable:!0,emotionsOn:!!L?.emotions?.enabled}}),R=x.useMemo(()=>!g||g==="__new__"?{}:g.startsWith("custom:")?N.custom?.[g.slice(7)]||{}:N[g]||{},[g,N]),A=async(U,D)=>{_(!0);try{const L=U.startsWith("custom:")?`voice.tts.custom.${U.slice(7)}.enabled`:`voice.tts.${U}.enabled`;await o({[L]:D}),await m()}catch(L){e.error(L.message)}finally{_(!1)}},T=async(U,D)=>{_(!0);try{const L=U.startsWith("custom:")?`voice.tts.custom.${U.slice(7)}.emotions.enabled`:`voice.tts.${U}.emotions.enabled`;await o({[L]:D}),await m(),await l()}catch(L){e.error(L.message)}finally{_(!1)}},z=async U=>{_(!0);try{await o({"voice.tts.order":U}),await m()}catch(D){e.error(D.message)}finally{_(!1)}},O=async({set:U,unset:D})=>{await o(U,D.length?D:void 0),await m(),await l(),e.success(u("voice_ui.toast_config_saved"))},B=async U=>{if(U.startsWith("custom:")&&window.confirm(u("voice_ui.remove_confirm"))){_(!0);try{const D=U.slice(7);await o({"voice.tts.order":k.filter(L=>L!==U)},[`voice.tts.custom.${D}`]),await m(),await l(),e.success(u("voice_ui.toast_provider_removed"))}catch(D){e.error(D.message)}finally{_(!1)}}},P=async(U,D)=>{try{await o(U,D),e.success(u("voice_ui.toast_transcription_updated"))}catch(L){e.error(L.message)}};return s.jsxs("div",{"data-testid":"screen-voice",children:[s.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[s.jsx(Ye,{title:u("voice_screen.providers_title"),description:u("voice_ui.providers_desc"),children:d||a?s.jsx(rt,{}):p?s.jsx(pt,{children:u("voice_ui.providers_load_error",{msg:p.message})}):s.jsx(J9,{engines:E,order:k,onToggleEnabled:A,onToggleEmotions:T,onReorder:z,onConfigure:U=>h(U),onRemove:B,onAddNew:()=>h("__new__"),busy:b})}),s.jsxs("div",{className:"space-y-6",children:[s.jsx(Ye,{title:u("voice_screen.test_title"),description:u("voice_ui.test_desc"),children:s.jsx(sU,{engines:E,defaultProvider:w,mode:S})}),s.jsx(Ye,{title:u("voice_screen.stt_title"),description:u("voice_ui.stt_desc"),children:a?s.jsx(rt,{}):s.jsx(oU,{config:y,onPatch:P})})]})]}),s.jsx(tU,{open:!!g,providerId:g,config:R,onClose:()=>h(null),onSave:O})]})}function iU(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 cU({manifest:e}){const t=e.daemon,a=e.safety;return s.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[s.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[s.jsxs("span",{className:"font-semibold text-foreground",children:[t.name," ",s.jsxs("span",{className:"font-normal text-muted-fg",children:["v",t.version]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),s.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_daemon_active",{uptime:iU(t.uptime_s)})})]})]}),s.jsxs("div",{className:"flex flex-wrap gap-2",children:[s.jsxs("span",{className:"text-muted-fg",children:[t.host,":",t.port]}),s.jsx("span",{className:"text-muted-fg",children:"·"}),s.jsxs("span",{className:"text-muted-fg",children:[u("modules_ui.deck_daemon_started")," ",new Date(t.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),s.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[a.direct_shell===!1&&s.jsx(He,{tone:"success",children:u("modules_ui.deck_safety_no_shell")}),a.arbitrary_commands===!1&&s.jsx(He,{tone:"success",children:u("modules_ui.deck_safety_no_arbitrary")}),a.dangerous_actions_require_confirmation&&s.jsx(He,{tone:"info",children:u("modules_ui.deck_safety_confirm")})]})]})}function uU(e){return e==="available"?"success":e==="configured"?"info":"muted"}function dU(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function fU(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function pU({widget:e,onToggle:t}){const a=e.source==="external",[o,l]=x.useState(!1),c=e.user_enabled===!0,d=async p=>{if(!(!t||o)){l(!0);try{await t(p)}finally{l(!1)}}};return s.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:he("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",a?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[s.jsx($e,{content:e.source==="apx"?u("deck_screen.widget_native"):u("deck_screen.widget_external"),children:s.jsx("span",{className:he("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"font-medium",children:e.title}),s.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),s.jsx(He,{tone:fU(e.kind),children:e.kind}),s.jsx(He,{tone:uU(e.status),children:dU(e.status)}),a?s.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:s.jsx(Bt,{checked:c,onChange:d,disabled:o||!t})}):s.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function mU({desktop:e,widgets:t,onToggle:a}){return t.length===0?null:s.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[s.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),s.jsx("ul",{className:"space-y-1.5",children:t.map(o=>s.jsx(pU,{widget:o,onToggle:o.source==="external"?l=>a(o.id,l):void 0},o.id))})]})}function gU(){Ze();const{data:e,error:t,isLoading:a,mutate:o}=qe("/deck/manifest",()=>hN.manifest(),{refreshInterval:3e4}),l=async(h,b)=>{},c=e?.deck.desktops??[],d=e?.deck.widgets??[],p=c.map(h=>({desktop:h,widgets:d.filter(b=>b.desktop===h.id)})),g=d.filter(h=>h.source==="external").filter(h=>h.user_enabled===!0).length;return s.jsxs("div",{className:"relative min-h-full","data-testid":"screen-deck",children:[s.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&&s.jsx(cU,{manifest:e}),s.jsxs(Ye,{title:u("deck_screen.widgets_title"),description:a?u("modules_ui.deck_loading_manifest"):t?u("modules_ui.deck_manifest_error"):u("modules_ui.deck_widgets_summary",{count:d.length,enabled:g}),action:s.jsx($e,{content:u("deck_screen.reload_manifest"),children:s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>o(),disabled:a,"aria-label":u("deck_screen.reload_manifest"),children:s.jsx(Vs,{size:14,className:a?"animate-spin":""})})}),children:[a&&s.jsx(rt,{label:u("modules_ui.deck_loading_manifest_full")}),!a&&t&&s.jsxs(pt,{children:[u("modules_ui.deck_manifest_load_failed")," ",s.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>o(),children:u("modules_ui.deck_retry")})]}),!a&&!t&&d.length===0&&s.jsx(pt,{children:u("modules_ui.deck_no_widgets")}),!a&&!t&&d.length>0&&s.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:p.filter(h=>h.widgets.length>0).map(h=>s.jsx(mU,{desktop:h.desktop,widgets:h.widgets,onToggle:l},h.desktop.id))})]}),e?.apx&&s.jsx(Ye,{title:u("deck_screen.context_title"),description:u("modules_ui.deck_context_desc"),children:s.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_active_project")}),s.jsx("span",{className:"font-medium",children:e.apx.active_project?e.apx.active_project.name:u("modules_ui.deck_none")})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_registered_projects")}),s.jsx("span",{className:"font-medium",children:e.apx.projects.length})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-muted-fg",children:u("modules_ui.deck_active_plugins")}),s.jsx("span",{className:"font-medium",children:Object.keys(e.apx.plugins).join(", ")||"—"})]})]})})]}),s.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:s.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card/95 p-8 text-center shadow-2xl",children:[s.jsx("div",{className:"mx-auto mb-4 flex size-12 items-center justify-center rounded-full bg-muted",children:s.jsx(zM,{className:"size-6 text-muted-fg"})}),s.jsx("span",{className:"inline-block rounded-full bg-muted px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-muted-fg",children:u("deck_screen.preview_badge")}),s.jsx("h2",{id:"deck-coming-soon-title",className:"mt-3 text-lg font-semibold",children:u("deck_screen.preview_title")}),s.jsx("p",{className:"mt-2 text-sm text-muted-fg",children:u("deck_screen.preview_body")})]})})]})}const hU=[{title:u("settings.account_section"),items:[{key:"identity",label:u("settings.tabs.identity"),icon:kb}]},{title:u("settings.agents_section"),items:[{key:"super_agent",label:u("settings.tabs.super_agent"),icon:un},{key:"engines",label:u("settings.tabs.engines"),icon:pb},{key:"memory",label:"Memory (RAG)",icon:US},{key:"skills",label:u("skills_page.title"),icon:ea}]},{title:u("settings.channels_section"),items:[{key:"telegram",label:u("settings.tabs.telegram"),icon:ja},{key:"devices",label:u("settings.tabs.devices"),icon:m3}]},{title:u("settings.modules_section"),items:[{key:"voice",label:u("nav.modules.voice"),icon:_b},{key:"desktop",label:u("nav.modules.desktop"),icon:vb},{key:"deck",label:u("nav.modules.deck"),icon:JM},{key:"web",label:u("nav.modules.web"),icon:GS}]},{title:u("settings.advanced_section"),items:[{key:"advanced",label:u("settings.tabs.advanced"),icon:jb}]}],xU=new Set(["engines","telegram","memory","skills","web","voice"]),bU={identity:()=>s.jsx(WB,{}),super_agent:()=>s.jsx(ZB,{}),engines:()=>s.jsx(sE,{}),memory:()=>s.jsx(t9,{}),skills:()=>s.jsx(a9,{}),telegram:()=>s.jsx(c9,{}),devices:()=>s.jsx(L9,{}),voice:()=>s.jsx(lU,{}),deck:()=>s.jsx(gU,{}),desktop:()=>s.jsx(Z9,{}),web:()=>s.jsx($9,{}),advanced:()=>s.jsx(U9,{})};function _U(){const e=Pn(),t=ts(),a=vU(t.pathname),o=bU[a],{collapsed:l,toggle:c}=S_(zn.sidebarCollapsed+".settings");return s.jsx(UN,{sections:hU,active:a,onChange:d=>e(d==="identity"?"/settings":`/settings/${yU(d)}`),collapsed:l,onToggleCollapse:c,contentClassName:`w-full ${xU.has(a)?"":"mx-auto max-w-3xl"} space-y-6 py-6 pt-3 pr-6 pl-4`,testId:`settings-tab-${a}`,children:s.jsx(o,{})})}function vU(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 yU(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function jU(){const{data:e,isLoading:t,mutate:a}=qe("/messages/global?channel=desktop",()=>K9(40),{refreshInterval:8e3});return s.jsx("div",{className:"mx-auto max-w-3xl space-y-6 p-6","data-testid":"screen-desktop",children:s.jsxs("div",{className:"space-y-6",children:[s.jsx("div",{children:s.jsx(WE,{showConfigLink:!0})}),s.jsx("div",{children:s.jsx(Ye,{title:u("desktop_screen.last_conv_title"),description:u("modules_ui.desktop_last_conv_desc"),action:s.jsx("button",{type:"button",onClick:()=>a(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:u("modules_ui.desktop_refresh")}),children:s.jsx(wU,{messages:e||[],loading:t})})})]})})}function wU({messages:e,loading:t}){const a=x.useMemo(()=>SU(e),[e]);return t?s.jsx(rt,{}):e.length?s.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:a.slice().reverse().map((o,l)=>s.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:o.map((c,d)=>s.jsx(kU,{m:c},d))},l))}):s.jsx(pt,{children:u("modules_ui.desktop_no_messages")})}function kU({m:e}){const t=e.direction==="in",a=CU(e.ts);return s.jsxs("div",{className:"py-1",children:[s.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[s.jsx("span",{className:"font-semibold",children:u(t?"modules_ui.desktop_you":"modules_ui.desktop_roby")}),s.jsx("span",{children:a})]}),s.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(t?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||s.jsx("span",{className:"italic opacity-50",children:u("modules_ui.desktop_empty_msg")})})]})}function SU(e){const t=[];for(const a of e)a.direction==="in"||!t.length?t.push([a]):t[t.length-1].push(a);return t}function CU(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 NU(e,t){const a=getComputedStyle(e),o=parseFloat(a.fontSize);return t*o}function EU(e,t){const a=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(a.fontSize);return t*o}function RU(e){return e/100*window.innerHeight}function TU(e){return e/100*window.innerWidth}function AU(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 Tc({groupSize:e,panelElement:t,styleProp:a}){let o;const[l,c]=AU(a);switch(c){case"%":{o=l/100*e;break}case"px":{o=l;break}case"rem":{o=EU(t,l);break}case"em":{o=NU(t,l);break}case"vh":{o=RU(l);break}case"vw":{o=TU(l);break}}return o}function Jn(e){return parseFloat(e.toFixed(3))}function ri({group:e}){const{orientation:t,panels:a}=e;return a.reduce((o,l)=>(o+=t==="horizontal"?l.element.offsetWidth:l.element.offsetHeight,o),0)}function Zx(e){const{panels:t}=e,a=ri({group:e});return a===0?t.map(o=>({groupResizeBehavior:o.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:o.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:o.panelConstraints.disabled,minSize:0,maxSize:100,panelId:o.id})):t.map(o=>{const{element:l,panelConstraints:c}=o;let d=0;if(c.collapsedSize!==void 0){const h=Tc({groupSize:a,panelElement:l,styleProp:c.collapsedSize});d=Jn(h/a*100)}let p;if(c.defaultSize!==void 0){const h=Tc({groupSize:a,panelElement:l,styleProp:c.defaultSize});p=Jn(h/a*100)}let m=0;if(c.minSize!==void 0){const h=Tc({groupSize:a,panelElement:l,styleProp:c.minSize});m=Jn(h/a*100)}let g=100;if(c.maxSize!==void 0){const h=Tc({groupSize:a,panelElement:l,styleProp:c.maxSize});g=Jn(h/a*100)}return{groupResizeBehavior:c.groupResizeBehavior,collapsedSize:d,collapsible:c.collapsible===!0,defaultSize:p,disabled:c.disabled,minSize:m,maxSize:g,panelId:o.id}})}function Ft(e,t="Assertion error"){if(!e)throw Error(t)}function Jx(e,t){return Array.from(t).sort(e==="horizontal"?MU:OU)}function MU(e,t){const a=e.element.offsetLeft-t.element.offsetLeft;return a!==0?a:e.element.offsetWidth-t.element.offsetWidth}function OU(e,t){const a=e.element.offsetTop-t.element.offsetTop;return a!==0?a:e.element.offsetHeight-t.element.offsetHeight}function ZE(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function JE(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function zU({orientation:e,rects:t,targetRect:a}){const o={x:a.x+a.width/2,y:a.y+a.height/2};let l,c=Number.MAX_VALUE;for(const d of t){const{x:p,y:m}=JE(o,d),g=e==="horizontal"?p:m;g<c&&(c=g,l=d)}return Ft(l,"No rect found"),l}let Jd;function DU(){return Jd===void 0&&(typeof matchMedia=="function"?Jd=!!matchMedia("(pointer:coarse)").matches:Jd=!1),Jd}function eR(e){const{element:t,orientation:a,panels:o,separators:l}=e,c=Jx(a,Array.from(t.children).filter(ZE).map(N=>({element:N}))).map(({element:N})=>N),d=[];let p=!1,m=!1,g=-1,h=-1,b=0,_,j=[];{let N=-1;for(const y of c)y.hasAttribute("data-panel")&&(N++,y.hasAttribute("data-disabled")||(b++,g===-1&&(g=N),h=N))}if(b>1){let N=-1;for(const y of c)if(y.hasAttribute("data-panel")){N++;const w=o.find(S=>S.element===y);if(w){if(_){const S=_.element.getBoundingClientRect(),k=y.getBoundingClientRect();let E;if(m){const R=a==="horizontal"?new DOMRect(S.right,S.top,0,S.height):new DOMRect(S.left,S.bottom,S.width,0),A=a==="horizontal"?new DOMRect(k.left,k.top,0,k.height):new DOMRect(k.left,k.top,k.width,0);switch(j.length){case 0:{E=[R,A];break}case 1:{const T=j[0],z=zU({orientation:a,rects:[S,k],targetRect:T.element.getBoundingClientRect()});E=[T,z===S?A:R];break}default:{E=j;break}}}else j.length?E=j:E=[a==="horizontal"?new DOMRect(S.right,k.top,k.left-S.right,k.height):new DOMRect(k.left,S.bottom,k.width,k.top-S.bottom)];for(const R of E){let A="width"in R?R:R.element.getBoundingClientRect();const T=DU()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(A.width<T){const O=T-A.width;A=new DOMRect(A.x-O/2,A.y,A.width+O,A.height)}if(A.height<T){const O=T-A.height;A=new DOMRect(A.x,A.y-O/2,A.width,A.height+O)}const z=N<=g||N>h;!p&&!z&&d.push({group:e,groupSize:ri({group:e}),panels:[_,w],separator:"width"in R?void 0:R,rect:A}),p=!1}}m=!1,_=w,j=[]}}else if(y.hasAttribute("data-separator")){y.ariaDisabled!==null&&(p=!0);const w=l.find(S=>S.element===y);w?j.push(w):(_=void 0,j=[])}else m=!0}return d}class tR{#e={};addListener(t,a){const o=this.#e[t];return o===void 0?this.#e[t]=[a]:o.includes(a)||o.push(a),()=>{this.removeListener(t,a)}}emit(t,a){const o=this.#e[t];if(o!==void 0)if(o.length===1)o[0].call(null,a);else{let l=!1,c=null;const d=Array.from(o);for(let p=0;p<d.length;p++){const m=d[p];try{m.call(null,a)}catch(g){c===null&&(l=!0,c=g)}}if(l)throw c}}removeAllListeners(){this.#e={}}removeListener(t,a){const o=this.#e[t];if(o!==void 0){const l=o.indexOf(a);l>=0&&o.splice(l,1)}}}let Gl={cursorFlags:0,state:"inactive"};const nv=new tR;function Io(){return Gl}function PU(e){return nv.addListener("change",e)}function LU(e){const t=Gl,a={...Gl};a.cursorFlags=e,Gl=a,nv.emit("change",{prev:t,next:a})}function Yl(e){const t=Gl;Gl=e,nv.emit("change",{prev:t,next:e})}const IU=e=>e,lx=()=>{},nR=1,sR=2,aR=4,rR=8,Vk=3,Fk=12;let ef;function Gk(){return ef===void 0&&(ef=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(ef=!0)),ef}function BU({cursorFlags:e,groups:t,state:a}){let o=0,l=0;switch(a){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(a){case"active":{if(e&&Gk()){const c=(e&nR)!==0,d=(e&sR)!==0,p=(e&aR)!==0,m=(e&rR)!==0;if(c)return p?"se-resize":m?"ne-resize":"e-resize";if(d)return p?"sw-resize":m?"nw-resize":"w-resize";if(p)return"s-resize";if(m)return"n-resize"}break}}return Gk()?o>0&&l>0?"move":o>0?"ew-resize":"ns-resize":o>0&&l>0?"grab":o>0?"col-resize":"row-resize"}}const Yk=new WeakMap;function sv(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:a}=Yk.get(e)??{};a===void 0&&(a=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(a):e.adoptedStyleSheets=[...e.adoptedStyleSheets,a]));const o=Io();switch(o.state){case"active":case"hover":{const l=BU({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(d=>d.group),state:o.state}),c=`*, *:hover {cursor: ${l} !important; }`;if(t===c)return;t=c,l?a.cssRules.length===0?a.insertRule(c):a.replaceSync(c):a.cssRules.length===1&&a.deleteRule(0);break}case"inactive":{t=void 0,a.cssRules.length===1&&a.deleteRule(0);break}}Yk.set(e,{prevStyle:t,styleSheet:a})}let pa=new Map;const oR=new tR;function UU(e){pa=new Map(pa),pa.delete(e)}function Kk(e,t){for(const[a]of pa)if(a.id===e)return a}function $r(e,t){for(const[a,o]of pa)if(a.id===e)return o;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Go(){return pa}function av(e,t){return oR.addListener("groupChange",a=>{a.group.id===e&&t(a)})}function rr(e,t,a){const o=pa.get(e);pa=new Map(pa),pa.set(e,t),oR.emit("groupChange",{group:e,isUserInteraction:a?.isUserInteraction===!0,prev:o,next:t})}function lR(e){const t=Io();let a=!1;switch(t.state){case"active":Yl({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(sv(e),a=!0,t.hitRegions.forEach(o=>{const l=$r(o.group.id,!0);rr(o.group,l,{isUserInteraction:!0})}))}return a}function Xk(e){e.defaultPrevented||lR(e.currentTarget)}function $U(e,t,a){let o,l={x:1/0,y:1/0};for(const c of t){const d=JE(a,c.rect);switch(e){case"horizontal":{d.x<=l.x&&(o=c,l=d);break}case"vertical":{d.y<=l.y&&(o=c,l=d);break}}}return o?{distance:l,hitRegion:o}:void 0}function HU(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function qU(e,t){if(e===t)throw new Error("Cannot compare node with itself");const a={a:Zk(e),b:Zk(t)};let o;for(;a.a.at(-1)===a.b.at(-1);)o=a.a.pop(),a.b.pop();Ft(o,"Stacking order can only be calculated for elements with a common ancestor");const l={a:Wk(Qk(a.a)),b:Wk(Qk(a.b))};if(l.a===l.b){const c=o.childNodes,d={a:a.a.at(-1),b:a.b.at(-1)};let p=c.length;for(;p--;){const m=c[p];if(m===d.a)return 1;if(m===d.b)return-1}}return Math.sign(l.a-l.b)}const VU=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function FU(e){const t=getComputedStyle(iR(e)??e).display;return t==="flex"||t==="inline-flex"}function GU(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||FU(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"||VU.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Qk(e){let t=e.length;for(;t--;){const a=e[t];if(Ft(a,"Missing node"),GU(a))return a}return null}function Wk(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Zk(e){const t=[];for(;e;)t.push(e),e=iR(e);return t}function iR(e){const{parentNode:t}=e;return HU(t)?t.host:t}function YU(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 KU({groupElement:e,hitRegion:t,pointerEventTarget:a}){if(!ZE(a)||a.contains(e)||e.contains(a))return!0;if(qU(a,e)>0){let o=a;for(;o;){if(o.contains(e))return!0;if(YU(o.getBoundingClientRect(),t))return!1;o=o.parentElement}}return!0}function rv(e,t){const a=[];return t.forEach((o,l)=>{if(l.disabled)return;const c=eR(l),d=$U(l.orientation,c,{x:e.clientX,y:e.clientY});d&&d.distance.x<=0&&d.distance.y<=0&&KU({groupElement:l.element,hitRegion:d.hitRegion.rect,pointerEventTarget:e.target})&&a.push(d.hitRegion)}),a}function XU(e,t){if(e.length!==t.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!=t[a])return!1;return!0}function Yn(e,t,a=0){return Math.abs(Jn(e)-Jn(t))<=a}function ua(e,t){return Yn(e,t)?0:e>t?1:-1}function Il({overrideDisabledPanels:e,panelConstraints:t,prevSize:a,size:o}){const{collapsedSize:l=0,collapsible:c,disabled:d,maxSize:p=100,minSize:m=0}=t;if(d&&!e)return a;if(ua(o,m)<0)if(c){const g=(l+m)/2;ua(o,g)<0?o=l:o=m}else o=m;return o=Math.min(p,o),o=Jn(o),o}function Xc({delta:e,initialLayout:t,panelConstraints:a,pivotIndices:o,prevLayout:l,trigger:c}){if(Yn(e,0))return t;const d=c==="imperative-api",p=Object.values(t),m=Object.values(l),g=[...p],[h,b]=o;Ft(h!=null,"Invalid first pivot index"),Ft(b!=null,"Invalid second pivot index");let _=0;switch(c){case"keyboard":{{const y=e<0?b:h,w=a[y];Ft(w,`Panel constraints not found for index ${y}`);const{collapsedSize:S=0,collapsible:k,minSize:E=0}=w;if(k){const R=p[y];if(Ft(R!=null,`Previous layout not found for panel index ${y}`),Yn(R,S)){const A=E-R;ua(A,Math.abs(e))>0&&(e=e<0?0-A:A)}}}{const y=e<0?h:b,w=a[y];Ft(w,`No panel constraints found for index ${y}`);const{collapsedSize:S=0,collapsible:k,minSize:E=0}=w;if(k){const R=p[y];if(Ft(R!=null,`Previous layout not found for panel index ${y}`),Yn(R,E)){const A=R-S;ua(A,Math.abs(e))>0&&(e=e<0?0-A:A)}}}break}default:{const y=e<0?b:h,w=a[y];Ft(w,`Panel constraints not found for index ${y}`);const S=p[y],{collapsible:k,collapsedSize:E,minSize:R}=w;if(k&&ua(S,R)<0)if(e>0){const A=R-E,T=A/2,z=S+e;ua(z,R)<0&&(e=ua(e,T)<=0?0:A)}else{const A=R-E,T=100-A/2,z=S-e;ua(z,R)<0&&(e=ua(100+e,T)>0?0:-A)}break}}{const y=e<0?1:-1;let w=e<0?b:h,S=0;for(;;){const E=p[w];Ft(E!=null,`Previous layout not found for panel index ${w}`);const R=Il({overrideDisabledPanels:d,panelConstraints:a[w],prevSize:E,size:100})-E;if(S+=R,w+=y,w<0||w>=a.length)break}const k=Math.min(Math.abs(e),Math.abs(S));e=e<0?0-k:k}{let y=e<0?h:b;for(;y>=0&&y<a.length;){const w=Math.abs(e)-Math.abs(_),S=p[y];Ft(S!=null,`Previous layout not found for panel index ${y}`);const k=S-w,E=Il({overrideDisabledPanels:d,panelConstraints:a[y],prevSize:S,size:k});if(!Yn(S,E)&&(_+=S-E,g[y]=E,_.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?y--:y++}}if(XU(m,g))return l;{const y=e<0?b:h,w=p[y];Ft(w!=null,`Previous layout not found for panel index ${y}`);const S=w+_,k=Il({overrideDisabledPanels:d,panelConstraints:a[y],prevSize:w,size:S});if(g[y]=k,!Yn(k,S)){let E=S-k,R=e<0?b:h;for(;R>=0&&R<a.length;){const A=g[R];Ft(A!=null,`Previous layout not found for panel index ${R}`);const T=A+E,z=Il({overrideDisabledPanels:d,panelConstraints:a[R],prevSize:A,size:T});if(Yn(A,z)||(E-=z-A,g[R]=z),Yn(E,0))break;e>0?R--:R++}}}const j=Object.values(g).reduce((y,w)=>w+y,0);if(!Yn(j,100,.1))return l;const N=Object.keys(l);return g.reduce((y,w,S)=>(y[N[S]]=w,y),{})}function Bo(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(t[a]===void 0||ua(e[a],t[a])!==0)return!1;return!0}function Uo({layout:e,panelConstraints:t}){const a=Object.values(e),o=[...a],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(!Yn(l,100)&&o.length>0)for(let p=0;p<t.length;p++){const m=o[p];Ft(m!=null,`No layout data found for index ${p}`);const g=100/l*m;o[p]=g}let c=0;for(let p=0;p<t.length;p++){const m=a[p];Ft(m!=null,`No layout data found for index ${p}`);const g=o[p];Ft(g!=null,`No layout data found for index ${p}`);const h=Il({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:g});g!=h&&(c+=g-h,o[p]=h)}if(!Yn(c,0))for(let p=0;p<t.length;p++){const m=o[p];Ft(m!=null,`No layout data found for index ${p}`);const g=m+c,h=Il({overrideDisabledPanels:!0,panelConstraints:t[p],prevSize:m,size:g});if(m!==h&&(c-=h-m,o[p]=h,Yn(c,0)))break}const d=Object.keys(e);return o.reduce((p,m,g)=>(p[d[g]]=m,p),{})}function cR({groupId:e,panelId:t}){const a=()=>{const m=Go();for(const[g,{defaultLayoutDeferred:h,derivedPanelConstraints:b,layout:_,groupSize:j,separatorToPanels:N}]of m)if(g.id===e)return{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:g,groupSize:j,layout:_,separatorToPanels:N};throw Error(`Group ${e} not found`)},o=()=>{const m=a().derivedPanelConstraints.find(g=>g.panelId===t);if(m!==void 0)return m;throw Error(`Panel constraints not found for Panel ${t}`)},l=()=>{const m=a().group.panels.find(g=>g.id===t);if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},c=()=>{const m=a().layout[t];if(m!==void 0)return m;throw Error(`Layout not found for Panel ${t}`)},d=({nextSize:m,panels:g,prevLayout:h,derivedPanelConstraints:b})=>{const _=c(),j=g.findIndex(w=>w.id===t),N=j===0,y=j===g.length-1;if(y&&m<_&&(N||g.slice(0,j).every((w,S)=>{const k=b[S];return k?.collapsible&&Yn(k.collapsedSize,h[k.panelId])}))){const w=g.slice(0,j).reduce((S,k)=>S+h[k.id],0);return{...h,[t]:Jn(100-w)}}return Xc({delta:y?_-m:m-_,initialLayout:h,panelConstraints:b,pivotIndices:y?[j-1,j]:[j,j+1],prevLayout:h,trigger:"imperative-api"})},p=m=>{const g=c();if(m===g)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:b,group:_,groupSize:j,layout:N,separatorToPanels:y}=a(),w=d({nextSize:m,panels:_.panels,prevLayout:N,derivedPanelConstraints:b}),S=Uo({layout:w,panelConstraints:b});Bo(N,S)||rr(_,{defaultLayoutDeferred:h,derivedPanelConstraints:b,groupSize:j,layout:S,separatorToPanels:y})};return{collapse:()=>{const{collapsible:m,collapsedSize:g}=o(),{mutableValues:h}=l(),b=c();m&&b!==g&&(h.expandToSize=b,p(g))},expand:()=>{const{collapsible:m,collapsedSize:g,minSize:h}=o(),{mutableValues:b}=l(),_=c();if(m&&_===g){let j=b.expandToSize??h;j===0&&(j=1),p(j)}},getSize:()=>{const{group:m}=a(),g=c(),{element:h}=l(),b=m.orientation==="horizontal"?h.offsetWidth:h.offsetHeight;return{asPercentage:g,inPixels:b}},isCollapsed:()=>{const{collapsible:m,collapsedSize:g}=o(),h=c();return m&&Yn(g,h)},resize:m=>{const{group:g}=a(),{element:h}=l(),b=ri({group:g}),_=Tc({groupSize:b,panelElement:h,styleProp:m}),j=Jn(_/b*100);p(j)}}}function Jk(e){if(e.defaultPrevented)return;const t=Go();rv(e,t).forEach(a=>{if(a.separator&&!a.separator.disableDoubleClick){const o=a.panels.find(l=>l.panelConstraints.defaultSize!==void 0);if(o){const l=o.panelConstraints.defaultSize,c=cR({groupId:a.group.id,panelId:o.id});c&&l!==void 0&&(c.resize(l),e.preventDefault())}}})}function df(e){const t=Go();for(const[a]of t)if(a.separators.some(o=>o.element===e))return a;throw Error("Could not find parent Group for separator element")}function uR({groupId:e}){const t=()=>{const a=Go();for(const[o,l]of a)if(o.id===e)return{group:o,...l};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:a,layout:o}=t();return a?{}:o},setLayout(a){const{defaultLayoutDeferred:o,derivedPanelConstraints:l,group:c,groupSize:d,layout:p,separatorToPanels:m}=t(),g=Uo({layout:a,panelConstraints:l});return o?p:(Bo(p,g)||rr(c,{defaultLayoutDeferred:o,derivedPanelConstraints:l,groupSize:d,layout:g,separatorToPanels:m}),g)}}}function jo(e,t){const a=df(e),o=$r(a.id,!0),l=a.separators.find(h=>h.element===e);Ft(l,"Matching separator not found");const c=o.separatorToPanels.get(l);Ft(c,"Matching panels not found");const d=c.map(h=>a.panels.indexOf(h)),p=uR({groupId:a.id}).getLayout(),m=Xc({delta:t,initialLayout:p,panelConstraints:o.derivedPanelConstraints,pivotIndices:d,prevLayout:p,trigger:"keyboard"}),g=Uo({layout:m,panelConstraints:o.derivedPanelConstraints});Bo(p,g)||rr(a,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:g,separatorToPanels:o.separatorToPanels},{isUserInteraction:!0})}function eS(e){if(e.defaultPrevented)return;const t=e.currentTarget,a=df(t);if(!a.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),a.orientation==="vertical"&&jo(t,5);break}case"ArrowLeft":{e.preventDefault(),a.orientation==="horizontal"&&jo(t,-5);break}case"ArrowRight":{e.preventDefault(),a.orientation==="horizontal"&&jo(t,5);break}case"ArrowUp":{e.preventDefault(),a.orientation==="vertical"&&jo(t,-5);break}case"End":{e.preventDefault(),jo(t,100);break}case"Enter":{e.preventDefault();const o=df(t),l=$r(o.id,!0),{derivedPanelConstraints:c,layout:d,separatorToPanels:p}=l,m=o.separators.find(_=>_.element===t);Ft(m,"Matching separator not found");const g=p.get(m);Ft(g,"Matching panels not found");const h=g[0],b=c.find(_=>_.panelId===h.id);if(Ft(b,"Panel metadata not found"),b.collapsible){const _=d[h.id],j=b.collapsedSize===_?o.mutableState.expandedPanelSizes[h.id]??b.minSize:b.collapsedSize;jo(t,j-_)}break}case"F6":{e.preventDefault();const o=df(t).separators.map(d=>d.element),l=Array.from(o).findIndex(d=>d===e.currentTarget);Ft(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(),jo(t,-100);break}}}function tS(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=Go(),a=rv(e,t),o=new Map;let l=!1;a.forEach(c=>{c.separator&&(l||(l=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const d=t.get(c.group);d&&o.set(c.group,d.layout)}),Yl({cursorFlags:0,hitRegions:a,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),a.length&&e.preventDefault()}function dR({document:e,event:t,hitRegions:a,initialLayoutMap:o,mountedGroups:l,pointerDownAtPoint:c,prevCursorFlags:d}){let p=0;a.forEach(g=>{const{group:h,groupSize:b}=g,{orientation:_,panels:j}=h,{disableCursor:N}=h.mutableState;let y=0;c?_==="horizontal"?y=(t.clientX-c.x)/b*100:y=(t.clientY-c.y)/b*100:_==="horizontal"?y=t.clientX<0?-100:100:y=t.clientY<0?-100:100;const w=o.get(h),S=l.get(h);if(!w||!S)return;const{defaultLayoutDeferred:k,derivedPanelConstraints:E,groupSize:R,layout:A,separatorToPanels:T}=S;if(E&&A&&T){const z=Xc({delta:y,initialLayout:w,panelConstraints:E,pivotIndices:g.panels.map(O=>j.indexOf(O)),prevLayout:A,trigger:"mouse-or-touch"});if(Bo(z,A)){if(y!==0&&!N)switch(_){case"horizontal":{p|=y<0?nR:sR;break}case"vertical":{p|=y<0?aR:rR;break}}}else rr(g.group,{defaultLayoutDeferred:k,derivedPanelConstraints:E,groupSize:R,layout:z,separatorToPanels:T})}});let m=0;t.movementX===0?m|=d&Vk:m|=p&Vk,t.movementY===0?m|=d&Fk:m|=p&Fk,LU(m),sv(e)}function nS(e){const t=Go(),a=Io();switch(a.state){case"active":dR({document:e.currentTarget,event:e,hitRegions:a.hitRegions,initialLayoutMap:a.initialLayoutMap,mountedGroups:t,prevCursorFlags:a.cursorFlags})}}function sS(e){if(e.defaultPrevented)return;const t=Io(),a=Go();switch(t.state){case"active":{if(e.buttons===0){Yl({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(o=>{const l=$r(o.group.id,!0);rr(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)}dR({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:a,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const o=rv(e,a);o.length===0?t.state!=="inactive"&&Yl({cursorFlags:0,state:"inactive"}):Yl({cursorFlags:0,hitRegions:o,state:"hover"}),sv(e.currentTarget);break}}}function aS(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(Io().state){case"hover":Yl({cursorFlags:0,state:"inactive"})}}function rS(e){e.defaultPrevented||e.pointerType==="mouse"&&e.button>0||lR(e.currentTarget)&&e.preventDefault()}function oS(e){let t=0,a=0;const o={};for(const c of e)if(c.defaultSize!==void 0){t++;const d=Jn(c.defaultSize);a+=d,o[c.panelId]=d}else o[c.panelId]=void 0;const l=e.length-t;if(l!==0){const c=Jn((100-a)/l);for(const d of e)d.defaultSize===void 0&&(o[d.panelId]=c)}return o}function QU(e,t,a){if(!a[0])return;const o=e.panels.find(m=>m.element===t);if(!o||!o.onResize)return;const l=ri({group:e}),c=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,d=o.mutableValues.prevSize,p={asPercentage:Jn(c/l*100),inPixels:c};o.mutableValues.prevSize=p,o.onResize(p,o.id,d)}function WU(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const a in e)if(e[a]!==t[a])return!1;return!0}function ZU({group:e,nextGroupSize:t,prevGroupSize:a,prevLayout:o}){if(a<=0||t<=0||a===t)return o;let l=0,c=0,d=!1;const p=new Map,m=[];for(const b of e.panels){const _=o[b.id]??0;switch(b.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{d=!0;const j=_/100*a,N=Jn(j/t*100);p.set(b.id,N),l+=N;break}case"preserve-relative-size":default:{m.push(b.id),c+=_;break}}}if(!d||m.length===0)return o;const g=100-l,h={...o};if(p.forEach((b,_)=>{h[_]=b}),c>0)for(const b of m){const _=o[b]??0;h[b]=Jn(_/c*g)}else{const b=Jn(g/m.length);for(const _ of m)h[_]=b}return h}function JU(e,t){const a=e.map(l=>l.id),o=Object.keys(t);if(a.length!==o.length)return!1;for(const l of a)if(!o.includes(l))return!1;return!0}const zl=new Map;function e$(e){let t=!0;Ft(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const a=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,l=new Set,c=new a(N=>{for(const y of N){const{borderBoxSize:w,target:S}=y;if(S===e.element){if(t){const k=ri({group:e});if(k===0)return;const E=$r(e.id);if(!E)return;const R=Zx(e),A=E.defaultLayoutDeferred?oS(R):E.layout,T=ZU({group:e,nextGroupSize:k,prevGroupSize:E.groupSize,prevLayout:A}),z=Uo({layout:T,panelConstraints:R});if(!E.defaultLayoutDeferred&&Bo(E.layout,z)&&WU(E.derivedPanelConstraints,R)&&E.groupSize===k)return;rr(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:k,layout:z,separatorToPanels:E.separatorToPanels})}}else QU(e,S,w)}});c.observe(e.element),e.panels.forEach(N=>{Ft(!o.has(N.id),`Panel ids must be unique; id "${N.id}" was used more than once`),o.add(N.id),N.onResize&&c.observe(N.element)});const d=ri({group:e}),p=Zx(e),m=e.panels.map(({id:N})=>N).join(",");let g=e.mutableState.defaultLayout;g&&(JU(e.panels,g)||(g=void 0));const h=e.mutableState.layouts[m]??g??oS(p),b=Uo({layout:h,panelConstraints:p}),_=e.element.ownerDocument;zl.set(_,(zl.get(_)??0)+1);const j=new Map;return eR(e).forEach(N=>{N.separator&&j.set(N.separator,N.panels)}),rr(e,{defaultLayoutDeferred:d===0,derivedPanelConstraints:p,groupSize:d,layout:b,separatorToPanels:j}),e.separators.forEach(N=>{Ft(!l.has(N.id),`Separator ids must be unique; id "${N.id}" was used more than once`),l.add(N.id),N.element.addEventListener("keydown",eS)}),zl.get(_)===1&&(_.addEventListener("contextmenu",Xk,!0),_.addEventListener("dblclick",Jk,!0),_.addEventListener("pointerdown",tS,!0),_.addEventListener("pointerleave",nS),_.addEventListener("pointermove",sS),_.addEventListener("pointerout",aS),_.addEventListener("pointerup",rS,!0)),function(){t=!1,zl.set(_,Math.max(0,(zl.get(_)??0)-1)),UU(e),e.separators.forEach(N=>{N.element.removeEventListener("keydown",eS)}),zl.get(_)||(_.removeEventListener("contextmenu",Xk,!0),_.removeEventListener("dblclick",Jk,!0),_.removeEventListener("pointerdown",tS,!0),_.removeEventListener("pointerleave",nS),_.removeEventListener("pointermove",sS),_.removeEventListener("pointerout",aS),_.removeEventListener("pointerup",rS,!0)),c.disconnect()}}function t$(){const[e,t]=x.useState({}),a=x.useCallback(()=>t({}),[]);return[e,a]}function ov(e){const t=x.useId();return`${e??t}`}const Yo=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Ic(e){const t=x.useRef(e);return Yo(()=>{t.current=e},[e]),x.useCallback((...a)=>t.current?.(...a),[t])}function lv(...e){return Ic(t=>{e.forEach(a=>{if(a)switch(typeof a){case"function":{a(t);break}case"object":{a.current=t;break}}})})}function iv(e){const t=x.useRef({...e});return Yo(()=>{for(const a in e)t.current[a]=e[a]},[e]),t.current}const fR=x.createContext(null);function n$(e,t){const a=x.useRef({getLayout:()=>({}),setLayout:IU});x.useImperativeHandle(t,()=>a.current,[]),Yo(()=>{Object.assign(a.current,uR({groupId:e}))})}function eb({children:e,className:t,defaultLayout:a,disableCursor:o,disabled:l,elementRef:c,groupRef:d,id:p,onLayoutChange:m,onLayoutChanged:g,orientation:h="horizontal",resizeTargetMinimumSize:b={coarse:20,fine:10},style:_,...j}){const N=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),y=Ic(U=>{Bo(N.current.onLayoutChange,U)||(N.current.onLayoutChange=U,m?.(U))}),w=Ic((U,D)=>{Bo(N.current.onLayoutChanged,U)||(N.current.onLayoutChanged=U,g?.(U,{isUserInteraction:D}))}),S=ov(p),k=x.useRef(null),[E,R]=t$(),A=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:b,separators:[]}),T=lv(k,c);n$(S,d);const z=Ic((U,D)=>{const L=Io(),V=Kk(U),H=$r(U);if(H){let $=!1;switch(L.state){case"active":{$=L.hitRegions.some(F=>F.group===V);break}}return{flexGrow:H.layout[D]??1,pointerEvents:$?"none":void 0}}if(a?.[D])return{flexGrow:a?.[D]}}),O=iv({defaultLayout:a,disableCursor:o}),B=x.useMemo(()=>({get disableCursor(){return!!O.disableCursor},getPanelStyles:z,id:S,orientation:h,registerPanel:U=>{const D=A.current;return D.panels=Jx(h,[...D.panels,U]),R(),()=>{D.panels=D.panels.filter(L=>L!==U),R()}},registerSeparator:U=>{const D=A.current;return D.separators=Jx(h,[...D.separators,U]),R(),()=>{D.separators=D.separators.filter(L=>L!==U),R()}},updatePanelProps:(U,{disabled:D})=>{const L=A.current.panels.find($=>$.id===U);L&&(L.panelConstraints.disabled=D);const V=Kk(S),H=$r(S);V&&H&&rr(V,{...H,derivedPanelConstraints:Zx(V)})},updateSeparatorProps:(U,{disabled:D,disableDoubleClick:L})=>{const V=A.current.separators.find(H=>H.id===U);V&&(V.disabled=D,V.disableDoubleClick=L)}}),[z,S,R,h,O]),P=x.useRef(null);return Yo(()=>{const U=k.current;if(U===null)return;const D=A.current;let L;if(O.defaultLayout!==void 0&&Object.keys(O.defaultLayout).length===D.panels.length){L={};for(const K of D.panels){const I=O.defaultLayout[K.id];I!==void 0&&(L[K.id]=I)}}const V={disabled:!!l,element:U,id:S,mutableState:{defaultLayout:L,disableCursor:!!O.disableCursor,expandedPanelSizes:A.current.lastExpandedPanelSizes,layouts:A.current.layouts},orientation:h,panels:D.panels,resizeTargetMinimumSize:D.resizeTargetMinimumSize,separators:D.separators};P.current=V;const H=e$(V),{defaultLayoutDeferred:$,derivedPanelConstraints:F,layout:Y}=$r(V.id,!0);!$&&F.length>0&&(y(Y),w(Y,!1));const G=av(S,K=>{const{defaultLayoutDeferred:I,derivedPanelConstraints:X,layout:Z}=K.next;if(I||X.length===0)return;const W=V.panels.map(({id:te})=>te).join(",");V.mutableState.layouts[W]=Z,X.forEach(te=>{if(te.collapsible){const{layout:re}=K.prev??{};if(re){const le=Yn(te.collapsedSize,Z[te.panelId]),me=Yn(te.collapsedSize,re[te.panelId]);le&&!me&&(V.mutableState.expandedPanelSizes[te.panelId]=re[te.panelId])}}});const fe=Io().state!=="active";y(Z),fe&&w(Z,K.isUserInteraction)});return()=>{P.current=null,H(),G()}},[l,S,w,y,h,E,O]),x.useEffect(()=>{const U=P.current;U&&(U.mutableState.defaultLayout=a,U.mutableState.disableCursor=!!o)}),s.jsx(fR.Provider,{value:B,children:s.jsx("div",{...j,className:t,"data-group":!0,"data-testid":S,id:S,ref:T,style:{height:"100%",width:"100%",overflow:"hidden",..._,display:"flex",flexDirection:h==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:h==="horizontal"?"pan-y":"pan-x"},children:e})})}eb.displayName="Group";function cv(){const e=x.useContext(fR);return Ft(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function s$(e,t){const{id:a}=cv(),o=x.useRef({collapse:lx,expand:lx,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:lx});x.useImperativeHandle(t,()=>o.current,[]),Yo(()=>{Object.assign(o.current,cR({groupId:a,panelId:e}))})}function ko({children:e,className:t,collapsedSize:a="0%",collapsible:o=!1,defaultSize:l,disabled:c,elementRef:d,groupResizeBehavior:p="preserve-relative-size",id:m,maxSize:g="100%",minSize:h="0%",onResize:b,panelRef:_,style:j,...N}){const y=!!m,w=ov(m),S=iv({disabled:c}),k=x.useRef(null),E=lv(k,d),{getPanelStyles:R,id:A,orientation:T,registerPanel:z,updatePanelProps:O}=cv(),B=b!==null,P=Ic((V,H,$)=>{b?.(V,m,$)});Yo(()=>{const V=k.current;if(V!==null){const H={element:V,id:w,idIsStable:y,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:B?P:void 0,panelConstraints:{groupResizeBehavior:p,collapsedSize:a,collapsible:o,defaultSize:l,disabled:S.disabled,maxSize:g,minSize:h}};return z(H)}},[p,a,o,l,B,w,y,g,h,P,z,S]),x.useEffect(()=>{O(w,{disabled:c})},[c,w,O]),s$(w,_);const U=()=>{const V=R(A,w);if(V)return JSON.stringify(V)},D=x.useSyncExternalStore(V=>av(A,V),U,U);let L;return D?L=JSON.parse(D):l!==void 0?L={flexGrow:void 0,flexShrink:void 0,flexBasis:l}:L={flexGrow:1},s.jsx("div",{...N,"data-disabled":c||void 0,"data-panel":!0,"data-testid":w,id:w,ref:E,style:{...a$,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...L},children:s.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...j,touchAction:T==="horizontal"?"pan-y":"pan-x"},children:e})})}ko.displayName="Panel";const a$={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function r$({layout:e,panelConstraints:t,panelId:a,panelIndex:o}){let l,c;const d=e[a],p=t.find(m=>m.panelId===a);if(p){const m=p.maxSize,g=p.collapsible?p.collapsedSize:p.minSize,h=[o,o+1];c=Uo({layout:Xc({delta:g-d,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[a],l=Uo({layout:Xc({delta:m-d,initialLayout:e,panelConstraints:t,pivotIndices:h,prevLayout:e}),panelConstraints:t})[a]}return{valueControls:a,valueMax:l,valueMin:c,valueNow:d}}function uv({children:e,className:t,disabled:a,disableDoubleClick:o,elementRef:l,id:c,style:d,...p}){const m=ov(c),g=iv({disabled:a,disableDoubleClick:o}),[h,b]=x.useState({}),[_,j]=x.useState("inactive"),[N,y]=x.useState(!1),w=x.useRef(null),S=lv(w,l),{disableCursor:k,id:E,orientation:R,registerSeparator:A,updateSeparatorProps:T}=cv(),z=R==="horizontal"?"vertical":"horizontal";Yo(()=>{const P=w.current;if(P!==null){const U={disabled:g.disabled,disableDoubleClick:g.disableDoubleClick,element:P,id:m},D=A(U),L=PU(H=>{j(H.next.state!=="inactive"&&H.next.hitRegions.some($=>$.separator===U)?H.next.state:"inactive")}),V=av(E,H=>{const{derivedPanelConstraints:$,layout:F,separatorToPanels:Y}=H.next,G=Y.get(U);if(G){const K=G[0],I=G.indexOf(K);b(r$({layout:F,panelConstraints:$,panelId:K.id,panelIndex:I}))}});return()=>{L(),V(),D()}}},[E,m,A,g]),x.useEffect(()=>{T(m,{disabled:a,disableDoubleClick:o})},[a,o,m,T]);let O;a&&!k&&(O="not-allowed");let B;if(a)B="disabled";else switch(_){case"active":{B="active";break}default:N?B="focus":B=_}return s.jsx("div",{...p,"aria-controls":h.valueControls,"aria-disabled":a||void 0,"aria-orientation":z,"aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:e,className:t,"data-separator":B,"data-testid":m,id:m,onBlur:()=>y(!1),onFocus:()=>y(!0),ref:S,role:"separator",style:{flexBasis:"auto",cursor:O,...d,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:a?void 0:0})}uv.displayName="Separator";function o$({projects:e,value:t,onChange:a,disabled:o}){const l=e.map(c=>{const d=c.path?.split("/").filter(Boolean).pop()||u("modules_ui.code_project_fallback",{id:c.id});return{value:String(c.id),label:c.name||d,icon:qM,description:c.path}});return s.jsx("div",{className:"w-full","data-testid":"code-project-select",children:s.jsx(ut,{value:t,onChange:a,options:l,placeholder:u("modules_ui.code_pick_project_ph"),disabled:o})})}function l$({sessions:e,activeId:t,busy:a,onSelect:o,onCreate:l,onRename:c,onDelete:d}){return s.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:u("code_module.sessions")}),s.jsx($e,{content:u("code_module.new_session"),children:s.jsxs("button",{type:"button",onClick:l,disabled:a,"data-testid":"code-new-session",className:"flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",children:[s.jsx(It,{className:"size-3"})," ",u("code_module.new_session")]})})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?s.jsx("div",{className:"p-2",children:s.jsx(pt,{children:u("code_module.no_sessions")})}):s.jsx("ul",{className:"space-y-0.5",children:e.map(p=>s.jsxs("li",{className:"group/item relative",children:[s.jsxs("button",{type:"button",onClick:()=>o(p.id),className:he("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:[s.jsx(xb,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),s.jsxs("span",{className:"min-w-0 flex-1",children:[s.jsx("span",{className:"block truncate font-medium",children:p.title}),s.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[p.mode," · ",p.messageCount," msg",p.model?` · ${p.model}`:""]})]})]}),s.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[s.jsx($e,{content:u("code_module.rename"),children:s.jsx("button",{type:"button",onClick:()=>c(p.id,p.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:s.jsx(ya,{className:"size-3"})})}),s.jsx($e,{content:u("code_module.delete"),children:s.jsx("button",{type:"button",onClick:()=>d(p.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:s.jsx(vn,{className:"size-3"})})})]})]},p.id))})})]})}function i$({mode:e,onChange:t,disabled:a}){const o=(l,c,d,p)=>s.jsx($e,{content:d,children:s.jsxs("button",{type:"button",disabled:a,"data-testid":`code-mode-${l}`,"aria-pressed":e===l,onClick:()=>t(l),className:he("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:[s.jsx(p,{className:"size-3.5"})," ",c]})});return s.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[o("build",u("code_module.mode_build"),u("code_module.mode_build_hint"),YM),o("plan",u("code_module.mode_plan"),u("code_module.mode_plan_hint"),TM)]})}function c$({value:e,onValueChange:t,onSubmit:a,onStop:o,busy:l,disabled:c,mode:d,onModeChange:p,model:m,onModelChange:g}){return s.jsx(W_,{value:e,onValueChange:t,onSubmit:a,onStop:o,busy:l,disabled:c,placeholder:u("code_module.placeholder"),minRows:1,maxRows:6,footer:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(i$,{mode:d,onChange:p,disabled:l}),s.jsx(Z_,{value:m,onChange:g,disabled:l})]})})}function ix(e,t){let a=0;for(const o of e.parts||[])o.kind==="text"&&t.text&&(a+=o.text.length),o.kind==="tool"&&t.tool&&(o.args&&(a+=JSON.stringify(o.args).length),o.result!==void 0&&(a+=JSON.stringify(o.result).length));return Math.ceil(a/4)}function u$(e){let t=null,a=0,o=0;for(const d of e)d.role==="user"?a++:o++,d.role==="assistant"&&d.usage&&(t={input:d.usage.input_tokens,output:d.usage.output_tokens,model:d.model});const 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:a,assistantMsgs:o}}function d$(e){let t=0,a=0,o=0;for(const d of e)d.role==="user"?t+=ix(d,{text:!0}):a+=ix(d,{text:!0}),o+=ix(d,{tool:!0});const l=t+a+o||1,c=(d,p)=>({key:d,tokens:p,percent:Math.round(p/l*100)});return[c("user",t),c("assistant",a),c("tool",o)].filter(d=>d.tokens>0)}const lS={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Ka({label:e,value:t}){return s.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[s.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),s.jsx("span",{className:"min-w-0 truncate text-right font-mono text-xs text-foreground",children:t})]})}function iS(e){if(!e)return"";const t=new Date(e),a=o=>String(o).padStart(2,"0");return`${a(t.getDate())} ${t.toLocaleString("es",{month:"short"})} ${t.getFullYear()}, ${a(t.getHours())}:${a(t.getMinutes())}`}function f$({turns:e,session:t}){const a=x.useMemo(()=>u$(e),[e]),o=x.useMemo(()=>d$(e),[e]);return e.length===0?s.jsx("div",{className:"p-3",children:s.jsx(pt,{children:u("code_module.ctx_none")})}):s.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[s.jsx(Ka,{label:u("code_module.ctx_model"),value:a.model||u("modules_ui.code_ctx_auto")}),t?.mode&&s.jsx(Ka,{label:u("modules_ui.code_ctx_mode"),value:t.mode}),t?.agentSlug&&s.jsx(Ka,{label:u("modules_ui.code_ctx_agent"),value:t.agentSlug}),s.jsx(Ka,{label:u("code_module.ctx_messages"),value:u("modules_ui.code_ctx_msgs_value",{user:a.userMsgs,assistant:a.assistantMsgs})}),s.jsx(Ka,{label:u("code_module.ctx_input"),value:a.input.toLocaleString()}),s.jsx(Ka,{label:u("code_module.ctx_output"),value:a.output.toLocaleString()}),s.jsx(Ka,{label:u("modules_ui.code_ctx_tokens_total"),value:(a.input+a.output).toLocaleString()}),t?.createdAt&&s.jsx(Ka,{label:u("modules_ui.code_ctx_created"),value:iS(t.createdAt)}),t?.updatedAt&&s.jsx(Ka,{label:u("modules_ui.code_ctx_activity"),value:iS(t.updatedAt)}),s.jsx("hr",{className:"border-border my-2"}),s.jsxs("div",{children:[s.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:u("code_module.ctx_breakdown")}),o.length>0?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:o.map(l=>s.jsx($e,{content:`${l.key}: ${l.tokens} (${l.percent}%)`,children:s.jsx("div",{className:lS[l.key],style:{width:`${l.percent}%`}})},l.key))}),s.jsx("ul",{className:"mt-2 space-y-1",children:o.map(l=>s.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[s.jsx("span",{className:`size-2 rounded-full ${lS[l.key]}`}),s.jsx("span",{className:"flex-1 text-foreground/80",children:u(`code_module.seg_${l.key}`)}),s.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.tokens," · ",l.percent,"%"]})]},l.key))})]}):s.jsx("p",{className:"text-[11px] text-muted-foreground",children:u("code_module.ctx_none")})]})]})}function p$(e){const t=[];for(const a of(e||"").split(`
|
|
798
|
+
`))a.startsWith("diff --git")||a.startsWith("index ")||a.startsWith("--- ")||a.startsWith("+++ ")||a.startsWith("new file")||a.startsWith("deleted file")||a.startsWith("similarity index")||a.startsWith("rename ")||(a.startsWith("@@")?t.push({kind:"hunk",text:a}):a.startsWith("+")?t.push({kind:"add",text:a.slice(1)}):a.startsWith("-")?t.push({kind:"del",text:a.slice(1)}):t.push({kind:"ctx",text:a.replace(/^ /,"")}));for(;t.length&&t[t.length-1].kind==="ctx"&&t[t.length-1].text==="";)t.pop();return t}function m$({patch:e}){const t=x.useMemo(()=>p$(e),[e]);return t.length?s.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:s.jsx("code",{className:"block",children:t.map((a,o)=>s.jsxs("div",{className:he("px-2 whitespace-pre",a.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",a.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",a.kind==="hunk"&&"bg-muted/60 text-muted-foreground",a.kind==="ctx"&&"text-foreground/70"),children:[s.jsx("span",{className:"select-none opacity-50",children:a.kind==="add"?"+":a.kind==="del"?"-":" "}),a.text]},o))})}):null}const g$={added:px,modified:hf,deleted:HM},h$={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 x$({file:e}){const[t,a]=x.useState(!1),o=g$[e.status];return s.jsxs("li",{className:"rounded-md border border-border",children:[s.jsxs("button",{type:"button",onClick:()=>a(l=>!l),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[s.jsx(Fr,{className:he("size-3 shrink-0 transition-transform",t&&"rotate-90")}),s.jsx(o,{className:he("size-3.5 shrink-0",h$[e.status])}),s.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),s.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&s.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&s.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),t&&s.jsx("div",{className:"border-t border-border p-1.5",children:s.jsx(m$,{patch:e.patch})})]})}function b$({changes:e,loading:t,onRefresh:a}){const o=e?.files||[];return s.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[s.jsx("span",{className:"text-[11px] text-muted-foreground",children:o.length>0?u("code_module.changes_files",{n:o.length}):""}),s.jsx($e,{content:u("code_module.reload"),children:s.jsx("button",{type:"button",onClick:a,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:t?s.jsx(_n,{size:12}):s.jsx(Vs,{className:"size-3"})})})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?s.jsx(pt,{children:u("code_module.changes_no_git")}):o.length===0?s.jsx(pt,{children:u("code_module.changes_none")}):s.jsx("ul",{className:"space-y-1.5",children:o.map(l=>s.jsx(x$,{file:l},l.path))})})]})}const _$=[{value:"context",icon:Xf,label:"tab_context"},{value:"changes",icon:GM,label:"tab_changes"},{value:"artifacts",icon:r3,label:"tab_artifacts"}];function v$({pid:e,turns:t,changes:a,changesLoading:o,onRefreshChanges:l,session:c,onRunInTerminal:d,onEditArtifact:p}){const[m,g]=x.useState("context"),h=a?.files.length||0;return s.jsxs(Tp,{value:m,onValueChange:g,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[s.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:s.jsx(Ap,{variant:"line",className:"w-full",children:_$.map(({value:b,icon:_,label:j})=>{const N=m===b,y=u(`code_module.${j}`);return s.jsx($e,{content:y,children:s.jsxs(Us,{value:b,className:N?"flex-1 min-w-0":"w-8 shrink-0",children:[s.jsx(_,{className:"size-3.5 shrink-0"}),N&&s.jsx("span",{className:"truncate text-xs",children:y}),b==="changes"&&h>0&&s.jsx("span",{className:"ml-0.5 rounded-full bg-muted px-1 text-[10px] text-muted-foreground leading-none py-0.5",children:h})]})},b)})})}),s.jsx(us,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:s.jsx(f$,{turns:t,session:c})}),s.jsx(us,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(b$,{changes:a,loading:o,onRefresh:l})}),s.jsx(us,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:s.jsx($E,{pid:e,onRunInTerminal:d,onEditArtifact:p})})]})}function y$(e){const t=[];for(const o of e){const l=o.split("/").filter(Boolean);let c=t,d="";for(let p=0;p<l.length;p++){d=d?`${d}/${l[p]}`:l[p];const m=p===l.length-1;let g=c.find(h=>h.name===l[p]);g||(g={name:l[p],path:d,type:m?"file":"dir",children:m?void 0:[]},c.push(g)),m||(c=g.children)}}const a=o=>(o.forEach(l=>{l.children&&(l.children=a(l.children))}),o.sort((l,c)=>l.type!==c.type?l.type==="dir"?-1:1:l.name.localeCompare(c.name)));return a(t)}function pR({node:e,depth:t,onOpenFile:a,openDirs:o,toggleDir:l}){const c=e.type==="dir",d=c&&o.has(e.path);return s.jsxs("li",{children:[s.jsxs("button",{type:"button",onClick:()=>c?l(e.path):a(e.path),style:{paddingLeft:`${t*12+6}px`},className:he("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?s.jsxs(s.Fragment,{children:[s.jsx(Fr,{className:he("size-3 shrink-0 transition-transform",d&&"rotate-90")}),d?s.jsx(ci,{className:"size-3.5 shrink-0 text-amber-400"}):s.jsx(VS,{className:"size-3.5 shrink-0 text-amber-400"})]}):s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"size-3 shrink-0"}),s.jsx(HS,{className:"size-3.5 shrink-0 text-sky-400"})]}),s.jsx("span",{className:"truncate",children:e.name})]}),c&&d&&e.children&&e.children.length>0&&s.jsx("ul",{children:e.children.map(p=>s.jsx(pR,{node:p,depth:t+1,onOpenFile:a,openDirs:o,toggleDir:l},p.path))})]})}function j$({pid:e,projectPath:t,className:a,onOpenFile:o}){const[l,c]=x.useState([]),[d,p]=x.useState(!1),[m,g]=x.useState(!1),[h,b]=x.useState(()=>new Set),_=x.useCallback(async()=>{p(!0);try{const k=(await ne.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(`
|
|
799
|
+
`).map(E=>E.trim()).filter(Boolean);c(k),g(!0)}catch{g(!0)}finally{p(!1)}},[e]);x.useEffect(()=>{b(new Set),_()},[_]);const j=x.useCallback(S=>{b(k=>{const E=new Set(k);return E.has(S)?E.delete(S):E.add(S),E})},[]),N=x.useCallback(()=>{b(new Set)},[]),y=y$(l),w=h.size>0;return s.jsxs("div",{className:he("flex h-full flex-col",a),"data-testid":"code-file-tree",children:[s.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-3 py-2",children:[s.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Archivos"}),s.jsxs("div",{className:"flex items-center gap-0.5",children:[s.jsx($e,{content:u("code_module.tree_collapse_all"),children:s.jsx("button",{type:"button",onClick:N,disabled:!w,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:s.jsx(CM,{className:"size-3"})})}),s.jsx($e,{content:u("code_module.reload"),children:s.jsx("button",{type:"button",onClick:()=>void _(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:d?s.jsx(_n,{size:12}):s.jsx(Vs,{className:"size-3"})})})]})]}),s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:m?y.length===0?s.jsx("div",{className:"p-3",children:s.jsx(pt,{children:"Sin archivos"})}):s.jsx("ul",{children:y.map(S=>s.jsx(pR,{node:S,depth:0,onOpenFile:o??(()=>{}),openDirs:h,toggleDir:j},S.path))}):s.jsx("div",{className:"flex justify-center pt-6",children:s.jsx(_n,{size:14})})})]})}function w$({path:e,content:t,loading:a,onSave:o}){const l=typeof o=="function",[c,d]=x.useState(t),[p,m]=x.useState(!1);x.useEffect(()=>{d(t)},[t]);const g=l&&c!==t,h=async()=>{if(!(!o||!g)){m(!0);try{await o(c)}finally{m(!1)}}};return s.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"code-file-viewer",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[s.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e,g&&s.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),l&&s.jsxs(s.Fragment,{children:[s.jsx($e,{content:u("code_module.discard_changes"),children:s.jsxs("button",{type:"button",onClick:()=>d(t),disabled:!g||p,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",children:[s.jsx(ui,{className:"size-3"}),"Descartar"]})}),s.jsx($e,{content:u("code_module.save_shortcut_hint"),children:s.jsxs("button",{type:"button",onClick:()=>void h(),disabled:!g||p,className:he("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",g&&!p?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[p?s.jsx(_n,{size:10}):s.jsx(nu,{className:"size-3"}),"Guardar"]})})]})]}),a?s.jsx("div",{className:"flex flex-1 items-center justify-center",children:s.jsx(_n,{size:16})}):l?s.jsx("textarea",{value:c,onChange:b=>d(b.target.value),onKeyDown:b=>{(b.metaKey||b.ctrlKey)&&b.key==="s"&&(b.preventDefault(),h())},className:"min-h-0 flex-1 resize-none bg-transparent p-3 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none",spellCheck:!1}):s.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:s.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:s.jsx("tbody",{children:t.split(`
|
|
800
|
+
`).map((b,_)=>s.jsxs("tr",{className:"hover:bg-accent/20",children:[s.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 py-0 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:_+1}),s.jsx("td",{className:"px-4 py-0 align-top text-foreground/90 whitespace-pre",children:b||" "})]},_))})})})]})}function k$({pid:e,className:t,initCmd:a,onClose:o}){const[l,c]=x.useState([]),[d,p]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState([]),[_,j]=x.useState(-1),N=x.useRef(null),y=x.useRef(null);x.useEffect(()=>{N.current?.scrollIntoView({behavior:"smooth"})},[l]),x.useEffect(()=>{a&&(p(a),setTimeout(()=>y.current?.focus(),50))},[a]);const w=async k=>{const E=k.trim();if(E){b(R=>[E,...R.slice(0,49)]),j(-1),c(R=>[...R,{type:"cmd",text:`$ ${E}`}]),g(!0);try{const R=await ne.post("/run",{cmd:E,project:e});R.stdout&&c(A=>[...A,{type:"out",text:R.stdout}]),R.stderr&&c(A=>[...A,{type:"err",text:R.stderr}])}catch(R){c(A=>[...A,{type:"err",text:String(R.message)}])}finally{g(!1)}}},S=k=>{if(k.key==="Enter")w(d),p("");else if(k.key==="ArrowUp"){k.preventDefault();const E=Math.min(_+1,h.length-1);j(E),p(h[E]??"")}else if(k.key==="ArrowDown"){k.preventDefault();const E=Math.max(_-1,-1);j(E),p(E===-1?"":h[E]??"")}};return s.jsxs("div",{className:he("flex h-full min-h-0 flex-col bg-card/60",t),"data-testid":"code-terminal",children:[s.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1",children:[s.jsx(ba,{className:"size-3 text-muted-foreground"}),s.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),s.jsx($e,{content:u("code_module.terminal_clear"),children:s.jsx("button",{type:"button",onClick:()=>c([]),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(IM,{className:"size-3"})})}),s.jsx($e,{content:u("code_module.terminal_close"),children:s.jsx("button",{type:"button",onClick:()=>o?.(),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:s.jsx(Ss,{className:"size-3"})})})]}),s.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((k,E)=>s.jsx("div",{className:he("whitespace-pre-wrap break-all",k.type==="cmd"&&"text-emerald-400",k.type==="err"&&"text-rose-400",k.type==="out"&&"text-foreground/90"),children:k.text},E)),s.jsx("div",{ref:N})]}),s.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-3 py-1",children:[s.jsx("span",{className:"mr-2 text-[11px] text-emerald-400 font-mono",children:"$"}),s.jsx("input",{ref:y,value:d,onChange:k=>p(k.target.value),onKeyDown:S,disabled:m,placeholder:m?"ejecutando…":"comando…",className:"flex-1 bg-transparent font-mono text-[11px] text-foreground outline-none placeholder:text-muted-foreground/50 disabled:opacity-50",spellCheck:!1,autoComplete:"off"})]})]})}const yc="super-agent";function cx(){return s.jsx(uv,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function S$(){return s.jsx(uv,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function C$(){const e=Ze(),t=qe("/projects",()=>Qn.list()),a=x.useMemo(()=>t.data||[],[t.data]),[o,l]=x.useState(""),[c,d]=x.useState(null),[p,m]=x.useState(yc),[g,h]=x.useState([]),[b,_]=x.useState(""),[j,N]=x.useState(!1),[y,w]=x.useState(!0),[S,k]=x.useState(!0),[E,R]=x.useState(!1),[A,T]=x.useState(""),[z,O]=x.useState(!1),B=x.useRef(null),[P,U]=$o(),D=x.useRef(!1),[L,V]=x.useState([]),[H,$]=x.useState("chat"),F=x.useCallback(_e=>{R(!0),T(_e)},[]);x.useEffect(()=>{!o&&a.length&&l(String(a[0].id))},[o,a]);const Y=qe(o?["code-sessions",o]:null,()=>Ya.sessions.list(o)),G=qe(o?["agents",o]:null,()=>cn.list(o)),K=qe(o&&c?["code-session",o,c]:null,()=>Ya.sessions.get(o,c)),I=qe(o&&c?["code-changes",o,c]:null,()=>Ya.changes(o,c));x.useEffect(()=>{const _e=Y.data||[];!c&&_e.length&&d(_e[0].id),c&&_e.length&&!_e.some(Pe=>Pe.id===c)&&d(_e[0]?.id??null)},[Y.data,c]),x.useEffect(()=>{K.data&&m(K.data.agentSlug||yc)},[K.data]),x.useEffect(()=>{j||(K.data?h(K.data.messages||[]):c||h([]))},[K.data,c,j]),x.useEffect(()=>()=>B.current?.abort(),[]);const X=K.data,Z=X?.mode==="plan"?"plan":"build",W=X?.model||"",fe=_e=>{_e===o||j||(l(_e),d(null),h([]))},te=_e=>{j||_e===c||(d(_e),h([]))},re=async()=>{if(!(!o||j))try{const _e=await Ya.sessions.create(o,{title:u("code_module.untitled"),agentSlug:p!==yc?p:null});await Y.mutate(),d(_e.id),h([])}catch(_e){e.error(_e.message)}},le=async(_e,Pe)=>{const Xe=window.prompt(u("code_module.rename"),Pe);if(!(!Xe||Xe===Pe))try{await Ya.sessions.update(o,_e,{title:Xe}),await Y.mutate(),_e===c&&await K.mutate()}catch(it){e.error(it.message)}},me=async _e=>{if(!j&&window.confirm(u("code_module.delete_confirm")))try{await Ya.sessions.remove(o,_e),_e===c&&(d(null),h([])),await Y.mutate()}catch(Pe){e.error(Pe.message)}},Me=async _e=>{if(m(_e),!!c)try{await Ya.sessions.update(o,c,{agentSlug:_e!==yc?_e:null}),await Promise.all([K.mutate(),Y.mutate()])}catch(Pe){e.error(Pe.message)}},de=x.useCallback(async _e=>{if(c)try{await Ya.sessions.update(o,c,_e),await Promise.all([K.mutate(),Y.mutate()])}catch(Pe){e.error(Pe.message)}},[o,c,K,Y,e]),ge=()=>{B.current?.abort(),N(!1)},Ce=_e=>h(Pe=>{const Xe=[...Pe],it=Xe[Xe.length-1];return it&&it.role==="assistant"&&(Xe[Xe.length-1]=_e(it)),Xe}),ke=async _e=>{const Pe=(_e??b).trim();if(!Pe||j||!o||!c)return;const Xe=new Date().toISOString();h(mt=>[...mt,{role:"user",parts:[{kind:"text",text:Pe}],ts:Xe},{role:"assistant",parts:[],ts:Xe,pending:!0}]),_(""),N(!0);const it=new AbortController;B.current=it;const Qe=mt=>{if(mt.type==="error"){e.error(mt.error||u("modules_ui.code_stream_error"));return}Ce(Ot=>J_(Ot,mt))};try{await Ya.stream(o,c,{prompt:Pe},Qe,it.signal),Ce(mt=>({...mt,pending:!1}))}catch(mt){it.signal.aborted?Ce(Ot=>({...Ot,pending:!1,parts:[...Ot.parts,{kind:"text",text:u("code_module.stopped")}]})):(e.error(mt.message),h(Ot=>Ot.filter((Jt,Qt)=>Qt!==Ot.length-1)))}finally{B.current===it&&(B.current=null),N(!1),K.mutate(),Y.mutate(),I.mutate()}},Be=async _e=>{try{await navigator.clipboard.writeText(_e),e.info(u("modules_ui.code_copied"))}catch{}},Ve=x.useCallback(_e=>{$(_e),V(Pe=>Pe.some(Xe=>Xe.path===_e)?Pe:[...Pe,{path:_e,content:"",loading:!0}]),ne.post("/run",{cmd:`cat "${_e}"`,project:o}).then(Pe=>{const Xe=Pe.stdout||Pe.stderr||u("modules_ui.code_file_empty");V(it=>it.map(Qe=>Qe.path===_e?{...Qe,content:Xe,loading:!1}:Qe))}).catch(Pe=>{V(Xe=>Xe.map(it=>it.path===_e?{...it,content:u("modules_ui.code_file_error",{msg:Pe.message}),loading:!1}:it))})},[o]),Se=x.useCallback(_e=>{V(Pe=>Pe.filter(Xe=>Xe.path!==_e)),$(Pe=>Pe===_e?"chat":Pe)},[]),Te=x.useCallback(_e=>{const Pe=`artifacts/${_e}`;$(Pe),V(Xe=>Xe.some(it=>it.path===Pe)?Xe:[...Xe,{path:Pe,content:"",loading:!0,artifactName:_e}]),Xs.read(o,_e).then(Xe=>{V(it=>it.map(Qe=>Qe.path===Pe?{...Qe,content:Xe.content,loading:!1}:Qe))}).catch(Xe=>{V(it=>it.map(Qe=>Qe.path===Pe?{...Qe,content:u("modules_ui.code_file_error",{msg:Xe.message}),loading:!1}:Qe))})},[o]);x.useEffect(()=>{if(D.current)return;const _e=P.get("pid"),Pe=P.get("cmd"),Xe=P.get("edit");if(!(!_e||!Pe&&!Xe)){if(String(o)!==String(_e)){l(String(_e));return}D.current=!0,Xe&&Te(Xe),Pe&&F(Pe.endsWith(" ")?Pe:Pe+" "),U({},{replace:!0})}},[P,o,Te,F,U]);const je=x.useCallback(async(_e,Pe)=>{const Xe=L.find(it=>it.path===_e);if(Xe?.artifactName)try{await Xs.write(o,Xe.artifactName,Pe),V(it=>it.map(Qe=>Qe.path===_e?{...Qe,content:Pe}:Qe)),e.info(u("modules_ui.code_saved"))}catch(it){e.error(it.message)}},[L,o,e]),Ee=!t.isLoading&&a.length>0,De=x.useMemo(()=>{const _e=[{value:yc,label:u("modules_ui.code_super_agent"),icon:un,description:u("modules_ui.code_super_agent_desc")}],Pe=(G.data||[]).map(Xe=>({value:Xe.slug,label:Xe.slug,icon:un,description:Xe.description||Xe.role||void 0}));return[..._e,...Pe]},[G.data]),Le=x.useMemo(()=>g,[g]),Ie=x.useMemo(()=>Y.data?.find(_e=>_e.id===c)?.title||"",[Y.data,c]),ue=x.useMemo(()=>a.find(_e=>String(_e.id)===o),[a,o]);g6(Ie);const[ye,Ge]=x.useState(null),Re=j?null:IE(g),Oe=Re&&Re.turnKey!==ye,tt=_e=>{ke(_e)},ot=x.useCallback(()=>w(_e=>!_e),[]),vt=x.useCallback(()=>O(_e=>!_e),[]),Mt=x.useCallback(()=>R(_e=>!_e),[]),lt=x.useCallback(()=>k(_e=>!_e),[]),Rt=x.useMemo(()=>c?s.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:WS,open:y,toggle:ot,title:u("modules_ui.code_panel_sessions")},{Icon:hb,open:z,toggle:vt,title:u("modules_ui.code_panel_tree")},{Icon:ba,open:E,toggle:Mt,title:u("modules_ui.code_panel_terminal")},{Icon:o3,open:S,toggle:lt,title:u("modules_ui.code_panel_context")}].map(({Icon:_e,open:Pe,toggle:Xe,title:it})=>s.jsx($e,{content:it,children:s.jsx("button",{type:"button",onClick:Xe,"data-active":Pe,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:s.jsx(_e,{className:"size-3.5"})})},it))}):null,[c,y,z,E,S,ot,vt,Mt,lt]);return x6(Rt),s.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:t.isLoading?s.jsx(rt,{}):Ee?s.jsxs(eb,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[s.jsx(ko,{id:"top",defaultSize:E?"55%":"100%",minSize:"20%",children:s.jsxs(eb,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[y&&s.jsxs(s.Fragment,{children:[s.jsx(ko,{id:"left",defaultSize:"14%",minSize:"8%",children:s.jsxs("aside",{className:"flex h-full flex-col",children:[s.jsx("div",{className:"shrink-0 border-b border-border p-2",children:s.jsx(o$,{projects:a,value:o,onChange:fe,disabled:j})}),s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:s.jsx(l$,{sessions:Y.data||[],activeId:c,busy:j,onSelect:te,onCreate:re,onRename:le,onDelete:me})}),s.jsx("div",{className:"shrink-0 border-t border-border p-2",children:s.jsx(ut,{value:p,onChange:Me,options:De,disabled:j,showIcon:!0})})]})}),s.jsx(cx,{})]}),z&&s.jsxs(s.Fragment,{children:[s.jsx(ko,{id:"tree",defaultSize:"13%",minSize:"8%",children:s.jsx("div",{className:"h-full",children:s.jsx(j$,{pid:o,projectPath:ue?.path,onOpenFile:Ve})})}),s.jsx(cx,{})]}),s.jsx(ko,{id:"main",defaultSize:"50%",minSize:"20%",children:s.jsxs("div",{className:"flex h-full flex-col",children:[L.length>0&&s.jsxs("div",{className:"flex shrink-0 items-center gap-0 overflow-x-auto border-b border-border",children:[s.jsxs("button",{type:"button",onClick:()=>$("chat"),"data-active":H==="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:[s.jsx(xb,{className:"size-3 shrink-0"}),u("modules_ui.code_chat_tab")]}),L.map(_e=>{const Pe=_e.path.split("/").pop()??_e.path,Xe=H===_e.path;return s.jsxs("div",{"data-active":Xe,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:[s.jsx($e,{content:_e.path,children:s.jsx("button",{type:"button",onClick:()=>$(_e.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:Pe})}),s.jsx($e,{content:u("code_module.close"),children:s.jsx("button",{type:"button",onClick:()=>Se(_e.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:s.jsx(Ss,{className:"size-2.5"})})})]},_e.path)})]}),H==="chat"?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?g.length?s.jsx(ev,{msgs:g,onCopy:Be}):s.jsx("div",{className:"grid h-full place-items-center p-6",children:s.jsx(pt,{children:u("code_module.empty_chat")})}):s.jsx("div",{className:"grid h-full place-items-center p-6",children:s.jsx(pt,{children:u("code_module.pick_project")})})}),Oe&&Re&&s.jsx(LE,{turnKey:Re.turnKey,questions:Re.questions,onSubmit:tt,onDismiss:()=>Ge(Re.turnKey),disabled:j})]}):s.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const _e=L.find(Pe=>Pe.path===H);return _e?s.jsx(w$,{path:_e.path,content:_e.content,loading:_e.loading,onSave:_e.artifactName?Pe=>je(_e.path,Pe):void 0}):null})()}),s.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:s.jsx(c$,{value:b,onValueChange:_,onSubmit:()=>void ke(),onStop:ge,busy:j,disabled:!c,mode:Z,onModeChange:_e=>void de({mode:_e}),model:W,onModelChange:_e=>void de({model:_e||null})})})]})}),S&&s.jsxs(s.Fragment,{children:[s.jsx(cx,{}),s.jsx(ko,{id:"right",defaultSize:"22%",minSize:"15%",children:s.jsx("aside",{className:"flex h-full flex-col",children:s.jsx(v$,{pid:o,turns:Le,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:F,onEditArtifact:Te})})})]})]})}),E&&o&&s.jsxs(s.Fragment,{children:[s.jsx(S$,{}),s.jsx(ko,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:s.jsx(k$,{pid:o,initCmd:A,onClose:Mt,className:"h-full"})})]})]}):s.jsx("div",{className:"grid flex-1 place-items-center",children:s.jsx(pt,{children:u("code_module.no_projects")})})})}function N$({open:e,onClose:t}){const{mutate:a}=pN(),o=Pn(),l=Ze(),[c,d]=x.useState(""),[p,m]=x.useState(!1),[g,h]=x.useState(""),[b,_]=x.useState([]),[j,N]=x.useState(null),[y,w]=x.useState(""),[S,k]=x.useState(!1),[E,R]=x.useState(!1),A=async(O,B=!1)=>{k(!0),w("");try{const P=await vw.dirs(O||"~");h(P.path),d(P.path),N(P.parent),_(P.entries)}catch(P){const U=P.message;w(U),B||l.error(U)}finally{k(!1)}};x.useEffect(()=>{e||(d(""),m(!1),h(""),_([]),N(null),w(""))},[e]);const T=async()=>{k(!0);try{const O=await vw.pickDir(u("add_project.picker_prompt"));if("cancelled"in O)return;d(O.path);return}catch{m(!0),await A(c||"~")}finally{k(!1)}},z=async()=>{const O=c.trim();if(!O){l.error(u("add_project.path_required"));return}R(!0);try{const B=await Qn.register(O);l.success(u("add_project.registered",{id:B.id})),await a("/projects"),t(),o(`/p/${B.id}`)}catch(B){l.error(B.message)}finally{R(!1)}};return s.jsx(Zt,{open:e,onClose:t,title:u("add_project.title"),description:u("add_project.subtitle"),footer:s.jsxs(s.Fragment,{children:[s.jsx(se,{variant:"ghost",onClick:t,disabled:E,children:u("common.cancel")}),s.jsx(se,{variant:"primary",onClick:z,loading:E,children:u("add_project.register")})]}),children:s.jsxs("div",{className:"space-y-3",children:[s.jsx(ae,{label:u("add_project.path_label"),hint:u("add_project.path_hint"),children:s.jsxs("div",{className:"flex gap-2",children:[s.jsx(Ne,{autoFocus:!0,placeholder:u("add_project.path_placeholder"),value:c,onChange:O=>d(O.target.value),onKeyDown:O=>{O.key==="Enter"&&z()}}),s.jsxs(se,{onClick:T,disabled:S,children:[s.jsx(Ac,{size:14})," ",u("add_project.search_btn")]})]})}),p&&s.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[s.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:g||c||"~"}),s.jsxs("div",{className:"flex gap-1",children:[s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>A("~"),disabled:S,children:s.jsx(QM,{size:13})}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>j&&A(j),disabled:!j||S,children:".."}),s.jsx(se,{size:"sm",variant:"ghost",onClick:()=>m(!1),disabled:S,children:s.jsx(Ss,{size:13})})]})]}),s.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[S&&s.jsx(rt,{}),!S&&y&&s.jsx(pt,{children:u("add_project.browser_unavailable")}),!S&&!y&&b.length===0&&s.jsx(pt,{children:u("add_project.no_folders")}),!S&&!y&&b.map(O=>s.jsxs("button",{type:"button",onClick:()=>A(O),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[s.jsx(ci,{size:14,className:"text-muted-fg"}),s.jsx("span",{className:"truncate",children:O.split("/").pop()}),s.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:O})]},O))]})]})]})})}function E$({onPaired:e}){const[t,a]=x.useState(""),[o,l]=x.useState(R$()),[c,d]=x.useState(!1),[p,m]=x.useState(null);async function g(){const h=t.trim();if(!h){m(u("pairing.err_required"));return}d(!0),m(null);try{const b=await si.confirm({pairing_id:h,label:o.trim()||void 0});So(b.token);try{localStorage.setItem(zn.token,b.token)}catch{}e()}catch(b){m(T$(b)),d(!1)}}return s.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:s.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[s.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[s.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:s.jsx(KS,{size:20})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-base font-semibold",children:u("pairing.title")}),s.jsx("p",{className:"text-xs text-muted-fg",children:u("pairing.subtitle")})]})]}),s.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[s.jsx("li",{className:"font-medium text-foreground",children:u("pairing.steps_title")}),s.jsxs("li",{children:["1. ",u("pairing.step_1")]}),s.jsxs("li",{children:["2. ",u("pairing.step_2")]}),s.jsxs("li",{children:["3. ",u("pairing.step_3")]})]}),s.jsxs("form",{className:"space-y-3",onSubmit:h=>{h.preventDefault(),g()},children:[s.jsx(ae,{label:u("pairing.code_label"),children:s.jsx(Ne,{value:t,onChange:h=>a(h.target.value),placeholder:u("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),s.jsx(ae,{label:u("pairing.label_label"),hint:u("pairing.revoke_hint"),children:s.jsx(Ne,{value:o,onChange:h=>l(h.target.value),placeholder:u("pairing.label_ph")})}),p&&s.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p}),s.jsx(se,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:u(c?"pairing.linking":"pairing.submit")})]})]})})}function R$(){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 T$(e){if(e instanceof cu){if(e.status===410)return u("pairing.err_expired");if(e.status===404||e.status===409)return u("pairing.err_unknown")}return u("pairing.err_generic")}function A$({...e}){return s.jsx(NN,{"data-slot":"sheet",...e})}function M$({...e}){return s.jsx(CN,{"data-slot":"sheet-portal",...e})}function O$({className:e,...t}){return s.jsx(jN,{"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 z$({className:e,children:t,side:a="right",showCloseButton:o=!0,...l}){return s.jsxs(M$,{children:[s.jsx(O$,{}),s.jsxs(SN,{"data-slot":"sheet-content","data-side":a,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&&s.jsxs(Ep,{"data-slot":"sheet-close",render:s.jsx(ar,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[s.jsx(Ss,{}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function D$({className:e,...t}){return s.jsx("div",{"data-slot":"sheet-header",className:Ct("flex flex-col gap-0.5 p-4",e),...t})}function P$({className:e,...t}){return s.jsx(EN,{"data-slot":"sheet-title",className:Ct("font-heading text-base font-medium text-foreground",e),...t})}function L$({className:e,...t}){return s.jsx(wN,{"data-slot":"sheet-description",className:Ct("text-sm text-muted-foreground",e),...t})}function I$({value:e,projectPath:t,onPick:a}){const o=B$(e),l=o?U$(e):"",{data:c}=qe(o?["/skills",t||""]:null,()=>Bs.list(t)),d=c?.skills||[],p=x.useMemo(()=>{const m=l.toLowerCase();return m?d.filter(g=>g.slug.toLowerCase().includes(m)).slice(0,8):d.slice(0,8)},[d,l]);return!o||p.length===0?null:s.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[s.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:p.map(m=>s.jsx("li",{children:s.jsxs("button",{type:"button",onClick:()=>a(m.slug),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-accent hover:text-accent-foreground",children:[s.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",m.slug]}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:m.description})]})},m.slug))}),s.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 B$(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function U$(e){const t=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return t?t[1]:""}function $$(){try{const e=localStorage.getItem(zn.robyChat);if(!e)return[];const t=JSON.parse(e);return Array.isArray(t)?t.filter(a=>a&&Array.isArray(a.parts)&&!a.pending):[]}catch{return[]}}function H$({open:e,onOpenChange:t}){const a=Sp(),o=Ze(),[l,c]=x.useState($$),[d,p]=x.useState(""),[m,g]=x.useState(!1),[h,b]=x.useState(""),_=x.useRef(null);x.useEffect(()=>{const k=l.filter(E=>!E.pending);try{k.length?localStorage.setItem(zn.robyChat,JSON.stringify(k)):localStorage.removeItem(zn.robyChat)}catch{}},[l]);const j=()=>{if(!m){c([]),p("");try{localStorage.removeItem(zn.robyChat)}catch{}}};x.useEffect(()=>()=>_.current?.abort(),[]),x.useEffect(()=>{const k=E=>{const R=E.detail?.prompt;typeof R=="string"&&(t(!0),p(R))};return window.addEventListener("apx:roby-prompt",k),()=>window.removeEventListener("apx:roby-prompt",k)},[t]);const N=()=>{_.current?.abort(),g(!1)},y=k=>c(E=>{const R=[...E],A=R[R.length-1];return A?.role==="assistant"&&(R[R.length-1]=k(A)),R}),w=async()=>{const k=d.trim();if(!k||m)return;const E=new Date().toISOString(),R=l.filter(O=>!O.pending).map(O=>({role:O.role,content:Xx(O)}));c(O=>[...O,{role:"user",parts:[{kind:"text",text:k}],ts:E},{role:"assistant",parts:[],ts:E,pending:!0}]),p(""),g(!0);const A=new AbortController;_.current=A;let T=!1;const z=O=>{if(O?.type==="error"){T=!0,o.error(O.error||"error"),c(B=>{const P=[...B],U=P[P.length-1];return U?.role==="assistant"&&U.pending&&P.pop(),P});return}y(B=>J_(B,O))};try{await gN.stream(0,{prompt:k,previousMessages:R,model:h||void 0,channel:"web_sidebar"},z,A.signal),y(O=>({...O,pending:!1}))}catch(O){A.signal.aborted?y(B=>({...B,pending:!1,parts:[...B.parts,{kind:"text",text:u("project.chat.stopped_marker")}]})):T||(o.error(O.message),c(B=>{const P=[...B],U=P[P.length-1];return U?.role==="assistant"&&U.pending&&P.pop(),P}))}finally{_.current===A&&(_.current=null),g(!1)}},S=async k=>{try{await navigator.clipboard.writeText(k),o.info(u("project.chat.copied"))}catch{}};return s.jsx(A$,{open:e,onOpenChange:t,children:s.jsxs(z$,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[s.jsxs(D$,{className:"pr-12",children:[s.jsxs(P$,{className:"flex items-center gap-2",children:[s.jsx(un,{size:18})," ",u("superagent.title",{persona:a}),s.jsx("span",{className:"text-xs font-normal text-muted-fg",children:u("superagent.badge")})]}),s.jsx(L$,{children:u("superagent.desc")})]}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?s.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:u("superagent.empty",{persona:a})}):s.jsx(ev,{msgs:l,onCopy:S})}),s.jsx(PE,{msgs:l}),s.jsxs("div",{className:"border-t border-border p-3",children:[s.jsx("div",{className:"mb-1.5",children:s.jsx(I$,{value:d,onPick:k=>p(`/${k} `)})}),s.jsx(W_,{value:d,onValueChange:p,onSubmit:()=>void w(),onStop:N,busy:m,placeholder:u("superagent.placeholder"),footer:s.jsx(Z_,{value:h,onChange:b,disabled:m})}),s.jsx("div",{className:"mt-1.5 flex justify-end",children:s.jsxs(ar,{size:"xs",variant:"ghost",onClick:j,disabled:m||l.length===0,children:[s.jsx(It,{className:"size-3"})," ",u("superagent.new_chat")]})})]})]})})}function q$(){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 V$(){const[e,t]=x.useState({status:"loading"}),[a,o]=x.useState(0),l=x.useCallback(()=>{t({status:"loading"}),o(c=>c+1)},[]);return x.useEffect(()=>{let c=!1;return(async()=>{try{const h=await fetch("/health");if(!h.ok)throw new Error(`HTTP ${h.status}`)}catch(h){c||t({status:"error",reason:String(h)});return}const d=window.location.hash.replace(/^#/,""),p=new URLSearchParams(d),m=p.get("pair");if(m){history.replaceState(null,"",window.location.pathname+window.location.search);try{const h=await si.confirm({pairing_id:m,label:q$(),kind:"web"});So(h.token);try{localStorage.setItem(zn.token,h.token)}catch{}c||t({status:"ok"});return}catch{}}const g=p.get("token");if(g){So(g);try{localStorage.setItem(zn.token,g)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const h=localStorage.getItem(zn.token);h&&So(h)}catch{}try{const h=await fetch("/admin/web-token");if(h.ok){const b=await h.json();if(b?.token){So(b.token);try{localStorage.setItem(zn.token,b.token)}catch{}}}}catch{}if(!E_()){c||t({status:"unpaired"});return}try{await ne.get("/projects"),c||t({status:"ok"})}catch(h){if(h instanceof cu&&(h.status===401||h.status===403)){So(null);try{localStorage.removeItem(zn.token)}catch{}c||t({status:"unpaired"})}else c||t({status:"error",reason:String(h)})}})(),()=>{c=!0}},[a]),{...e,reload:l}}function F$(){const e=V$();return e.status==="loading"?s.jsx(cS,{text:u("daemon.connecting")}):e.status==="error"?s.jsx(cS,{mood:"sad",text:u("daemon.unreachable"),sub:`${u("daemon.unreachable_hint")}
|
|
801
|
+
|
|
802
|
+
${e.reason}`}):e.status==="unpaired"?s.jsx(E$,{onPaired:e.reload}):s.jsx(o6,{children:s.jsx(_D,{delay:0,children:s.jsx(G$,{})})})}function G$(){const e=Pn(),t=ts(),[a,o]=$o(),{theme:l,toggle:c}=Cb(),d=a.get("action")==="add-project",[p,m]=x.useState(!1),g=()=>{const b=new URLSearchParams(a);b.delete("action"),o(b,{replace:!0})},h=()=>{const b=new URLSearchParams(a);b.set("action","add-project"),o(b)};return s.jsx(d6,{children:s.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[s.jsx(bL,{onSelect:b=>e(b),onOpenRoby:()=>m(!0),onOpenAddProject:h}),s.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:[s.jsx(Y$,{onToggleTheme:c,isDark:l==="dark",pathname:t.pathname}),s.jsx("div",{className:"flex-1 overflow-y-auto",children:s.jsxs(TS,{children:[s.jsx(Dt,{path:"/",element:s.jsx(u6,{})}),s.jsx(Dt,{path:"/settings/*",element:s.jsx(_U,{})}),s.jsx(Dt,{path:"/m/desktop/*",element:s.jsx(jU,{})}),s.jsx(Dt,{path:"/m/code/*",element:s.jsx(C$,{})}),s.jsx(Dt,{path:"/p/:pid/*",element:s.jsx($B,{})}),s.jsx(Dt,{path:"*",element:s.jsx(Z$,{})})]})})]}),s.jsx(N$,{open:d,onClose:g}),s.jsx(H$,{open:p,onOpenChange:m})]})})}function Y$({onToggleTheme:e,isDark:t,pathname:a}){const{projects:o}=uu(),l=m6(),c=a.split("/").filter(Boolean),d=c[0]==="p"?o.find(N=>String(N.id)===c[1]):void 0,p=c[0]==="settings"?Q$(c[1]):c[0]==="p"?W$(c[2]):"",m=c[0]==="p"&&c[1]==="0",g=d?.name||d?.path?.split("/").pop()||u("nav.project"),h=a==="/"?u("topbar.breadcrumb_root"):c[0]==="settings"?[u("topbar.breadcrumb_root"),u("nav.settings"),p].filter(Boolean).join(" › "):c[0]==="m"?[u("topbar.breadcrumb_root"),X$(c[1]),l].filter(Boolean).join(" › "):c[0]==="p"?m?[u("topbar.breadcrumb_root"),u("topbar.breadcrumb_base"),p].filter(Boolean).join(" › "):[u("topbar.breadcrumb_root"),u("topbar.breadcrumb_projects"),g,p].filter(Boolean).join(" › "):u("topbar.breadcrumb_root"),b=a==="/"?"":c[0]==="settings"?u("settings.subtitle"):c[0]==="p"?m?u("base.subtitle"):d?`${xN(d.kind)} · ${d.path}`:"":"",_=f6(),j=h6();return s.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[_&&s.jsx(RP,{collapsed:_.collapsed,onToggle:_.toggle}),s.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[h,b&&s.jsxs("span",{className:"text-muted-fg/50",children:[" · ",b]})]}),j,s.jsx(K$,{}),s.jsx($e,{content:u(t?"topbar.light":"topbar.dark"),children:s.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?s.jsx(h3,{size:14}):s.jsx(s3,{size:14})})})]})}function K$(){const e=k_(),t=a=>{a!==e&&(sN(a),window.location.reload())};return s.jsxs(v_,{children:[s.jsxs(y_,{"data-testid":"lang-menu",title:u("topbar.lang_toggle"),className:"flex shrink-0 items-center gap-1 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:[s.jsx(WM,{size:14}),s.jsx("span",{className:"text-[11px] font-medium uppercase",children:e})]}),s.jsx(j_,{align:"end",children:s.jsx(yP,{value:e,onValueChange:a=>t(a),children:aN.map(a=>s.jsx(jP,{value:a.value,children:a.label},a.value))})})]})}function X$(e){switch(e){case"desktop":return u("nav.modules.desktop");case"code":return u("nav.modules.code");default:return e||""}}function Q$(e){switch(e){case"super-agent":return u("settings.tabs.super_agent");case"engines":return u("settings.tabs.engines");case"telegram":return u("settings.tabs.telegram");case"devices":return u("settings.tabs.devices");case"voice":return u("nav.modules.voice");case"deck":return u("nav.modules.deck");case"desktop":return u("nav.modules.desktop");case"appearance":return u("settings.appearance");case"config":case"advanced":return u("settings.tabs.advanced");case"identity":default:return e||""}}function W$(e){switch(e){case"chat":return u("project.nav.chat");case"telegram":return u("project.nav.telegram");case"agents":return u("project.nav.agents");case"routines":return u("project.nav.routines");case"tasks":return u("project.nav.tasks");case"mcps":return u("project.nav.mcps");case"artifacts":return u("project.nav.artifacts");case"config":return u("project.nav.config");case"workspaces":return u("base.workspaces_title");case"models":return u("settings.tabs.engines");case"agent-defaults":return u("base.defaults_title");case"sessions":return u("base.sessions_title");case"logs":return u("project.nav.logs");case"memories":return u("project.nav.memories");default:return""}}function cS({text:e,sub:t,mood:a="happy"}){return s.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:s.jsxs("div",{className:"flex flex-col items-center text-center",children:[s.jsx($N,{mood:a,className:"mb-4 text-xs"}),s.jsx("div",{className:"text-foreground",children:e}),t&&s.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:t})]})})}function Z$(){const e=Pn();return s.jsx(HN,{testId:"screen-not-found",mood:"confused",title:u("not_found.title"),titleClassName:"text-7xl",message:u("not_found.message"),action:s.jsx(ar,{variant:"outline",onClick:()=>e("/"),children:u("not_found.home")})})}mI();DA.createRoot(document.getElementById("root")).render(s.jsx(Wc.StrictMode,{children:s.jsx(rM,{children:s.jsx(w3,{children:s.jsx(F$,{})})})}));
|
|
803
|
+
//# sourceMappingURL=index-vwd6yQVw.js.map
|