@agentprojectcontext/apx 1.38.1 → 1.39.1

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.
@@ -1,629 +0,0 @@
1
- function BN(e,n){for(var s=0;s<n.length;s++){const o=n[s];if(typeof o!="string"&&!Array.isArray(o)){for(const l in o)if(l!=="default"&&!(l in e)){const c=Object.getOwnPropertyDescriptor(o,l);c&&Object.defineProperty(e,l,c.get?c:{enumerable:!0,get:()=>o[l]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.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 s(l){const c={};return l.integrity&&(c.integrity=l.integrity),l.referrerPolicy&&(c.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?c.credentials="include":l.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function o(l){if(l.ep)return;l.ep=!0;const c=s(l);fetch(l.href,c)}})();function ex(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fm={exports:{}},Ti={};/**
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 T0;function UN(){if(T0)return Ti;T0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(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 Ti.Fragment=n,Ti.jsx=s,Ti.jsxs=s,Ti}var A0;function HN(){return A0||(A0=1,Fm.exports=UN()),Fm.exports}var r=HN(),Ym={exports:{}},rt={};/**
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 M0;function VN(){if(M0)return rt;M0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),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"),_=Symbol.for("react.activity"),v=Symbol.iterator;function k(U){return U===null||typeof U!="object"?null:(U=v&&U[v]||U["@@iterator"],typeof U=="function"?U:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,w={};function C(U,K,F){this.props=U,this.context=K,this.refs=w,this.updater=F||S}C.prototype.isReactComponent={},C.prototype.setState=function(U,K){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,K,"setState")},C.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function E(){}E.prototype=C.prototype;function N(U,K,F){this.props=U,this.context=K,this.refs=w,this.updater=F||S}var R=N.prototype=new E;R.constructor=N,j(R,C.prototype),R.isPureReactComponent=!0;var T=Array.isArray;function O(){}var A={H:null,A:null,T:null,S:null},z=Object.prototype.hasOwnProperty;function B(U,K,F){var J=F.ref;return{$$typeof:e,type:U,key:K,ref:J!==void 0?J:null,props:F}}function L(U,K){return B(U.type,K,U.props)}function D(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function P(U){var K={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(F){return K[F]})}var H=/\/+/g;function q(U,K){return typeof U=="object"&&U!==null&&U.key!=null?P(""+U.key):K.toString(36)}function Y(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(O,O):(U.status="pending",U.then(function(K){U.status==="pending"&&(U.status="fulfilled",U.value=K)},function(K){U.status==="pending"&&(U.status="rejected",U.reason=K)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function V(U,K,F,J,ie){var re=typeof U;(re==="undefined"||re==="boolean")&&(U=null);var oe=!1;if(U===null)oe=!0;else switch(re){case"bigint":case"string":case"number":oe=!0;break;case"object":switch(U.$$typeof){case e:case n:oe=!0;break;case h:return oe=U._init,V(oe(U._payload),K,F,J,ie)}}if(oe)return ie=ie(U),oe=J===""?"."+q(U,0):J,T(ie)?(F="",oe!=null&&(F=oe.replace(H,"$&/")+"/"),V(ie,K,F,"",function(Te){return Te})):ie!=null&&(D(ie)&&(ie=L(ie,F+(ie.key==null||U&&U.key===ie.key?"":(""+ie.key).replace(H,"$&/")+"/")+oe)),K.push(ie)),1;oe=0;var ce=J===""?".":J+":";if(T(U))for(var ee=0;ee<U.length;ee++)J=U[ee],re=ce+q(J,ee),oe+=V(J,K,F,re,ie);else if(ee=k(U),typeof ee=="function")for(U=ee.call(U),ee=0;!(J=U.next()).done;)J=J.value,re=ce+q(J,ee++),oe+=V(J,K,F,re,ie);else if(re==="object"){if(typeof U.then=="function")return V(Y(U),K,F,J,ie);throw K=String(U),Error("Objects are not valid as a React child (found: "+(K==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":K)+"). If you meant to render a collection of children, use an array instead.")}return oe}function $(U,K,F){if(U==null)return U;var J=[],ie=0;return V(U,J,"","",function(re){return K.call(F,re,ie++)}),J}function Z(U){if(U._status===-1){var K=U._result;K=K(),K.then(function(F){(U._status===0||U._status===-1)&&(U._status=1,U._result=F)},function(F){(U._status===0||U._status===-1)&&(U._status=2,U._result=F)}),U._status===-1&&(U._status=0,U._result=K)}if(U._status===1)return U._result.default;throw U._result}var G=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var K=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(K))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},X={map:$,forEach:function(U,K,F){$(U,function(){K.apply(this,arguments)},F)},count:function(U){var K=0;return $(U,function(){K++}),K},toArray:function(U){return $(U,function(K){return K})||[]},only:function(U){if(!D(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return rt.Activity=_,rt.Children=X,rt.Component=C,rt.Fragment=s,rt.Profiler=l,rt.PureComponent=N,rt.StrictMode=o,rt.Suspense=m,rt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,rt.__COMPILER_RUNTIME={__proto__:null,c:function(U){return A.H.useMemoCache(U)}},rt.cache=function(U){return function(){return U.apply(null,arguments)}},rt.cacheSignal=function(){return null},rt.cloneElement=function(U,K,F){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var J=j({},U.props),ie=U.key;if(K!=null)for(re in K.key!==void 0&&(ie=""+K.key),K)!z.call(K,re)||re==="key"||re==="__self"||re==="__source"||re==="ref"&&K.ref===void 0||(J[re]=K[re]);var re=arguments.length-2;if(re===1)J.children=F;else if(1<re){for(var oe=Array(re),ce=0;ce<re;ce++)oe[ce]=arguments[ce+2];J.children=oe}return B(U.type,ie,J)},rt.createContext=function(U){return U={$$typeof:d,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:c,_context:U},U},rt.createElement=function(U,K,F){var J,ie={},re=null;if(K!=null)for(J in K.key!==void 0&&(re=""+K.key),K)z.call(K,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(ie[J]=K[J]);var oe=arguments.length-2;if(oe===1)ie.children=F;else if(1<oe){for(var ce=Array(oe),ee=0;ee<oe;ee++)ce[ee]=arguments[ee+2];ie.children=ce}if(U&&U.defaultProps)for(J in oe=U.defaultProps,oe)ie[J]===void 0&&(ie[J]=oe[J]);return B(U,re,ie)},rt.createRef=function(){return{current:null}},rt.forwardRef=function(U){return{$$typeof:p,render:U}},rt.isValidElement=D,rt.lazy=function(U){return{$$typeof:h,_payload:{_status:-1,_result:U},_init:Z}},rt.memo=function(U,K){return{$$typeof:g,type:U,compare:K===void 0?null:K}},rt.startTransition=function(U){var K=A.T,F={};A.T=F;try{var J=U(),ie=A.S;ie!==null&&ie(F,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(O,G)}catch(re){G(re)}finally{K!==null&&F.types!==null&&(K.types=F.types),A.T=K}},rt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},rt.use=function(U){return A.H.use(U)},rt.useActionState=function(U,K,F){return A.H.useActionState(U,K,F)},rt.useCallback=function(U,K){return A.H.useCallback(U,K)},rt.useContext=function(U){return A.H.useContext(U)},rt.useDebugValue=function(){},rt.useDeferredValue=function(U,K){return A.H.useDeferredValue(U,K)},rt.useEffect=function(U,K){return A.H.useEffect(U,K)},rt.useEffectEvent=function(U){return A.H.useEffectEvent(U)},rt.useId=function(){return A.H.useId()},rt.useImperativeHandle=function(U,K,F){return A.H.useImperativeHandle(U,K,F)},rt.useInsertionEffect=function(U,K){return A.H.useInsertionEffect(U,K)},rt.useLayoutEffect=function(U,K){return A.H.useLayoutEffect(U,K)},rt.useMemo=function(U,K){return A.H.useMemo(U,K)},rt.useOptimistic=function(U,K){return A.H.useOptimistic(U,K)},rt.useReducer=function(U,K,F){return A.H.useReducer(U,K,F)},rt.useRef=function(U){return A.H.useRef(U)},rt.useState=function(U){return A.H.useState(U)},rt.useSyncExternalStore=function(U,K,F){return A.H.useSyncExternalStore(U,K,F)},rt.useTransition=function(){return A.H.useTransition()},rt.version="19.2.7",rt}var O0;function wc(){return O0||(O0=1,Ym.exports=VN()),Ym.exports}var x=wc();const kc=ex(x),qN=BN({__proto__:null,default:kc},[x]);var Xm={exports:{}},Ai={},Km={exports:{}},Qm={};/**
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 z0;function $N(){return z0||(z0=1,(function(e){function n(V,$){var Z=V.length;V.push($);e:for(;0<Z;){var G=Z-1>>>1,X=V[G];if(0<l(X,$))V[G]=$,V[Z]=X,Z=G;else break e}}function s(V){return V.length===0?null:V[0]}function o(V){if(V.length===0)return null;var $=V[0],Z=V.pop();if(Z!==$){V[0]=Z;e:for(var G=0,X=V.length,U=X>>>1;G<U;){var K=2*(G+1)-1,F=V[K],J=K+1,ie=V[J];if(0>l(F,Z))J<X&&0>l(ie,F)?(V[G]=ie,V[J]=Z,G=J):(V[G]=F,V[K]=Z,G=K);else if(J<X&&0>l(ie,Z))V[G]=ie,V[J]=Z,G=J;else break e}}return $}function l(V,$){var Z=V.sortIndex-$.sortIndex;return Z!==0?Z:V.id-$.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,_=null,v=3,k=!1,S=!1,j=!1,w=!1,C=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function R(V){for(var $=s(g);$!==null;){if($.callback===null)o(g);else if($.startTime<=V)o(g),$.sortIndex=$.expirationTime,n(m,$);else break;$=s(g)}}function T(V){if(j=!1,R(V),!S)if(s(m)!==null)S=!0,O||(O=!0,P());else{var $=s(g);$!==null&&Y(T,$.startTime-V)}}var O=!1,A=-1,z=5,B=-1;function L(){return w?!0:!(e.unstable_now()-B<z)}function D(){if(w=!1,O){var V=e.unstable_now();B=V;var $=!0;try{e:{S=!1,j&&(j=!1,E(A),A=-1),k=!0;var Z=v;try{t:{for(R(V),_=s(m);_!==null&&!(_.expirationTime>V&&L());){var G=_.callback;if(typeof G=="function"){_.callback=null,v=_.priorityLevel;var X=G(_.expirationTime<=V);if(V=e.unstable_now(),typeof X=="function"){_.callback=X,R(V),$=!0;break t}_===s(m)&&o(m),R(V)}else o(m);_=s(m)}if(_!==null)$=!0;else{var U=s(g);U!==null&&Y(T,U.startTime-V),$=!1}}break e}finally{_=null,v=Z,k=!1}$=void 0}}finally{$?P():O=!1}}}var P;if(typeof N=="function")P=function(){N(D)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,q=H.port2;H.port1.onmessage=D,P=function(){q.postMessage(null)}}else P=function(){C(D,0)};function Y(V,$){A=C(function(){V(e.unstable_now())},$)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(V){V.callback=null},e.unstable_forceFrameRate=function(V){0>V||125<V?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<V?Math.floor(1e3/V):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(V){switch(v){case 1:case 2:case 3:var $=3;break;default:$=v}var Z=v;v=$;try{return V()}finally{v=Z}},e.unstable_requestPaint=function(){w=!0},e.unstable_runWithPriority=function(V,$){switch(V){case 1:case 2:case 3:case 4:case 5:break;default:V=3}var Z=v;v=V;try{return $()}finally{v=Z}},e.unstable_scheduleCallback=function(V,$,Z){var G=e.unstable_now();switch(typeof Z=="object"&&Z!==null?(Z=Z.delay,Z=typeof Z=="number"&&0<Z?G+Z:G):Z=G,V){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=Z+X,V={id:h++,callback:$,priorityLevel:V,startTime:Z,expirationTime:X,sortIndex:-1},Z>G?(V.sortIndex=Z,n(g,V),s(m)===null&&V===s(g)&&(j?(E(A),A=-1):j=!0,Y(T,Z-G))):(V.sortIndex=X,n(m,V),S||k||(S=!0,O||(O=!0,P()))),V},e.unstable_shouldYield=L,e.unstable_wrapCallback=function(V){var $=v;return function(){var Z=v;v=$;try{return V.apply(this,arguments)}finally{v=Z}}}})(Qm)),Qm}var D0;function GN(){return D0||(D0=1,Km.exports=$N()),Km.exports}var Zm={exports:{}},Dn={};/**
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 L0;function FN(){if(L0)return Dn;L0=1;var e=wc();function n(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)g+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var o={d:{f:s,r:function(){throw Error(n(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},l=Symbol.for("react.portal");function c(m,g,h){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:l,key:_==null?null:""+_,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 Dn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Dn.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(n(299));return c(m,g,null,h)},Dn.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()}},Dn.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))},Dn.prefetchDNS=function(m){typeof m=="string"&&o.d.D(m)},Dn.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var h=g.as,_=p(h,g.crossOrigin),v=typeof g.integrity=="string"?g.integrity:void 0,k=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;h==="style"?o.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:_,integrity:v,fetchPriority:k}):h==="script"&&o.d.X(m,{crossOrigin:_,integrity:v,fetchPriority:k,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},Dn.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)},Dn.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var h=g.as,_=p(h,g.crossOrigin);o.d.L(m,h,{crossOrigin:_,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})}},Dn.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)},Dn.requestFormReset=function(m){o.d.r(m)},Dn.unstable_batchedUpdates=function(m,g){return m(g)},Dn.useFormState=function(m,g,h){return d.H.useFormState(m,g,h)},Dn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Dn.version="19.2.7",Dn}var P0;function bw(){if(P0)return Zm.exports;P0=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(n){console.error(n)}}return e(),Zm.exports=FN(),Zm.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 I0;function YN(){if(I0)return Ai;I0=1;var e=GN(),n=wc(),s=bw();function o(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var i=2;i<arguments.length;i++)a+="&args[]="+encodeURIComponent(arguments[i])}return"Minified React error #"+t+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function l(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var a=t,i=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(i=a.return),t=a.return;while(t)}return a.tag===3?i:null}function d(t){if(t.tag===13){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function p(t){if(t.tag===31){var a=t.memoizedState;if(a===null&&(t=t.alternate,t!==null&&(a=t.memoizedState)),a!==null)return a.dehydrated}return null}function m(t){if(c(t)!==t)throw Error(o(188))}function g(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(o(188));return a!==t?null:t}for(var i=t,u=a;;){var b=i.return;if(b===null)break;var y=b.alternate;if(y===null){if(u=b.return,u!==null){i=u;continue}break}if(b.child===y.child){for(y=b.child;y;){if(y===i)return m(b),t;if(y===u)return m(b),a;y=y.sibling}throw Error(o(188))}if(i.return!==u.return)i=b,u=y;else{for(var M=!1,I=b.child;I;){if(I===i){M=!0,i=b,u=y;break}if(I===u){M=!0,u=b,i=y;break}I=I.sibling}if(!M){for(I=y.child;I;){if(I===i){M=!0,i=y,u=b;break}if(I===u){M=!0,u=y,i=b;break}I=I.sibling}if(!M)throw Error(o(189))}}if(i.alternate!==u)throw Error(o(190))}if(i.tag!==3)throw Error(o(188));return i.stateNode.current===i?t:a}function h(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t;for(t=t.child;t!==null;){if(a=h(t),a!==null)return a;t=t.sibling}return null}var _=Object.assign,v=Symbol.for("react.element"),k=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),w=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),N=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),O=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),z=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),L=Symbol.for("react.memo_cache_sentinel"),D=Symbol.iterator;function P(t){return t===null||typeof t!="object"?null:(t=D&&t[D]||t["@@iterator"],typeof t=="function"?t:null)}var H=Symbol.for("react.client.reference");function q(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===H?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case j:return"Fragment";case C:return"Profiler";case w:return"StrictMode";case T:return"Suspense";case O:return"SuspenseList";case B:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case S:return"Portal";case N:return t.displayName||"Context";case E:return(t._context.displayName||"Context")+".Consumer";case R:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case A:return a=t.displayName||null,a!==null?a:q(t.type)||"Memo";case z:a=t._payload,t=t._init;try{return q(t(a))}catch{}}return null}var Y=Array.isArray,V=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},G=[],X=-1;function U(t){return{current:t}}function K(t){0>X||(t.current=G[X],G[X]=null,X--)}function F(t,a){X++,G[X]=t.current,t.current=a}var J=U(null),ie=U(null),re=U(null),oe=U(null);function ce(t,a){switch(F(re,a),F(ie,t),F(J,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Jy(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Jy(a),t=e0(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}K(J),F(J,t)}function ee(){K(J),K(ie),K(re)}function Te(t){t.memoizedState!==null&&F(oe,t);var a=J.current,i=e0(a,t.type);a!==i&&(F(ie,t),F(J,i))}function Fe(t){ie.current===t&&(K(J),K(ie)),oe.current===t&&(K(oe),Ci._currentValue=Z)}var _e,Se;function Ne(t){if(_e===void 0)try{throw Error()}catch(i){var a=i.stack.trim().match(/\n( *(at )?)/);_e=a&&a[1]||"",Se=-1<i.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<i.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+_e+t+Se}var Pe=!1;function Ie(t,a){if(!t||Pe)return"";Pe=!0;var i=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(ue){var se=ue}Reflect.construct(t,[],xe)}else{try{xe.call()}catch(ue){se=ue}t.call(xe.prototype)}}else{try{throw Error()}catch(ue){se=ue}(xe=t())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(ue){if(ue&&se&&typeof ue.stack=="string")return[ue.stack,se.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var b=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");b&&b.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=u.DetermineComponentFrameRoot(),M=y[0],I=y[1];if(M&&I){var Q=M.split(`
44
- `),ae=I.split(`
45
- `);for(b=u=0;u<Q.length&&!Q[u].includes("DetermineComponentFrameRoot");)u++;for(;b<ae.length&&!ae[b].includes("DetermineComponentFrameRoot");)b++;if(u===Q.length||b===ae.length)for(u=Q.length-1,b=ae.length-1;1<=u&&0<=b&&Q[u]!==ae[b];)b--;for(;1<=u&&0<=b;u--,b--)if(Q[u]!==ae[b]){if(u!==1||b!==1)do if(u--,b--,0>b||Q[u]!==ae[b]){var fe=`
46
- `+Q[u].replace(" at new "," at ");return t.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",t.displayName)),fe}while(1<=u&&0<=b);break}}}finally{Pe=!1,Error.prepareStackTrace=i}return(i=t?t.displayName||t.name:"")?Ne(i):""}function be(t,a){switch(t.tag){case 26:case 27:case 5:return Ne(t.type);case 16:return Ne("Lazy");case 13:return t.child!==a&&a!==null?Ne("Suspense Fallback"):Ne("Suspense");case 19:return Ne("SuspenseList");case 0:case 15:return Ie(t.type,!1);case 11:return Ie(t.type.render,!1);case 1:return Ie(t.type,!0);case 31:return Ne("Activity");default:return""}}function Ae(t){try{var a="",i=null;do a+=be(t,i),i=t,t=t.return;while(t);return a}catch(u){return`
47
- Error generating stack: `+u.message+`
48
- `+u.stack}}var we=Object.prototype.hasOwnProperty,Be=e.unstable_scheduleCallback,Xe=e.unstable_cancelCallback,Ye=e.unstable_shouldYield,De=e.unstable_requestPaint,ve=e.unstable_now,le=e.unstable_getCurrentPriorityLevel,je=e.unstable_ImmediatePriority,ke=e.unstable_UserBlockingPriority,Ue=e.unstable_NormalPriority,Je=e.unstable_LowPriority,yt=e.unstable_IdlePriority,zt=e.log,pe=e.unstable_setDisableYieldValue,Ee=null,Re=null;function qe(t){if(typeof zt=="function"&&pe(t),Re&&typeof Re.setStrictMode=="function")try{Re.setStrictMode(Ee,t)}catch{}}var st=Math.clz32?Math.clz32:mt,an=Math.log,Vt=Math.LN2;function mt(t){return t>>>=0,t===0?32:31-(an(t)/Vt|0)|0}var Rt=256,Wt=262144,kt=4194304;function sn(t){var a=t&42;if(a!==0)return a;switch(t&-t){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 t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function Ft(t,a,i){var u=t.pendingLanes;if(u===0)return 0;var b=0,y=t.suspendedLanes,M=t.pingedLanes;t=t.warmLanes;var I=u&134217727;return I!==0?(u=I&~y,u!==0?b=sn(u):(M&=I,M!==0?b=sn(M):i||(i=I&~t,i!==0&&(b=sn(i))))):(I=u&~y,I!==0?b=sn(I):M!==0?b=sn(M):i||(i=u&~t,i!==0&&(b=sn(i)))),b===0?0:a!==0&&a!==b&&(a&y)===0&&(y=b&-b,i=a&-a,y>=i||y===32&&(i&4194048)!==0)?a:b}function dn(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function On(t,a){switch(t){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Kn(){var t=kt;return kt<<=1,(kt&62914560)===0&&(kt=4194304),t}function ca(t){for(var a=[],i=0;31>i;i++)a.push(t);return a}function Qn(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function us(t,a,i,u,b,y){var M=t.pendingLanes;t.pendingLanes=i,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=i,t.entangledLanes&=i,t.errorRecoveryDisabledLanes&=i,t.shellSuspendCounter=0;var I=t.entanglements,Q=t.expirationTimes,ae=t.hiddenUpdates;for(i=M&~i;0<i;){var fe=31-st(i),xe=1<<fe;I[fe]=0,Q[fe]=-1;var se=ae[fe];if(se!==null)for(ae[fe]=null,fe=0;fe<se.length;fe++){var ue=se[fe];ue!==null&&(ue.lane&=-536870913)}i&=~xe}u!==0&&zn(t,u,0),y!==0&&b===0&&t.tag!==0&&(t.suspendedLanes|=y&~(M&~a))}function zn(t,a,i){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-st(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|i&261930}function ua(t,a){var i=t.entangledLanes|=a;for(t=t.entanglements;i;){var u=31-st(i),b=1<<u;b&a|t[u]&a&&(t[u]|=a),i&=~b}}function Ia(t,a){var i=a&-a;return i=(i&42)!==0?1:ds(i),(i&(t.suspendedLanes|a))!==0?0:i}function ds(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=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:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function it(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Dt(){var t=$.p;return t!==0?t:(t=window.event,t===void 0?32:w0(t.type))}function kn(t,a){var i=$.p;try{return $.p=t,a()}finally{$.p=i}}var rn=Math.random().toString(36).slice(2),At="__reactFiber$"+rn,hn="__reactProps$"+rn,Pr="__reactContainer$"+rn,Dc="__reactEvents$"+rn,NC="__reactListeners$"+rn,RC="__reactHandles$"+rn,Ub="__reactResources$"+rn,Hl="__reactMarker$"+rn;function If(t){delete t[At],delete t[hn],delete t[Dc],delete t[NC],delete t[RC]}function ko(t){var a=t[At];if(a)return a;for(var i=t.parentNode;i;){if(a=i[Pr]||i[At]){if(i=a.alternate,a.child!==null||i!==null&&i.child!==null)for(t=l0(t);t!==null;){if(i=t[At])return i;t=l0(t)}return a}t=i,i=t.parentNode}return null}function So(t){if(t=t[At]||t[Pr]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function Vl(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(o(33))}function Co(t){var a=t[Ub];return a||(a=t[Ub]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function jn(t){t[Hl]=!0}var Hb=new Set,Vb={};function Ir(t,a){Eo(t,a),Eo(t+"Capture",a)}function Eo(t,a){for(Vb[t]=a,t=0;t<a.length;t++)Hb.add(a[t])}var TC=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]*$"),qb={},$b={};function AC(t){return we.call($b,t)?!0:we.call(qb,t)?!1:TC.test(t)?$b[t]=!0:(qb[t]=!0,!1)}function Lc(t,a,i){if(AC(a))if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":t.removeAttribute(a);return;case"boolean":var u=a.toLowerCase().slice(0,5);if(u!=="data-"&&u!=="aria-"){t.removeAttribute(a);return}}t.setAttribute(a,""+i)}}function Pc(t,a,i){if(i===null)t.removeAttribute(a);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+i)}}function fs(t,a,i,u){if(u===null)t.removeAttribute(i);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(i);return}t.setAttributeNS(a,i,""+u)}}function ja(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Gb(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function MC(t,a,i){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var b=u.get,y=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return b.call(this)},set:function(M){i=""+M,y.call(this,M)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return i},setValue:function(M){i=""+M},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function Bf(t){if(!t._valueTracker){var a=Gb(t)?"checked":"value";t._valueTracker=MC(t,a,""+t[a])}}function Fb(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var i=a.getValue(),u="";return t&&(u=Gb(t)?t.checked?"true":"false":t.value),t=u,t!==i?(a.setValue(t),!0):!1}function Ic(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var OC=/[\n"\\]/g;function wa(t){return t.replace(OC,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function Uf(t,a,i,u,b,y,M,I){t.name="",M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?t.type=M:t.removeAttribute("type"),a!=null?M==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+ja(a)):t.value!==""+ja(a)&&(t.value=""+ja(a)):M!=="submit"&&M!=="reset"||t.removeAttribute("value"),a!=null?Hf(t,M,ja(a)):i!=null?Hf(t,M,ja(i)):u!=null&&t.removeAttribute("value"),b==null&&y!=null&&(t.defaultChecked=!!y),b!=null&&(t.checked=b&&typeof b!="function"&&typeof b!="symbol"),I!=null&&typeof I!="function"&&typeof I!="symbol"&&typeof I!="boolean"?t.name=""+ja(I):t.removeAttribute("name")}function Yb(t,a,i,u,b,y,M,I){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(t.type=y),a!=null||i!=null){if(!(y!=="submit"&&y!=="reset"||a!=null)){Bf(t);return}i=i!=null?""+ja(i):"",a=a!=null?""+ja(a):i,I||a===t.value||(t.value=a),t.defaultValue=a}u=u??b,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=I?t.checked:!!u,t.defaultChecked=!!u,M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"&&(t.name=M),Bf(t)}function Hf(t,a,i){a==="number"&&Ic(t.ownerDocument)===t||t.defaultValue===""+i||(t.defaultValue=""+i)}function No(t,a,i,u){if(t=t.options,a){a={};for(var b=0;b<i.length;b++)a["$"+i[b]]=!0;for(i=0;i<t.length;i++)b=a.hasOwnProperty("$"+t[i].value),t[i].selected!==b&&(t[i].selected=b),b&&u&&(t[i].defaultSelected=!0)}else{for(i=""+ja(i),a=null,b=0;b<t.length;b++){if(t[b].value===i){t[b].selected=!0,u&&(t[b].defaultSelected=!0);return}a!==null||t[b].disabled||(a=t[b])}a!==null&&(a.selected=!0)}}function Xb(t,a,i){if(a!=null&&(a=""+ja(a),a!==t.value&&(t.value=a),i==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=i!=null?""+ja(i):""}function Kb(t,a,i,u){if(a==null){if(u!=null){if(i!=null)throw Error(o(92));if(Y(u)){if(1<u.length)throw Error(o(93));u=u[0]}i=u}i==null&&(i=""),a=i}i=ja(a),t.defaultValue=i,u=t.textContent,u===i&&u!==""&&u!==null&&(t.value=u),Bf(t)}function Ro(t,a){if(a){var i=t.firstChild;if(i&&i===t.lastChild&&i.nodeType===3){i.nodeValue=a;return}}t.textContent=a}var zC=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 Qb(t,a,i){var u=a.indexOf("--")===0;i==null||typeof i=="boolean"||i===""?u?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":u?t.setProperty(a,i):typeof i!="number"||i===0||zC.has(a)?a==="float"?t.cssFloat=i:t[a]=(""+i).trim():t[a]=i+"px"}function Zb(t,a,i){if(a!=null&&typeof a!="object")throw Error(o(62));if(t=t.style,i!=null){for(var u in i)!i.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var b in a)u=a[b],a.hasOwnProperty(b)&&i[b]!==u&&Qb(t,b,u)}else for(var y in a)a.hasOwnProperty(y)&&Qb(t,y,a[y])}function Vf(t){if(t.indexOf("-")===-1)return!1;switch(t){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 DC=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"]]),LC=/^[\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 Bc(t){return LC.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function ps(){}var qf=null;function $f(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var To=null,Ao=null;function Wb(t){var a=So(t);if(a&&(t=a.stateNode)){var i=t[hn]||null;e:switch(t=a.stateNode,a.type){case"input":if(Uf(t,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name),a=i.name,i.type==="radio"&&a!=null){for(i=t;i.parentNode;)i=i.parentNode;for(i=i.querySelectorAll('input[name="'+wa(""+a)+'"][type="radio"]'),a=0;a<i.length;a++){var u=i[a];if(u!==t&&u.form===t.form){var b=u[hn]||null;if(!b)throw Error(o(90));Uf(u,b.value,b.defaultValue,b.defaultValue,b.checked,b.defaultChecked,b.type,b.name)}}for(a=0;a<i.length;a++)u=i[a],u.form===t.form&&Fb(u)}break e;case"textarea":Xb(t,i.value,i.defaultValue);break e;case"select":a=i.value,a!=null&&No(t,!!i.multiple,a,!1)}}}var Gf=!1;function Jb(t,a,i){if(Gf)return t(a,i);Gf=!0;try{var u=t(a);return u}finally{if(Gf=!1,(To!==null||Ao!==null)&&(Cu(),To&&(a=To,t=Ao,Ao=To=null,Wb(a),t)))for(a=0;a<t.length;a++)Wb(t[a])}}function ql(t,a){var i=t.stateNode;if(i===null)return null;var u=i[hn]||null;if(u===null)return null;i=u[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(u=!u.disabled)||(t=t.type,u=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!u;break e;default:t=!1}if(t)return null;if(i&&typeof i!="function")throw Error(o(231,a,typeof i));return i}var ms=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ff=!1;if(ms)try{var $l={};Object.defineProperty($l,"passive",{get:function(){Ff=!0}}),window.addEventListener("test",$l,$l),window.removeEventListener("test",$l,$l)}catch{Ff=!1}var Fs=null,Yf=null,Uc=null;function e_(){if(Uc)return Uc;var t,a=Yf,i=a.length,u,b="value"in Fs?Fs.value:Fs.textContent,y=b.length;for(t=0;t<i&&a[t]===b[t];t++);var M=i-t;for(u=1;u<=M&&a[i-u]===b[y-u];u++);return Uc=b.slice(t,1<u?1-u:void 0)}function Hc(t){var a=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&a===13&&(t=13)):t=a,t===10&&(t=13),32<=t||t===13?t:0}function Vc(){return!0}function t_(){return!1}function Zn(t){function a(i,u,b,y,M){this._reactName=i,this._targetInst=b,this.type=u,this.nativeEvent=y,this.target=M,this.currentTarget=null;for(var I in t)t.hasOwnProperty(I)&&(i=t[I],this[I]=i?i(y):y[I]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Vc:t_,this.isPropagationStopped=t_,this}return _(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var i=this.nativeEvent;i&&(i.preventDefault?i.preventDefault():typeof i.returnValue!="unknown"&&(i.returnValue=!1),this.isDefaultPrevented=Vc)},stopPropagation:function(){var i=this.nativeEvent;i&&(i.stopPropagation?i.stopPropagation():typeof i.cancelBubble!="unknown"&&(i.cancelBubble=!0),this.isPropagationStopped=Vc)},persist:function(){},isPersistent:Vc}),a}var Br={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qc=Zn(Br),Gl=_({},Br,{view:0,detail:0}),PC=Zn(Gl),Xf,Kf,Fl,$c=_({},Gl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zf,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Fl&&(Fl&&t.type==="mousemove"?(Xf=t.screenX-Fl.screenX,Kf=t.screenY-Fl.screenY):Kf=Xf=0,Fl=t),Xf)},movementY:function(t){return"movementY"in t?t.movementY:Kf}}),n_=Zn($c),IC=_({},$c,{dataTransfer:0}),BC=Zn(IC),UC=_({},Gl,{relatedTarget:0}),Qf=Zn(UC),HC=_({},Br,{animationName:0,elapsedTime:0,pseudoElement:0}),VC=Zn(HC),qC=_({},Br,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),$C=Zn(qC),GC=_({},Br,{data:0}),a_=Zn(GC),FC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},YC={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"},XC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function KC(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=XC[t])?!!a[t]:!1}function Zf(){return KC}var QC=_({},Gl,{key:function(t){if(t.key){var a=FC[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=Hc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?YC[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zf,charCode:function(t){return t.type==="keypress"?Hc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Hc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ZC=Zn(QC),WC=_({},$c,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),s_=Zn(WC),JC=_({},Gl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zf}),eE=Zn(JC),tE=_({},Br,{propertyName:0,elapsedTime:0,pseudoElement:0}),nE=Zn(tE),aE=_({},$c,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),sE=Zn(aE),rE=_({},Br,{newState:0,oldState:0}),oE=Zn(rE),lE=[9,13,27,32],Wf=ms&&"CompositionEvent"in window,Yl=null;ms&&"documentMode"in document&&(Yl=document.documentMode);var iE=ms&&"TextEvent"in window&&!Yl,r_=ms&&(!Wf||Yl&&8<Yl&&11>=Yl),o_=" ",l_=!1;function i_(t,a){switch(t){case"keyup":return lE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function c_(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Mo=!1;function cE(t,a){switch(t){case"compositionend":return c_(a);case"keypress":return a.which!==32?null:(l_=!0,o_);case"textInput":return t=a.data,t===o_&&l_?null:t;default:return null}}function uE(t,a){if(Mo)return t==="compositionend"||!Wf&&i_(t,a)?(t=e_(),Uc=Yf=Fs=null,Mo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return r_&&a.locale!=="ko"?null:a.data;default:return null}}var dE={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 u_(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!dE[t.type]:a==="textarea"}function d_(t,a,i,u){To?Ao?Ao.push(u):Ao=[u]:To=u,a=Ou(a,"onChange"),0<a.length&&(i=new qc("onChange","change",null,i,u),t.push({event:i,listeners:a}))}var Xl=null,Kl=null;function fE(t){Yy(t,0)}function Gc(t){var a=Vl(t);if(Fb(a))return t}function f_(t,a){if(t==="change")return a}var p_=!1;if(ms){var Jf;if(ms){var ep="oninput"in document;if(!ep){var m_=document.createElement("div");m_.setAttribute("oninput","return;"),ep=typeof m_.oninput=="function"}Jf=ep}else Jf=!1;p_=Jf&&(!document.documentMode||9<document.documentMode)}function g_(){Xl&&(Xl.detachEvent("onpropertychange",h_),Kl=Xl=null)}function h_(t){if(t.propertyName==="value"&&Gc(Kl)){var a=[];d_(a,Kl,t,$f(t)),Jb(fE,a)}}function pE(t,a,i){t==="focusin"?(g_(),Xl=a,Kl=i,Xl.attachEvent("onpropertychange",h_)):t==="focusout"&&g_()}function mE(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Gc(Kl)}function gE(t,a){if(t==="click")return Gc(a)}function hE(t,a){if(t==="input"||t==="change")return Gc(a)}function xE(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var da=typeof Object.is=="function"?Object.is:xE;function Ql(t,a){if(da(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var i=Object.keys(t),u=Object.keys(a);if(i.length!==u.length)return!1;for(u=0;u<i.length;u++){var b=i[u];if(!we.call(a,b)||!da(t[b],a[b]))return!1}return!0}function x_(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function b_(t,a){var i=x_(t);t=0;for(var u;i;){if(i.nodeType===3){if(u=t+i.textContent.length,t<=a&&u>=a)return{node:i,offset:a-t};t=u}e:{for(;i;){if(i.nextSibling){i=i.nextSibling;break e}i=i.parentNode}i=void 0}i=x_(i)}}function __(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?__(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function v_(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=Ic(t.document);a instanceof t.HTMLIFrameElement;){try{var i=typeof a.contentWindow.location.href=="string"}catch{i=!1}if(i)t=a.contentWindow;else break;a=Ic(t.document)}return a}function tp(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a&&(a==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||a==="textarea"||t.contentEditable==="true")}var bE=ms&&"documentMode"in document&&11>=document.documentMode,Oo=null,np=null,Zl=null,ap=!1;function y_(t,a,i){var u=i.window===i?i.document:i.nodeType===9?i:i.ownerDocument;ap||Oo==null||Oo!==Ic(u)||(u=Oo,"selectionStart"in u&&tp(u)?u={start:u.selectionStart,end:u.selectionEnd}:(u=(u.ownerDocument&&u.ownerDocument.defaultView||window).getSelection(),u={anchorNode:u.anchorNode,anchorOffset:u.anchorOffset,focusNode:u.focusNode,focusOffset:u.focusOffset}),Zl&&Ql(Zl,u)||(Zl=u,u=Ou(np,"onSelect"),0<u.length&&(a=new qc("onSelect","select",null,a,i),t.push({event:a,listeners:u}),a.target=Oo)))}function Ur(t,a){var i={};return i[t.toLowerCase()]=a.toLowerCase(),i["Webkit"+t]="webkit"+a,i["Moz"+t]="moz"+a,i}var zo={animationend:Ur("Animation","AnimationEnd"),animationiteration:Ur("Animation","AnimationIteration"),animationstart:Ur("Animation","AnimationStart"),transitionrun:Ur("Transition","TransitionRun"),transitionstart:Ur("Transition","TransitionStart"),transitioncancel:Ur("Transition","TransitionCancel"),transitionend:Ur("Transition","TransitionEnd")},sp={},j_={};ms&&(j_=document.createElement("div").style,"AnimationEvent"in window||(delete zo.animationend.animation,delete zo.animationiteration.animation,delete zo.animationstart.animation),"TransitionEvent"in window||delete zo.transitionend.transition);function Hr(t){if(sp[t])return sp[t];if(!zo[t])return t;var a=zo[t],i;for(i in a)if(a.hasOwnProperty(i)&&i in j_)return sp[t]=a[i];return t}var w_=Hr("animationend"),k_=Hr("animationiteration"),S_=Hr("animationstart"),_E=Hr("transitionrun"),vE=Hr("transitionstart"),yE=Hr("transitioncancel"),C_=Hr("transitionend"),E_=new Map,rp="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(" ");rp.push("scrollEnd");function Ba(t,a){E_.set(t,a),Ir(a,[t])}var Fc=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},ka=[],Do=0,op=0;function Yc(){for(var t=Do,a=op=Do=0;a<t;){var i=ka[a];ka[a++]=null;var u=ka[a];ka[a++]=null;var b=ka[a];ka[a++]=null;var y=ka[a];if(ka[a++]=null,u!==null&&b!==null){var M=u.pending;M===null?b.next=b:(b.next=M.next,M.next=b),u.pending=b}y!==0&&N_(i,b,y)}}function Xc(t,a,i,u){ka[Do++]=t,ka[Do++]=a,ka[Do++]=i,ka[Do++]=u,op|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function lp(t,a,i,u){return Xc(t,a,i,u),Kc(t)}function Vr(t,a){return Xc(t,null,null,a),Kc(t)}function N_(t,a,i){t.lanes|=i;var u=t.alternate;u!==null&&(u.lanes|=i);for(var b=!1,y=t.return;y!==null;)y.childLanes|=i,u=y.alternate,u!==null&&(u.childLanes|=i),y.tag===22&&(t=y.stateNode,t===null||t._visibility&1||(b=!0)),t=y,y=y.return;return t.tag===3?(y=t.stateNode,b&&a!==null&&(b=31-st(i),t=y.hiddenUpdates,u=t[b],u===null?t[b]=[a]:u.push(a),a.lane=i|536870912),y):null}function Kc(t){if(50<_i)throw _i=0,hm=null,Error(o(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var Lo={};function jE(t,a,i,u){this.tag=t,this.key=i,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=u,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fa(t,a,i,u){return new jE(t,a,i,u)}function ip(t){return t=t.prototype,!(!t||!t.isReactComponent)}function gs(t,a){var i=t.alternate;return i===null?(i=fa(t.tag,a,t.key,t.mode),i.elementType=t.elementType,i.type=t.type,i.stateNode=t.stateNode,i.alternate=t,t.alternate=i):(i.pendingProps=a,i.type=t.type,i.flags=0,i.subtreeFlags=0,i.deletions=null),i.flags=t.flags&65011712,i.childLanes=t.childLanes,i.lanes=t.lanes,i.child=t.child,i.memoizedProps=t.memoizedProps,i.memoizedState=t.memoizedState,i.updateQueue=t.updateQueue,a=t.dependencies,i.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},i.sibling=t.sibling,i.index=t.index,i.ref=t.ref,i.refCleanup=t.refCleanup,i}function R_(t,a){t.flags&=65011714;var i=t.alternate;return i===null?(t.childLanes=0,t.lanes=a,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=i.childLanes,t.lanes=i.lanes,t.child=i.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=i.memoizedProps,t.memoizedState=i.memoizedState,t.updateQueue=i.updateQueue,t.type=i.type,a=i.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function Qc(t,a,i,u,b,y){var M=0;if(u=t,typeof t=="function")ip(t)&&(M=1);else if(typeof t=="string")M=EN(t,i,J.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case B:return t=fa(31,i,a,b),t.elementType=B,t.lanes=y,t;case j:return qr(i.children,b,y,a);case w:M=8,b|=24;break;case C:return t=fa(12,i,a,b|2),t.elementType=C,t.lanes=y,t;case T:return t=fa(13,i,a,b),t.elementType=T,t.lanes=y,t;case O:return t=fa(19,i,a,b),t.elementType=O,t.lanes=y,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case N:M=10;break e;case E:M=9;break e;case R:M=11;break e;case A:M=14;break e;case z:M=16,u=null;break e}M=29,i=Error(o(130,t===null?"null":typeof t,"")),u=null}return a=fa(M,i,a,b),a.elementType=t,a.type=u,a.lanes=y,a}function qr(t,a,i,u){return t=fa(7,t,u,a),t.lanes=i,t}function cp(t,a,i){return t=fa(6,t,null,a),t.lanes=i,t}function T_(t){var a=fa(18,null,null,0);return a.stateNode=t,a}function up(t,a,i){return a=fa(4,t.children!==null?t.children:[],t.key,a),a.lanes=i,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var A_=new WeakMap;function Sa(t,a){if(typeof t=="object"&&t!==null){var i=A_.get(t);return i!==void 0?i:(a={value:t,source:a,stack:Ae(a)},A_.set(t,a),a)}return{value:t,source:a,stack:Ae(a)}}var Po=[],Io=0,Zc=null,Wl=0,Ca=[],Ea=0,Ys=null,Xa=1,Ka="";function hs(t,a){Po[Io++]=Wl,Po[Io++]=Zc,Zc=t,Wl=a}function M_(t,a,i){Ca[Ea++]=Xa,Ca[Ea++]=Ka,Ca[Ea++]=Ys,Ys=t;var u=Xa;t=Ka;var b=32-st(u)-1;u&=~(1<<b),i+=1;var y=32-st(a)+b;if(30<y){var M=b-b%5;y=(u&(1<<M)-1).toString(32),u>>=M,b-=M,Xa=1<<32-st(a)+b|i<<b|u,Ka=y+t}else Xa=1<<y|i<<b|u,Ka=t}function dp(t){t.return!==null&&(hs(t,1),M_(t,1,0))}function fp(t){for(;t===Zc;)Zc=Po[--Io],Po[Io]=null,Wl=Po[--Io],Po[Io]=null;for(;t===Ys;)Ys=Ca[--Ea],Ca[Ea]=null,Ka=Ca[--Ea],Ca[Ea]=null,Xa=Ca[--Ea],Ca[Ea]=null}function O_(t,a){Ca[Ea++]=Xa,Ca[Ea++]=Ka,Ca[Ea++]=Ys,Xa=a.id,Ka=a.overflow,Ys=t}var Sn=null,Yt=null,jt=!1,Xs=null,Na=!1,pp=Error(o(519));function Ks(t){var a=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Jl(Sa(a,t)),pp}function z_(t){var a=t.stateNode,i=t.type,u=t.memoizedProps;switch(a[At]=t,a[hn]=u,i){case"dialog":ht("cancel",a),ht("close",a);break;case"iframe":case"object":case"embed":ht("load",a);break;case"video":case"audio":for(i=0;i<yi.length;i++)ht(yi[i],a);break;case"source":ht("error",a);break;case"img":case"image":case"link":ht("error",a),ht("load",a);break;case"details":ht("toggle",a);break;case"input":ht("invalid",a),Yb(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":ht("invalid",a);break;case"textarea":ht("invalid",a),Kb(a,u.value,u.defaultValue,u.children)}i=u.children,typeof i!="string"&&typeof i!="number"&&typeof i!="bigint"||a.textContent===""+i||u.suppressHydrationWarning===!0||Zy(a.textContent,i)?(u.popover!=null&&(ht("beforetoggle",a),ht("toggle",a)),u.onScroll!=null&&ht("scroll",a),u.onScrollEnd!=null&&ht("scrollend",a),u.onClick!=null&&(a.onclick=ps),a=!0):a=!1,a||Ks(t,!0)}function D_(t){for(Sn=t.return;Sn;)switch(Sn.tag){case 5:case 31:case 13:Na=!1;return;case 27:case 3:Na=!0;return;default:Sn=Sn.return}}function Bo(t){if(t!==Sn)return!1;if(!jt)return D_(t),jt=!0,!1;var a=t.tag,i;if((i=a!==3&&a!==27)&&((i=a===5)&&(i=t.type,i=!(i!=="form"&&i!=="button")||Am(t.type,t.memoizedProps)),i=!i),i&&Yt&&Ks(t),D_(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(317));Yt=o0(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(317));Yt=o0(t)}else a===27?(a=Yt,cr(t.type)?(t=Lm,Lm=null,Yt=t):Yt=a):Yt=Sn?Ta(t.stateNode.nextSibling):null;return!0}function $r(){Yt=Sn=null,jt=!1}function mp(){var t=Xs;return t!==null&&(ta===null?ta=t:ta.push.apply(ta,t),Xs=null),t}function Jl(t){Xs===null?Xs=[t]:Xs.push(t)}var gp=U(null),Gr=null,xs=null;function Qs(t,a,i){F(gp,a._currentValue),a._currentValue=i}function bs(t){t._currentValue=gp.current,K(gp)}function hp(t,a,i){for(;t!==null;){var u=t.alternate;if((t.childLanes&a)!==a?(t.childLanes|=a,u!==null&&(u.childLanes|=a)):u!==null&&(u.childLanes&a)!==a&&(u.childLanes|=a),t===i)break;t=t.return}}function xp(t,a,i,u){var b=t.child;for(b!==null&&(b.return=t);b!==null;){var y=b.dependencies;if(y!==null){var M=b.child;y=y.firstContext;e:for(;y!==null;){var I=y;y=b;for(var Q=0;Q<a.length;Q++)if(I.context===a[Q]){y.lanes|=i,I=y.alternate,I!==null&&(I.lanes|=i),hp(y.return,i,t),u||(M=null);break e}y=I.next}}else if(b.tag===18){if(M=b.return,M===null)throw Error(o(341));M.lanes|=i,y=M.alternate,y!==null&&(y.lanes|=i),hp(M,i,t),M=null}else M=b.child;if(M!==null)M.return=b;else for(M=b;M!==null;){if(M===t){M=null;break}if(b=M.sibling,b!==null){b.return=M.return,M=b;break}M=M.return}b=M}}function Uo(t,a,i,u){t=null;for(var b=a,y=!1;b!==null;){if(!y){if((b.flags&524288)!==0)y=!0;else if((b.flags&262144)!==0)break}if(b.tag===10){var M=b.alternate;if(M===null)throw Error(o(387));if(M=M.memoizedProps,M!==null){var I=b.type;da(b.pendingProps.value,M.value)||(t!==null?t.push(I):t=[I])}}else if(b===oe.current){if(M=b.alternate,M===null)throw Error(o(387));M.memoizedState.memoizedState!==b.memoizedState.memoizedState&&(t!==null?t.push(Ci):t=[Ci])}b=b.return}t!==null&&xp(a,t,i,u),a.flags|=262144}function Wc(t){for(t=t.firstContext;t!==null;){if(!da(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Fr(t){Gr=t,xs=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Cn(t){return L_(Gr,t)}function Jc(t,a){return Gr===null&&Fr(t),L_(t,a)}function L_(t,a){var i=a._currentValue;if(a={context:a,memoizedValue:i,next:null},xs===null){if(t===null)throw Error(o(308));xs=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else xs=xs.next=a;return i}var wE=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(i,u){t.push(u)}};this.abort=function(){a.aborted=!0,t.forEach(function(i){return i()})}},kE=e.unstable_scheduleCallback,SE=e.unstable_NormalPriority,xn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bp(){return{controller:new wE,data:new Map,refCount:0}}function ei(t){t.refCount--,t.refCount===0&&kE(SE,function(){t.controller.abort()})}var ti=null,_p=0,Ho=0,Vo=null;function CE(t,a){if(ti===null){var i=ti=[];_p=0,Ho=jm(),Vo={status:"pending",value:void 0,then:function(u){i.push(u)}}}return _p++,a.then(P_,P_),a}function P_(){if(--_p===0&&ti!==null){Vo!==null&&(Vo.status="fulfilled");var t=ti;ti=null,Ho=0,Vo=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function EE(t,a){var i=[],u={status:"pending",value:null,reason:null,then:function(b){i.push(b)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var b=0;b<i.length;b++)(0,i[b])(a)},function(b){for(u.status="rejected",u.reason=b,b=0;b<i.length;b++)(0,i[b])(void 0)}),u}var I_=V.S;V.S=function(t,a){yy=ve(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&CE(t,a),I_!==null&&I_(t,a)};var Yr=U(null);function vp(){var t=Yr.current;return t!==null?t:qt.pooledCache}function eu(t,a){a===null?F(Yr,Yr.current):F(Yr,a.pool)}function B_(){var t=vp();return t===null?null:{parent:xn._currentValue,pool:t}}var qo=Error(o(460)),yp=Error(o(474)),tu=Error(o(542)),nu={then:function(){}};function U_(t){return t=t.status,t==="fulfilled"||t==="rejected"}function H_(t,a,i){switch(i=t[i],i===void 0?t.push(a):i!==a&&(a.then(ps,ps),a=i),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,q_(t),t;default:if(typeof a.status=="string")a.then(ps,ps);else{if(t=qt,t!==null&&100<t.shellSuspendCounter)throw Error(o(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var b=a;b.status="fulfilled",b.value=u}},function(u){if(a.status==="pending"){var b=a;b.status="rejected",b.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,q_(t),t}throw Kr=a,qo}}function Xr(t){try{var a=t._init;return a(t._payload)}catch(i){throw i!==null&&typeof i=="object"&&typeof i.then=="function"?(Kr=i,qo):i}}var Kr=null;function V_(){if(Kr===null)throw Error(o(459));var t=Kr;return Kr=null,t}function q_(t){if(t===qo||t===tu)throw Error(o(483))}var $o=null,ni=0;function au(t){var a=ni;return ni+=1,$o===null&&($o=[]),H_($o,t,a)}function ai(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function su(t,a){throw a.$$typeof===v?Error(o(525)):(t=Object.prototype.toString.call(a),Error(o(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function $_(t){function a(te,W){if(t){var ne=te.deletions;ne===null?(te.deletions=[W],te.flags|=16):ne.push(W)}}function i(te,W){if(!t)return null;for(;W!==null;)a(te,W),W=W.sibling;return null}function u(te){for(var W=new Map;te!==null;)te.key!==null?W.set(te.key,te):W.set(te.index,te),te=te.sibling;return W}function b(te,W){return te=gs(te,W),te.index=0,te.sibling=null,te}function y(te,W,ne){return te.index=ne,t?(ne=te.alternate,ne!==null?(ne=ne.index,ne<W?(te.flags|=67108866,W):ne):(te.flags|=67108866,W)):(te.flags|=1048576,W)}function M(te){return t&&te.alternate===null&&(te.flags|=67108866),te}function I(te,W,ne,he){return W===null||W.tag!==6?(W=cp(ne,te.mode,he),W.return=te,W):(W=b(W,ne),W.return=te,W)}function Q(te,W,ne,he){var Ke=ne.type;return Ke===j?fe(te,W,ne.props.children,he,ne.key):W!==null&&(W.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===z&&Xr(Ke)===W.type)?(W=b(W,ne.props),ai(W,ne),W.return=te,W):(W=Qc(ne.type,ne.key,ne.props,null,te.mode,he),ai(W,ne),W.return=te,W)}function ae(te,W,ne,he){return W===null||W.tag!==4||W.stateNode.containerInfo!==ne.containerInfo||W.stateNode.implementation!==ne.implementation?(W=up(ne,te.mode,he),W.return=te,W):(W=b(W,ne.children||[]),W.return=te,W)}function fe(te,W,ne,he,Ke){return W===null||W.tag!==7?(W=qr(ne,te.mode,he,Ke),W.return=te,W):(W=b(W,ne),W.return=te,W)}function xe(te,W,ne){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=cp(""+W,te.mode,ne),W.return=te,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case k:return ne=Qc(W.type,W.key,W.props,null,te.mode,ne),ai(ne,W),ne.return=te,ne;case S:return W=up(W,te.mode,ne),W.return=te,W;case z:return W=Xr(W),xe(te,W,ne)}if(Y(W)||P(W))return W=qr(W,te.mode,ne,null),W.return=te,W;if(typeof W.then=="function")return xe(te,au(W),ne);if(W.$$typeof===N)return xe(te,Jc(te,W),ne);su(te,W)}return null}function se(te,W,ne,he){var Ke=W!==null?W.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Ke!==null?null:I(te,W,""+ne,he);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case k:return ne.key===Ke?Q(te,W,ne,he):null;case S:return ne.key===Ke?ae(te,W,ne,he):null;case z:return ne=Xr(ne),se(te,W,ne,he)}if(Y(ne)||P(ne))return Ke!==null?null:fe(te,W,ne,he,null);if(typeof ne.then=="function")return se(te,W,au(ne),he);if(ne.$$typeof===N)return se(te,W,Jc(te,ne),he);su(te,ne)}return null}function ue(te,W,ne,he,Ke){if(typeof he=="string"&&he!==""||typeof he=="number"||typeof he=="bigint")return te=te.get(ne)||null,I(W,te,""+he,Ke);if(typeof he=="object"&&he!==null){switch(he.$$typeof){case k:return te=te.get(he.key===null?ne:he.key)||null,Q(W,te,he,Ke);case S:return te=te.get(he.key===null?ne:he.key)||null,ae(W,te,he,Ke);case z:return he=Xr(he),ue(te,W,ne,he,Ke)}if(Y(he)||P(he))return te=te.get(ne)||null,fe(W,te,he,Ke,null);if(typeof he.then=="function")return ue(te,W,ne,au(he),Ke);if(he.$$typeof===N)return ue(te,W,ne,Jc(W,he),Ke);su(W,he)}return null}function He(te,W,ne,he){for(var Ke=null,St=null,$e=W,ct=W=0,bt=null;$e!==null&&ct<ne.length;ct++){$e.index>ct?(bt=$e,$e=null):bt=$e.sibling;var Ct=se(te,$e,ne[ct],he);if(Ct===null){$e===null&&($e=bt);break}t&&$e&&Ct.alternate===null&&a(te,$e),W=y(Ct,W,ct),St===null?Ke=Ct:St.sibling=Ct,St=Ct,$e=bt}if(ct===ne.length)return i(te,$e),jt&&hs(te,ct),Ke;if($e===null){for(;ct<ne.length;ct++)$e=xe(te,ne[ct],he),$e!==null&&(W=y($e,W,ct),St===null?Ke=$e:St.sibling=$e,St=$e);return jt&&hs(te,ct),Ke}for($e=u($e);ct<ne.length;ct++)bt=ue($e,te,ct,ne[ct],he),bt!==null&&(t&&bt.alternate!==null&&$e.delete(bt.key===null?ct:bt.key),W=y(bt,W,ct),St===null?Ke=bt:St.sibling=bt,St=bt);return t&&$e.forEach(function(mr){return a(te,mr)}),jt&&hs(te,ct),Ke}function et(te,W,ne,he){if(ne==null)throw Error(o(151));for(var Ke=null,St=null,$e=W,ct=W=0,bt=null,Ct=ne.next();$e!==null&&!Ct.done;ct++,Ct=ne.next()){$e.index>ct?(bt=$e,$e=null):bt=$e.sibling;var mr=se(te,$e,Ct.value,he);if(mr===null){$e===null&&($e=bt);break}t&&$e&&mr.alternate===null&&a(te,$e),W=y(mr,W,ct),St===null?Ke=mr:St.sibling=mr,St=mr,$e=bt}if(Ct.done)return i(te,$e),jt&&hs(te,ct),Ke;if($e===null){for(;!Ct.done;ct++,Ct=ne.next())Ct=xe(te,Ct.value,he),Ct!==null&&(W=y(Ct,W,ct),St===null?Ke=Ct:St.sibling=Ct,St=Ct);return jt&&hs(te,ct),Ke}for($e=u($e);!Ct.done;ct++,Ct=ne.next())Ct=ue($e,te,ct,Ct.value,he),Ct!==null&&(t&&Ct.alternate!==null&&$e.delete(Ct.key===null?ct:Ct.key),W=y(Ct,W,ct),St===null?Ke=Ct:St.sibling=Ct,St=Ct);return t&&$e.forEach(function(IN){return a(te,IN)}),jt&&hs(te,ct),Ke}function It(te,W,ne,he){if(typeof ne=="object"&&ne!==null&&ne.type===j&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case k:e:{for(var Ke=ne.key;W!==null;){if(W.key===Ke){if(Ke=ne.type,Ke===j){if(W.tag===7){i(te,W.sibling),he=b(W,ne.props.children),he.return=te,te=he;break e}}else if(W.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===z&&Xr(Ke)===W.type){i(te,W.sibling),he=b(W,ne.props),ai(he,ne),he.return=te,te=he;break e}i(te,W);break}else a(te,W);W=W.sibling}ne.type===j?(he=qr(ne.props.children,te.mode,he,ne.key),he.return=te,te=he):(he=Qc(ne.type,ne.key,ne.props,null,te.mode,he),ai(he,ne),he.return=te,te=he)}return M(te);case S:e:{for(Ke=ne.key;W!==null;){if(W.key===Ke)if(W.tag===4&&W.stateNode.containerInfo===ne.containerInfo&&W.stateNode.implementation===ne.implementation){i(te,W.sibling),he=b(W,ne.children||[]),he.return=te,te=he;break e}else{i(te,W);break}else a(te,W);W=W.sibling}he=up(ne,te.mode,he),he.return=te,te=he}return M(te);case z:return ne=Xr(ne),It(te,W,ne,he)}if(Y(ne))return He(te,W,ne,he);if(P(ne)){if(Ke=P(ne),typeof Ke!="function")throw Error(o(150));return ne=Ke.call(ne),et(te,W,ne,he)}if(typeof ne.then=="function")return It(te,W,au(ne),he);if(ne.$$typeof===N)return It(te,W,Jc(te,ne),he);su(te,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,W!==null&&W.tag===6?(i(te,W.sibling),he=b(W,ne),he.return=te,te=he):(i(te,W),he=cp(ne,te.mode,he),he.return=te,te=he),M(te)):i(te,W)}return function(te,W,ne,he){try{ni=0;var Ke=It(te,W,ne,he);return $o=null,Ke}catch($e){if($e===qo||$e===tu)throw $e;var St=fa(29,$e,null,te.mode);return St.lanes=he,St.return=te,St}finally{}}}var Qr=$_(!0),G_=$_(!1),Zs=!1;function jp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function wp(t,a){t=t.updateQueue,a.updateQueue===t&&(a.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Ws(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Js(t,a,i){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(Nt&2)!==0){var b=u.pending;return b===null?a.next=a:(a.next=b.next,b.next=a),u.pending=a,a=Kc(t),N_(t,null,i),a}return Xc(t,u,a,i),Kc(t)}function si(t,a,i){if(a=a.updateQueue,a!==null&&(a=a.shared,(i&4194048)!==0)){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,ua(t,i)}}function kp(t,a){var i=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,i===u)){var b=null,y=null;if(i=i.firstBaseUpdate,i!==null){do{var M={lane:i.lane,tag:i.tag,payload:i.payload,callback:null,next:null};y===null?b=y=M:y=y.next=M,i=i.next}while(i!==null);y===null?b=y=a:y=y.next=a}else b=y=a;i={baseState:u.baseState,firstBaseUpdate:b,lastBaseUpdate:y,shared:u.shared,callbacks:u.callbacks},t.updateQueue=i;return}t=i.lastBaseUpdate,t===null?i.firstBaseUpdate=a:t.next=a,i.lastBaseUpdate=a}var Sp=!1;function ri(){if(Sp){var t=Vo;if(t!==null)throw t}}function oi(t,a,i,u){Sp=!1;var b=t.updateQueue;Zs=!1;var y=b.firstBaseUpdate,M=b.lastBaseUpdate,I=b.shared.pending;if(I!==null){b.shared.pending=null;var Q=I,ae=Q.next;Q.next=null,M===null?y=ae:M.next=ae,M=Q;var fe=t.alternate;fe!==null&&(fe=fe.updateQueue,I=fe.lastBaseUpdate,I!==M&&(I===null?fe.firstBaseUpdate=ae:I.next=ae,fe.lastBaseUpdate=Q))}if(y!==null){var xe=b.baseState;M=0,fe=ae=Q=null,I=y;do{var se=I.lane&-536870913,ue=se!==I.lane;if(ue?(xt&se)===se:(u&se)===se){se!==0&&se===Ho&&(Sp=!0),fe!==null&&(fe=fe.next={lane:0,tag:I.tag,payload:I.payload,callback:null,next:null});e:{var He=t,et=I;se=a;var It=i;switch(et.tag){case 1:if(He=et.payload,typeof He=="function"){xe=He.call(It,xe,se);break e}xe=He;break e;case 3:He.flags=He.flags&-65537|128;case 0:if(He=et.payload,se=typeof He=="function"?He.call(It,xe,se):He,se==null)break e;xe=_({},xe,se);break e;case 2:Zs=!0}}se=I.callback,se!==null&&(t.flags|=64,ue&&(t.flags|=8192),ue=b.callbacks,ue===null?b.callbacks=[se]:ue.push(se))}else ue={lane:se,tag:I.tag,payload:I.payload,callback:I.callback,next:null},fe===null?(ae=fe=ue,Q=xe):fe=fe.next=ue,M|=se;if(I=I.next,I===null){if(I=b.shared.pending,I===null)break;ue=I,I=ue.next,ue.next=null,b.lastBaseUpdate=ue,b.shared.pending=null}}while(!0);fe===null&&(Q=xe),b.baseState=Q,b.firstBaseUpdate=ae,b.lastBaseUpdate=fe,y===null&&(b.shared.lanes=0),sr|=M,t.lanes=M,t.memoizedState=xe}}function F_(t,a){if(typeof t!="function")throw Error(o(191,t));t.call(a)}function Y_(t,a){var i=t.callbacks;if(i!==null)for(t.callbacks=null,t=0;t<i.length;t++)F_(i[t],a)}var Go=U(null),ru=U(0);function X_(t,a){t=Es,F(ru,t),F(Go,a),Es=t|a.baseLanes}function Cp(){F(ru,Es),F(Go,Go.current)}function Ep(){Es=ru.current,K(Go),K(ru)}var pa=U(null),Ra=null;function er(t){var a=t.alternate;F(fn,fn.current&1),F(pa,t),Ra===null&&(a===null||Go.current!==null||a.memoizedState!==null)&&(Ra=t)}function Np(t){F(fn,fn.current),F(pa,t),Ra===null&&(Ra=t)}function K_(t){t.tag===22?(F(fn,fn.current),F(pa,t),Ra===null&&(Ra=t)):tr()}function tr(){F(fn,fn.current),F(pa,pa.current)}function ma(t){K(pa),Ra===t&&(Ra=null),K(fn)}var fn=U(0);function ou(t){for(var a=t;a!==null;){if(a.tag===13){var i=a.memoizedState;if(i!==null&&(i=i.dehydrated,i===null||zm(i)||Dm(i)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var _s=0,ot=null,Lt=null,bn=null,lu=!1,Fo=!1,Zr=!1,iu=0,li=0,Yo=null,NE=0;function on(){throw Error(o(321))}function Rp(t,a){if(a===null)return!1;for(var i=0;i<a.length&&i<t.length;i++)if(!da(t[i],a[i]))return!1;return!0}function Tp(t,a,i,u,b,y){return _s=y,ot=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,V.H=t===null||t.memoizedState===null?Mv:Gp,Zr=!1,y=i(u,b),Zr=!1,Fo&&(y=Z_(a,i,u,b)),Q_(t),y}function Q_(t){V.H=ui;var a=Lt!==null&&Lt.next!==null;if(_s=0,bn=Lt=ot=null,lu=!1,li=0,Yo=null,a)throw Error(o(300));t===null||_n||(t=t.dependencies,t!==null&&Wc(t)&&(_n=!0))}function Z_(t,a,i,u){ot=t;var b=0;do{if(Fo&&(Yo=null),li=0,Fo=!1,25<=b)throw Error(o(301));if(b+=1,bn=Lt=null,t.updateQueue!=null){var y=t.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}V.H=Ov,y=a(i,u)}while(Fo);return y}function RE(){var t=V.H,a=t.useState()[0];return a=typeof a.then=="function"?ii(a):a,t=t.useState()[0],(Lt!==null?Lt.memoizedState:null)!==t&&(ot.flags|=1024),a}function Ap(){var t=iu!==0;return iu=0,t}function Mp(t,a,i){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~i}function Op(t){if(lu){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}lu=!1}_s=0,bn=Lt=ot=null,Fo=!1,li=iu=0,Yo=null}function qn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return bn===null?ot.memoizedState=bn=t:bn=bn.next=t,bn}function pn(){if(Lt===null){var t=ot.alternate;t=t!==null?t.memoizedState:null}else t=Lt.next;var a=bn===null?ot.memoizedState:bn.next;if(a!==null)bn=a,Lt=t;else{if(t===null)throw ot.alternate===null?Error(o(467)):Error(o(310));Lt=t,t={memoizedState:Lt.memoizedState,baseState:Lt.baseState,baseQueue:Lt.baseQueue,queue:Lt.queue,next:null},bn===null?ot.memoizedState=bn=t:bn=bn.next=t}return bn}function cu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ii(t){var a=li;return li+=1,Yo===null&&(Yo=[]),t=H_(Yo,t,a),a=ot,(bn===null?a.memoizedState:bn.next)===null&&(a=a.alternate,V.H=a===null||a.memoizedState===null?Mv:Gp),t}function uu(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return ii(t);if(t.$$typeof===N)return Cn(t)}throw Error(o(438,String(t)))}function zp(t){var a=null,i=ot.updateQueue;if(i!==null&&(a=i.memoCache),a==null){var u=ot.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(b){return b.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),i===null&&(i=cu(),ot.updateQueue=i),i.memoCache=a,i=a.data[a.index],i===void 0)for(i=a.data[a.index]=Array(t),u=0;u<t;u++)i[u]=L;return a.index++,i}function vs(t,a){return typeof a=="function"?a(t):a}function du(t){var a=pn();return Dp(a,Lt,t)}function Dp(t,a,i){var u=t.queue;if(u===null)throw Error(o(311));u.lastRenderedReducer=i;var b=t.baseQueue,y=u.pending;if(y!==null){if(b!==null){var M=b.next;b.next=y.next,y.next=M}a.baseQueue=b=y,u.pending=null}if(y=t.baseState,b===null)t.memoizedState=y;else{a=b.next;var I=M=null,Q=null,ae=a,fe=!1;do{var xe=ae.lane&-536870913;if(xe!==ae.lane?(xt&xe)===xe:(_s&xe)===xe){var se=ae.revertLane;if(se===0)Q!==null&&(Q=Q.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),xe===Ho&&(fe=!0);else if((_s&se)===se){ae=ae.next,se===Ho&&(fe=!0);continue}else xe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(I=Q=xe,M=y):Q=Q.next=xe,ot.lanes|=se,sr|=se;xe=ae.action,Zr&&i(y,xe),y=ae.hasEagerState?ae.eagerState:i(y,xe)}else se={lane:xe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},Q===null?(I=Q=se,M=y):Q=Q.next=se,ot.lanes|=xe,sr|=xe;ae=ae.next}while(ae!==null&&ae!==a);if(Q===null?M=y:Q.next=I,!da(y,t.memoizedState)&&(_n=!0,fe&&(i=Vo,i!==null)))throw i;t.memoizedState=y,t.baseState=M,t.baseQueue=Q,u.lastRenderedState=y}return b===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function Lp(t){var a=pn(),i=a.queue;if(i===null)throw Error(o(311));i.lastRenderedReducer=t;var u=i.dispatch,b=i.pending,y=a.memoizedState;if(b!==null){i.pending=null;var M=b=b.next;do y=t(y,M.action),M=M.next;while(M!==b);da(y,a.memoizedState)||(_n=!0),a.memoizedState=y,a.baseQueue===null&&(a.baseState=y),i.lastRenderedState=y}return[y,u]}function W_(t,a,i){var u=ot,b=pn(),y=jt;if(y){if(i===void 0)throw Error(o(407));i=i()}else i=a();var M=!da((Lt||b).memoizedState,i);if(M&&(b.memoizedState=i,_n=!0),b=b.queue,Bp(tv.bind(null,u,b,t),[t]),b.getSnapshot!==a||M||bn!==null&&bn.memoizedState.tag&1){if(u.flags|=2048,Xo(9,{destroy:void 0},ev.bind(null,u,b,i,a),null),qt===null)throw Error(o(349));y||(_s&127)!==0||J_(u,a,i)}return i}function J_(t,a,i){t.flags|=16384,t={getSnapshot:a,value:i},a=ot.updateQueue,a===null?(a=cu(),ot.updateQueue=a,a.stores=[t]):(i=a.stores,i===null?a.stores=[t]:i.push(t))}function ev(t,a,i,u){a.value=i,a.getSnapshot=u,nv(a)&&av(t)}function tv(t,a,i){return i(function(){nv(a)&&av(t)})}function nv(t){var a=t.getSnapshot;t=t.value;try{var i=a();return!da(t,i)}catch{return!0}}function av(t){var a=Vr(t,2);a!==null&&na(a,t,2)}function Pp(t){var a=qn();if(typeof t=="function"){var i=t;if(t=i(),Zr){qe(!0);try{i()}finally{qe(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:t},a}function sv(t,a,i,u){return t.baseState=i,Dp(t,Lt,typeof u=="function"?u:vs)}function TE(t,a,i,u,b){if(mu(t))throw Error(o(485));if(t=a.action,t!==null){var y={payload:b,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(M){y.listeners.push(M)}};V.T!==null?i(!0):y.isTransition=!1,u(y),i=a.pending,i===null?(y.next=a.pending=y,rv(a,y)):(y.next=i.next,a.pending=i.next=y)}}function rv(t,a){var i=a.action,u=a.payload,b=t.state;if(a.isTransition){var y=V.T,M={};V.T=M;try{var I=i(b,u),Q=V.S;Q!==null&&Q(M,I),ov(t,a,I)}catch(ae){Ip(t,a,ae)}finally{y!==null&&M.types!==null&&(y.types=M.types),V.T=y}}else try{y=i(b,u),ov(t,a,y)}catch(ae){Ip(t,a,ae)}}function ov(t,a,i){i!==null&&typeof i=="object"&&typeof i.then=="function"?i.then(function(u){lv(t,a,u)},function(u){return Ip(t,a,u)}):lv(t,a,i)}function lv(t,a,i){a.status="fulfilled",a.value=i,iv(a),t.state=i,a=t.pending,a!==null&&(i=a.next,i===a?t.pending=null:(i=i.next,a.next=i,rv(t,i)))}function Ip(t,a,i){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=i,iv(a),a=a.next;while(a!==u)}t.action=null}function iv(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function cv(t,a){return a}function uv(t,a){if(jt){var i=qt.formState;if(i!==null){e:{var u=ot;if(jt){if(Yt){t:{for(var b=Yt,y=Na;b.nodeType!==8;){if(!y){b=null;break t}if(b=Ta(b.nextSibling),b===null){b=null;break t}}y=b.data,b=y==="F!"||y==="F"?b:null}if(b){Yt=Ta(b.nextSibling),u=b.data==="F!";break e}}Ks(u)}u=!1}u&&(a=i[0])}}return i=qn(),i.memoizedState=i.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:cv,lastRenderedState:a},i.queue=u,i=Rv.bind(null,ot,u),u.dispatch=i,u=Pp(!1),y=$p.bind(null,ot,!1,u.queue),u=qn(),b={state:a,dispatch:null,action:t,pending:null},u.queue=b,i=TE.bind(null,ot,b,y,i),b.dispatch=i,u.memoizedState=t,[a,i,!1]}function dv(t){var a=pn();return fv(a,Lt,t)}function fv(t,a,i){if(a=Dp(t,a,cv)[0],t=du(vs)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=ii(a)}catch(M){throw M===qo?tu:M}else u=a;a=pn();var b=a.queue,y=b.dispatch;return i!==a.memoizedState&&(ot.flags|=2048,Xo(9,{destroy:void 0},AE.bind(null,b,i),null)),[u,y,t]}function AE(t,a){t.action=a}function pv(t){var a=pn(),i=Lt;if(i!==null)return fv(a,i,t);pn(),a=a.memoizedState,i=pn();var u=i.queue.dispatch;return i.memoizedState=t,[a,u,!1]}function Xo(t,a,i,u){return t={tag:t,create:i,deps:u,inst:a,next:null},a=ot.updateQueue,a===null&&(a=cu(),ot.updateQueue=a),i=a.lastEffect,i===null?a.lastEffect=t.next=t:(u=i.next,i.next=t,t.next=u,a.lastEffect=t),t}function mv(){return pn().memoizedState}function fu(t,a,i,u){var b=qn();ot.flags|=t,b.memoizedState=Xo(1|a,{destroy:void 0},i,u===void 0?null:u)}function pu(t,a,i,u){var b=pn();u=u===void 0?null:u;var y=b.memoizedState.inst;Lt!==null&&u!==null&&Rp(u,Lt.memoizedState.deps)?b.memoizedState=Xo(a,y,i,u):(ot.flags|=t,b.memoizedState=Xo(1|a,y,i,u))}function gv(t,a){fu(8390656,8,t,a)}function Bp(t,a){pu(2048,8,t,a)}function ME(t){ot.flags|=4;var a=ot.updateQueue;if(a===null)a=cu(),ot.updateQueue=a,a.events=[t];else{var i=a.events;i===null?a.events=[t]:i.push(t)}}function hv(t){var a=pn().memoizedState;return ME({ref:a,nextImpl:t}),function(){if((Nt&2)!==0)throw Error(o(440));return a.impl.apply(void 0,arguments)}}function xv(t,a){return pu(4,2,t,a)}function bv(t,a){return pu(4,4,t,a)}function _v(t,a){if(typeof a=="function"){t=t();var i=a(t);return function(){typeof i=="function"?i():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function vv(t,a,i){i=i!=null?i.concat([t]):null,pu(4,4,_v.bind(null,a,t),i)}function Up(){}function yv(t,a){var i=pn();a=a===void 0?null:a;var u=i.memoizedState;return a!==null&&Rp(a,u[1])?u[0]:(i.memoizedState=[t,a],t)}function jv(t,a){var i=pn();a=a===void 0?null:a;var u=i.memoizedState;if(a!==null&&Rp(a,u[1]))return u[0];if(u=t(),Zr){qe(!0);try{t()}finally{qe(!1)}}return i.memoizedState=[u,a],u}function Hp(t,a,i){return i===void 0||(_s&1073741824)!==0&&(xt&261930)===0?t.memoizedState=a:(t.memoizedState=i,t=wy(),ot.lanes|=t,sr|=t,i)}function wv(t,a,i,u){return da(i,a)?i:Go.current!==null?(t=Hp(t,i,u),da(t,a)||(_n=!0),t):(_s&42)===0||(_s&1073741824)!==0&&(xt&261930)===0?(_n=!0,t.memoizedState=i):(t=wy(),ot.lanes|=t,sr|=t,a)}function kv(t,a,i,u,b){var y=$.p;$.p=y!==0&&8>y?y:8;var M=V.T,I={};V.T=I,$p(t,!1,a,i);try{var Q=b(),ae=V.S;if(ae!==null&&ae(I,Q),Q!==null&&typeof Q=="object"&&typeof Q.then=="function"){var fe=EE(Q,u);ci(t,a,fe,xa(t))}else ci(t,a,u,xa(t))}catch(xe){ci(t,a,{then:function(){},status:"rejected",reason:xe},xa())}finally{$.p=y,M!==null&&I.types!==null&&(M.types=I.types),V.T=M}}function OE(){}function Vp(t,a,i,u){if(t.tag!==5)throw Error(o(476));var b=Sv(t).queue;kv(t,b,a,Z,i===null?OE:function(){return Cv(t),i(u)})}function Sv(t){var a=t.memoizedState;if(a!==null)return a;a={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:Z},next:null};var i={};return a.next={memoizedState:i,baseState:i,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:vs,lastRenderedState:i},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function Cv(t){var a=Sv(t);a.next===null&&(a=t.alternate.memoizedState),ci(t,a.next.queue,{},xa())}function qp(){return Cn(Ci)}function Ev(){return pn().memoizedState}function Nv(){return pn().memoizedState}function zE(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var i=xa();t=Ws(i);var u=Js(a,t,i);u!==null&&(na(u,a,i),si(u,a,i)),a={cache:bp()},t.payload=a;return}a=a.return}}function DE(t,a,i){var u=xa();i={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},mu(t)?Tv(a,i):(i=lp(t,a,i,u),i!==null&&(na(i,t,u),Av(i,a,u)))}function Rv(t,a,i){var u=xa();ci(t,a,i,u)}function ci(t,a,i,u){var b={lane:u,revertLane:0,gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null};if(mu(t))Tv(a,b);else{var y=t.alternate;if(t.lanes===0&&(y===null||y.lanes===0)&&(y=a.lastRenderedReducer,y!==null))try{var M=a.lastRenderedState,I=y(M,i);if(b.hasEagerState=!0,b.eagerState=I,da(I,M))return Xc(t,a,b,0),qt===null&&Yc(),!1}catch{}finally{}if(i=lp(t,a,b,u),i!==null)return na(i,t,u),Av(i,a,u),!0}return!1}function $p(t,a,i,u){if(u={lane:2,revertLane:jm(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},mu(t)){if(a)throw Error(o(479))}else a=lp(t,i,u,2),a!==null&&na(a,t,2)}function mu(t){var a=t.alternate;return t===ot||a!==null&&a===ot}function Tv(t,a){Fo=lu=!0;var i=t.pending;i===null?a.next=a:(a.next=i.next,i.next=a),t.pending=a}function Av(t,a,i){if((i&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,i|=u,a.lanes=i,ua(t,i)}}var ui={readContext:Cn,use:uu,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useLayoutEffect:on,useInsertionEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useSyncExternalStore:on,useId:on,useHostTransitionStatus:on,useFormState:on,useActionState:on,useOptimistic:on,useMemoCache:on,useCacheRefresh:on};ui.useEffectEvent=on;var Mv={readContext:Cn,use:uu,useCallback:function(t,a){return qn().memoizedState=[t,a===void 0?null:a],t},useContext:Cn,useEffect:gv,useImperativeHandle:function(t,a,i){i=i!=null?i.concat([t]):null,fu(4194308,4,_v.bind(null,a,t),i)},useLayoutEffect:function(t,a){return fu(4194308,4,t,a)},useInsertionEffect:function(t,a){fu(4,2,t,a)},useMemo:function(t,a){var i=qn();a=a===void 0?null:a;var u=t();if(Zr){qe(!0);try{t()}finally{qe(!1)}}return i.memoizedState=[u,a],u},useReducer:function(t,a,i){var u=qn();if(i!==void 0){var b=i(a);if(Zr){qe(!0);try{i(a)}finally{qe(!1)}}}else b=a;return u.memoizedState=u.baseState=b,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:b},u.queue=t,t=t.dispatch=DE.bind(null,ot,t),[u.memoizedState,t]},useRef:function(t){var a=qn();return t={current:t},a.memoizedState=t},useState:function(t){t=Pp(t);var a=t.queue,i=Rv.bind(null,ot,a);return a.dispatch=i,[t.memoizedState,i]},useDebugValue:Up,useDeferredValue:function(t,a){var i=qn();return Hp(i,t,a)},useTransition:function(){var t=Pp(!1);return t=kv.bind(null,ot,t.queue,!0,!1),qn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,i){var u=ot,b=qn();if(jt){if(i===void 0)throw Error(o(407));i=i()}else{if(i=a(),qt===null)throw Error(o(349));(xt&127)!==0||J_(u,a,i)}b.memoizedState=i;var y={value:i,getSnapshot:a};return b.queue=y,gv(tv.bind(null,u,y,t),[t]),u.flags|=2048,Xo(9,{destroy:void 0},ev.bind(null,u,y,i,a),null),i},useId:function(){var t=qn(),a=qt.identifierPrefix;if(jt){var i=Ka,u=Xa;i=(u&~(1<<32-st(u)-1)).toString(32)+i,a="_"+a+"R_"+i,i=iu++,0<i&&(a+="H"+i.toString(32)),a+="_"}else i=NE++,a="_"+a+"r_"+i.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:qp,useFormState:uv,useActionState:uv,useOptimistic:function(t){var a=qn();a.memoizedState=a.baseState=t;var i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=i,a=$p.bind(null,ot,!0,i),i.dispatch=a,[t,a]},useMemoCache:zp,useCacheRefresh:function(){return qn().memoizedState=zE.bind(null,ot)},useEffectEvent:function(t){var a=qn(),i={impl:t};return a.memoizedState=i,function(){if((Nt&2)!==0)throw Error(o(440));return i.impl.apply(void 0,arguments)}}},Gp={readContext:Cn,use:uu,useCallback:yv,useContext:Cn,useEffect:Bp,useImperativeHandle:vv,useInsertionEffect:xv,useLayoutEffect:bv,useMemo:jv,useReducer:du,useRef:mv,useState:function(){return du(vs)},useDebugValue:Up,useDeferredValue:function(t,a){var i=pn();return wv(i,Lt.memoizedState,t,a)},useTransition:function(){var t=du(vs)[0],a=pn().memoizedState;return[typeof t=="boolean"?t:ii(t),a]},useSyncExternalStore:W_,useId:Ev,useHostTransitionStatus:qp,useFormState:dv,useActionState:dv,useOptimistic:function(t,a){var i=pn();return sv(i,Lt,t,a)},useMemoCache:zp,useCacheRefresh:Nv};Gp.useEffectEvent=hv;var Ov={readContext:Cn,use:uu,useCallback:yv,useContext:Cn,useEffect:Bp,useImperativeHandle:vv,useInsertionEffect:xv,useLayoutEffect:bv,useMemo:jv,useReducer:Lp,useRef:mv,useState:function(){return Lp(vs)},useDebugValue:Up,useDeferredValue:function(t,a){var i=pn();return Lt===null?Hp(i,t,a):wv(i,Lt.memoizedState,t,a)},useTransition:function(){var t=Lp(vs)[0],a=pn().memoizedState;return[typeof t=="boolean"?t:ii(t),a]},useSyncExternalStore:W_,useId:Ev,useHostTransitionStatus:qp,useFormState:pv,useActionState:pv,useOptimistic:function(t,a){var i=pn();return Lt!==null?sv(i,Lt,t,a):(i.baseState=t,[t,i.queue.dispatch])},useMemoCache:zp,useCacheRefresh:Nv};Ov.useEffectEvent=hv;function Fp(t,a,i,u){a=t.memoizedState,i=i(u,a),i=i==null?a:_({},a,i),t.memoizedState=i,t.lanes===0&&(t.updateQueue.baseState=i)}var Yp={enqueueSetState:function(t,a,i){t=t._reactInternals;var u=xa(),b=Ws(u);b.payload=a,i!=null&&(b.callback=i),a=Js(t,b,u),a!==null&&(na(a,t,u),si(a,t,u))},enqueueReplaceState:function(t,a,i){t=t._reactInternals;var u=xa(),b=Ws(u);b.tag=1,b.payload=a,i!=null&&(b.callback=i),a=Js(t,b,u),a!==null&&(na(a,t,u),si(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var i=xa(),u=Ws(i);u.tag=2,a!=null&&(u.callback=a),a=Js(t,u,i),a!==null&&(na(a,t,i),si(a,t,i))}};function zv(t,a,i,u,b,y,M){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,y,M):a.prototype&&a.prototype.isPureReactComponent?!Ql(i,u)||!Ql(b,y):!0}function Dv(t,a,i,u){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(i,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(i,u),a.state!==t&&Yp.enqueueReplaceState(a,a.state,null)}function Wr(t,a){var i=a;if("ref"in a){i={};for(var u in a)u!=="ref"&&(i[u]=a[u])}if(t=t.defaultProps){i===a&&(i=_({},i));for(var b in t)i[b]===void 0&&(i[b]=t[b])}return i}function Lv(t){Fc(t)}function Pv(t){console.error(t)}function Iv(t){Fc(t)}function gu(t,a){try{var i=t.onUncaughtError;i(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function Bv(t,a,i){try{var u=t.onCaughtError;u(i.value,{componentStack:i.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(b){setTimeout(function(){throw b})}}function Xp(t,a,i){return i=Ws(i),i.tag=3,i.payload={element:null},i.callback=function(){gu(t,a)},i}function Uv(t){return t=Ws(t),t.tag=3,t}function Hv(t,a,i,u){var b=i.type.getDerivedStateFromError;if(typeof b=="function"){var y=u.value;t.payload=function(){return b(y)},t.callback=function(){Bv(a,i,u)}}var M=i.stateNode;M!==null&&typeof M.componentDidCatch=="function"&&(t.callback=function(){Bv(a,i,u),typeof b!="function"&&(rr===null?rr=new Set([this]):rr.add(this));var I=u.stack;this.componentDidCatch(u.value,{componentStack:I!==null?I:""})})}function LE(t,a,i,u,b){if(i.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=i.alternate,a!==null&&Uo(a,i,b,!0),i=pa.current,i!==null){switch(i.tag){case 31:case 13:return Ra===null?Eu():i.alternate===null&&ln===0&&(ln=3),i.flags&=-257,i.flags|=65536,i.lanes=b,u===nu?i.flags|=16384:(a=i.updateQueue,a===null?i.updateQueue=new Set([u]):a.add(u),_m(t,u,b)),!1;case 22:return i.flags|=65536,u===nu?i.flags|=16384:(a=i.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},i.updateQueue=a):(i=a.retryQueue,i===null?a.retryQueue=new Set([u]):i.add(u)),_m(t,u,b)),!1}throw Error(o(435,i.tag))}return _m(t,u,b),Eu(),!1}if(jt)return a=pa.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=b,u!==pp&&(t=Error(o(422),{cause:u}),Jl(Sa(t,i)))):(u!==pp&&(a=Error(o(423),{cause:u}),Jl(Sa(a,i))),t=t.current.alternate,t.flags|=65536,b&=-b,t.lanes|=b,u=Sa(u,i),b=Xp(t.stateNode,u,b),kp(t,b),ln!==4&&(ln=2)),!1;var y=Error(o(520),{cause:u});if(y=Sa(y,i),bi===null?bi=[y]:bi.push(y),ln!==4&&(ln=2),a===null)return!0;u=Sa(u,i),i=a;do{switch(i.tag){case 3:return i.flags|=65536,t=b&-b,i.lanes|=t,t=Xp(i.stateNode,u,t),kp(i,t),!1;case 1:if(a=i.type,y=i.stateNode,(i.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(rr===null||!rr.has(y))))return i.flags|=65536,b&=-b,i.lanes|=b,b=Uv(b),Hv(b,t,i,u),kp(i,b),!1}i=i.return}while(i!==null);return!1}var Kp=Error(o(461)),_n=!1;function En(t,a,i,u){a.child=t===null?G_(a,null,i,u):Qr(a,t.child,i,u)}function Vv(t,a,i,u,b){i=i.render;var y=a.ref;if("ref"in u){var M={};for(var I in u)I!=="ref"&&(M[I]=u[I])}else M=u;return Fr(a),u=Tp(t,a,i,M,y,b),I=Ap(),t!==null&&!_n?(Mp(t,a,b),ys(t,a,b)):(jt&&I&&dp(a),a.flags|=1,En(t,a,u,b),a.child)}function qv(t,a,i,u,b){if(t===null){var y=i.type;return typeof y=="function"&&!ip(y)&&y.defaultProps===void 0&&i.compare===null?(a.tag=15,a.type=y,$v(t,a,y,u,b)):(t=Qc(i.type,null,u,a,a.mode,b),t.ref=a.ref,t.return=a,a.child=t)}if(y=t.child,!am(t,b)){var M=y.memoizedProps;if(i=i.compare,i=i!==null?i:Ql,i(M,u)&&t.ref===a.ref)return ys(t,a,b)}return a.flags|=1,t=gs(y,u),t.ref=a.ref,t.return=a,a.child=t}function $v(t,a,i,u,b){if(t!==null){var y=t.memoizedProps;if(Ql(y,u)&&t.ref===a.ref)if(_n=!1,a.pendingProps=u=y,am(t,b))(t.flags&131072)!==0&&(_n=!0);else return a.lanes=t.lanes,ys(t,a,b)}return Qp(t,a,i,u,b)}function Gv(t,a,i,u){var b=u.children,y=t!==null?t.memoizedState:null;if(t===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),u.mode==="hidden"){if((a.flags&128)!==0){if(y=y!==null?y.baseLanes|i:i,t!==null){for(u=a.child=t.child,b=0;u!==null;)b=b|u.lanes|u.childLanes,u=u.sibling;u=b&~y}else u=0,a.child=null;return Fv(t,a,y,i,u)}if((i&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&eu(a,y!==null?y.cachePool:null),y!==null?X_(a,y):Cp(),K_(a);else return u=a.lanes=536870912,Fv(t,a,y!==null?y.baseLanes|i:i,i,u)}else y!==null?(eu(a,y.cachePool),X_(a,y),tr(),a.memoizedState=null):(t!==null&&eu(a,null),Cp(),tr());return En(t,a,b,i),a.child}function di(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Fv(t,a,i,u,b){var y=vp();return y=y===null?null:{parent:xn._currentValue,pool:y},a.memoizedState={baseLanes:i,cachePool:y},t!==null&&eu(a,null),Cp(),K_(a),t!==null&&Uo(t,a,u,!0),a.childLanes=b,null}function hu(t,a){return a=bu({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function Yv(t,a,i){return Qr(a,t.child,null,i),t=hu(a,a.pendingProps),t.flags|=2,ma(a),a.memoizedState=null,t}function PE(t,a,i){var u=a.pendingProps,b=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(jt){if(u.mode==="hidden")return t=hu(a,u),a.lanes=536870912,di(null,t);if(Np(a),(t=Yt)?(t=r0(t,Na),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Ys!==null?{id:Xa,overflow:Ka}:null,retryLane:536870912,hydrationErrors:null},i=T_(t),i.return=a,a.child=i,Sn=a,Yt=null)):t=null,t===null)throw Ks(a);return a.lanes=536870912,null}return hu(a,u)}var y=t.memoizedState;if(y!==null){var M=y.dehydrated;if(Np(a),b)if(a.flags&256)a.flags&=-257,a=Yv(t,a,i);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(o(558));else if(_n||Uo(t,a,i,!1),b=(i&t.childLanes)!==0,_n||b){if(u=qt,u!==null&&(M=Ia(u,i),M!==0&&M!==y.retryLane))throw y.retryLane=M,Vr(t,M),na(u,t,M),Kp;Eu(),a=Yv(t,a,i)}else t=y.treeContext,Yt=Ta(M.nextSibling),Sn=a,jt=!0,Xs=null,Na=!1,t!==null&&O_(a,t),a=hu(a,u),a.flags|=4096;return a}return t=gs(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function xu(t,a){var i=a.ref;if(i===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof i!="function"&&typeof i!="object")throw Error(o(284));(t===null||t.ref!==i)&&(a.flags|=4194816)}}function Qp(t,a,i,u,b){return Fr(a),i=Tp(t,a,i,u,void 0,b),u=Ap(),t!==null&&!_n?(Mp(t,a,b),ys(t,a,b)):(jt&&u&&dp(a),a.flags|=1,En(t,a,i,b),a.child)}function Xv(t,a,i,u,b,y){return Fr(a),a.updateQueue=null,i=Z_(a,u,i,b),Q_(t),u=Ap(),t!==null&&!_n?(Mp(t,a,y),ys(t,a,y)):(jt&&u&&dp(a),a.flags|=1,En(t,a,i,y),a.child)}function Kv(t,a,i,u,b){if(Fr(a),a.stateNode===null){var y=Lo,M=i.contextType;typeof M=="object"&&M!==null&&(y=Cn(M)),y=new i(u,y),a.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Yp,a.stateNode=y,y._reactInternals=a,y=a.stateNode,y.props=u,y.state=a.memoizedState,y.refs={},jp(a),M=i.contextType,y.context=typeof M=="object"&&M!==null?Cn(M):Lo,y.state=a.memoizedState,M=i.getDerivedStateFromProps,typeof M=="function"&&(Fp(a,i,M,u),y.state=a.memoizedState),typeof i.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(M=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),M!==y.state&&Yp.enqueueReplaceState(y,y.state,null),oi(a,u,y,b),ri(),y.state=a.memoizedState),typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){y=a.stateNode;var I=a.memoizedProps,Q=Wr(i,I);y.props=Q;var ae=y.context,fe=i.contextType;M=Lo,typeof fe=="object"&&fe!==null&&(M=Cn(fe));var xe=i.getDerivedStateFromProps;fe=typeof xe=="function"||typeof y.getSnapshotBeforeUpdate=="function",I=a.pendingProps!==I,fe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(I||ae!==M)&&Dv(a,y,u,M),Zs=!1;var se=a.memoizedState;y.state=se,oi(a,u,y,b),ri(),ae=a.memoizedState,I||se!==ae||Zs?(typeof xe=="function"&&(Fp(a,i,xe,u),ae=a.memoizedState),(Q=Zs||zv(a,i,Q,u,se,ae,M))?(fe||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(a.flags|=4194308)):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=ae),y.props=u,y.state=ae,y.context=M,u=Q):(typeof y.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{y=a.stateNode,wp(t,a),M=a.memoizedProps,fe=Wr(i,M),y.props=fe,xe=a.pendingProps,se=y.context,ae=i.contextType,Q=Lo,typeof ae=="object"&&ae!==null&&(Q=Cn(ae)),I=i.getDerivedStateFromProps,(ae=typeof I=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(M!==xe||se!==Q)&&Dv(a,y,u,Q),Zs=!1,se=a.memoizedState,y.state=se,oi(a,u,y,b),ri();var ue=a.memoizedState;M!==xe||se!==ue||Zs||t!==null&&t.dependencies!==null&&Wc(t.dependencies)?(typeof I=="function"&&(Fp(a,i,I,u),ue=a.memoizedState),(fe=Zs||zv(a,i,fe,u,se,ue,Q)||t!==null&&t.dependencies!==null&&Wc(t.dependencies))?(ae||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(u,ue,Q),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(u,ue,Q)),typeof y.componentDidUpdate=="function"&&(a.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof y.componentDidUpdate!="function"||M===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&se===t.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=ue),y.props=u,y.state=ue,y.context=Q,u=fe):(typeof y.componentDidUpdate!="function"||M===t.memoizedProps&&se===t.memoizedState||(a.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||M===t.memoizedProps&&se===t.memoizedState||(a.flags|=1024),u=!1)}return y=u,xu(t,a),u=(a.flags&128)!==0,y||u?(y=a.stateNode,i=u&&typeof i.getDerivedStateFromError!="function"?null:y.render(),a.flags|=1,t!==null&&u?(a.child=Qr(a,t.child,null,b),a.child=Qr(a,null,i,b)):En(t,a,i,b),a.memoizedState=y.state,t=a.child):t=ys(t,a,b),t}function Qv(t,a,i,u){return $r(),a.flags|=256,En(t,a,i,u),a.child}var Zp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Wp(t){return{baseLanes:t,cachePool:B_()}}function Jp(t,a,i){return t=t!==null?t.childLanes&~i:0,a&&(t|=ha),t}function Zv(t,a,i){var u=a.pendingProps,b=!1,y=(a.flags&128)!==0,M;if((M=y)||(M=t!==null&&t.memoizedState===null?!1:(fn.current&2)!==0),M&&(b=!0,a.flags&=-129),M=(a.flags&32)!==0,a.flags&=-33,t===null){if(jt){if(b?er(a):tr(),(t=Yt)?(t=r0(t,Na),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:Ys!==null?{id:Xa,overflow:Ka}:null,retryLane:536870912,hydrationErrors:null},i=T_(t),i.return=a,a.child=i,Sn=a,Yt=null)):t=null,t===null)throw Ks(a);return Dm(t)?a.lanes=32:a.lanes=536870912,null}var I=u.children;return u=u.fallback,b?(tr(),b=a.mode,I=bu({mode:"hidden",children:I},b),u=qr(u,b,i,null),I.return=a,u.return=a,I.sibling=u,a.child=I,u=a.child,u.memoizedState=Wp(i),u.childLanes=Jp(t,M,i),a.memoizedState=Zp,di(null,u)):(er(a),em(a,I))}var Q=t.memoizedState;if(Q!==null&&(I=Q.dehydrated,I!==null)){if(y)a.flags&256?(er(a),a.flags&=-257,a=tm(t,a,i)):a.memoizedState!==null?(tr(),a.child=t.child,a.flags|=128,a=null):(tr(),I=u.fallback,b=a.mode,u=bu({mode:"visible",children:u.children},b),I=qr(I,b,i,null),I.flags|=2,u.return=a,I.return=a,u.sibling=I,a.child=u,Qr(a,t.child,null,i),u=a.child,u.memoizedState=Wp(i),u.childLanes=Jp(t,M,i),a.memoizedState=Zp,a=di(null,u));else if(er(a),Dm(I)){if(M=I.nextSibling&&I.nextSibling.dataset,M)var ae=M.dgst;M=ae,u=Error(o(419)),u.stack="",u.digest=M,Jl({value:u,source:null,stack:null}),a=tm(t,a,i)}else if(_n||Uo(t,a,i,!1),M=(i&t.childLanes)!==0,_n||M){if(M=qt,M!==null&&(u=Ia(M,i),u!==0&&u!==Q.retryLane))throw Q.retryLane=u,Vr(t,u),na(M,t,u),Kp;zm(I)||Eu(),a=tm(t,a,i)}else zm(I)?(a.flags|=192,a.child=t.child,a=null):(t=Q.treeContext,Yt=Ta(I.nextSibling),Sn=a,jt=!0,Xs=null,Na=!1,t!==null&&O_(a,t),a=em(a,u.children),a.flags|=4096);return a}return b?(tr(),I=u.fallback,b=a.mode,Q=t.child,ae=Q.sibling,u=gs(Q,{mode:"hidden",children:u.children}),u.subtreeFlags=Q.subtreeFlags&65011712,ae!==null?I=gs(ae,I):(I=qr(I,b,i,null),I.flags|=2),I.return=a,u.return=a,u.sibling=I,a.child=u,di(null,u),u=a.child,I=t.child.memoizedState,I===null?I=Wp(i):(b=I.cachePool,b!==null?(Q=xn._currentValue,b=b.parent!==Q?{parent:Q,pool:Q}:b):b=B_(),I={baseLanes:I.baseLanes|i,cachePool:b}),u.memoizedState=I,u.childLanes=Jp(t,M,i),a.memoizedState=Zp,di(t.child,u)):(er(a),i=t.child,t=i.sibling,i=gs(i,{mode:"visible",children:u.children}),i.return=a,i.sibling=null,t!==null&&(M=a.deletions,M===null?(a.deletions=[t],a.flags|=16):M.push(t)),a.child=i,a.memoizedState=null,i)}function em(t,a){return a=bu({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function bu(t,a){return t=fa(22,t,null,a),t.lanes=0,t}function tm(t,a,i){return Qr(a,t.child,null,i),t=em(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function Wv(t,a,i){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),hp(t.return,a,i)}function nm(t,a,i,u,b,y){var M=t.memoizedState;M===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:i,tailMode:b,treeForkCount:y}:(M.isBackwards=a,M.rendering=null,M.renderingStartTime=0,M.last=u,M.tail=i,M.tailMode=b,M.treeForkCount=y)}function Jv(t,a,i){var u=a.pendingProps,b=u.revealOrder,y=u.tail;u=u.children;var M=fn.current,I=(M&2)!==0;if(I?(M=M&1|2,a.flags|=128):M&=1,F(fn,M),En(t,a,u,i),u=jt?Wl:0,!I&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Wv(t,i,a);else if(t.tag===19)Wv(t,i,a);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===a)break e;for(;t.sibling===null;){if(t.return===null||t.return===a)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(b){case"forwards":for(i=a.child,b=null;i!==null;)t=i.alternate,t!==null&&ou(t)===null&&(b=i),i=i.sibling;i=b,i===null?(b=a.child,a.child=null):(b=i.sibling,i.sibling=null),nm(a,!1,b,i,y,u);break;case"backwards":case"unstable_legacy-backwards":for(i=null,b=a.child,a.child=null;b!==null;){if(t=b.alternate,t!==null&&ou(t)===null){a.child=b;break}t=b.sibling,b.sibling=i,i=b,b=t}nm(a,!0,i,null,y,u);break;case"together":nm(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function ys(t,a,i){if(t!==null&&(a.dependencies=t.dependencies),sr|=a.lanes,(i&a.childLanes)===0)if(t!==null){if(Uo(t,a,i,!1),(i&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(o(153));if(a.child!==null){for(t=a.child,i=gs(t,t.pendingProps),a.child=i,i.return=a;t.sibling!==null;)t=t.sibling,i=i.sibling=gs(t,t.pendingProps),i.return=a;i.sibling=null}return a.child}function am(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Wc(t)))}function IE(t,a,i){switch(a.tag){case 3:ce(a,a.stateNode.containerInfo),Qs(a,xn,t.memoizedState.cache),$r();break;case 27:case 5:Te(a);break;case 4:ce(a,a.stateNode.containerInfo);break;case 10:Qs(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Np(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(er(a),a.flags|=128,null):(i&a.child.childLanes)!==0?Zv(t,a,i):(er(a),t=ys(t,a,i),t!==null?t.sibling:null);er(a);break;case 19:var b=(t.flags&128)!==0;if(u=(i&a.childLanes)!==0,u||(Uo(t,a,i,!1),u=(i&a.childLanes)!==0),b){if(u)return Jv(t,a,i);a.flags|=128}if(b=a.memoizedState,b!==null&&(b.rendering=null,b.tail=null,b.lastEffect=null),F(fn,fn.current),u)break;return null;case 22:return a.lanes=0,Gv(t,a,i,a.pendingProps);case 24:Qs(a,xn,t.memoizedState.cache)}return ys(t,a,i)}function ey(t,a,i){if(t!==null)if(t.memoizedProps!==a.pendingProps)_n=!0;else{if(!am(t,i)&&(a.flags&128)===0)return _n=!1,IE(t,a,i);_n=(t.flags&131072)!==0}else _n=!1,jt&&(a.flags&1048576)!==0&&M_(a,Wl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=Xr(a.elementType),a.type=t,typeof t=="function")ip(t)?(u=Wr(t,u),a.tag=1,a=Kv(null,a,t,u,i)):(a.tag=0,a=Qp(null,a,t,u,i));else{if(t!=null){var b=t.$$typeof;if(b===R){a.tag=11,a=Vv(null,a,t,u,i);break e}else if(b===A){a.tag=14,a=qv(null,a,t,u,i);break e}}throw a=q(t)||t,Error(o(306,a,""))}}return a;case 0:return Qp(t,a,a.type,a.pendingProps,i);case 1:return u=a.type,b=Wr(u,a.pendingProps),Kv(t,a,u,b,i);case 3:e:{if(ce(a,a.stateNode.containerInfo),t===null)throw Error(o(387));u=a.pendingProps;var y=a.memoizedState;b=y.element,wp(t,a),oi(a,u,null,i);var M=a.memoizedState;if(u=M.cache,Qs(a,xn,u),u!==y.cache&&xp(a,[xn],i,!0),ri(),u=M.element,y.isDehydrated)if(y={element:u,isDehydrated:!1,cache:M.cache},a.updateQueue.baseState=y,a.memoizedState=y,a.flags&256){a=Qv(t,a,u,i);break e}else if(u!==b){b=Sa(Error(o(424)),a),Jl(b),a=Qv(t,a,u,i);break e}else{switch(t=a.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Yt=Ta(t.firstChild),Sn=a,jt=!0,Xs=null,Na=!0,i=G_(a,null,u,i),a.child=i;i;)i.flags=i.flags&-3|4096,i=i.sibling}else{if($r(),u===b){a=ys(t,a,i);break e}En(t,a,u,i)}a=a.child}return a;case 26:return xu(t,a),t===null?(i=d0(a.type,null,a.pendingProps,null))?a.memoizedState=i:jt||(i=a.type,t=a.pendingProps,u=zu(re.current).createElement(i),u[At]=a,u[hn]=t,Nn(u,i,t),jn(u),a.stateNode=u):a.memoizedState=d0(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return Te(a),t===null&&jt&&(u=a.stateNode=i0(a.type,a.pendingProps,re.current),Sn=a,Na=!0,b=Yt,cr(a.type)?(Lm=b,Yt=Ta(u.firstChild)):Yt=b),En(t,a,a.pendingProps.children,i),xu(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&jt&&((b=u=Yt)&&(u=mN(u,a.type,a.pendingProps,Na),u!==null?(a.stateNode=u,Sn=a,Yt=Ta(u.firstChild),Na=!1,b=!0):b=!1),b||Ks(a)),Te(a),b=a.type,y=a.pendingProps,M=t!==null?t.memoizedProps:null,u=y.children,Am(b,y)?u=null:M!==null&&Am(b,M)&&(a.flags|=32),a.memoizedState!==null&&(b=Tp(t,a,RE,null,null,i),Ci._currentValue=b),xu(t,a),En(t,a,u,i),a.child;case 6:return t===null&&jt&&((t=i=Yt)&&(i=gN(i,a.pendingProps,Na),i!==null?(a.stateNode=i,Sn=a,Yt=null,t=!0):t=!1),t||Ks(a)),null;case 13:return Zv(t,a,i);case 4:return ce(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=Qr(a,null,u,i):En(t,a,u,i),a.child;case 11:return Vv(t,a,a.type,a.pendingProps,i);case 7:return En(t,a,a.pendingProps,i),a.child;case 8:return En(t,a,a.pendingProps.children,i),a.child;case 12:return En(t,a,a.pendingProps.children,i),a.child;case 10:return u=a.pendingProps,Qs(a,a.type,u.value),En(t,a,u.children,i),a.child;case 9:return b=a.type._context,u=a.pendingProps.children,Fr(a),b=Cn(b),u=u(b),a.flags|=1,En(t,a,u,i),a.child;case 14:return qv(t,a,a.type,a.pendingProps,i);case 15:return $v(t,a,a.type,a.pendingProps,i);case 19:return Jv(t,a,i);case 31:return PE(t,a,i);case 22:return Gv(t,a,i,a.pendingProps);case 24:return Fr(a),u=Cn(xn),t===null?(b=vp(),b===null&&(b=qt,y=bp(),b.pooledCache=y,y.refCount++,y!==null&&(b.pooledCacheLanes|=i),b=y),a.memoizedState={parent:u,cache:b},jp(a),Qs(a,xn,b)):((t.lanes&i)!==0&&(wp(t,a),oi(a,null,null,i),ri()),b=t.memoizedState,y=a.memoizedState,b.parent!==u?(b={parent:u,cache:u},a.memoizedState=b,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=b),Qs(a,xn,u)):(u=y.cache,Qs(a,xn,u),u!==b.cache&&xp(a,[xn],i,!0))),En(t,a,a.pendingProps.children,i),a.child;case 29:throw a.pendingProps}throw Error(o(156,a.tag))}function js(t){t.flags|=4}function sm(t,a,i,u,b){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(b&335544128)===b)if(t.stateNode.complete)t.flags|=8192;else if(Ey())t.flags|=8192;else throw Kr=nu,yp}else t.flags&=-16777217}function ty(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!h0(a))if(Ey())t.flags|=8192;else throw Kr=nu,yp}function _u(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?Kn():536870912,t.lanes|=a,Wo|=a)}function fi(t,a){if(!jt)switch(t.tailMode){case"hidden":a=t.tail;for(var i=null;a!==null;)a.alternate!==null&&(i=a),a=a.sibling;i===null?t.tail=null:i.sibling=null;break;case"collapsed":i=t.tail;for(var u=null;i!==null;)i.alternate!==null&&(u=i),i=i.sibling;u===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function Xt(t){var a=t.alternate!==null&&t.alternate.child===t.child,i=0,u=0;if(a)for(var b=t.child;b!==null;)i|=b.lanes|b.childLanes,u|=b.subtreeFlags&65011712,u|=b.flags&65011712,b.return=t,b=b.sibling;else for(b=t.child;b!==null;)i|=b.lanes|b.childLanes,u|=b.subtreeFlags,u|=b.flags,b.return=t,b=b.sibling;return t.subtreeFlags|=u,t.childLanes=i,a}function BE(t,a,i){var u=a.pendingProps;switch(fp(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Xt(a),null;case 1:return Xt(a),null;case 3:return i=a.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),bs(xn),ee(),i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),(t===null||t.child===null)&&(Bo(a)?js(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,mp())),Xt(a),null;case 26:var b=a.type,y=a.memoizedState;return t===null?(js(a),y!==null?(Xt(a),ty(a,y)):(Xt(a),sm(a,b,null,u,i))):y?y!==t.memoizedState?(js(a),Xt(a),ty(a,y)):(Xt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&js(a),Xt(a),sm(a,b,t,u,i)),null;case 27:if(Fe(a),i=re.current,b=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&js(a);else{if(!u){if(a.stateNode===null)throw Error(o(166));return Xt(a),null}t=J.current,Bo(a)?z_(a):(t=i0(b,u,i),a.stateNode=t,js(a))}return Xt(a),null;case 5:if(Fe(a),b=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&js(a);else{if(!u){if(a.stateNode===null)throw Error(o(166));return Xt(a),null}if(y=J.current,Bo(a))z_(a);else{var M=zu(re.current);switch(y){case 1:y=M.createElementNS("http://www.w3.org/2000/svg",b);break;case 2:y=M.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;default:switch(b){case"svg":y=M.createElementNS("http://www.w3.org/2000/svg",b);break;case"math":y=M.createElementNS("http://www.w3.org/1998/Math/MathML",b);break;case"script":y=M.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof u.is=="string"?M.createElement("select",{is:u.is}):M.createElement("select"),u.multiple?y.multiple=!0:u.size&&(y.size=u.size);break;default:y=typeof u.is=="string"?M.createElement(b,{is:u.is}):M.createElement(b)}}y[At]=a,y[hn]=u;e:for(M=a.child;M!==null;){if(M.tag===5||M.tag===6)y.appendChild(M.stateNode);else if(M.tag!==4&&M.tag!==27&&M.child!==null){M.child.return=M,M=M.child;continue}if(M===a)break e;for(;M.sibling===null;){if(M.return===null||M.return===a)break e;M=M.return}M.sibling.return=M.return,M=M.sibling}a.stateNode=y;e:switch(Nn(y,b,u),b){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&js(a)}}return Xt(a),sm(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,i),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&js(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(o(166));if(t=re.current,Bo(a)){if(t=a.stateNode,i=a.memoizedProps,u=null,b=Sn,b!==null)switch(b.tag){case 27:case 5:u=b.memoizedProps}t[At]=a,t=!!(t.nodeValue===i||u!==null&&u.suppressHydrationWarning===!0||Zy(t.nodeValue,i)),t||Ks(a,!0)}else t=zu(t).createTextNode(u),t[At]=a,a.stateNode=t}return Xt(a),null;case 31:if(i=a.memoizedState,t===null||t.memoizedState!==null){if(u=Bo(a),i!==null){if(t===null){if(!u)throw Error(o(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(o(557));t[At]=a}else $r(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),t=!1}else i=mp(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=i),t=!0;if(!t)return a.flags&256?(ma(a),a):(ma(a),null);if((a.flags&128)!==0)throw Error(o(558))}return Xt(a),null;case 13:if(u=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(b=Bo(a),u!==null&&u.dehydrated!==null){if(t===null){if(!b)throw Error(o(318));if(b=a.memoizedState,b=b!==null?b.dehydrated:null,!b)throw Error(o(317));b[At]=a}else $r(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Xt(a),b=!1}else b=mp(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=b),b=!0;if(!b)return a.flags&256?(ma(a),a):(ma(a),null)}return ma(a),(a.flags&128)!==0?(a.lanes=i,a):(i=u!==null,t=t!==null&&t.memoizedState!==null,i&&(u=a.child,b=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(b=u.alternate.memoizedState.cachePool.pool),y=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(y=u.memoizedState.cachePool.pool),y!==b&&(u.flags|=2048)),i!==t&&i&&(a.child.flags|=8192),_u(a,a.updateQueue),Xt(a),null);case 4:return ee(),t===null&&Cm(a.stateNode.containerInfo),Xt(a),null;case 10:return bs(a.type),Xt(a),null;case 19:if(K(fn),u=a.memoizedState,u===null)return Xt(a),null;if(b=(a.flags&128)!==0,y=u.rendering,y===null)if(b)fi(u,!1);else{if(ln!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(y=ou(t),y!==null){for(a.flags|=128,fi(u,!1),t=y.updateQueue,a.updateQueue=t,_u(a,t),a.subtreeFlags=0,t=i,i=a.child;i!==null;)R_(i,t),i=i.sibling;return F(fn,fn.current&1|2),jt&&hs(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&ve()>ku&&(a.flags|=128,b=!0,fi(u,!1),a.lanes=4194304)}else{if(!b)if(t=ou(y),t!==null){if(a.flags|=128,b=!0,t=t.updateQueue,a.updateQueue=t,_u(a,t),fi(u,!0),u.tail===null&&u.tailMode==="hidden"&&!y.alternate&&!jt)return Xt(a),null}else 2*ve()-u.renderingStartTime>ku&&i!==536870912&&(a.flags|=128,b=!0,fi(u,!1),a.lanes=4194304);u.isBackwards?(y.sibling=a.child,a.child=y):(t=u.last,t!==null?t.sibling=y:a.child=y,u.last=y)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ve(),t.sibling=null,i=fn.current,F(fn,b?i&1|2:i&1),jt&&hs(a,u.treeForkCount),t):(Xt(a),null);case 22:case 23:return ma(a),Ep(),u=a.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(i&536870912)!==0&&(a.flags&128)===0&&(Xt(a),a.subtreeFlags&6&&(a.flags|=8192)):Xt(a),i=a.updateQueue,i!==null&&_u(a,i.retryQueue),i=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==i&&(a.flags|=2048),t!==null&&K(Yr),null;case 24:return i=null,t!==null&&(i=t.memoizedState.cache),a.memoizedState.cache!==i&&(a.flags|=2048),bs(xn),Xt(a),null;case 25:return null;case 30:return null}throw Error(o(156,a.tag))}function UE(t,a){switch(fp(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return bs(xn),ee(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return Fe(a),null;case 31:if(a.memoizedState!==null){if(ma(a),a.alternate===null)throw Error(o(340));$r()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(ma(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(o(340));$r()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return K(fn),null;case 4:return ee(),null;case 10:return bs(a.type),null;case 22:case 23:return ma(a),Ep(),t!==null&&K(Yr),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return bs(xn),null;case 25:return null;default:return null}}function ny(t,a){switch(fp(a),a.tag){case 3:bs(xn),ee();break;case 26:case 27:case 5:Fe(a);break;case 4:ee();break;case 31:a.memoizedState!==null&&ma(a);break;case 13:ma(a);break;case 19:K(fn);break;case 10:bs(a.type);break;case 22:case 23:ma(a),Ep(),t!==null&&K(Yr);break;case 24:bs(xn)}}function pi(t,a){try{var i=a.updateQueue,u=i!==null?i.lastEffect:null;if(u!==null){var b=u.next;i=b;do{if((i.tag&t)===t){u=void 0;var y=i.create,M=i.inst;u=y(),M.destroy=u}i=i.next}while(i!==b)}}catch(I){Ot(a,a.return,I)}}function nr(t,a,i){try{var u=a.updateQueue,b=u!==null?u.lastEffect:null;if(b!==null){var y=b.next;u=y;do{if((u.tag&t)===t){var M=u.inst,I=M.destroy;if(I!==void 0){M.destroy=void 0,b=a;var Q=i,ae=I;try{ae()}catch(fe){Ot(b,Q,fe)}}}u=u.next}while(u!==y)}}catch(fe){Ot(a,a.return,fe)}}function ay(t){var a=t.updateQueue;if(a!==null){var i=t.stateNode;try{Y_(a,i)}catch(u){Ot(t,t.return,u)}}}function sy(t,a,i){i.props=Wr(t.type,t.memoizedProps),i.state=t.memoizedState;try{i.componentWillUnmount()}catch(u){Ot(t,a,u)}}function mi(t,a){try{var i=t.ref;if(i!==null){switch(t.tag){case 26:case 27:case 5:var u=t.stateNode;break;case 30:u=t.stateNode;break;default:u=t.stateNode}typeof i=="function"?t.refCleanup=i(u):i.current=u}}catch(b){Ot(t,a,b)}}function Qa(t,a){var i=t.ref,u=t.refCleanup;if(i!==null)if(typeof u=="function")try{u()}catch(b){Ot(t,a,b)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof i=="function")try{i(null)}catch(b){Ot(t,a,b)}else i.current=null}function ry(t){var a=t.type,i=t.memoizedProps,u=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":i.autoFocus&&u.focus();break e;case"img":i.src?u.src=i.src:i.srcSet&&(u.srcset=i.srcSet)}}catch(b){Ot(t,t.return,b)}}function rm(t,a,i){try{var u=t.stateNode;iN(u,t.type,i,a),u[hn]=a}catch(b){Ot(t,t.return,b)}}function oy(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&cr(t.type)||t.tag===4}function om(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||oy(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&cr(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function lm(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i).insertBefore(t,a):(a=i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.appendChild(t),i=i._reactRootContainer,i!=null||a.onclick!==null||(a.onclick=ps));else if(u!==4&&(u===27&&cr(t.type)&&(i=t.stateNode,a=null),t=t.child,t!==null))for(lm(t,a,i),t=t.sibling;t!==null;)lm(t,a,i),t=t.sibling}function vu(t,a,i){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?i.insertBefore(t,a):i.appendChild(t);else if(u!==4&&(u===27&&cr(t.type)&&(i=t.stateNode),t=t.child,t!==null))for(vu(t,a,i),t=t.sibling;t!==null;)vu(t,a,i),t=t.sibling}function ly(t){var a=t.stateNode,i=t.memoizedProps;try{for(var u=t.type,b=a.attributes;b.length;)a.removeAttributeNode(b[0]);Nn(a,u,i),a[At]=t,a[hn]=i}catch(y){Ot(t,t.return,y)}}var ws=!1,vn=!1,im=!1,iy=typeof WeakSet=="function"?WeakSet:Set,wn=null;function HE(t,a){if(t=t.containerInfo,Rm=Hu,t=v_(t),tp(t)){if("selectionStart"in t)var i={start:t.selectionStart,end:t.selectionEnd};else e:{i=(i=t.ownerDocument)&&i.defaultView||window;var u=i.getSelection&&i.getSelection();if(u&&u.rangeCount!==0){i=u.anchorNode;var b=u.anchorOffset,y=u.focusNode;u=u.focusOffset;try{i.nodeType,y.nodeType}catch{i=null;break e}var M=0,I=-1,Q=-1,ae=0,fe=0,xe=t,se=null;t:for(;;){for(var ue;xe!==i||b!==0&&xe.nodeType!==3||(I=M+b),xe!==y||u!==0&&xe.nodeType!==3||(Q=M+u),xe.nodeType===3&&(M+=xe.nodeValue.length),(ue=xe.firstChild)!==null;)se=xe,xe=ue;for(;;){if(xe===t)break t;if(se===i&&++ae===b&&(I=M),se===y&&++fe===u&&(Q=M),(ue=xe.nextSibling)!==null)break;xe=se,se=xe.parentNode}xe=ue}i=I===-1||Q===-1?null:{start:I,end:Q}}else i=null}i=i||{start:0,end:0}}else i=null;for(Tm={focusedElem:t,selectionRange:i},Hu=!1,wn=a;wn!==null;)if(a=wn,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,wn=t;else for(;wn!==null;){switch(a=wn,y=a.alternate,t=a.flags,a.tag){case 0:if((t&4)!==0&&(t=a.updateQueue,t=t!==null?t.events:null,t!==null))for(i=0;i<t.length;i++)b=t[i],b.ref.impl=b.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&y!==null){t=void 0,i=a,b=y.memoizedProps,y=y.memoizedState,u=i.stateNode;try{var He=Wr(i.type,b);t=u.getSnapshotBeforeUpdate(He,y),u.__reactInternalSnapshotBeforeUpdate=t}catch(et){Ot(i,i.return,et)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,i=t.nodeType,i===9)Om(t);else if(i===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Om(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(o(163))}if(t=a.sibling,t!==null){t.return=a.return,wn=t;break}wn=a.return}}function cy(t,a,i){var u=i.flags;switch(i.tag){case 0:case 11:case 15:Ss(t,i),u&4&&pi(5,i);break;case 1:if(Ss(t,i),u&4)if(t=i.stateNode,a===null)try{t.componentDidMount()}catch(M){Ot(i,i.return,M)}else{var b=Wr(i.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(b,a,t.__reactInternalSnapshotBeforeUpdate)}catch(M){Ot(i,i.return,M)}}u&64&&ay(i),u&512&&mi(i,i.return);break;case 3:if(Ss(t,i),u&64&&(t=i.updateQueue,t!==null)){if(a=null,i.child!==null)switch(i.child.tag){case 27:case 5:a=i.child.stateNode;break;case 1:a=i.child.stateNode}try{Y_(t,a)}catch(M){Ot(i,i.return,M)}}break;case 27:a===null&&u&4&&ly(i);case 26:case 5:Ss(t,i),a===null&&u&4&&ry(i),u&512&&mi(i,i.return);break;case 12:Ss(t,i);break;case 31:Ss(t,i),u&4&&fy(t,i);break;case 13:Ss(t,i),u&4&&py(t,i),u&64&&(t=i.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(i=QE.bind(null,i),hN(t,i))));break;case 22:if(u=i.memoizedState!==null||ws,!u){a=a!==null&&a.memoizedState!==null||vn,b=ws;var y=vn;ws=u,(vn=a)&&!y?Cs(t,i,(i.subtreeFlags&8772)!==0):Ss(t,i),ws=b,vn=y}break;case 30:break;default:Ss(t,i)}}function uy(t){var a=t.alternate;a!==null&&(t.alternate=null,uy(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&If(a)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Jt=null,Wn=!1;function ks(t,a,i){for(i=i.child;i!==null;)dy(t,a,i),i=i.sibling}function dy(t,a,i){if(Re&&typeof Re.onCommitFiberUnmount=="function")try{Re.onCommitFiberUnmount(Ee,i)}catch{}switch(i.tag){case 26:vn||Qa(i,a),ks(t,a,i),i.memoizedState?i.memoizedState.count--:i.stateNode&&(i=i.stateNode,i.parentNode.removeChild(i));break;case 27:vn||Qa(i,a);var u=Jt,b=Wn;cr(i.type)&&(Jt=i.stateNode,Wn=!1),ks(t,a,i),wi(i.stateNode),Jt=u,Wn=b;break;case 5:vn||Qa(i,a);case 6:if(u=Jt,b=Wn,Jt=null,ks(t,a,i),Jt=u,Wn=b,Jt!==null)if(Wn)try{(Jt.nodeType===9?Jt.body:Jt.nodeName==="HTML"?Jt.ownerDocument.body:Jt).removeChild(i.stateNode)}catch(y){Ot(i,a,y)}else try{Jt.removeChild(i.stateNode)}catch(y){Ot(i,a,y)}break;case 18:Jt!==null&&(Wn?(t=Jt,a0(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,i.stateNode),ol(t)):a0(Jt,i.stateNode));break;case 4:u=Jt,b=Wn,Jt=i.stateNode.containerInfo,Wn=!0,ks(t,a,i),Jt=u,Wn=b;break;case 0:case 11:case 14:case 15:nr(2,i,a),vn||nr(4,i,a),ks(t,a,i);break;case 1:vn||(Qa(i,a),u=i.stateNode,typeof u.componentWillUnmount=="function"&&sy(i,a,u)),ks(t,a,i);break;case 21:ks(t,a,i);break;case 22:vn=(u=vn)||i.memoizedState!==null,ks(t,a,i),vn=u;break;default:ks(t,a,i)}}function fy(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{ol(t)}catch(i){Ot(a,a.return,i)}}}function py(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{ol(t)}catch(i){Ot(a,a.return,i)}}function VE(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new iy),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new iy),a;default:throw Error(o(435,t.tag))}}function yu(t,a){var i=VE(t);a.forEach(function(u){if(!i.has(u)){i.add(u);var b=ZE.bind(null,t,u);u.then(b,b)}})}function Jn(t,a){var i=a.deletions;if(i!==null)for(var u=0;u<i.length;u++){var b=i[u],y=t,M=a,I=M;e:for(;I!==null;){switch(I.tag){case 27:if(cr(I.type)){Jt=I.stateNode,Wn=!1;break e}break;case 5:Jt=I.stateNode,Wn=!1;break e;case 3:case 4:Jt=I.stateNode.containerInfo,Wn=!0;break e}I=I.return}if(Jt===null)throw Error(o(160));dy(y,M,b),Jt=null,Wn=!1,y=b.alternate,y!==null&&(y.return=null),b.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)my(a,t),a=a.sibling}var Ua=null;function my(t,a){var i=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Jn(a,t),ea(t),u&4&&(nr(3,t,t.return),pi(3,t),nr(5,t,t.return));break;case 1:Jn(a,t),ea(t),u&512&&(vn||i===null||Qa(i,i.return)),u&64&&ws&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(i=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=i===null?u:i.concat(u))));break;case 26:var b=Ua;if(Jn(a,t),ea(t),u&512&&(vn||i===null||Qa(i,i.return)),u&4){var y=i!==null?i.memoizedState:null;if(u=t.memoizedState,i===null)if(u===null)if(t.stateNode===null){e:{u=t.type,i=t.memoizedProps,b=b.ownerDocument||b;t:switch(u){case"title":y=b.getElementsByTagName("title")[0],(!y||y[Hl]||y[At]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=b.createElement(u),b.head.insertBefore(y,b.querySelector("head > title"))),Nn(y,u,i),y[At]=t,jn(y),u=y;break e;case"link":var M=m0("link","href",b).get(u+(i.href||""));if(M){for(var I=0;I<M.length;I++)if(y=M[I],y.getAttribute("href")===(i.href==null||i.href===""?null:i.href)&&y.getAttribute("rel")===(i.rel==null?null:i.rel)&&y.getAttribute("title")===(i.title==null?null:i.title)&&y.getAttribute("crossorigin")===(i.crossOrigin==null?null:i.crossOrigin)){M.splice(I,1);break t}}y=b.createElement(u),Nn(y,u,i),b.head.appendChild(y);break;case"meta":if(M=m0("meta","content",b).get(u+(i.content||""))){for(I=0;I<M.length;I++)if(y=M[I],y.getAttribute("content")===(i.content==null?null:""+i.content)&&y.getAttribute("name")===(i.name==null?null:i.name)&&y.getAttribute("property")===(i.property==null?null:i.property)&&y.getAttribute("http-equiv")===(i.httpEquiv==null?null:i.httpEquiv)&&y.getAttribute("charset")===(i.charSet==null?null:i.charSet)){M.splice(I,1);break t}}y=b.createElement(u),Nn(y,u,i),b.head.appendChild(y);break;default:throw Error(o(468,u))}y[At]=t,jn(y),u=y}t.stateNode=u}else g0(b,t.type,t.stateNode);else t.stateNode=p0(b,u,t.memoizedProps);else y!==u?(y===null?i.stateNode!==null&&(i=i.stateNode,i.parentNode.removeChild(i)):y.count--,u===null?g0(b,t.type,t.stateNode):p0(b,u,t.memoizedProps)):u===null&&t.stateNode!==null&&rm(t,t.memoizedProps,i.memoizedProps)}break;case 27:Jn(a,t),ea(t),u&512&&(vn||i===null||Qa(i,i.return)),i!==null&&u&4&&rm(t,t.memoizedProps,i.memoizedProps);break;case 5:if(Jn(a,t),ea(t),u&512&&(vn||i===null||Qa(i,i.return)),t.flags&32){b=t.stateNode;try{Ro(b,"")}catch(He){Ot(t,t.return,He)}}u&4&&t.stateNode!=null&&(b=t.memoizedProps,rm(t,b,i!==null?i.memoizedProps:b)),u&1024&&(im=!0);break;case 6:if(Jn(a,t),ea(t),u&4){if(t.stateNode===null)throw Error(o(162));u=t.memoizedProps,i=t.stateNode;try{i.nodeValue=u}catch(He){Ot(t,t.return,He)}}break;case 3:if(Pu=null,b=Ua,Ua=Du(a.containerInfo),Jn(a,t),Ua=b,ea(t),u&4&&i!==null&&i.memoizedState.isDehydrated)try{ol(a.containerInfo)}catch(He){Ot(t,t.return,He)}im&&(im=!1,gy(t));break;case 4:u=Ua,Ua=Du(t.stateNode.containerInfo),Jn(a,t),ea(t),Ua=u;break;case 12:Jn(a,t),ea(t);break;case 31:Jn(a,t),ea(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,yu(t,u)));break;case 13:Jn(a,t),ea(t),t.child.flags&8192&&t.memoizedState!==null!=(i!==null&&i.memoizedState!==null)&&(wu=ve()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,yu(t,u)));break;case 22:b=t.memoizedState!==null;var Q=i!==null&&i.memoizedState!==null,ae=ws,fe=vn;if(ws=ae||b,vn=fe||Q,Jn(a,t),vn=fe,ws=ae,ea(t),u&8192)e:for(a=t.stateNode,a._visibility=b?a._visibility&-2:a._visibility|1,b&&(i===null||Q||ws||vn||Jr(t)),i=null,a=t;;){if(a.tag===5||a.tag===26){if(i===null){Q=i=a;try{if(y=Q.stateNode,b)M=y.style,typeof M.setProperty=="function"?M.setProperty("display","none","important"):M.display="none";else{I=Q.stateNode;var xe=Q.memoizedProps.style,se=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;I.style.display=se==null||typeof se=="boolean"?"":(""+se).trim()}}catch(He){Ot(Q,Q.return,He)}}}else if(a.tag===6){if(i===null){Q=a;try{Q.stateNode.nodeValue=b?"":Q.memoizedProps}catch(He){Ot(Q,Q.return,He)}}}else if(a.tag===18){if(i===null){Q=a;try{var ue=Q.stateNode;b?s0(ue,!0):s0(Q.stateNode,!1)}catch(He){Ot(Q,Q.return,He)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===t)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===t)break e;for(;a.sibling===null;){if(a.return===null||a.return===t)break e;i===a&&(i=null),a=a.return}i===a&&(i=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=t.updateQueue,u!==null&&(i=u.retryQueue,i!==null&&(u.retryQueue=null,yu(t,i))));break;case 19:Jn(a,t),ea(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,yu(t,u)));break;case 30:break;case 21:break;default:Jn(a,t),ea(t)}}function ea(t){var a=t.flags;if(a&2){try{for(var i,u=t.return;u!==null;){if(oy(u)){i=u;break}u=u.return}if(i==null)throw Error(o(160));switch(i.tag){case 27:var b=i.stateNode,y=om(t);vu(t,y,b);break;case 5:var M=i.stateNode;i.flags&32&&(Ro(M,""),i.flags&=-33);var I=om(t);vu(t,I,M);break;case 3:case 4:var Q=i.stateNode.containerInfo,ae=om(t);lm(t,ae,Q);break;default:throw Error(o(161))}}catch(fe){Ot(t,t.return,fe)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function gy(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;gy(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function Ss(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)cy(t,a.alternate,a),a=a.sibling}function Jr(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:nr(4,a,a.return),Jr(a);break;case 1:Qa(a,a.return);var i=a.stateNode;typeof i.componentWillUnmount=="function"&&sy(a,a.return,i),Jr(a);break;case 27:wi(a.stateNode);case 26:case 5:Qa(a,a.return),Jr(a);break;case 22:a.memoizedState===null&&Jr(a);break;case 30:Jr(a);break;default:Jr(a)}t=t.sibling}}function Cs(t,a,i){for(i=i&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,b=t,y=a,M=y.flags;switch(y.tag){case 0:case 11:case 15:Cs(b,y,i),pi(4,y);break;case 1:if(Cs(b,y,i),u=y,b=u.stateNode,typeof b.componentDidMount=="function")try{b.componentDidMount()}catch(ae){Ot(u,u.return,ae)}if(u=y,b=u.updateQueue,b!==null){var I=u.stateNode;try{var Q=b.shared.hiddenCallbacks;if(Q!==null)for(b.shared.hiddenCallbacks=null,b=0;b<Q.length;b++)F_(Q[b],I)}catch(ae){Ot(u,u.return,ae)}}i&&M&64&&ay(y),mi(y,y.return);break;case 27:ly(y);case 26:case 5:Cs(b,y,i),i&&u===null&&M&4&&ry(y),mi(y,y.return);break;case 12:Cs(b,y,i);break;case 31:Cs(b,y,i),i&&M&4&&fy(b,y);break;case 13:Cs(b,y,i),i&&M&4&&py(b,y);break;case 22:y.memoizedState===null&&Cs(b,y,i),mi(y,y.return);break;case 30:break;default:Cs(b,y,i)}a=a.sibling}}function cm(t,a){var i=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(i=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==i&&(t!=null&&t.refCount++,i!=null&&ei(i))}function um(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ei(t))}function Ha(t,a,i,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)hy(t,a,i,u),a=a.sibling}function hy(t,a,i,u){var b=a.flags;switch(a.tag){case 0:case 11:case 15:Ha(t,a,i,u),b&2048&&pi(9,a);break;case 1:Ha(t,a,i,u);break;case 3:Ha(t,a,i,u),b&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&ei(t)));break;case 12:if(b&2048){Ha(t,a,i,u),t=a.stateNode;try{var y=a.memoizedProps,M=y.id,I=y.onPostCommit;typeof I=="function"&&I(M,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(Q){Ot(a,a.return,Q)}}else Ha(t,a,i,u);break;case 31:Ha(t,a,i,u);break;case 13:Ha(t,a,i,u);break;case 23:break;case 22:y=a.stateNode,M=a.alternate,a.memoizedState!==null?y._visibility&2?Ha(t,a,i,u):gi(t,a):y._visibility&2?Ha(t,a,i,u):(y._visibility|=2,Ko(t,a,i,u,(a.subtreeFlags&10256)!==0||!1)),b&2048&&cm(M,a);break;case 24:Ha(t,a,i,u),b&2048&&um(a.alternate,a);break;default:Ha(t,a,i,u)}}function Ko(t,a,i,u,b){for(b=b&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var y=t,M=a,I=i,Q=u,ae=M.flags;switch(M.tag){case 0:case 11:case 15:Ko(y,M,I,Q,b),pi(8,M);break;case 23:break;case 22:var fe=M.stateNode;M.memoizedState!==null?fe._visibility&2?Ko(y,M,I,Q,b):gi(y,M):(fe._visibility|=2,Ko(y,M,I,Q,b)),b&&ae&2048&&cm(M.alternate,M);break;case 24:Ko(y,M,I,Q,b),b&&ae&2048&&um(M.alternate,M);break;default:Ko(y,M,I,Q,b)}a=a.sibling}}function gi(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var i=t,u=a,b=u.flags;switch(u.tag){case 22:gi(i,u),b&2048&&cm(u.alternate,u);break;case 24:gi(i,u),b&2048&&um(u.alternate,u);break;default:gi(i,u)}a=a.sibling}}var hi=8192;function Qo(t,a,i){if(t.subtreeFlags&hi)for(t=t.child;t!==null;)xy(t,a,i),t=t.sibling}function xy(t,a,i){switch(t.tag){case 26:Qo(t,a,i),t.flags&hi&&t.memoizedState!==null&&NN(i,Ua,t.memoizedState,t.memoizedProps);break;case 5:Qo(t,a,i);break;case 3:case 4:var u=Ua;Ua=Du(t.stateNode.containerInfo),Qo(t,a,i),Ua=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=hi,hi=16777216,Qo(t,a,i),hi=u):Qo(t,a,i));break;default:Qo(t,a,i)}}function by(t){var a=t.alternate;if(a!==null&&(t=a.child,t!==null)){a.child=null;do a=t.sibling,t.sibling=null,t=a;while(t!==null)}}function xi(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];wn=u,vy(u,t)}by(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)_y(t),t=t.sibling}function _y(t){switch(t.tag){case 0:case 11:case 15:xi(t),t.flags&2048&&nr(9,t,t.return);break;case 3:xi(t);break;case 12:xi(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,ju(t)):xi(t);break;default:xi(t)}}function ju(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var i=0;i<a.length;i++){var u=a[i];wn=u,vy(u,t)}by(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:nr(8,a,a.return),ju(a);break;case 22:i=a.stateNode,i._visibility&2&&(i._visibility&=-3,ju(a));break;default:ju(a)}t=t.sibling}}function vy(t,a){for(;wn!==null;){var i=wn;switch(i.tag){case 0:case 11:case 15:nr(8,i,a);break;case 23:case 22:if(i.memoizedState!==null&&i.memoizedState.cachePool!==null){var u=i.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:ei(i.memoizedState.cache)}if(u=i.child,u!==null)u.return=i,wn=u;else e:for(i=t;wn!==null;){u=wn;var b=u.sibling,y=u.return;if(uy(u),u===i){wn=null;break e}if(b!==null){b.return=y,wn=b;break e}wn=y}}}var qE={getCacheForType:function(t){var a=Cn(xn),i=a.data.get(t);return i===void 0&&(i=t(),a.data.set(t,i)),i},cacheSignal:function(){return Cn(xn).controller.signal}},$E=typeof WeakMap=="function"?WeakMap:Map,Nt=0,qt=null,gt=null,xt=0,Mt=0,ga=null,ar=!1,Zo=!1,dm=!1,Es=0,ln=0,sr=0,eo=0,fm=0,ha=0,Wo=0,bi=null,ta=null,pm=!1,wu=0,yy=0,ku=1/0,Su=null,rr=null,yn=0,or=null,Jo=null,Ns=0,mm=0,gm=null,jy=null,_i=0,hm=null;function xa(){return(Nt&2)!==0&&xt!==0?xt&-xt:V.T!==null?jm():Dt()}function wy(){if(ha===0)if((xt&536870912)===0||jt){var t=Wt;Wt<<=1,(Wt&3932160)===0&&(Wt=262144),ha=t}else ha=536870912;return t=pa.current,t!==null&&(t.flags|=32),ha}function na(t,a,i){(t===qt&&(Mt===2||Mt===9)||t.cancelPendingCommit!==null)&&(el(t,0),lr(t,xt,ha,!1)),Qn(t,i),((Nt&2)===0||t!==qt)&&(t===qt&&((Nt&2)===0&&(eo|=i),ln===4&&lr(t,xt,ha,!1)),Za(t))}function ky(t,a,i){if((Nt&6)!==0)throw Error(o(327));var u=!i&&(a&127)===0&&(a&t.expiredLanes)===0||dn(t,a),b=u?YE(t,a):bm(t,a,!0),y=u;do{if(b===0){Zo&&!u&&lr(t,a,0,!1);break}else{if(i=t.current.alternate,y&&!GE(i)){b=bm(t,a,!1),y=!1;continue}if(b===2){if(y=a,t.errorRecoveryDisabledLanes&y)var M=0;else M=t.pendingLanes&-536870913,M=M!==0?M:M&536870912?536870912:0;if(M!==0){a=M;e:{var I=t;b=bi;var Q=I.current.memoizedState.isDehydrated;if(Q&&(el(I,M).flags|=256),M=bm(I,M,!1),M!==2){if(dm&&!Q){I.errorRecoveryDisabledLanes|=y,eo|=y,b=4;break e}y=ta,ta=b,y!==null&&(ta===null?ta=y:ta.push.apply(ta,y))}b=M}if(y=!1,b!==2)continue}}if(b===1){el(t,0),lr(t,a,0,!0);break}e:{switch(u=t,y=b,y){case 0:case 1:throw Error(o(345));case 4:if((a&4194048)!==a)break;case 6:lr(u,a,ha,!ar);break e;case 2:ta=null;break;case 3:case 5:break;default:throw Error(o(329))}if((a&62914560)===a&&(b=wu+300-ve(),10<b)){if(lr(u,a,ha,!ar),Ft(u,0,!0)!==0)break e;Ns=a,u.timeoutHandle=t0(Sy.bind(null,u,i,ta,Su,pm,a,ha,eo,Wo,ar,y,"Throttled",-0,0),b);break e}Sy(u,i,ta,Su,pm,a,ha,eo,Wo,ar,y,null,-0,0)}}break}while(!0);Za(t)}function Sy(t,a,i,u,b,y,M,I,Q,ae,fe,xe,se,ue){if(t.timeoutHandle=-1,xe=a.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ps},xy(a,y,xe);var He=(y&62914560)===y?wu-ve():(y&4194048)===y?yy-ve():0;if(He=RN(xe,He),He!==null){Ns=y,t.cancelPendingCommit=He(Oy.bind(null,t,a,y,i,u,b,M,I,Q,fe,xe,null,se,ue)),lr(t,y,M,!ae);return}}Oy(t,a,y,i,u,b,M,I,Q)}function GE(t){for(var a=t;;){var i=a.tag;if((i===0||i===11||i===15)&&a.flags&16384&&(i=a.updateQueue,i!==null&&(i=i.stores,i!==null)))for(var u=0;u<i.length;u++){var b=i[u],y=b.getSnapshot;b=b.value;try{if(!da(y(),b))return!1}catch{return!1}}if(i=a.child,a.subtreeFlags&16384&&i!==null)i.return=a,a=i;else{if(a===t)break;for(;a.sibling===null;){if(a.return===null||a.return===t)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function lr(t,a,i,u){a&=~fm,a&=~eo,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var b=a;0<b;){var y=31-st(b),M=1<<y;u[y]=-1,b&=~M}i!==0&&zn(t,i,a)}function Cu(){return(Nt&6)===0?(vi(0),!1):!0}function xm(){if(gt!==null){if(Mt===0)var t=gt.return;else t=gt,xs=Gr=null,Op(t),$o=null,ni=0,t=gt;for(;t!==null;)ny(t.alternate,t),t=t.return;gt=null}}function el(t,a){var i=t.timeoutHandle;i!==-1&&(t.timeoutHandle=-1,dN(i)),i=t.cancelPendingCommit,i!==null&&(t.cancelPendingCommit=null,i()),Ns=0,xm(),qt=t,gt=i=gs(t.current,null),xt=a,Mt=0,ga=null,ar=!1,Zo=dn(t,a),dm=!1,Wo=ha=fm=eo=sr=ln=0,ta=bi=null,pm=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var b=31-st(u),y=1<<b;a|=t[b],u&=~y}return Es=a,Yc(),i}function Cy(t,a){ot=null,V.H=ui,a===qo||a===tu?(a=V_(),Mt=3):a===yp?(a=V_(),Mt=4):Mt=a===Kp?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,ga=a,gt===null&&(ln=1,gu(t,Sa(a,t.current)))}function Ey(){var t=pa.current;return t===null?!0:(xt&4194048)===xt?Ra===null:(xt&62914560)===xt||(xt&536870912)!==0?t===Ra:!1}function Ny(){var t=V.H;return V.H=ui,t===null?ui:t}function Ry(){var t=V.A;return V.A=qE,t}function Eu(){ln=4,ar||(xt&4194048)!==xt&&pa.current!==null||(Zo=!0),(sr&134217727)===0&&(eo&134217727)===0||qt===null||lr(qt,xt,ha,!1)}function bm(t,a,i){var u=Nt;Nt|=2;var b=Ny(),y=Ry();(qt!==t||xt!==a)&&(Su=null,el(t,a)),a=!1;var M=ln;e:do try{if(Mt!==0&&gt!==null){var I=gt,Q=ga;switch(Mt){case 8:xm(),M=6;break e;case 3:case 2:case 9:case 6:pa.current===null&&(a=!0);var ae=Mt;if(Mt=0,ga=null,tl(t,I,Q,ae),i&&Zo){M=0;break e}break;default:ae=Mt,Mt=0,ga=null,tl(t,I,Q,ae)}}FE(),M=ln;break}catch(fe){Cy(t,fe)}while(!0);return a&&t.shellSuspendCounter++,xs=Gr=null,Nt=u,V.H=b,V.A=y,gt===null&&(qt=null,xt=0,Yc()),M}function FE(){for(;gt!==null;)Ty(gt)}function YE(t,a){var i=Nt;Nt|=2;var u=Ny(),b=Ry();qt!==t||xt!==a?(Su=null,ku=ve()+500,el(t,a)):Zo=dn(t,a);e:do try{if(Mt!==0&&gt!==null){a=gt;var y=ga;t:switch(Mt){case 1:Mt=0,ga=null,tl(t,a,y,1);break;case 2:case 9:if(U_(y)){Mt=0,ga=null,Ay(a);break}a=function(){Mt!==2&&Mt!==9||qt!==t||(Mt=7),Za(t)},y.then(a,a);break e;case 3:Mt=7;break e;case 4:Mt=5;break e;case 7:U_(y)?(Mt=0,ga=null,Ay(a)):(Mt=0,ga=null,tl(t,a,y,7));break;case 5:var M=null;switch(gt.tag){case 26:M=gt.memoizedState;case 5:case 27:var I=gt;if(M?h0(M):I.stateNode.complete){Mt=0,ga=null;var Q=I.sibling;if(Q!==null)gt=Q;else{var ae=I.return;ae!==null?(gt=ae,Nu(ae)):gt=null}break t}}Mt=0,ga=null,tl(t,a,y,5);break;case 6:Mt=0,ga=null,tl(t,a,y,6);break;case 8:xm(),ln=6;break e;default:throw Error(o(462))}}XE();break}catch(fe){Cy(t,fe)}while(!0);return xs=Gr=null,V.H=u,V.A=b,Nt=i,gt!==null?0:(qt=null,xt=0,Yc(),ln)}function XE(){for(;gt!==null&&!Ye();)Ty(gt)}function Ty(t){var a=ey(t.alternate,t,Es);t.memoizedProps=t.pendingProps,a===null?Nu(t):gt=a}function Ay(t){var a=t,i=a.alternate;switch(a.tag){case 15:case 0:a=Xv(i,a,a.pendingProps,a.type,void 0,xt);break;case 11:a=Xv(i,a,a.pendingProps,a.type.render,a.ref,xt);break;case 5:Op(a);default:ny(i,a),a=gt=R_(a,Es),a=ey(i,a,Es)}t.memoizedProps=t.pendingProps,a===null?Nu(t):gt=a}function tl(t,a,i,u){xs=Gr=null,Op(a),$o=null,ni=0;var b=a.return;try{if(LE(t,b,a,i,xt)){ln=1,gu(t,Sa(i,t.current)),gt=null;return}}catch(y){if(b!==null)throw gt=b,y;ln=1,gu(t,Sa(i,t.current)),gt=null;return}a.flags&32768?(jt||u===1?t=!0:Zo||(xt&536870912)!==0?t=!1:(ar=t=!0,(u===2||u===9||u===3||u===6)&&(u=pa.current,u!==null&&u.tag===13&&(u.flags|=16384))),My(a,t)):Nu(a)}function Nu(t){var a=t;do{if((a.flags&32768)!==0){My(a,ar);return}t=a.return;var i=BE(a.alternate,a,Es);if(i!==null){gt=i;return}if(a=a.sibling,a!==null){gt=a;return}gt=a=t}while(a!==null);ln===0&&(ln=5)}function My(t,a){do{var i=UE(t.alternate,t);if(i!==null){i.flags&=32767,gt=i;return}if(i=t.return,i!==null&&(i.flags|=32768,i.subtreeFlags=0,i.deletions=null),!a&&(t=t.sibling,t!==null)){gt=t;return}gt=t=i}while(t!==null);ln=6,gt=null}function Oy(t,a,i,u,b,y,M,I,Q){t.cancelPendingCommit=null;do Ru();while(yn!==0);if((Nt&6)!==0)throw Error(o(327));if(a!==null){if(a===t.current)throw Error(o(177));if(y=a.lanes|a.childLanes,y|=op,us(t,i,y,M,I,Q),t===qt&&(gt=qt=null,xt=0),Jo=a,or=t,Ns=i,mm=y,gm=b,jy=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,WE(Ue,function(){return Iy(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=V.T,V.T=null,b=$.p,$.p=2,M=Nt,Nt|=4;try{HE(t,a,i)}finally{Nt=M,$.p=b,V.T=u}}yn=1,zy(),Dy(),Ly()}}function zy(){if(yn===1){yn=0;var t=or,a=Jo,i=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||i){i=V.T,V.T=null;var u=$.p;$.p=2;var b=Nt;Nt|=4;try{my(a,t);var y=Tm,M=v_(t.containerInfo),I=y.focusedElem,Q=y.selectionRange;if(M!==I&&I&&I.ownerDocument&&__(I.ownerDocument.documentElement,I)){if(Q!==null&&tp(I)){var ae=Q.start,fe=Q.end;if(fe===void 0&&(fe=ae),"selectionStart"in I)I.selectionStart=ae,I.selectionEnd=Math.min(fe,I.value.length);else{var xe=I.ownerDocument||document,se=xe&&xe.defaultView||window;if(se.getSelection){var ue=se.getSelection(),He=I.textContent.length,et=Math.min(Q.start,He),It=Q.end===void 0?et:Math.min(Q.end,He);!ue.extend&&et>It&&(M=It,It=et,et=M);var te=b_(I,et),W=b_(I,It);if(te&&W&&(ue.rangeCount!==1||ue.anchorNode!==te.node||ue.anchorOffset!==te.offset||ue.focusNode!==W.node||ue.focusOffset!==W.offset)){var ne=xe.createRange();ne.setStart(te.node,te.offset),ue.removeAllRanges(),et>It?(ue.addRange(ne),ue.extend(W.node,W.offset)):(ne.setEnd(W.node,W.offset),ue.addRange(ne))}}}}for(xe=[],ue=I;ue=ue.parentNode;)ue.nodeType===1&&xe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof I.focus=="function"&&I.focus(),I=0;I<xe.length;I++){var he=xe[I];he.element.scrollLeft=he.left,he.element.scrollTop=he.top}}Hu=!!Rm,Tm=Rm=null}finally{Nt=b,$.p=u,V.T=i}}t.current=a,yn=2}}function Dy(){if(yn===2){yn=0;var t=or,a=Jo,i=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||i){i=V.T,V.T=null;var u=$.p;$.p=2;var b=Nt;Nt|=4;try{cy(t,a.alternate,a)}finally{Nt=b,$.p=u,V.T=i}}yn=3}}function Ly(){if(yn===4||yn===3){yn=0,De();var t=or,a=Jo,i=Ns,u=jy;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?yn=5:(yn=0,Jo=or=null,Py(t,t.pendingLanes));var b=t.pendingLanes;if(b===0&&(rr=null),it(i),a=a.stateNode,Re&&typeof Re.onCommitFiberRoot=="function")try{Re.onCommitFiberRoot(Ee,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=V.T,b=$.p,$.p=2,V.T=null;try{for(var y=t.onRecoverableError,M=0;M<u.length;M++){var I=u[M];y(I.value,{componentStack:I.stack})}}finally{V.T=a,$.p=b}}(Ns&3)!==0&&Ru(),Za(t),b=t.pendingLanes,(i&261930)!==0&&(b&42)!==0?t===hm?_i++:(_i=0,hm=t):_i=0,vi(0)}}function Py(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,ei(a)))}function Ru(){return zy(),Dy(),Ly(),Iy()}function Iy(){if(yn!==5)return!1;var t=or,a=mm;mm=0;var i=it(Ns),u=V.T,b=$.p;try{$.p=32>i?32:i,V.T=null,i=gm,gm=null;var y=or,M=Ns;if(yn=0,Jo=or=null,Ns=0,(Nt&6)!==0)throw Error(o(331));var I=Nt;if(Nt|=4,_y(y.current),hy(y,y.current,M,i),Nt=I,vi(0,!1),Re&&typeof Re.onPostCommitFiberRoot=="function")try{Re.onPostCommitFiberRoot(Ee,y)}catch{}return!0}finally{$.p=b,V.T=u,Py(t,a)}}function By(t,a,i){a=Sa(i,a),a=Xp(t.stateNode,a,2),t=Js(t,a,2),t!==null&&(Qn(t,2),Za(t))}function Ot(t,a,i){if(t.tag===3)By(t,t,i);else for(;a!==null;){if(a.tag===3){By(a,t,i);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(rr===null||!rr.has(u))){t=Sa(i,t),i=Uv(2),u=Js(a,i,2),u!==null&&(Hv(i,u,a,t),Qn(u,2),Za(u));break}}a=a.return}}function _m(t,a,i){var u=t.pingCache;if(u===null){u=t.pingCache=new $E;var b=new Set;u.set(a,b)}else b=u.get(a),b===void 0&&(b=new Set,u.set(a,b));b.has(i)||(dm=!0,b.add(i),t=KE.bind(null,t,a,i),a.then(t,t))}function KE(t,a,i){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&i,t.warmLanes&=~i,qt===t&&(xt&i)===i&&(ln===4||ln===3&&(xt&62914560)===xt&&300>ve()-wu?(Nt&2)===0&&el(t,0):fm|=i,Wo===xt&&(Wo=0)),Za(t)}function Uy(t,a){a===0&&(a=Kn()),t=Vr(t,a),t!==null&&(Qn(t,a),Za(t))}function QE(t){var a=t.memoizedState,i=0;a!==null&&(i=a.retryLane),Uy(t,i)}function ZE(t,a){var i=0;switch(t.tag){case 31:case 13:var u=t.stateNode,b=t.memoizedState;b!==null&&(i=b.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(o(314))}u!==null&&u.delete(a),Uy(t,i)}function WE(t,a){return Be(t,a)}var Tu=null,nl=null,vm=!1,Au=!1,ym=!1,ir=0;function Za(t){t!==nl&&t.next===null&&(nl===null?Tu=nl=t:nl=nl.next=t),Au=!0,vm||(vm=!0,eN())}function vi(t,a){if(!ym&&Au){ym=!0;do for(var i=!1,u=Tu;u!==null;){if(t!==0){var b=u.pendingLanes;if(b===0)var y=0;else{var M=u.suspendedLanes,I=u.pingedLanes;y=(1<<31-st(42|t)+1)-1,y&=b&~(M&~I),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(i=!0,$y(u,y))}else y=xt,y=Ft(u,u===qt?y:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(y&3)===0||dn(u,y)||(i=!0,$y(u,y));u=u.next}while(i);ym=!1}}function JE(){Hy()}function Hy(){Au=vm=!1;var t=0;ir!==0&&uN()&&(t=ir);for(var a=ve(),i=null,u=Tu;u!==null;){var b=u.next,y=Vy(u,a);y===0?(u.next=null,i===null?Tu=b:i.next=b,b===null&&(nl=i)):(i=u,(t!==0||(y&3)!==0)&&(Au=!0)),u=b}yn!==0&&yn!==5||vi(t),ir!==0&&(ir=0)}function Vy(t,a){for(var i=t.suspendedLanes,u=t.pingedLanes,b=t.expirationTimes,y=t.pendingLanes&-62914561;0<y;){var M=31-st(y),I=1<<M,Q=b[M];Q===-1?((I&i)===0||(I&u)!==0)&&(b[M]=On(I,a)):Q<=a&&(t.expiredLanes|=I),y&=~I}if(a=qt,i=xt,i=Ft(t,t===a?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,i===0||t===a&&(Mt===2||Mt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&Xe(u),t.callbackNode=null,t.callbackPriority=0;if((i&3)===0||dn(t,i)){if(a=i&-i,a===t.callbackPriority)return a;switch(u!==null&&Xe(u),it(i)){case 2:case 8:i=ke;break;case 32:i=Ue;break;case 268435456:i=yt;break;default:i=Ue}return u=qy.bind(null,t),i=Be(i,u),t.callbackPriority=a,t.callbackNode=i,a}return u!==null&&u!==null&&Xe(u),t.callbackPriority=2,t.callbackNode=null,2}function qy(t,a){if(yn!==0&&yn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var i=t.callbackNode;if(Ru()&&t.callbackNode!==i)return null;var u=xt;return u=Ft(t,t===qt?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(ky(t,u,a),Vy(t,ve()),t.callbackNode!=null&&t.callbackNode===i?qy.bind(null,t):null)}function $y(t,a){if(Ru())return null;ky(t,a,!0)}function eN(){fN(function(){(Nt&6)!==0?Be(je,JE):Hy()})}function jm(){if(ir===0){var t=Ho;t===0&&(t=Rt,Rt<<=1,(Rt&261888)===0&&(Rt=256)),ir=t}return ir}function Gy(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Bc(""+t)}function Fy(t,a){var i=a.ownerDocument.createElement("input");return i.name=a.name,i.value=a.value,t.id&&i.setAttribute("form",t.id),a.parentNode.insertBefore(i,a),t=new FormData(t),i.parentNode.removeChild(i),t}function tN(t,a,i,u,b){if(a==="submit"&&i&&i.stateNode===b){var y=Gy((b[hn]||null).action),M=u.submitter;M&&(a=(a=M[hn]||null)?Gy(a.formAction):M.getAttribute("formAction"),a!==null&&(y=a,M=null));var I=new qc("action","action",null,u,b);t.push({event:I,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(ir!==0){var Q=M?Fy(b,M):new FormData(b);Vp(i,{pending:!0,data:Q,method:b.method,action:y},null,Q)}}else typeof y=="function"&&(I.preventDefault(),Q=M?Fy(b,M):new FormData(b),Vp(i,{pending:!0,data:Q,method:b.method,action:y},y,Q))},currentTarget:b}]})}}for(var wm=0;wm<rp.length;wm++){var km=rp[wm],nN=km.toLowerCase(),aN=km[0].toUpperCase()+km.slice(1);Ba(nN,"on"+aN)}Ba(w_,"onAnimationEnd"),Ba(k_,"onAnimationIteration"),Ba(S_,"onAnimationStart"),Ba("dblclick","onDoubleClick"),Ba("focusin","onFocus"),Ba("focusout","onBlur"),Ba(_E,"onTransitionRun"),Ba(vE,"onTransitionStart"),Ba(yE,"onTransitionCancel"),Ba(C_,"onTransitionEnd"),Eo("onMouseEnter",["mouseout","mouseover"]),Eo("onMouseLeave",["mouseout","mouseover"]),Eo("onPointerEnter",["pointerout","pointerover"]),Eo("onPointerLeave",["pointerout","pointerover"]),Ir("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ir("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ir("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ir("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ir("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ir("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var yi="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(" "),sN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(yi));function Yy(t,a){a=(a&4)!==0;for(var i=0;i<t.length;i++){var u=t[i],b=u.event;u=u.listeners;e:{var y=void 0;if(a)for(var M=u.length-1;0<=M;M--){var I=u[M],Q=I.instance,ae=I.currentTarget;if(I=I.listener,Q!==y&&b.isPropagationStopped())break e;y=I,b.currentTarget=ae;try{y(b)}catch(fe){Fc(fe)}b.currentTarget=null,y=Q}else for(M=0;M<u.length;M++){if(I=u[M],Q=I.instance,ae=I.currentTarget,I=I.listener,Q!==y&&b.isPropagationStopped())break e;y=I,b.currentTarget=ae;try{y(b)}catch(fe){Fc(fe)}b.currentTarget=null,y=Q}}}}function ht(t,a){var i=a[Dc];i===void 0&&(i=a[Dc]=new Set);var u=t+"__bubble";i.has(u)||(Xy(a,t,2,!1),i.add(u))}function Sm(t,a,i){var u=0;a&&(u|=4),Xy(i,t,u,a)}var Mu="_reactListening"+Math.random().toString(36).slice(2);function Cm(t){if(!t[Mu]){t[Mu]=!0,Hb.forEach(function(i){i!=="selectionchange"&&(sN.has(i)||Sm(i,!1,t),Sm(i,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[Mu]||(a[Mu]=!0,Sm("selectionchange",!1,a))}}function Xy(t,a,i,u){switch(w0(a)){case 2:var b=MN;break;case 8:b=ON;break;default:b=Hm}i=b.bind(null,a,i,t),b=void 0,!Ff||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(b=!0),u?b!==void 0?t.addEventListener(a,i,{capture:!0,passive:b}):t.addEventListener(a,i,!0):b!==void 0?t.addEventListener(a,i,{passive:b}):t.addEventListener(a,i,!1)}function Em(t,a,i,u,b){var y=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var M=u.tag;if(M===3||M===4){var I=u.stateNode.containerInfo;if(I===b)break;if(M===4)for(M=u.return;M!==null;){var Q=M.tag;if((Q===3||Q===4)&&M.stateNode.containerInfo===b)return;M=M.return}for(;I!==null;){if(M=ko(I),M===null)return;if(Q=M.tag,Q===5||Q===6||Q===26||Q===27){u=y=M;continue e}I=I.parentNode}}u=u.return}Jb(function(){var ae=y,fe=$f(i),xe=[];e:{var se=E_.get(t);if(se!==void 0){var ue=qc,He=t;switch(t){case"keypress":if(Hc(i)===0)break e;case"keydown":case"keyup":ue=ZC;break;case"focusin":He="focus",ue=Qf;break;case"focusout":He="blur",ue=Qf;break;case"beforeblur":case"afterblur":ue=Qf;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":ue=n_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=BC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=eE;break;case w_:case k_:case S_:ue=VC;break;case C_:ue=nE;break;case"scroll":case"scrollend":ue=PC;break;case"wheel":ue=sE;break;case"copy":case"cut":case"paste":ue=$C;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=s_;break;case"toggle":case"beforetoggle":ue=oE}var et=(a&4)!==0,It=!et&&(t==="scroll"||t==="scrollend"),te=et?se!==null?se+"Capture":null:se;et=[];for(var W=ae,ne;W!==null;){var he=W;if(ne=he.stateNode,he=he.tag,he!==5&&he!==26&&he!==27||ne===null||te===null||(he=ql(W,te),he!=null&&et.push(ji(W,he,ne))),It)break;W=W.return}0<et.length&&(se=new ue(se,He,null,i,fe),xe.push({event:se,listeners:et}))}}if((a&7)===0){e:{if(se=t==="mouseover"||t==="pointerover",ue=t==="mouseout"||t==="pointerout",se&&i!==qf&&(He=i.relatedTarget||i.fromElement)&&(ko(He)||He[Pr]))break e;if((ue||se)&&(se=fe.window===fe?fe:(se=fe.ownerDocument)?se.defaultView||se.parentWindow:window,ue?(He=i.relatedTarget||i.toElement,ue=ae,He=He?ko(He):null,He!==null&&(It=c(He),et=He.tag,He!==It||et!==5&&et!==27&&et!==6)&&(He=null)):(ue=null,He=ae),ue!==He)){if(et=n_,he="onMouseLeave",te="onMouseEnter",W="mouse",(t==="pointerout"||t==="pointerover")&&(et=s_,he="onPointerLeave",te="onPointerEnter",W="pointer"),It=ue==null?se:Vl(ue),ne=He==null?se:Vl(He),se=new et(he,W+"leave",ue,i,fe),se.target=It,se.relatedTarget=ne,he=null,ko(fe)===ae&&(et=new et(te,W+"enter",He,i,fe),et.target=ne,et.relatedTarget=It,he=et),It=he,ue&&He)t:{for(et=rN,te=ue,W=He,ne=0,he=te;he;he=et(he))ne++;he=0;for(var Ke=W;Ke;Ke=et(Ke))he++;for(;0<ne-he;)te=et(te),ne--;for(;0<he-ne;)W=et(W),he--;for(;ne--;){if(te===W||W!==null&&te===W.alternate){et=te;break t}te=et(te),W=et(W)}et=null}else et=null;ue!==null&&Ky(xe,se,ue,et,!1),He!==null&&It!==null&&Ky(xe,It,He,et,!0)}}e:{if(se=ae?Vl(ae):window,ue=se.nodeName&&se.nodeName.toLowerCase(),ue==="select"||ue==="input"&&se.type==="file")var St=f_;else if(u_(se))if(p_)St=hE;else{St=mE;var $e=pE}else ue=se.nodeName,!ue||ue.toLowerCase()!=="input"||se.type!=="checkbox"&&se.type!=="radio"?ae&&Vf(ae.elementType)&&(St=f_):St=gE;if(St&&(St=St(t,ae))){d_(xe,St,i,fe);break e}$e&&$e(t,se,ae),t==="focusout"&&ae&&se.type==="number"&&ae.memoizedProps.value!=null&&Hf(se,"number",se.value)}switch($e=ae?Vl(ae):window,t){case"focusin":(u_($e)||$e.contentEditable==="true")&&(Oo=$e,np=ae,Zl=null);break;case"focusout":Zl=np=Oo=null;break;case"mousedown":ap=!0;break;case"contextmenu":case"mouseup":case"dragend":ap=!1,y_(xe,i,fe);break;case"selectionchange":if(bE)break;case"keydown":case"keyup":y_(xe,i,fe)}var ct;if(Wf)e:{switch(t){case"compositionstart":var bt="onCompositionStart";break e;case"compositionend":bt="onCompositionEnd";break e;case"compositionupdate":bt="onCompositionUpdate";break e}bt=void 0}else Mo?i_(t,i)&&(bt="onCompositionEnd"):t==="keydown"&&i.keyCode===229&&(bt="onCompositionStart");bt&&(r_&&i.locale!=="ko"&&(Mo||bt!=="onCompositionStart"?bt==="onCompositionEnd"&&Mo&&(ct=e_()):(Fs=fe,Yf="value"in Fs?Fs.value:Fs.textContent,Mo=!0)),$e=Ou(ae,bt),0<$e.length&&(bt=new a_(bt,t,null,i,fe),xe.push({event:bt,listeners:$e}),ct?bt.data=ct:(ct=c_(i),ct!==null&&(bt.data=ct)))),(ct=iE?cE(t,i):uE(t,i))&&(bt=Ou(ae,"onBeforeInput"),0<bt.length&&($e=new a_("onBeforeInput","beforeinput",null,i,fe),xe.push({event:$e,listeners:bt}),$e.data=ct)),tN(xe,t,ae,i,fe)}Yy(xe,a)})}function ji(t,a,i){return{instance:t,listener:a,currentTarget:i}}function Ou(t,a){for(var i=a+"Capture",u=[];t!==null;){var b=t,y=b.stateNode;if(b=b.tag,b!==5&&b!==26&&b!==27||y===null||(b=ql(t,i),b!=null&&u.unshift(ji(t,b,y)),b=ql(t,a),b!=null&&u.push(ji(t,b,y))),t.tag===3)return u;t=t.return}return[]}function rN(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Ky(t,a,i,u,b){for(var y=a._reactName,M=[];i!==null&&i!==u;){var I=i,Q=I.alternate,ae=I.stateNode;if(I=I.tag,Q!==null&&Q===u)break;I!==5&&I!==26&&I!==27||ae===null||(Q=ae,b?(ae=ql(i,y),ae!=null&&M.unshift(ji(i,ae,Q))):b||(ae=ql(i,y),ae!=null&&M.push(ji(i,ae,Q)))),i=i.return}M.length!==0&&t.push({event:a,listeners:M})}var oN=/\r\n?/g,lN=/\u0000|\uFFFD/g;function Qy(t){return(typeof t=="string"?t:""+t).replace(oN,`
49
- `).replace(lN,"")}function Zy(t,a){return a=Qy(a),Qy(t)===a}function Pt(t,a,i,u,b,y){switch(i){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||Ro(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&Ro(t,""+u);break;case"className":Pc(t,"class",u);break;case"tabIndex":Pc(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":Pc(t,i,u);break;case"style":Zb(t,u,y);break;case"data":if(a!=="object"){Pc(t,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||i!=="href")){t.removeAttribute(i);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Bc(""+u),t.setAttribute(i,u);break;case"action":case"formAction":if(typeof u=="function"){t.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 y=="function"&&(i==="formAction"?(a!=="input"&&Pt(t,a,"name",b.name,b,null),Pt(t,a,"formEncType",b.formEncType,b,null),Pt(t,a,"formMethod",b.formMethod,b,null),Pt(t,a,"formTarget",b.formTarget,b,null)):(Pt(t,a,"encType",b.encType,b,null),Pt(t,a,"method",b.method,b,null),Pt(t,a,"target",b.target,b,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(i);break}u=Bc(""+u),t.setAttribute(i,u);break;case"onClick":u!=null&&(t.onclick=ps);break;case"onScroll":u!=null&&ht("scroll",t);break;case"onScrollEnd":u!=null&&ht("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(o(61));if(i=u.__html,i!=null){if(b.children!=null)throw Error(o(60));t.innerHTML=i}}break;case"multiple":t.multiple=u&&typeof u!="function"&&typeof u!="symbol";break;case"muted":t.muted=u&&typeof u!="function"&&typeof u!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(u==null||typeof u=="function"||typeof u=="boolean"||typeof u=="symbol"){t.removeAttribute("xlink:href");break}i=Bc(""+u),t.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":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""+u):t.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":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,""):t.removeAttribute(i);break;case"capture":case"download":u===!0?t.setAttribute(i,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(i,u):t.removeAttribute(i);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(i,u):t.removeAttribute(i);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(i):t.setAttribute(i,u);break;case"popover":ht("beforetoggle",t),ht("toggle",t),Lc(t,"popover",u);break;case"xlinkActuate":fs(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":fs(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":fs(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":fs(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":fs(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":fs(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":fs(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":fs(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":fs(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":Lc(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<i.length)||i[0]!=="o"&&i[0]!=="O"||i[1]!=="n"&&i[1]!=="N")&&(i=DC.get(i)||i,Lc(t,i,u))}}function Nm(t,a,i,u,b,y){switch(i){case"style":Zb(t,u,y);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(o(61));if(i=u.__html,i!=null){if(b.children!=null)throw Error(o(60));t.innerHTML=i}}break;case"children":typeof u=="string"?Ro(t,u):(typeof u=="number"||typeof u=="bigint")&&Ro(t,""+u);break;case"onScroll":u!=null&&ht("scroll",t);break;case"onScrollEnd":u!=null&&ht("scrollend",t);break;case"onClick":u!=null&&(t.onclick=ps);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Vb.hasOwnProperty(i))e:{if(i[0]==="o"&&i[1]==="n"&&(b=i.endsWith("Capture"),a=i.slice(2,b?i.length-7:void 0),y=t[hn]||null,y=y!=null?y[i]:null,typeof y=="function"&&t.removeEventListener(a,y,b),typeof u=="function")){typeof y!="function"&&y!==null&&(i in t?t[i]=null:t.hasAttribute(i)&&t.removeAttribute(i)),t.addEventListener(a,u,b);break e}i in t?t[i]=u:u===!0?t.setAttribute(i,""):Lc(t,i,u)}}}function Nn(t,a,i){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ht("error",t),ht("load",t);var u=!1,b=!1,y;for(y in i)if(i.hasOwnProperty(y)){var M=i[y];if(M!=null)switch(y){case"src":u=!0;break;case"srcSet":b=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:Pt(t,a,y,M,i,null)}}b&&Pt(t,a,"srcSet",i.srcSet,i,null),u&&Pt(t,a,"src",i.src,i,null);return;case"input":ht("invalid",t);var I=y=M=b=null,Q=null,ae=null;for(u in i)if(i.hasOwnProperty(u)){var fe=i[u];if(fe!=null)switch(u){case"name":b=fe;break;case"type":M=fe;break;case"checked":Q=fe;break;case"defaultChecked":ae=fe;break;case"value":y=fe;break;case"defaultValue":I=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(o(137,a));break;default:Pt(t,a,u,fe,i,null)}}Yb(t,y,I,Q,ae,M,b,!1);return;case"select":ht("invalid",t),u=M=y=null;for(b in i)if(i.hasOwnProperty(b)&&(I=i[b],I!=null))switch(b){case"value":y=I;break;case"defaultValue":M=I;break;case"multiple":u=I;default:Pt(t,a,b,I,i,null)}a=y,i=M,t.multiple=!!u,a!=null?No(t,!!u,a,!1):i!=null&&No(t,!!u,i,!0);return;case"textarea":ht("invalid",t),y=b=u=null;for(M in i)if(i.hasOwnProperty(M)&&(I=i[M],I!=null))switch(M){case"value":u=I;break;case"defaultValue":b=I;break;case"children":y=I;break;case"dangerouslySetInnerHTML":if(I!=null)throw Error(o(91));break;default:Pt(t,a,M,I,i,null)}Kb(t,u,b,y);return;case"option":for(Q in i)if(i.hasOwnProperty(Q)&&(u=i[Q],u!=null))switch(Q){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Pt(t,a,Q,u,i,null)}return;case"dialog":ht("beforetoggle",t),ht("toggle",t),ht("cancel",t),ht("close",t);break;case"iframe":case"object":ht("load",t);break;case"video":case"audio":for(u=0;u<yi.length;u++)ht(yi[u],t);break;case"image":ht("error",t),ht("load",t);break;case"details":ht("toggle",t);break;case"embed":case"source":case"link":ht("error",t),ht("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ae in i)if(i.hasOwnProperty(ae)&&(u=i[ae],u!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,a));default:Pt(t,a,ae,u,i,null)}return;default:if(Vf(a)){for(fe in i)i.hasOwnProperty(fe)&&(u=i[fe],u!==void 0&&Nm(t,a,fe,u,i,void 0));return}}for(I in i)i.hasOwnProperty(I)&&(u=i[I],u!=null&&Pt(t,a,I,u,i,null))}function iN(t,a,i,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var b=null,y=null,M=null,I=null,Q=null,ae=null,fe=null;for(ue in i){var xe=i[ue];if(i.hasOwnProperty(ue)&&xe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":Q=xe;default:u.hasOwnProperty(ue)||Pt(t,a,ue,null,u,xe)}}for(var se in u){var ue=u[se];if(xe=i[se],u.hasOwnProperty(se)&&(ue!=null||xe!=null))switch(se){case"type":y=ue;break;case"name":b=ue;break;case"checked":ae=ue;break;case"defaultChecked":fe=ue;break;case"value":M=ue;break;case"defaultValue":I=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(o(137,a));break;default:ue!==xe&&Pt(t,a,se,ue,u,xe)}}Uf(t,M,I,Q,ae,fe,y,b);return;case"select":ue=M=I=se=null;for(y in i)if(Q=i[y],i.hasOwnProperty(y)&&Q!=null)switch(y){case"value":break;case"multiple":ue=Q;default:u.hasOwnProperty(y)||Pt(t,a,y,null,u,Q)}for(b in u)if(y=u[b],Q=i[b],u.hasOwnProperty(b)&&(y!=null||Q!=null))switch(b){case"value":se=y;break;case"defaultValue":I=y;break;case"multiple":M=y;default:y!==Q&&Pt(t,a,b,y,u,Q)}a=I,i=M,u=ue,se!=null?No(t,!!i,se,!1):!!u!=!!i&&(a!=null?No(t,!!i,a,!0):No(t,!!i,i?[]:"",!1));return;case"textarea":ue=se=null;for(I in i)if(b=i[I],i.hasOwnProperty(I)&&b!=null&&!u.hasOwnProperty(I))switch(I){case"value":break;case"children":break;default:Pt(t,a,I,null,u,b)}for(M in u)if(b=u[M],y=i[M],u.hasOwnProperty(M)&&(b!=null||y!=null))switch(M){case"value":se=b;break;case"defaultValue":ue=b;break;case"children":break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(o(91));break;default:b!==y&&Pt(t,a,M,b,u,y)}Xb(t,se,ue);return;case"option":for(var He in i)if(se=i[He],i.hasOwnProperty(He)&&se!=null&&!u.hasOwnProperty(He))switch(He){case"selected":t.selected=!1;break;default:Pt(t,a,He,null,u,se)}for(Q in u)if(se=u[Q],ue=i[Q],u.hasOwnProperty(Q)&&se!==ue&&(se!=null||ue!=null))switch(Q){case"selected":t.selected=se&&typeof se!="function"&&typeof se!="symbol";break;default:Pt(t,a,Q,se,u,ue)}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 et in i)se=i[et],i.hasOwnProperty(et)&&se!=null&&!u.hasOwnProperty(et)&&Pt(t,a,et,null,u,se);for(ae in u)if(se=u[ae],ue=i[ae],u.hasOwnProperty(ae)&&se!==ue&&(se!=null||ue!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(o(137,a));break;default:Pt(t,a,ae,se,u,ue)}return;default:if(Vf(a)){for(var It in i)se=i[It],i.hasOwnProperty(It)&&se!==void 0&&!u.hasOwnProperty(It)&&Nm(t,a,It,void 0,u,se);for(fe in u)se=u[fe],ue=i[fe],!u.hasOwnProperty(fe)||se===ue||se===void 0&&ue===void 0||Nm(t,a,fe,se,u,ue);return}}for(var te in i)se=i[te],i.hasOwnProperty(te)&&se!=null&&!u.hasOwnProperty(te)&&Pt(t,a,te,null,u,se);for(xe in u)se=u[xe],ue=i[xe],!u.hasOwnProperty(xe)||se===ue||se==null&&ue==null||Pt(t,a,xe,se,u,ue)}function Wy(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function cN(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,i=performance.getEntriesByType("resource"),u=0;u<i.length;u++){var b=i[u],y=b.transferSize,M=b.initiatorType,I=b.duration;if(y&&I&&Wy(M)){for(M=0,I=b.responseEnd,u+=1;u<i.length;u++){var Q=i[u],ae=Q.startTime;if(ae>I)break;var fe=Q.transferSize,xe=Q.initiatorType;fe&&Wy(xe)&&(Q=Q.responseEnd,M+=fe*(Q<I?1:(I-ae)/(Q-ae)))}if(--u,a+=8*(y+M)/(b.duration/1e3),t++,10<t)break}}if(0<t)return a/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Rm=null,Tm=null;function zu(t){return t.nodeType===9?t:t.ownerDocument}function Jy(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function e0(t,a){if(t===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&a==="foreignObject"?0:t}function Am(t,a){return t==="textarea"||t==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Mm=null;function uN(){var t=window.event;return t&&t.type==="popstate"?t===Mm?!1:(Mm=t,!0):(Mm=null,!1)}var t0=typeof setTimeout=="function"?setTimeout:void 0,dN=typeof clearTimeout=="function"?clearTimeout:void 0,n0=typeof Promise=="function"?Promise:void 0,fN=typeof queueMicrotask=="function"?queueMicrotask:typeof n0<"u"?function(t){return n0.resolve(null).then(t).catch(pN)}:t0;function pN(t){setTimeout(function(){throw t})}function cr(t){return t==="head"}function a0(t,a){var i=a,u=0;do{var b=i.nextSibling;if(t.removeChild(i),b&&b.nodeType===8)if(i=b.data,i==="/$"||i==="/&"){if(u===0){t.removeChild(b),ol(a);return}u--}else if(i==="$"||i==="$?"||i==="$~"||i==="$!"||i==="&")u++;else if(i==="html")wi(t.ownerDocument.documentElement);else if(i==="head"){i=t.ownerDocument.head,wi(i);for(var y=i.firstChild;y;){var M=y.nextSibling,I=y.nodeName;y[Hl]||I==="SCRIPT"||I==="STYLE"||I==="LINK"&&y.rel.toLowerCase()==="stylesheet"||i.removeChild(y),y=M}}else i==="body"&&wi(t.ownerDocument.body);i=b}while(i);ol(a)}function s0(t,a){var i=t;t=0;do{var u=i.nextSibling;if(i.nodeType===1?a?(i._stashedDisplay=i.style.display,i.style.display="none"):(i.style.display=i._stashedDisplay||"",i.getAttribute("style")===""&&i.removeAttribute("style")):i.nodeType===3&&(a?(i._stashedText=i.nodeValue,i.nodeValue=""):i.nodeValue=i._stashedText||""),u&&u.nodeType===8)if(i=u.data,i==="/$"){if(t===0)break;t--}else i!=="$"&&i!=="$?"&&i!=="$~"&&i!=="$!"||t++;i=u}while(i)}function Om(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var i=a;switch(a=a.nextSibling,i.nodeName){case"HTML":case"HEAD":case"BODY":Om(i),If(i);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(i.rel.toLowerCase()==="stylesheet")continue}t.removeChild(i)}}function mN(t,a,i,u){for(;t.nodeType===1;){var b=i;if(t.nodeName.toLowerCase()!==a.toLowerCase()){if(!u&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(u){if(!t[Hl])switch(a){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(y=t.getAttribute("rel"),y==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(y!==b.rel||t.getAttribute("href")!==(b.href==null||b.href===""?null:b.href)||t.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin)||t.getAttribute("title")!==(b.title==null?null:b.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(y=t.getAttribute("src"),(y!==(b.src==null?null:b.src)||t.getAttribute("type")!==(b.type==null?null:b.type)||t.getAttribute("crossorigin")!==(b.crossOrigin==null?null:b.crossOrigin))&&y&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var y=b.name==null?null:""+b.name;if(b.type==="hidden"&&t.getAttribute("name")===y)return t}else return t;if(t=Ta(t.nextSibling),t===null)break}return null}function gN(t,a,i){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!i||(t=Ta(t.nextSibling),t===null))return null;return t}function r0(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Ta(t.nextSibling),t===null))return null;return t}function zm(t){return t.data==="$?"||t.data==="$~"}function Dm(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function hN(t,a){var i=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||i.readyState!=="loading")a();else{var u=function(){a(),i.removeEventListener("DOMContentLoaded",u)};i.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Ta(t){for(;t!=null;t=t.nextSibling){var a=t.nodeType;if(a===1||a===3)break;if(a===8){if(a=t.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return t}var Lm=null;function o0(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="/$"||i==="/&"){if(a===0)return Ta(t.nextSibling);a--}else i!=="$"&&i!=="$!"&&i!=="$?"&&i!=="$~"&&i!=="&"||a++}t=t.nextSibling}return null}function l0(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var i=t.data;if(i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"){if(a===0)return t;a--}else i!=="/$"&&i!=="/&"||a++}t=t.previousSibling}return null}function i0(t,a,i){switch(a=zu(i),t){case"html":if(t=a.documentElement,!t)throw Error(o(452));return t;case"head":if(t=a.head,!t)throw Error(o(453));return t;case"body":if(t=a.body,!t)throw Error(o(454));return t;default:throw Error(o(451))}}function wi(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);If(t)}var Aa=new Map,c0=new Set;function Du(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Rs=$.d;$.d={f:xN,r:bN,D:_N,C:vN,L:yN,m:jN,X:kN,S:wN,M:SN};function xN(){var t=Rs.f(),a=Cu();return t||a}function bN(t){var a=So(t);a!==null&&a.tag===5&&a.type==="form"?Cv(a):Rs.r(t)}var al=typeof document>"u"?null:document;function u0(t,a,i){var u=al;if(u&&typeof a=="string"&&a){var b=wa(a);b='link[rel="'+t+'"][href="'+b+'"]',typeof i=="string"&&(b+='[crossorigin="'+i+'"]'),c0.has(b)||(c0.add(b),t={rel:t,crossOrigin:i,href:a},u.querySelector(b)===null&&(a=u.createElement("link"),Nn(a,"link",t),jn(a),u.head.appendChild(a)))}}function _N(t){Rs.D(t),u0("dns-prefetch",t,null)}function vN(t,a){Rs.C(t,a),u0("preconnect",t,a)}function yN(t,a,i){Rs.L(t,a,i);var u=al;if(u&&t&&a){var b='link[rel="preload"][as="'+wa(a)+'"]';a==="image"&&i&&i.imageSrcSet?(b+='[imagesrcset="'+wa(i.imageSrcSet)+'"]',typeof i.imageSizes=="string"&&(b+='[imagesizes="'+wa(i.imageSizes)+'"]')):b+='[href="'+wa(t)+'"]';var y=b;switch(a){case"style":y=sl(t);break;case"script":y=rl(t)}Aa.has(y)||(t=_({rel:"preload",href:a==="image"&&i&&i.imageSrcSet?void 0:t,as:a},i),Aa.set(y,t),u.querySelector(b)!==null||a==="style"&&u.querySelector(ki(y))||a==="script"&&u.querySelector(Si(y))||(a=u.createElement("link"),Nn(a,"link",t),jn(a),u.head.appendChild(a)))}}function jN(t,a){Rs.m(t,a);var i=al;if(i&&t){var u=a&&typeof a.as=="string"?a.as:"script",b='link[rel="modulepreload"][as="'+wa(u)+'"][href="'+wa(t)+'"]',y=b;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=rl(t)}if(!Aa.has(y)&&(t=_({rel:"modulepreload",href:t},a),Aa.set(y,t),i.querySelector(b)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(i.querySelector(Si(y)))return}u=i.createElement("link"),Nn(u,"link",t),jn(u),i.head.appendChild(u)}}}function wN(t,a,i){Rs.S(t,a,i);var u=al;if(u&&t){var b=Co(u).hoistableStyles,y=sl(t);a=a||"default";var M=b.get(y);if(!M){var I={loading:0,preload:null};if(M=u.querySelector(ki(y)))I.loading=5;else{t=_({rel:"stylesheet",href:t,"data-precedence":a},i),(i=Aa.get(y))&&Pm(t,i);var Q=M=u.createElement("link");jn(Q),Nn(Q,"link",t),Q._p=new Promise(function(ae,fe){Q.onload=ae,Q.onerror=fe}),Q.addEventListener("load",function(){I.loading|=1}),Q.addEventListener("error",function(){I.loading|=2}),I.loading|=4,Lu(M,a,u)}M={type:"stylesheet",instance:M,count:1,state:I},b.set(y,M)}}}function kN(t,a){Rs.X(t,a);var i=al;if(i&&t){var u=Co(i).hoistableScripts,b=rl(t),y=u.get(b);y||(y=i.querySelector(Si(b)),y||(t=_({src:t,async:!0},a),(a=Aa.get(b))&&Im(t,a),y=i.createElement("script"),jn(y),Nn(y,"link",t),i.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(b,y))}}function SN(t,a){Rs.M(t,a);var i=al;if(i&&t){var u=Co(i).hoistableScripts,b=rl(t),y=u.get(b);y||(y=i.querySelector(Si(b)),y||(t=_({src:t,async:!0,type:"module"},a),(a=Aa.get(b))&&Im(t,a),y=i.createElement("script"),jn(y),Nn(y,"link",t),i.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},u.set(b,y))}}function d0(t,a,i,u){var b=(b=re.current)?Du(b):null;if(!b)throw Error(o(446));switch(t){case"meta":case"title":return null;case"style":return typeof i.precedence=="string"&&typeof i.href=="string"?(a=sl(i.href),i=Co(b).hoistableStyles,u=i.get(a),u||(u={type:"style",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(i.rel==="stylesheet"&&typeof i.href=="string"&&typeof i.precedence=="string"){t=sl(i.href);var y=Co(b).hoistableStyles,M=y.get(t);if(M||(b=b.ownerDocument||b,M={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(t,M),(y=b.querySelector(ki(t)))&&!y._p&&(M.instance=y,M.state.loading=5),Aa.has(t)||(i={rel:"preload",as:"style",href:i.href,crossOrigin:i.crossOrigin,integrity:i.integrity,media:i.media,hrefLang:i.hrefLang,referrerPolicy:i.referrerPolicy},Aa.set(t,i),y||CN(b,t,i,M.state))),a&&u===null)throw Error(o(528,""));return M}if(a&&u!==null)throw Error(o(529,""));return null;case"script":return a=i.async,i=i.src,typeof i=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=rl(i),i=Co(b).hoistableScripts,u=i.get(a),u||(u={type:"script",instance:null,count:0,state:null},i.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,t))}}function sl(t){return'href="'+wa(t)+'"'}function ki(t){return'link[rel="stylesheet"]['+t+"]"}function f0(t){return _({},t,{"data-precedence":t.precedence,precedence:null})}function CN(t,a,i,u){t.querySelector('link[rel="preload"][as="style"]['+a+"]")?u.loading=1:(a=t.createElement("link"),u.preload=a,a.addEventListener("load",function(){return u.loading|=1}),a.addEventListener("error",function(){return u.loading|=2}),Nn(a,"link",i),jn(a),t.head.appendChild(a))}function rl(t){return'[src="'+wa(t)+'"]'}function Si(t){return"script[async]"+t}function p0(t,a,i){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+wa(i.href)+'"]');if(u)return a.instance=u,jn(u),u;var b=_({},i,{"data-href":i.href,"data-precedence":i.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),jn(u),Nn(u,"style",b),Lu(u,i.precedence,t),a.instance=u;case"stylesheet":b=sl(i.href);var y=t.querySelector(ki(b));if(y)return a.state.loading|=4,a.instance=y,jn(y),y;u=f0(i),(b=Aa.get(b))&&Pm(u,b),y=(t.ownerDocument||t).createElement("link"),jn(y);var M=y;return M._p=new Promise(function(I,Q){M.onload=I,M.onerror=Q}),Nn(y,"link",u),a.state.loading|=4,Lu(y,i.precedence,t),a.instance=y;case"script":return y=rl(i.src),(b=t.querySelector(Si(y)))?(a.instance=b,jn(b),b):(u=i,(b=Aa.get(y))&&(u=_({},i),Im(u,b)),t=t.ownerDocument||t,b=t.createElement("script"),jn(b),Nn(b,"link",u),t.head.appendChild(b),a.instance=b);case"void":return null;default:throw Error(o(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,Lu(u,i.precedence,t));return a.instance}function Lu(t,a,i){for(var u=i.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),b=u.length?u[u.length-1]:null,y=b,M=0;M<u.length;M++){var I=u[M];if(I.dataset.precedence===a)y=I;else if(y!==b)break}y?y.parentNode.insertBefore(t,y.nextSibling):(a=i.nodeType===9?i.head:i,a.insertBefore(t,a.firstChild))}function Pm(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function Im(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var Pu=null;function m0(t,a,i){if(Pu===null){var u=new Map,b=Pu=new Map;b.set(i,u)}else b=Pu,u=b.get(i),u||(u=new Map,b.set(i,u));if(u.has(t))return u;for(u.set(t,null),i=i.getElementsByTagName(t),b=0;b<i.length;b++){var y=i[b];if(!(y[Hl]||y[At]||t==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var M=y.getAttribute(a)||"";M=t+M;var I=u.get(M);I?I.push(y):u.set(M,[y])}}return u}function g0(t,a,i){t=t.ownerDocument||t,t.head.insertBefore(i,a==="title"?t.querySelector("head > title"):null)}function EN(t,a,i){if(i===1||a.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;switch(a.rel){case"stylesheet":return t=a.disabled,typeof a.precedence=="string"&&t==null;default:return!0}case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function h0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function NN(t,a,i,u){if(i.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(i.state.loading&4)===0){if(i.instance===null){var b=sl(u.href),y=a.querySelector(ki(b));if(y){a=y._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=Iu.bind(t),a.then(t,t)),i.state.loading|=4,i.instance=y,jn(y);return}y=a.ownerDocument||a,u=f0(u),(b=Aa.get(b))&&Pm(u,b),y=y.createElement("link"),jn(y);var M=y;M._p=new Promise(function(I,Q){M.onload=I,M.onerror=Q}),Nn(y,"link",u),i.instance=y}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(i,a),(a=i.state.preload)&&(i.state.loading&3)===0&&(t.count++,i=Iu.bind(t),a.addEventListener("load",i),a.addEventListener("error",i))}}var Bm=0;function RN(t,a){return t.stylesheets&&t.count===0&&Uu(t,t.stylesheets),0<t.count||0<t.imgCount?function(i){var u=setTimeout(function(){if(t.stylesheets&&Uu(t,t.stylesheets),t.unsuspend){var y=t.unsuspend;t.unsuspend=null,y()}},6e4+a);0<t.imgBytes&&Bm===0&&(Bm=62500*cN());var b=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&Uu(t,t.stylesheets),t.unsuspend)){var y=t.unsuspend;t.unsuspend=null,y()}},(t.imgBytes>Bm?50:800)+a);return t.unsuspend=i,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(b)}}:null}function Iu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Uu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var Bu=null;function Uu(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Bu=new Map,a.forEach(TN,t),Bu=null,Iu.call(t))}function TN(t,a){if(!(a.state.loading&4)){var i=Bu.get(t);if(i)var u=i.get(null);else{i=new Map,Bu.set(t,i);for(var b=t.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<b.length;y++){var M=b[y];(M.nodeName==="LINK"||M.getAttribute("media")!=="not all")&&(i.set(M.dataset.precedence,M),u=M)}u&&i.set(null,u)}b=a.instance,M=b.getAttribute("data-precedence"),y=i.get(M)||u,y===u&&i.set(null,b),i.set(M,b),this.count++,u=Iu.bind(this),b.addEventListener("load",u),b.addEventListener("error",u),y?y.parentNode.insertBefore(b,y.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(b,t.firstChild)),a.state.loading|=4}}var Ci={$$typeof:N,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function AN(t,a,i,u,b,y,M,I,Q){this.tag=1,this.containerInfo=t,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=ca(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ca(0),this.hiddenUpdates=ca(null),this.identifierPrefix=u,this.onUncaughtError=b,this.onCaughtError=y,this.onRecoverableError=M,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Q,this.incompleteTransitions=new Map}function x0(t,a,i,u,b,y,M,I,Q,ae,fe,xe){return t=new AN(t,a,i,M,Q,ae,fe,xe,I),a=1,y===!0&&(a|=24),y=fa(3,null,null,a),t.current=y,y.stateNode=t,a=bp(),a.refCount++,t.pooledCache=a,a.refCount++,y.memoizedState={element:u,isDehydrated:i,cache:a},jp(y),t}function b0(t){return t?(t=Lo,t):Lo}function _0(t,a,i,u,b,y){b=b0(b),u.context===null?u.context=b:u.pendingContext=b,u=Ws(a),u.payload={element:i},y=y===void 0?null:y,y!==null&&(u.callback=y),i=Js(t,u,a),i!==null&&(na(i,t,a),si(i,t,a))}function v0(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var i=t.retryLane;t.retryLane=i!==0&&i<a?i:a}}function Um(t,a){v0(t,a),(t=t.alternate)&&v0(t,a)}function y0(t){if(t.tag===13||t.tag===31){var a=Vr(t,67108864);a!==null&&na(a,t,67108864),Um(t,67108864)}}function j0(t){if(t.tag===13||t.tag===31){var a=xa();a=ds(a);var i=Vr(t,a);i!==null&&na(i,t,a),Um(t,a)}}var Hu=!0;function MN(t,a,i,u){var b=V.T;V.T=null;var y=$.p;try{$.p=2,Hm(t,a,i,u)}finally{$.p=y,V.T=b}}function ON(t,a,i,u){var b=V.T;V.T=null;var y=$.p;try{$.p=8,Hm(t,a,i,u)}finally{$.p=y,V.T=b}}function Hm(t,a,i,u){if(Hu){var b=Vm(u);if(b===null)Em(t,a,u,Vu,i),k0(t,u);else if(DN(b,t,a,i,u))u.stopPropagation();else if(k0(t,u),a&4&&-1<zN.indexOf(t)){for(;b!==null;){var y=So(b);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var M=sn(y.pendingLanes);if(M!==0){var I=y;for(I.pendingLanes|=2,I.entangledLanes|=2;M;){var Q=1<<31-st(M);I.entanglements[1]|=Q,M&=~Q}Za(y),(Nt&6)===0&&(ku=ve()+500,vi(0))}}break;case 31:case 13:I=Vr(y,2),I!==null&&na(I,y,2),Cu(),Um(y,2)}if(y=Vm(u),y===null&&Em(t,a,u,Vu,i),y===b)break;b=y}b!==null&&u.stopPropagation()}else Em(t,a,u,null,i)}}function Vm(t){return t=$f(t),qm(t)}var Vu=null;function qm(t){if(Vu=null,t=ko(t),t!==null){var a=c(t);if(a===null)t=null;else{var i=a.tag;if(i===13){if(t=d(a),t!==null)return t;t=null}else if(i===31){if(t=p(a),t!==null)return t;t=null}else if(i===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return Vu=t,null}function w0(t){switch(t){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(le()){case je:return 2;case ke:return 8;case Ue:case Je:return 32;case yt:return 268435456;default:return 32}default:return 32}}var $m=!1,ur=null,dr=null,fr=null,Ei=new Map,Ni=new Map,pr=[],zN="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 k0(t,a){switch(t){case"focusin":case"focusout":ur=null;break;case"dragenter":case"dragleave":dr=null;break;case"mouseover":case"mouseout":fr=null;break;case"pointerover":case"pointerout":Ei.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ni.delete(a.pointerId)}}function Ri(t,a,i,u,b,y){return t===null||t.nativeEvent!==y?(t={blockedOn:a,domEventName:i,eventSystemFlags:u,nativeEvent:y,targetContainers:[b]},a!==null&&(a=So(a),a!==null&&y0(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,b!==null&&a.indexOf(b)===-1&&a.push(b),t)}function DN(t,a,i,u,b){switch(a){case"focusin":return ur=Ri(ur,t,a,i,u,b),!0;case"dragenter":return dr=Ri(dr,t,a,i,u,b),!0;case"mouseover":return fr=Ri(fr,t,a,i,u,b),!0;case"pointerover":var y=b.pointerId;return Ei.set(y,Ri(Ei.get(y)||null,t,a,i,u,b)),!0;case"gotpointercapture":return y=b.pointerId,Ni.set(y,Ri(Ni.get(y)||null,t,a,i,u,b)),!0}return!1}function S0(t){var a=ko(t.target);if(a!==null){var i=c(a);if(i!==null){if(a=i.tag,a===13){if(a=d(i),a!==null){t.blockedOn=a,kn(t.priority,function(){j0(i)});return}}else if(a===31){if(a=p(i),a!==null){t.blockedOn=a,kn(t.priority,function(){j0(i)});return}}else if(a===3&&i.stateNode.current.memoizedState.isDehydrated){t.blockedOn=i.tag===3?i.stateNode.containerInfo:null;return}}}t.blockedOn=null}function qu(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var i=Vm(t.nativeEvent);if(i===null){i=t.nativeEvent;var u=new i.constructor(i.type,i);qf=u,i.target.dispatchEvent(u),qf=null}else return a=So(i),a!==null&&y0(a),t.blockedOn=i,!1;a.shift()}return!0}function C0(t,a,i){qu(t)&&i.delete(a)}function LN(){$m=!1,ur!==null&&qu(ur)&&(ur=null),dr!==null&&qu(dr)&&(dr=null),fr!==null&&qu(fr)&&(fr=null),Ei.forEach(C0),Ni.forEach(C0)}function $u(t,a){t.blockedOn===a&&(t.blockedOn=null,$m||($m=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,LN)))}var Gu=null;function E0(t){Gu!==t&&(Gu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){Gu===t&&(Gu=null);for(var a=0;a<t.length;a+=3){var i=t[a],u=t[a+1],b=t[a+2];if(typeof u!="function"){if(qm(u||i)===null)continue;break}var y=So(i);y!==null&&(t.splice(a,3),a-=3,Vp(y,{pending:!0,data:b,method:i.method,action:u},u,b))}}))}function ol(t){function a(Q){return $u(Q,t)}ur!==null&&$u(ur,t),dr!==null&&$u(dr,t),fr!==null&&$u(fr,t),Ei.forEach(a),Ni.forEach(a);for(var i=0;i<pr.length;i++){var u=pr[i];u.blockedOn===t&&(u.blockedOn=null)}for(;0<pr.length&&(i=pr[0],i.blockedOn===null);)S0(i),i.blockedOn===null&&pr.shift();if(i=(t.ownerDocument||t).$$reactFormReplay,i!=null)for(u=0;u<i.length;u+=3){var b=i[u],y=i[u+1],M=b[hn]||null;if(typeof y=="function")M||E0(i);else if(M){var I=null;if(y&&y.hasAttribute("formAction")){if(b=y,M=y[hn]||null)I=M.formAction;else if(qm(b)!==null)continue}else I=M.action;typeof I=="function"?i[u+1]=I:(i.splice(u,3),u-=3),E0(i)}}}function N0(){function t(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(M){return b=M})},focusReset:"manual",scroll:"manual"})}function a(){b!==null&&(b(),b=null),u||setTimeout(i,20)}function i(){if(!u&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,b=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(i,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),b!==null&&(b(),b=null)}}}function Gm(t){this._internalRoot=t}Fu.prototype.render=Gm.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(o(409));var i=a.current,u=xa();_0(i,u,t,a,null,null)},Fu.prototype.unmount=Gm.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;_0(t.current,2,null,t,null,null),Cu(),a[Pr]=null}};function Fu(t){this._internalRoot=t}Fu.prototype.unstable_scheduleHydration=function(t){if(t){var a=Dt();t={blockedOn:null,target:t,priority:a};for(var i=0;i<pr.length&&a!==0&&a<pr[i].priority;i++);pr.splice(i,0,t),i===0&&S0(t)}};var R0=n.version;if(R0!=="19.2.7")throw Error(o(527,R0,"19.2.7"));$.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(o(188)):(t=Object.keys(t).join(","),Error(o(268,t)));return t=g(a),t=t!==null?h(t):null,t=t===null?null:t.stateNode,t};var PN={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:V,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yu.isDisabled&&Yu.supportsFiber)try{Ee=Yu.inject(PN),Re=Yu}catch{}}return Ai.createRoot=function(t,a){if(!l(t))throw Error(o(299));var i=!1,u="",b=Lv,y=Pv,M=Iv;return a!=null&&(a.unstable_strictMode===!0&&(i=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(b=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(M=a.onRecoverableError)),a=x0(t,1,!1,null,null,i,u,null,b,y,M,N0),t[Pr]=a.current,Cm(t),new Gm(a)},Ai.hydrateRoot=function(t,a,i){if(!l(t))throw Error(o(299));var u=!1,b="",y=Lv,M=Pv,I=Iv,Q=null;return i!=null&&(i.unstable_strictMode===!0&&(u=!0),i.identifierPrefix!==void 0&&(b=i.identifierPrefix),i.onUncaughtError!==void 0&&(y=i.onUncaughtError),i.onCaughtError!==void 0&&(M=i.onCaughtError),i.onRecoverableError!==void 0&&(I=i.onRecoverableError),i.formState!==void 0&&(Q=i.formState)),a=x0(t,1,!0,a,i??null,u,b,Q,y,M,I,N0),a.context=b0(null),i=a.current,u=xa(),u=ds(u),b=Ws(u),b.callback=null,Js(i,b,u),i=u,a.current.lanes=i,Qn(a,i),Za(a),t[Pr]=a.current,Cm(t),new Fu(a)},Ai.version="19.2.7",Ai}var B0;function XN(){if(B0)return Xm.exports;B0=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(n){console.error(n)}}return e(),Xm.exports=YN(),Xm.exports}var KN=XN();const QN=ex(KN);/**
50
- * react-router v7.17.0
51
- *
52
- * Copyright (c) Remix Software Inc.
53
- *
54
- * This source code is licensed under the MIT license found in the
55
- * LICENSE.md file in the root directory of this source tree.
56
- *
57
- * @license MIT
58
- */var U0="popstate";function H0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function ZN(e={}){function n(o,l){let c=l.state?.masked,{pathname:d,search:p,hash:m}=c||o.location;return dh("",{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 s(o,l){return typeof l=="string"?l:cc(l)}return JN(n,s,null,e)}function en(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function La(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function WN(){return Math.random().toString(36).substring(2,10)}function V0(e,n){return{usr:e.state,key:e.key,idx:n,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function dh(e,n,s=null,o,l){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?Tl(n):n,state:s,key:n&&n.key||o||WN(),mask:l}}function cc({pathname:e="/",search:n="",hash:s=""}){return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(e+=s.charAt(0)==="#"?s:"#"+s),e}function Tl(e){let n={};if(e){let s=e.indexOf("#");s>=0&&(n.hash=e.substring(s),e=e.substring(0,s));let o=e.indexOf("?");o>=0&&(n.search=e.substring(o),e=e.substring(0,o)),e&&(n.pathname=e)}return n}function JN(e,n,s,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 _(){p="POP";let w=h(),C=w==null?null:w-g;g=w,m&&m({action:p,location:j.location,delta:C})}function v(w,C){p="PUSH";let E=H0(w)?w:dh(j.location,w,C);g=h()+1;let N=V0(E,g),R=j.createHref(E.mask||E);try{d.pushState(N,"",R)}catch(T){if(T instanceof DOMException&&T.name==="DataCloneError")throw T;l.location.assign(R)}c&&m&&m({action:p,location:j.location,delta:1})}function k(w,C){p="REPLACE";let E=H0(w)?w:dh(j.location,w,C);g=h();let N=V0(E,g),R=j.createHref(E.mask||E);d.replaceState(N,"",R),c&&m&&m({action:p,location:j.location,delta:0})}function S(w){return eR(l,w)}let j={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(U0,_),m=w,()=>{l.removeEventListener(U0,_),m=null}},createHref(w){return n(l,w)},createURL:S,encodeLocation(w){let C=S(w);return{pathname:C.pathname,search:C.search,hash:C.hash}},push:v,replace:k,go(w){return d.go(w)}};return j}function eR(e,n,s=!1){let o="http://localhost";e&&(o=e.location.origin!=="null"?e.location.origin:e.location.href),en(o,"No window.location.(origin|href) available to create URL");let l=typeof n=="string"?n:cc(n);return l=l.replace(/ $/,"%20"),!s&&l.startsWith("//")&&(l=o+l),new URL(l,o)}function _w(e,n,s="/"){return tR(e,n,s,!1)}function tR(e,n,s,o,l){let c=typeof n=="string"?Tl(n):n,d=Is(c.pathname||"/",s);if(d==null)return null;let p=nR(e),m=null,g=mR(d);for(let h=0;m==null&&h<p.length;++h)m=fR(p[h],g,o);return m}function nR(e){let n=vw(e);return aR(n),n}function vw(e,n=[],s=[],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;en(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 _=$a([o,h.relativePath]),v=s.concat(h);d.children&&d.children.length>0&&(en(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${_}".`),vw(d.children,n,v,_,m)),!(d.path==null&&!d.index)&&n.push({path:_,score:uR(_,d.index),routesMeta:v})};return e.forEach((d,p)=>{if(d.path===""||!d.path?.includes("?"))c(d,p);else for(let m of yw(d.path))c(d,p,!0,m)}),n}function yw(e){let n=e.split("/");if(n.length===0)return[];let[s,...o]=n,l=s.endsWith("?"),c=s.replace(/\?$/,"");if(o.length===0)return l?[c,""]:[c];let d=yw(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 aR(e){e.sort((n,s)=>n.score!==s.score?s.score-n.score:dR(n.routesMeta.map(o=>o.childrenIndex),s.routesMeta.map(o=>o.childrenIndex)))}var sR=/^:[\w-]+$/,rR=3,oR=2,lR=1,iR=10,cR=-2,q0=e=>e==="*";function uR(e,n){let s=e.split("/"),o=s.length;return s.some(q0)&&(o+=cR),n&&(o+=oR),s.filter(l=>!q0(l)).reduce((l,c)=>l+(sR.test(c)?rR:c===""?lR:iR),o)}function dR(e,n){return e.length===n.length&&e.slice(0,-1).every((o,l)=>o===n[l])?e[e.length-1]-n[n.length-1]:0}function fR(e,n,s=!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==="/"?n:n.slice(c.length)||"/",_=Nd({path:m.relativePath,caseSensitive:m.caseSensitive,end:g},h),v=m.route;if(!_&&g&&s&&!o[o.length-1].route.index&&(_=Nd({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},h)),!_)return null;Object.assign(l,_.params),d.push({params:l,pathname:$a([c,_.pathname]),pathnameBase:bR($a([c,_.pathnameBase])),route:v}),_.pathnameBase!=="/"&&(c=$a([c,_.pathnameBase]))}return d}function Nd(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,o]=pR(e.path,e.caseSensitive,e.end),l=n.match(s);if(!l)return null;let c=l[0],d=c.replace(/(.)\/+$/,"$1"),p=l.slice(1);return{params:o.reduce((g,{paramName:h,isOptional:_},v)=>{if(h==="*"){let S=p[v]||"";d=c.slice(0,c.length-S.length).replace(/(.)\/+$/,"$1")}const k=p[v];return _&&!k?g[h]=void 0:g[h]=(k||"").replace(/%2F/g,"/"),g},{}),pathname:c,pathnameBase:d,pattern:e}}function pR(e,n=!1,s=!0){La(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let o=[],l="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,p,m,g,h)=>{if(o.push({paramName:p,isOptional:m!=null}),m){let _=h.charAt(g+d.length);return _&&_!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(o.push({paramName:"*"}),l+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?l+="\\/*$":e!==""&&e!=="/"&&(l+="(?:(?=\\/|$))"),[new RegExp(l,n?void 0:"i"),o]}function mR(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return La(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${n}).`),e}}function Is(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let s=n.endsWith("/")?n.length-1:n.length,o=e.charAt(s);return o&&o!=="/"?null:e.slice(s)||"/"}var gR=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function hR(e,n="/"){let{pathname:s,search:o="",hash:l=""}=typeof e=="string"?Tl(e):e,c;return s?(s=jw(s),s.startsWith("/")?c=$0(s.substring(1),"/"):c=$0(s,n)):c=n,{pathname:c,search:_R(o),hash:vR(l)}}function $0(e,n){let s=Rd(n).split("/");return e.split("/").forEach(l=>{l===".."?s.length>1&&s.pop():l!=="."&&s.push(l)}),s.length>1?s.join("/"):"/"}function Wm(e,n,s,o){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(o)}]. Please separate it out to the \`to.${s}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function xR(e){return e.filter((n,s)=>s===0||n.route.path&&n.route.path.length>0)}function tx(e){let n=xR(e);return n.map((s,o)=>o===n.length-1?s.pathname:s.pathnameBase)}function sf(e,n,s,o=!1){let l;typeof e=="string"?l=Tl(e):(l={...e},en(!l.pathname||!l.pathname.includes("?"),Wm("?","pathname","search",l)),en(!l.pathname||!l.pathname.includes("#"),Wm("#","pathname","hash",l)),en(!l.search||!l.search.includes("#"),Wm("#","search","hash",l)));let c=e===""||l.pathname==="",d=c?"/":l.pathname,p;if(d==null)p=s;else{let _=n.length-1;if(!o&&d.startsWith("..")){let v=d.split("/");for(;v[0]==="..";)v.shift(),_-=1;l.pathname=v.join("/")}p=_>=0?n[_]:"/"}let m=hR(l,p),g=d&&d!=="/"&&d.endsWith("/"),h=(c||d===".")&&s.endsWith("/");return!m.pathname.endsWith("/")&&(g||h)&&(m.pathname+="/"),m}var jw=e=>e.replace(/\/\/+/g,"/"),$a=e=>jw(e.join("/")),Rd=e=>e.replace(/\/+$/,""),bR=e=>Rd(e).replace(/^\/*/,"/"),_R=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,vR=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,yR=class{constructor(e,n,s,o=!1){this.status=e,this.statusText=n||"",this.internal=o,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function jR(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function wR(e){let n=e.map(s=>s.route.path).filter(Boolean);return $a(n)||"/"}var ww=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function kw(e,n){let s=e;if(typeof s!="string"||!gR.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let o=s,l=!1;if(ww)try{let c=new URL(window.location.href),d=s.startsWith("//")?new URL(c.protocol+s):new URL(s),p=Is(d.pathname,n);d.origin===c.origin&&p!=null?s=p+d.search+d.hash:l=!0}catch{La(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:o,isExternal:l,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var Sw=["POST","PUT","PATCH","DELETE"];new Set(Sw);var kR=["GET",...Sw];new Set(kR);var Al=x.createContext(null);Al.displayName="DataRouter";var rf=x.createContext(null);rf.displayName="DataRouterState";var Cw=x.createContext(!1);function SR(){return x.useContext(Cw)}var Ew=x.createContext({isTransitioning:!1});Ew.displayName="ViewTransition";var CR=x.createContext(new Map);CR.displayName="Fetchers";var ER=x.createContext(null);ER.displayName="Await";var ya=x.createContext(null);ya.displayName="Navigation";var Sc=x.createContext(null);Sc.displayName="Location";var Fa=x.createContext({outlet:null,matches:[],isDataRoute:!1});Fa.displayName="Route";var nx=x.createContext(null);nx.displayName="RouteError";var Nw="REACT_ROUTER_ERROR",NR="REDIRECT",RR="ROUTE_ERROR_RESPONSE";function TR(e){if(e.startsWith(`${Nw}:${NR}:{`))try{let n=JSON.parse(e.slice(28));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string"&&typeof n.location=="string"&&typeof n.reloadDocument=="boolean"&&typeof n.replace=="boolean")return n}catch{}}function AR(e){if(e.startsWith(`${Nw}:${RR}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new yR(n.status,n.statusText,n.data)}catch{}}function MR(e,{relative:n}={}){en(Ml(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:o}=x.useContext(ya),{hash:l,pathname:c,search:d}=Cc(e,{relative:n}),p=c;return s!=="/"&&(p=c==="/"?s:$a([s,c])),o.createHref({pathname:p,search:d,hash:l})}function Ml(){return x.useContext(Sc)!=null}function Yn(){return en(Ml(),"useLocation() may be used only in the context of a <Router> component."),x.useContext(Sc).location}var Rw="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Tw(e){x.useContext(ya).static||x.useLayoutEffect(e)}function la(){let{isDataRoute:e}=x.useContext(Fa);return e?GR():OR()}function OR(){en(Ml(),"useNavigate() may be used only in the context of a <Router> component.");let e=x.useContext(Al),{basename:n,navigator:s}=x.useContext(ya),{matches:o}=x.useContext(Fa),{pathname:l}=Yn(),c=JSON.stringify(tx(o)),d=x.useRef(!1);return Tw(()=>{d.current=!0}),x.useCallback((m,g={})=>{if(La(d.current,Rw),!d.current)return;if(typeof m=="number"){s.go(m);return}let h=sf(m,JSON.parse(c),l,g.relative==="path");e==null&&n!=="/"&&(h.pathname=h.pathname==="/"?n:$a([n,h.pathname])),(g.replace?s.replace:s.push)(h,g.state,g)},[n,s,c,l,e])}x.createContext(null);function Aw(){let{matches:e}=x.useContext(Fa);return e[e.length-1]?.params??{}}function Cc(e,{relative:n}={}){let{matches:s}=x.useContext(Fa),{pathname:o}=Yn(),l=JSON.stringify(tx(s));return x.useMemo(()=>sf(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function zR(e,n){return Mw(e,n)}function Mw(e,n,s){en(Ml(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:o}=x.useContext(ya),{matches:l}=x.useContext(Fa),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||"";zw(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=Yn(),_;if(n){let w=typeof n=="string"?Tl(n):n;en(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.`),_=w}else _=h;let v=_.pathname||"/",k=v;if(m!=="/"){let w=m.replace(/^\//,"").split("/");k="/"+v.replace(/^\//,"").split("/").slice(w.length).join("/")}let S=s&&s.state.matches.length?s.state.matches.map(w=>Object.assign(w,{route:s.manifest[w.route.id]||w.route})):_w(e,{pathname:k});La(g||S!=null,`No routes matched location "${_.pathname}${_.search}${_.hash}" `),La(S==null||S[S.length-1].route.element!==void 0||S[S.length-1].route.Component!==void 0||S[S.length-1].route.lazy!==void 0,`Matched leaf route at location "${_.pathname}${_.search}${_.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 j=BR(S&&S.map(w=>Object.assign({},w,{params:Object.assign({},d,w.params),pathname:$a([m,o.encodeLocation?o.encodeLocation(w.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathname]),pathnameBase:w.pathnameBase==="/"?m:$a([m,o.encodeLocation?o.encodeLocation(w.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:w.pathnameBase])})),l,s);return n&&j?x.createElement(Sc.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,..._},navigationType:"POP"}},j):j}function DR(){let e=$R(),n=jR(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,o="rgba(200,200,200, 0.5)",l={padding:"0.5rem",backgroundColor:o},c={padding:"2px 4px",backgroundColor:o},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"}},n),s?x.createElement("pre",{style:l},s):null,d)}var LR=x.createElement(DR,null),Ow=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,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){this.props.onError?this.props.onError(e,n):console.error("React Router caught the following error during render",e)}render(){let e=this.state.error;if(this.context&&typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){const s=AR(e.digest);s&&(e=s)}let n=e!==void 0?x.createElement(Fa.Provider,{value:this.props.routeContext},x.createElement(nx.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?x.createElement(PR,{error:e},n):n}};Ow.contextType=Cw;var Jm=new WeakMap;function PR({children:e,error:n}){let{basename:s}=x.useContext(ya);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let o=TR(n.digest);if(o){let l=Jm.get(n);if(l)throw l;let c=kw(o.location,s);if(ww&&!Jm.get(n))if(c.isExternal||o.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:o.replace}));throw Jm.set(n,d),d}return x.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function IR({routeContext:e,match:n,children:s}){let o=x.useContext(Al);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),x.createElement(Fa.Provider,{value:e},s)}function BR(e,n=[],s){let o=s?.state;if(e==null){if(!o)return null;if(o.errors)e=o.matches;else if(n.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(_=>_.route.id&&c?.[_.route.id]!==void 0);en(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(s&&o){d=o.renderFallback;for(let h=0;h<l.length;h++){let _=l[h];if((_.route.HydrateFallback||_.route.hydrateFallbackElement)&&(p=h),_.route.id){let{loaderData:v,errors:k}=o,S=_.route.loader&&!v.hasOwnProperty(_.route.id)&&(!k||k[_.route.id]===void 0);if(_.route.lazy||S){s.isStatic&&(d=!0),p>=0?l=l.slice(0,p+1):l=[l[0]];break}}}}let m=s?.onError,g=o&&m?(h,_)=>{m(h,{location:o.location,params:o.matches?.[0]?.params??{},pattern:wR(o.matches),errorInfo:_})}:void 0;return l.reduceRight((h,_,v)=>{let k,S=!1,j=null,w=null;o&&(k=c&&_.route.id?c[_.route.id]:void 0,j=_.route.errorElement||LR,d&&(p<0&&v===0?(zw("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),S=!0,w=null):p===v&&(S=!0,w=_.route.hydrateFallbackElement||null)));let C=n.concat(l.slice(0,v+1)),E=()=>{let N;return k?N=j:S?N=w:_.route.Component?N=x.createElement(_.route.Component,null):_.route.element?N=_.route.element:N=h,x.createElement(IR,{match:_,routeContext:{outlet:h,matches:C,isDataRoute:o!=null},children:N})};return o&&(_.route.ErrorBoundary||_.route.errorElement||v===0)?x.createElement(Ow,{location:o.location,revalidation:o.revalidation,component:j,error:k,children:E(),routeContext:{outlet:null,matches:C,isDataRoute:!0},onError:g}):E()},null)}function ax(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function UR(e){let n=x.useContext(Al);return en(n,ax(e)),n}function HR(e){let n=x.useContext(rf);return en(n,ax(e)),n}function VR(e){let n=x.useContext(Fa);return en(n,ax(e)),n}function sx(e){let n=VR(e),s=n.matches[n.matches.length-1];return en(s.route.id,`${e} can only be used on routes that contain a unique "id"`),s.route.id}function qR(){return sx("useRouteId")}function $R(){let e=x.useContext(nx),n=HR("useRouteError"),s=sx("useRouteError");return e!==void 0?e:n.errors?.[s]}function GR(){let{router:e}=UR("useNavigate"),n=sx("useNavigate"),s=x.useRef(!1);return Tw(()=>{s.current=!0}),x.useCallback(async(l,c={})=>{La(s.current,Rw),s.current&&(typeof l=="number"?await e.navigate(l):await e.navigate(l,{fromRouteId:n,...c}))},[e,n])}var G0={};function zw(e,n,s){!n&&!G0[e]&&(G0[e]=!0,La(!1,s))}x.memo(FR);function FR({routes:e,manifest:n,future:s,state:o,isStatic:l,onError:c}){return Mw(e,void 0,{manifest:n,state:o,isStatic:l,onError:c})}function YR({to:e,replace:n,state:s,relative:o}){en(Ml(),"<Navigate> may be used only in the context of a <Router> component.");let{static:l}=x.useContext(ya);La(!l,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:c}=x.useContext(Fa),{pathname:d}=Yn(),p=la(),m=sf(e,tx(c),d,o==="path"),g=JSON.stringify(m);return x.useEffect(()=>{p(JSON.parse(g),{replace:n,state:s,relative:o})},[p,g,o,n,s]),null}function $t(e){en(!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 XR({basename:e="/",children:n=null,location:s,navigationType:o="POP",navigator:l,static:c=!1,useTransitions:d}){en(!Ml(),"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 s=="string"&&(s=Tl(s));let{pathname:g="/",search:h="",hash:_="",state:v=null,key:k="default",mask:S}=s,j=x.useMemo(()=>{let w=Is(g,p);return w==null?null:{location:{pathname:w,search:h,hash:_,state:v,key:k,mask:S},navigationType:o}},[p,g,h,_,v,k,o,S]);return La(j!=null,`<Router basename="${p}"> is not able to match the URL "${g}${h}${_}" because it does not start with the basename, so the <Router> won't render anything.`),j==null?null:x.createElement(ya.Provider,{value:m},x.createElement(Sc.Provider,{children:n,value:j}))}function Dw({children:e,location:n}){return zR(fh(e),n)}function fh(e,n=[]){let s=[];return x.Children.forEach(e,(o,l)=>{if(!x.isValidElement(o))return;let c=[...n,l];if(o.type===x.Fragment){s.push.apply(s,fh(o.props.children,c));return}en(o.type===$t,`[${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>`),en(!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=fh(o.props.children,c)),s.push(d)}),s}var bd="get",_d="application/x-www-form-urlencoded";function of(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function KR(e){return of(e)&&e.tagName.toLowerCase()==="button"}function QR(e){return of(e)&&e.tagName.toLowerCase()==="form"}function ZR(e){return of(e)&&e.tagName.toLowerCase()==="input"}function WR(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function JR(e,n){return e.button===0&&(!n||n==="_self")&&!WR(e)}function ph(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,s)=>{let o=e[s];return n.concat(Array.isArray(o)?o.map(l=>[s,l]):[[s,o]])},[]))}function eT(e,n){let s=ph(e);return n&&n.forEach((o,l)=>{s.has(l)||n.getAll(l).forEach(c=>{s.append(l,c)})}),s}var Xu=null;function tT(){if(Xu===null)try{new FormData(document.createElement("form"),0),Xu=!1}catch{Xu=!0}return Xu}var nT=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function eg(e){return e!=null&&!nT.has(e)?(La(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${_d}"`),null):e}function aT(e,n){let s,o,l,c,d;if(QR(e)){let p=e.getAttribute("action");o=p?Is(p,n):null,s=e.getAttribute("method")||bd,l=eg(e.getAttribute("enctype"))||_d,c=new FormData(e)}else if(KR(e)||ZR(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?Is(m,n):null,s=e.getAttribute("formmethod")||p.getAttribute("method")||bd,l=eg(e.getAttribute("formenctype"))||eg(p.getAttribute("enctype"))||_d,c=new FormData(p,e),!tT()){let{name:g,type:h,value:_}=e;if(h==="image"){let v=g?`${g}.`:"";c.append(`${v}x`,"0"),c.append(`${v}y`,"0")}else g&&c.append(g,_)}}else{if(of(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=bd,o=null,l=_d,d=e}return c&&l==="text/plain"&&(d=c,c=void 0),{action:o,method:s.toLowerCase(),encType:l,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function rx(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Lw(e,n,s,o){let l=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return s?l.pathname.endsWith("/")?l.pathname=`${l.pathname}_.${o}`:l.pathname=`${l.pathname}.${o}`:l.pathname==="/"?l.pathname=`_root.${o}`:n&&Is(l.pathname,n)==="/"?l.pathname=`${Rd(n)}/_root.${o}`:l.pathname=`${Rd(l.pathname)}.${o}`,l}async function sT(e,n){if(e.id in n)return n[e.id];try{let s=await import(e.module);return n[e.id]=s,s}catch(s){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(s),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function rT(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 oT(e,n,s){let o=await Promise.all(e.map(async l=>{let c=n.routes[l.route.id];if(c){let d=await sT(c,s);return d.links?d.links():[]}return[]}));return uT(o.flat(1).filter(rT).filter(l=>l.rel==="stylesheet"||l.rel==="preload").map(l=>l.rel==="stylesheet"?{...l,rel:"prefetch",as:"style"}:{...l,rel:"prefetch"}))}function F0(e,n,s,o,l,c){let d=(m,g)=>s[g]?m.route.id!==s[g].route.id:!0,p=(m,g)=>s[g].pathname!==m.pathname||s[g].route.path?.endsWith("*")&&s[g].params["*"]!==m.params["*"];return c==="assets"?n.filter((m,g)=>d(m,g)||p(m,g)):c==="data"?n.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 _=m.route.shouldRevalidate({currentUrl:new URL(l.pathname+l.search+l.hash,window.origin),currentParams:s[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof _=="boolean")return _}return!0}):[]}function lT(e,n,{includeHydrateFallback:s}={}){return iT(e.map(o=>{let l=n.routes[o.route.id];if(!l)return[];let c=[l.module];return l.clientActionModule&&(c=c.concat(l.clientActionModule)),l.clientLoaderModule&&(c=c.concat(l.clientLoaderModule)),s&&l.hydrateFallbackModule&&(c=c.concat(l.hydrateFallbackModule)),l.imports&&(c=c.concat(l.imports)),c}).flat(1))}function iT(e){return[...new Set(e)]}function cT(e){let n={},s=Object.keys(e).sort();for(let o of s)n[o]=e[o];return n}function uT(e,n){let s=new Set;return new Set(n),e.reduce((o,l)=>{let c=JSON.stringify(cT(l));return s.has(c)||(s.add(c),o.push({key:c,link:l})),o},[])}function ox(){let e=x.useContext(Al);return rx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function dT(){let e=x.useContext(rf);return rx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var lx=x.createContext(void 0);lx.displayName="FrameworkContext";function ix(){let e=x.useContext(lx);return rx(e,"You must render this element inside a <HydratedRouter> element"),e}function fT(e,n){let s=x.useContext(lx),[o,l]=x.useState(!1),[c,d]=x.useState(!1),{onFocus:p,onBlur:m,onMouseEnter:g,onMouseLeave:h,onTouchStart:_}=n,v=x.useRef(null);x.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let j=C=>{C.forEach(E=>{d(E.isIntersecting)})},w=new IntersectionObserver(j,{threshold:.5});return v.current&&w.observe(v.current),()=>{w.disconnect()}}},[e]),x.useEffect(()=>{if(o){let j=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(j)}}},[o]);let k=()=>{l(!0)},S=()=>{l(!1),d(!1)};return s?e!=="intent"?[c,v,{}]:[c,v,{onFocus:Mi(p,k),onBlur:Mi(m,S),onMouseEnter:Mi(g,k),onMouseLeave:Mi(h,S),onTouchStart:Mi(_,k)}]:[!1,v,{}]}function Mi(e,n){return s=>{e&&e(s),s.defaultPrevented||n(s)}}function pT({page:e,...n}){let s=SR(),{router:o}=ox(),l=x.useMemo(()=>_w(o.routes,e,o.basename),[o.routes,e,o.basename]);return l?s?x.createElement(gT,{page:e,matches:l,...n}):x.createElement(hT,{page:e,matches:l,...n}):null}function mT(e){let{manifest:n,routeModules:s}=ix(),[o,l]=x.useState([]);return x.useEffect(()=>{let c=!1;return oT(e,n,s).then(d=>{c||l(d)}),()=>{c=!0}},[e,n,s]),o}function gT({page:e,matches:n,...s}){let o=Yn(),{future:l}=ix(),{basename:c}=ox(),d=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let p=Lw(e,c,l.v8_trailingSlashAwareDataRequests,"rsc"),m=!1,g=[];for(let h of n)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,n]);return x.createElement(x.Fragment,null,d.map(p=>x.createElement("link",{key:p,rel:"prefetch",as:"fetch",href:p,...s})))}function hT({page:e,matches:n,...s}){let o=Yn(),{future:l,manifest:c,routeModules:d}=ix(),{basename:p}=ox(),{loaderData:m,matches:g}=dT(),h=x.useMemo(()=>F0(e,n,g,c,o,"data"),[e,n,g,c,o]),_=x.useMemo(()=>F0(e,n,g,c,o,"assets"),[e,n,g,c,o]),v=x.useMemo(()=>{if(e===o.pathname+o.search+o.hash)return[];let j=new Set,w=!1;if(n.forEach(E=>{let N=c.routes[E.route.id];!N||!N.hasLoader||(!h.some(R=>R.route.id===E.route.id)&&E.route.id in m&&d[E.route.id]?.shouldRevalidate||N.hasClientLoader?w=!0:j.add(E.route.id))}),j.size===0)return[];let C=Lw(e,p,l.v8_trailingSlashAwareDataRequests,"data");return w&&j.size>0&&C.searchParams.set("_routes",n.filter(E=>j.has(E.route.id)).map(E=>E.route.id).join(",")),[C.pathname+C.search]},[p,l.v8_trailingSlashAwareDataRequests,m,o,c,h,n,e,d]),k=x.useMemo(()=>lT(_,c),[_,c]),S=mT(_);return x.createElement(x.Fragment,null,v.map(j=>x.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...s})),k.map(j=>x.createElement("link",{key:j,rel:"modulepreload",href:j,...s})),S.map(({key:j,link:w})=>x.createElement("link",{key:j,nonce:s.nonce,...w,crossOrigin:w.crossOrigin??s.crossOrigin})))}function xT(...e){return n=>{e.forEach(s=>{typeof s=="function"?s(n):s!=null&&(s.current=n)})}}var bT=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{bT&&(window.__reactRouterVersion="7.17.0")}catch{}function _T({basename:e,children:n,useTransitions:s,window:o}){let l=x.useRef();l.current==null&&(l.current=ZN({window:o,v5Compat:!0}));let c=l.current,[d,p]=x.useState({action:c.action,location:c.location}),m=x.useCallback(g=>{s===!1?p(g):x.startTransition(()=>p(g))},[s]);return x.useLayoutEffect(()=>c.listen(m),[c,m]),x.createElement(XR,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:s})}var Pw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,cx=x.forwardRef(function({onClick:n,discover:s="render",prefetch:o="none",relative:l,reloadDocument:c,replace:d,mask:p,state:m,target:g,to:h,preventScrollReset:_,viewTransition:v,defaultShouldRevalidate:k,...S},j){let{basename:w,navigator:C,useTransitions:E}=x.useContext(ya),N=typeof h=="string"&&Pw.test(h),R=kw(h,w);h=R.to;let T=MR(h,{relative:l}),O=Yn(),A=null;if(p){let Y=sf(p,[],O.mask?O.mask.pathname:"/",!0);w!=="/"&&(Y.pathname=Y.pathname==="/"?w:$a([w,Y.pathname])),A=C.createHref(Y)}let[z,B,L]=fT(o,S),D=jT(h,{replace:d,mask:p,state:m,target:g,preventScrollReset:_,relative:l,viewTransition:v,defaultShouldRevalidate:k,useTransitions:E});function P(Y){n&&n(Y),Y.defaultPrevented||D(Y)}let H=!(R.isExternal||c),q=x.createElement("a",{...S,...L,href:(H?A:void 0)||R.absoluteURL||T,onClick:H?P:n,ref:xT(j,B),target:g,"data-discover":!N&&s==="render"?"true":void 0});return z&&!N?x.createElement(x.Fragment,null,q,x.createElement(pT,{page:T})):q});cx.displayName="Link";var Iw=x.forwardRef(function({"aria-current":n="page",caseSensitive:s=!1,className:o="",end:l=!1,style:c,to:d,viewTransition:p,children:m,...g},h){let _=Cc(d,{relative:g.relative}),v=Yn(),k=x.useContext(rf),{navigator:S,basename:j}=x.useContext(ya),w=k!=null&&ET(_)&&p===!0,C=S.encodeLocation?S.encodeLocation(_).pathname:_.pathname,E=v.pathname,N=k&&k.navigation&&k.navigation.location?k.navigation.location.pathname:null;s||(E=E.toLowerCase(),N=N?N.toLowerCase():null,C=C.toLowerCase()),N&&j&&(N=Is(N,j)||N);const R=C!=="/"&&C.endsWith("/")?C.length-1:C.length;let T=E===C||!l&&E.startsWith(C)&&E.charAt(R)==="/",O=N!=null&&(N===C||!l&&N.startsWith(C)&&N.charAt(C.length)==="/"),A={isActive:T,isPending:O,isTransitioning:w},z=T?n:void 0,B;typeof o=="function"?B=o(A):B=[o,T?"active":null,O?"pending":null,w?"transitioning":null].filter(Boolean).join(" ");let L=typeof c=="function"?c(A):c;return x.createElement(cx,{...g,"aria-current":z,className:B,ref:h,style:L,to:d,viewTransition:p},typeof m=="function"?m(A):m)});Iw.displayName="NavLink";var vT=x.forwardRef(({discover:e="render",fetcherKey:n,navigate:s,reloadDocument:o,replace:l,state:c,method:d=bd,action:p,onSubmit:m,relative:g,preventScrollReset:h,viewTransition:_,defaultShouldRevalidate:v,...k},S)=>{let{useTransitions:j}=x.useContext(ya),w=ST(),C=CT(p,{relative:g}),E=d.toLowerCase()==="get"?"get":"post",N=typeof p=="string"&&Pw.test(p),R=T=>{if(m&&m(T),T.defaultPrevented)return;T.preventDefault();let O=T.nativeEvent.submitter,A=O?.getAttribute("formmethod")||d,z=()=>w(O||T.currentTarget,{fetcherKey:n,method:A,navigate:s,replace:l,state:c,relative:g,preventScrollReset:h,viewTransition:_,defaultShouldRevalidate:v});j&&s!==!1?x.startTransition(()=>z()):z()};return x.createElement("form",{ref:S,method:E,action:C,onSubmit:o?m:R,...k,"data-discover":!N&&e==="render"?"true":void 0})});vT.displayName="Form";function yT(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Bw(e){let n=x.useContext(Al);return en(n,yT(e)),n}function jT(e,{target:n,replace:s,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:p,defaultShouldRevalidate:m,useTransitions:g}={}){let h=la(),_=Yn(),v=Cc(e,{relative:d});return x.useCallback(k=>{if(JR(k,n)){k.preventDefault();let S=s!==void 0?s:cc(_)===cc(v),j=()=>h(e,{replace:S,mask:o,state:l,preventScrollReset:c,relative:d,viewTransition:p,defaultShouldRevalidate:m});g?x.startTransition(()=>j()):j()}},[_,h,v,s,o,l,n,e,c,d,p,m,g])}function Uw(e){La(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let n=x.useRef(ph(e)),s=x.useRef(!1),o=Yn(),l=x.useMemo(()=>eT(o.search,s.current?null:n.current),[o.search]),c=la(),d=x.useCallback((p,m)=>{const g=ph(typeof p=="function"?p(new URLSearchParams(l)):p);s.current=!0,c("?"+g,m)},[c,l]);return[l,d]}var wT=0,kT=()=>`__${String(++wT)}__`;function ST(){let{router:e}=Bw("useSubmit"),{basename:n}=x.useContext(ya),s=qR(),o=e.fetch,l=e.navigate;return x.useCallback(async(c,d={})=>{let{action:p,method:m,encType:g,formData:h,body:_}=aT(c,n);if(d.navigate===!1){let v=d.fetcherKey||kT();await o(v,s,d.action||p,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:_,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:_,formMethod:d.method||m,formEncType:d.encType||g,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[o,l,n,s])}function CT(e,{relative:n}={}){let{basename:s}=x.useContext(ya),o=x.useContext(Fa);en(o,"useFormAction must be used inside a RouteContext");let[l]=o.matches.slice(-1),c={...Cc(e||".",{relative:n})},d=Yn();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(_=>_).forEach(_=>p.append("index",_));let h=p.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&l.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(c.pathname=c.pathname==="/"?s:$a([s,c.pathname])),cc(c)}function ET(e,{relative:n}={}){let s=x.useContext(Ew);en(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:o}=Bw("useViewTransitionState"),l=Cc(e,{relative:n});if(!s.isTransitioning)return!1;let c=Is(s.currentLocation.pathname,o)||s.currentLocation.pathname,d=Is(s.nextLocation.pathname,o)||s.nextLocation.pathname;return Nd(l.pathname,d)!=null||Nd(l.pathname,c)!=null}var Tr=bw();/**
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 NT=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Hw=(...e)=>e.filter((n,s,o)=>!!n&&n.trim()!==""&&o.indexOf(n)===s).join(" ").trim();/**
66
- * @license lucide-react v0.469.0 - ISC
67
- *
68
- * This source code is licensed under the ISC license.
69
- * See the LICENSE file in the root directory of this source tree.
70
- */var RT={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 TT=x.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:o,className:l="",children:c,iconNode:d,...p},m)=>x.createElement("svg",{ref:m,...RT,width:n,height:n,stroke:e,strokeWidth:o?Number(s)*24/Number(n):s,className:Hw("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 ye=(e,n)=>{const s=x.forwardRef(({className:o,...l},c)=>x.createElement(TT,{ref:c,iconNode:n,className:Hw(`lucide-${NT(e)}`,o),...l}));return s.displayName=`${e}`,s};/**
81
- * @license lucide-react v0.469.0 - ISC
82
- *
83
- * This source code is licensed under the ISC license.
84
- * See the LICENSE file in the root directory of this source tree.
85
- */const Vw=ye("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 qw=ye("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 AT=ye("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 $w=ye("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 Gw=ye("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 MT=ye("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 OT=ye("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"}]]);/**
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 gn=ye("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"}]]);/**
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 zT=ye("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"}]]);/**
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 DT=ye("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"}]]);/**
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 Td=ye("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"}]]);/**
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 uc=ye("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
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 Ar=ye("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
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 Ec=ye("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
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 Fw=ye("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
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 LT=ye("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
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 ux=ye("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
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 PT=ye("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"}]]);/**
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 IT=ye("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
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 BT=ye("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"}]]);/**
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 UT=ye("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
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 HT=ye("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
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 Ad=ye("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"}]]);/**
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 VT=ye("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
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 qT=ye("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
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 dx=ye("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"}]]);/**
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 Bs=ye("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"}]]);/**
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 Yw=ye("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"}]]);/**
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 $T=ye("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"}]]);/**
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 GT=ye("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"}]]);/**
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 lf=ye("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"}]]);/**
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 FT=ye("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"}]]);/**
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 Md=ye("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"}]]);/**
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 YT=ye("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"}]]);/**
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 XT=ye("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"}]]);/**
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 KT=ye("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"}]]);/**
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 QT=ye("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"}]]);/**
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 ZT=ye("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"}]]);/**
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 Xw=ye("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"}]]);/**
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 WT=ye("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"}]]);/**
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 Kw=ye("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"}]]);/**
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 fx=ye("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"}]]);/**
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 Qw=ye("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"}]]);/**
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 JT=ye("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"}]]);/**
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 cf=ye("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
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 eA=ye("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"}]]);/**
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=ye("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"}]]);/**
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 tA=ye("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"}]]);/**
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 nA=ye("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"}]]);/**
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 _l=ye("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"}]]);/**
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 aA=ye("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"}]]);/**
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 sA=ye("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"}]]);/**
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 rA=ye("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
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 mh=ye("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"}]]);/**
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 oA=ye("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"}]]);/**
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 lA=ye("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"}]]);/**
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 iA=ye("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"}]]);/**
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 cA=ye("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"}]]);/**
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 uf=ye("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 Zw=ye("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"}]]);/**
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 mx=ye("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"}]]);/**
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 Od=ye("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"}]]);/**
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 Ww=ye("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"}]]);/**
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 Jw=ye("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"}]]);/**
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 uA=ye("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
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 dA=ye("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"}]]);/**
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 fA=ye("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
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 ek=ye("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
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 pA=ye("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
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 Ol=ye("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"}]]);/**
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=ye("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 mA=ye("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"}]]);/**
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 nn=ye("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 gh=ye("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"}]]);/**
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 gA=ye("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"}]]);/**
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 os=ye("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"}]]);/**
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 hx=ye("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"}]]);/**
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 df=ye("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"}]]);/**
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 zd=ye("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"}]]);/**
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 vd=ye("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
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 Ya=ye("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"}]]);/**
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 tk=ye("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"}]]);/**
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 hA=ye("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"}]]);/**
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 Dd=ye("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"}]]);/**
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 xA=ye("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
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 ls=ye("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"}]]);/**
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 bA=ye("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"}]]);/**
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 nk=ye("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
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 _A=ye("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"}]]);/**
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 Er=ye("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
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 vA=ye("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"}]]);/**
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 ia=ye("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"}]]);/**
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 ak=ye("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"}]]);/**
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 yA=ye("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"}]]);/**
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 xx=ye("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"}]]);/**
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 jA=ye("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"}]]);/**
561
- * @license lucide-react v0.469.0 - ISC
562
- *
563
- * This source code is licensed under the ISC license.
564
- * See the LICENSE file in the root directory of this source tree.
565
- */const wA=ye("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"}]]);/**
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 zl=ye("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"}]]);/**
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 bo=ye("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
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 dc=ye("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"}]]),ff={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},Rn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},bx=["total","automatico","permiso"],Y0=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],kA={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 SA(){if(typeof window>"u")return"dark";const e=localStorage.getItem(Rn.theme);return e==="light"||e==="dark"?e:document.documentElement.classList.contains("dark")?"dark":"light"}const sk=x.createContext(null);function CA({children:e}){const[n,s]=x.useState(SA);x.useEffect(()=>{document.documentElement.classList.toggle("dark",n==="dark");try{localStorage.setItem(Rn.theme,n)}catch{}},[n]);const o=x.useCallback(()=>{s(c=>c==="dark"?"light":"dark")},[]),l=x.useMemo(()=>({theme:n,toggle:o,set:s}),[n,o]);return r.jsx(sk.Provider,{value:l,children:e})}function _x(){const e=x.useContext(sk);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const EA=1367/458,NA=735/1016;function RA({size:e=32,title:n="APX",variant:s="icon"}){const{theme:o}=_x(),l=kA[s][o];if(s==="full"){const c=e,d=Math.round(e*EA);return r.jsx("img",{src:l,alt:n,width:d,height:c,className:"block object-contain",draggable:!1})}if(s==="vertical"){const c=e,d=Math.round(e/NA);return r.jsx("img",{src:l,alt:n,width:c,height:d,className:"block object-contain",draggable:!1})}return r.jsx("img",{src:l,alt:n,width:e,height:e,className:"block object-contain",draggable:!1})}function rk(e){var n,s,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var l=e.length;for(n=0;n<l;n++)e[n]&&(s=rk(e[n]))&&(o&&(o+=" "),o+=s)}else for(s in e)e[s]&&(o&&(o+=" "),o+=s);return o}function fc(){for(var e,n,s=0,o="",l=arguments.length;s<l;s++)(e=arguments[s])&&(n=rk(e))&&(o&&(o+=" "),o+=n);return o}const vx="-",TA=e=>{const n=MA(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:d=>{const p=d.split(vx);return p[0]===""&&p.length!==1&&p.shift(),ok(p,n)||AA(d)},getConflictingClassGroupIds:(d,p)=>{const m=s[d]||[];return p&&o[d]?[...m,...o[d]]:m}}},ok=(e,n)=>{if(e.length===0)return n.classGroupId;const s=e[0],o=n.nextPart.get(s),l=o?ok(e.slice(1),o):void 0;if(l)return l;if(n.validators.length===0)return;const c=e.join(vx);return n.validators.find(({validator:d})=>d(c))?.classGroupId},X0=/^\[(.+)\]$/,AA=e=>{if(X0.test(e)){const n=X0.exec(e)[1],s=n?.substring(0,n.indexOf(":"));if(s)return"arbitrary.."+s}},MA=e=>{const{theme:n,prefix:s}=e,o={nextPart:new Map,validators:[]};return zA(Object.entries(e.classGroups),s).forEach(([c,d])=>{hh(d,o,c,n)}),o},hh=(e,n,s,o)=>{e.forEach(l=>{if(typeof l=="string"){const c=l===""?n:K0(n,l);c.classGroupId=s;return}if(typeof l=="function"){if(OA(l)){hh(l(o),n,s,o);return}n.validators.push({validator:l,classGroupId:s});return}Object.entries(l).forEach(([c,d])=>{hh(d,K0(n,c),s,o)})})},K0=(e,n)=>{let s=e;return n.split(vx).forEach(o=>{s.nextPart.has(o)||s.nextPart.set(o,{nextPart:new Map,validators:[]}),s=s.nextPart.get(o)}),s},OA=e=>e.isThemeGetter,zA=(e,n)=>n?e.map(([s,o])=>{const l=o.map(c=>typeof c=="string"?n+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([d,p])=>[n+d,p])):c);return[s,l]}):e,DA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,s=new Map,o=new Map;const l=(c,d)=>{s.set(c,d),n++,n>e&&(n=0,o=s,s=new Map)};return{get(c){let d=s.get(c);if(d!==void 0)return d;if((d=o.get(c))!==void 0)return l(c,d),d},set(c,d){s.has(c)?s.set(c,d):l(c,d)}}},lk="!",LA=e=>{const{separator:n,experimentalParseClassName:s}=e,o=n.length===1,l=n[0],c=n.length,d=p=>{const m=[];let g=0,h=0,_;for(let w=0;w<p.length;w++){let C=p[w];if(g===0){if(C===l&&(o||p.slice(w,w+c)===n)){m.push(p.slice(h,w)),h=w+c;continue}if(C==="/"){_=w;continue}}C==="["?g++:C==="]"&&g--}const v=m.length===0?p:p.substring(h),k=v.startsWith(lk),S=k?v.substring(1):v,j=_&&_>h?_-h:void 0;return{modifiers:m,hasImportantModifier:k,baseClassName:S,maybePostfixModifierPosition:j}};return s?p=>s({className:p,parseClassName:d}):d},PA=e=>{if(e.length<=1)return e;const n=[];let s=[];return e.forEach(o=>{o[0]==="["?(n.push(...s.sort(),o),s=[]):s.push(o)}),n.push(...s.sort()),n},IA=e=>({cache:DA(e.cacheSize),parseClassName:LA(e),...TA(e)}),BA=/\s+/,UA=(e,n)=>{const{parseClassName:s,getClassGroupId:o,getConflictingClassGroupIds:l}=n,c=[],d=e.trim().split(BA);let p="";for(let m=d.length-1;m>=0;m-=1){const g=d[m],{modifiers:h,hasImportantModifier:_,baseClassName:v,maybePostfixModifierPosition:k}=s(g);let S=!!k,j=o(S?v.substring(0,k):v);if(!j){if(!S){p=g+(p.length>0?" "+p:p);continue}if(j=o(v),!j){p=g+(p.length>0?" "+p:p);continue}S=!1}const w=PA(h).join(":"),C=_?w+lk:w,E=C+j;if(c.includes(E))continue;c.push(E);const N=l(j,S);for(let R=0;R<N.length;++R){const T=N[R];c.push(C+T)}p=g+(p.length>0?" "+p:p)}return p};function HA(){let e=0,n,s,o="";for(;e<arguments.length;)(n=arguments[e++])&&(s=ik(n))&&(o&&(o+=" "),o+=s);return o}const ik=e=>{if(typeof e=="string")return e;let n,s="";for(let o=0;o<e.length;o++)e[o]&&(n=ik(e[o]))&&(s&&(s+=" "),s+=n);return s};function VA(e,...n){let s,o,l,c=d;function d(m){const g=n.reduce((h,_)=>_(h),e());return s=IA(g),o=s.cache.get,l=s.cache.set,c=p,p(m)}function p(m){const g=o(m);if(g)return g;const h=UA(m,s);return l(m,h),h}return function(){return c(HA.apply(null,arguments))}}const Kt=e=>{const n=s=>s[e]||[];return n.isThemeGetter=!0,n},ck=/^\[(?:([a-z-]+):)?(.+)\]$/i,qA=/^\d+\/\d+$/,$A=new Set(["px","full","screen"]),GA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,FA=/\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$/,YA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,XA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,KA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ts=e=>pl(e)||$A.has(e)||qA.test(e),gr=e=>Dl(e,"length",aM),pl=e=>!!e&&!Number.isNaN(Number(e)),tg=e=>Dl(e,"number",pl),Oi=e=>!!e&&Number.isInteger(Number(e)),QA=e=>e.endsWith("%")&&pl(e.slice(0,-1)),ut=e=>ck.test(e),hr=e=>GA.test(e),ZA=new Set(["length","size","percentage"]),WA=e=>Dl(e,ZA,uk),JA=e=>Dl(e,"position",uk),eM=new Set(["image","url"]),tM=e=>Dl(e,eM,rM),nM=e=>Dl(e,"",sM),zi=()=>!0,Dl=(e,n,s)=>{const o=ck.exec(e);return o?o[1]?typeof n=="string"?o[1]===n:n.has(o[1]):s(o[2]):!1},aM=e=>FA.test(e)&&!YA.test(e),uk=()=>!1,sM=e=>XA.test(e),rM=e=>KA.test(e),oM=()=>{const e=Kt("colors"),n=Kt("spacing"),s=Kt("blur"),o=Kt("brightness"),l=Kt("borderColor"),c=Kt("borderRadius"),d=Kt("borderSpacing"),p=Kt("borderWidth"),m=Kt("contrast"),g=Kt("grayscale"),h=Kt("hueRotate"),_=Kt("invert"),v=Kt("gap"),k=Kt("gradientColorStops"),S=Kt("gradientColorStopPositions"),j=Kt("inset"),w=Kt("margin"),C=Kt("opacity"),E=Kt("padding"),N=Kt("saturate"),R=Kt("scale"),T=Kt("sepia"),O=Kt("skew"),A=Kt("space"),z=Kt("translate"),B=()=>["auto","contain","none"],L=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto",ut,n],P=()=>[ut,n],H=()=>["",Ts,gr],q=()=>["auto",pl,ut],Y=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],V=()=>["solid","dashed","dotted","double","none"],$=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",ut],X=()=>["auto","avoid","all","avoid-page","page","left","right","column"],U=()=>[pl,ut];return{cacheSize:500,separator:":",theme:{colors:[zi],spacing:[Ts,gr],blur:["none","",hr,ut],brightness:U(),borderColor:[e],borderRadius:["none","","full",hr,ut],borderSpacing:P(),borderWidth:H(),contrast:U(),grayscale:G(),hueRotate:U(),invert:G(),gap:P(),gradientColorStops:[e],gradientColorStopPositions:[QA,gr],inset:D(),margin:D(),opacity:U(),padding:P(),saturate:U(),scale:U(),sepia:G(),skew:U(),space:P(),translate:P()},classGroups:{aspect:[{aspect:["auto","square","video",ut]}],container:["container"],columns:[{columns:[hr]}],"break-after":[{"break-after":X()}],"break-before":[{"break-before":X()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Y(),ut]}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:B()}],"overscroll-x":[{"overscroll-x":B()}],"overscroll-y":[{"overscroll-y":B()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[j]}],"inset-x":[{"inset-x":[j]}],"inset-y":[{"inset-y":[j]}],start:[{start:[j]}],end:[{end:[j]}],top:[{top:[j]}],right:[{right:[j]}],bottom:[{bottom:[j]}],left:[{left:[j]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Oi,ut]}],basis:[{basis:D()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ut]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",Oi,ut]}],"grid-cols":[{"grid-cols":[zi]}],"col-start-end":[{col:["auto",{span:["full",Oi,ut]},ut]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[zi]}],"row-start-end":[{row:["auto",{span:[Oi,ut]},ut]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ut]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ut]}],gap:[{gap:[v]}],"gap-x":[{"gap-x":[v]}],"gap-y":[{"gap-y":[v]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[E]}],px:[{px:[E]}],py:[{py:[E]}],ps:[{ps:[E]}],pe:[{pe:[E]}],pt:[{pt:[E]}],pr:[{pr:[E]}],pb:[{pb:[E]}],pl:[{pl:[E]}],m:[{m:[w]}],mx:[{mx:[w]}],my:[{my:[w]}],ms:[{ms:[w]}],me:[{me:[w]}],mt:[{mt:[w]}],mr:[{mr:[w]}],mb:[{mb:[w]}],ml:[{ml:[w]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ut,n]}],"min-w":[{"min-w":[ut,n,"min","max","fit"]}],"max-w":[{"max-w":[ut,n,"none","full","min","max","fit","prose",{screen:[hr]},hr]}],h:[{h:[ut,n,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ut,n,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ut,n,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ut,n,"auto","min","max","fit"]}],"font-size":[{text:["base",hr,gr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",tg]}],"font-family":[{font:[zi]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ut]}],"line-clamp":[{"line-clamp":["none",pl,tg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ts,ut]}],"list-image":[{"list-image":["none",ut]}],"list-style-type":[{list:["none","disc","decimal",ut]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[C]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[C]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ts,gr]}],"underline-offset":[{"underline-offset":["auto",Ts,ut]}],"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:P()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ut]}],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",ut]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[C]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Y(),JA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",WA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},tM]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[k]}],"gradient-via":[{via:[k]}],"gradient-to":[{to:[k]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"border-w":[{border:[p]}],"border-w-x":[{"border-x":[p]}],"border-w-y":[{"border-y":[p]}],"border-w-s":[{"border-s":[p]}],"border-w-e":[{"border-e":[p]}],"border-w-t":[{"border-t":[p]}],"border-w-r":[{"border-r":[p]}],"border-w-b":[{"border-b":[p]}],"border-w-l":[{"border-l":[p]}],"border-opacity":[{"border-opacity":[C]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[p]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[p]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[C]}],"divide-style":[{divide:V()}],"border-color":[{border:[l]}],"border-color-x":[{"border-x":[l]}],"border-color-y":[{"border-y":[l]}],"border-color-s":[{"border-s":[l]}],"border-color-e":[{"border-e":[l]}],"border-color-t":[{"border-t":[l]}],"border-color-r":[{"border-r":[l]}],"border-color-b":[{"border-b":[l]}],"border-color-l":[{"border-l":[l]}],"divide-color":[{divide:[l]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[Ts,ut]}],"outline-w":[{outline:[Ts,gr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[C]}],"ring-offset-w":[{"ring-offset":[Ts,gr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",hr,nM]}],"shadow-color":[{shadow:[zi]}],opacity:[{opacity:[C]}],"mix-blend":[{"mix-blend":[...$(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":$()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[o]}],contrast:[{contrast:[m]}],"drop-shadow":[{"drop-shadow":["","none",hr,ut]}],grayscale:[{grayscale:[g]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[_]}],saturate:[{saturate:[N]}],sepia:[{sepia:[T]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[o]}],"backdrop-contrast":[{"backdrop-contrast":[m]}],"backdrop-grayscale":[{"backdrop-grayscale":[g]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[_]}],"backdrop-opacity":[{"backdrop-opacity":[C]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[T]}],"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",ut]}],duration:[{duration:U()}],ease:[{ease:["linear","in","out","in-out",ut]}],delay:[{delay:U()}],animate:[{animate:["none","spin","ping","pulse","bounce",ut]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[R]}],"scale-x":[{"scale-x":[R]}],"scale-y":[{"scale-y":[R]}],rotate:[{rotate:[Oi,ut]}],"translate-x":[{"translate-x":[z]}],"translate-y":[{"translate-y":[z]}],"skew-x":[{"skew-x":[O]}],"skew-y":[{"skew-y":[O]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ut]}],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",ut]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":P()}],"scroll-mx":[{"scroll-mx":P()}],"scroll-my":[{"scroll-my":P()}],"scroll-ms":[{"scroll-ms":P()}],"scroll-me":[{"scroll-me":P()}],"scroll-mt":[{"scroll-mt":P()}],"scroll-mr":[{"scroll-mr":P()}],"scroll-mb":[{"scroll-mb":P()}],"scroll-ml":[{"scroll-ml":P()}],"scroll-p":[{"scroll-p":P()}],"scroll-px":[{"scroll-px":P()}],"scroll-py":[{"scroll-py":P()}],"scroll-ps":[{"scroll-ps":P()}],"scroll-pe":[{"scroll-pe":P()}],"scroll-pt":[{"scroll-pt":P()}],"scroll-pr":[{"scroll-pr":P()}],"scroll-pb":[{"scroll-pb":P()}],"scroll-pl":[{"scroll-pl":P()}],"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",ut]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ts,gr,tg]}],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"]}}},dk=VA(oM);function Oe(...e){return dk(fc(e))}const Q0={};function va(e,n){const s=x.useRef(Q0);return s.current===Q0&&(s.current=e(n)),s}const xh=[];let bh;function lM(){return bh}function iM(e){xh.push(e)}function fk(e){const n=(s,o)=>{const l=va(uM).current;let c;try{bh=l;for(const d of xh)d.before(l);c=e(s,o);for(const d of xh)d.after(l);l.didInitialize=!0}finally{bh=void 0}return c};return n.displayName=e.displayName||e.name,n}function cM(e){return x.forwardRef(fk(e))}function uM(){return{didInitialize:!1}}function yx(e){const n=x.useRef(!0);n.current&&(n.current=!1,e())}const dM=()=>{},Me=typeof document<"u"?x.useLayoutEffect:dM;function fM(e,n){return function(o,...l){const c=new URL(e);return c.searchParams.set("code",o.toString()),l.forEach(d=>c.searchParams.append("args[]",d)),`${n} error #${o}; visit ${c} for the full message.`}}const Mn=fM("https://base-ui.com/production-error","Base UI"),pk=x.createContext(void 0);function Nc(e){const n=x.useContext(pk);if(n===void 0&&!e)throw new Error(Mn(72));return n}const pM=[];function jx(e){x.useEffect(e,pM)}const Di=0;class Ga{static create(){return new Ga}currentId=Di;start(n,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Di,s()},n)}isStarted(){return this.currentId!==Di}clear=()=>{this.currentId!==Di&&(clearTimeout(this.currentId),this.currentId=Di)};disposeEffect=()=>this.clear}function sa(){const e=va(Ga.create).current;return jx(e.disposeEffect),e}const Ll=typeof navigator<"u",ng=gM(),mk=xM(),gk=hM(),wx=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),hk=ng.platform==="MacIntel"&&ng.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(ng.platform),xk=Ll&&/apple/i.test(navigator.vendor),_h=Ll&&/android/i.test(mk)||/android/i.test(gk),mM=Ll&&mk.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,bk=gk.includes("jsdom/");function gM(){if(!Ll)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function hM(){if(!Ll)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:n,version:s})=>`${n}/${s}`).join(" "):navigator.userAgent}function xM(){if(!Ll)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function ba(e){e.preventDefault(),e.stopPropagation()}function bM(e){return"nativeEvent"in e}function kx(e){return e.pointerType===""&&e.isTrusted?!0:_h&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function _k(e){return bk?!1:!_h&&e.width===0&&e.height===0||_h&&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 uo(e,n){const s=["mouse","pen"];return n||s.push("",void 0),s.includes(e)}function _M(e){const n=e.type;return n==="click"||n==="mousedown"||n==="keydown"||n==="keyup"}function pf(){return typeof window<"u"}function Hn(e){return Sx(e)?(e.nodeName||"").toLowerCase():"#document"}function Qt(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function is(e){var n;return(n=(Sx(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function Sx(e){return pf()?e instanceof Node||e instanceof Qt(e).Node:!1}function dt(e){return pf()?e instanceof Element||e instanceof Qt(e).Element:!1}function Gt(e){return pf()?e instanceof HTMLElement||e instanceof Qt(e).HTMLElement:!1}function vl(e){return!pf()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qt(e).ShadowRoot}function Mr(e){const{overflow:n,overflowX:s,overflowY:o,display:l}=oa(e);return/auto|scroll|overlay|hidden|clip/.test(n+o+s)&&l!=="inline"&&l!=="contents"}function vM(e){return/^(table|td|th)$/.test(Hn(e))}function mf(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const yM=/transform|translate|scale|rotate|perspective|filter/,jM=/paint|layout|strict|content/,to=e=>!!e&&e!=="none";let ag;function Cx(e){const n=dt(e)?oa(e):e;return to(n.transform)||to(n.translate)||to(n.scale)||to(n.rotate)||to(n.perspective)||!gf()&&(to(n.backdropFilter)||to(n.filter))||yM.test(n.willChange||"")||jM.test(n.contain||"")}function wM(e){let n=Us(e);for(;Gt(n)&&!Ls(n);){if(Cx(n))return n;if(mf(n))return null;n=Us(n)}return null}function gf(){return ag==null&&(ag=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ag}function Ls(e){return/^(html|body|#document)$/.test(Hn(e))}function oa(e){return Qt(e).getComputedStyle(e)}function hf(e){return dt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Us(e){if(Hn(e)==="html")return e;const n=e.assignedSlot||e.parentNode||vl(e)&&e.host||is(e);return vl(n)?n.host:n}function vk(e){const n=Us(e);return Ls(n)?e.ownerDocument?e.ownerDocument.body:e.body:Gt(n)&&Mr(n)?n:vk(n)}function pc(e,n,s){var o;n===void 0&&(n=[]),s===void 0&&(s=!0);const l=vk(e),c=l===((o=e.ownerDocument)==null?void 0:o.body),d=Qt(l);if(c){const p=vh(d);return n.concat(d,d.visualViewport||[],Mr(l)?l:[],p&&s?pc(p):[])}else return n.concat(l,pc(l,[],s))}function vh(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const yh="data-base-ui-focusable",yk="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",wr="ArrowLeft",kr="ArrowRight",Ex="ArrowUp",Rc="ArrowDown";function Pn(e){let n=e.activeElement;for(;n?.shadowRoot?.activeElement!=null;)n=n.shadowRoot.activeElement;return n}function Ze(e,n){if(!e||!n)return!1;const s=n.getRootNode?.();if(e.contains(n))return!0;if(s&&vl(s)){let o=n;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function Tn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Ld(e,n){if(!dt(e))return!1;const s=e;if(n.hasElement(s))return!s.hasAttribute("data-trigger-disabled");for(const[,o]of n.entries())if(Ze(o,s))return!o.hasAttribute("data-trigger-disabled");return!1}function sg(e,n){if(n==null)return!1;if("composedPath"in e)return e.composedPath().includes(n);const s=e;return s.target!=null&&n.contains(s.target)}function kM(e){return e.matches("html,body")}function xf(e){return Gt(e)&&e.matches(yk)}function SM(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${yk}`)!=null}function jh(e){return e?e.getAttribute("role")==="combobox"&&xf(e):!1}function CM(e){if(!e||bk)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function Pd(e){return e?e.hasAttribute(yh)?e:e.querySelector(`[${yh}]`)||e:null}function EM(e,n){return n!=null&&!uo(n)?0:typeof e=="function"?e():e}function Id(e,n,s){const o=EM(e,s);return typeof o=="number"?o:o?.[n]}function Z0(e){return typeof e=="function"?e():e}function jk(e,n){return n||e==="click"||e==="mousedown"}function NM(e){return e?.includes("mouse")&&e!=="mousedown"}function Bn(){}const mc=Object.freeze([]),un=Object.freeze({}),Hs="none",gc="trigger-press",$n="trigger-hover",yd="trigger-focus",Nx="outside-press",rg="item-press",RM="close-press",bf="focus-out",Rx="escape-key",W0="list-navigation",TM="cancel-open",wk="disabled",J0="missing",e1="initial",kk="imperative-action",AM="window-resize";function lt(e,n,s,o){let l=!1,c=!1;const d=o??un;return{reason:e,event:n??new Event("base-ui"),cancel(){l=!0},allowPropagation(){c=!0},get isCanceled(){return l},get isPropagationAllowed(){return c},trigger:s,...d}}const Sk=x.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ga,currentIdRef:{current:null},currentContextRef:{current:null}});function MM(e){const{children:n,delay:s,timeoutMs:o=0}=e,l=x.useRef(s),c=x.useRef(s),d=x.useRef(null),p=x.useRef(null),m=sa();return r.jsx(Sk.Provider,{value:x.useMemo(()=>({hasProvider:!0,delayRef:l,initialDelayRef:c,currentIdRef:d,timeoutMs:o,currentContextRef:p,timeout:m}),[o,m]),children:n})}function OM(e,n={open:!1}){const{open:s}=n,o="rootStore"in e?e.rootStore:e,l=o.useState("floatingId"),c=x.useContext(Sk),{currentIdRef:d,delayRef:p,timeoutMs:m,initialDelayRef:g,currentContextRef:h,hasProvider:_,timeout:v}=c,[k,S]=x.useState(!1);return Me(()=>{function j(){S(!1),h.current?.setIsInstantPhase(!1),d.current=null,h.current=null,p.current=g.current}if(d.current&&!s&&d.current===l){if(S(!1),m){const w=l;return v.start(m,()=>{o.select("open")||d.current&&d.current!==w||j()}),()=>{v.clear()}}j()}},[s,l,d,p,m,g,h,v,o]),Me(()=>{if(!s)return;const j=h.current,w=d.current;v.clear(),h.current={onOpenChange:o.setOpen,setIsInstantPhase:S},d.current=l,p.current={open:0,close:Id(g.current,"close")},w!==null&&w!==l?(S(!0),j?.setIsInstantPhase(!0),j?.onOpenChange(!1,lt(Hs))):(S(!1),j?.setIsInstantPhase(!1))},[s,l,o,d,p,g,h,v]),Me(()=>()=>{h.current=null},[h]),x.useMemo(()=>({hasProvider:_,delayRef:p,isInstantPhase:k}),[_,p,k])}function ft(e,n,s,o){return e.addEventListener(n,s,o),()=>{e.removeEventListener(n,s,o)}}function ss(...e){return()=>{for(let n=0;n<e.length;n+=1){const s=e[n];s&&s()}}}function Vs(e,n,s,o){const l=va(Ck).current;return DM(l,e,n,s,o)&&Ek(l,[e,n,s,o]),l.callback}function zM(e){const n=va(Ck).current;return LM(n,e)&&Ek(n,e),n.callback}function Ck(){return{callback:null,cleanup:null,refs:[]}}function DM(e,n,s,o,l){return e.refs[0]!==n||e.refs[1]!==s||e.refs[2]!==o||e.refs[3]!==l}function LM(e,n){return e.refs.length!==n.length||e.refs.some((s,o)=>s!==n[o])}function Ek(e,n){if(e.refs=n,n.every(s=>s==null)){e.callback=null;return}e.callback=s=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),s!=null){const o=Array(n.length).fill(null);for(let l=0;l<n.length;l+=1){const c=n[l];if(c!=null)switch(typeof c){case"function":{const d=c(s);typeof d=="function"&&(o[l]=d);break}case"object":{c.current=s;break}}}e.cleanup=()=>{for(let l=0;l<n.length;l+=1){const c=n[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 mn(e){const n=va(PM,e).current;return n.next=e,Me(n.effect),n}function PM(e){const n={current:e,next:e,effect:()=>{n.current=n.next}};return n}const Tx={...qN},og=Tx.useInsertionEffect,IM=og&&og!==Tx.useLayoutEffect?og:e=>e();function Le(e){const n=va(BM).current;return n.next=e,IM(n.effect),n.trampoline}function BM(){const e={next:void 0,callback:UM,trampoline:(...n)=>e.callback?.(...n),effect:()=>{e.callback=e.next}};return e}function UM(){}const Ku=null;class HM{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=n=>{this.isScheduled=!1;const s=this.callbacks,o=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,o>0)for(let l=0;l<s.length;l+=1)s[l]?.(n)};request(n){const s=this.nextId;return this.nextId+=1,this.callbacks.push(n),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),s}cancel(n){const s=n-this.startId;s<0||s>=this.callbacks.length||(this.callbacks[s]=null,this.callbacksCount-=1)}}const Qu=new HM;class es{static create(){return new es}static request(n){return Qu.request(n)}static cancel(n){return Qu.cancel(n)}currentId=Ku;request(n){this.cancel(),this.currentId=Qu.request(()=>{this.currentId=Ku,n()})}cancel=()=>{this.currentId!==Ku&&(Qu.cancel(this.currentId),this.currentId=Ku)};disposeEffect=()=>this.cancel}function yl(){const e=va(es.create).current;return jx(e.disposeEffect),e}function vt(e){return e?.ownerDocument||document}const Nk={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Ax={...Nk,position:"fixed",top:0,left:0},Rk={...Nk,position:"absolute"},Bd=x.forwardRef(function(n,s){const[o,l]=x.useState();Me(()=>{xk&&l("button")},[]);const c={tabIndex:0,role:o};return r.jsx("span",{...n,ref:s,style:Ax,"aria-hidden":o?void 0:!0,...c,"data-base-ui-focus-guard":""})}),VM=["top","right","bottom","left"],jl=Math.min,_a=Math.max,Ud=Math.round,oo=Math.floor,rs=e=>({x:e,y:e}),qM={left:"right",right:"left",bottom:"top",top:"bottom"};function wh(e,n,s){return _a(e,jl(n,s))}function qs(e,n){return typeof e=="function"?e(n):e}function ra(e){return e.split("-")[0]}function Or(e){return e.split("-")[1]}function Mx(e){return e==="x"?"y":"x"}function Ox(e){return e==="y"?"height":"width"}function Oa(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function zx(e){return Mx(Oa(e))}function $M(e,n,s){s===void 0&&(s=!1);const o=Or(e),l=zx(e),c=Ox(l);let d=l==="x"?o===(s?"end":"start")?"right":"left":o==="start"?"bottom":"top";return n.reference[c]>n.floating[c]&&(d=Hd(d)),[d,Hd(d)]}function GM(e){const n=Hd(e);return[kh(e),n,kh(n)]}function kh(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const t1=["left","right"],n1=["right","left"],FM=["top","bottom"],YM=["bottom","top"];function XM(e,n,s){switch(e){case"top":case"bottom":return s?n?n1:t1:n?t1:n1;case"left":case"right":return n?FM:YM;default:return[]}}function KM(e,n,s,o){const l=Or(e);let c=XM(ra(e),s==="start",o);return l&&(c=c.map(d=>d+"-"+l),n&&(c=c.concat(c.map(kh)))),c}function Hd(e){const n=ra(e);return qM[n]+e.slice(n.length)}function QM(e){return{top:0,right:0,bottom:0,left:0,...e}}function Tk(e){return typeof e!="number"?QM(e):{top:e,right:e,bottom:e,left:e}}function hc(e){const{x:n,y:s,width:o,height:l}=e;return{width:o,height:l,top:s,left:n,right:n+o,bottom:s+l,x:n,y:s}}function Zu(e,n,s){return Math.floor(e/n)!==s}function xc(e,n){return n<0||n>=e.length}function jd(e,n){return Ln(e.current,{disabledIndices:n})}function Sh(e,n){return Ln(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:n})}function Ln(e,{startingIndex:n=-1,decrement:s=!1,disabledIndices:o,amount:l=1}={}){let c=n;do c+=s?-l:l;while(c>=0&&c<=e.length-1&&Ps(e,c,o));return c}function Ak(e,{event:n,orientation:s,loopFocus:o,onLoop:l,rtl:c,cols:d,disabledIndices:p,minIndex:m,maxIndex:g,prevIndex:h,stopEvent:_=!1}){let v=h,k;if(n.key===Ex?k="up":n.key===Rc&&(k="down"),k){const S=[],j=[];let w=!1,C=0;{let B=null,L=-1;e.forEach((D,P)=>{if(D==null)return;C+=1;const H=D.closest('[role="row"]');H&&(w=!0),(H!==B||L===-1)&&(B=H,L+=1,S[L]=[]),S[L].push(P),j[P]=L})}let E=!1,N=0;if(w)for(const B of S){const L=B.length;L>N&&(N=L),L!==d&&(E=!0)}const R=E&&C<e.length,T=N||d,O=B=>{if(!E||h===-1)return;const L=j[h];if(L==null)return;const D=S[L].indexOf(h),P=B==="up"?-1:1;for(let H=L+P,q=0;q<S.length;q+=1,H+=P){if(H<0||H>=S.length){if(!o||R)return;if(H=H<0?S.length-1:0,l){const V=Math.min(D,S[H].length-1),$=S[H][V]??S[H][0],Z=l(n,h,$);H=j[Z]??H}}const Y=S[H];for(let V=Math.min(D,Y.length-1);V>=0;V-=1){const $=Y[V];if(!Ps(e,$,p))return $}}},A=B=>{if(!R||h===-1)return;const L=h%T,D=B==="up"?-T:T,P=g-g%T,H=oo(g/T)+1;for(let q=h-L+D,Y=0;Y<H;Y+=1,q+=D){if(q<0||q>g){if(!o)return;q=q<0?P:0}const V=Math.min(q+T-1,g);for(let $=Math.min(q+L,V);$>=q;$-=1)if(!Ps(e,$,p))return $}};_&&ba(n);const z=O(k)??A(k);if(z!==void 0)v=z;else if(h===-1)v=k==="up"?g:m;else if(v=Ln(e,{startingIndex:h,amount:T,decrement:k==="up",disabledIndices:p}),o){if(k==="up"&&(h-T<m||v<0)){const B=h%T,L=g%T,D=g-(L-B);L===B?v=g:v=L>B?D:D-T,l&&(v=l(n,h,v))}k==="down"&&h+T>g&&(v=Ln(e,{startingIndex:h%T-T,amount:T,disabledIndices:p}),l&&(v=l(n,h,v)))}xc(e,v)&&(v=h)}if(s==="both"){const S=oo(h/d);n.key===(c?wr:kr)&&(_&&ba(n),h%d!==d-1?(v=Ln(e,{startingIndex:h,disabledIndices:p}),o&&Zu(v,d,S)&&(v=Ln(e,{startingIndex:h-h%d-1,disabledIndices:p}),l&&(v=l(n,h,v)))):o&&(v=Ln(e,{startingIndex:h-h%d-1,disabledIndices:p}),l&&(v=l(n,h,v))),Zu(v,d,S)&&(v=h)),n.key===(c?kr:wr)&&(_&&ba(n),h%d!==0?(v=Ln(e,{startingIndex:h,decrement:!0,disabledIndices:p}),o&&Zu(v,d,S)&&(v=Ln(e,{startingIndex:h+(d-h%d),decrement:!0,disabledIndices:p}),l&&(v=l(n,h,v)))):o&&(v=Ln(e,{startingIndex:h+(d-h%d),decrement:!0,disabledIndices:p}),l&&(v=l(n,h,v))),Zu(v,d,S)&&(v=h));const j=oo(g/d)===S;xc(e,v)&&(o&&j?(v=n.key===(c?kr:wr)?g:Ln(e,{startingIndex:h-h%d-1,disabledIndices:p}),l&&(v=l(n,h,v))):v=h)}return v}function Mk(e,n,s){const o=[];let l=0;return e.forEach(({width:c,height:d},p)=>{let m=!1;for(s&&(l=0);!m;){const g=[];for(let h=0;h<c;h+=1)for(let _=0;_<d;_+=1)g.push(l+h+_*n);l%n+c<=n&&g.every(h=>o[h]==null)?(g.forEach(h=>{o[h]=p}),m=!0):l+=1}}),[...o]}function Ok(e,n,s,o,l){if(e===-1)return-1;const c=s.indexOf(e),d=n[e];switch(l){case"tl":return c;case"tr":return d?c+d.width-1:c;case"bl":return d?c+(d.height-1)*o:c;case"br":return s.lastIndexOf(e);default:return-1}}function zk(e,n){return n.flatMap((s,o)=>e.includes(s)?[o]:[])}function Ps(e,n,s){if(typeof s=="function"?s(n):s?.includes(n)??!1)return!0;const l=e[n];return l?_f(l)?!s&&(l.hasAttribute("disabled")||l.getAttribute("aria-disabled")==="true"):!0:!1}function ZM(e){return e.visibility==="hidden"||e.visibility==="collapse"}function _f(e,n=e?oa(e):null){return!e||!e.isConnected||!n||ZM(n)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():n.display!=="none"&&n.display!=="contents"}const WM='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function JM(e){const n=e.assignedSlot;if(n)return n;if(e.parentElement)return e.parentElement;const s=e.getRootNode();return vl(s)?s.host:null}function Ch(e){for(const n of Array.from(e.children))if(Hn(n)==="summary")return n;return null}function e3(e,n){const s=Ch(n);return!!s&&(e===s||Ze(s,e))}function Dk(e){const n=e?Hn(e):"";return e!=null&&e.matches(WM)&&(n!=="summary"||e.parentElement!=null&&Hn(e.parentElement)==="details"&&Ch(e.parentElement)===e)&&(n!=="details"||Ch(e)==null)&&(n!=="input"||e.type!=="hidden")}function Lk(e){if(!Dk(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let n=e;n;n=JM(n)){const s=n!==e,o=Hn(n)==="slot";if(n.hasAttribute("inert")||s&&Hn(n)==="details"&&!n.open&&!e3(e,n)||n.hasAttribute("hidden")||!o&&!t3(n,s))return!1}return!0}function t3(e,n){const s=oa(e);return n?s.display!=="none":_f(e,s)}function Pk(e){const n=e.tabIndex;if(n<0){const s=Hn(e);if(s==="details"||s==="audio"||s==="video"||Gt(e)&&e.isContentEditable)return 0}return n}function lg(e){if(Hn(e)!=="input")return null;const n=e;return n.type==="radio"&&n.name!==""?n:null}function n3(e,n){const s=lg(e);if(!s)return!0;const o=n.find(l=>{const c=lg(l);return c?.name===s.name&&c.form===s.form&&c.checked});return o?o===s:n.find(l=>{const c=lg(l);return c?.name===s.name&&c.form===s.form})===s}function Ik(e){if(Gt(e)&&Hn(e)==="slot"){const n=e.assignedElements({flatten:!0});if(n.length>0)return n}return Gt(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Bk(e,n){Ik(e).forEach(s=>{Dk(s)&&n.push(s),Bk(s,n)})}function Uk(e,n,s){Ik(e).forEach(o=>{Gt(o)&&o.matches(n)&&s.push(o),Uk(o,n,s)})}function Dx(e){return Lk(e)&&Pk(e)>=0}function Hk(e){const n=[];return Bk(e,n),n.filter(Lk)}function vf(e){const n=Hk(e);return n.filter(s=>Pk(s)>=0&&n3(s,n))}function Vk(e,n){const s=vf(e),o=s.length;if(o===0)return;const l=Pn(vt(e)),c=s.indexOf(l),d=c===-1?n===1?0:o-1:c+n;return s[d]}function qk(e){return Vk(vt(e).body,1)||e}function $k(e){return Vk(vt(e).body,-1)||e}function nc(e,n){const s=n||e.currentTarget,o=e.relatedTarget;return!o||!Ze(s,o)}function a3(e){vf(e).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function a1(e){const n=[];Uk(e,"[data-tabindex]",n),n.forEach(s=>{const o=s.dataset.tabindex;delete s.dataset.tabindex,o?s.setAttribute("tabindex",o):s.removeAttribute("tabindex")})}function Nr(e,n,s=!0){return e.filter(l=>l.parentId===n).flatMap(l=>[...!s||l.context?.open?[l]:[],...Nr(e,l.id,s)])}function s1(e,n){let s=[],o=e.find(l=>l.id===n)?.parentId;for(;o;){const l=e.find(c=>c.id===o);o=l?.parentId,l&&(s=s.concat(l))}return s}function bc(e){return`data-base-ui-${e}`}let Wu=0;function wd(e,n={}){const{preventScroll:s=!1,sync:o=!1,shouldFocus:l}=n;cancelAnimationFrame(Wu);function c(){l&&!l()||e?.focus({preventScroll:s})}if(o)return c(),Bn;const d=requestAnimationFrame(c);return Wu=d,()=>{Wu===d&&(cancelAnimationFrame(d),Wu=0)}}const ig={inert:new WeakMap,"aria-hidden":new WeakMap},r1="data-base-ui-inert",Eh={inert:new WeakSet,"aria-hidden":new WeakSet};let Li=new WeakMap,cg=0;function s3(e){return Eh[e]}function Gk(e){return e?vl(e)?e.host:Gk(e.parentNode):null}const ug=(e,n)=>n.map(s=>{if(e.contains(s))return s;const o=Gk(s);return e.contains(o)?o:null}).filter(s=>s!=null),o1=e=>{const n=new Set;return e.forEach(s=>{let o=s;for(;o&&!n.has(o);)n.add(o),o=o.parentNode}),n},l1=(e,n,s)=>{const o=[],l=c=>{!c||s.has(c)||Array.from(c.children).forEach(d=>{Hn(d)!=="script"&&(n.has(d)?l(d):o.push(d))})};return l(e),o};function r3(e,n,s,o,{mark:l=!0,markerIgnoreElements:c=[]}){const d=o?"inert":s?"aria-hidden":null;let p=null,m=null;const g=ug(n,e),h=l?ug(n,c):[],_=new Set(h),v=l?l1(n,o1(g),new Set(g)).filter(j=>!_.has(j)):[],k=[],S=[];if(d){const j=ig[d],w=s3(d);m=w,p=j;const C=ug(n,Array.from(n.querySelectorAll("[aria-live]"))),E=g.concat(C);l1(n,o1(E),new Set(E)).forEach(R=>{const T=R.getAttribute(d),O=T!==null&&T!=="false",A=(j.get(R)||0)+1;j.set(R,A),k.push(R),A===1&&O&&w.add(R),O||R.setAttribute(d,d==="inert"?"":"true")})}return l&&v.forEach(j=>{const w=(Li.get(j)||0)+1;Li.set(j,w),S.push(j),w===1&&j.setAttribute(r1,"")}),cg+=1,()=>{p&&k.forEach(j=>{const C=(p.get(j)||0)-1;p.set(j,C),C||(!m?.has(j)&&d&&j.removeAttribute(d),m?.delete(j))}),l&&S.forEach(j=>{const w=(Li.get(j)||0)-1;Li.set(j,w),w||j.removeAttribute(r1)}),cg-=1,cg||(ig.inert=new WeakMap,ig["aria-hidden"]=new WeakMap,Eh.inert=new WeakSet,Eh["aria-hidden"]=new WeakSet,Li=new WeakMap)}}function i1(e,n={}){const{ariaHidden:s=!1,inert:o=!1,mark:l=!0,markerIgnoreElements:c=[]}=n,d=vt(e[0]).body;return r3(e,d,s,o,{mark:l,markerIgnoreElements:c})}let c1=0;function o3(e,n="mui"){const[s,o]=x.useState(e),l=e||s;return x.useEffect(()=>{s==null&&(c1+=1,o(`${n}-${c1}`))},[s,n]),l}const u1=Tx.useId;function yf(e,n){if(u1!==void 0){const s=u1();return e??(n?`${n}-${s}`:s)}return o3(e,n)}const l3=parseInt(x.version,10);function Lx(e){return l3>=e}function d1(e){if(!x.isValidElement(e))return null;const n=e,s=n.props;return(Lx(19)?s?.ref:n.ref)??null}function Nh(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function i3(e,n){const s={};for(const o in e){const l=e[o];if(n?.hasOwnProperty(o)){const c=n[o](l);c!=null&&Object.assign(s,c);continue}l===!0?s[`data-${o.toLowerCase()}`]="":l&&(s[`data-${o.toLowerCase()}`]=l.toString())}return s}function c3(e,n){return typeof e=="function"?e(n):e}function u3(e,n){return typeof e=="function"?e(n):e}const Px={};function Da(e,n,s,o,l){if(!s&&!o&&!l&&!e)return Vd(n);let c=Vd(e);return n&&(c=Xi(c,n)),s&&(c=Xi(c,s)),o&&(c=Xi(c,o)),l&&(c=Xi(c,l)),c}function d3(e){if(e.length===0)return Px;if(e.length===1)return Vd(e[0]);let n=Vd(e[0]);for(let s=1;s<e.length;s+=1)n=Xi(n,e[s]);return n}function Vd(e){return Ix(e)?{...Yk(e,Px)}:f3(e)}function Xi(e,n){return Ix(n)?Yk(n,e):p3(e,n)}function f3(e){const n={...e};for(const s in n){const o=n[s];Fk(s,o)&&(n[s]=Xk(o))}return n}function p3(e,n){if(!n)return e;for(const s in n){const o=n[s];switch(s){case"style":{e[s]=Nh(e.style,o);break}case"className":{e[s]=Kk(e.className,o);break}default:Fk(s,o)?e[s]=m3(e[s],o):e[s]=o}}return e}function Fk(e,n){const s=e.charCodeAt(0),o=e.charCodeAt(1),l=e.charCodeAt(2);return s===111&&o===110&&l>=65&&l<=90&&(typeof n=="function"||typeof n>"u")}function Ix(e){return typeof e=="function"}function Yk(e,n){return Ix(e)?e(n):e??Px}function m3(e,n){return n?e?(...s)=>{const o=s[0];if(Qk(o)){const c=o;qd(c);const d=n(...s);return c.baseUIHandlerPrevented||e?.(...s),d}const l=n(...s);return e?.(...s),l}:Xk(n):e}function Xk(e){return e&&((...n)=>{const s=n[0];return Qk(s)&&qd(s),e(...n)})}function qd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Kk(e,n){return n?e?n+" "+e:n:e}function Qk(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Ht(e,n,s={}){const o=n.render,l=g3(n,s);if(s.enabled===!1)return null;const c=s.state??un;return b3(e,o,l,c)}function g3(e,n={}){const{className:s,style:o,render:l}=e,{state:c=un,ref:d,props:p,stateAttributesMapping:m,enabled:g=!0}=n,h=g?c3(s,c):void 0,_=g?u3(o,c):void 0,v=g?i3(c,m):un,k=g&&p?h3(p):void 0,S=g?Nh(v,k)??{}:un;return typeof document<"u"&&(g?Array.isArray(d)?S.ref=zM([S.ref,d1(l),...d]):S.ref=Vs(S.ref,d1(l),d):Vs(null,null)),g?(h!==void 0&&(S.className=Kk(S.className,h)),_!==void 0&&(S.style=Nh(S.style,_)),S):un}function h3(e){return Array.isArray(e)?d3(e):Da(void 0,e)}const x3=Symbol.for("react.lazy");function b3(e,n,s,o){if(n){if(typeof n=="function")return n(s,o);const l=Da(s,n.props);l.ref=s.ref;let c=n;return c?.$$typeof===x3&&(c=x.Children.toArray(n)[0]),x.cloneElement(c,l)}if(e&&typeof e=="string")return _3(e,s);throw new Error(Mn(8))}function _3(e,n){return e==="button"?x.createElement("button",{type:"button",...n,key:n.key}):e==="img"?x.createElement("img",{alt:"",...n,key:n.key}):x.createElement(e,n)}const v3={style:{transition:"none"}},y3="data-base-ui-click-trigger",j3={fallbackAxisSide:"none"},w3={fallbackAxisSide:"end"},k3={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Zk=x.createContext(null),Wk=()=>x.useContext(Zk),S3=bc("portal");function Jk(e={}){const{ref:n,container:s,componentProps:o=un,elementProps:l}=e,c=yf(),p=Wk()?.portalNode,[m,g]=x.useState(null),[h,_]=x.useState(null),v=Le(w=>{w!==null&&_(w)}),k=x.useRef(null);Me(()=>{if(s===null){k.current&&(k.current=null,_(null),g(null));return}if(c==null)return;const w=(s&&(Sx(s)?s:s.current))??p??document.body;if(w==null){k.current&&(k.current=null,_(null),g(null));return}k.current!==w&&(k.current=w,_(null),g(w))},[s,p,c]);const S=Ht("div",o,{ref:[n,v],props:[{id:c,[S3]:""},l]});return{portalNode:h,portalSubtree:m&&S?Tr.createPortal(S,m):null}}const eS=x.forwardRef(function(n,s){const{render:o,className:l,style:c,children:d,container:p,renderGuards:m,...g}=n,{portalNode:h,portalSubtree:_}=Jk({container:p,ref:s,componentProps:n,elementProps:g}),v=x.useRef(null),k=x.useRef(null),S=x.useRef(null),j=x.useRef(null),[w,C]=x.useState(null),E=x.useRef(!1),N=w?.modal,R=w?.open,T=typeof m=="boolean"?m:!!w&&!w.modal&&w.open&&!!h;x.useEffect(()=>{if(!h||N)return;function A(z){h&&z.relatedTarget&&nc(z)&&(z.type==="focusin"?E.current&&(a1(h),E.current=!1):(a3(h),E.current=!0))}return ss(ft(h,"focusin",A,!0),ft(h,"focusout",A,!0))},[h,N]),x.useEffect(()=>{!h||R!==!1||(a1(h),E.current=!1)},[R,h]);const O=x.useMemo(()=>({beforeOutsideRef:v,afterOutsideRef:k,beforeInsideRef:S,afterInsideRef:j,portalNode:h,setFocusManagerState:C}),[h]);return r.jsxs(x.Fragment,{children:[_,r.jsxs(Zk.Provider,{value:O,children:[T&&h&&r.jsx(Bd,{"data-type":"outside",ref:v,onFocus:A=>{if(nc(A,h))S.current?.focus();else{const z=w?w.domReference:null;$k(z)?.focus()}}}),T&&h&&r.jsx("span",{"aria-owns":h.id,style:k3}),h&&Tr.createPortal(d,h),T&&h&&r.jsx(Bd,{"data-type":"outside",ref:k,onFocus:A=>{if(nc(A,h))j.current?.focus();else{const z=w?w.domReference:null;qk(z)?.focus(),w?.closeOnFocusOut&&w?.onOpenChange(!1,lt(bf,A.nativeEvent))}}})]})]})});function C3(){const e=new Map;return{emit(n,s){e.get(n)?.forEach(o=>o(s))},on(n,s){e.has(n)||e.set(n,new Set),e.get(n).add(s)},off(n,s){e.get(n)?.delete(s)}}}const E3=x.createContext(null),N3=x.createContext(null),jf=()=>x.useContext(E3)?.id||null,Pl=e=>{const n=x.useContext(N3);return e??n};function Os(e){return e==null?e:"current"in e?e.current:e}function R3(e,n){const s=Qt(Tn(e));return e instanceof s.KeyboardEvent?"keyboard":e instanceof s.FocusEvent?n||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof s.MouseEvent?n||(e.detail===0?"keyboard":"mouse"):""}const f1=20;let yr=[];function Bx(){yr=yr.filter(e=>e.deref()?.isConnected)}function T3(e){Bx(),e&&Hn(e)!=="body"&&(yr.push(new WeakRef(e)),yr.length>f1&&(yr=yr.slice(-f1)))}function dg(){return Bx(),yr[yr.length-1]?.deref()}function A3(e){return e?Dx(e)?e:vf(e)[0]||e:null}function p1(e,n){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!n.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const o=Hk(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return Dx(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),l=e.getAttribute("tabindex");n.current.includes("floating")||o.length===0?l!=="0"&&e.setAttribute("tabindex","0"):(l!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function tS(e){const{context:n,children:s,disabled:o=!1,initialFocus:l=!0,returnFocus:c=!0,restoreFocus:d=!1,modal:p=!0,closeOnFocusOut:m=!0,openInteractionType:g="",nextFocusableElement:h,previousFocusableElement:_,beforeContentFocusGuardRef:v,externalTree:k,getInsideElements:S}=e,j="rootStore"in n?n.rootStore:n,w=j.useState("open"),C=j.useState("domReferenceElement"),E=j.useState("floatingElement"),{events:N,dataRef:R}=j.context,T=Le(()=>R.current.floatingContext?.nodeId),O=l===!1,A=jh(C)&&O,z=x.useRef(["content"]),B=mn(l),L=mn(c),D=mn(g),P=Pl(k),H=Wk(),q=x.useRef(!1),Y=x.useRef(!1),V=x.useRef(!1),$=x.useRef(null),Z=x.useRef(""),G=x.useRef(""),X=x.useRef(null),U=x.useRef(null),K=Vs(X,v,H?.beforeInsideRef),F=Vs(U,H?.afterInsideRef),J=sa(),ie=sa(),re=yl(),oe=H!=null,ce=Pd(E),ee=Le((_e=ce)=>_e?vf(_e):[]),Te=Le(()=>S?.().filter(_e=>_e!=null)??[]);x.useEffect(()=>{if(o||!p)return;function _e(Ne){Ne.key==="Tab"&&Ze(ce,Pn(vt(ce)))&&ee().length===0&&!A&&ba(Ne)}const Se=vt(ce);return ft(Se,"keydown",_e)},[o,ce,p,A,ee]),x.useEffect(()=>{if(o||!w)return;const _e=vt(ce);function Se(){V.current=!1}function Ne(Ie){const be=Tn(Ie),Ae=Te(),we=Ze(E,be)||Ze(C,be)||Ze(H?.portalNode,be)||Ae.some(Be=>Be===be||Ze(Be,be));V.current=!we,G.current=Ie.pointerType||"keyboard",be?.closest(`[${y3}]`)&&(Y.current=!0)}function Pe(){G.current="keyboard"}return ss(ft(_e,"pointerdown",Ne,!0),ft(_e,"pointerup",Se,!0),ft(_e,"pointercancel",Se,!0),ft(_e,"keydown",Pe,!0))},[o,E,C,ce,w,H,Te]),x.useEffect(()=>{if(o||!m)return;const _e=vt(ce);function Se(){Y.current=!0,ie.start(0,()=>{Y.current=!1})}function Ne(Ae){const we=Tn(Ae);Dx(we)&&($.current=we)}function Pe(Ae){const we=Ae.relatedTarget,Be=Ae.currentTarget,Xe=Tn(Ae);queueMicrotask(()=>{const Ye=T(),De=j.context.triggerElements,ve=Te(),le=we?.hasAttribute(bc("focus-guard"))&&[X.current,U.current,H?.beforeInsideRef.current,H?.afterInsideRef.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,Os(_),Os(h)].includes(we),je=!(Ze(C,we)||Ze(E,we)||Ze(we,E)||Ze(H?.portalNode,we)||ve.some(ke=>ke===we||Ze(ke,we))||we!=null&&De.hasElement(we)||De.hasMatchingElement(ke=>Ze(ke,we))||le||P&&(Nr(P.nodesRef.current,Ye).find(ke=>Ze(ke.context?.elements.floating,we)||Ze(ke.context?.elements.domReference,we))||s1(P.nodesRef.current,Ye).find(ke=>[ke.context?.elements.floating,Pd(ke.context?.elements.floating)].includes(we)||ke.context?.elements.domReference===we)));if(Be===C&&ce&&p1(ce,z),d&&Be!==C&&!_f(Xe)&&Pn(_e)===_e.body){if(Gt(ce)&&(ce.focus(),d==="popup")){re.request(()=>{ce.focus()});return}const ke=ee(),Ue=$.current,Je=(Ue&&ke.includes(Ue)?Ue:null)||ke[ke.length-1]||ce;Gt(Je)&&Je.focus()}if(R.current.insideReactTree){R.current.insideReactTree=!1;return}(A||!p)&&we&&je&&!Y.current&&(A||we!==dg())&&(q.current=!0,j.setOpen(!1,lt(bf,Ae)))})}function Ie(){V.current||(R.current.insideReactTree=!0,J.start(0,()=>{R.current.insideReactTree=!1}))}const be=Gt(C)?C:null;if(!(!E&&!be))return ss(be&&ft(be,"focusout",Pe),be&&ft(be,"pointerdown",Se),E&&ft(E,"focusin",Ne),E&&ft(E,"focusout",Pe),E&&H&&ft(E,"focusout",Ie,!0))},[o,C,E,ce,p,P,H,j,m,d,ee,A,T,z,R,J,ie,re,h,_,Te]),x.useEffect(()=>{if(o||!E||!w)return;const _e=Array.from(H?.portalNode?.querySelectorAll(`[${bc("portal")}]`)||[]),Ne=(P?s1(P.nodesRef.current,T()):[]).find(Be=>jh(Be.context?.elements.domReference||null))?.context?.elements.domReference,Ie=[...[E,..._e,X.current,U.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,...Te()],Ne,Os(_),Os(h),A?C:null].filter(Be=>Be!=null),be=i1(Ie,{ariaHidden:p||A,mark:!1}),Ae=[E,..._e].filter(Be=>Be!=null),we=i1(Ae);return()=>{we(),be()}},[w,o,C,E,p,H,A,P,T,h,_,Te]),Me(()=>{if(!w||o||!Gt(ce))return;const _e=vt(ce),Se=Pn(_e);queueMicrotask(()=>{const Ne=B.current,Pe=typeof Ne=="function"?Ne(D.current||""):Ne;if(Pe===void 0||Pe===!1||Ze(ce,Se))return;let be=null;const Ae=()=>(be==null&&(be=ee(ce)),be[0]||ce);let we;Pe===!0||Pe===null?we=Ae():we=Os(Pe),we=we||Ae();const Be=Ze(ce,Pn(_e));wd(we,{preventScroll:we===ce,shouldFocus(){if(Be)return!0;const Xe=Pn(_e);return!(Xe!==we&&Ze(ce,Xe))}})})},[o,w,ce,ee,B,D]),Me(()=>{if(o||!ce)return;const _e=vt(ce),Se=Pn(_e);T3(Se);function Ne(Ie){if(Ie.open||(Z.current=R3(Ie.nativeEvent,G.current)),Ie.reason===$n&&Ie.nativeEvent.type==="mouseleave"&&(q.current=!0),Ie.reason===Nx)if(Ie.nested)q.current=!1;else if(kx(Ie.nativeEvent)||_k(Ie.nativeEvent))q.current=!1;else{let be=!1;vt(ce).createElement("div").focus({get preventScroll(){return be=!0,!1}}),be?q.current=!1:q.current=!0}}N.on("openchange",Ne);function Pe(){const Ie=L.current;let be=typeof Ie=="function"?Ie(Z.current):Ie;if(be===void 0||be===!1)return null;if(be===null&&(be=!0),typeof be=="boolean")return C?.isConnected?C:dg()||null;const Ae=C?.isConnected?C:dg();return Os(be)||Ae||null}return()=>{N.off("openchange",Ne);const Ie=Pn(_e),be=Te(),Ae=Ze(E,Ie)||be.some(Xe=>Xe===Ie||Ze(Xe,Ie))||P&&Nr(P.nodesRef.current,T(),!1).some(Xe=>Ze(Xe.context?.elements.floating,Ie)),we=L.current,Be=Pe();queueMicrotask(()=>{const Xe=A3(Be),Ye=typeof we!="boolean";we&&!q.current&&Gt(Xe)&&(!(!Ye&&Xe!==Ie&&Ie!==_e.body)||Ae)&&Xe.focus({preventScroll:!0}),q.current=!1})}},[o,E,ce,L,N,P,C,T,Te]),Me(()=>{if(!wx||w||!E)return;const _e=Pn(vt(E));!Gt(_e)||!xf(_e)||Ze(E,_e)&&_e.blur()},[w,E]),Me(()=>{if(!(o||!H))return H.setFocusManagerState({modal:p,closeOnFocusOut:m,open:w,onOpenChange:j.setOpen,domReference:C}),()=>{H.setFocusManagerState(null)}},[o,H,p,w,j,m,C]),Me(()=>{if(!(o||!ce))return p1(ce,z),()=>{queueMicrotask(Bx)}},[o,ce,z]);const Fe=!o&&(p?!A:!0)&&(oe||p);return r.jsxs(x.Fragment,{children:[Fe&&r.jsx(Bd,{"data-type":"inside",ref:K,onFocus:_e=>{if(p){const Se=ee();wd(Se[Se.length-1])}else H?.portalNode&&(q.current=!1,nc(_e,H.portalNode)?qk(C)?.focus():Os(_??H.beforeOutsideRef)?.focus())}}),s,Fe&&r.jsx(Bd,{"data-type":"inside",ref:F,onFocus:_e=>{p?wd(ee()[0]):H?.portalNode&&(m&&(q.current=!0),nc(_e,H.portalNode)?$k(C)?.focus():Os(h??H.afterOutsideRef)?.focus())}})]})}function M3(e,n={}){const{enabled:s=!0,event:o="click",toggle:l=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:p=0,reason:m=gc}=n,g="rootStore"in e?e.rootStore:e,h=g.context.dataRef,_=x.useRef(void 0),v=yl(),k=sa(),S=x.useMemo(()=>{function j(C,E,N,R){const T=lt(m,E,N);C&&R==="touch"&&p>0?k.start(p,()=>{g.setOpen(!0,T)}):g.setOpen(C,T)}function w(C,E,N){const R=h.current.openEvent,T=g.select("domReferenceElement")!==E;return C&&T||!C||!l?!0:R&&d?!N(R.type):!1}return{onPointerDown(C){_.current=C.pointerType},onMouseDown(C){const E=_.current,N=C.nativeEvent,R=g.select("open");if(C.button!==0||o==="click"||uo(E,!0)&&c)return;const T=w(R,C.currentTarget,z=>z==="click"||z==="mousedown"),O=Tn(N);if(xf(O)){j(T,N,O,E);return}const A=C.currentTarget;v.request(()=>{j(T,N,A,E)})},onClick(C){if(o==="mousedown-only")return;const E=_.current;if(o==="mousedown"&&E){_.current=void 0;return}if(uo(E,!0)&&c)return;const N=g.select("open"),R=w(N,C.currentTarget,T=>T==="click"||T==="mousedown"||T==="keydown"||T==="keyup");j(R,C.nativeEvent,C.currentTarget,E)},onKeyDown(){_.current=void 0}}},[h,o,c,m,g,d,l,v,k,p]);return x.useMemo(()=>s?{reference:S}:un,[s,S])}function O3(e,n){let s=null,o=null,l=!1;return{contextElement:e||void 0,getBoundingClientRect(){const c=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},d=n.axis==="x"||n.axis==="both",p=n.axis==="y"||n.axis==="both",m=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let g=c.width,h=c.height,_=c.x,v=c.y;return s==null&&n.x&&d&&(s=c.x-n.x),o==null&&n.y&&p&&(o=c.y-n.y),_-=s||0,v-=o||0,g=0,h=0,!l||m?(g=n.axis==="y"?c.width:0,h=n.axis==="x"?c.height:0,_=d&&n.x!=null?n.x:_,v=p&&n.y!=null?n.y:v):l&&!m&&(h=n.axis==="x"?c.height:h,g=n.axis==="y"?c.width:g),l=!0,{width:g,height:h,x:_,y:v,top:v,right:_+g,bottom:v+h,left:_}}}}function m1(e){return e!=null&&e.clientX!=null}function z3(e,n={}){const{enabled:s=!0,axis:o="both"}=n,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),[_,v]=x.useState(),[k,S]=x.useState([]),j=Le(R=>{l.set("positionReference",R)}),w=Le((R,T,O)=>{g.current||m.current.openEvent&&!m1(m.current.openEvent)||l.set("positionReference",O3(O??p,{x:R,y:T,axis:o,dataRef:m,pointerType:_}))}),C=Le(R=>{c?h.current||(w(R.clientX,R.clientY,R.currentTarget),S([])):w(R.clientX,R.clientY,R.currentTarget)}),E=uo(_)?d:c;x.useEffect(()=>{if(!s){j(p);return}if(!E)return;function R(){h.current?.(),h.current=null}const T=Qt(d);function O(A){const z=Tn(A);Ze(d,z)?R():w(A.clientX,A.clientY)}return!m.current.openEvent||m1(m.current.openEvent)?h.current=ft(T,"mousemove",O):j(p),R},[E,s,d,m,p,l,w,j,k]),x.useEffect(()=>()=>{l.set("positionReference",null)},[l]),x.useEffect(()=>{s&&!d&&(g.current=!1)},[s,d]),x.useEffect(()=>{!s&&c&&(g.current=!0)},[s,c]);const N=x.useMemo(()=>{function R(T){v(T.pointerType)}return{onPointerDown:R,onPointerEnter:R,onMouseMove:C,onMouseEnter:C}},[C]);return x.useMemo(()=>s?{reference:N,trigger:N}:{},[s,N])}const D3={intentional:"onClick",sloppy:"onPointerDown"};function L3(){return!1}function P3(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Ux(e,n={}){const{enabled:s=!0,escapeKey:o=!0,outsidePress:l=!0,outsidePressEvent:c="sloppy",referencePress:d=L3,referencePressEvent:p="sloppy",bubbles:m,externalTree:g}=n,h="rootStore"in e?e.rootStore:e,_=h.useState("open"),v=h.useState("floatingElement"),{dataRef:k}=h.context,S=Pl(g),j=Le(typeof l=="function"?l:()=>!1),w=typeof l=="function"?j:l,C=w!==!1,E=Le(()=>c),{escapeKey:N,outsidePress:R}=P3(m),T=x.useRef(!1),O=x.useRef(!1),A=x.useRef(!1),z=x.useRef(!1),B=x.useRef(""),L=x.useRef(null),D=sa(),P=sa(),H=Le(()=>{P.clear(),k.current.insideReactTree=!1}),q=Le(F=>{const J=k.current.floatingContext?.nodeId;return(S?Nr(S.nodesRef.current,J):[]).some(re=>re.context?.open&&!re.context.dataRef.current[F])}),Y=Le(F=>sg(F,h.select("floatingElement"))||sg(F,h.select("domReferenceElement"))),V=Le(F=>{d()&&h.setOpen(!1,lt(gc,F.nativeEvent))}),$=Le(F=>{if(!_||!s||!o||F.key!=="Escape"||z.current||!N&&q("__escapeKeyBubbles"))return;const J=bM(F)?F.nativeEvent:F,ie=lt(Rx,J);h.setOpen(!1,ie),ie.isCanceled||F.preventDefault(),!N&&!ie.isPropagationAllowed&&F.stopPropagation()}),Z=Le(()=>{k.current.insideReactTree=!0,P.start(0,H)}),G=Le(F=>{if(!_||!s||F.button!==0)return;const J=Tn(F.nativeEvent);Ze(h.select("floatingElement"),J)&&(T.current||(T.current=!0,O.current=!1))}),X=Le(F=>{!_||!s||(F.defaultPrevented||F.nativeEvent.defaultPrevented)&&T.current&&(O.current=!0)});x.useEffect(()=>{if(!_||!s)return;k.current.__escapeKeyBubbles=N,k.current.__outsidePressBubbles=R;const F=new Ga,J=new Ga;function ie(){F.clear(),z.current=!0}function re(){F.start(gf()?5:0,()=>{z.current=!1})}function oe(){A.current=!0,J.start(0,()=>{A.current=!1})}function ce(){T.current=!1,O.current=!1}function ee(){const le=B.current,je=le==="pen"||!le?"mouse":le,ke=E(),Ue=typeof ke=="function"?ke():ke;return typeof Ue=="string"?Ue:Ue[je]}function Te(le){const je=ee();return je==="intentional"&&le.type!=="click"||je==="sloppy"&&le.type==="click"}function Fe(le){const je=k.current.floatingContext?.nodeId,ke=S&&Nr(S.nodesRef.current,je).some(Ue=>sg(le,Ue.context?.elements.floating));return Y(le)||ke}function _e(le){if(Te(le)){le.type!=="click"&&!Y(le)&&(J.clear(),A.current=!1),H();return}if(k.current.insideReactTree){H();return}const je=Tn(le),ke=`[${bc("inert")}]`,Ue=dt(je)?je.getRootNode():null,Je=Array.from((vl(Ue)?Ue:vt(h.select("floatingElement"))).querySelectorAll(ke)),yt=h.context.triggerElements;if(je&&(yt.hasElement(je)||yt.hasMatchingElement(pe=>Ze(pe,je))))return;let zt=dt(je)?je:null;for(;zt&&!Ls(zt);){const pe=Us(zt);if(Ls(pe)||!dt(pe))break;zt=pe}if(!(Je.length&&dt(je)&&!kM(je)&&!Ze(je,h.select("floatingElement"))&&Je.every(pe=>!Ze(zt,pe)))){if(Gt(je)&&!("touches"in le)){const pe=Ls(je),Ee=oa(je),Re=/auto|scroll/,qe=pe||Re.test(Ee.overflowX),st=pe||Re.test(Ee.overflowY),an=qe&&je.clientWidth>0&&je.scrollWidth>je.clientWidth,Vt=st&&je.clientHeight>0&&je.scrollHeight>je.clientHeight,mt=Ee.direction==="rtl",Rt=Vt&&(mt?le.offsetX<=je.offsetWidth-je.clientWidth:le.offsetX>je.clientWidth),Wt=an&&le.offsetY>je.clientHeight;if(Rt||Wt)return}if(!Fe(le)){if(ee()==="intentional"&&A.current){J.clear(),A.current=!1;return}typeof w=="function"&&!w(le)||q("__outsidePressBubbles")||(h.setOpen(!1,lt(Nx,le)),H())}}}function Se(le){ee()!=="sloppy"||le.pointerType==="touch"||!h.select("open")||!s||Y(le)||_e(le)}function Ne(le){if(ee()!=="sloppy"||!h.select("open")||!s||Y(le))return;const je=le.touches[0];je&&(L.current={startTime:Date.now(),startX:je.clientX,startY:je.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},D.start(1e3,()=>{L.current&&(L.current.dismissOnTouchEnd=!1,L.current.dismissOnMouseDown=!1)}))}function Pe(le,je){const ke=Tn(le);if(!ke)return;const Ue=ft(ke,le.type,()=>{je(le),Ue()})}function Ie(le){B.current="touch",Pe(le,Ne)}function be(le){D.clear(),le.type==="pointerdown"&&(B.current=le.pointerType),!(le.type==="mousedown"&&L.current&&!L.current.dismissOnMouseDown)&&Pe(le,je=>{je.type==="pointerdown"?Se(je):_e(je)})}function Ae(le){if(!T.current)return;const je=O.current;if(ce(),ee()==="intentional"){if(le.type==="pointercancel"){je&&oe();return}if(!Fe(le)){if(je){oe();return}typeof w=="function"&&!w(le)||(J.clear(),A.current=!0,H())}}}function we(le){if(ee()!=="sloppy"||!L.current||Y(le))return;const je=le.touches[0];if(!je)return;const ke=Math.abs(je.clientX-L.current.startX),Ue=Math.abs(je.clientY-L.current.startY),Je=Math.sqrt(ke*ke+Ue*Ue);Je>5&&(L.current.dismissOnTouchEnd=!0),Je>10&&(_e(le),D.clear(),L.current=null)}function Be(le){Pe(le,we)}function Xe(le){ee()!=="sloppy"||!L.current||Y(le)||(L.current.dismissOnTouchEnd&&_e(le),D.clear(),L.current=null)}function Ye(le){Pe(le,Xe)}const De=vt(v),ve=ss(o&&ss(ft(De,"keydown",$),ft(De,"compositionstart",ie),ft(De,"compositionend",re)),C&&ss(ft(De,"click",be,!0),ft(De,"pointerdown",be,!0),ft(De,"pointerup",Ae,!0),ft(De,"pointercancel",Ae,!0),ft(De,"mousedown",be,!0),ft(De,"mouseup",Ae,!0),ft(De,"touchstart",Ie,!0),ft(De,"touchmove",Be,!0),ft(De,"touchend",Ye,!0)));return()=>{ve(),F.clear(),J.clear(),ce(),A.current=!1}},[k,v,o,C,w,_,s,N,R,$,H,E,q,Y,S,h,D]),x.useEffect(H,[w,H]);const U=x.useMemo(()=>({onKeyDown:$,[D3[p]]:V,...p!=="intentional"&&{onClick:V}}),[$,V,p]),K=x.useMemo(()=>({onKeyDown:$,onPointerDown:X,onMouseDown:X,onClickCapture:Z,onMouseDownCapture(F){Z(),G(F)},onPointerDownCapture(F){Z(),G(F)},onMouseUpCapture:Z,onTouchEndCapture:Z,onTouchMoveCapture:Z}),[$,Z,G,X]);return x.useMemo(()=>s?{reference:U,floating:K,trigger:U}:{},[s,U,K])}function g1(e,n,s){let{reference:o,floating:l}=e;const c=Oa(n),d=zx(n),p=Ox(d),m=ra(n),g=c==="y",h=o.x+o.width/2-l.width/2,_=o.y+o.height/2-l.height/2,v=o[p]/2-l[p]/2;let k;switch(m){case"top":k={x:h,y:o.y-l.height};break;case"bottom":k={x:h,y:o.y+o.height};break;case"right":k={x:o.x+o.width,y:_};break;case"left":k={x:o.x-l.width,y:_};break;default:k={x:o.x,y:o.y}}switch(Or(n)){case"start":k[d]-=v*(s&&g?-1:1);break;case"end":k[d]+=v*(s&&g?-1:1);break}return k}async function I3(e,n){var s;n===void 0&&(n={});const{x:o,y:l,platform:c,rects:d,elements:p,strategy:m}=e,{boundary:g="clippingAncestors",rootBoundary:h="viewport",elementContext:_="floating",altBoundary:v=!1,padding:k=0}=qs(n,e),S=Tk(k),w=p[v?_==="floating"?"reference":"floating":_],C=hc(await c.getClippingRect({element:(s=await(c.isElement==null?void 0:c.isElement(w)))==null||s?w:w.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(p.floating)),boundary:g,rootBoundary:h,strategy:m})),E=_==="floating"?{x:o,y:l,width:d.floating.width,height:d.floating.height}:d.reference,N=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p.floating)),R=await(c.isElement==null?void 0:c.isElement(N))?await(c.getScale==null?void 0:c.getScale(N))||{x:1,y:1}:{x:1,y:1},T=hc(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:p,rect:E,offsetParent:N,strategy:m}):E);return{top:(C.top-T.top+S.top)/R.y,bottom:(T.bottom-C.bottom+S.bottom)/R.y,left:(C.left-T.left+S.left)/R.x,right:(T.right-C.right+S.right)/R.x}}const B3=50,U3=async(e,n,s)=>{const{placement:o="bottom",strategy:l="absolute",middleware:c=[],platform:d}=s,p=d.detectOverflow?d:{...d,detectOverflow:I3},m=await(d.isRTL==null?void 0:d.isRTL(n));let g=await d.getElementRects({reference:e,floating:n,strategy:l}),{x:h,y:_}=g1(g,o,m),v=o,k=0;const S={};for(let j=0;j<c.length;j++){const w=c[j];if(!w)continue;const{name:C,fn:E}=w,{x:N,y:R,data:T,reset:O}=await E({x:h,y:_,initialPlacement:o,placement:v,strategy:l,middlewareData:S,rects:g,platform:p,elements:{reference:e,floating:n}});h=N??h,_=R??_,S[C]={...S[C],...T},O&&k<B3&&(k++,typeof O=="object"&&(O.placement&&(v=O.placement),O.rects&&(g=O.rects===!0?await d.getElementRects({reference:e,floating:n,strategy:l}):O.rects),{x:h,y:_}=g1(g,v,m)),j=-1)}return{x:h,y:_,placement:v,strategy:l,middlewareData:S}},H3=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var s,o;const{placement:l,middlewareData:c,rects:d,initialPlacement:p,platform:m,elements:g}=n,{mainAxis:h=!0,crossAxis:_=!0,fallbackPlacements:v,fallbackStrategy:k="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:j=!0,...w}=qs(e,n);if((s=c.arrow)!=null&&s.alignmentOffset)return{};const C=ra(l),E=Oa(p),N=ra(p)===p,R=await(m.isRTL==null?void 0:m.isRTL(g.floating)),T=v||(N||!j?[Hd(p)]:GM(p)),O=S!=="none";!v&&O&&T.push(...KM(p,j,S,R));const A=[p,...T],z=await m.detectOverflow(n,w),B=[];let L=((o=c.flip)==null?void 0:o.overflows)||[];if(h&&B.push(z[C]),_){const q=$M(l,d,R);B.push(z[q[0]],z[q[1]])}if(L=[...L,{placement:l,overflows:B}],!B.every(q=>q<=0)){var D,P;const q=(((D=c.flip)==null?void 0:D.index)||0)+1,Y=A[q];if(Y&&(!(_==="alignment"?E!==Oa(Y):!1)||L.every(Z=>Oa(Z.placement)===E?Z.overflows[0]>0:!0)))return{data:{index:q,overflows:L},reset:{placement:Y}};let V=(P=L.filter($=>$.overflows[0]<=0).sort(($,Z)=>$.overflows[1]-Z.overflows[1])[0])==null?void 0:P.placement;if(!V)switch(k){case"bestFit":{var H;const $=(H=L.filter(Z=>{if(O){const G=Oa(Z.placement);return G===E||G==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(G=>G>0).reduce((G,X)=>G+X,0)]).sort((Z,G)=>Z[1]-G[1])[0])==null?void 0:H[0];$&&(V=$);break}case"initialPlacement":V=p;break}if(l!==V)return{reset:{placement:V}}}return{}}}};function h1(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function x1(e){return VM.some(n=>e[n]>=0)}const V3=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:s,platform:o}=n,{strategy:l="referenceHidden",...c}=qs(e,n);switch(l){case"referenceHidden":{const d=await o.detectOverflow(n,{...c,elementContext:"reference"}),p=h1(d,s.reference);return{data:{referenceHiddenOffsets:p,referenceHidden:x1(p)}}}case"escaped":{const d=await o.detectOverflow(n,{...c,altBoundary:!0}),p=h1(d,s.floating);return{data:{escapedOffsets:p,escaped:x1(p)}}}default:return{}}}}},nS=new Set(["left","top"]);async function q3(e,n){const{placement:s,platform:o,elements:l}=e,c=await(o.isRTL==null?void 0:o.isRTL(l.floating)),d=ra(s),p=Or(s),m=Oa(s)==="y",g=nS.has(d)?-1:1,h=c&&m?-1:1,_=qs(n,e);let{mainAxis:v,crossAxis:k,alignmentAxis:S}=typeof _=="number"?{mainAxis:_,crossAxis:0,alignmentAxis:null}:{mainAxis:_.mainAxis||0,crossAxis:_.crossAxis||0,alignmentAxis:_.alignmentAxis};return p&&typeof S=="number"&&(k=p==="end"?S*-1:S),m?{x:k*h,y:v*g}:{x:v*g,y:k*h}}const $3=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var s,o;const{x:l,y:c,placement:d,middlewareData:p}=n,m=await q3(n,e);return d===((s=p.offset)==null?void 0:s.placement)&&(o=p.arrow)!=null&&o.alignmentOffset?{}:{x:l+m.x,y:c+m.y,data:{...m,placement:d}}}}},G3=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:s,y:o,placement:l,platform:c}=n,{mainAxis:d=!0,crossAxis:p=!1,limiter:m={fn:C=>{let{x:E,y:N}=C;return{x:E,y:N}}},...g}=qs(e,n),h={x:s,y:o},_=await c.detectOverflow(n,g),v=Oa(ra(l)),k=Mx(v);let S=h[k],j=h[v];if(d){const C=k==="y"?"top":"left",E=k==="y"?"bottom":"right",N=S+_[C],R=S-_[E];S=wh(N,S,R)}if(p){const C=v==="y"?"top":"left",E=v==="y"?"bottom":"right",N=j+_[C],R=j-_[E];j=wh(N,j,R)}const w=m.fn({...n,[k]:S,[v]:j});return{...w,data:{x:w.x-s,y:w.y-o,enabled:{[k]:d,[v]:p}}}}}},F3=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:s,y:o,placement:l,rects:c,middlewareData:d}=n,{offset:p=0,mainAxis:m=!0,crossAxis:g=!0}=qs(e,n),h={x:s,y:o},_=Oa(l),v=Mx(_);let k=h[v],S=h[_];const j=qs(p,n),w=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(m){const N=v==="y"?"height":"width",R=c.reference[v]-c.floating[N]+w.mainAxis,T=c.reference[v]+c.reference[N]-w.mainAxis;k<R?k=R:k>T&&(k=T)}if(g){var C,E;const N=v==="y"?"width":"height",R=nS.has(ra(l)),T=c.reference[_]-c.floating[N]+(R&&((C=d.offset)==null?void 0:C[_])||0)+(R?0:w.crossAxis),O=c.reference[_]+c.reference[N]+(R?0:((E=d.offset)==null?void 0:E[_])||0)-(R?w.crossAxis:0);S<T?S=T:S>O&&(S=O)}return{[v]:k,[_]:S}}}},Y3=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var s,o;const{placement:l,rects:c,platform:d,elements:p}=n,{apply:m=()=>{},...g}=qs(e,n),h=await d.detectOverflow(n,g),_=ra(l),v=Or(l),k=Oa(l)==="y",{width:S,height:j}=c.floating;let w,C;_==="top"||_==="bottom"?(w=_,C=v===(await(d.isRTL==null?void 0:d.isRTL(p.floating))?"start":"end")?"left":"right"):(C=_,w=v==="end"?"top":"bottom");const E=j-h.top-h.bottom,N=S-h.left-h.right,R=jl(j-h[w],E),T=jl(S-h[C],N),O=!n.middlewareData.shift;let A=R,z=T;if((s=n.middlewareData.shift)!=null&&s.enabled.x&&(z=N),(o=n.middlewareData.shift)!=null&&o.enabled.y&&(A=E),O&&!v){const L=_a(h.left,0),D=_a(h.right,0),P=_a(h.top,0),H=_a(h.bottom,0);k?z=S-2*(L!==0||D!==0?L+D:_a(h.left,h.right)):A=j-2*(P!==0||H!==0?P+H:_a(h.top,h.bottom))}await m({...n,availableWidth:z,availableHeight:A});const B=await d.getDimensions(p.floating);return S!==B.width||j!==B.height?{reset:{rects:!0}}:{}}}};function aS(e){const n=oa(e);let s=parseFloat(n.width)||0,o=parseFloat(n.height)||0;const l=Gt(e),c=l?e.offsetWidth:s,d=l?e.offsetHeight:o,p=Ud(s)!==c||Ud(o)!==d;return p&&(s=c,o=d),{width:s,height:o,$:p}}function Hx(e){return dt(e)?e:e.contextElement}function ml(e){const n=Hx(e);if(!Gt(n))return rs(1);const s=n.getBoundingClientRect(),{width:o,height:l,$:c}=aS(n);let d=(c?Ud(s.width):s.width)/o,p=(c?Ud(s.height):s.height)/l;return(!d||!Number.isFinite(d))&&(d=1),(!p||!Number.isFinite(p))&&(p=1),{x:d,y:p}}const X3=rs(0);function sS(e){const n=Qt(e);return!gf()||!n.visualViewport?X3:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function K3(e,n,s){return n===void 0&&(n=!1),!s||n&&s!==Qt(e)?!1:n}function fo(e,n,s,o){n===void 0&&(n=!1),s===void 0&&(s=!1);const l=e.getBoundingClientRect(),c=Hx(e);let d=rs(1);n&&(o?dt(o)&&(d=ml(o)):d=ml(e));const p=K3(c,s,o)?sS(c):rs(0);let m=(l.left+p.x)/d.x,g=(l.top+p.y)/d.y,h=l.width/d.x,_=l.height/d.y;if(c){const v=Qt(c),k=o&&dt(o)?Qt(o):o;let S=v,j=vh(S);for(;j&&o&&k!==S;){const w=ml(j),C=j.getBoundingClientRect(),E=oa(j),N=C.left+(j.clientLeft+parseFloat(E.paddingLeft))*w.x,R=C.top+(j.clientTop+parseFloat(E.paddingTop))*w.y;m*=w.x,g*=w.y,h*=w.x,_*=w.y,m+=N,g+=R,S=Qt(j),j=vh(S)}}return hc({width:h,height:_,x:m,y:g})}function wf(e,n){const s=hf(e).scrollLeft;return n?n.left+s:fo(is(e)).left+s}function rS(e,n){const s=e.getBoundingClientRect(),o=s.left+n.scrollLeft-wf(e,s),l=s.top+n.scrollTop;return{x:o,y:l}}function Q3(e){let{elements:n,rect:s,offsetParent:o,strategy:l}=e;const c=l==="fixed",d=is(o),p=n?mf(n.floating):!1;if(o===d||p&&c)return s;let m={scrollLeft:0,scrollTop:0},g=rs(1);const h=rs(0),_=Gt(o);if((_||!_&&!c)&&((Hn(o)!=="body"||Mr(d))&&(m=hf(o)),_)){const k=fo(o);g=ml(o),h.x=k.x+o.clientLeft,h.y=k.y+o.clientTop}const v=d&&!_&&!c?rS(d,m):rs(0);return{width:s.width*g.x,height:s.height*g.y,x:s.x*g.x-m.scrollLeft*g.x+h.x+v.x,y:s.y*g.y-m.scrollTop*g.y+h.y+v.y}}function Z3(e){return Array.from(e.getClientRects())}function W3(e){const n=is(e),s=hf(e),o=e.ownerDocument.body,l=_a(n.scrollWidth,n.clientWidth,o.scrollWidth,o.clientWidth),c=_a(n.scrollHeight,n.clientHeight,o.scrollHeight,o.clientHeight);let d=-s.scrollLeft+wf(e);const p=-s.scrollTop;return oa(o).direction==="rtl"&&(d+=_a(n.clientWidth,o.clientWidth)-l),{width:l,height:c,x:d,y:p}}const b1=25;function J3(e,n){const s=Qt(e),o=is(e),l=s.visualViewport;let c=o.clientWidth,d=o.clientHeight,p=0,m=0;if(l){c=l.width,d=l.height;const h=gf();(!h||h&&n==="fixed")&&(p=l.offsetLeft,m=l.offsetTop)}const g=wf(o);if(g<=0){const h=o.ownerDocument,_=h.body,v=getComputedStyle(_),k=h.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,S=Math.abs(o.clientWidth-_.clientWidth-k);S<=b1&&(c-=S)}else g<=b1&&(c+=g);return{width:c,height:d,x:p,y:m}}function e5(e,n){const s=fo(e,!0,n==="fixed"),o=s.top+e.clientTop,l=s.left+e.clientLeft,c=Gt(e)?ml(e):rs(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 _1(e,n,s){let o;if(n==="viewport")o=J3(e,s);else if(n==="document")o=W3(is(e));else if(dt(n))o=e5(n,s);else{const l=sS(e);o={x:n.x-l.x,y:n.y-l.y,width:n.width,height:n.height}}return hc(o)}function oS(e,n){const s=Us(e);return s===n||!dt(s)||Ls(s)?!1:oa(s).position==="fixed"||oS(s,n)}function t5(e,n){const s=n.get(e);if(s)return s;let o=pc(e,[],!1).filter(p=>dt(p)&&Hn(p)!=="body"),l=null;const c=oa(e).position==="fixed";let d=c?Us(e):e;for(;dt(d)&&!Ls(d);){const p=oa(d),m=Cx(d);!m&&p.position==="fixed"&&(l=null),(c?!m&&!l:!m&&p.position==="static"&&!!l&&(l.position==="absolute"||l.position==="fixed")||Mr(d)&&!m&&oS(e,d))?o=o.filter(h=>h!==d):l=p,d=Us(d)}return n.set(e,o),o}function n5(e){let{element:n,boundary:s,rootBoundary:o,strategy:l}=e;const d=[...s==="clippingAncestors"?mf(n)?[]:t5(n,this._c):[].concat(s),o],p=_1(n,d[0],l);let m=p.top,g=p.right,h=p.bottom,_=p.left;for(let v=1;v<d.length;v++){const k=_1(n,d[v],l);m=_a(k.top,m),g=jl(k.right,g),h=jl(k.bottom,h),_=_a(k.left,_)}return{width:g-_,height:h-m,x:_,y:m}}function a5(e){const{width:n,height:s}=aS(e);return{width:n,height:s}}function s5(e,n,s){const o=Gt(n),l=is(n),c=s==="fixed",d=fo(e,!0,c,n);let p={scrollLeft:0,scrollTop:0};const m=rs(0);function g(){m.x=wf(l)}if(o||!o&&!c)if((Hn(n)!=="body"||Mr(l))&&(p=hf(n)),o){const k=fo(n,!0,c,n);m.x=k.x+n.clientLeft,m.y=k.y+n.clientTop}else l&&g();c&&!o&&l&&g();const h=l&&!o&&!c?rS(l,p):rs(0),_=d.left+p.scrollLeft-m.x-h.x,v=d.top+p.scrollTop-m.y-h.y;return{x:_,y:v,width:d.width,height:d.height}}function fg(e){return oa(e).position==="static"}function v1(e,n){if(!Gt(e)||oa(e).position==="fixed")return null;if(n)return n(e);let s=e.offsetParent;return is(e)===s&&(s=s.ownerDocument.body),s}function lS(e,n){const s=Qt(e);if(mf(e))return s;if(!Gt(e)){let l=Us(e);for(;l&&!Ls(l);){if(dt(l)&&!fg(l))return l;l=Us(l)}return s}let o=v1(e,n);for(;o&&vM(o)&&fg(o);)o=v1(o,n);return o&&Ls(o)&&fg(o)&&!Cx(o)?s:o||wM(e)||s}const r5=async function(e){const n=this.getOffsetParent||lS,s=this.getDimensions,o=await s(e.floating);return{reference:s5(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function o5(e){return oa(e).direction==="rtl"}const iS={convertOffsetParentRelativeRectToViewportRelativeRect:Q3,getDocumentElement:is,getClippingRect:n5,getOffsetParent:lS,getElementRects:r5,getClientRects:Z3,getDimensions:a5,getScale:ml,isElement:dt,isRTL:o5};function cS(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function l5(e,n){let s=null,o;const l=is(e);function c(){var p;clearTimeout(o),(p=s)==null||p.disconnect(),s=null}function d(p,m){p===void 0&&(p=!1),m===void 0&&(m=1),c();const g=e.getBoundingClientRect(),{left:h,top:_,width:v,height:k}=g;if(p||n(),!v||!k)return;const S=oo(_),j=oo(l.clientWidth-(h+v)),w=oo(l.clientHeight-(_+k)),C=oo(h),N={rootMargin:-S+"px "+-j+"px "+-w+"px "+-C+"px",threshold:_a(0,jl(1,m))||1};let R=!0;function T(O){const A=O[0].intersectionRatio;if(A!==m){if(!R)return d();A?d(!1,A):o=setTimeout(()=>{d(!1,1e-7)},1e3)}A===1&&!cS(g,e.getBoundingClientRect())&&d(),R=!1}try{s=new IntersectionObserver(T,{...N,root:l.ownerDocument})}catch{s=new IntersectionObserver(T,N)}s.observe(e)}return d(!0),c}function y1(e,n,s,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=Hx(e),h=l||c?[...g?pc(g):[],...n?pc(n):[]]:[];h.forEach(C=>{l&&C.addEventListener("scroll",s,{passive:!0}),c&&C.addEventListener("resize",s)});const _=g&&p?l5(g,s):null;let v=-1,k=null;d&&(k=new ResizeObserver(C=>{let[E]=C;E&&E.target===g&&k&&n&&(k.unobserve(n),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var N;(N=k)==null||N.observe(n)})),s()}),g&&!m&&k.observe(g),n&&k.observe(n));let S,j=m?fo(e):null;m&&w();function w(){const C=fo(e);j&&!cS(j,C)&&s(),j=C,S=requestAnimationFrame(w)}return s(),()=>{var C;h.forEach(E=>{l&&E.removeEventListener("scroll",s),c&&E.removeEventListener("resize",s)}),_?.(),(C=k)==null||C.disconnect(),k=null,m&&cancelAnimationFrame(S)}}const i5=$3,c5=G3,u5=H3,d5=Y3,f5=V3,p5=F3,m5=(e,n,s)=>{const o=new Map,l={platform:iS,...s},c={...l.platform,_c:o};return U3(e,n,{...l,platform:c})};var g5=typeof document<"u",h5=function(){},kd=g5?x.useLayoutEffect:h5;function $d(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let s,o,l;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==n.length)return!1;for(o=s;o--!==0;)if(!$d(e[o],n[o]))return!1;return!0}if(l=Object.keys(e),s=l.length,s!==Object.keys(n).length)return!1;for(o=s;o--!==0;)if(!{}.hasOwnProperty.call(n,l[o]))return!1;for(o=s;o--!==0;){const c=l[o];if(!(c==="_owner"&&e.$$typeof)&&!$d(e[c],n[c]))return!1}return!0}return e!==e&&n!==n}function uS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function j1(e,n){const s=uS(e);return Math.round(n*s)/s}function pg(e){const n=x.useRef(e);return kd(()=>{n.current=e}),n}function x5(e){e===void 0&&(e={});const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:l,elements:{reference:c,floating:d}={},transform:p=!0,whileElementsMounted:m,open:g}=e,[h,_]=x.useState({x:0,y:0,strategy:s,placement:n,middlewareData:{},isPositioned:!1}),[v,k]=x.useState(o);$d(v,o)||k(o);const[S,j]=x.useState(null),[w,C]=x.useState(null),E=x.useCallback(Z=>{Z!==O.current&&(O.current=Z,j(Z))},[]),N=x.useCallback(Z=>{Z!==A.current&&(A.current=Z,C(Z))},[]),R=c||S,T=d||w,O=x.useRef(null),A=x.useRef(null),z=x.useRef(h),B=m!=null,L=pg(m),D=pg(l),P=pg(g),H=x.useCallback(()=>{if(!O.current||!A.current)return;const Z={placement:n,strategy:s,middleware:v};D.current&&(Z.platform=D.current),m5(O.current,A.current,Z).then(G=>{const X={...G,isPositioned:P.current!==!1};q.current&&!$d(z.current,X)&&(z.current=X,Tr.flushSync(()=>{_(X)}))})},[v,n,s,D,P]);kd(()=>{g===!1&&z.current.isPositioned&&(z.current.isPositioned=!1,_(Z=>({...Z,isPositioned:!1})))},[g]);const q=x.useRef(!1);kd(()=>(q.current=!0,()=>{q.current=!1}),[]),kd(()=>{if(R&&(O.current=R),T&&(A.current=T),R&&T){if(L.current)return L.current(R,T,H);H()}},[R,T,H,L,B]);const Y=x.useMemo(()=>({reference:O,floating:A,setReference:E,setFloating:N}),[E,N]),V=x.useMemo(()=>({reference:R,floating:T}),[R,T]),$=x.useMemo(()=>{const Z={position:s,left:0,top:0};if(!V.floating)return Z;const G=j1(V.floating,h.x),X=j1(V.floating,h.y);return p?{...Z,transform:"translate("+G+"px, "+X+"px)",...uS(V.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:G,top:X}},[s,p,V.floating,h.x,h.y]);return x.useMemo(()=>({...h,update:H,refs:Y,elements:V,floatingStyles:$}),[h,H,Y,V,$])}const b5=(e,n)=>{const s=i5(e);return{name:s.name,fn:s.fn,options:[e,n]}},_5=(e,n)=>{const s=c5(e);return{name:s.name,fn:s.fn,options:[e,n]}},v5=(e,n)=>({fn:p5(e).fn,options:[e,n]}),y5=(e,n)=>{const s=u5(e);return{name:s.name,fn:s.fn,options:[e,n]}},j5=(e,n)=>{const s=d5(e);return{name:s.name,fn:s.fn,options:[e,n]}},w5=(e,n)=>{const s=f5(e);return{name:s.name,fn:s.fn,options:[e,n]}},ze=(e,n,s,o,l,c,...d)=>{if(d.length>0)throw new Error(Mn(1));let p;if(e)p=e;else throw new Error("Missing arguments");return p};var mg={exports:{}},gg={};/**
581
- * @license React
582
- * use-sync-external-store-shim.production.js
583
- *
584
- * Copyright (c) Meta Platforms, Inc. and affiliates.
585
- *
586
- * This source code is licensed under the MIT license found in the
587
- * LICENSE file in the root directory of this source tree.
588
- */var w1;function k5(){if(w1)return gg;w1=1;var e=wc();function n(_,v){return _===v&&(_!==0||1/_===1/v)||_!==_&&v!==v}var s=typeof Object.is=="function"?Object.is:n,o=e.useState,l=e.useEffect,c=e.useLayoutEffect,d=e.useDebugValue;function p(_,v){var k=v(),S=o({inst:{value:k,getSnapshot:v}}),j=S[0].inst,w=S[1];return c(function(){j.value=k,j.getSnapshot=v,m(j)&&w({inst:j})},[_,k,v]),l(function(){return m(j)&&w({inst:j}),_(function(){m(j)&&w({inst:j})})},[_]),d(k),k}function m(_){var v=_.getSnapshot;_=_.value;try{var k=v();return!s(_,k)}catch{return!0}}function g(_,v){return v()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?g:p;return gg.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,gg}var k1;function dS(){return k1||(k1=1,mg.exports=k5()),mg.exports}var Gd=dS(),hg={exports:{}},xg={};/**
589
- * @license React
590
- * use-sync-external-store-shim/with-selector.production.js
591
- *
592
- * Copyright (c) Meta Platforms, Inc. and affiliates.
593
- *
594
- * This source code is licensed under the MIT license found in the
595
- * LICENSE file in the root directory of this source tree.
596
- */var S1;function S5(){if(S1)return xg;S1=1;var e=wc(),n=dS();function s(g,h){return g===h&&(g!==0||1/g===1/h)||g!==g&&h!==h}var o=typeof Object.is=="function"?Object.is:s,l=n.useSyncExternalStore,c=e.useRef,d=e.useEffect,p=e.useMemo,m=e.useDebugValue;return xg.useSyncExternalStoreWithSelector=function(g,h,_,v,k){var S=c(null);if(S.current===null){var j={hasValue:!1,value:null};S.current=j}else j=S.current;S=p(function(){function C(O){if(!E){if(E=!0,N=O,O=v(O),k!==void 0&&j.hasValue){var A=j.value;if(k(A,O))return R=A}return R=O}if(A=R,o(N,O))return A;var z=v(O);return k!==void 0&&k(A,z)?(N=O,A):(N=O,R=z)}var E=!1,N,R,T=_===void 0?null:_;return[function(){return C(h())},T===null?void 0:function(){return C(T())}]},[h,_,v,k]);var w=l(g,S[0],S[1]);return d(function(){j.hasValue=!0,j.value=w},[w]),m(w),w},xg}var C1;function C5(){return C1||(C1=1,hg.exports=S5()),hg.exports}var E5=C5();const N5=Lx(19),R5=N5?A5:M5;function tt(e,n,s,o,l){return R5(e,n,s,o,l)}function T5(e,n,s,o,l){const c=x.useCallback(()=>n(e.getSnapshot(),s,o,l),[e,n,s,o,l]);return Gd.useSyncExternalStore(e.subscribe,c,c)}iM({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let n=!1;for(let s=0;s<e.syncHooks.length;s+=1){const o=e.syncHooks[s],l=o.selector(o.store.state,o.a1,o.a2,o.a3);(o.didChange||!Object.is(o.value,l))&&(n=!0,o.value=l,o.didChange=!1)}return n&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=n=>{const s=new Set;for(const l of e.syncHooks)s.add(l.store);const o=[];for(const l of s)o.push(l.subscribe(n));return()=>{for(const l of o)l()}}),Gd.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function A5(e,n,s,o,l){const c=lM();if(!c)return T5(e,n,s,o,l);const d=c.syncIndex;c.syncIndex+=1;let p;return c.didInitialize?(p=c.syncHooks[d],(p.store!==e||p.selector!==n||!Object.is(p.a1,s)||!Object.is(p.a2,o)||!Object.is(p.a3,l))&&(p.store!==e&&(c.didChangeStore=!0),p.store=e,p.selector=n,p.a1=s,p.a2=o,p.a3=l,p.didChange=!0)):(p={store:e,selector:n,a1:s,a2:o,a3:l,value:n(e.getSnapshot(),s,o,l),didChange:!1},c.syncHooks.push(p)),p.value}function M5(e,n,s,o,l){return E5.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>n(c,s,o,l))}class fS{constructor(n){this.state=n,this.listeners=new Set,this.updateTick=0}subscribe=n=>(this.listeners.add(n),()=>{this.listeners.delete(n)});getSnapshot=()=>this.state;setState(n){if(this.state===n)return;this.state=n,this.updateTick+=1;const s=this.updateTick;for(const o of this.listeners){if(s!==this.updateTick)return;o(n)}}update(n){for(const s in n)if(!Object.is(this.state[s],n[s])){this.setState({...this.state,...n});return}}set(n,s){Object.is(this.state[n],s)||this.setState({...this.state,[n]:s})}notifyAll(){const n={...this.state};this.setState(n)}use(n,s,o,l){return tt(this,n,s,o,l)}}class Vx extends fS{constructor(n,s={},o){super(n),this.context=s,this.selectors=o}useSyncedValue(n,s){x.useDebugValue(n);const o=this;Me(()=>{o.state[n]!==s&&o.set(n,s)},[o,n,s])}useSyncedValueWithCleanup(n,s){const o=this;Me(()=>(o.state[n]!==s&&o.set(n,s),()=>{o.set(n,void 0)}),[o,n,s])}useSyncedValues(n){const s=this,o=Object.values(n);Me(()=>{s.update(n)},[s,...o])}useControlledProp(n,s){x.useDebugValue(n);const o=this,l=s!==void 0;Me(()=>{l&&!Object.is(o.state[n],s)&&o.setState({...o.state,[n]:s})},[o,n,s,l])}select(n,s,o,l){const c=this.selectors[n];return c(this.state,s,o,l)}useState(n,s,o,l){return x.useDebugValue(n),tt(this,this.selectors[n],s,o,l)}useContextCallback(n,s){x.useDebugValue(n);const o=Le(s??Bn);this.context[n]=o}useStateSetter(n){const s=x.useRef(void 0);return s.current===void 0&&(s.current=o=>{this.set(n,o)}),s.current}observe(n,s){let o;typeof n=="function"?o=n:o=this.selectors[n];let l=o(this.state);return s(l,l,this),this.subscribe(c=>{const d=o(c);if(!Object.is(l,d)){const p=l;l=d,s(d,p,this)}})}}const O5={open:ze(e=>e.open),transitionStatus:ze(e=>e.transitionStatus),domReferenceElement:ze(e=>e.domReferenceElement),referenceElement:ze(e=>e.positionReference??e.referenceElement),floatingElement:ze(e=>e.floatingElement),floatingId:ze(e=>e.floatingId)};class kf extends Vx{constructor(n){const{syncOnly:s,nested:o,onOpenChange:l,triggerElements:c,...d}=n;super({...d,positionReference:d.referenceElement,domReferenceElement:d.referenceElement},{onOpenChange:l,dataRef:{current:{}},events:C3(),nested:o,triggerElements:c},O5),this.syncOnly=s}syncOpenEvent=(n,s)=>{(!n||!this.state.open||s!=null&&_M(s))&&(this.context.dataRef.current.openEvent=n?s:void 0)};dispatchOpenChange=(n,s)=>{this.syncOpenEvent(n,s.event);const o={open:n,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",o)};setOpen=(n,s)=>{if(this.syncOnly){this.context.onOpenChange?.(n,s);return}this.dispatchOpenChange(n,s),this.context.onOpenChange?.(n,s)}}function z5(e){const{popupStore:n,treatPopupAsFloatingElement:s=!1,floatingRootContext:o,floatingId:l,nested:c,onOpenChange:d}=e,p=n.useState("open"),m=n.useState("activeTriggerElement"),g=n.useState(s?"popupElement":"positionerElement"),h=n.context.triggerElements,_=d,v=x.useRef(null);o===void 0&&v.current===null&&(v.current=new kf({open:p,transitionStatus:void 0,referenceElement:m,floatingElement:g,triggerElements:h,onOpenChange:_,floatingId:l,syncOnly:!0,nested:c}));const k=o??v.current;return n.useSyncedValue("floatingId",l),Me(()=>{const S={open:p,floatingId:l,referenceElement:m,floatingElement:g};dt(m)&&(S.domReferenceElement=m),k.state.positionReference===k.state.referenceElement&&(S.positionReference=m),k.update(S)},[p,l,m,g,k]),k.context.onOpenChange=_,k.context.nested=c,k}function Tc(e,n=!1,s=!1){const[o,l]=x.useState(e&&n?"idle":void 0),[c,d]=x.useState(e);return e&&!c&&(d(!0),l("starting")),!e&&c&&o!=="ending"&&!s&&l("ending"),!e&&!c&&o==="ending"&&l(void 0),Me(()=>{if(!e&&c&&o!=="ending"&&s){const p=es.request(()=>{l("ending")});return()=>{es.cancel(p)}}},[e,c,o,s]),Me(()=>{if(!e||n)return;const p=es.request(()=>{l(void 0)});return()=>{es.cancel(p)}},[n,e]),Me(()=>{if(!e||!n)return;e&&c&&o!=="idle"&&l("starting");const p=es.request(()=>{l("idle")});return()=>{es.cancel(p)}},[n,e,c,o]),{mounted:c,setMounted:d,transitionStatus:o}}let po=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const D5={[po.startingStyle]:""},L5={[po.endingStyle]:""},Il={transitionStatus(e){return e==="starting"?D5:e==="ending"?L5:null}};function P5(e,n=!1,s=!0){const o=yl();return Le((l,c=null)=>{o.cancel();const d=Os(e);if(d==null)return;const p=d,m=()=>{Tr.flushSync(l)};if(typeof p.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){l();return}function g(){Promise.all(p.getAnimations().map(h=>h.finished)).then(()=>{c?.aborted||m()}).catch(()=>{if(s){c?.aborted||m();return}const h=p.getAnimations();!c?.aborted&&h.length>0&&h.some(_=>_.pending||_.playState!=="finished")&&g()})}if(n){const h=po.startingStyle;if(!p.hasAttribute(h)){o.request(g);return}const _=new MutationObserver(()=>{p.hasAttribute(h)||(_.disconnect(),g())});_.observe(p,{attributes:!0,attributeFilter:[h]}),c?.addEventListener("abort",()=>_.disconnect(),{once:!0});return}o.request(g)})}function zr(e){const{enabled:n=!0,open:s,ref:o,onComplete:l}=e,c=Le(l),d=P5(o,s,!1);x.useEffect(()=>{if(!n)return;const p=new AbortController;return d(c,p.signal),()=>{p.abort()}},[n,s,c,d])}const Sf={tabIndex:-1,[yh]:""};function pS(e,n,s=!1){const o=yf(),l=jf()!=null,c=x.useRef(null);e===void 0&&c.current===null&&(c.current=n(o,l));const d=e??c.current;return z5({popupStore:d,treatPopupAsFloatingElement:s,floatingRootContext:d.state.floatingRootContext,floatingId:o,nested:l,onOpenChange:d.setOpen}),{store:d,internalStore:c.current}}function I5(e,n){const s=x.useRef(null),o=x.useRef(null);return x.useCallback(l=>{if(e===void 0)return;let c=!1;if(s.current!==null){const d=s.current,p=o.current,m=n.context.triggerElements.getById(d);p&&m===p&&(n.context.triggerElements.delete(d),c=!0),s.current=null,o.current=null}if(l!==null&&(s.current=e,o.current=l,n.context.triggerElements.add(e,l),c=!0),c){const d=n.context.triggerElements.size;n.select("open")&&n.state.triggerCount!==d&&n.set("triggerCount",d)}},[n,e])}function mS(e,n,s){const o=s?.id??null;(o||n)&&(e.activeTriggerId=o,e.activeTriggerElement=s??null)}function B5(e,n,s,o){const l=s.useState("isMountedByTrigger",e),c=I5(e,s),d=Le(p=>{if(c(p),!p)return;const m=s.select("open"),g=s.select("activeTriggerId");if(g===e){s.update({activeTriggerElement:p,...m?o:null});return}g==null&&m&&s.update({activeTriggerId:e,activeTriggerElement:p,...o})});return Me(()=>{l&&s.update({activeTriggerElement:n.current,...o})},[l,s,n,...Object.values(o)]),{registerTrigger:d,isMountedByThisTrigger:l}}function gS(e){const n=e.useState("open"),s=e.useState("triggerCount");Me(()=>{if(!n){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const o=e.context.triggerElements.size,l={};if(e.state.triggerCount!==o&&(l.triggerCount=o),!e.select("activeTriggerId")&&o===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[d,p]=c.value;l.activeTriggerId=d,l.activeTriggerElement=p}}(l.triggerCount!==void 0||l.activeTriggerId!==void 0)&&e.update(l)},[n,e,s])}function hS(e,n,s){const{mounted:o,setMounted:l,transitionStatus:c}=Tc(e);n.useSyncedValues({mounted:o,transitionStatus:c});const d=Le(()=>{l(!1),n.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n.context.onOpenChangeComplete?.(!1)}),p=n.useState("preventUnmountingOnClose");return zr({enabled:o&&!e&&!p,open:e,ref:n.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:c}}function xS(e,n){e.useSyncedValues(n),Me(()=>()=>{e.update({activeTriggerProps:un,inactiveTriggerProps:un,popupProps:un})},[e])}function U5(e,n){Me(()=>{!n&&e.state.openMethod!==null&&e.set("openMethod",null)},[n,e]),Me(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Cf{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(n,s){const o=this.idMap.get(n);o!==s&&(o!==void 0&&this.elementsSet.delete(o),this.elementsSet.add(s),this.idMap.set(n,s))}delete(n){const s=this.idMap.get(n);s&&(this.elementsSet.delete(s),this.idMap.delete(n))}hasElement(n){return this.elementsSet.has(n)}hasMatchingElement(n){for(const s of this.elementsSet)if(n(s))return!0;return!1}getById(n){return this.idMap.get(n)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function H5(){return new kf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Cf,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function bS(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:H5(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:un,inactiveTriggerProps:un,popupProps:un}}function _S(e,n,s=!1){return new kf({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:s,onOpenChange:void 0})}const ac=ze(e=>e.triggerIdProp??e.activeTriggerId),qx=ze(e=>e.openProp??e.open),E1=ze(e=>(e.popupElement?.id??e.floatingId)||void 0);function vS(e,n){return n!==void 0&&qx(e)&&ac(e)===n}function V5(e,n){return vS(e,n)?!0:n!==void 0&&qx(e)&&ac(e)==null&&e.triggerCount===1}const yS={open:qx,mounted:ze(e=>e.mounted),transitionStatus:ze(e=>e.transitionStatus),floatingRootContext:ze(e=>e.floatingRootContext),triggerCount:ze(e=>e.triggerCount),preventUnmountingOnClose:ze(e=>e.preventUnmountingOnClose),payload:ze(e=>e.payload),activeTriggerId:ac,activeTriggerElement:ze(e=>e.mounted?e.activeTriggerElement:null),popupId:E1,isTriggerActive:ze((e,n)=>n!==void 0&&ac(e)===n),isOpenedByTrigger:ze((e,n)=>vS(e,n)),isMountedByTrigger:ze((e,n)=>n!==void 0&&ac(e)===n&&e.mounted),triggerProps:ze((e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:ze((e,n)=>V5(e,n)?E1(e):void 0),popupProps:ze(e=>e.popupProps),popupElement:ze(e=>e.popupElement),positionerElement:ze(e=>e.positionerElement)};function jS(e){const{open:n=!1,onOpenChange:s,elements:o={}}=e,l=yf(),c=jf()!=null,d=va(()=>new kf({open:n,transitionStatus:void 0,onOpenChange:s,referenceElement:o.reference??null,floatingElement:o.floating??null,triggerElements:new Cf,floatingId:l,syncOnly:!1,nested:c})).current;return Me(()=>{const p={open:n,floatingId:l};o.reference!==void 0&&(p.referenceElement=o.reference,p.domReferenceElement=dt(o.reference)?o.reference:null),o.floating!==void 0&&(p.floatingElement=o.floating),d.update(p)},[n,l,o.reference,o.floating,d]),d.context.onOpenChange=s,d.context.nested=c,d}function q5(e={}){const{nodeId:n,externalTree:s}=e,o=jS(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,_]=x.useState(null),[v,k]=x.useState(void 0),[S,j]=x.useState(void 0),w=x.useRef(null),C=Pl(s),E=x.useMemo(()=>({reference:c,floating:d,domReference:p}),[c,d,p]),N=x5({...e,elements:{...E,...h&&{reference:h}}}),R=dt(v)?v:null,T=S===void 0?l.state.floatingElement:S;l.useSyncedValue("referenceElement",v??null),l.useSyncedValue("domReferenceElement",v===void 0?p:R),l.useSyncedValue("floatingElement",T);const O=x.useCallback(P=>{const H=dt(P)?{getBoundingClientRect:()=>P.getBoundingClientRect(),getClientRects:()=>P.getClientRects(),contextElement:P}:P;_(H),N.refs.setReference(H)},[N.refs]),A=x.useCallback(P=>{(dt(P)||P===null)&&(w.current=P,k(P)),(dt(N.refs.reference.current)||N.refs.reference.current===null||P!==null&&!dt(P))&&N.refs.setReference(P)},[N.refs,k]),z=x.useCallback(P=>{j(P),N.refs.setFloating(P)},[N.refs]),B=x.useMemo(()=>({...N.refs,setReference:A,setFloating:z,setPositionReference:O,domReference:w}),[N.refs,A,z,O]),L=x.useMemo(()=>({...N.elements,domReference:p}),[N.elements,p]),D=x.useMemo(()=>({...N,dataRef:l.context.dataRef,open:m,onOpenChange:l.setOpen,events:l.context.events,floatingId:g,refs:B,elements:L,nodeId:n,rootStore:l}),[N,B,L,n,l,m,g]);return Me(()=>{p&&(w.current=p)},[p]),Me(()=>{l.context.dataRef.current.floatingContext=D;const P=C?.nodesRef.current.find(H=>H.id===n);P&&(P.context=D)}),x.useMemo(()=>({...N,context:D,refs:B,elements:L,rootStore:l}),[N,B,L,D,l])}const bg=mM&&xk;function $5(e,n={}){const{enabled:s=!0,delay:o}=n,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=sa();x.useEffect(()=>{const v=l.select("domReferenceElement");if(!s)return;const k=Qt(v);function S(){const C=l.select("domReferenceElement");!l.select("open")&&Gt(C)&&C===Pn(vt(C))&&(p.current=!0)}function j(){g.current=!0}function w(){g.current=!1}return ss(ft(k,"blur",S),bg&&ft(k,"keydown",j,!0),bg&&ft(k,"pointerdown",w,!0))},[l,s]),x.useEffect(()=>{if(!s)return;function v(k){if(k.reason===gc||k.reason===Rx){const S=l.select("domReferenceElement");dt(S)&&(m.current=S,p.current=!0)}}return c.on("openchange",v),()=>{c.off("openchange",v)}},[c,s,l]);const _=x.useMemo(()=>{function v(){p.current=!1,m.current=null}return{onMouseLeave(){v()},onFocus(k){const S=k.currentTarget;if(p.current){if(m.current===S)return;v()}const j=Tn(k.nativeEvent);if(dt(j)){if(bg&&!k.relatedTarget){if(!g.current&&!xf(j))return}else if(!CM(j))return}const w=Ld(k.relatedTarget,l.context.triggerElements),{nativeEvent:C,currentTarget:E}=k,N=typeof o=="function"?o():o;if(l.select("open")&&w||N===0||N===void 0){l.setOpen(!0,lt(yd,C,E));return}h.start(N,()=>{p.current||l.setOpen(!0,lt(yd,C,E))})},onBlur(k){v();const S=k.relatedTarget,j=k.nativeEvent,w=dt(S)&&S.hasAttribute(bc("focus-guard"))&&S.getAttribute("data-type")==="outside";h.start(0,()=>{const C=l.select("domReferenceElement"),E=Pn(vt(C));!S&&E===C||Ze(d.current.floatingContext?.refs.floating.current,E)||Ze(C,E)||w||Ld(S??E,l.context.triggerElements)||l.setOpen(!1,lt(yd,j))})}}},[d,o,l,h]);return x.useMemo(()=>s?{reference:_,trigger:_}:{},[s,_])}class $x{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 Ga,this.restTimeout=new Ga,this.handleCloseOptions=void 0}static create(){return new $x}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const Fd=new WeakMap;function Yd(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&Fd.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),Fd.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function wS(e,n){const{scopeElement:s,referenceElement:o,floatingElement:l}=n,c=Fd.get(s);c&&c!==e&&Yd(c),Yd(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=s,e.pointerEventsReferenceElement=o,e.pointerEventsFloatingElement=l,Fd.set(s,e),s.style.pointerEvents="none",o.style.pointerEvents="auto",l.style.pointerEvents="auto"}function Gx(e){const n=e.context.dataRef.current,s=va(()=>n.hoverInteractionState??$x.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=s),jx(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function G5(e,n={}){const{enabled:s=!0,closeDelay:o=0,nodeId:l}=n,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),p=c.useState("floatingElement"),m=c.useState("domReferenceElement"),{dataRef:g}=c.context,h=Pl(),_=jf(),v=Gx(c),k=sa(),S=Le(()=>jk(g.current.openEvent?.type,v.interactedInside)),j=Le(()=>NM(g.current.openEvent?.type)),w=Le(()=>{Yd(v)});Me(()=>{d||(v.pointerType=void 0,v.restTimeoutPending=!1,v.interactedInside=!1,w())},[d,v,w]),x.useEffect(()=>w,[w]),Me(()=>{if(s&&d&&v.handleCloseOptions?.blockPointerEvents&&j()&&dt(m)&&p){const C=m,E=p,N=vt(p),R=h?.nodesRef.current.find(z=>z.id===_)?.context?.elements.floating;R&&(R.style.pointerEvents="");const T=v.pointerEventsScopeElement!==E?v.pointerEventsScopeElement:null,O=R!==E?R:null,A=v.handleCloseOptions?.getScope?.()??T??O??C.closest("[data-rootownerid]")??N.body;return wS(v,{scopeElement:A,referenceElement:C,floatingElement:E}),()=>{w()}}},[s,d,m,p,v,j,h,_,w]),x.useEffect(()=>{if(!s)return;function C(){return!!(h&&_&&Nr(h.nodesRef.current,_).length>0)}function E(z){const B=Id(o,"close",v.pointerType),L=()=>{c.setOpen(!1,lt($n,z)),h?.events.emit("floating.closed",z)};B?v.openChangeTimeout.start(B,L):(v.openChangeTimeout.clear(),L())}function N(z){const B=Tn(z);if(!SM(B)){v.interactedInside=!1;return}v.interactedInside=B?.closest("[aria-haspopup]")!=null}function R(){v.openChangeTimeout.clear(),k.clear(),h?.events.off("floating.closed",O),w()}function T(z){if(C()&&h){h.events.on("floating.closed",O);return}if(Ld(z.relatedTarget,c.context.triggerElements))return;const B=g.current.floatingContext?.nodeId??l,L=z.relatedTarget;if(!(h&&B&&dt(L)&&Nr(h.nodesRef.current,B,!1).some(P=>Ze(P.context?.elements.floating,L)))){if(v.handler){v.handler(z);return}w(),S()||E(z)}}function O(z){!h||!_||C()||k.start(0,()=>{h.events.off("floating.closed",O),c.setOpen(!1,lt($n,z)),h.events.emit("floating.closed",z)})}const A=p;return ss(A&&ft(A,"mouseenter",R),A&&ft(A,"mouseleave",T),A&&ft(A,"pointerdown",N,!0),()=>{h?.events.off("floating.closed",O)})},[s,p,c,g,o,l,S,w,v,h,_,k])}const F5={current:null};function Y5(e,n={}){const{enabled:s=!0,delay:o=0,handleClose:l=null,mouseOnly:c=!1,restMs:d=0,move:p=!0,triggerElementRef:m=F5,externalTree:g,isActiveTrigger:h=!0,getHandleCloseContext:_,isClosing:v,shouldOpen:k}=n,S="rootStore"in e?e.rootStore:e,{dataRef:j,events:w}=S.context,C=Pl(g),E=Gx(S),N=x.useRef(!1),R=mn(l),T=mn(o),O=mn(d),A=mn(s),z=mn(k),B=mn(v),L=Le(()=>jk(j.current.openEvent?.type,E.interactedInside)),D=Le(()=>z.current?.()!==!1),P=Le((Y,V,$)=>{const Z=S.context.triggerElements;if(Z.hasElement(V))return!Y||!Ze(Y,V);if(!dt($))return!1;const G=$;return Z.hasMatchingElement(X=>Ze(X,G))&&(!Y||!Ze(Y,G))}),H=Le(()=>{if(!E.handler)return;vt(S.select("domReferenceElement")).removeEventListener("mousemove",E.handler),E.handler=void 0}),q=Le(()=>{Yd(E)});return h&&(E.handleCloseOptions=R.current?.__options),x.useEffect(()=>H,[H]),x.useEffect(()=>{if(!s)return;function Y(V){V.open?N.current=!1:(N.current=V.reason===$n,H(),E.openChangeTimeout.clear(),E.restTimeout.clear(),E.blockMouseMove=!0,E.restTimeoutPending=!1)}return w.on("openchange",Y),()=>{w.off("openchange",Y)}},[s,w,E,H]),x.useEffect(()=>{if(!s)return;function Y(G,X=!0){const U=Id(T.current,"close",E.pointerType);U?E.openChangeTimeout.start(U,()=>{S.setOpen(!1,lt($n,G)),C?.events.emit("floating.closed",G)}):X&&(E.openChangeTimeout.clear(),S.setOpen(!1,lt($n,G)),C?.events.emit("floating.closed",G))}const V=m.current??(h?S.select("domReferenceElement"):null);if(!dt(V))return;function $(G){if(E.openChangeTimeout.clear(),E.blockMouseMove=!1,c&&!uo(E.pointerType))return;const X=Z0(O.current),U=Id(T.current,"open",E.pointerType),K=Tn(G),F=G.currentTarget??null,J=S.select("domReferenceElement");let ie=F;if(dt(K)&&!S.context.triggerElements.hasElement(K)){for(const Ne of S.context.triggerElements.elements())if(Ze(Ne,K)){ie=Ne;break}}dt(F)&&dt(J)&&!S.context.triggerElements.hasElement(F)&&Ze(F,J)&&(ie=J);const re=ie==null?!1:P(J,ie,K),oe=S.select("open"),ce=B.current?.()??S.select("transitionStatus")==="ending",ee=!oe&&ce&&N.current,Te=!re&&dt(ie)&&dt(J)&&Ze(J,ie)&&ee,Fe=X>0&&!U,_e=re&&(oe||ee)||Te,Se=!oe||re;if(_e){D()&&S.setOpen(!0,lt($n,G,ie));return}Fe||(U?E.openChangeTimeout.start(U,()=>{Se&&D()&&S.setOpen(!0,lt($n,G,ie))}):Se&&D()&&S.setOpen(!0,lt($n,G,ie)))}function Z(G){if(L()){q();return}H();const X=S.select("domReferenceElement"),U=vt(X);E.restTimeout.clear(),E.restTimeoutPending=!1;const K=j.current.floatingContext??_?.();if(Ld(G.relatedTarget,S.context.triggerElements))return;if(R.current&&K){S.select("open")||E.openChangeTimeout.clear();const J=m.current;E.handler=R.current({...K,tree:C,x:G.clientX,y:G.clientY,onClose(){q(),H(),A.current&&!L()&&J===S.select("domReferenceElement")&&Y(G,!0)}}),U.addEventListener("mousemove",E.handler),E.handler(G);return}(E.pointerType==="touch"?!Ze(S.select("floatingElement"),G.relatedTarget):!0)&&Y(G)}return p?ss(ft(V,"mousemove",$,{once:!0}),ft(V,"mouseenter",$),ft(V,"mouseleave",Z)):ss(ft(V,"mouseenter",$),ft(V,"mouseleave",Z))},[H,q,j,T,S,s,R,E,h,P,L,c,p,O,m,C,A,_,B,D]),x.useMemo(()=>{if(!s)return;function Y(V){E.pointerType=V.pointerType}return{onPointerDown:Y,onPointerEnter:Y,onMouseMove(V){const{nativeEvent:$}=V,Z=V.currentTarget,G=S.select("domReferenceElement"),X=S.select("open"),U=P(G,Z,V.target);if(c&&!uo(E.pointerType))return;if(X&&U&&E.handleCloseOptions?.blockPointerEvents){const J=S.select("floatingElement");if(J){const ie=E.handleCloseOptions?.getScope?.()??Z.ownerDocument.body;wS(E,{scopeElement:ie,referenceElement:Z,floatingElement:J})}}const K=Z0(O.current);if(X&&!U||K===0||!U&&E.restTimeoutPending&&V.movementX**2+V.movementY**2<2)return;E.restTimeout.clear();function F(){if(E.restTimeoutPending=!1,L())return;const J=S.select("open");!E.blockMouseMove&&(!J||U)&&D()&&S.setOpen(!0,lt($n,$,Z))}E.pointerType==="touch"?Tr.flushSync(()=>{F()}):U&&X?F():(E.restTimeoutPending=!0,E.restTimeout.start(K,F))}}},[s,E,L,P,c,S,O,D])}const X5="Escape";function Ef(e,n,s){switch(e){case"vertical":return n;case"horizontal":return s;default:return n||s}}function Ju(e,n){return Ef(n,e===Ex||e===Rc,e===wr||e===kr)}function _g(e,n,s){return Ef(n,e===Rc,s?e===wr:e===kr)||e==="Enter"||e===" "||e===""}function K5(e,n,s){return Ef(n,s?e===wr:e===kr,e===Rc)}function Q5(e,n,s,o){const l=s?e===kr:e===wr,c=e===Ex;return n==="both"||n==="horizontal"&&o&&o>1?e===X5:Ef(n,l,c)}function Z5(e,n){const{listRef:s,activeIndex:o,onNavigate:l=()=>{},enabled:c=!0,selectedIndex:d=null,allowEscape:p=!1,loopFocus:m=!1,nested:g=!1,rtl:h=!1,virtual:_=!1,focusItemOnOpen:v="auto",focusItemOnHover:k=!0,openOnArrowKeyDown:S=!0,disabledIndices:j=void 0,orientation:w="vertical",parentOrientation:C,cols:E=1,id:N,resetOnPointerLeave:R=!0,externalTree:T}=n,O="rootStore"in e?e.rootStore:e,A=O.useState("open"),z=O.useState("floatingElement"),B=O.useState("domReferenceElement"),L=O.context.dataRef,D=Pd(z),P=jh(B),H=mn(D),q=jf(),Y=Pl(T),V=x.useRef(v),$=x.useRef(d??-1),Z=x.useRef(null),G=x.useRef(!0),X=Le(ve=>{l($.current===-1?null:$.current,ve)}),U=x.useRef(X),K=x.useRef(!!z),F=x.useRef(A),J=x.useRef(!1),ie=x.useRef(!1),re=x.useRef(null),oe=mn(j),ce=mn(A),ee=mn(d),Te=mn(R),Fe=yl(),_e=yl(),Se=Le(()=>{function ve(Ue){_?Y?.events.emit("virtualfocus",Ue):re.current=wd(Ue,{sync:J.current,preventScroll:!0})}const le=s.current[$.current],je=ie.current;le&&ve(le),(J.current?Ue=>Ue():Ue=>Fe.request(Ue))(()=>{const Ue=s.current[$.current]||le;if(!Ue)return;le||ve(Ue),we&&(je||!G.current)&&Ue.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Me(()=>{L.current.orientation=w},[L,w]),Me(()=>{c&&(A&&z?($.current=d??-1,V.current&&d!=null&&(ie.current=!0,X())):K.current&&($.current=-1,U.current()))},[c,A,z,d,X]),Me(()=>{if(c){if(!A){J.current=!1;return}if(z)if(o==null){if(J.current=!1,ee.current!=null)return;if(K.current&&($.current=-1,Se()),(!F.current||!K.current)&&V.current&&(Z.current!=null||V.current===!0&&Z.current==null)){let ve=0;const le=()=>{s.current[0]==null?(ve<2&&(ve?ke=>_e.request(ke):queueMicrotask)(le),ve+=1):($.current=Z.current==null||_g(Z.current,w,h)||g?jd(s):Sh(s),Z.current=null,X())};le()}}else xc(s.current,o)||($.current=o,Se(),ie.current=!1)}},[c,A,z,o,ee,g,s,w,h,X,Se,_e]),Me(()=>{if(!c||z||!Y||_||!K.current)return;const ve=Y.nodesRef.current,le=ve.find(Ue=>Ue.id===q)?.context?.elements.floating,je=Pn(vt(z)),ke=ve.some(Ue=>Ue.context&&Ze(Ue.context.elements.floating,je));le&&!ke&&G.current&&le.focus({preventScroll:!0})},[c,z,Y,q,_]),Me(()=>{U.current=X,F.current=A,K.current=!!z}),Me(()=>{A||(Z.current=null,V.current=v)},[A,v]);const Ne=o!=null,Pe=Le(ve=>{if(!ce.current)return;const le=s.current.indexOf(ve.currentTarget);le!==-1&&($.current!==le||o!==le)&&($.current=le,X(ve))}),Ie=Le(()=>C??Y?.nodesRef.current.find(ve=>ve.id===q)?.context?.dataRef?.current.orientation),be=Le(()=>jd(s,oe.current)),Ae=Le(ve=>{if(G.current=!1,J.current=!0,ve.which===229||!ce.current&&ve.currentTarget===H.current)return;if(g&&Q5(ve.key,w,h,E)){Ju(ve.key,Ie())||ba(ve),O.setOpen(!1,lt(W0,ve.nativeEvent)),Gt(B)&&(_?Y?.events.emit("virtualfocus",B):B.focus());return}const le=$.current,je=jd(s,j),ke=Sh(s,j);if(P||(ve.key==="Home"&&(ba(ve),$.current=je,X(ve)),ve.key==="End"&&(ba(ve),$.current=ke,X(ve))),E>1){const Ue=Array.from({length:s.current.length},()=>({width:1,height:1})),Je=Mk(Ue,E,!1),yt=Je.findIndex(Ee=>Ee!=null&&!Ps(s.current,Ee,j)),zt=Je.reduce((Ee,Re,qe)=>Re!=null&&!Ps(s.current,Re,j)?qe:Ee,-1),pe=Je[Ak(Je.map(Ee=>Ee!=null?s.current[Ee]:null),{event:ve,orientation:w,loopFocus:m,rtl:h,cols:E,disabledIndices:zk([...(typeof j!="function"?j:null)||s.current.map((Ee,Re)=>Ps(s.current,Re,j)?Re:void 0),void 0],Je),minIndex:yt,maxIndex:zt,prevIndex:Ok($.current>ke?je:$.current,Ue,Je,E,ve.key===Rc?"bl":ve.key===(h?wr:kr)?"tr":"tl"),stopEvent:!0})];if(pe!=null&&($.current=pe,X(ve)),w==="both")return}if(Ju(ve.key,w)){if(ba(ve),A&&!_&&Pn(ve.currentTarget.ownerDocument)===ve.currentTarget){$.current=_g(ve.key,w,h)?je:ke,X(ve);return}_g(ve.key,w,h)?m?le>=ke?p&&le!==s.current.length?$.current=-1:(J.current=!1,$.current=je):$.current=Ln(s.current,{startingIndex:le,disabledIndices:j}):$.current=Math.min(ke,Ln(s.current,{startingIndex:le,disabledIndices:j})):m?le<=je?p&&le!==-1?$.current=s.current.length:(J.current=!1,$.current=ke):$.current=Ln(s.current,{startingIndex:le,decrement:!0,disabledIndices:j}):$.current=Math.max(je,Ln(s.current,{startingIndex:le,decrement:!0,disabledIndices:j})),xc(s.current,$.current)&&($.current=-1),X(ve)}}),we=x.useMemo(()=>({onFocus(le){J.current=!0,Pe(le)},onClick:({currentTarget:le})=>le.focus({preventScroll:!0}),onMouseMove(le){J.current=!0,ie.current=!1,k&&Pe(le)},onPointerLeave(le){if(!ce.current||!G.current||le.pointerType==="touch")return;J.current=!0;const je=le.relatedTarget;if(!(!k||s.current.includes(je))&&Te.current&&(re.current?.(),re.current=null,$.current=-1,X(le),!_)){const ke=H.current,Ue=Pn(vt(ke));ke&&Ze(ke,Ue)&&ke.focus({preventScroll:!0})}}}),[Pe,ce,H,k,s,X,Te,_]),Be=x.useMemo(()=>_&&A&&Ne&&{"aria-activedescendant":`${N}-${o}`},[_,A,Ne,N,o]),Xe=x.useMemo(()=>({"aria-orientation":w==="both"?void 0:w,...P?{}:Be,onKeyDown(ve){if(ve.key==="Tab"&&ve.shiftKey&&A&&!_){const le=Tn(ve.nativeEvent);if(le&&!Ze(H.current,le))return;ba(ve),O.setOpen(!1,lt(bf,ve.nativeEvent)),Gt(B)&&B.focus();return}Ae(ve)},onPointerMove(){G.current=!0}}),[Be,Ae,H,w,P,O,A,_,B]),Ye=x.useMemo(()=>{function ve(ke){O.setOpen(!0,lt(W0,ke.nativeEvent,ke.currentTarget))}function le(ke){v==="auto"&&kx(ke.nativeEvent)&&(V.current=!_)}function je(ke){V.current=v,v==="auto"&&_k(ke.nativeEvent)&&(V.current=!0)}return{onKeyDown(ke){const Ue=O.select("open");G.current=!1;const Je=ke.key.startsWith("Arrow"),yt=K5(ke.key,Ie(),h),zt=Ju(ke.key,w),pe=(g?yt:zt)||ke.key==="Enter"||ke.key.trim()==="";if(_&&Ue)return Ae(ke);if(!(!Ue&&!S&&Je)){if(pe){const Ee=Ju(ke.key,Ie());Z.current=g&&Ee?null:ke.key}if(g){yt&&(ba(ke),Ue?($.current=be(),X(ke)):ve(ke));return}zt&&(ee.current!=null&&($.current=ee.current),ba(ke),!Ue&&S?ve(ke):Ae(ke),Ue&&X(ke))}},onFocus(ke){O.select("open")&&!_&&($.current=-1,X(ke))},onPointerDown:je,onPointerEnter:je,onMouseDown:le,onClick:le}},[Ae,v,be,g,X,O,S,w,Ie,h,ee,_]),De=x.useMemo(()=>({...Be,...Ye}),[Be,Ye]);return x.useMemo(()=>c?{reference:De,floating:Xe,item:we,trigger:Ye}:{},[c,De,Xe,Ye,we])}function W5(e,n){const{listRef:s,elementsRef:o,activeIndex:l,onMatch:c,onTyping:d,enabled:p=!0,resetMs:m=750,selectedIndex:g=null}=n,h="rootStore"in e?e.rootStore:e,_=h.useState("open"),v=sa(),k=x.useRef(""),S=x.useRef(g??l??-1),j=x.useRef(null),w=Le(N=>{function R(P){const H=o?.current[P];return!H||_f(H)}function T(P,H,q=0){if(P.length===0)return-1;const Y=(q%P.length+P.length)%P.length,V=H.toLocaleLowerCase();for(let $=0;$<P.length;$+=1){const Z=(Y+$)%P.length;if(!(!P[Z]?.toLocaleLowerCase().startsWith(V)||!R(Z)))return Z}return-1}const O=s.current;if(k.current.length>0&&N.key===" "&&(ba(N),d?.(!0)),k.current.length>0&&k.current[0]!==" "&&T(O,k.current)===-1&&N.key!==" "&&d?.(!1),O==null||N.key.length!==1||N.ctrlKey||N.metaKey||N.altKey)return;_&&N.key!==" "&&(ba(N),d?.(!0));const A=k.current==="";A&&(S.current=g??l??-1),O.every(P=>P?P[0]?.toLocaleLowerCase()!==P[1]?.toLocaleLowerCase():!0)&&k.current===N.key&&(k.current="",S.current=j.current),k.current+=N.key,v.start(m,()=>{k.current="",S.current=j.current,d?.(!1)});const L=((A?g??l??-1:S.current)??0)+1,D=T(O,k.current,L);D!==-1?(c?.(D),j.current=D):N.key!==" "&&(k.current="",d?.(!1))}),C=Le(N=>{const R=N.relatedTarget,T=h.select("domReferenceElement"),O=h.select("floatingElement");Ze(T,R)||Ze(O,R)||(v.clear(),k.current="",S.current=j.current,d?.(!1))});Me(()=>{!_&&g!==null||(v.clear(),j.current=null,k.current!==""&&(k.current=""))},[_,g,v]),Me(()=>{_&&k.current===""&&(S.current=g??l??-1)},[_,g,l]);const E=x.useMemo(()=>({onKeyDown:w,onBlur:C}),[w,C]);return x.useMemo(()=>p?{reference:E,floating:E}:{},[p,E])}const N1=.1,J5=N1*N1,Bt=.5;function ed(e,n,s,o,l,c){return o>=n!=c>=n&&e<=(l-s)*(n-o)/(c-o)+s}function td(e,n,s,o,l,c,d,p,m,g){let h=!1;return ed(e,n,s,o,l,c)&&(h=!h),ed(e,n,l,c,d,p)&&(h=!h),ed(e,n,d,p,m,g)&&(h=!h),ed(e,n,m,g,s,o)&&(h=!h),h}function e4(e,n,s){return e>=s.x&&e<=s.x+s.width&&n>=s.y&&n<=s.y+s.height}function nd(e,n,s,o,l,c){const d=Math.min(s,l),p=Math.max(s,l),m=Math.min(o,c),g=Math.max(o,c);return e>=d&&e<=p&&n>=m&&n<=g}function t4(e={}){const{blockPointerEvents:n=!1}=e,s=new Ga,o=({x:l,y:c,placement:d,elements:p,onClose:m,nodeId:g,tree:h})=>{const _=d?.split("-")[0];let v=!1,k=null,S=null,j=typeof performance<"u"?performance.now():0;function w(E,N){const R=performance.now(),T=R-j;if(k===null||S===null||T===0)return k=E,S=N,j=R,!1;const O=E-k,A=N-S,z=O*O+A*A,B=T*T*J5;return k=E,S=N,j=R,z<B}function C(){s.clear(),m()}return function(N){s.clear();const R=p.domReference,T=p.floating;if(!R||!T||_==null||l==null||c==null)return;const{clientX:O,clientY:A}=N,z=Tn(N),B=N.type==="mouseleave",L=Ze(T,z),D=Ze(R,z);if(L&&(v=!0,!B))return;if(D&&(v=!1,!B)){v=!0;return}if(B&&dt(N.relatedTarget)&&Ze(T,N.relatedTarget))return;function P(){return!!(h&&Nr(h.nodesRef.current,g).length>0)}function H(){P()||C()}if(P())return;const q=R.getBoundingClientRect(),Y=T.getBoundingClientRect(),V=l>Y.right-Y.width/2,$=c>Y.bottom-Y.height/2,Z=Y.width>q.width,G=Y.height>q.height,X=(Z?q:Y).left,U=(Z?q:Y).right,K=(G?q:Y).top,F=(G?q:Y).bottom;if(_==="top"&&c>=q.bottom-1||_==="bottom"&&c<=q.top+1||_==="left"&&l>=q.right-1||_==="right"&&l<=q.left+1){H();return}let J=!1;switch(_){case"top":J=nd(O,A,X,q.top+1,U,Y.bottom-1);break;case"bottom":J=nd(O,A,X,Y.top+1,U,q.bottom-1);break;case"left":J=nd(O,A,Y.right-1,F,q.left+1,K);break;case"right":J=nd(O,A,q.right-1,F,Y.left+1,K);break}if(J)return;if(v&&!e4(O,A,q)){H();return}if(!B&&w(O,A)){H();return}let ie=!1;switch(_){case"top":{const re=Z?Bt/2:Bt*4,oe=Z||V?l+re:l-re,ce=Z?l-re:V?l+re:l-re,ee=c+Bt+1,Te=V||Z?Y.bottom-Bt:Y.top,Fe=V?Z?Y.bottom-Bt:Y.top:Y.bottom-Bt;ie=td(O,A,oe,ee,ce,ee,Y.left,Te,Y.right,Fe);break}case"bottom":{const re=Z?Bt/2:Bt*4,oe=Z||V?l+re:l-re,ce=Z?l-re:V?l+re:l-re,ee=c-Bt,Te=V||Z?Y.top+Bt:Y.bottom,Fe=V?Z?Y.top+Bt:Y.bottom:Y.top+Bt;ie=td(O,A,oe,ee,ce,ee,Y.left,Te,Y.right,Fe);break}case"left":{const re=G?Bt/2:Bt*4,oe=G||$?c+re:c-re,ce=G?c-re:$?c+re:c-re,ee=l+Bt+1,Te=$||G?Y.right-Bt:Y.left,Fe=$?G?Y.right-Bt:Y.left:Y.right-Bt;ie=td(O,A,Te,Y.top,Fe,Y.bottom,ee,oe,ee,ce);break}case"right":{const re=G?Bt/2:Bt*4,oe=G||$?c+re:c-re,ce=G?c-re:$?c+re:c-re,ee=l-Bt,Te=$||G?Y.left+Bt:Y.right,Fe=$?G?Y.left+Bt:Y.right:Y.left+Bt;ie=td(O,A,ee,oe,ee,ce,Te,Y.top,Fe,Y.bottom);break}}ie?v||s.start(40,H):H()}};return o.__options={...e,blockPointerEvents:n},o}const n4={...yS,disabled:ze(e=>e.disabled),instantType:ze(e=>e.instantType),isInstantPhase:ze(e=>e.isInstantPhase),trackCursorAxis:ze(e=>e.trackCursorAxis),disableHoverablePopup:ze(e=>e.disableHoverablePopup),lastOpenChangeReason:ze(e=>e.openChangeReason),closeOnClick:ze(e=>e.closeOnClick),closeDelay:ze(e=>e.closeDelay),hasViewport:ze(e=>e.hasViewport)};class Fx extends Vx{constructor(n,s,o=!1){const l=new Cf,c={...a4(),...n};c.floatingRootContext=_S(l,s,o),super(c,{popupRef:x.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:l},n4)}setOpen=(n,s)=>{const o=s.reason,l=o===$n,c=n&&o===yd,d=!n&&(o===gc||o===Rx);if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const p=()=>{const m={open:n,openChangeReason:o};c?m.instantType="focus":d?m.instantType="dismiss":o===$n&&(m.instantType=void 0),mS(m,n,s.trigger),this.update(m)};l?Tr.flushSync(p):p()};cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,lt(gc,n))}static useStore(n,s){return pS(n,(l,c)=>new Fx(s,l,c)).store}}function a4(){return{...bS(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const s4=fk(function(n){const{disabled:s=!1,defaultOpen:o=!1,open:l,disableHoverablePopup:c=!1,trackCursorAxis:d="none",actionsRef:p,onOpenChange:m,onOpenChangeComplete:g,handle:h,triggerId:_,defaultTriggerId:v=null,children:k}=n,S=Fx.useStore(h?.store,{open:o,openProp:l,activeTriggerId:v,triggerIdProp:_});yx(()=>{l===void 0&&S.state.open===!1&&o===!0&&S.update({open:!0,activeTriggerId:v})}),S.useControlledProp("openProp",l),S.useControlledProp("triggerIdProp",_),S.useContextCallback("onOpenChange",m),S.useContextCallback("onOpenChangeComplete",g);const j=S.useState("open"),w=!s&&j,C=S.useState("activeTriggerId"),E=S.useState("mounted"),N=S.useState("payload");S.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:c}),S.useSyncedValue("disabled",s),gS(S);const{forceUnmount:R,transitionStatus:T}=hS(w,S),O=S.useState("isInstantPhase"),A=S.useState("instantType"),z=S.useState("lastOpenChangeReason"),B=x.useRef(null);Me(()=>{j&&s&&S.setOpen(!1,lt(wk))},[j,s,S]),Me(()=>{T==="ending"&&z===Hs||T!=="ending"&&O?(A!=="delay"&&(B.current=A),S.set("instantType","delay")):B.current!==null&&(S.set("instantType",B.current),B.current=null)},[T,O,z,A,S]),Me(()=>{w&&C==null&&S.set("payload",void 0)},[S,C,w]);const L=x.useCallback(()=>{S.setOpen(!1,lt(kk))},[S]);x.useImperativeHandle(p,()=>({unmount:R,close:L}),[R,L]);const D=w||E||!s&&d!=="none";return r.jsxs(pk.Provider,{value:S,children:[D&&r.jsx(r4,{store:S,disabled:s,trackCursorAxis:d}),typeof k=="function"?k({payload:N}):k]})});function r4({store:e,disabled:n,trackCursorAxis:s}){const o=e.useState("floatingRootContext"),l=Ux(o,{enabled:!n,referencePress:()=>e.select("closeOnClick")}),c=z3(o,{enabled:!n&&s!=="none",axis:s==="none"?void 0:s}),d=x.useMemo(()=>Da(c.reference,l.reference),[c.reference,l.reference]),p=x.useMemo(()=>Da(c.trigger,l.trigger),[c.trigger,l.trigger]),m=x.useMemo(()=>Da(Sf,c.floating,l.floating),[c.floating,l.floating]);return xS(e,{activeTriggerProps:d,inactiveTriggerProps:p,popupProps:m}),null}let lo=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=po.startingStyle]="startingStyle",e[e.endingStyle=po.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),Xd=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const o4={[Xd.popupOpen]:""},l4={[Xd.popupOpen]:"",[Xd.pressed]:""},i4={[lo.open]:""},c4={[lo.closed]:""},u4={[lo.anchorHidden]:""},kS={open(e){return e?o4:null}},d4={open(e){return e?l4:null}},Bl={open(e){return e?i4:c4},anchorHidden(e){return e?u4:null}};function Dr(e){return yf(e,"base-ui")}const SS=x.createContext(void 0);function f4(){return x.useContext(SS)}let p4=(function(e){return e[e.popupOpen=Xd.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const m4=600,CS="data-base-ui-tooltip-trigger";function R1(e){if("composedPath"in e){const s=e.composedPath();for(let o=0;o<s.length;o+=1){const l=s[o];if(dt(l))return l}}const n=e.target;return dt(n)?n:null}function g4(e){let n=e;for(;n;){if(n.hasAttribute(CS))return n;const s=n.parentElement;if(s){n=s;continue}const o=n.getRootNode();n="host"in o&&dt(o.host)?o.host:null}return null}const h4=cM(function(n,s){const{render:o,className:l,style:c,handle:d,payload:p,disabled:m,delay:g,closeOnClick:h=!0,closeDelay:_,id:v,...k}=n,S=Nc(!0),j=d?.store??S;if(!j)throw new Error(Mn(82));const w=Dr(v),C=j.useState("isTriggerActive",w),E=j.useState("isOpenedByTrigger",w),N=j.useState("floatingRootContext"),R=x.useRef(null),T=g??m4,O=_??0,{registerTrigger:A,isMountedByThisTrigger:z}=B5(w,R,j,{payload:p,closeOnClick:h,closeDelay:O}),B=f4(),{delayRef:L,isInstantPhase:D,hasProvider:P}=OM(N,{open:E}),H=Gx(N);j.useSyncedValue("isInstantPhase",D);const q=j.useState("disabled"),Y=m??q,V=mn(Y),$=j.useState("trackCursorAxis"),Z=j.useState("disableHoverablePopup"),G=x.useRef(!1),X=sa(),U=x.useRef(void 0);function K(){const _e=B?.delay,Se=typeof L.current=="object"?L.current.open:void 0;let Ne=T;return P&&(Se!==0?Ne=g??_e??T:Ne=0),Ne}function F(_e){const Se=R.current;if(!Se||!_e)return!1;const Ne=g4(_e);return Ne!==null&&Ne!==Se&&Ze(Se,Ne)}function J(_e){const Se=F(_e);return G.current=Se,Se&&(H.openChangeTimeout.clear(),H.restTimeout.clear(),H.restTimeoutPending=!1,X.clear()),Se}const ie=Y5(N,{enabled:!Y,mouseOnly:!0,move:!1,handleClose:!Z&&$!=="both"?t4():null,restMs:K,delay(){const _e=typeof L.current=="object"?L.current.close:void 0;let Se=O;return _==null&&P&&(Se=_e),{close:Se}},triggerElementRef:R,isActiveTrigger:C,isClosing:()=>j.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),re=$5(N,{enabled:!Y}).reference,oe=_e=>{const Se=G.current,Ne=R1(_e),Pe=J(Ne),Ie=R.current,be=Ie&&Ne&&Ze(Ie,Ne);if(Pe&&j.select("open")&&j.select("lastOpenChangeReason")===$n){j.setOpen(!1,lt($n,_e));return}if(Se&&!Pe&&be&&!V.current&&!j.select("open")&&Ie&&uo(U.current)){const Ae=()=>{!G.current&&!V.current&&!j.select("open")&&j.setOpen(!0,lt($n,_e,Ie))},we=K();we===0?(X.clear(),Ae()):X.start(we,Ae)}},ce=j.useState("triggerProps",z);return Ht("button",n,{state:{open:E},ref:[s,A,R],props:[ie,re,z||$!=="none"?ce:void 0,{onMouseOver(_e){oe(_e.nativeEvent)},onFocus(_e){F(R1(_e.nativeEvent))&&_e.preventBaseUIHandler()},onMouseLeave(){G.current=!1,X.clear(),U.current=void 0},onPointerEnter(_e){U.current=_e.pointerType},onPointerDown(_e){U.current=_e.pointerType,j.set("closeOnClick",h),h&&!j.select("open")&&j.cancelPendingOpen(_e.nativeEvent)},onClick(_e){h&&!j.select("open")&&j.cancelPendingOpen(_e.nativeEvent)},id:w,[p4.triggerDisabled]:Y?"":void 0,[CS]:Y?void 0:""},k],stateAttributesMapping:kS})}),ES=x.createContext(void 0);function x4(){const e=x.useContext(ES);if(e===void 0)throw new Error(Mn(70));return e}const b4=x.forwardRef(function(n,s){const{children:o,container:l,className:c,render:d,style:p,...m}=n,{portalNode:g,portalSubtree:h}=Jk({container:l,ref:s,componentProps:n,elementProps:m});return!h&&!g?null:r.jsxs(x.Fragment,{children:[h,g&&Tr.createPortal(o,g)]})}),_4=x.forwardRef(function(n,s){const{keepMounted:o=!1,...l}=n;return Nc().useState("mounted")||o?r.jsx(ES.Provider,{value:o,children:r.jsx(b4,{ref:s,...l})}):null}),NS=x.createContext(void 0);function RS(){const e=x.useContext(NS);if(e===void 0)throw new Error(Mn(71));return e}const v4=x.createContext(void 0);function Yx(){return x.useContext(v4)?.direction??"ltr"}const y4=e=>({name:"arrow",options:e,async fn(n){const{x:s,y:o,placement:l,rects:c,platform:d,elements:p,middlewareData:m}=n,{element:g,padding:h=0,offsetParent:_="real"}=qs(e,n)||{};if(g==null)return{};const v=Tk(h),k={x:s,y:o},S=zx(l),j=Ox(S),w=await d.getDimensions(g),C=S==="y",E=C?"top":"left",N=C?"bottom":"right",R=C?"clientHeight":"clientWidth",T=c.reference[j]+c.reference[S]-k[S]-c.floating[j],O=k[S]-c.reference[S],A=_==="real"?await d.getOffsetParent?.(g):p.floating;let z=p.floating[R]||c.floating[j];(!z||!await d.isElement?.(A))&&(z=p.floating[R]||c.floating[j]);const B=T/2-O/2,L=z/2-w[j]/2-1,D=Math.min(v[E],L),P=Math.min(v[N],L),H=D,q=z-w[j]-P,Y=z/2-w[j]/2+B,V=wh(H,Y,q),$=!m.arrow&&Or(l)!=null&&Y!==V&&c.reference[j]/2-(Y<H?D:P)-w[j]/2<0,Z=$?Y<H?Y-H:Y-q:0;return{[S]:k[S]+Z,data:{[S]:V,centerOffset:Y-V-Z,...$&&{alignmentOffset:Z}},reset:$}}}),j4=(e,n)=>({...y4(e),options:[e,n]}),w4={name:"hide",async fn(e){const{width:n,height:s,x:o,y:l}=e.rects.reference,c=n===0&&s===0&&o===0&&l===0;return{data:{referenceHidden:(await w5().fn(e)).data?.referenceHidden||c}}}},Sd={sideX:"left",sideY:"top"},k4={name:"adaptiveOrigin",async fn(e){const{x:n,y:s,rects:{floating:o},elements:{floating:l},platform:c,strategy:d,placement:p}=e,m=Qt(l),g=m.getComputedStyle(l);if(!(g.transitionDuration!=="0s"&&g.transitionDuration!==""))return{x:n,y:s,data:Sd};const _=await c.getOffsetParent?.(l);let v={width:0,height:0};if(d==="fixed"&&m?.visualViewport)v={width:m.visualViewport.width,height:m.visualViewport.height};else if(_===m){const E=vt(l);v={width:E.documentElement.clientWidth,height:E.documentElement.clientHeight}}else await c.isElement?.(_)&&(v=await c.getDimensions(_));const k=ra(p);let S=n,j=s;k==="left"&&(S=v.width-(n+o.width)),k==="top"&&(j=v.height-(s+o.height));const w=k==="left"?"right":Sd.sideX,C=k==="top"?"bottom":Sd.sideY;return{x:S,y:j,data:{sideX:w,sideY:C}}}};function TS(e,n,s){const o=e==="inline-start"||e==="inline-end";return{top:"top",right:o?s?"inline-start":"inline-end":"right",bottom:"bottom",left:o?s?"inline-end":"inline-start":"left"}[n]}function T1(e,n,s){const{rects:o,placement:l}=e;return{side:TS(n,ra(l),s),align:Or(l)||"center",anchor:{width:o.reference.width,height:o.reference.height},positioner:{width:o.floating.width,height:o.floating.height}}}function AS(e){const{anchor:n,positionMethod:s="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:_=!1,inline:v,keepMounted:k=!1,floatingRootContext:S,mounted:j,collisionAvoidance:w,shiftCrossAxis:C=!1,nodeId:E,adaptiveOrigin:N,lazyFlip:R=!1,externalTree:T}=e,[O,A]=x.useState(null);!j&&O!==null&&A(null);const z=w.side||"flip",B=w.align||"flip",L=w.fallbackAxisSide||"end",D=typeof n=="function"?n:void 0,P=Le(D),H=D?P:n,q=mn(n),Y=mn(j),$=Yx()==="rtl",Z=O||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":$?"left":"right","inline-start":$?"right":"left"}[o],G=c==="center"?Z:`${Z}-${c}`;let X=m;const U=1,K=o==="bottom"?U:0,F=o==="top"?U:0,J=o==="right"?U:0,ie=o==="left"?U:0;typeof X=="number"?X={top:X+K,right:X+ie,bottom:X+F,left:X+J}:X&&(X={top:(X.top||0)+K,right:(X.right||0)+ie,bottom:(X.bottom||0)+F,left:(X.left||0)+J});const re={boundary:p==="clipping-ancestors"?"clippingAncestors":p,padding:X},oe=x.useRef(null),ce=mn(l),ee=mn(d),Te=typeof l!="function"?l:0,Fe=typeof d!="function"?d:0,_e=[];v&&_e.push(v),_e.push(b5(mt=>{const Rt=T1(mt,o,$),Wt=typeof ce.current=="function"?ce.current(Rt):ce.current,kt=typeof ee.current=="function"?ee.current(Rt):ee.current;return{mainAxis:Wt,crossAxis:kt,alignmentAxis:kt}},[Te,Fe,$,o]));const Se=B==="none"&&z!=="shift",Ne=!Se&&(g||C||z==="shift"),Pe=z==="none"?null:y5({...re,padding:{top:X.top+U,right:X.right+U,bottom:X.bottom+U,left:X.left+U},mainAxis:!C&&z==="flip",crossAxis:B==="flip"?"alignment":!1,fallbackAxisSideDirection:L}),Ie=Se?null:_5(mt=>{const Rt=vt(mt.elements.floating).documentElement;return{...re,rootBoundary:C?{x:0,y:0,width:Rt.clientWidth,height:Rt.clientHeight}:void 0,mainAxis:B!=="none",crossAxis:Ne,limiter:g||C?void 0:v5(Wt=>{if(!oe.current)return{};const{width:kt,height:sn}=oe.current.getBoundingClientRect(),Ft=Oa(ra(Wt.placement)),dn=Ft==="y"?kt:sn,On=Ft==="y"?X.left+X.right:X.top+X.bottom;return{offset:dn/2+On/2}})}},[re,g,C,X,B]);z==="shift"||B==="shift"||c==="center"?_e.push(Ie,Pe):_e.push(Pe,Ie),_e.push(j5({...re,apply({elements:{floating:mt},availableWidth:Rt,availableHeight:Wt,rects:kt}){if(!Y.current)return;const sn=mt.style;sn.setProperty("--available-width",`${Rt}px`),sn.setProperty("--available-height",`${Wt}px`);const Ft=Qt(mt).devicePixelRatio||1,{x:dn,y:On,width:Kn,height:ca}=kt.reference,Qn=(Math.round((dn+Kn)*Ft)-Math.round(dn*Ft))/Ft,us=(Math.round((On+ca)*Ft)-Math.round(On*Ft))/Ft;sn.setProperty("--anchor-width",`${Qn}px`),sn.setProperty("--anchor-height",`${us}px`)}}),j4(mt=>({element:oe.current||vt(mt.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(mt){const{elements:Rt,middlewareData:Wt,placement:kt,rects:sn,y:Ft}=mt,dn=ra(kt),On=Oa(dn),Kn=oe.current,ca=Wt.arrow?.x||0,Qn=Wt.arrow?.y||0,us=Kn?.clientWidth||0,zn=Kn?.clientHeight||0,ua=ca+us/2,Ia=Qn+zn/2,ds=Math.abs(Wt.shift?.y||0),it=sn.reference.height/2,Dt=typeof l=="function"?l(T1(mt,o,$)):l,kn=ds>Dt,rn={top:`${ua}px calc(100% + ${Dt}px)`,bottom:`${ua}px ${-Dt}px`,left:`calc(100% + ${Dt}px) ${Ia}px`,right:`${-Dt}px ${Ia}px`}[dn],At=`${ua}px ${sn.reference.y+it-Ft}px`;return Rt.floating.style.setProperty("--transform-origin",Ne&&On==="y"&&kn?At:rn),{}}},w4,N),Me(()=>{!j&&S&&S.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[j,S]);const be=x.useMemo(()=>({elementResize:!_&&typeof ResizeObserver<"u",layoutShift:!_&&typeof IntersectionObserver<"u"}),[_]),{refs:Ae,elements:we,x:Be,y:Xe,middlewareData:Ye,update:De,placement:ve,context:le,isPositioned:je,floatingStyles:ke}=q5({rootContext:S,open:k?j:void 0,placement:G,middleware:_e,strategy:s,whileElementsMounted:k?void 0:(...mt)=>y1(...mt,be),nodeId:E,externalTree:T}),{sideX:Ue,sideY:Je}=Ye.adaptiveOrigin||Sd,yt=je?s:"fixed",zt=x.useMemo(()=>{const mt=N?{position:yt,[Ue]:Be,[Je]:Xe}:{position:yt,...ke};return je||(mt.opacity=0),mt},[N,yt,Ue,Be,Je,Xe,ke,je]),pe=x.useRef(null);Me(()=>{if(!j)return;const mt=q.current,Rt=typeof mt=="function"?mt():mt,kt=(A1(Rt)?Rt.current:Rt)||null||null;kt!==pe.current&&(Ae.setPositionReference(kt),pe.current=kt)},[j,Ae,H,q]),x.useEffect(()=>{if(!j)return;const mt=q.current;typeof mt!="function"&&A1(mt)&&mt.current!==pe.current&&(Ae.setPositionReference(mt.current),pe.current=mt.current)},[j,Ae,H,q]),x.useEffect(()=>{if(k&&j&&we.domReference&&we.floating)return y1(we.domReference,we.floating,De,be)},[k,j,we,De,be]);const Ee=ra(ve),Re=TS(o,Ee,$),qe=Or(ve)||"center",st=!!Ye.hide?.referenceHidden;Me(()=>{R&&j&&je&&A(Ee)},[R,j,je,Ee]);const an=x.useMemo(()=>({position:"absolute",top:Ye.arrow?.y,left:Ye.arrow?.x}),[Ye.arrow]),Vt=Ye.arrow?.centerOffset!==0;return x.useMemo(()=>({positionerStyles:zt,arrowStyles:an,arrowRef:oe,arrowUncentered:Vt,side:Re,align:qe,physicalSide:Ee,anchorHidden:st,refs:Ae,context:le,isPositioned:je,update:De}),[zt,an,oe,Vt,Re,qe,Ee,st,Ae,le,je,De])}function A1(e){return e!=null&&"current"in e}function Xx(e){return e==="starting"?v3:un}function MS(e,n,{styles:s,transitionStatus:o,props:l,refs:c,hidden:d,inert:p=!1}){const m={...s};return p&&(m.pointerEvents="none"),Ht("div",e,{state:n,ref:c,props:[{role:"presentation",hidden:d,style:m},Xx(o),l],stateAttributesMapping:Bl})}const S4=x.forwardRef(function(n,s){const{render:o,className:l,anchor:c,positionMethod:d="absolute",side:p="top",align:m="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:_="clipping-ancestors",collisionPadding:v=5,arrowPadding:k=5,sticky:S=!1,disableAnchorTracking:j=!1,collisionAvoidance:w=w3,style:C,...E}=n,N=Nc(),R=x4(),T=N.useState("open"),O=N.useState("mounted"),A=N.useState("trackCursorAxis"),z=N.useState("disableHoverablePopup"),B=N.useState("floatingRootContext"),L=N.useState("instantType"),D=N.useState("transitionStatus"),P=N.useState("hasViewport"),H=AS({anchor:c,positionMethod:d,floatingRootContext:B,mounted:O,side:p,sideOffset:g,align:m,alignOffset:h,collisionBoundary:_,collisionPadding:v,sticky:S,arrowPadding:k,disableAnchorTracking:j,keepMounted:R,collisionAvoidance:w,adaptiveOrigin:P?k4:void 0}),q=x.useMemo(()=>({open:T,side:H.side,align:H.align,anchorHidden:H.anchorHidden,instant:A!=="none"?"tracking-cursor":L}),[T,H.side,H.align,H.anchorHidden,A,L]),Y=MS(n,q,{styles:H.positionerStyles,transitionStatus:D,props:E,refs:[s,N.useStateSetter("positionerElement")],hidden:!O,inert:!T||A==="both"||z});return r.jsx(NS.Provider,{value:H,children:Y})}),C4={...Bl,...Il},E4=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,p=Nc(),{side:m,align:g}=RS(),h=p.useState("open"),_=p.useState("instantType"),v=p.useState("transitionStatus"),k=p.useState("popupProps"),S=p.useState("floatingRootContext"),j=p.useState("disabled"),w=p.useState("closeDelay");zr({open:h,ref:p.context.popupRef,onComplete(){h&&p.context.onOpenChangeComplete?.(!0)}}),G5(S,{enabled:!j,closeDelay:w});const C=p.useStateSetter("popupElement");return Ht("div",n,{state:{open:h,side:m,align:g,instant:_,transitionStatus:v},ref:[s,p.context.popupRef,C],props:[k,Xx(v),d],stateAttributesMapping:C4})}),N4=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,p=Nc(),{arrowRef:m,side:g,align:h,arrowUncentered:_,arrowStyles:v}=RS(),k=p.useState("open"),S=p.useState("instantType");return Ht("div",n,{state:{open:k,side:g,align:h,uncentered:_,instant:S},ref:[s,m],props:[{style:v,"aria-hidden":!0},d],stateAttributesMapping:Bl})}),R4=function(n){const{delay:s,closeDelay:o,timeout:l=400}=n,c=x.useMemo(()=>({delay:s,closeDelay:o}),[s,o]),d=x.useMemo(()=>({open:s,close:o}),[s,o]);return r.jsx(SS.Provider,{value:c,children:r.jsx(MM,{delay:d,timeoutMs:l,children:n.children})})};function Kx(e){return Lx(19)?e:e?"true":void 0}function T4(e){const[n,s]=x.useState({current:e,previous:null});return e!==n.current&&s({current:e,previous:n.current}),n.previous}function Et(...e){return dk(fc(e))}function A4({delay:e=0,...n}){return r.jsx(R4,{"data-slot":"tooltip-provider",delay:e,...n})}function Qx({...e}){return r.jsx(s4,{"data-slot":"tooltip",...e})}function Zx({...e}){return r.jsx(h4,{"data-slot":"tooltip-trigger",...e})}function Wx({className:e,side:n="top",sideOffset:s=4,align:o="center",alignOffset:l=0,children:c,...d}){return r.jsx(_4,{children:r.jsx(S4,{align:o,alignOffset:l,side:n,sideOffset:s,className:"isolate z-50",children:r.jsxs(E4,{"data-slot":"tooltip-content",className:Et("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,r.jsx(N4,{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 Pi({label:e,active:n,onClick:s,isAdd:o,isSettings:l,isDefault:c,icon:d,title:p,testId:m}){const g=e.trim()||"·",{initials:h,subLabel:_}=M4(g),v=o||l?"indigo":z4(g),k=_&&!o&&!l&&!c;return r.jsxs(Qx,{children:[r.jsx(Zx,{render:r.jsxs("button",{type:"button",onClick:s,"data-testid":m,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[r.jsx("span",{className:Oe("flex size-10 items-center justify-center rounded-xl text-sm font-bold transition-all",n&&"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&&n&&I4(v),!o&&!l&&!c&&!n&&P4(v)),children:d??h}),k&&r.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:_})]})}),r.jsx(Wx,{side:"right",children:p||e})]})}function M4(e){const n=e.trim().replace(/[_\-.]+/g," ").replace(/\s+/g," ");if(!n)return{initials:"·",subLabel:null};const s=n.split(" ");if(s.length>=2)return{initials:(s[0][0]+s[1][0]).toUpperCase(),subLabel:O4(n)};const o=s[0];return o.length<=4?{initials:o[0].toUpperCase(),subLabel:o}:{initials:o[0].toUpperCase(),subLabel:o.slice(0,4)+"…"}}function O4(e){return e.length>6?e.slice(0,5)+"…":e}function z4(e){let n=0;for(let s=0;s<e.length;s++)n=n*31+e.charCodeAt(s)|0;return Y0[Math.abs(n)%Y0.length]}const D4={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"},L4={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 P4(e){return D4[e]}function I4(e){return L4[e]}function Tt({content:e,side:n="top",children:s}){return e?r.jsxs(Qx,{children:[r.jsx(Zx,{render:s}),r.jsx(Wx,{side:n,children:e})]}):s}const OS=0,zS=1,DS=2,M1=3;var O1=Object.prototype.hasOwnProperty;function Rh(e,n){var s,o;if(e===n)return!0;if(e&&n&&(s=e.constructor)===n.constructor){if(s===Date)return e.getTime()===n.getTime();if(s===RegExp)return e.toString()===n.toString();if(s===Array){if((o=e.length)===n.length)for(;o--&&Rh(e[o],n[o]););return o===-1}if(!s||typeof e=="object"){o=0;for(s in e)if(O1.call(e,s)&&++o&&!O1.call(n,s)||!(s in n)||!Rh(e[s],n[s]))return!1;return Object.keys(n).length===o}}return e!==e&&n!==n}const zs=new WeakMap,Ds=()=>{},Un=Ds(),Th=Object,_t=e=>e===Un,ts=e=>typeof e=="function",Rr=(e,n)=>({...e,...n}),LS=e=>ts(e.then),vg={},ad={},Jx="undefined",Ac=typeof window!=Jx,Ah=typeof document!=Jx,B4=Ac&&"Deno"in window,U4=()=>Ac&&typeof window.requestAnimationFrame!=Jx,PS=(e,n)=>{const s=zs.get(e);return[()=>!_t(n)&&e.get(n)||vg,o=>{if(!_t(n)){const l=e.get(n);n in ad||(ad[n]=l),s[5](n,Rr(l,o),l||vg)}},s[6],()=>!_t(n)&&n in ad?ad[n]:!_t(n)&&e.get(n)||vg]};let Mh=!0;const H4=()=>Mh,[Oh,zh]=Ac&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Ds,Ds],V4=()=>{const e=Ah&&document.visibilityState;return _t(e)||e!=="hidden"},q4=e=>(Ah&&document.addEventListener("visibilitychange",e),Oh("focus",e),()=>{Ah&&document.removeEventListener("visibilitychange",e),zh("focus",e)}),$4=e=>{const n=()=>{Mh=!0,e()},s=()=>{Mh=!1};return Oh("online",n),Oh("offline",s),()=>{zh("online",n),zh("offline",s)}},G4={isOnline:H4,isVisible:V4},F4={initFocus:q4,initReconnect:$4},z1=!kc.useId,gl=!Ac||B4,Y4=e=>U4()?window.requestAnimationFrame(e):setTimeout(e,1),yg=gl?x.useEffect:x.useLayoutEffect,jg=typeof navigator<"u"&&navigator.connection,D1=!gl&&jg&&(["slow-2g","2g"].includes(jg.effectiveType)||jg.saveData),sd=new WeakMap,X4=e=>Th.prototype.toString.call(e),wg=(e,n)=>e===`[object ${n}]`;let K4=0;const Dh=e=>{const n=typeof e,s=X4(e),o=wg(s,"Date"),l=wg(s,"RegExp"),c=wg(s,"Object");let d,p;if(Th(e)===e&&!o&&!l){if(d=sd.get(e),d)return d;if(d=++K4+"~",sd.set(e,d),Array.isArray(e)){for(d="@",p=0;p<e.length;p++)d+=Dh(e[p])+",";sd.set(e,d)}if(c){d="#";const m=Th.keys(e).sort();for(;!_t(p=m.pop());)_t(e[p])||(d+=p+":"+Dh(e[p])+",");sd.set(e,d)}}else d=o?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return d},eb=e=>{if(ts(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Dh(e):"",[e,n]};let Q4=0;const Lh=()=>++Q4;async function IS(...e){const[n,s,o,l]=e,c=Rr({populateCache:!0,throwOnError:!0},typeof l=="boolean"?{revalidate:l}:l||{});let d=c.populateCache;const p=c.rollbackOnError;let m=c.optimisticData;const g=v=>typeof p=="function"?p(v):p!==!1,h=c.throwOnError;if(ts(s)){const v=s,k=[],S=n.keys();for(const j of S)!/^\$(inf|sub)\$/.test(j)&&v(n.get(j)._k)&&k.push(j);return Promise.all(k.map(_))}return _(s);async function _(v){const[k]=eb(v);if(!k)return;const[S,j]=PS(n,k),[w,C,E,N]=zs.get(n),R=()=>{const q=w[k];return(ts(c.revalidate)?c.revalidate(S().data,v):c.revalidate!==!1)&&(delete E[k],delete N[k],q&&q[0])?q[0](DS).then(()=>S().data):S().data};if(e.length<3)return R();let T=o,O,A=!1;const z=Lh();C[k]=[z,0];const B=!_t(m),L=S(),D=L.data,P=L._c,H=_t(P)?D:P;if(B&&(m=ts(m)?m(H,D):m,j({data:m,_c:H})),ts(T))try{T=T(H)}catch(q){O=q,A=!0}if(T&&LS(T))if(T=await T.catch(q=>{O=q,A=!0}),z!==C[k][0]){if(A)throw O;return T}else A&&B&&g(O)&&(d=!0,j({data:H,_c:Un}));if(d&&!A)if(ts(d)){const q=d(T,H);j({data:q,error:Un,_c:Un})}else j({data:T,error:Un,_c:Un});if(C[k][1]=Lh(),Promise.resolve(R()).then(()=>{j({_c:Un})}),A){if(h)throw O;return}return T}}const L1=(e,n)=>{for(const s in e)e[s][0]&&e[s][0](n)},Z4=(e,n)=>{if(!zs.has(e)){const s=Rr(F4,n),o=Object.create(null),l=IS.bind(Un,e);let c=Ds;const d=Object.create(null),p=(h,_)=>{const v=d[h]||[];return d[h]=v,v.push(_),()=>v.splice(v.indexOf(_),1)},m=(h,_,v)=>{e.set(h,_);const k=d[h];if(k)for(const S of k)S(_,v)},g=()=>{if(!zs.has(e)&&(zs.set(e,[o,Object.create(null),Object.create(null),Object.create(null),l,m,p]),!gl)){const h=s.initFocus(setTimeout.bind(Un,L1.bind(Un,o,OS))),_=s.initReconnect(setTimeout.bind(Un,L1.bind(Un,o,zS)));c=()=>{h&&h(),_&&_(),zs.delete(e)}}};return g(),[e,l,g,c]}return[e,zs.get(e)[4]]},W4=(e,n,s,o,l)=>{const c=s.errorRetryCount,d=l.retryCount,p=~~((Math.random()+.5)*(1<<(d<8?d:8)))*s.errorRetryInterval;!_t(c)&&d>c||setTimeout(o,p,l)},J4=Rh,[BS,eO]=Z4(new Map),tO=Rr({onLoadingSlow:Ds,onSuccess:Ds,onError:Ds,onErrorRetry:W4,onDiscarded:Ds,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:D1?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:D1?5e3:3e3,compare:J4,isPaused:()=>!1,cache:BS,mutate:eO,fallback:{}},G4),nO=(e,n)=>{const s=Rr(e,n);if(n){const{use:o,fallback:l}=e,{use:c,fallback:d}=n;o&&c&&(s.use=o.concat(c)),l&&d&&(s.fallback=Rr(l,d))}return s},aO=x.createContext({}),sO="$inf$",US=Ac&&window.__SWR_DEVTOOLS_USE__,rO=US?window.__SWR_DEVTOOLS_USE__:[],oO=()=>{US&&(window.__SWR_DEVTOOLS_REACT__=kc)},lO=e=>ts(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],HS=()=>{const e=x.useContext(aO);return x.useMemo(()=>Rr(tO,e),[e])},iO=e=>(n,s,o)=>e(n,s&&((...c)=>{const[d]=eb(n),[,,,p]=zs.get(BS);if(d.startsWith(sO))return s(...c);const m=p[d];return _t(m)?s(...c):(delete p[d],m)}),o),cO=rO.concat(iO),uO=e=>function(...s){const o=HS(),[l,c,d]=lO(s),p=nO(o,d);let m=e;const{use:g}=p,h=(g||[]).concat(cO);for(let _=h.length;_--;)m=h[_](m);return m(l,c||p.fetcher||null,p)},dO=(e,n,s)=>{const o=n[e]||(n[e]=[]);return o.push(s),()=>{const l=o.indexOf(s);l>=0&&(o[l]=o[o.length-1],o.pop())}};oO();const kg=kc.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(n=>{e.status="fulfilled",e.value=n},n=>{e.status="rejected",e.reason=n}),e}}),Sg={dedupe:!0},P1=Promise.resolve(Un),fO=()=>Ds,pO=(e,n,s)=>{const{cache:o,compare:l,suspense:c,fallbackData:d,revalidateOnMount:p,revalidateIfStale:m,refreshInterval:g,refreshWhenHidden:h,refreshWhenOffline:_,keepPreviousData:v,strictServerPrefetchWarning:k}=s,[S,j,w,C]=zs.get(o),[E,N]=eb(e),R=x.useRef(!1),T=x.useRef(!1),O=x.useRef(E),A=x.useRef(n),z=x.useRef(s),B=()=>z.current,L=()=>B().isVisible()&&B().isOnline(),[D,P,H,q]=PS(o,E),Y=x.useRef({}).current,V=_t(d)?_t(s.fallback)?Un:s.fallback[E]:d,$=(be,Ae)=>{for(const we in Y){const Be=we;if(Be==="data"){if(!l(be[Be],Ae[Be])&&(!_t(be[Be])||!l(re,Ae[Be])))return!1}else if(Ae[Be]!==be[Be])return!1}return!0},Z=!R.current,G=x.useMemo(()=>{const be=D(),Ae=q(),we=De=>{const ve=Rr(De);return delete ve._k,(()=>{if(!E||!n||B().isPaused())return!1;if(Z&&!_t(p))return p;const je=_t(V)?ve.data:V;return _t(je)||m})()?{isValidating:!0,isLoading:!0,...ve}:ve},Be=we(be),Xe=be===Ae?Be:we(Ae);let Ye=Be;return[()=>{const De=we(D());return $(De,Ye)?(Ye.data=De.data,Ye.isLoading=De.isLoading,Ye.isValidating=De.isValidating,Ye.error=De.error,Ye):(Ye=De,De)},()=>Xe]},[o,E]),X=Gd.useSyncExternalStore(x.useCallback(be=>H(E,(Ae,we)=>{$(we,Ae)||be()}),[o,E]),G[0],G[1]),U=S[E]&&S[E].length>0,K=X.data,F=_t(K)?V&&LS(V)?kg(V):V:K,J=X.error,ie=x.useRef(F),re=v?_t(K)?_t(ie.current)?F:ie.current:K:F,oe=E&&_t(F),ce=x.useRef(null);!gl&&Gd.useSyncExternalStore(fO,()=>(ce.current=!1,ce),()=>(ce.current=!0,ce));const ee=ce.current;k&&ee&&!c&&oe&&console.warn(`Missing pre-initiated data for serialized key "${E}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const Te=!E||!n||B().isPaused()||U&&!_t(J)?!1:Z&&!_t(p)?p:c?_t(F)?!1:m:_t(F)||m,Fe=Z&&Te,_e=_t(X.isValidating)?Fe:X.isValidating,Se=_t(X.isLoading)?Fe:X.isLoading,Ne=x.useCallback(async be=>{const Ae=A.current;if(!E||!Ae||T.current||B().isPaused())return!1;let we,Be,Xe=!0;const Ye=be||{},De=!w[E]||!Ye.dedupe,ve=()=>z1?!T.current&&E===O.current&&R.current:E===O.current,le={isValidating:!1,isLoading:!1},je=()=>{P(le)},ke=()=>{const Je=w[E];Je&&Je[1]===Be&&delete w[E]},Ue={isValidating:!0};_t(D().data)&&(Ue.isLoading=!0);try{if(De&&(P(Ue),s.loadingTimeout&&_t(D().data)&&setTimeout(()=>{Xe&&ve()&&B().onLoadingSlow(E,s)},s.loadingTimeout),w[E]=[Ae(N),Lh()]),[we,Be]=w[E],we=await we,De&&setTimeout(ke,s.dedupingInterval),!w[E]||w[E][1]!==Be)return De&&ve()&&B().onDiscarded(E),!1;le.error=Un;const Je=j[E];if(!_t(Je)&&(Be<=Je[0]||Be<=Je[1]||Je[1]===0))return je(),De&&ve()&&B().onDiscarded(E),!1;const yt=D().data;le.data=l(yt,we)?yt:we,De&&ve()&&B().onSuccess(we,E,s)}catch(Je){ke();const yt=B(),{shouldRetryOnError:zt}=yt;yt.isPaused()||(le.error=Je,De&&ve()&&(yt.onError(Je,E,yt),(zt===!0||ts(zt)&&zt(Je))&&(!B().revalidateOnFocus||!B().revalidateOnReconnect||L())&&yt.onErrorRetry(Je,E,yt,pe=>{const Ee=S[E];Ee&&Ee[0]&&Ee[0](M1,pe)},{retryCount:(Ye.retryCount||0)+1,dedupe:!0})))}return Xe=!1,je(),!0},[E,o]),Pe=x.useCallback((...be)=>IS(o,O.current,...be),[]);if(yg(()=>{A.current=n,z.current=s,_t(K)||(ie.current=K)}),yg(()=>{if(!E)return;const be=Ne.bind(Un,Sg);let Ae=0;B().revalidateOnFocus&&(Ae=Date.now()+B().focusThrottleInterval);const Be=dO(E,S,(Xe,Ye={})=>{if(Xe==OS){const De=Date.now();B().revalidateOnFocus&&De>Ae&&L()&&(Ae=De+B().focusThrottleInterval,be())}else if(Xe==zS)B().revalidateOnReconnect&&L()&&be();else{if(Xe==DS)return Ne();if(Xe==M1)return Ne(Ye)}});return T.current=!1,O.current=E,R.current=!0,P({_k:N}),Te&&(w[E]||(_t(F)||gl?be():Y4(be))),()=>{T.current=!0,Be()}},[E]),yg(()=>{let be;function Ae(){const Be=ts(g)?g(D().data):g;Be&&be!==-1&&(be=setTimeout(we,Be))}function we(){!D().error&&(h||B().isVisible())&&(_||B().isOnline())?Ne(Sg).then(Ae):Ae()}return Ae(),()=>{be&&(clearTimeout(be),be=-1)}},[g,h,_,E]),x.useDebugValue(re),c){if(!z1&&gl&&oe)throw new Error("Fallback data is required when using Suspense in SSR.");oe&&(A.current=n,z.current=s,T.current=!1);const be=C[E],Ae=!_t(be)&&oe?Pe(be):P1;if(kg(Ae),!_t(J)&&oe)throw J;const we=oe?Ne(Sg):P1;!_t(re)&&oe&&(we.status="fulfilled",we.value=!0),kg(we)}return{mutate:Pe,get data(){return Y.data=!0,re},get error(){return Y.error=!0,J},get isValidating(){return Y.isValidating=!0,_e},get isLoading(){return Y.isLoading=!0,Se}}},Qe=uO(pO);let wl=null;function ro(e){wl=e}function tb(){return wl}class Mc extends Error{status;body;constructor(n,s,o){super(s),this.status=n,this.body=o}}async function Ii(e,n,s,o={}){const l={"content-type":"application/json",...wl?{authorization:`Bearer ${wl}`}:{},...o.headers||{}},c=await fetch(n,{...o,method:e,headers:l,body:s!==void 0?JSON.stringify(s):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 Mc(c.status,`${e} ${n} → ${c.status}: ${d}`,p)}if(c.status!==204)return await c.json()}const me={get:e=>Ii("GET",e),post:(e,n)=>Ii("POST",e,n),put:(e,n)=>Ii("PUT",e,n),patch:(e,n)=>Ii("PATCH",e,n),del:e=>Ii("DELETE",e)};async function VS(e,n,s,o){const l=await fetch(e,{method:"POST",signal:o,headers:{"content-type":"application/json",...wl?{authorization:`Bearer ${wl}`}:{}},body:JSON.stringify(n)});if(!l.ok||!l.body){const m=await l.text().catch(()=>"");throw new Mc(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(`
597
- `);for(;h>=0;){const _=p.slice(0,h).trim();if(p=p.slice(h+1),_)try{s(JSON.parse(_))}catch{}h=p.indexOf(`
598
- `)}}if(p.trim())try{s(JSON.parse(p.trim()))}catch{}}const mO={get:()=>me.get("/health")},aa={list:()=>me.get("/projects"),register:e=>me.post("/projects",{path:e}),remove:e=>me.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>me.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>me.get(`/projects/${e}/config`),set:(e,n)=>me.patch(`/projects/${e}/config`,{set:n}),unset:(e,n)=>me.patch(`/projects/${e}/config`,{unset:n}),put:(e,n)=>me.put(`/projects/${e}/config`,n)},apcProject:{set:(e,n,s)=>me.patch(`/projects/${e}/apc-project`,{set:n,unset:s}),put:(e,n)=>me.put(`/projects/${e}/apc-project`,n)},memory:{get:e=>me.get(`/projects/${e}/memory`),put:(e,n)=>me.put(`/projects/${e}/memory`,{body:n})}},tn={list:e=>me.get(`/projects/${e}/agents`),get:(e,n)=>me.get(`/projects/${e}/agents/${n}`),create:(e,n)=>me.post(`/projects/${e}/agents`,n),update:(e,n,s)=>me.patch(`/projects/${e}/agents/${encodeURIComponent(n)}`,s),remove:(e,n)=>me.del(`/projects/${e}/agents/${encodeURIComponent(n)}`),chat:(e,n,s)=>me.post(`/projects/${e}/agents/${encodeURIComponent(n)}/chat`,s),memory:{get:(e,n)=>me.get(`/projects/${e}/agents/${n}/memory`),put:(e,n,s)=>me.put(`/projects/${e}/agents/${n}/memory`,{body:s})},vault:e=>me.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,n={},s="")=>me.post("/agents/vault",{slug:e,fields:n,body:s}),vaultPatch:(e,n)=>me.patch(`/agents/vault/${encodeURIComponent(e)}`,n),vaultRemove:e=>me.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>me.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,n)=>me.post(`/projects/${e}/agents/import`,{slug:n})},nb={list:(e,n)=>me.get(`/projects/${e}/agents/${n}/conversations`),get:(e,n,s)=>me.get(`/projects/${e}/agents/${n}/conversations/${s}`),compact:(e,n,s)=>me.post(s?`/projects/${e}/agents/${n}/conversations/${s}/compact`:`/projects/${e}/agents/${n}/compact`,{})},br={list:e=>me.get(`/projects/${e}/routines`),get:(e,n)=>me.get(`/projects/${e}/routines/${n}`),run:(e,n)=>me.post(`/projects/${e}/routines/${n}/run`),enable:(e,n)=>me.post(`/projects/${e}/routines/${n}/enable`),disable:(e,n)=>me.post(`/projects/${e}/routines/${n}/disable`),upsert:(e,n)=>me.post(`/projects/${e}/routines`,n),remove:(e,n)=>me.del(`/projects/${e}/routines/${encodeURIComponent(n)}`)},_r={list:(e,n="open")=>me.get(`/projects/${e}/tasks?state=${n}`),global:(e="open")=>me.get(`/tasks?state=${e}`),add:(e,n)=>me.post(`/projects/${e}/tasks`,n),done:(e,n)=>me.post(`/projects/${e}/tasks/${n}/done`),drop:(e,n)=>me.post(`/projects/${e}/tasks/${n}/drop`),reopen:(e,n)=>me.post(`/projects/${e}/tasks/${n}/reopen`)},vr={list:e=>me.get(`/projects/${e}/mcps`),check:e=>me.get(`/projects/${e}/mcps/check`),add:(e,n,s)=>me.post(`/projects/${e}/mcps?scope=${n}`,s),remove:(e,n,s="shared")=>me.del(`/projects/${e}/mcps/${encodeURIComponent(n)}?scope=${s}`),test:(e,n)=>me.post(`/projects/${e}/mcps/${encodeURIComponent(n)}/test`,{}),logs:(e,n)=>me.get(`/projects/${e}/mcps/${encodeURIComponent(n)}/logs`)},_c={list:(e,n={})=>me.get(`/projects/${e}/vars${n.reveal?"?reveal=1":""}`),get:(e,n,s={})=>me.get(`/projects/${e}/vars/${encodeURIComponent(n)}${s.reveal?"?reveal=1":""}`),upsert:(e,n)=>me.post(`/projects/${e}/vars`,n),remove:(e,n,s="project")=>me.del(`/projects/${e}/vars/${encodeURIComponent(n)}?scope=${s}`)},Cg=e=>{const n=new URLSearchParams;for(const[o,l]of Object.entries(e))l!==void 0&&l!==""&&n.set(o,String(l));const s=n.toString();return s?`?${s}`:""},Ph={global:(e={})=>me.get(`/messages/global${Cg(e)}`),project:(e,n={})=>me.get(`/projects/${e}/messages${Cg(n)}`),search:(e,n,s=50)=>me.get(`/projects/${e}/messages/search${Cg({q:n,limit:s})}`)},gO={global:e=>me.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`)},hO={list:()=>me.get("/tools")},An={channels:{list:()=>me.get("/telegram/channels"),upsert:e=>me.post("/telegram/channels",e),patch:(e,n)=>me.patch(`/telegram/channels/${e}`,n),remove:e=>me.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>me.get("/telegram/contacts"),patch:(e,n)=>me.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,n),remove:e=>me.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>me.get("/telegram/roles"),set:(e,n)=>me.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:n}),remove:e=>me.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>me.get("/telegram/status"),start:()=>me.post("/telegram/start"),stop:()=>me.post("/telegram/stop"),send:e=>me.post("/telegram/send",e)},Kd={list:()=>me.get("/engines"),models:e=>me.post("/engines/models",e)},kl={reload:()=>me.post("/admin/reload"),shutdown:()=>me.post("/admin/shutdown"),config:{get:()=>me.get("/admin/config"),patch:e=>me.patch("/admin/config",e)},superAgent:()=>me.get("/admin/super-agent"),logs:(e="errors",n=200)=>me.get(`/admin/logs?file=${e}&limit=${n}`)},Sl={list:()=>me.get("/pair/list"),revoke:e=>me.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>me.post("/pair/init",{}),status:e=>me.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>me.post("/pair/confirm",e)},I1={get:()=>me.get("/identity"),patch:e=>me.patch("/identity",e)},qS={send:(e,n)=>me.post(`/projects/${e}/super-agent/chat`,n),stream:(e,n,s,o)=>VS(`/projects/${e}/super-agent/chat/stream`,n,s,o),summarize:e=>me.post("/super-agent/summarize",e)},xO={dirs:e=>me.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`)},bO=["alloy","echo","fable","onyx","nova","shimmer"],_O=["Kore","Puck","Charon","Fenrir","Aoede"],vO=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],yO=["tts-1","tts-1-hd"],jO=["tiny","base","small","medium","large-v2","large-v3"],Qd={piper:{name:"Piper",note:"Local, offline (CLI + .onnx model). No API key.",local:!0},elevenlabs:{name:"ElevenLabs",note:"Cloud, multilingual. Requires an API key."},openai:{name:"OpenAI",note:"Cloud (tts-1 / tts-1-hd). Uses your OpenAI key."},gemini:{name:"Gemini",note:"Cloud (preview). Uses your Gemini key."},mock:{name:"Mock",note:"Silent test engine. Always available as a fallback.",local:!0}};async function wO(e){const n=tb(),s=await fetch(`/voice/tts?path=${encodeURIComponent(e)}`,{headers:n?{authorization:`Bearer ${n}`}:{}});if(!s.ok){const l=await s.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${s.status}): ${l.slice(0,160)}`)}const o=await s.blob();return URL.createObjectURL(o)}const $S={providers:()=>me.get("/tts/providers"),say:e=>me.post("/tts/say",e),turn:e=>me.post("/voice/turn",e)},B1={manifest:()=>me.get("/deck/manifest"),setWidget:(e,n)=>me.patch(`/deck/widgets/${encodeURIComponent(e)}`,n),exec:e=>me.post("/deck/exec",e)},no=e=>`/projects/${e}/code/sessions`,As={sessions:{list:e=>me.get(no(e)).then(n=>n.sessions),get:(e,n)=>me.get(`${no(e)}/${n}`),create:(e,n={})=>me.post(no(e),n),update:(e,n,s)=>me.patch(`${no(e)}/${n}`,s),remove:(e,n)=>me.del(`${no(e)}/${n}`)},changes:(e,n)=>me.get(`${no(e)}/${n}/changes`),stream:(e,n,s,o,l)=>VS(`${no(e)}/${n}/chat/stream`,s,o,l)},hl={list:e=>me.get(`/projects/${encodeURIComponent(e)}/artifacts`),read:(e,n)=>me.get(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`),run:(e,n,s=[])=>me.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}/run`,{args:s}),remove:(e,n)=>me.del(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`),write:(e,n,s)=>me.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`,{content:s}),rename:(e,n,s)=>me.patch(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`,{newName:s})},Ki={list:e=>me.get(e?`/skills?project_path=${encodeURIComponent(e)}`:"/skills"),inspector:()=>me.get("/skills/inspector"),updateInspector:e=>me.put("/skills/inspector",e),index:(e={})=>me.post("/skills/index",e),inspect:(e,n)=>me.post("/skills/inspect",{prompt:e,project_path:n})};function Oc(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/projects",()=>aa.list(),{refreshInterval:ff.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:n,isLoading:s,mutate:o}}function ab(e){const{projects:n,isLoading:s,mutate:o}=Oc();return{project:n.find(c=>String(c.id)===e)??null,isLoading:s,mutate:o}}const kO={common:{loading:"Cargando…",saving:"Guardando…",cancel:"Cancelar",save:"Guardar",delete:"Borrar",edit:"Editar",create:"Crear",add:"Agregar",remove:"Quitar",reload:"Recargar",shutdown:"Apagar",enabled:"Habilitado",disabled:"Deshabilitado",enable:"Habilitar",disable:"Deshabilitar",open:"Abrir",close:"Cerrar",confirm:"Confirmar",optional:"(opcional)",none:"—",none_yet:"Todavía no hay nada.",error_generic:"Algo salió mal.",search:"Buscar",new:"Nuevo",restore:"Restaurar",show:"Mostrar",hide:"Ocultar",copy:"Copiar",run:"Ejecutar"},daemon:{connecting:"Conectando con el daemon…",unreachable:"No pude llegar al daemon en localhost:7430.",unreachable_hint:"Arrancá APX con `apx daemon start` y refrescá.",version:"Versión",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — relee ~/.apx/config.json sin reiniciar.",shutdown_confirm:"¿Apagar el daemon? Las próximas requests fallarán hasta levantarlo de nuevo.",shutdown_done:"Daemon detenido."},pairing:{title:"Vincular este equipo",subtitle:"Estás entrando desde fuera de esta máquina. Por seguridad, vinculá este navegador con un código de pairing.",steps_title:"Cómo obtener el código",step_1:"En la PC donde corre APX, abrí una terminal.",step_2:"Ejecutá `apx pair` (o escaneá el QR con APX Deck).",step_3:"Copiá el código que aparece debajo del QR y pegalo acá.",code_label:"Código de pairing",code_ph:"p. ej. 7f3a1c9e-…",label_label:"Nombre de este equipo",label_ph:"p. ej. Notebook del living",submit:"Vincular",linking:"Vinculando…",success:"Equipo vinculado ✓",err_required:"Pegá el código de pairing.",err_expired:"El código expiró. Volvé a correr `apx pair` y probá de nuevo.",err_unknown:"Código desconocido o ya usado. Generá uno nuevo con `apx pair`.",err_generic:"No se pudo vincular. Revisá el código e intentá otra vez.",revoke_hint:"Podés revocar este equipo cuando quieras desde Settings o con `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Proyecto",add_project:"Agregar proyecto",modules:{voice:"Voces",desktop:"Escritorio",deck:"Deck",code:"Code"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Proyecto",breadcrumb_base:"Base",breadcrumb_projects:"Proyectos",light:"Cambiar a claro",dark:"Cambiar a oscuro",lang_toggle:"Idioma"},admin:{title:"APX",subtitle:"Panel general. Configuración global, canales y proyectos.",engines_title:"Engines",engines_subtitle:"Adaptadores LLM disponibles. Las API keys viven en ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Canales configurados. Cada uno puede estar pineado a un proyecto.",telegram_polling_on:"Polling activo",telegram_polling_off:"Deshabilitado",telegram_add_channel:"Canal",telegram_send_test:"Probar",telegram_send_test_title:"Enviar a",telegram_default_message:"Mensaje de prueba desde el panel de APX ✅",projects_title:"Proyectos registrados",projects_subtitle:"Click en un proyecto para abrir su panel.",unregister:"Desregistrar",unregister_confirm:"¿Quitar {label} de APX? La carpeta no se borra; sólo se desregistra.",reload_success:"Config recargada.",telegram_polling_started:"Polling iniciado.",telegram_polling_stopped:"Polling detenido.",telegram_channel_removed:"Canal eliminado.",agents_badge:"agents",engine_badge:"sí",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Agregar proyecto",subtitle:"APX indexará .apc/, agents y AGENTS.md en esa carpeta.",path_label:"Ruta absoluta",path_hint:"Equivalente a apx project add /ruta/al/proyecto",path_placeholder:"/Volumes/SSDT7Shield/proyectos_varios/mi-proyecto",register:"Registrar",path_required:"Ruta requerida.",registered:"Proyecto #{id} registrado.",search_btn:"Buscar",browser_unavailable:"Explorador no disponible hasta reiniciar daemon. Pegá ruta manual.",no_folders:"Sin carpetas."},settings:{title:"Settings",subtitle:"Preferencias del panel + diagnóstico del daemon local.",appearance:"Apariencia",light_mode:"Claro",dark_mode:"Oscuro",language:"Idioma",daemon:"Daemon",daemon_sub:"Estado del proceso local que sirve esta web y orquesta los agentes.",engines:"Engines disponibles",engines_sub:"Adaptadores LLM compilados con el daemon.",token:"Token para esta sesión",token_sub:"Si esta web no logró auto-cargar el token, pegalo acá.",token_active:"(ya hay token activo)",token_paste:"Pegá el bearer del daemon",token_saved:"Token guardado.",devices:"Dispositivos pareados",devices_sub:"GET /pair/list. Revocar invalida ese bearer en el daemon.",devices_empty:"No hay clientes pareados todavía.",devices_revoke_confirm:"Revocar cliente {id}?",devices_revoke_success:"Cliente revocado.",devices_pair_btn:"Vincular dispositivo",devices_pair_title:"Vincular dispositivo",devices_pair_desc:"Escaneá el QR con la cámara del celu para entrar directo, o pegá el código en la otra PC.",devices_pair_scan:"Escaneá con la cámara del teléfono — te abre la web ya vinculada.",devices_pair_code:"O pegá este código en la pantalla de pairing:",devices_pair_url:"URL de acceso",devices_pair_link:"O copiá este link y abrilo en el otro dispositivo (entra solo):",devices_pair_copy:"Copiar",devices_pair_copied:"Link copiado al portapapeles.",devices_pair_copied_code:"Código copiado.",devices_pair_expires:"Expira en {s}s",devices_pair_expired:"El código expiró.",devices_pair_regen:"Generar otro",devices_pair_waiting:"Esperando que el dispositivo confirme…",devices_pair_done:"Dispositivo vinculado ✓",devices_pair_localhost_only:"Solo se pueden generar códigos desde la PC del daemon (localhost).",devices_last_seen:"visto:",devices_never:"nunca",devices_revoke:"Revocar",account_section:"Cuenta",agents_section:"Agentes & modelos",channels_section:"Canales & dispositivos",advanced_section:"Avanzado",tabs:{identity:"Identidad",super_agent:"Super-agente",engines:"Engines & modelos",telegram:"Telegram",devices:"Dispositivos",advanced:"Avanzado"},identity:{title:"Identidad",subtitle:"Datos del usuario. Configuración del agente va en Super-agente.",agent_name:"Nombre del agente",owner_name:"Tu nombre",personality:"Personalidad",owner_context:"Contexto del dueño",owner_context_hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",language:"Idioma preferido",timezone:"Timezone (IANA)",timezone_hint:"ej. America/Argentina/Buenos_Aires",saved:"Identidad guardada."},super_agent:{title:"Super-agente",subtitle:"Personalidad, modelo, prompt y modos del super-agente.",personality:"Personalidad",model:"Modelo activo",model_hint:"Ej: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Prompt extra (system)",system_hint:"Texto que se prepende al system prompt base.",system_ph:"(Vacío = se usa el prompt base de core/agent/prompts/super-agent-base.md)",fallback_title:"Fallback chain",fallback_hint:"Si el modelo activo falla, prueba estos en orden.",fallback_add:"Agregar modelo a la cadena",saved:"Super-agente guardado.",enabled_label:"Super-agente habilitado",model_active:"Modelo activo (router)",model_configure:"Configurar en Modelos",behavior_subtitle:"Comportamiento del super-agente. El modelo y la cadena de fallback se configuran en el Router de modelos."},engines_keys:{title:"API keys de modelos",subtitle:"Cada engine guarda su key en ~/.apx/config.json. Los valores ya seteados muestran sufijo seguro.",ollama_url:"Ollama URL",ollama_hint:"Por defecto: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(no seteada)",clear:"Borrar key",saved:"Key guardada.",cleared:"Key borrada."},telegram_global:{title:"Telegram (default)",subtitle:"Canal default — los proyectos pueden overridear con su propio canal.",bot_token:"Bot token",chat_id:"Chat ID por defecto",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling habilitado",saved:"Telegram guardado."},advanced:{title:"Avanzado",subtitle:"Editor raw del ~/.apx/config.json. Los secretos se ven *** set *** pero podés escribir uno nuevo.",write:"Aplicar cambios",written:"Config aplicada y daemon recargado.",reload_success:"Config recargada."}},project:{not_found:"Roby no encontró el proyecto {pid}: quizás se desregistró o el ID es incorrecto.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"¿Desregistrar {label}? La carpeta no se borra.",unregistered:"Desregistrado.",base_subtitle:"Espacio general · super-agente",danger:{title:"Zona peligrosa",subtitle:"Acciones que afectan el registro del proyecto en APX. No tocan archivos del repo.",rebuild_desc:"Re-escanea .apc/, MCPs y agents y regenera el contexto del super-agente para este proyecto.",unregister_desc:"Quita el proyecto del registry de APX. La carpeta del disco se mantiene intacta.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerar contexto de {label}.",rebuild_long:"Vuelve a leer la config APC, lista MCPs y agents disponibles, y reconstruye el system prompt del super-agente. Es seguro de correr — no borra nada. Usalo después de tocar .apc/ a mano o si los cambios no se reflejan.",unregister_confirm_title:"Desregistrar proyecto",unregister_long:"El proyecto deja de aparecer en `apx`. Los archivos del disco (.apc/, código, todo) se mantienen. Podés volver a registrarlo con `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Rutinas",tasks:"Tasks",mcps:"MCPs",vars:"Variables",logs:"Logs",memories:"Memorias"},sections:{workspace:"Workspace",automation:"Automatización",knowledge:"Conversaciones",config:"Config"},overview:{tasks_open:"Tasks abiertas",routines:"Rutinas",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"abrir"},chat:{title:"Chat con agente",subtitle:"Chat directo con el agente del proyecto.",superagent_title:"Chat con {persona}",superagent_subtitle:"Chat con {persona} — el super-agente APX. Puede usar tools (proyectos, tasks, mcps, agentes).",loaded_subtitle:"Conversación cargada con {slug}. Lo que mandes se agrega a este chat.",empty:"Mandá un mensaje para arrancar la conversación.",placeholder:"Escribí algo y enter para enviar (shift+enter = nueva línea)",send:"Enviar",stop:"Stop",clear:"Limpiar",copy:"copiar",copied:"Copiado.",stopped_marker:" [detenido]",create_agent:"Crear agente",create_agent_title:"Crear agente",create_agent_desc:"Necesario para iniciar chat en proyecto.",role_label:"rol",model_label:"modelo",model_hint:"ej. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Agente master",list:{title:"Chats",new:"Nuevo",search:"Buscar chats…",all_agents:"Todos los agentes",empty:"No hay conversaciones todavía. Arrancá una desde la derecha.",count:"{n} en total",live_with:"Live · {slug}",live_subtitle:"Sesión en memoria"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL en ~/.apx/projects/<id>/tasks/.",add:"agregar",add_label:"Nueva task",add_placeholder:"ej. revisar bug del scroll",empty:"No hay tasks {state}.",empty_open:"No hay tasks abiertas.",created:"Task creada.",create_error:"no pude crear la task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"vence",via:"via",aria_done:"marcar done",aria_drop:"descartar task",aria_reopen:"reabrir task"},global_tasks:{title:"Tasks (todos los proyectos)",subtitle:"Tareas agregadas de todos los proyectos registrados.",empty:"Sin tasks.",due:"vence",go_project:"Ir al proyecto"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Cada rutina dispara un agente o un shell.",empty:"Sin rutinas. Creá una arriba.",new:"nueva",new_btn:"Nueva",delete_confirm:"Borrar rutina {name}?",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",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:"Texto (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.",delete_success:"borrada."},agents:{title:"Agents",subtitle:"Definidos en AGENTS.md + .apc/agents/<slug>.md.",subtitle_full:"Definidos en AGENTS.md + .apc/agents/<slug>.md. La memoria runtime vive en ~/.apx/projects/<id>/agents/<slug>/.",empty:"Sin agents. Agregá uno con <code>apx agent add</code> o el botón.",empty_text:"Sin agents. Agregá uno con `apx agent add` o el botón de arriba.",new:"Agente",created:"Agent {slug} creado.",slug_invalid:"slug debe matchear /^[a-z][a-z0-9_-]*$/",hierarchy:"Jerarquía",list_view:"Lista",import:"Importar",chat:"Chat",view:"Ver",orchestrator:"Orquestador",new_title:"Nuevo agent",new_desc:"POST /projects/:pid/agents — escribe .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (opcional)",role_ph:"code refactor",model_label:"model (opcional)",model_hint:"ej. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (opcional)",desc_label:"description (opcional)",desc_ph:"Qué hace este agente…",skills_label:"skills (coma)",skills_ph:"skill-a, skill-b",tools_label:"tools (coma)",tools_ph:"tool-a, tool-b",parent_label:"reporta a (parent, opcional)",parent_hint:"Subagente de un orquestador.",none_parent:"— ninguno —",master_label:"Orquestador (master)",create_success:"Agent {slug} creado.",create_error:"create falló",import_title:"Importar del vault",import_desc:"Plantillas en ~/.apx/agents. Se registran en este proyecto (.apc/agents/<slug>.md).",import_empty:"Sin plantillas en el vault.",import_success:"Importado: {slug}",import_already:"ya está",import_btn:"Importar"},agent_detail:{not_found:"Agente no encontrado.",chat_btn:"Chat con {slug}",reports_to:"↳ reporta a",no_threads:"Sin threads.",no_activity:"Sin actividad registrada.",threads_recent:"Threads recientes",subagents:"Subagentes",subagents_desc:"Agentes que reportan a este orquestador.",config_title:"Configuración del agente",type_label:"Tipología (type)",area_label:"Área",area_hint:"ej. operaciones, marketing",area_ph:"operaciones",role_label:"Role",parent_label:"Reporta a (parent)",none_parent:"— ninguno —",model_label:"Modelo base",model_hint:"Vacío = usa el modelo del Router (default). Setealo solo para forzar un modelo a este agente.",model_ph:"(vacío = router default)",skills_label:"Skills (coma)",bio_label:"Bio / descripción",system_label:"System prompt",system_hint:"Define personalidad y comportamiento (cuerpo del AGENT.md).",master_label:"Orquestador (master)",delete_btn:"Borrar agente",save_btn:"Guardar cambios",delete_confirm:'Borrar el agente "{slug}"? Se elimina .apc/agents/{slug}.md y sus datos runtime locales.',update_success:"Agente actualizado.",delete_success:"Agente borrado.",tools_hint:"Qué tools puede usar el agente. Tocá para activar/desactivar; o editá la lista abajo.",tools_custom_ph:"lista (coma): echo, http_fetch",memory_title:"Memoria del agente",memory_empty:"(memoria vacía)",memory_saved:"Memoria guardada.",records_title:"Records",records_desc:"Log de actividad del agente (mensajes/acciones). Lo más nuevo primero.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Estado de ejecución del agente, derivado de sus rutinas.",sleep_deep:"Deep sleep · sin heartbeat",sleep_deep_desc:"Este agente no tiene ninguna rutina que lo dispare. No se ejecuta de forma autónoma; solo responde cuando lo invocás (chat / tarea).",brain_title:"Brain",brain_desc:"Grafo de relaciones reales del agente: memoria, threads, tasks, heartbeats y jerarquía. (primera versión — lo refinamos)",brain_empty:"Aún no hay relaciones para graficar (sin memoria, threads, tasks ni rutinas).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: Runtime > Shared > Global. Conflictos arriba si los hay.",empty:"Sin MCPs configurados.",new:"MCP",delete_confirm:"Borrar MCP {name} de scope {scope}?",conflicts:"⚠ Conflictos: {names}",new_title:"Nuevo MCP",edit_title:"Editar MCP",new_desc:"Se guarda según el scope elegido. Los valores con ${var.X} se resuelven al arrancar el MCP.",scope_label:"Scope",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",scope_runtime_desc:"Solo este proyecto · con secrets · no se commitea (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"Solo este proyecto · committeable · sin secrets (.apc/mcps.json)",scope_global_desc:"Todos los proyectos de esta máquina (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Proceso local — `command` + args",transport_http_desc:"Endpoint remoto — URL + headers",transport_label:"Transport",name_label:"Nombre",name_ph:"my-mcp",cmd_label:"Comando",cmd_ph:"npx",args_label:"Args",args_hint_tokens:"Una entrada por argumento. Usá el botón + para insertar variables.",env_label:"Env",env_hint_tokens:"Pares clave/valor. Los valores aceptan ${var.NOMBRE} (botón + a la derecha).",env_empty:"Sin variables de entorno.",url_label:"URL",url_ph:"https://example.com/v2/mcp",headers_label:"Headers",headers_hint:"Pares clave/valor — típicamente Authorization: Bearer ${var.TOKEN}.",headers_empty:"Sin headers.",enabled_label:"Habilitado",add_btn:"Agregar",save_btn:"Guardar",add_arg:"Agregar arg",edit_btn:"Editar",test_btn:"Probar",logs_btn:"Logs",testing:"Probando…",test_ok:"OK · {n} tools disponibles",logs_title:"Logs · {name}",logs_empty:"Sin logs todavía. Arrancá el MCP llamando un tool o probando.",logs_events:"Eventos recientes",logs_stderr:"stderr (últimos 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"elegí un MCP",logs_panel_hint:"Click un MCP de la lista para ver lo que está pasando en vivo.",logs_panel_idle:"Sin actividad. Apretá Probar para arrancarlo.",name_required:"Nombre requerido",removed:"eliminado",added:"MCP agregado.",updated:"MCP actualizado."},vars:{title:"Variables",subtitle_project:"Reemplazan ${var.NOMBRE} al cargar MCPs y plantillas. Las del proyecto ganan sobre las globales. Se guardan fuera del repo (~/.apx/, chmod 0600).",subtitle_base:"Variables globales — disponibles para todos los proyectos. Se guardan en ~/.apx/vars.json (chmod 0600).",empty:"Sin variables todavía.",new:"Variable",new_title:"Nueva variable",edit_title:"Editar variable",new_desc:"Se referencia como ${var.NOMBRE} en cualquier campo que soporte interpolación.",reveal_all:"Mostrar valores",reveal:"Mostrar",hide:"Ocultar",filter_label:"Mostrar:",filter_all:"Todas",filter_project:"Sólo proyecto",filter_global:"Sólo globales",scope_label:"Scope",scope_project:"proyecto",scope_project_desc:"Sólo este proyecto. Pisa la global con mismo nombre.",scope_global:"global",scope_global_desc:"Disponible en todos los proyectos.",name_label:"Nombre",name_hint:"Mayúsculas, dígitos y _. P. ej.: MY_API_KEY, GITHUB_TOKEN.",value_label:"Valor",value_hint:"Se guarda en disco con permisos 0600. Nunca se commitea.",value_edit_ph:"(dejá vacío para no cambiarlo… aún no soportado, pegá el valor de nuevo)",add_btn:"Agregar",save_btn:"Guardar",edit_btn:"Editar",delete_btn:"Borrar",delete_confirm:"¿Borrar {name} ({scope})?",removed:"Variable eliminada.",added:"Variable agregada.",updated:"Variable actualizada.",name_required:"Nombre requerido.",value_required:"Valor requerido."},threads:{title:"Chats",subtitle:"Conversaciones por agent (vacío = ningún log persistido todavía).",no_agents:"No hay agents. Las conversaciones requieren un agent configurado.",pick:"Elegí un agent para ver sus conversaciones.",empty:"No hay conversaciones para {slug}.",conversation_title:"Conversación {id}",messages:"mensajes",via:"via"},config:{title:"Config rápida",subtitle:"Override del proyecto. Se escribe en {path}.",model:"super_agent.model",model_hint:"ej. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug del agent que atiende por defecto en este proyecto.",use_global:"(usa global)",saved:"Guardado.",nothing:"Nada para guardar.",raw_title:"Config (JSON crudo)",raw_subtitle:"Pegá el objeto entero — equivale a PUT del archivo.",raw_save:"Reemplazar config",raw_done:"Config sobrescrita.",effective:"Effective config (read-only)",effective_sub:"Lo que ve realmente el daemon (global ⊕ override).",section_title:"Config proyecto",section_desc:"APC metadata y overrides separados. General APX vive en Settings > Config.",effective_read:"Lectura: global APX + override proyecto.",save_project:".apc/project.json guardado.",save_override:".apc/config.json guardado.",save_fields_success:"Overrides guardados.",save_meta_success:"Project metadata guardado.",no_data:"Sin datos."},telegram:{title:"Canal de Telegram (override)",subtitle:"Si seteás un canal acá, los mensajes generados por este proyecto se mandan ahí en lugar del default.",use_default:"Usar el canal default",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override guardado.",cleared:"Override eliminado — vuelve al default.",override_active:"override activo",channel_badge:"Canal {name}",no_override:"Sin override. Los mensajes de este proyecto van al canal default.",respond_engine:"Responder con engine",route_agent:"route_to_agent",route_hint:"Slug del agent que atiende (vacío = super-agent).",bot_hint_none:"Si vacío, hereda del default."},memories:{project_title:"Memoria del proyecto",project_desc:"Hechos durables a nivel proyecto. .apc/memory.md — la leen los agentes y el super-agente.",project_ph:`# Memoria del proyecto
599
-
600
- Hechos estables que cualquier agente debería saber…`,agents_title:"Memorias de agentes",agents_desc:"Memoria individual por agente. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"Sin agentes en este proyecto.",saved:"Memoria guardada.",empty:"(memoria vacía)",chars:"chars · Markdown",save_btn:"Guardar"}},base:{title:"Base",subtitle:"Espacio general · super-agente",nav_general:"General",nav_activity:"Actividad",nav_system:"Sistema",workspaces_title:"Workspaces",workspaces_desc:"Todos los proyectos registrados en APX.",workspaces_new:"Nuevo proyecto",workspaces_empty:"Sin proyectos. Agregá uno con el botón de arriba.",sessions_title:"Sessions",sessions_desc:"Sesiones de todos los engines (apx · claude · codex), más nuevas primero.",sessions_all:"Todos los engines",sessions_empty:"Sin sesiones.",sessions_error:"No pude leer las sesiones: {msg}",defaults_title:"Agent defaults",defaults_desc:"Plantillas globales del vault. Las bundled vienen con APX y siempre están; las que crees o edites quedan en ~/.apx/agents y se superponen. Importalas a un proyecto desde Agents › Importar.",defaults_show_removed:"Mostrar removidos",defaults_new:"Nuevo",defaults_empty:"Sin plantillas en el vault.",defaults_hide:"Ocultar",defaults_restore:"Restaurar",defaults_edit:"Editar",defaults_remove:"Ocultar",defaults_delete:"Borrar",defaults_tombstone_msg:'Ocultar el default "{slug}"? Es bundled — quedá tombstoneado y lo recuperás con Restaurar.',defaults_delete_msg:'Borrar el template "{slug}"?',defaults_hidden:"Ocultado.",defaults_deleted:"Borrado.",defaults_restored:"Restaurado.",defaults_new_title:"Nuevo template",defaults_new_desc:"POST /agents/vault — se guarda en ~/.apx/agents/<slug>.md",defaults_edit_title:'Editar "{slug}"',defaults_bundled_desc:"Es un default bundled. Al guardar se hace copy-on-write a ~/.apx/agents/<slug>.md (queda como override).",defaults_user_desc:"PATCH /agents/vault/:slug — edita el archivo en ~/.apx/agents.",defaults_master_label:"Agente master",defaults_slug_invalid:"slug inválido (debe matchear /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" creado.',defaults_saved:'Template "{slug}" guardado.'},logs:{title:"Logs",desc_global:"Actividad del daemon (canales globales: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Actividad del proyecto. ~/.apx/projects/<id>/messages/.",filter_channel:"filtrar canal (ej. telegram)",filter_dir:"dirección",all_directions:"Todas las direcciones",in:"Entrada (in)",out:"Salida (out)",filter_type:"tipo",all_types:"Todos los tipos",search_text:"buscar en el texto…",count_of:"de",no_activity:"Sin actividad.",no_activity_ch:'Sin actividad en el canal "{ch}".',error:"No pude leer los mensajes: {msg}",show_more:"ver más",show_less:"ver menos",daemon_errors:"Errores del daemon (~/.apx/logs/errors.jsonl)",no_errors:"Sin errores registrados. 🎉"},telegram_contacts:{title:"Contactos de Telegram",desc:"Quién le escribe a los bots. El rol define qué herramientas puede usar; un invitado no tiene permisos hasta que le asignes un rol.",empty:"Todavía no hay contactos — se registran solos cuando alguien escribe a un bot.",owner_badge:"dueño",assign_role:"Asignar rol",owner_hint:"Es dueño de un canal — cambialo desde el canal",removed:"Contacto eliminado.",delete_confirm:"¿Borrar el contacto {name}?",last_seen:"visto:",tools_all:"tools: todas",tools_none:"tools: ninguna",tools_label:"tools:"},telegram_channels:{title:"Canales",desc:"Cada canal es un bot que el daemon polea. Acá podés añadir/quitar canales, cambiar el agente que contesta, el proyecto al que pertenece y su dueño.",new_btn:"Nuevo canal",empty:"Todavía no hay canales — agregá el primero.",removed:"Canal eliminado.",delete_confirm:"¿Borrar el canal {name}?",no_owner:"sin dueño (se reclama al primer DM)",owner_label:"dueño:"},telegram_channel_dialog:{new_title:"Nuevo canal de Telegram",edit_title:"Editar canal: {name}",name_label:"name (slug interno)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug o id del proyecto al que pinear este canal (opcional).",route_label:"route_to_agent",route_hint:"Agente que contesta; vacío = super-agent APX.",owner_label:"owner_user_id",owner_hint:"user_id de Telegram del dueño de este canal. Override del rol global a 'owner' acá. Si lo dejás vacío, el primer mensaje privado lo reclama.",owner_ph:"889721252",respond_label:"Responder con engine (no echo)",name_required:"name requerido",saved:"Canal guardado."},telegram_send_dialog:{title:"Enviar a {name}",default_msg:"Mensaje de prueba desde el panel de APX ✅"},telegram_roles:{title:"Roles",desc:"Cada rol define qué herramientas del super-agent puede usar quien lo tenga asignado. 'owner' siempre = todas; 'guest' siempre = ninguna (solo chat).",empty:"No hay roles definidos.",tools_all:"todas las herramientas",tools_none:"ninguna herramienta",builtin:"built-in",delete_confirm:'¿Borrar el rol "{name}"?',removed:"Rol eliminado.",saved:'Rol "{name}" guardado.',name_required:"Nombre requerido.",builtin_error:'"{name}" es un rol built-in.',new_title:"Nuevo rol o reemplazar uno custom",name_label:"Nombre",name_ph:"editor",tools_label:"Tools (separadas por coma)",tools_hint:"Vacío = ninguna. Ejemplos: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Acceso total (todas las tools)",save_btn:"Guardar rol",delete_btn:"Borrar"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Conversación rápida con tu super-agente. Tiene acceso a tools (proyectos, tasks, mcps, agentes); para un hilo más largo y persistente, abrí Chats.",empty:"Mandale un mensaje a {persona} para arrancar.",thinking:"{persona} está pensando…",talk:"Hablar con {persona}",new_chat:"Nuevo chat",placeholder:"Escribí y enter para enviar (shift+enter = nueva línea)…"},not_found:{title:"404",message:"Roby se perdió: esta página no existe o se movió.",home:"Volver al inicio"},ask_panel:{answers_header:"Respuestas",other:"Otro",other_placeholder:"Escribí tu propia respuesta acá",text_placeholder:"Escribí tu respuesta…",back:"Atrás",skip:"Omitir",next:"Siguiente",submit:"Enviar",status_waiting:"Esperando respuesta…",status_received:"Respuestas recibidas"},code_module:{title:"Code",badge:"super-agent",desc:"Sesiones de código estilo OpenCode. Elegí un proyecto, abrí una sesión y pedile que lea, planifique, edite o ejecute.",no_projects:"No hay proyectos registrados. Registrá uno con `apx project add` para usar Code.",sessions:"Sesiones",new_session:"Nueva sesión",untitled:"Nueva sesión",no_sessions:"Todavía no hay sesiones — creá una para empezar a codear.",pick_project:"Elegí un proyecto para ver sus sesiones.",rename:"Renombrar",delete:"Eliminar",delete_confirm:"¿Eliminar esta sesión? Se borra la transcripción; tus archivos quedan intactos.",empty_chat:"Mandá una instrucción de código para arrancar.",placeholder:"Pedí un cambio… (enter envía, shift+enter = nueva línea)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edita archivos y ejecuta comandos",mode_plan_hint:"Plan — solo lectura, propone cambios sin tocar archivos",tab_context:"Contexto",tab_changes:"Cambios",tab_artifacts:"Artifacts",artifacts_none:"Todavía no hay artifacts. Pedile al agente que cree un script en `artifacts/<nombre>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copiar path",artifacts_run:"Run",artifacts_run_hint:"Para ejecutarlo desde la terminal:",artifacts_delete:"Eliminar",artifacts_delete_confirm:"¿Eliminar este artifact? El archivo se borra del disco.",ctx_model:"Modelo",ctx_tokens:"Tokens",ctx_input:"Entrada",ctx_output:"Salida",ctx_messages:"Mensajes",ctx_breakdown:"Desglose de contexto",ctx_none:"Sin uso todavía — mandá un turno para ver tokens.",seg_system:"Sistema",seg_user:"Usuario",seg_assistant:"Asistente",seg_tool:"Tools",seg_other:"Otro",changes_none:"Todavía no hay cambios en esta sesión.",changes_no_git:"Los cambios necesitan un repo git. Este proyecto no lo es.",changes_files:"{n} archivo(s) cambiados",stopped:"[detenido]",close:"Cerrar",reload:"Recargar",discard_changes:"Descartar cambios",save_shortcut_hint:"Guardar (Cmd/Ctrl+S)",artifacts_rename:"Renombrar",artifacts_view:"Ver contenido",artifacts_edit:"Editar contenido",tree_collapse_all:"Colapsar todo",terminal_clear:"Limpiar",terminal_close:"Cerrar terminal"},desktop_screen:{status_title:"Estado",autostart_title:"Arranque automático",shortcut_title:"Atajo de teclado",appearance_title:"Apariencia",activation_title:"Activación + transcripción",last_conv_title:"Última conversación"},voice_screen:{providers_title:"Proveedores de voz (TTS)",test_title:"Probar voz",stt_title:"Transcripción (STT)",configure_provider:"Configurar {name}"},deck_screen:{widgets_title:"Widgets",context_title:"Contexto APX",reload_manifest:"Recargar manifest",widget_native:"Widget nativo APX",widget_external:"Widget externo"},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Modelo que vectoriza el historial de todos los canales para la memoria relevante. Igual que TTS/STT: elegí un proveedor y un modelo. 'Automático' prueba local primero y cae a offline si no hay nada disponible.",provider_label:"Proveedor",provider_hint:"Ollama es local y gratis. Gemini/OpenAI usan la API key de su sección en Modelos (o la de abajo).",mode_label:"Modo de selección",mode_hint:"Cadena cae al siguiente si uno falla; Único usa exactamente el proveedor elegido.",available:"disponible",unavailable:"no disp.",test_btn:"Probar embedding",reindex_btn:"Reindexar memoria",test_ok:"Embedding OK con {embedder}",test_failed:"Test falló: {msg}",reindexed:"Reindexado: {indexed} chunks (limpiados {cleared}).",reindex_failed:"Reindex falló: {msg}",save_failed:"No se pudo guardar: {msg}",provider_auto:"Automático (cadena: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, sin API key (nomic-embed-text)",provider_gemini:"Gemini — free tier con key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, sin modelo — degradado)",mode_chain:"Cadena (fallback automático)",mode_single:"Único (usa solo el elegido)",ollama_title:"Ollama (local)",ollama_desc:"Sin API key. Corre nomic-embed-text en tu Ollama local o cloud.",model_label:"Modelo",base_url_label:"Base URL",ollama_base_url_hint:"Vacío usa engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) u otro modelo compatible.",api_key_label:"API key",openai_key_hint:"Vacío reusa engines.openai.api_key. Dejalo en blanco para mantener la guardada.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier con API key de Google.",gemini_key_hint:"Vacío reusa engines.gemini.api_key.",compaction_title:"Compactación de historial",compaction_desc:"Cuando un chat supera el umbral de turnos, los más viejos se resumen con un LLM liviano (local) y se guardan como [RESUMEN COMPACTADO], manteniendo el contexto acotado. Corre fuera del hot-path: el turno actual usa el resumen que ya exista.",threshold_label:"Umbral de compactación",threshold_hint:"Compactar una vez que el chat supera estos turnos (por defecto 60).",keep_recent_label:"Turnos recientes a preservar",keep_recent_hint:"Turnos verbatim que NUNCA se compactan (por defecto 40). Debe ser menor al umbral.",compact_model_label:"Modelo de compactación",compact_model_hint:"LLM liviano para resumir. Ideal uno local (Ollama) para no gastar. Formato proveedor:modelo.",compact_fallback_label:"Modelo de fallback",compact_fallback_hint:"Se usa si el de compactación falla. Vacío cae al modelo del super-agente.",compact_fallback_ph:"(vacío → modelo del super-agente)"},router_panel:{title:"Router de modelos",description:"Un único router general (sin casos por tarea). Elegí un proveedor y un modelo; si el activo falla, prueba la cadena de fallback en orden.",badge_default:"default",no_providers:"Agregá un proveedor abajo para poder elegir modelos.",active_model_label:"Modelo activo (default)",active_model_hint:"Proveedor + modelo. Se guarda como proveedor:modelo.",fallback_title:"Cadena de fallback",fallback_desc:"Si el modelo activo falla, prueba estos en orden. Click en uno para editarlo.",fallback_empty:"Sin fallback configurado.",add_to_chain:"Agregar a la cadena",done:"listo",save:"Guardar router",saved:"Guardado",saved_toast:"Router guardado.",provider_ph:"— proveedor —",provider_not_found:"⚠ {name} (no encontrado)",provider_not_configured:'El proveedor "{name}" no está configurado.'},engines_panel:{title:"Proveedores",new_btn:"Nuevo proveedor",description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",empty:"Sin providers. Agregá uno con el botón de arriba.",add_card:"Agregar provider",saved:"Provider guardado.",saved_json:"Provider guardado (JSON).",deleted:"Provider borrado.",delete_confirm:"¿Borrar provider {name}?"},providers_modal:{new_title:"Nuevo proveedor",edit_title:"Editar {name}",description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",list_models_hint:"Listar los modelos reales del proveedor",toggle_active:"Activo · click para desactivar",toggle_inactive:"Inactivo · click para activar",delete:"Borrar",custom:"Custom",json_mode:"JSON",form_mode:"Volver al formulario",json_label:"Config del provider (JSON)",json_hint:"Se guarda como engines.{slug} en config.json",json_help:"Debe ser un objeto JSON válido con al menos engine. El slug se toma del formulario.",name_label:"Nombre",name_ph:"Mi provider",engine_label:"Motor (engine)",base_url_label:"URL base (base_url)",base_url_hint:"Se completa sola al elegir un proveedor.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Dejá en blanco para mantener la actual.",api_key_hint_env:"Se guarda como secreto. Env sugerida: {env}",api_key_hint:"Se guarda como secreto.",api_key_set:"…{suffix} (ya seteada)",model_label:"Modelo por defecto",load_models:"Cargar modelos",max_tokens_label:"Máx. tokens (max_tokens)",temperature_label:"Temperatura: {value}",pricing_summary:"Análisis de tokens / pricing (opcional)",context_limit_label:"Límite de contexto (tokens)",price_input:"$ entrada / 1M",price_output:"$ salida / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Límites de contexto por modelo (JSON)",active_label:"Activo (los agentes pueden usarlo)",err_slug_required:"Slug requerido.",err_slug_required_form:"Slug requerido (en el formulario).",err_slug_exists:'Ya existe un provider "{slug}".',err_model_limits_json:"Límites de contexto por modelo: JSON inválido.",err_json_invalid:"JSON inválido: revisá la sintaxis.",err_json_object:"El JSON debe ser un objeto con la config del provider.",err_engine_missing:'Falta "engine" (ej. "anthropic", "ollama").',err_save:"Error al guardar.",err_no_models:"Sin modelos. ¿Key/URL correctas?",err_list_models:"No se pudo listar modelos."},providers_card:{active:"Activo",off:"Off",model:"Modelo",base_url:"Base URL",api_key:"API key",key_set:"✓ seteada",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copiar",stop:"Detener",send:"Enviar",pick_model:"Elegir modelo (o Auto)",insert_variable:"Insertar variable"},sidebar_ui:{toggle:"Mostrar/ocultar sidebar"},models_ui:{invalid_hint:"Modelo/proveedor no disponible"},global_config:{title:"Config APX"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (ya seteada)",api_key_keep_hint:"Dejá en blanco para mantener la actual.",api_key_secret_hint:"Se guarda como secreto. Env: {env}",api_key_reuse_hint:"Si lo dejás vacío, reusa {engine}. Env: {env}",err_save:"Error al guardar.",model_label:"Modelo",voice_label:"Voz",format_label:"Formato",output_format_label:"Formato de salida",voice_id_label:"Voice ID",voice_id_hint:"Voice id de ElevenLabs (vacío = default).",gemini_model_hint:"El TTS de Gemini todavía está en preview.",style_label:"Estilo (cómo debería hablar)",style_hint:"Instrucción en lenguaje natural. Vacío = sin estilo. Ej.: 'hablá en un tono alegre y pausado'.",style_ph:"hablá en un tono alegre y enérgico",piper_bin_label:"Binario (bin)",piper_bin_hint:"Ruta o nombre del CLI de piper (PATH).",piper_model_label:"Modelo (.onnx)",piper_model_hint:"Ruta absoluta al modelo de voz de piper.",piper_speaker_label:"Speaker (opcional)",piper_speaker_hint:"Speaker id para modelos multi-voz.",mock_desc:"El engine mock genera un WAV de prueba en silencio. No tiene parámetros: sirve como fallback garantizado cuando no hay ningún otro engine configurado.",selection_mode:"Modo de selección",mode_chain_desc:"Cadena con fallback: usa el primer engine disponible siguiendo el orden de abajo.",mode_single_desc:"Solo engine default: siempre usa el elegido; el resto queda configurado para otros usos.",mode_chain_btn:"Cadena (router)",mode_single_btn:"Solo engine default",move_up:"Subir",move_down:"Bajar",badge_local:"local",badge_available:"disponible",badge_unavailable:"configurado, no disponible",badge_not_configured:"sin configurar",badge_default:"default",set_as_default:"Usar como default",configure:"Configurar",stt_engine_label:"Engine de transcripción",stt_engine_hint:"Local usa faster-whisper (requiere python3 + faster-whisper). OpenAI usa la key de engines.openai.",stt_model_label:"Modelo local (whisper)",stt_model_hint:"Más grande = más preciso y más lento.",stt_language_label:"Idioma",stt_language_hint:'Para español, elegir "Español" mejora la precisión.',stt_provider_auto:"Automático (local, después OpenAI)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",lang_auto:"Detección automática",lang_es:"Español",lang_en:"Inglés",lang_pt:"Portugués",lang_fr:"Francés",lang_it:"Italiano",lang_de:"Alemán",test_default_text:"Hola, soy APX. Esto es una prueba de voz.",test_default_engine:"Default ({name})",test_default_chain:"Default (cadena)",test_unavailable_suffix:" · no disponible",test_empty_error:"Escribí algo para decir.",test_synth_error:"No se pudo sintetizar.",test_engine_label:"Engine",test_engine_hint:"Override del default para probar.",test_style_label:"Estilo (solo Gemini)",test_style_hint:"Cómo debería hablar. Vacío = sin estilo.",test_text_label:"Texto a decir",test_text_ph:"Escribí lo que querés que diga…",say_this:"Decir esto",stop:"Detener",replay:"Repetir",engine_result:"Engine",providers_desc:"Engines de síntesis. El estado lo reporta el daemon en vivo. Elegí cuál usar por defecto.",providers_load_error:"No pude cargar los proveedores: {msg}",test_desc:"Elegí con qué engine sintetizar y, si aplica, cómo debería hablar.",stt_desc:"Engine de speech-to-text que usan el deck, Telegram y la CLI al escuchar.",toast_default_engine:"Engine default: {id}.",toast_mode_chain:"Modo: cadena con fallback.",toast_mode_single:"Modo: solo engine default.",toast_config_saved:"Configuración de voz guardada.",toast_transcription_updated:"Transcripción actualizada."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (parcial).",bot_token_hint:"Token de BotFather. Se guarda en ~/.apx/config.json.",bot_token_hint_short:"Token de BotFather.",secret_set_replace:"(seteado — escribí para reemplazar)",secret_already_set:"(ya seteado)",empty_keep:"— vacío = mantener",message_sent:"Mensaje enviado.",message_label:"Texto",send_chat_id:"chat_id: {id}",default_apx:"APX por defecto",yes:"sí",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_ui:{model_router_default:"modelo: default del router",slug_kebab_hint:"kebab-case, ej. reviewer, my-agent, content-writer",comma_separated:"separadas por coma",body_hint:"markdown — extiende el system prompt del agente",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorador",type_none:"— sin tipo —",type_orchestrator:"Orquestador",type_orchestrator_desc:"Coordina el equipo y delega.",type_specialist:"Especialista",type_specialist_desc:"Experto en el dominio; corre tareas.",type_assistant:"Asistente",type_assistant_desc:"Ayudante conversacional.",type_worker:"Worker",type_worker_desc:"Corre tareas autónomas.",type_monitor:"Monitor",type_monitor_desc:"Vigila el estado y reporta.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definición (frontmatter + system prompt).",memory_durable_desc:"hechos durables que el agente recuerda.",running:"running",paused:"pausada",last_error:"última: error",field_tick:"Tick",field_next_tick:"Próximo tick",field_last_tick:"Último tick",field_last_run:"Última corrida",tools_label:"Tools",kind_agent:"agente",kind_memory:"memoria",kind_thread:"thread",kind_task:"task",kind_routine:"rutina",kind_hierarchy:"jerarquía",nodes_drag_hint:"{n} nodos · arrastrá para reordenar",kind_exec_agent:"Agente del proyecto",kind_exec_agent_desc:"Corre un agente del proyecto con un prompt. Vos elegís cuál.",kind_super_agent:"Super-agente",kind_super_agent_desc:"Llama al super-agente APX con un prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Manda un mensaje fijo a un canal de Telegram. Sin modelo ni agente.",kind_shell:"Shell",kind_shell_desc:"Corre un comando shell. Sin prompt ni pre/post — el comando es la acción.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"No hace nada salvo escribir una línea en los logs cada vez que corre. Sirve para confirmar que el scheduler está vivo. Si no sabés si lo necesitás, no lo uses.",unit_seconds:"segundos",unit_minutes:"minutos",unit_hours:"horas",unit_days:"días",every_n_unit:"cada {n} {unit}",every_v:"cada {v}",preset_every_10m:"cada 10 min",preset_hourly:"cada hora",preset_daily_9am:"diario 9am",preset_weekdays_9am:"días hábiles 9am",preset_manual:"Manual",var_pre_output_prompt:"Salida de los pre-commands, inyectada en el prompt.",var_llm_output:"Respuesta del agente / super-agente.",var_status:"ok | error.",var_skipped:"1 si la acción se salteó.",var_pre_output:"Salida de los pre-commands.",var_pre_output_file:"Archivo con la salida pre (para salidas grandes).",var_pre_exit:"Código de salida de los pre-commands.",var_routine:"Nombre de la rutina.",summary_runs_agent:'Corre el agente "{agent}"',summary_runs_agent_none:"Corre un agente (todavía no elegiste cuál)",summary_super_agent:"Llama al super-agente",summary_telegram:'Manda Telegram a "{channel}"',summary_runs_cmd:"Corre: {cmd}",summary_shell:"Corre un comando shell",summary_heartbeat:"Deja un heartbeat en los logs",action_agent_answers:'El agente "{agent}" responde el prompt',action_agent_pick_answers:"El agente (elegí uno) responde el prompt",action_super_answers:"El super-agente responde el prompt",action_telegram_channel:'Manda Telegram al canal "{channel}"',action_runs_shell:"Corre el comando shell",step_pre:"Pre",step_post:"Post",last_label:"última:",tg_chat_id_ph:"(usa el del canal)",tg_text_ph:"mensaje a enviar",hb_message_ph:"sigo vivo",arg_placeholder:"--flag o valor",remove_arg:"quitar arg",super_agent_label:"{persona} (super-agente)",super_agent_badge:"super-agente"},modules_ui:{desktop_pos_left:"Izquierda",desktop_pos_center:"Centro",desktop_pos_right:"Derecha",desktop_theme_light:"Claro",desktop_theme_dark:"Oscuro",desktop_status_desc:"La ventana se abre desde la terminal o por arranque automático.",desktop_running:"Corriendo",desktop_stopped:"Detenida",desktop_refresh:"refrescar",desktop_from_terminal:"Desde la terminal:",desktop_autostart_desc:"Abre la ventana al iniciar sesión. Equivale a `apx desktop install` (no requiere sudo).",desktop_platform:"plataforma: {platform}",desktop_shortcut_desc:"Atajo global que muestra/oculta la ventana y empieza a escuchar.",desktop_accelerator:"Acelerador",desktop_accelerator_hint:'Formato Electron, ej. "CommandOrControl+G" o "CommandOrControl+Shift+Space". Reiniciá la ventana para aplicar.',desktop_shortcut_saved:"Atajo guardado. Reiniciá la ventana (apx desktop stop && start) para aplicarlo.",desktop_autostart_on:"Arranque automático habilitado para el próximo inicio de sesión.",desktop_autostart_off:"Arranque automático deshabilitado.",desktop_appearance_desc:"Tema de la ventana y posición en la pantalla.",desktop_theme:"Tema",desktop_restart_apply:"Reiniciá la ventana para aplicar.",desktop_theme_set:"Tema: {value}.",desktop_position:"Posición",desktop_position_hint:'"izquierda" / "centro" / "derecha" del borde superior.',desktop_position_set:"Posición: {value}.",desktop_activation_desc:"El plugin del daemon procesa los mensajes. El STT se configura en Voces.",desktop_enabled_toast:"Escritorio habilitado.",desktop_disabled_toast:"Escritorio deshabilitado.",desktop_plugin_on:"Plugin habilitado (responde mensajes)",desktop_plugin_off:"Plugin deshabilitado",desktop_stt_engine:"Motor de speech-to-text:",desktop_stt_engine_suffix:"(whisper local, idioma, modelo).",desktop_last_conv_desc:"El último intercambio con el agente desde la ventana flotante.",desktop_no_messages:"Todavía no hay mensajes. Mandá algo a la ventana de escritorio para que aparezca acá.",desktop_you:"Vos",desktop_roby:"Roby",desktop_empty_msg:"(vacío)",deck_widget_enabled:"Widget {id} habilitado.",deck_widget_disabled:"Widget {id} deshabilitado.",deck_save_error:"Error al guardar",deck_loading_manifest:"Cargando manifest…",deck_manifest_error:"Error al cargar el manifest.",deck_widgets_summary:"{count} widgets · {enabled} externos habilitados",deck_loading_manifest_full:"Cargando el manifest del Deck…",deck_manifest_load_failed:"No se pudo cargar el manifest del Deck.",deck_retry:"Reintentar",deck_no_widgets:"No hay widgets en el manifest.",deck_context_desc:"Información que el Deck ve desde el daemon.",deck_active_project:"Proyecto activo:",deck_none:"ninguno",deck_registered_projects:"Proyectos registrados:",deck_active_plugins:"Plugins activos:",deck_daemon_active:"activo · {uptime}",deck_daemon_started:"iniciado",deck_safety_no_shell:"sin shell directo",deck_safety_no_arbitrary:"comandos arbitrarios bloqueados",deck_safety_confirm:"las acciones peligrosas requieren confirmación",code_copied:"Copiado.",code_saved:"Guardado.",code_file_empty:"(vacío)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Agente principal con todas las tools",code_chat_tab:"Chat",code_panel_sessions:"Lista de sesiones",code_panel_tree:"Árbol de archivos",code_panel_terminal:"Terminal",code_panel_context:"Panel de contexto",code_ctx_auto:"auto",code_ctx_mode:"Modo",code_ctx_agent:"Agente",code_ctx_msgs_value:"{user} usuario · {assistant} asistente",code_ctx_tokens_total:"Tokens Total",code_ctx_created:"Creado",code_ctx_activity:"Actividad",code_project_fallback:"proyecto {id}",code_pick_project_ph:"Elegí un proyecto…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"Ver",code_artifact_edit_short:"Editar",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncado"},settings_ui:{bearer_label:"Bearer",global_config_desc:"Config general en ~/.apx/config.json. Editable por tabs; el JSON queda separado.",global_json_desc:"Los secretos redacted no se sobrescriben.",save_json:"Guardar JSON",expand_menu:"Expandir menú",collapse_menu:"Colapsar menú",documentation:"Documentación",kind_personal:"Personal",kind_company:"Empresa",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Otro",base_menu_view:"Vista del menú Base (workspace general).",coming_soon:"Próximamente",inspector_title:"Skill Inspector (RAG por turno)",inspector_desc:"Función experimental. Cuando está activa, el agente NO recibe la lista completa de skills en su prompt; en cada mensaje un RAG local decide qué skill(s) cargar — el cuerpo completo si hay match fuerte, una sugerencia si es medio, nada si no aplica. Se reevalúa en cada turno: una skill que dejó de ser relevante desaparece del contexto.",enable_inspector:"Habilitar inspector",enable_inspector_hint:"Off = comportamiento clásico (lista de slugs + sugerencia pasiva). On = el RAG decide por turno.",on:"On",off:"Off",index_count:"Índice: {n} skills",not_indexed:"sin indexar",dim:"dim {dim}",updated_at:"actualizado {date}",reindex:"Reindexar",reindex_forced:"Reindexar (forzado)",embedder_source:"El embedder viene de Memoria (RAG). Local con Ollama, u offline si no hay proveedor configurado.",thresholds_title:"Umbrales y límites",thresholds_desc:"Ajustá qué tan agresivo es el inspector. Subir los umbrales = menos falsos positivos pero más riesgo de perderte una skill; bajarlos = al revés.",test_title:"Probar (dry-run)",test_desc:"Escribí un mensaje como lo haría un usuario y mirá qué skills cargaría/sugeriría el inspector — sin llamar al modelo. Fuerza el inspector aunque esté apagado arriba.",test_placeholder:"ej.: necesito crear un video promocional con voz en off",test_btn:"Probar",jit_empty_index:"JIT (índice vacío)",loaded_label:"Cargadas:",suggested_label:"Sugeridas:",could_not_save:"No se pudo guardar: {msg}",indexed_with:"Indexado con {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Falló el indexado: {msg}",dry_run_failed:"Falló el dry-run: {msg}",knob_load_threshold:"Umbral de carga",knob_load_threshold_hint:"Similaridad mínima para inyectar el CUERPO de la skill (alto = más estricto).",knob_hint_threshold:"Umbral de sugerencia",knob_hint_threshold_hint:"Similaridad mínima para solo SUGERIR la skill (así el agente la carga si quiere).",knob_margin:"Margen sobre la 2da",knob_margin_hint:"La primera tiene que superar a la segunda por este margen para cargar su cuerpo (evita empates flojos).",knob_max_loaded:"Máx. cuerpos cargados",knob_max_loaded_hint:"Cuántas skills se inyectan completas por turno.",knob_max_hints:"Máx. sugerencias",knob_max_hints_hint:"Cuántas skills extra se nombran como sugerencia.",knob_prompt_floor:"Largo mínimo del prompt",knob_prompt_floor_hint:"Los mensajes más cortos que esto se ignoran (evita 'ok', 'hola').",knob_body_char_cap:"Tope de chars del cuerpo",knob_body_char_cap_hint:"Recorta los cuerpos largos para que no inflen el contexto.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Solo valores específicos del proyecto; vacío hereda del global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Modelo del super-agente",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Prompt extra",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Responder con engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Proyecto",cfg_project_desc:".apc/project.json. Metadata APC portable; sin secretos, sin runtime.",cfg_name:"Nombre",cfg_version:"Versión",cfg_apc_spec:"APC spec",cfg_apx_install:"Estado de instalación APX",cfg_apx_storage_id:"ID de storage APX"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) eligió estas skills para este turno",tools_count:"{n} tools",tool_read_file:"Leer archivo",tool_write_file:"Escribir archivo",tool_edit_file:"Editar archivo",tool_list_files:"Listar archivos",tool_search_files:"Buscar en archivos",tool_search_messages:"Buscar mensajes",tool_tail_messages:"Últimos mensajes",tool_run_shell:"Correr shell",tool_send_telegram:"Enviar Telegram",tool_call_agent:"Llamar agente",tool_call_mcp:"Llamar MCP",tool_call_runtime:"Llamar runtime",tool_create_task:"Crear task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (decide el router)",model_filter_ph:"filtrar o escribir modelo…",loading_models:"cargando modelos…",use_value:"usar “{value}”",model_combobox_ph:"elegí o escribí un modelo…",search_variable_ph:"buscar variable…",no_matches:"sin coincidencias",create_variable:"Crear nueva variable…",kv_key_ph:"CLAVE",kv_value_ph:"valor",remove_row:"quitar fila",add_row:"Agregar fila",err_chat_failed:"Falló el chat.",err_stream_failed:"Falló el stream.",err_load_conversation:"No se pudo cargar la conversación.",err_stream:"Error de stream."}},SO={common:{loading:"Loading…",saving:"Saving…",cancel:"Cancel",save:"Save",delete:"Delete",edit:"Edit",create:"Create",add:"Add",remove:"Remove",reload:"Reload",shutdown:"Shut down",enabled:"Enabled",disabled:"Disabled",enable:"Enable",disable:"Disable",open:"Open",close:"Close",confirm:"Confirm",optional:"(optional)",none:"—",none_yet:"Nothing here yet.",error_generic:"Something went wrong.",search:"Search",new:"New",restore:"Restore",show:"Show",hide:"Hide",copy:"Copy",run:"Run"},daemon:{connecting:"Connecting to the daemon…",unreachable:"Could not reach the daemon at localhost:7430.",unreachable_hint:"Start APX with `apx daemon start` and refresh.",version:"Version",uptime:"Uptime",status:"Status",running:"running",down:"down",reload_hint:"POST /admin/reload — reloads ~/.apx/config.json without restarting.",shutdown_confirm:"Shut down the daemon? Upcoming requests will fail until it restarts.",shutdown_done:"Daemon stopped."},pairing:{title:"Pair this device",subtitle:"You are connecting from outside this machine. For security, pair this browser with a pairing code.",steps_title:"How to get the code",step_1:"On the PC where APX is running, open a terminal.",step_2:"Run `apx pair` (or scan the QR with APX Deck).",step_3:"Copy the code shown below the QR and paste it here.",code_label:"Pairing code",code_ph:"e.g. 7f3a1c9e-…",label_label:"Device name",label_ph:"e.g. Living room laptop",submit:"Pair",linking:"Pairing…",success:"Device paired ✓",err_required:"Paste the pairing code.",err_expired:"The code expired. Run `apx pair` again and try again.",err_unknown:"Unknown or already-used code. Generate a new one with `apx pair`.",err_generic:"Could not pair. Check the code and try again.",revoke_hint:"You can revoke this device at any time from Settings or with `apx pair revoke`."},nav:{apx_admin:"APX",settings:"Settings",project:"Project",add_project:"Add project",modules:{voice:"Voices",desktop:"Desktop",deck:"Deck",code:"Code"}},topbar:{breadcrumb_root:"APX",breadcrumb_settings:"APX › Settings",breadcrumb_project:"APX › Project",breadcrumb_base:"Base",breadcrumb_projects:"Projects",light:"Switch to light",dark:"Switch to dark",lang_toggle:"Language"},admin:{title:"APX",subtitle:"Admin panel. Global config, channels and projects.",engines_title:"Engines",engines_subtitle:"Available LLM adapters. API keys live in ~/.apx/config.json.",telegram_title:"Telegram",telegram_subtitle:"Configured channels. Each one can be pinned to a project.",telegram_polling_on:"Polling active",telegram_polling_off:"Disabled",telegram_add_channel:"Channel",telegram_send_test:"Test",telegram_send_test_title:"Send to",telegram_default_message:"Test message from APX panel ✅",projects_title:"Registered projects",projects_subtitle:"Click a project to open its panel.",unregister:"Unregister",unregister_confirm:"Remove {label} from APX? The folder is not deleted; only unregistered.",reload_success:"Config reloaded.",telegram_polling_started:"Polling started.",telegram_polling_stopped:"Polling stopped.",telegram_channel_removed:"Channel deleted.",agents_badge:"agents",engine_badge:"yes",engine_badge_no:"no",base_label:"Base"},add_project:{title:"Add project",subtitle:"APX will index .apc/, agents and AGENTS.md in that folder.",path_label:"Absolute path",path_hint:"Equivalent to apx project add /path/to/project",path_placeholder:"/path/to/my-project",register:"Register",path_required:"Path required.",registered:"Project #{id} registered.",search_btn:"Browse",browser_unavailable:"Browser unavailable until daemon restarts. Paste path manually.",no_folders:"No folders."},settings:{title:"Settings",subtitle:"Panel preferences + local daemon diagnostics.",appearance:"Appearance",light_mode:"Light",dark_mode:"Dark",language:"Language",daemon:"Daemon",daemon_sub:"Status of the local process that serves this web and orchestrates agents.",engines:"Available engines",engines_sub:"LLM adapters compiled with the daemon.",token:"Session token",token_sub:"If this web could not auto-load the token, paste it here.",token_active:"(token already active)",token_paste:"Paste daemon bearer",token_saved:"Token saved.",devices:"Paired devices",devices_sub:"GET /pair/list. Revoking invalidates that bearer on the daemon.",devices_empty:"No paired clients yet.",devices_revoke_confirm:"Revoke client {id}?",devices_revoke_success:"Client revoked.",devices_pair_btn:"Pair device",devices_pair_title:"Pair device",devices_pair_desc:"Scan the QR with your phone camera to open the web already paired, or paste the code on another PC.",devices_pair_scan:"Scan with your phone camera — opens the web already paired.",devices_pair_code:"Or paste this code on the pairing screen:",devices_pair_url:"Access URL",devices_pair_link:"Or copy this link and open it on the other device (enters automatically):",devices_pair_copy:"Copy",devices_pair_copied:"Link copied to clipboard.",devices_pair_copied_code:"Code copied.",devices_pair_expires:"Expires in {s}s",devices_pair_expired:"The code expired.",devices_pair_regen:"Generate another",devices_pair_waiting:"Waiting for device to confirm…",devices_pair_done:"Device paired ✓",devices_pair_localhost_only:"Codes can only be generated from the daemon's PC (localhost).",devices_last_seen:"seen:",devices_never:"never",devices_revoke:"Revoke",account_section:"Account",agents_section:"Agents & models",channels_section:"Channels & devices",advanced_section:"Advanced",tabs:{identity:"Identity",super_agent:"Super-agent",engines:"Engines & models",telegram:"Telegram",devices:"Devices",advanced:"Advanced"},identity:{title:"Identity",subtitle:"User data. Agent configuration goes in Super-agent.",agent_name:"Agent name",owner_name:"Your name",personality:"Personality",owner_context:"Owner context",owner_context_hint:"Who you are, what you work on, what the agent should know about you.",language:"Preferred language",timezone:"Timezone (IANA)",timezone_hint:"e.g. America/New_York",saved:"Identity saved."},super_agent:{title:"Super-agent",subtitle:"Personality, model, prompt and modes of the super-agent.",personality:"Personality",model:"Active model",model_hint:"E.g.: anthropic:claude-sonnet-4.5, ollama:gemma2:9b",permission_mode:"Permission mode",system:"Extra prompt (system)",system_hint:"Text prepended to the base system prompt.",system_ph:"(Empty = the base prompt from core/agent/prompts/super-agent-base.md is used)",fallback_title:"Fallback chain",fallback_hint:"If the active model fails, these are tried in order.",fallback_add:"Add model to chain",saved:"Super-agent saved.",enabled_label:"Super-agent enabled",model_active:"Active model (router)",model_configure:"Configure in Models",behavior_subtitle:"Super-agent behavior. Model and fallback chain are configured in the Model Router."},engines_keys:{title:"Model API keys",subtitle:"Each engine stores its key in ~/.apx/config.json. Already-set values show a safe suffix.",ollama_url:"Ollama URL",ollama_hint:"Default: http://127.0.0.1:11434",key_label:"API key",key_placeholder:"(not set)",clear:"Clear key",saved:"Key saved.",cleared:"Key cleared."},telegram_global:{title:"Telegram (default)",subtitle:"Default channel — projects can override with their own channel.",bot_token:"Bot token",chat_id:"Default chat ID",poll_interval:"Poll interval (ms)",respond_with_engine:"Respond with engine",enabled:"Polling enabled",saved:"Telegram saved."},advanced:{title:"Advanced",subtitle:"Raw editor for ~/.apx/config.json. Secrets show as *** set *** but you can write a new one.",write:"Apply changes",written:"Config applied and daemon reloaded.",reload_success:"Config reloaded."}},project:{not_found:"Roby couldn't find project {pid}: it may have been unregistered, or the ID is wrong.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"Unregister {label}? The folder is not deleted.",unregistered:"Unregistered.",base_subtitle:"General workspace · super-agent",danger:{title:"Danger zone",subtitle:"Actions that affect APX's project registry. They do not touch repo files.",rebuild_desc:"Re-scans .apc/, MCPs and agents and regenerates the super-agent context for this project.",unregister_desc:"Removes the project from APX's registry. The folder on disk stays intact.",rebuild_confirm_title:"Rebuild context",rebuild_confirm_desc:"Regenerate context for {label}.",rebuild_long:"Re-reads APC config, lists available MCPs and agents, and rebuilds the super-agent system prompt. Safe to run — nothing is deleted. Use it after editing .apc/ by hand or if changes are not being picked up.",unregister_confirm_title:"Unregister project",unregister_long:"The project disappears from `apx`. Files on disk (.apc/, code, everything) stay. You can re-register it with `apx project register <path>`."},nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Routines",tasks:"Tasks",mcps:"MCPs",vars:"Variables",logs:"Logs",memories:"Memories"},sections:{workspace:"Workspace",automation:"Automation",knowledge:"Conversations",config:"Config"},overview:{tasks_open:"Open tasks",routines:"Routines",agents:"Agents",mcps:"MCPs",chat:"Chat (super-agent)",chat_value:"open"},chat:{title:"Chat with agent",subtitle:"Direct conversations with project agents. The super-agent does not intervene.",superagent_title:"Chat with {persona}",superagent_subtitle:"Chat with {persona} — the APX super-agent. Can use tools (projects, tasks, mcps, agents).",loaded_subtitle:"Loaded conversation with {slug}. Sending will append to this thread.",empty:"Send a message to start the conversation.",placeholder:"Type something and press enter to send (shift+enter = new line)",send:"Send",stop:"Stop",clear:"Clear",copy:"copy",copied:"Copied.",stopped_marker:" [stopped]",create_agent:"Create agent",create_agent_title:"Create agent",create_agent_desc:"Required to start a chat in this project.",role_label:"role",model_label:"model",model_hint:"e.g. openai:gpt-5, groq:llama-3.3-70b-versatile",master_label:"Master agent",list:{title:"Chats",new:"New",search:"Search chats…",all_agents:"All agents",empty:"No conversations yet. Start one from the right.",count:"{n} total",live_with:"Live · {slug}",live_subtitle:"In-memory session"}},tasks:{title:"Tasks (TODOs)",subtitle:"Append-only JSONL in ~/.apx/projects/<id>/tasks/.",add:"add",add_label:"New task",add_placeholder:"e.g. fix scroll bug",empty:"No {state} tasks.",empty_open:"No open tasks.",created:"Task created.",create_error:"could not create task",done:"✓ done",drop:"✗ drop",reopen:"↻ reopen",due:"due",via:"via",aria_done:"mark done",aria_drop:"discard task",aria_reopen:"reopen task"},global_tasks:{title:"Tasks (all projects)",subtitle:"Aggregated tasks from all registered projects.",empty:"No tasks.",due:"due",go_project:"Go to project"},routines:{title:"Heartbeats / Routines",subtitle:"Cron, every:Nm, once:ISO. Each routine fires an agent or a shell.",empty:"No routines. Create one above.",new:"new",new_btn:"New",delete_confirm:"Delete routine {name}?",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",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:"Text (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.",delete_success:"deleted."},agents:{title:"Agents",subtitle:"Defined in AGENTS.md + .apc/agents/<slug>.md.",subtitle_full:"Defined in AGENTS.md + .apc/agents/<slug>.md. Runtime memory lives under ~/.apx/projects/<id>/agents/<slug>/.",empty:"No agents. Add one with <code>apx agent add</code> or the button.",empty_text:"No agents. Add one with `apx agent add` or the button above.",new:"Agent",created:"Agent {slug} created.",slug_invalid:"slug must match /^[a-z][a-z0-9_-]*$/",hierarchy:"Hierarchy",list_view:"List",import:"Import",chat:"Chat",view:"View",orchestrator:"Orchestrator",new_title:"New agent",new_desc:"POST /projects/:pid/agents — writes .apc/agents/<slug>.md.",slug_label:"slug",slug_ph:"cody",role_label:"role (optional)",role_ph:"code refactor",model_label:"model (optional)",model_hint:"e.g. ollama:gemma2:9b, openai:gpt-4o-mini",lang_label:"language (optional)",desc_label:"description (optional)",desc_ph:"What does this agent do…",skills_label:"skills (comma)",skills_ph:"skill-a, skill-b",tools_label:"tools (comma)",tools_ph:"tool-a, tool-b",parent_label:"reports to (parent, optional)",parent_hint:"Sub-agent of an orchestrator.",none_parent:"— none —",master_label:"Orchestrator (master)",create_success:"Agent {slug} created.",create_error:"create failed",import_title:"Import from vault",import_desc:"Templates in ~/.apx/agents. Registered in this project (.apc/agents/<slug>.md).",import_empty:"No templates in the vault.",import_success:"Imported: {slug}",import_already:"already here",import_btn:"Import"},agent_detail:{not_found:"Agent not found.",chat_btn:"Chat with {slug}",reports_to:"↳ reports to",no_threads:"No threads.",no_activity:"No recorded activity.",threads_recent:"Recent threads",subagents:"Sub-agents",subagents_desc:"Agents that report to this orchestrator.",config_title:"Agent configuration",type_label:"Type",area_label:"Area",area_hint:"e.g. operations, marketing",area_ph:"operations",role_label:"Role",parent_label:"Reports to (parent)",none_parent:"— none —",model_label:"Base model",model_hint:"Empty = uses the Router model (default). Set only to force a model for this agent.",model_ph:"(empty = router default)",skills_label:"Skills (comma)",bio_label:"Bio / description",system_label:"System prompt",system_hint:"Defines personality and behavior (body of AGENT.md).",master_label:"Orchestrator (master)",delete_btn:"Delete agent",save_btn:"Save changes",delete_confirm:'Delete agent "{slug}"? Removes .apc/agents/{slug}.md and local runtime data.',update_success:"Agent updated.",delete_success:"Agent deleted.",tools_hint:"Which tools this agent can use. Tap to toggle; or edit the list below.",tools_custom_ph:"list (comma): echo, http_fetch",memory_title:"Agent memory",memory_empty:"(empty memory)",memory_saved:"Memory saved.",records_title:"Records",records_desc:"Agent activity log (messages/actions). Newest first.",sleep_title:"Sleep / Heartbeat",sleep_desc:"Agent execution status, derived from its routines.",sleep_deep:"Deep sleep · no heartbeat",sleep_deep_desc:"This agent has no routine that triggers it. It does not run autonomously; it only responds when invoked (chat / task).",brain_title:"Brain",brain_desc:"Real relationship graph of the agent: memory, threads, tasks, heartbeats and hierarchy. (first version — will be refined)",brain_empty:"No relationships to graph yet (no memory, threads, tasks or routines).",msgs_count:"msgs"},mcps:{title:"MCP servers",subtitle:"3 scopes: runtime > shared > global. Conflicts shown above if any.",empty:"No MCPs configured.",new:"MCP",delete_confirm:"Delete MCP {name} from scope {scope}?",conflicts:"⚠ Conflicts: {names}",new_title:"New MCP",new_desc:"POST /projects/:pid/mcps?scope=…",scope_label:"Scope",transport_label:"Transport",name_label:"Name",name_ph:"filesystem",cmd_label:"Command",cmd_ph:"npx",args_label:"Args",args_hint:"space-separated",args_ph:"-y @modelcontextprotocol/server-filesystem /tmp",env_label:"Env (JSON, optional)",url_label:"URL",url_ph:"https://example.com/mcp",enabled_label:"Enabled",add_btn:"Add",name_required:"name required",env_invalid:"env must be valid JSON",removed:"removed",added:"MCP added.",updated:"MCP updated.",edit_title:"Edit MCP",save_btn:"Save",add_arg:"Add arg",edit_btn:"Edit",test_btn:"Test",logs_btn:"Logs",testing:"Testing…",test_ok:"OK · {n} tools available",logs_title:"Logs · {name}",logs_empty:"No logs yet. Start the MCP by calling a tool or running Test.",logs_events:"Recent events",logs_stderr:"stderr (last 4KB)",logs_panel_title:"Live logs",logs_panel_pick:"pick an MCP",logs_panel_hint:"Click an MCP in the list to see what's happening live.",logs_panel_idle:"No activity. Hit Test to spin it up.",scope_runtime:"Runtime",scope_shared:"Shared",scope_global:"Global",scope_runtime_desc:"This project only · with secrets · not committed (~/.apx/projects/<id>/mcps.json)",scope_shared_desc:"This project only · committeable · no secrets (.apc/mcps.json)",scope_global_desc:"All projects on this machine (~/.apx/mcps.json)",transport_stdio:"stdio",transport_http:"HTTP",transport_stdio_desc:"Local process — `command` + args",transport_http_desc:"Remote endpoint — URL + headers",args_hint_tokens:"One entry per arg. Use the + button to insert a variable.",env_hint_tokens:"Key/value pairs. Values accept ${var.NAME} (+ button on the right).",env_empty:"No env vars.",headers_label:"Headers",headers_hint:"Key/value pairs — typically Authorization: Bearer ${var.TOKEN}.",headers_empty:"No headers."},vars:{title:"Variables",subtitle_project:"Replace ${var.NAME} when loading MCPs and templates. Project vars beat globals. Stored outside the repo (~/.apx/, chmod 0600).",subtitle_base:"Global variables — available to every project. Stored in ~/.apx/vars.json (chmod 0600).",empty:"No variables yet.",new:"Variable",new_title:"New variable",edit_title:"Edit variable",new_desc:"Referenced as ${var.NAME} in any field that supports interpolation.",reveal_all:"Show values",reveal:"Show",hide:"Hide",filter_label:"Show:",filter_all:"All",filter_project:"Project only",filter_global:"Globals only",scope_label:"Scope",scope_project:"project",scope_project_desc:"This project only. Beats the global with the same name.",scope_global:"global",scope_global_desc:"Available to every project.",name_label:"Name",name_hint:"Uppercase, digits and _. E.g. MY_API_KEY, GITHUB_TOKEN.",value_label:"Value",value_hint:"Stored on disk with 0600 perms. Never committed.",value_edit_ph:"(leave empty to keep current… not yet supported, paste the value again)",add_btn:"Add",save_btn:"Save",edit_btn:"Edit",delete_btn:"Delete",delete_confirm:"Delete {name} ({scope})?",removed:"Variable removed.",added:"Variable added.",updated:"Variable updated.",name_required:"Name required.",value_required:"Value required."},threads:{title:"Chats",subtitle:"Conversations per agent (empty = no logs persisted yet).",no_agents:"No agents. Conversations require a configured agent.",pick:"Pick an agent to view its conversations.",empty:"No conversations for {slug}.",conversation_title:"Conversation {id}",messages:"messages",via:"via"},config:{title:"Quick config",subtitle:"Project override. Written to {path}.",model:"super_agent.model",model_hint:"e.g. anthropic:claude-sonnet-4.5, ollama:gemma2:9b",perm:"super_agent.permission_mode",route:"route_to_agent",route_hint:"Slug of the agent that handles this project by default.",use_global:"(uses global)",saved:"Saved.",nothing:"Nothing to save.",raw_title:"Config (raw JSON)",raw_subtitle:"Paste the entire object — equivalent to PUT the file.",raw_save:"Replace config",raw_done:"Config overwritten.",effective:"Effective config (read-only)",effective_sub:"What the daemon actually sees (global ⊕ override).",section_title:"Project config",section_desc:"APC metadata and overrides separated. General APX lives in Settings > Config.",effective_read:"Read: global APX + project override.",save_project:".apc/project.json saved.",save_override:".apc/config.json saved.",save_fields_success:"Overrides saved.",save_meta_success:"Project metadata saved.",no_data:"No data."},telegram:{title:"Telegram channel (override)",subtitle:"If you set a channel here, messages from this project go there instead of the default.",use_default:"Use default channel",bot_token:"Bot token (override)",chat_id:"Chat ID (override)",saved:"Override saved.",cleared:"Override removed — falls back to default.",override_active:"override active",channel_badge:"Channel {name}",no_override:"No override. Messages from this project go to the default channel.",respond_engine:"Respond with engine",route_agent:"route_to_agent",route_hint:"Slug of the agent that handles messages (empty = super-agent).",bot_hint_none:"If empty, inherits from default."},memories:{project_title:"Project memory",project_desc:"Durable facts at the project level. .apc/memory.md — read by agents and the super-agent.",project_ph:`# Project Memory
601
-
602
- Stable facts that any agent should know…`,agents_title:"Agent memories",agents_desc:"Individual memory per agent. ~/.apx/projects/<id>/agents/<slug>/memory.md",no_agents:"No agents in this project.",saved:"Memory saved.",empty:"(empty memory)",chars:"chars · Markdown",save_btn:"Save"}},base:{title:"Base",subtitle:"General workspace · super-agent",nav_general:"General",nav_activity:"Activity",nav_system:"System",workspaces_title:"Workspaces",workspaces_desc:"All projects registered in APX.",workspaces_new:"New project",workspaces_empty:"No projects. Add one with the button above.",sessions_title:"Sessions",sessions_desc:"Sessions from all engines (apx · claude · codex), newest first.",sessions_all:"All engines",sessions_empty:"No sessions.",sessions_error:"Could not read sessions: {msg}",defaults_title:"Agent defaults",defaults_desc:"Global vault templates. Bundled ones come with APX and are always present; ones you create or edit go in ~/.apx/agents and override. Import them into a project from Agents › Import.",defaults_show_removed:"Show removed",defaults_new:"New",defaults_empty:"No templates in the vault.",defaults_hide:"Hide",defaults_restore:"Restore",defaults_edit:"Edit",defaults_remove:"Hide",defaults_delete:"Delete",defaults_tombstone_msg:`Hide the default "{slug}"? It's bundled — tombstoned and recoverable with Restore.`,defaults_delete_msg:'Delete the template "{slug}"?',defaults_hidden:"Hidden.",defaults_deleted:"Deleted.",defaults_restored:"Restored.",defaults_new_title:"New template",defaults_new_desc:"POST /agents/vault — saved to ~/.apx/agents/<slug>.md",defaults_edit_title:'Edit "{slug}"',defaults_bundled_desc:"This is a bundled default. Saving does a copy-on-write to ~/.apx/agents/<slug>.md (becomes an override).",defaults_user_desc:"PATCH /agents/vault/:slug — edits the file in ~/.apx/agents.",defaults_master_label:"Master agent",defaults_slug_invalid:"invalid slug (must match /^[a-z][a-z0-9_-]*$/)",defaults_created:'Template "{slug}" created.',defaults_saved:'Template "{slug}" saved.'},logs:{title:"Logs",desc_global:"Daemon activity (global channels: telegram, direct…). ~/.apx/messages/<channel>/.",desc_project:"Project activity. ~/.apx/projects/<id>/messages/.",filter_channel:"filter channel (e.g. telegram)",filter_dir:"direction",all_directions:"All directions",in:"Incoming (in)",out:"Outgoing (out)",filter_type:"type",all_types:"All types",search_text:"search text…",count_of:"of",no_activity:"No activity.",no_activity_ch:'No activity in channel "{ch}".',error:"Could not read messages: {msg}",show_more:"show more",show_less:"show less",daemon_errors:"Daemon errors (~/.apx/logs/errors.jsonl)",no_errors:"No errors recorded. 🎉"},telegram_contacts:{title:"Telegram contacts",desc:"Who writes to the bots. The role defines which tools they can use; a guest has no permissions until you assign a role.",empty:"No contacts yet — they register automatically when someone writes to a bot.",owner_badge:"owner",assign_role:"Assign role",owner_hint:"Channel owner — change it from the channel",removed:"Contact deleted.",delete_confirm:"Delete contact {name}?",last_seen:"seen:",tools_all:"tools: all",tools_none:"tools: none",tools_label:"tools:"},telegram_channels:{title:"Channels",desc:"Each channel is a bot the daemon polls. Here you can add/remove channels, change the answering agent, the project it belongs to and its owner.",new_btn:"New channel",empty:"No channels yet — add the first one.",removed:"Channel deleted.",delete_confirm:"Delete channel {name}?",no_owner:"no owner (claimed on first DM)",owner_label:"owner:"},telegram_channel_dialog:{new_title:"New Telegram channel",edit_title:"Edit channel: {name}",name_label:"name (internal slug)",token_label:"bot_token",chat_id:"chat_id",project_label:"project",project_hint:"Slug or id of the project to pin this channel to (optional).",route_label:"route_to_agent",route_hint:"Answering agent; empty = APX super-agent.",owner_label:"owner_user_id",owner_hint:"Telegram user_id of the channel owner. Overrides global role to 'owner' here. Leave empty — first private message claims it.",owner_ph:"889721252",respond_label:"Respond with engine (not echo)",name_required:"name required",saved:"Channel saved."},telegram_send_dialog:{title:"Send to {name}",default_msg:"Test message from APX panel ✅"},telegram_roles:{title:"Roles",desc:"Each role defines which super-agent tools the assigned user can invoke. 'owner' always = all; 'guest' always = none (chat only).",empty:"No roles defined.",tools_all:"all tools",tools_none:"no tools",builtin:"built-in",delete_confirm:'Delete role "{name}"?',removed:"Role deleted.",saved:'Role "{name}" saved.',name_required:"Name required.",builtin_error:'"{name}" is a built-in role.',new_title:"New role or replace a custom one",name_label:"Name",name_ph:"editor",tools_label:"Tools (comma-separated)",tools_hint:"Empty = none. Examples: call_agent, list_tasks, create_task.",tools_ph:"call_agent, list_tasks",full_access:"Full access (all tools)",save_btn:"Save role",delete_btn:"Delete"},superagent:{title:"{persona}",badge:"super-agent · APX",desc:"Quick chat with your super-agent. Has access to tools (projects, tasks, mcps, agents); for a longer persistent thread, open Chats.",empty:"Send {persona} a message to get started.",thinking:"{persona} is thinking…",talk:"Talk to {persona}",new_chat:"New chat",placeholder:"Type and press enter to send (shift+enter = new line)…"},not_found:{title:"404",message:"Roby got lost: this page doesn't exist or has moved.",home:"Back to home"},ask_panel:{answers_header:"Answers",other:"Other",other_placeholder:"Write your own answer here",text_placeholder:"Type your answer…",back:"Back",skip:"Skip",next:"Next",submit:"Send",status_waiting:"Waiting for your answer…",status_received:"Answers received"},code_module:{title:"Code",badge:"super-agent",desc:"OpenCode-style coding sessions. Pick a project, open a session, and ask it to read, plan, edit or run.",no_projects:"No registered projects. Register one with `apx project add` to use Code.",sessions:"Sessions",new_session:"New session",untitled:"New session",no_sessions:"No sessions yet — create one to start coding.",pick_project:"Pick a project to see its sessions.",rename:"Rename",delete:"Delete",delete_confirm:"Delete this session? The transcript is removed; your files are untouched.",empty_chat:"Send a coding instruction to get started.",placeholder:"Ask for a change… (enter sends, shift+enter = new line)",mode_build:"Build",mode_plan:"Plan",mode_build_hint:"Build — edits files and runs commands",mode_plan_hint:"Plan — read-only, proposes changes without touching files",tab_context:"Context",tab_changes:"Changes",tab_artifacts:"Artifacts",artifacts_none:"No artifacts yet. Ask the agent to create a script under `artifacts/<name>`.",artifacts_count:"{n} artifact(s)",artifacts_copy_path:"Copy path",artifacts_run:"Run",artifacts_run_hint:"Run it from your terminal:",artifacts_delete:"Delete",artifacts_delete_confirm:"Delete this artifact? The file will be removed from disk.",ctx_model:"Model",ctx_tokens:"Tokens",ctx_input:"Input",ctx_output:"Output",ctx_messages:"Messages",ctx_breakdown:"Context breakdown",ctx_none:"No usage yet — send a turn to see tokens.",seg_system:"System",seg_user:"User",seg_assistant:"Assistant",seg_tool:"Tools",seg_other:"Other",changes_none:"No changes in this session yet.",changes_no_git:"Changes need a git repository. This project isn't one.",changes_files:"{n} file(s) changed",stopped:"[stopped]",close:"Close",reload:"Reload",discard_changes:"Discard changes",save_shortcut_hint:"Save (Cmd/Ctrl+S)",artifacts_rename:"Rename",artifacts_view:"View contents",artifacts_edit:"Edit contents",tree_collapse_all:"Collapse all",terminal_clear:"Clear",terminal_close:"Close terminal"},desktop_screen:{status_title:"Status",autostart_title:"Auto-start",shortcut_title:"Keyboard shortcut",appearance_title:"Appearance",activation_title:"Activation + transcription",last_conv_title:"Last conversation"},voice_screen:{providers_title:"Voice providers (TTS)",test_title:"Test voice",stt_title:"Transcription (STT)",configure_provider:"Configure {name}"},deck_screen:{widgets_title:"Widgets",context_title:"APX context",reload_manifest:"Reload manifest",widget_native:"Native APX widget",widget_external:"External widget"},memory_panel:{embeddings_title:"Embeddings (RAG)",embeddings_desc:"Model that vectorizes the history of all channels for relevant memory. Just like TTS/STT: pick a provider and model. 'Automatic' tries local first and falls back to offline if nothing is available.",provider_label:"Provider",provider_hint:"Ollama is local and free. Gemini/OpenAI use the API key from their section in Models (or the one below).",mode_label:"Selection mode",mode_hint:"Chain falls back to the next if one fails; Single uses exactly the chosen provider.",available:"available",unavailable:"unavail.",test_btn:"Test embedding",reindex_btn:"Reindex memory",test_ok:"Embedding OK with {embedder}",test_failed:"Test failed: {msg}",reindexed:"Reindexed: {indexed} chunks (cleared {cleared}).",reindex_failed:"Reindex failed: {msg}",save_failed:"Could not save: {msg}",provider_auto:"Automatic (chain: Ollama → Gemini → OpenAI → offline)",provider_ollama:"Ollama — local, no API key (nomic-embed-text)",provider_gemini:"Gemini — free tier with key (text-embedding-004)",provider_openai:"OpenAI — text-embedding-3-small (cloud)",provider_tf:"Offline (term-frequency, no model — degraded)",mode_chain:"Chain (automatic fallback)",mode_single:"Single (uses only the chosen one)",ollama_title:"Ollama (local)",ollama_desc:"No API key. Runs nomic-embed-text on your local or cloud Ollama.",model_label:"Model",base_url_label:"Base URL",ollama_base_url_hint:"Empty uses engines.ollama.base_url (default http://localhost:11434).",openai_title:"OpenAI",openai_desc:"text-embedding-3-small (1536 dims) or another compatible model.",api_key_label:"API key",openai_key_hint:"Empty reuses engines.openai.api_key. Leave it blank to keep the saved one.",gemini_title:"Gemini",gemini_desc:"text-embedding-004 (768 dims). Free tier with a Google API key.",gemini_key_hint:"Empty reuses engines.gemini.api_key.",compaction_title:"History compaction",compaction_desc:"When a chat exceeds the turn threshold, the oldest turns are summarized with a lightweight (local) LLM and saved as [COMPACTED SUMMARY], keeping context bounded. Runs off the hot-path: the current turn uses whatever summary already exists.",threshold_label:"Compaction threshold",threshold_hint:"Compact once the chat exceeds these turns (default 60).",keep_recent_label:"Recent turns to preserve",keep_recent_hint:"Verbatim turns that are NEVER compacted (default 40). Must be lower than the threshold.",compact_model_label:"Compaction model",compact_model_hint:"Lightweight LLM for summarizing. Ideally a local one (Ollama) to avoid cost. Format provider:model.",compact_fallback_label:"Fallback model",compact_fallback_hint:"Used if the compaction one fails. Empty falls back to the super-agent model.",compact_fallback_ph:"(empty → super-agent model)"},router_panel:{title:"Model router",description:"A single general router (no per-task cases). Pick a provider and model; if the active one fails, it tries the fallback chain in order.",badge_default:"default",no_providers:"Add a provider below to be able to pick models.",active_model_label:"Active model (default)",active_model_hint:"Provider + model. Saved as provider:model.",fallback_title:"Fallback chain",fallback_desc:"If the active model fails, it tries these in order. Click one to edit it.",fallback_empty:"No fallback configured.",add_to_chain:"Add to the chain",done:"done",save:"Save router",saved:"Saved",saved_toast:"Router saved.",provider_ph:"— provider —",provider_not_found:"⚠ {name} (not found)",provider_not_configured:'The provider "{name}" is not configured.'},engines_panel:{title:"Providers",new_btn:"New provider",description:"LLM providers (API). Each provider uses an engine/adapter (openai, ollama, …) with its key and URL.",empty:"No providers. Add one with the button above.",add_card:"Add provider",saved:"Provider saved.",saved_json:"Provider saved (JSON).",deleted:"Provider deleted.",delete_confirm:"Delete provider {name}?"},providers_modal:{new_title:"New provider",edit_title:"Edit {name}",description:"LLM provider. The engine defines which adapter it uses (openai, ollama, …).",list_models_hint:"List the provider's actual models",toggle_active:"Active · click to deactivate",toggle_inactive:"Inactive · click to activate",delete:"Delete",custom:"Custom",json_mode:"JSON",form_mode:"Back to form",json_label:"Provider config (JSON)",json_hint:"Saved as engines.{slug} in config.json",json_help:"Must be a valid JSON object with at least engine. The slug is taken from the form.",name_label:"Name",name_ph:"My provider",engine_label:"Engine",base_url_label:"Base URL (base_url)",base_url_hint:"Auto-filled when you pick a provider.",base_url_ph:"https://api.openai.com/v1",api_key_label:"API key",api_key_hint_existing:"Leave blank to keep the current one.",api_key_hint_env:"Stored as a secret. Suggested env: {env}",api_key_hint:"Stored as a secret.",api_key_set:"…{suffix} (already set)",model_label:"Default model",load_models:"Load models",max_tokens_label:"Max tokens (max_tokens)",temperature_label:"Temperature: {value}",pricing_summary:"Token analysis / pricing (optional)",context_limit_label:"Context limit (tokens)",price_input:"$ input / 1M",price_output:"$ output / 1M",price_cache_read:"$ cache read / 1M",price_cache_write:"$ cache write / 1M",model_limits_label:"Per-model context limits (JSON)",active_label:"Active (agents can use it)",err_slug_required:"Slug required.",err_slug_required_form:"Slug required (in the form).",err_slug_exists:'A provider "{slug}" already exists.',err_model_limits_json:"Per-model context limits: invalid JSON.",err_json_invalid:"Invalid JSON: check the syntax.",err_json_object:"The JSON must be an object with the provider config.",err_engine_missing:'Missing "engine" (e.g. "anthropic", "ollama").',err_save:"Error saving.",err_no_models:"No models. Correct key/URL?",err_list_models:"Could not list models."},providers_card:{active:"Active",off:"Off",model:"Model",base_url:"Base URL",api_key:"API key",key_set:"✓ set",temp:"Temp",price_io:"$ in/out (1M)"},chat_ui:{copy:"Copy",stop:"Stop",send:"Send",pick_model:"Pick model (or Auto)",insert_variable:"Insert variable"},sidebar_ui:{toggle:"Toggle sidebar"},models_ui:{invalid_hint:"Model/provider unavailable"},global_config:{title:"APX config"},agent_detail_extra:{skills_title:"Skills & tools"},voice_ui:{api_key_label:"API key",api_key_set:"…{suffix} (already set)",api_key_keep_hint:"Leave blank to keep the current one.",api_key_secret_hint:"Stored as a secret. Env: {env}",api_key_reuse_hint:"Reuses {engine} if left blank. Env: {env}",err_save:"Error while saving.",model_label:"Model",voice_label:"Voice",format_label:"Format",output_format_label:"Output format",voice_id_label:"Voice ID",voice_id_hint:"ElevenLabs voice id (empty = default).",gemini_model_hint:"Gemini TTS is still in preview.",style_label:"Style (how it should speak)",style_hint:"Natural-language instruction. Empty = no style. E.g.: 'speak in a cheerful, unhurried tone'.",style_ph:"speak in a cheerful, energetic tone",piper_bin_label:"Binary (bin)",piper_bin_hint:"Path or name of the piper CLI (PATH).",piper_model_label:"Model (.onnx)",piper_model_hint:"Absolute path to the piper voice model.",piper_speaker_label:"Speaker (optional)",piper_speaker_hint:"Speaker id for multi-voice models.",mock_desc:"The mock engine generates a silent test WAV. It has no parameters: it serves as a guaranteed fallback when no other engine is configured.",selection_mode:"Selection mode",mode_chain_desc:"Chain with fallback: uses the first available engine following the order below.",mode_single_desc:"Default engine only: always uses the chosen one; the rest stay configured for other purposes.",mode_chain_btn:"Chain (router)",mode_single_btn:"Default engine only",move_up:"Move up",move_down:"Move down",badge_local:"local",badge_available:"available",badge_unavailable:"configured, unavailable",badge_not_configured:"not configured",badge_default:"default",set_as_default:"Set as default",configure:"Configure",stt_engine_label:"Transcription engine",stt_engine_hint:"Local uses faster-whisper (requires python3 + faster-whisper). OpenAI uses the engines.openai key.",stt_model_label:"Local model (whisper)",stt_model_hint:"Bigger = more accurate and slower.",stt_language_label:"Language",stt_language_hint:'For Spanish, setting "Spanish" improves accuracy.',stt_provider_auto:"Automatic (local, then OpenAI)",stt_provider_local:"Local — faster-whisper (offline)",stt_provider_openai:"OpenAI — Whisper-1 (cloud)",lang_auto:"Auto-detect",lang_es:"Spanish",lang_en:"English",lang_pt:"Portuguese",lang_fr:"French",lang_it:"Italian",lang_de:"German",test_default_text:"Hi, I'm APX. This is a voice test.",test_default_engine:"Default ({name})",test_default_chain:"Default (chain)",test_unavailable_suffix:" · unavailable",test_empty_error:"Type something to say.",test_synth_error:"Could not synthesize.",test_engine_label:"Engine",test_engine_hint:"Override the default for testing.",test_style_label:"Style (Gemini only)",test_style_hint:"How it should speak. Empty = no style.",test_text_label:"Text to say",test_text_ph:"Type what you want it to say…",say_this:"Say this",stop:"Stop",replay:"Replay",engine_result:"Engine",providers_desc:"Synthesis engines. Status is reported live by the daemon. Pick which one to use by default.",providers_load_error:"Could not load providers: {msg}",test_desc:"Pick which engine to synthesize with and, if applicable, how it should speak.",stt_desc:"Speech-to-text engine used by the deck, Telegram, and the CLI when listening.",toast_default_engine:"Default engine: {id}.",toast_mode_chain:"Mode: chain with fallback.",toast_mode_single:"Mode: default engine only.",toast_config_saved:"Voice configuration saved.",toast_transcription_updated:"Transcription updated."},telegram_ui:{channel_dialog_desc:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (partial).",bot_token_hint:"BotFather token. Stored in ~/.apx/config.json.",bot_token_hint_short:"BotFather token.",secret_set_replace:"(set — type to replace)",secret_already_set:"(already set)",empty_keep:"— empty = keep",message_sent:"Message sent.",message_label:"Text",send_chat_id:"chat_id: {id}",default_apx:"default APX",yes:"yes",no:"no",user_id_fallback:"user_id {id}",role_assigned:"{name} → {role}"},agents_ui:{model_router_default:"model: router default",slug_kebab_hint:"kebab-case, e.g. reviewer, my-agent, content-writer",comma_separated:"comma-separated",body_hint:"markdown — extends the agent's system prompt",source_user:"user",source_override:"override",source_bundled:"bundled",tab_explorer:"Explorer",type_none:"— no type —",type_orchestrator:"Orchestrator",type_orchestrator_desc:"Coordinates the team and delegates.",type_specialist:"Specialist",type_specialist_desc:"Domain expert; runs tasks.",type_assistant:"Assistant",type_assistant_desc:"Conversational helper.",type_worker:"Worker",type_worker_desc:"Runs autonomous tasks.",type_monitor:"Monitor",type_monitor_desc:"Watches state and reports.",stat_threads:"Threads",stat_records:"Records",stat_tasks:"Tasks",stat_heartbeats:"Heartbeats",config_def_desc:"definition (frontmatter + system prompt).",memory_durable_desc:"durable facts the agent remembers.",running:"running",paused:"paused",last_error:"last: error",field_tick:"Tick",field_next_tick:"Next tick",field_last_tick:"Last tick",field_last_run:"Last run",tools_label:"Tools",kind_agent:"agent",kind_memory:"memory",kind_thread:"thread",kind_task:"task",kind_routine:"routine",kind_hierarchy:"hierarchy",nodes_drag_hint:"{n} nodes · drag to rearrange",kind_exec_agent:"Project agent",kind_exec_agent_desc:"Runs a project agent with a prompt. You pick which one.",kind_super_agent:"Super-agent",kind_super_agent_desc:"Calls the APX super-agent with a prompt.",kind_telegram:"Telegram",kind_telegram_desc:"Sends a fixed message to a Telegram channel. No model or agent.",kind_shell:"Shell",kind_shell_desc:"Runs a shell command. No prompt or pre/post — the command is the action.",kind_heartbeat:"Heartbeat",kind_heartbeat_desc:"Does nothing except write a line to the logs each time it runs. Useful to confirm the scheduler is alive. If you don't know whether you need it, don't use it.",unit_seconds:"seconds",unit_minutes:"minutes",unit_hours:"hours",unit_days:"days",every_n_unit:"every {n} {unit}",every_v:"every {v}",preset_every_10m:"every 10 min",preset_hourly:"hourly",preset_daily_9am:"daily 9am",preset_weekdays_9am:"weekdays 9am",preset_manual:"Manual",var_pre_output_prompt:"Output of the pre-commands, injected into the prompt.",var_llm_output:"Response from the agent / super-agent.",var_status:"ok | error.",var_skipped:"1 if the action was skipped.",var_pre_output:"Output of the pre-commands.",var_pre_output_file:"File with the pre output (for large outputs).",var_pre_exit:"Exit code of the pre-commands.",var_routine:"Name of the routine.",summary_runs_agent:'Runs the agent "{agent}"',summary_runs_agent_none:"Runs an agent (none chosen yet)",summary_super_agent:"Calls the super-agent",summary_telegram:'Sends Telegram to "{channel}"',summary_runs_cmd:"Runs: {cmd}",summary_shell:"Runs a shell command",summary_heartbeat:"Leaves a heartbeat in the logs",action_agent_answers:'Agent "{agent}" answers the prompt',action_agent_pick_answers:"Agent (pick one) answers the prompt",action_super_answers:"The super-agent answers the prompt",action_telegram_channel:'Sends Telegram to channel "{channel}"',action_runs_shell:"Runs the shell command",step_pre:"Pre",step_post:"Post",last_label:"last:",tg_chat_id_ph:"(uses the channel's)",tg_text_ph:"message to send",hb_message_ph:"still alive",arg_placeholder:"--flag or value",remove_arg:"remove arg",super_agent_label:"{persona} (super-agent)",super_agent_badge:"super-agent"},modules_ui:{desktop_pos_left:"Left",desktop_pos_center:"Center",desktop_pos_right:"Right",desktop_theme_light:"Light",desktop_theme_dark:"Dark",desktop_status_desc:"The window launches from the terminal or via autostart.",desktop_running:"Running",desktop_stopped:"Stopped",desktop_refresh:"refresh",desktop_from_terminal:"From terminal:",desktop_autostart_desc:"Launches the window at user login. Equivalent to `apx desktop install` (no sudo required).",desktop_platform:"platform: {platform}",desktop_shortcut_desc:"Global hotkey that shows/hides the window and starts listening.",desktop_accelerator:"Accelerator",desktop_accelerator_hint:'Electron format, e.g. "CommandOrControl+G" or "CommandOrControl+Shift+Space". Restart the window to apply.',desktop_shortcut_saved:"Shortcut saved. Restart the window (apx desktop stop && start) to apply it.",desktop_autostart_on:"Autostart enabled for the next login.",desktop_autostart_off:"Autostart disabled.",desktop_appearance_desc:"Window theme and position on the screen.",desktop_theme:"Theme",desktop_restart_apply:"Restart the window to apply.",desktop_theme_set:"Theme: {value}.",desktop_position:"Position",desktop_position_hint:'"left" / "center" / "right" of the top edge.',desktop_position_set:"Position: {value}.",desktop_activation_desc:"The daemon plugin processes the messages. STT is configured in Voices.",desktop_enabled_toast:"Desktop enabled.",desktop_disabled_toast:"Desktop disabled.",desktop_plugin_on:"Plugin enabled (replies to messages)",desktop_plugin_off:"Plugin disabled",desktop_stt_engine:"Speech-to-text engine:",desktop_stt_engine_suffix:"(local whisper, language, model).",desktop_last_conv_desc:"The latest exchange with the agent from the floating window.",desktop_no_messages:"No messages yet. Send something to the desktop window for it to appear here.",desktop_you:"You",desktop_roby:"Roby",desktop_empty_msg:"(empty)",deck_widget_enabled:"Widget {id} enabled.",deck_widget_disabled:"Widget {id} disabled.",deck_save_error:"Error while saving",deck_loading_manifest:"Loading manifest…",deck_manifest_error:"Error loading the manifest.",deck_widgets_summary:"{count} widgets · {enabled} external enabled",deck_loading_manifest_full:"Loading the Deck manifest…",deck_manifest_load_failed:"Could not load the Deck manifest.",deck_retry:"Retry",deck_no_widgets:"No widgets in the manifest.",deck_context_desc:"Information the Deck sees from the daemon.",deck_active_project:"Active project:",deck_none:"none",deck_registered_projects:"Registered projects:",deck_active_plugins:"Active plugins:",deck_daemon_active:"active · {uptime}",deck_daemon_started:"started",deck_safety_no_shell:"no direct shell",deck_safety_no_arbitrary:"arbitrary commands blocked",deck_safety_confirm:"dangerous actions require confirmation",code_copied:"Copied.",code_saved:"Saved.",code_file_empty:"(empty)",code_file_error:"Error: {msg}",code_stream_error:"error",code_super_agent:"super-agent",code_super_agent_desc:"Main agent with all tools",code_chat_tab:"Chat",code_panel_sessions:"Session list",code_panel_tree:"File tree",code_panel_terminal:"Terminal",code_panel_context:"Context panel",code_ctx_auto:"auto",code_ctx_mode:"Mode",code_ctx_agent:"Agent",code_ctx_msgs_value:"{user} user · {assistant} assistant",code_ctx_tokens_total:"Total Tokens",code_ctx_created:"Created",code_ctx_activity:"Activity",code_project_fallback:"project {id}",code_pick_project_ph:"Pick a project…",code_artifact_exit_ok:"exit 0 — {ms}ms",code_artifact_exit_fail:"exit {code}{timeout}",code_artifact_timeout_suffix:" (timeout)",code_artifact_view_short:"View",code_artifact_edit_short:"Edit",code_artifact_exit_badge:"exit {code}",code_artifact_timeout:"timeout",code_artifact_truncated:"truncated"},settings_ui:{bearer_label:"Bearer",global_config_desc:"General config in ~/.apx/config.json. Editable by tabs; JSON stays separate.",global_json_desc:"Redacted secrets are not overwritten.",save_json:"Save JSON",expand_menu:"Expand menu",collapse_menu:"Collapse menu",documentation:"Documentation",kind_personal:"Personal",kind_company:"Company",kind_app:"App",kind_software:"Software",kind_default:"Default",kind_other:"Other",base_menu_view:"Base menu view (general workspace).",coming_soon:"Coming soon",inspector_title:"Skill Inspector (per-turn RAG)",inspector_desc:"Experimental feature. When active, the agent does NOT receive the full skill list in its prompt; on each message a local RAG decides which skill(s) to load — the full body on a strong match, a suggestion on a medium match, nothing if it doesn't apply. It is re-evaluated every turn: a skill that stopped being relevant disappears from the context.",enable_inspector:"Enable inspector",enable_inspector_hint:"Off = classic behavior (slug list + passive suggestion). On = the RAG decides per turn.",on:"On",off:"Off",index_count:"Index: {n} skills",not_indexed:"not indexed",dim:"dim {dim}",updated_at:"updated {date}",reindex:"Reindex",reindex_forced:"Reindex (forced)",embedder_source:"The embedder comes from Memory (RAG). Local with Ollama, or offline if no provider is set.",thresholds_title:"Thresholds and limits",thresholds_desc:"Tune how aggressive the inspector is. Raising the thresholds = fewer false positives but more risk of missing a skill; lowering them = the opposite.",test_title:"Test (dry-run)",test_desc:"Type a message the way a user would and see which skills the inspector would load/suggest — without calling the model. Forces the inspector on even if it's off above.",test_placeholder:"e.g.: I need to create a promo video with voiceover",test_btn:"Test",jit_empty_index:"JIT (empty index)",loaded_label:"Loaded:",suggested_label:"Suggested:",could_not_save:"Could not save: {msg}",indexed_with:"Indexed with {embedder} (dim {dim}): +{added} ~{refreshed} -{removed}.",index_failed:"Index failed: {msg}",dry_run_failed:"Dry-run failed: {msg}",knob_load_threshold:"Load threshold",knob_load_threshold_hint:"Minimum similarity to inject the skill's BODY (high = stricter).",knob_hint_threshold:"Hint threshold",knob_hint_threshold_hint:"Minimum similarity to only SUGGEST the skill (so the agent loads it if it wants).",knob_margin:"Margin over the 2nd",knob_margin_hint:"The top must beat the second by this margin to load its body (avoids weak ties).",knob_max_loaded:"Max. loaded bodies",knob_max_loaded_hint:"How many skills are injected in full per turn.",knob_max_hints:"Max. hints",knob_max_hints_hint:"How many extra skills are named as a suggestion.",knob_prompt_floor:"Minimum prompt length",knob_prompt_floor_hint:"Messages shorter than this are ignored (avoids 'ok', 'hi').",knob_body_char_cap:"Body char cap",knob_body_char_cap_hint:"Trims long skill bodies so they don't bloat the context.",cfg_overrides_label:"Overrides",cfg_overrides_desc:".apc/config.json. Only project-specific values; empty inherits global/effective.",cfg_route_to_agent:"Route to agent",cfg_super_agent_model:"Super-agent model",cfg_permission_mode:"Permission mode",cfg_extra_prompt:"Extra prompt",cfg_telegram_label:"Telegram",cfg_chat_id:"Chat ID",cfg_bot_token:"Bot token",cfg_respond_with_engine:"Respond with engine",cfg_engines_label:"Engines",cfg_ollama_url:"Ollama URL",cfg_anthropic_key:"Anthropic API key",cfg_openai_key:"OpenAI API key",cfg_groq_key:"Groq API key",cfg_openrouter_key:"OpenRouter API key",cfg_gemini_key:"Gemini API key",cfg_project_label:"Project",cfg_project_desc:".apc/project.json. Portable APC metadata; no secrets, no runtime.",cfg_name:"Name",cfg_version:"Version",cfg_apc_spec:"APC spec",cfg_apx_install:"APX install state",cfg_apx_storage_id:"APX storage id"},shared_ui:{skill_inspector_title:"Skill Inspector ({embedder}) chose these skills for this turn",tools_count:"{n} tools",tool_read_file:"Read file",tool_write_file:"Write file",tool_edit_file:"Edit file",tool_list_files:"List files",tool_search_files:"Search in files",tool_search_messages:"Search messages",tool_tail_messages:"Latest messages",tool_run_shell:"Run shell",tool_send_telegram:"Send Telegram",tool_call_agent:"Call agent",tool_call_mcp:"Call MCP",tool_call_runtime:"Call runtime",tool_create_task:"Create task",dedup:"dedup",args:"args",result:"result",auto:"Auto",auto_router:"Auto (router decides)",model_filter_ph:"filter or type a model…",loading_models:"loading models…",use_value:"use “{value}”",model_combobox_ph:"pick or type a model…",search_variable_ph:"search variable…",no_matches:"no matches",create_variable:"Create new variable…",kv_key_ph:"KEY",kv_value_ph:"value",remove_row:"remove row",add_row:"Add row",err_chat_failed:"Chat failed.",err_stream_failed:"Stream failed.",err_load_conversation:"Could not load conversation.",err_stream:"Stream error."}},sb={es:kO,en:SO};function CO(){try{const e=localStorage.getItem(Rn.language);if(e&&e in sb)return e}catch{}return"en"}let Nf=CO();function EO(e){Nf=e;try{localStorage.setItem(Rn.language,e)}catch{}}const NO=[{value:"es",label:"Español"},{value:"en",label:"English"}];function RO(){return Nf}function TO(e){const n=sb[Nf],s=e.split(".");let o=n;for(const l of s)if(o&&typeof o=="object"&&l in o)o=o[l];else return;return typeof o=="string"?o:void 0}function AO(e,n){return n?e.replace(/\{(\w+)\}/g,(s,o)=>o in n?String(n[o]):`{${o}}`):e}function MO(e){const n=TO(e);if(n!==void 0)return n;if(Nf!=="es"){const s=sb.es,o=e.split(".");let l=s;for(const c of o)if(l&&typeof l=="object"&&c in l)l=l[c];else return;return typeof l=="string"?l:void 0}}function f(e,n){const s=MO(e);return s===void 0?e:AO(s,n)}function rb(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/identity",()=>I1.get());return{identity:e||{},error:n,isLoading:s,mutate:o,save:async c=>{const d=await I1.patch(c);return await o(d,{revalidate:!1}),d}}}function ob(){const{identity:e}=rb();return e?.agent_name?.trim()||"APX"}function OO(){return[{id:"voice",label:f("nav.modules.voice"),href:"/m/voice",icon:Ww},{id:"desktop",label:f("nav.modules.desktop"),href:"/m/desktop",icon:Jw},{id:"deck",label:f("nav.modules.deck"),href:"/m/deck",icon:lA},{id:"code",label:f("nav.modules.code"),href:"/m/code",icon:Er}]}function zO({onSelect:e,onOpenRoby:n}){const{projects:s,isLoading:o}=Oc(),l=Yn(),c=OO(),d=ob(),p=h=>l.pathname===h||l.pathname.startsWith(`${h}/`),m=s.find(h=>String(h.id)==="0"),g=s.filter(h=>String(h.id)!=="0");return r.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-y-auto bg-transparent py-3",children:[r.jsx(Tt,{content:f("nav.apx_admin"),side:"right",children:r.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:r.jsx(RA,{size:36})})}),o&&r.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),m&&r.jsx(Pi,{label:f("base.title"),testId:"project-avatar-0",title:f("base.subtitle"),active:p("/p/0"),isDefault:!0,icon:r.jsx("img",{src:"/modules/superagent.png",alt:f("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),c.map(h=>r.jsx(Pi,{label:h.label,testId:`module-avatar-${h.id}`,title:h.label,active:p(h.href),icon:r.jsx(h.icon,{size:18}),onClick:()=>e(h.href)},h.id)),g.length>0&&r.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),g.map(h=>{const _=h.name||h.path.split("/").pop()||String(h.id),v=`/p/${h.id}`;return r.jsx(Pi,{label:_,testId:`project-avatar-${h.id}`,title:`${_} — ${h.path}`,active:p(v),onClick:()=>e(v)},h.id)}),r.jsx(Pi,{label:f("nav.add_project"),isAdd:!0,testId:"nav-add-project",icon:r.jsx(nn,{size:18}),active:!1,onClick:()=>e("/?action=add-project"),title:f("nav.add_project")}),r.jsx("div",{className:"flex-1"}),r.jsx(Pi,{label:f("nav.settings"),isSettings:!0,testId:"nav-settings",icon:r.jsx(Dd,{size:16}),active:l.pathname==="/settings"||l.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:f("nav.settings")}),r.jsx(Tt,{content:f("settings_ui.documentation"),side:"right",children:r.jsx("a",{href:"https://agentprojectcontext.github.io/apx/docs/",target:"_blank",rel:"noopener noreferrer","data-testid":"nav-docs","aria-label":f("settings_ui.documentation"),className:"mt-1 flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(OT,{size:18})})}),r.jsx(Tt,{content:f("superagent.talk",{persona:d}),side:"right",children:r.jsx("button",{type:"button",onClick:n,"data-testid":"nav-roby","aria-label":f("superagent.talk",{persona:d}),className:"mt-1 flex size-10 items-center justify-center rounded-xl border border-border/60 bg-muted/30 text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(gn,{size:18})})})]})}function GS(e){switch(e){case"personal":return f("settings_ui.kind_personal");case"company":return f("settings_ui.kind_company");case"app":return f("settings_ui.kind_app");case"software":return f("settings_ui.kind_software");case"default":return f("settings_ui.kind_default");case"other":return f("settings_ui.kind_other");default:return f("nav.project")}}function Ge({title:e,description:n,action:s,className:o,children:l}){return r.jsxs("section",{className:Oe("rounded-xl border border-border bg-card p-5",o),children:[r.jsxs("header",{className:"mb-4 flex items-start justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),n&&r.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:n})]}),s]}),r.jsx("div",{children:l})]})}function U1({children:e}){return r.jsx("kbd",{className:"rounded border border-border bg-muted px-1.5 py-0.5 font-mono text-[10px] uppercase tracking-wide text-muted-fg",children:e})}function Rf({ok:e}){return r.jsx("span",{className:Oe("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const FS=x.createContext(void 0);function YS(e=!1){const n=x.useContext(FS);if(n===void 0&&!e)throw new Error(Mn(16));return n}function DO(e){const{focusableWhenDisabled:n,disabled:s,composite:o=!1,tabIndex:l=0,isNativeButton:c}=e,d=o&&n!==!1,p=o&&n===!1;return{props:x.useMemo(()=>{const g={onKeyDown(h){s&&n&&h.key!=="Tab"&&h.preventDefault()}};return o||(g.tabIndex=l,!c&&s&&(g.tabIndex=n?l:-1)),(c&&(n||d)||!c&&s)&&(g["aria-disabled"]=s),c&&(!n||p)&&(g.disabled=s),g},[o,s,n,d,p,c,l])}}function Ul(e={}){const{disabled:n=!1,focusableWhenDisabled:s,tabIndex:o=0,native:l=!0,composite:c}=e,d=x.useRef(null),p=YS(!0),m=c??p!==void 0,{props:g}=DO({focusableWhenDisabled:s,disabled:n,composite:m,tabIndex:o,isNativeButton:l}),h=x.useCallback(()=>{const k=d.current;Eg(k)&&m&&n&&g.disabled===void 0&&k.disabled&&(k.disabled=!1)},[n,g.disabled,m]);Me(h,[h]);const _=x.useCallback((k={})=>{const{onClick:S,onMouseDown:j,onKeyUp:w,onKeyDown:C,onPointerDown:E,...N}=k;return Da({onClick(R){if(n){R.preventDefault();return}S?.(R)},onMouseDown(R){n||j?.(R)},onKeyDown(R){if(n||(qd(R),C?.(R),R.baseUIHandlerPrevented))return;const T=R.target===R.currentTarget,O=R.currentTarget,A=Eg(O),z=!l&&LO(O),B=T&&(l?A:!z),L=R.key==="Enter",D=R.key===" ",P=O.getAttribute("role"),H=P?.startsWith("menuitem")||P==="option"||P==="gridcell";if(T&&m&&D){if(R.defaultPrevented&&H)return;R.preventDefault(),z||l&&A?(O.click(),R.preventBaseUIHandler()):B&&(S?.(R),R.preventBaseUIHandler());return}B&&(!l&&(D||L)&&R.preventDefault(),!l&&L&&S?.(R))},onKeyUp(R){if(!n){if(qd(R),w?.(R),R.target===R.currentTarget&&l&&m&&Eg(R.currentTarget)&&R.key===" "){R.preventDefault();return}R.baseUIHandlerPrevented||R.target===R.currentTarget&&!l&&!m&&R.key===" "&&S?.(R)}},onPointerDown(R){if(n){R.preventDefault();return}E?.(R)}},l?{type:"button"}:{role:"button"},g,N)},[n,g,m,l]),v=Le(k=>{d.current=k,h()});return{getButtonProps:_,buttonRef:v}}function Eg(e){return Gt(e)&&e.tagName==="BUTTON"}function LO(e){return!!(e?.tagName==="A"&&e?.href)}const PO=x.forwardRef(function(n,s){const{render:o,className:l,disabled:c=!1,focusableWhenDisabled:d=!1,nativeButton:p=!0,style:m,...g}=n,{getButtonProps:h,buttonRef:_}=Ul({disabled:c,focusableWhenDisabled:d,native:p});return Ht("button",n,{state:{disabled:c},ref:[s,_],props:[g,h]})}),H1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,V1=fc,lb=(e,n)=>s=>{var o;if(n?.variants==null)return V1(e,s?.class,s?.className);const{variants:l,defaultVariants:c}=n,d=Object.keys(l).map(g=>{const h=s?.[g],_=c?.[g];if(h===null)return null;const v=H1(h)||H1(_);return l[g][v]}),p=s&&Object.entries(s).reduce((g,h)=>{let[_,v]=h;return v===void 0||(g[_]=v),g},{}),m=n==null||(o=n.compoundVariants)===null||o===void 0?void 0:o.reduce((g,h)=>{let{class:_,className:v,...k}=h;return Object.entries(k).every(S=>{let[j,w]=S;return Array.isArray(w)?w.includes({...c,...p}[j]):{...c,...p}[j]===w})?[...g,_,v]:g},[]);return V1(e,d,m,s?.class,s?.className)},IO=lb("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 $s({className:e,variant:n="default",size:s="default",...o}){return r.jsx(PO,{"data-slot":"button",className:Et(IO({variant:n,size:s,className:e})),...o})}let q1=(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 BO={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Qi={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},UO={disabled:!1,...Qi},ib={valid(e){return e===null?null:e?{[q1.valid]:""}:{[q1.invalid]:""}}},HO={invalid:void 0,name:void 0,validityData:{state:BO,errors:[],error:"",value:"",initialValue:null},setValidityData:Bn,disabled:void 0,touched:Qi.touched,setTouched:Bn,dirty:Qi.dirty,setDirty:Bn,filled:Qi.filled,setFilled:Bn,focused:Qi.focused,setFocused:Bn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:UO,markedDirtyRef:{current:!1},registerFieldControl:Bn,validation:{getValidationProps:(e=un)=>e,getInputValidationProps:(e=un)=>e,inputRef:{current:null},commit:async()=>{}}},VO=x.createContext(HO);function zc(e=!0){const n=x.useContext(VO);if(n.setValidityData===Bn&&!e)throw new Error(Mn(28));return n}const qO=x.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Bn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function XS(){return x.useContext(qO)}const $O=x.createContext({controlId:void 0,registerControlId:Bn,labelId:void 0,setLabelId:Bn,messageIds:[],setMessageIds:Bn,getDescriptionProps:e=>e});function Tf(){return x.useContext($O)}function GO(e,n,s,o=!0,l){const[c,d]=x.useState(),p=Dr(l?`${l}-label`:void 0),m=e??n??c;return Me(()=>{const g=e||n||!o?void 0:FO(s.current,p);c!==g&&d(g)}),m}function FO(e,n){const s=YO(e);if(s)return!s.id&&n&&(s.id=n),s.id||void 0}function YO(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const s=e.id;if(s){const l=e.nextElementSibling;if(l&&l.htmlFor===s)return l}const o=e.labels;return o&&o[0]}function Af(e={}){const{id:n,implicit:s=!1,controlRef:o}=e,{controlId:l,registerControlId:c}=Tf(),d=Dr(n),p=s?l:void 0,m=va(()=>Symbol("labelable-control")),g=x.useRef(!1),h=x.useRef(n!=null),_=Le(()=>{!g.current||c===Bn||(g.current=!1,c(m.current,void 0))});return Me(()=>{if(c===Bn)return;let v;if(s){const k=o?.current;dt(k)&&k.closest("label")!=null?v=n??null:v=p??d}else if(n!=null)h.current=!0,v=n;else if(h.current)v=d;else{_();return}if(v===void 0){_();return}g.current=!0,c(m.current,v)},[n,o,p,c,s,d,m,_]),x.useEffect(()=>_,[_]),l??d}function vc({controlled:e,default:n,name:s,state:o="value"}){const{current:l}=x.useRef(e!==void 0),[c,d]=x.useState(n),p=l?e:c,m=x.useCallback(g=>{l||d(g)},[]);return[p,m]}function cb(e,n,s,o,l=!0){const{registerFieldControl:c}=zc(),d=x.useRef(null);d.current||(d.current=Symbol()),Me(()=>{const p=d.current;return!p||!l?void 0:(c(p,{controlRef:e,getValue:o,id:n,value:s}),()=>{c(p,void 0)})},[e,l,o,n,c,s])}const XO=x.forwardRef(function(n,s){const{render:o,className:l,id:c,name:d,value:p,disabled:m=!1,onValueChange:g,defaultValue:h,autoFocus:_=!1,style:v,...k}=n,{state:S,name:j,disabled:w,setTouched:C,setDirty:E,validityData:N,setFocused:R,setFilled:T,validationMode:O,validation:A}=zc(),z=w||m,B=j??d,L={...S,disabled:z},{labelId:D}=Tf(),P=Af({id:c});Me(()=>{const G=p!=null;A.inputRef.current?.value||G&&p!==""?T(!0):G&&p===""&&T(!1)},[A.inputRef,T,p]);const H=x.useRef(null);Me(()=>{_&&H.current===Pn(vt(H.current))&&R(!0)},[_,R]);const[q]=vc({controlled:p,default:h,name:"FieldControl",state:"value"}),Y=p!==void 0,V=Y?q:void 0,$=Le(()=>A.inputRef.current?.value);return cb(A.inputRef,P,V,$),Ht("input",n,{ref:[s,H],state:L,props:[{id:P,disabled:z,name:B,ref:A.inputRef,"aria-labelledby":D,autoFocus:_,...Y?{value:V}:{defaultValue:h},onChange(G){const X=G.currentTarget.value;g?.(X,lt(Hs,G.nativeEvent)),E(X!==N.initialValue),T(X!=="")},onFocus(){R(!0)},onBlur(G){C(!0),R(!1),O==="onBlur"&&A.commit(G.currentTarget.value)},onKeyDown(G){G.currentTarget.tagName==="INPUT"&&G.key==="Enter"&&(C(!0),A.commit(G.currentTarget.value))}},A.getInputValidationProps(),k],stateAttributesMapping:ib})}),KO=x.forwardRef(function(n,s){return r.jsx(XO,{ref:s,...n})});function QO({className:e,type:n,...s}){return r.jsx(KO,{type:n,"data-slot":"input",className:Et("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",e),...s})}function ZO({className:e,...n}){return r.jsx("textarea",{"data-slot":"textarea",className:Et("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),...n})}function WO(e){return Ht(e.defaultTagName??"div",e,e)}const JO=lb("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 ez({className:e,variant:n="default",render:s,...o}){return WO({defaultTagName:"span",props:Da({className:Et(JO({variant:n}),e)},o),render:s,state:{slot:"badge",variant:n}})}const KS=x.createContext(void 0);function tz(){const e=x.useContext(KS);if(e===void 0)throw new Error(Mn(63));return e}let $1=(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 QS={...ib,checked(e){return e?{[$1.checked]:""}:{[$1.unchecked]:""}}};function ub(e,n){const s=x.useRef(e),o=Le(n);Me(()=>{s.current!==e&&o(s.current)},[e,o]),Me(()=>{s.current=e},[e])}const nz=x.forwardRef(function(n,s){const{checked:o,className:l,defaultChecked:c,"aria-labelledby":d,form:p,id:m,inputRef:g,name:h,nativeButton:_=!1,onCheckedChange:v,readOnly:k=!1,required:S=!1,disabled:j=!1,render:w,uncheckedValue:C,value:E,style:N,...R}=n,{clearErrors:T}=XS(),{state:O,setTouched:A,setDirty:z,validityData:B,setFilled:L,setFocused:D,shouldValidateOnChange:P,validationMode:H,disabled:q,name:Y,validation:V}=zc(),{labelId:$}=Tf(),Z=q||j,G=Y??h,X=x.useRef(null),U=Vs(X,g,V.inputRef),K=x.useRef(null),F=Dr(),J=Af({id:m,implicit:!1,controlRef:K}),ie=_?void 0:J,[re,oe]=vc({controlled:o,default:!!c,name:"Switch",state:"checked"});cb(K,F,re),Me(()=>{X.current&&L(X.current.checked)},[X,L]),ub(re,()=>{T(G),z(re!==B.initialValue),L(re),P()?V.commit(re):V.commit(re,!0)});const{getButtonProps:ce,buttonRef:ee}=Ul({disabled:Z,native:_}),Te=GO(d,$,X,!_,ie),Fe={id:_?J:F,role:"switch","aria-checked":re,"aria-readonly":k||void 0,"aria-required":S||void 0,"aria-labelledby":Te,onFocus(){Z||D(!0)},onBlur(){const Pe=X.current;!Pe||Z||(A(!0),D(!1),H==="onBlur"&&V.commit(Pe.checked))},onClick(Pe){if(k||Z)return;Pe.preventDefault();const Ie=X.current;Ie&&Ie.dispatchEvent(new(Qt(Ie)).PointerEvent("click",{bubbles:!0,shiftKey:Pe.shiftKey,ctrlKey:Pe.ctrlKey,altKey:Pe.altKey,metaKey:Pe.metaKey}))}},_e=Da({checked:re,disabled:Z,form:p,id:ie,name:G,required:S,style:G?Rk:Ax,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:U,onChange(Pe){if(Pe.nativeEvent.defaultPrevented)return;if(k){Pe.preventDefault();return}const Ie=Pe.currentTarget.checked,be=lt(Hs,Pe.nativeEvent);v?.(Ie,be),!be.isCanceled&&oe(Ie)},onFocus(){K.current?.focus()}},V.getInputValidationProps,E!==void 0?{value:E}:un),Se=x.useMemo(()=>({...O,checked:re,disabled:Z,readOnly:k,required:S}),[O,re,Z,k,S]),Ne=Ht("span",n,{state:Se,ref:[s,K,ee],props:[Fe,V.getValidationProps,R,ce],stateAttributesMapping:QS});return r.jsxs(KS.Provider,{value:Se,children:[Ne,!re&&G&&C!==void 0&&r.jsx("input",{type:"hidden",form:p,name:G,value:C}),r.jsx("input",{..._e,suppressHydrationWarning:!0})]})}),az=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,p=tz();return Ht("span",n,{state:p,ref:s,stateAttributesMapping:QS,props:d})});function sz({className:e,size:n="default",...s}){return r.jsx(nz,{"data-slot":"switch","data-size":n,className:Et("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",e),...s,children:r.jsx(az,{"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 rz({className:e,...n}){return r.jsx(uf,{role:"status","aria-label":"Loading",className:Et("size-4 animate-spin",e),...n})}const ZS=x.createContext(!1),WS=x.createContext(void 0);function _o(e){const n=x.useContext(WS);if(e===!1&&n===void 0)throw new Error(Mn(27));return n}const oz={...Bl,...Il},JS=x.forwardRef(function(n,s){const{render:o,className:l,style:c,forceRender:d=!1,...p}=n,{store:m}=_o(),g=m.useState("open"),h=m.useState("nested"),_=m.useState("mounted"),v=m.useState("transitionStatus");return Ht("div",n,{state:{open:g,transitionStatus:v},ref:[m.context.backdropRef,s],stateAttributesMapping:oz,props:[{role:"presentation",hidden:!_,style:{userSelect:"none",WebkitUserSelect:"none"}},p],enabled:d||!h})}),Mf=x.forwardRef(function(n,s){const{render:o,className:l,style:c,disabled:d=!1,nativeButton:p=!0,...m}=n,{store:g}=_o(),h=g.useState("open"),{getButtonProps:_,buttonRef:v}=Ul({disabled:d,native:p}),k={disabled:d};function S(j){h&&g.setOpen(!1,lt(RM,j.nativeEvent))}return Ht("button",n,{state:k,ref:[s,v],props:[{onClick:S},m,_]})}),e2=x.forwardRef(function(n,s){const{render:o,className:l,style:c,id:d,...p}=n,{store:m}=_o(),g=Dr(d);return m.useSyncedValueWithCleanup("descriptionElementId",g),Ht("p",n,{ref:s,props:[{id:g},p]})});let lz=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),iz=(function(e){return e[e.open=lo.open]="open",e[e.closed=lo.closed]="closed",e[e.startingStyle=lo.startingStyle]="startingStyle",e[e.endingStyle=lo.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const t2=x.createContext(void 0);function cz(){const e=x.useContext(t2);if(e===void 0)throw new Error(Mn(26));return e}const sc="ArrowUp",dl="ArrowDown",Zd="ArrowLeft",rc="ArrowRight",Of="Home",zf="End",n2=new Set([Zd,rc]),uz=new Set([Zd,rc,Of,zf]),a2=new Set([sc,dl]),dz=new Set([sc,dl,Of,zf]),s2=new Set([...n2,...a2]),db=new Set([...s2,Of,zf]),fz="Shift",pz="Control",mz="Alt",gz="Meta",hz=new Set([fz,pz,mz,gz]);function xz(e){return Gt(e)&&e.tagName==="INPUT"}function G1(e){return!!(xz(e)&&e.selectionStart!=null||Gt(e)&&e.tagName==="TEXTAREA")}function F1(e,n,s,o){if(!e||!n||!n.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=Y1(e,n,"left"),g=rd(e),h=rd(n);s==="ltr"&&(m+n.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight?l=m+n.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight:m-h.scrollMarginLeft<e.scrollLeft+g.scrollPaddingLeft&&(l=m-h.scrollMarginLeft-g.scrollPaddingLeft)),s==="rtl"&&(m-h.scrollMarginRight<e.scrollLeft+g.scrollPaddingLeft?l=m-h.scrollMarginLeft-g.scrollPaddingLeft:m+n.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-g.scrollPaddingRight&&(l=m+n.offsetWidth+h.scrollMarginRight-e.clientWidth+g.scrollPaddingRight))}if(p&&o!=="horizontal"){const m=Y1(e,n,"top"),g=rd(e),h=rd(n);m-h.scrollMarginTop<e.scrollTop+g.scrollPaddingTop?c=m-h.scrollMarginTop-g.scrollPaddingTop:m+n.offsetHeight+h.scrollMarginBottom>e.scrollTop+e.clientHeight-g.scrollPaddingBottom&&(c=m+n.offsetHeight+h.scrollMarginBottom-e.clientHeight+g.scrollPaddingBottom)}e.scrollTo({left:l,top:c,behavior:"auto"})}function Y1(e,n,s){const o=s==="left"?"offsetLeft":"offsetTop";let l=0;for(;n.offsetParent&&(l+=n[o],n.offsetParent!==e);)n=n.offsetParent;return l}function rd(e){const n=getComputedStyle(e);return{scrollMarginTop:parseFloat(n.scrollMarginTop)||0,scrollMarginRight:parseFloat(n.scrollMarginRight)||0,scrollMarginBottom:parseFloat(n.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(n.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(n.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(n.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(n.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(n.scrollPaddingLeft)||0}}const bz={...Bl,...Il,nestedDialogOpen(e){return e?{[iz.nestedDialogOpen]:""}:null}},r2=x.forwardRef(function(n,s){const{render:o,className:l,style:c,finalFocus:d,initialFocus:p,...m}=n,{store:g}=_o(),h=g.useState("descriptionElementId"),_=g.useState("disablePointerDismissal"),v=g.useState("floatingRootContext"),k=g.useState("popupProps"),S=g.useState("modal"),j=g.useState("mounted"),w=g.useState("nested"),C=g.useState("nestedOpenDialogCount"),E=g.useState("open"),N=g.useState("openMethod"),R=g.useState("titleElementId"),T=g.useState("transitionStatus"),O=g.useState("role"),A=v.useState("floatingId"),z=m.id??A;cz(),zr({open:E,ref:g.context.popupRef,onComplete(){E&&g.context.onOpenChangeComplete?.(!0)}});function B(Y){return Y==="touch"?g.context.popupRef.current:!0}const L=p===void 0?B:p,D=C>0,P=g.useStateSetter("popupElement"),q=Ht("div",n,{state:{open:E,nested:w,transitionStatus:T,nestedDialogOpen:D},props:[k,{id:z,"aria-labelledby":R??void 0,"aria-describedby":h??void 0,role:O,...Sf,hidden:!j,onKeyDown(Y){db.has(Y.key)&&Y.stopPropagation()},style:{[lz.nestedDialogs]:C}},m],ref:[s,g.context.popupRef,P],stateAttributesMapping:bz});return r.jsx(tS,{context:v,openInteractionType:N,disabled:!j,closeOnFocusOut:!_,initialFocus:L,returnFocus:d,modal:S!==!1,restoreFocus:"popup",children:q})}),o2=x.forwardRef(function(n,s){const{cutout:o,...l}=n;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 r.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...l,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),l2=x.forwardRef(function(n,s){const{keepMounted:o=!1,...l}=n,{store:c}=_o(),d=c.useState("mounted"),p=c.useState("modal"),m=c.useState("open");return d||o?r.jsx(t2.Provider,{value:o,children:r.jsxs(eS,{ref:s,...l,children:[d&&p===!0&&r.jsx(o2,{ref:c.context.internalBackdropRef,inert:Kx(!m)}),n.children]})}):null});let X1={},K1={},Q1="";function _z(e){if(typeof document>"u")return!1;const n=vt(e);return Qt(n).innerWidth-n.documentElement.clientWidth>0}function vz(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const s=vt(e),o=s.documentElement,l=s.body,c=Mr(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 yz(e){const n=vt(e),s=n.documentElement,o=n.body,l=Mr(s)?s:o,c={overflowY:l.style.overflowY,overflowX:l.style.overflowX};return Object.assign(l.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(l.style,c)}}function jz(e){const n=vt(e),s=n.documentElement,o=n.body,l=Qt(s);let c=0,d=0,p=!1;const m=es.create();if(wx&&(l.visualViewport?.scale??1)!==1)return()=>{};function g(){const k=l.getComputedStyle(s),S=l.getComputedStyle(o),C=(k.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=s.scrollTop,d=s.scrollLeft,X1={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},Q1=s.style.scrollBehavior,K1={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 E=s.scrollHeight>s.clientHeight,N=s.scrollWidth>s.clientWidth,R=k.overflowY==="scroll"||S.overflowY==="scroll",T=k.overflowX==="scroll"||S.overflowX==="scroll",O=Math.max(0,l.innerWidth-o.clientWidth),A=Math.max(0,l.innerHeight-o.clientHeight),z=parseFloat(S.marginTop)+parseFloat(S.marginBottom),B=parseFloat(S.marginLeft)+parseFloat(S.marginRight),L=Mr(s)?s:o;if(p=vz(e),p){s.style.scrollbarGutter=C,L.style.overflowY="hidden",L.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(E||R)&&(s.style.overflowY="scroll"),(N||T)&&(s.style.overflowX="scroll"),Object.assign(o.style,{position:"relative",height:z||A?`calc(100dvh - ${z+A}px)`:"100dvh",width:B||O?`calc(100vw - ${B+O}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),o.scrollTop=c,o.scrollLeft=d,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function h(){Object.assign(s.style,X1),Object.assign(o.style,K1),p||(s.scrollTop=c,s.scrollLeft=d,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=Q1)}function _(){h(),m.request(g)}g();const v=ft(l,"resize",_);return()=>{m.cancel(),h(),typeof l.removeEventListener=="function"&&v()}}class wz{lockCount=0;restore=null;timeoutLock=Ga.create();timeoutUnlock=Ga.create();acquire(n){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(n)),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(n){if(this.lockCount===0||this.restore!==null)return;const o=vt(n).documentElement,l=Qt(o).getComputedStyle(o).overflowY;if(l==="hidden"||l==="clip"){this.restore=Bn;return}const c=hk||!_z(n);this.restore=c?yz(n):jz(n)}}const kz=new wz;function i2(e=!0,n=null){Me(()=>{if(e)return kz.acquire(n)},[e,n])}function Sz(e){const{store:n,parentContext:s,actionsRef:o,isDrawer:l}=e,c=n.useState("open");U5(n,c),gS(n);const{forceUnmount:d}=hS(c,n),p=x.useCallback(()=>{n.setOpen(!1,lt(kk))},[n]);return x.useImperativeHandle(o,()=>({unmount:d,close:p}),[d,p]),{parentContext:s,isDrawer:l}}function Cz({store:e,dialogRoot:n}){const{parentContext:s,isDrawer:o}=n,l=e.useState("open"),c=e.useState("disablePointerDismissal"),d=e.useState("modal"),p=e.useState("popupElement"),m=e.useState("floatingRootContext"),[g,h]=x.useState(0),[_,v]=x.useState(0),k=g===0,S=Ux(m,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:d==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(E){if(!e.context.outsidePressEnabledRef.current||"button"in E&&E.button!==0||"touches"in E&&E.touches.length!==1)return!1;const N=Tn(E);if(k&&!c){const R=N;return d&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===R||e.context.backdropRef.current===R||Ze(R,p)&&!R?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:k});i2(l&&d===!0,p),e.useContextCallback("onNestedDialogOpen",(E,N)=>{h(E),v(N)}),e.useContextCallback("onNestedDialogClose",()=>{h(0),v(0)}),x.useEffect(()=>(s?.onNestedDialogOpen&&l&&s.onNestedDialogOpen(g+1,_+(o?1:0)),s?.onNestedDialogClose&&!l&&s.onNestedDialogClose(),()=>{s?.onNestedDialogClose&&l&&s.onNestedDialogClose()}),[o,l,g,_,s]);const j=S.reference??un,w=S.trigger??un,C=x.useMemo(()=>Da(Sf,S.floating),[S.floating]);return xS(e,{activeTriggerProps:j,inactiveTriggerProps:w,popupProps:C,nestedOpenDialogCount:g,nestedOpenDrawerCount:_}),null}const Ez={...yS,modal:ze(e=>e.modal),nested:ze(e=>e.nested),nestedOpenDialogCount:ze(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:ze(e=>e.nestedOpenDrawerCount),disablePointerDismissal:ze(e=>e.disablePointerDismissal),openMethod:ze(e=>e.openMethod),descriptionElementId:ze(e=>e.descriptionElementId),titleElementId:ze(e=>e.titleElementId),viewportElement:ze(e=>e.viewportElement),role:ze(e=>e.role)};class fb extends Vx{constructor(n,s,o=!1){const l=new Cf,c=Nz(n);c.floatingRootContext=_S(l,s,o),super(c,{popupRef:x.createRef(),backdropRef:x.createRef(),internalBackdropRef:x.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:l,onOpenChange:void 0,onOpenChangeComplete:void 0},Ez)}setOpen=(n,s)=>{if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&s.trigger==null&&this.state.activeTriggerId!=null&&(s.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const o={open:n};mS(o,n,s.trigger),this.update(o)};static useStore(n,s){return pS(n,(l,c)=>new fb(s,l,c),!0).store}}function Nz(e={}){return{...bS(),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 Rz(e,n="dialog"){const{children:s,open:o,defaultOpen:l=!1,onOpenChange:c,onOpenChangeComplete:d,disablePointerDismissal:p=!1,modal:m=!0,actionsRef:g,handle:h,triggerId:_,defaultTriggerId:v=null}=e,k=n==="drawer",S=n==="alert-dialog",j=S?!0:m,w=S||p,C=S?"alertdialog":"dialog",E=_o(!0),R={modal:j,disablePointerDismissal:w,nested:!!E,role:C},T=fb.useStore(h?.store,{open:l,openProp:o,activeTriggerId:v,triggerIdProp:_,...R});yx(()=>{const P=o===void 0&&T.state.open===!1&&l===!0?{open:!0,activeTriggerId:v}:null;S?T.update(P?{...R,...P}:R):P&&T.update(P)}),T.useControlledProp("openProp",o),T.useControlledProp("triggerIdProp",_),T.useSyncedValues(R),T.useContextCallback("onOpenChange",c),T.useContextCallback("onOpenChangeComplete",d);const O=T.useState("open"),A=T.useState("mounted"),z=T.useState("payload"),B=Sz({store:T,actionsRef:g,parentContext:E?.store.context,isDrawer:k}),L=O||A,D=x.useMemo(()=>({store:T}),[T]);return r.jsx(ZS.Provider,{value:!1,children:r.jsxs(WS.Provider,{value:D,children:[L&&r.jsx(Cz,{store:T,dialogRoot:B}),typeof s=="function"?s({payload:z}):s]})})}function c2(e){const n=x.useContext(ZS)?"drawer":"dialog";return Rz(e,n)}const u2=x.forwardRef(function(n,s){const{render:o,className:l,style:c,id:d,...p}=n,{store:m}=_o(),g=Dr(d);return m.useSyncedValueWithCleanup("titleElementId",g),Ht("h2",n,{ref:s,props:[{id:g},p]})});function Tz(e){const n=x.useRef(""),s=x.useCallback(l=>{l.defaultPrevented||(n.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,n.current),n.current=""},[e]),onPointerDown:s}}function Az(e,n){const s=Le((c,d)=>{(typeof e=="function"?e():e)||n(d||(hk?"touch":""))}),{onClick:o,onPointerDown:l}=Tz(s);return x.useMemo(()=>({onClick:o,onPointerDown:l}),[o,l])}function Mz(e){const[n,s]=x.useState(null),o=Az(e,s);return ub(e,l=>{l&&!e&&s(null)}),x.useMemo(()=>({openMethod:n,triggerProps:o}),[n,o])}function Ih({...e}){return r.jsx(c2,{"data-slot":"dialog",...e})}function Oz({...e}){return r.jsx(l2,{"data-slot":"dialog-portal",...e})}function zz({...e}){return r.jsx(Mf,{"data-slot":"dialog-close",...e})}function Dz({className:e,...n}){return r.jsx(JS,{"data-slot":"dialog-overlay",className:Et("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),...n})}function Bh({className:e,children:n,showCloseButton:s=!0,...o}){return r.jsxs(Oz,{children:[r.jsx(Dz,{}),r.jsxs(r2,{"data-slot":"dialog-content",className:Et("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:[n,s&&r.jsxs(Mf,{"data-slot":"dialog-close",render:r.jsx($s,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[r.jsx(bo,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Uh({className:e,...n}){return r.jsx("div",{"data-slot":"dialog-header",className:Et("flex flex-col gap-2",e),...n})}function Z1({className:e,showCloseButton:n=!1,children:s,...o}){return r.jsxs("div",{"data-slot":"dialog-footer",className:Et("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",e),...o,children:[s,n&&r.jsx(Mf,{render:r.jsx($s,{variant:"outline"}),children:"Close"})]})}function Hh({className:e,...n}){return r.jsx(u2,{"data-slot":"dialog-title",className:Et("font-heading text-base leading-none font-medium",e),...n})}function Lz({className:e,...n}){return r.jsx(e2,{"data-slot":"dialog-description",className:Et("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...n})}const Pz={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},Iz={sm:"sm",md:"default"};function ge({variant:e="secondary",size:n="md",loading:s,className:o,children:l,disabled:c,type:d="button",...p}){return r.jsxs($s,{type:d,variant:Pz[e],size:Iz[n],disabled:c||s,className:o,...p,children:[s?r.jsx(Pa,{size:14}):null,l]})}function Ce(e){return r.jsx(QO,{...e})}function cn(e){return r.jsx(ZO,{...e})}function Bz(e){return r.jsx("select",{...e,className:Oe("h-8 w-full rounded-lg border border-input bg-transparent px-2.5 text-sm outline-none transition-colors focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",e.className)})}function de({label:e,hint:n,badge:s,children:o}){return r.jsxs("label",{className:"block space-y-1",children:[r.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,s&&r.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:s})]}),o,n&&r.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:n})]})}function Zt({checked:e,onChange:n,label:s,disabled:o}){return r.jsxs("label",{className:Oe("inline-flex items-center gap-2",o&&"opacity-50"),children:[r.jsx(sz,{checked:e,onCheckedChange:n,disabled:o}),s&&r.jsx("span",{className:"text-sm",children:s})]})}function Ve({children:e,tone:n="muted",className:s}){const o=n==="danger"?"destructive":n==="muted"?"secondary":"outline",l={muted:"",danger:"",success:"text-emerald-400 border-emerald-500/30",warning:"text-amber-400 border-amber-500/30",info:"text-sky-400 border-sky-500/30"};return r.jsx(ez,{variant:o,className:Oe("rounded-md",l[n],s),children:e})}function Vn({open:e,onClose:n,title:s,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 r.jsx(Ih,{open:e,onOpenChange:m=>{m||n()},children:r.jsxs(Bh,{className:Oe("flex max-h-[88vh] w-full flex-col gap-0 p-0",p[d]),children:[(s||o)&&r.jsxs(Uh,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[s&&r.jsx(Hh,{children:s}),o&&r.jsx(Lz,{children:o})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:l}),c&&r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function Pa({size:e=14}){return r.jsx(rz,{style:{width:e,height:e}})}function pt({children:e}){return r.jsx("div",{className:"rounded-lg border border-dashed border-border bg-muted/20 px-4 py-6 text-center text-sm text-muted-foreground",children:e})}function nt({label:e="Cargando…"}){return r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Pa,{})," ",e]})}const d2=x.createContext(null);let Uz=1;function Hz({children:e}){const[n,s]=x.useState([]),o=x.useCallback((c,d)=>{const p=Uz++;s(m=>[...m,{id:p,kind:c,message:d}]),setTimeout(()=>{s(m=>m.filter(g=>g.id!==p))},4500)},[]),l=x.useMemo(()=>({show:o,success:c=>o("success",c),error:c=>o("error",c),info:c=>o("info",c)}),[o]);return x.useEffect(()=>(window.__apxToast=l,()=>{delete window.__apxToast}),[l]),r.jsxs(d2.Provider,{value:l,children:[e,r.jsx("div",{className:"pointer-events-none fixed bottom-4 right-4 z-[100] flex w-80 max-w-[calc(100vw-2rem)] flex-col gap-2",children:n.map(c=>r.jsx("div",{className:Oe("pointer-events-auto overflow-hidden rounded-lg border bg-card px-3 py-2 text-sm shadow-lg",c.kind==="success"&&"border-emerald-500/40",c.kind==="error"&&"border-destructive/60",c.kind==="info"&&"border-border"),children:r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("span",{className:Oe("mt-1 size-2 shrink-0 rounded-full",c.kind==="success"&&"bg-emerald-500",c.kind==="error"&&"bg-destructive",c.kind==="info"&&"bg-sky-500")}),r.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function at(){const e=x.useContext(d2);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function f2(){const{data:e,error:n,isLoading:s}=Qe("/health",()=>mO.get(),{refreshInterval:ff.health});return{health:e,error:n,isLoading:s,isUp:!n&&!!e}}function Vz(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/engines",()=>Kd.list());return{engines:e?.engines||[],error:n,isLoading:s,mutate:o}}function qz(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/telegram/status",()=>An.status(),{refreshInterval:ff.telegramStatus});return{status:e,error:n,isLoading:s,mutate:o}}function pb(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/telegram/channels",()=>An.channels.list());return{channels:e?.channels||[],error:n,isLoading:s,mutate:o}}function mb(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/telegram/contacts",()=>An.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:n,isLoading:s,mutate:o}}function qa(e){return typeof e=="string"&&e.startsWith("*** set ***")}function Sr(e,n="(no seteada)"){return qa(e)?e:n}function Cl(e){if(typeof e!="string")return null;const n=e.match(/\(\.\.\.([^)]+)\)/);return n?n[1]:null}function p2({channel:e,onClose:n,onSaved:s}){const o=at(),[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(f("telegram_channel_dialog.name_required"));return}c(!0);try{e&&e.name!==""&&e?.name===d.name?await An.channels.patch(e.name,d):await An.channels.upsert(d),o.success(f("telegram_channel_dialog.saved")),s()}catch(g){o.error(g.message)}finally{c(!1)}};return r.jsx(Vn,{open:!!e,onClose:n,title:e?.name?f("telegram_channel_dialog.edit_title",{name:e.name}):f("telegram_channel_dialog.new_title"),description:f("telegram_ui.channel_dialog_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:l,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:m,loading:l,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:f("telegram_channel_dialog.name_label"),children:r.jsx(Ce,{value:d.name,onChange:g=>p({...d,name:g.target.value}),disabled:!!e?.name})}),r.jsx(de,{label:f("telegram_channel_dialog.token_label"),hint:e?.bot_token?Sr(e.bot_token):f("telegram_ui.bot_token_hint"),children:r.jsx(Ce,{type:"password",value:d.bot_token||"",onChange:g=>p({...d,bot_token:g.target.value}),placeholder:e?.bot_token?Sr(e.bot_token):""})}),r.jsx(de,{label:f("telegram_channel_dialog.chat_id"),children:r.jsx(Ce,{value:d.chat_id||"",onChange:g=>p({...d,chat_id:g.target.value})})}),r.jsx(de,{label:f("telegram_channel_dialog.project_label"),hint:f("telegram_channel_dialog.project_hint"),children:r.jsx(Ce,{value:d.project||"",onChange:g=>p({...d,project:g.target.value})})}),r.jsx(de,{label:f("telegram_channel_dialog.route_label"),hint:f("telegram_channel_dialog.route_hint"),children:r.jsx(Ce,{value:d.route_to_agent||"",onChange:g=>p({...d,route_to_agent:g.target.value})})}),r.jsx(de,{label:f("telegram_channel_dialog.owner_label"),hint:f("telegram_channel_dialog.owner_hint"),children:r.jsx(Ce,{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"})}),r.jsx(Zt,{checked:!!d.respond_with_engine,onChange:g=>p({...d,respond_with_engine:g}),label:f("telegram_channel_dialog.respond_label")})]})})}function m2({channel:e,onClose:n}){const s=at(),[o,l]=x.useState(f("admin.telegram_default_message")),[c,d]=x.useState(!1),p=async()=>{if(!(!o.trim()||!e)){d(!0);try{await An.send({text:o,channel:e.name}),s.success(f("telegram_ui.message_sent")),n()}catch(m){s.error(m.message)}finally{d(!1)}}};return r.jsx(Vn,{open:!!e,onClose:n,title:e?f("telegram_send_dialog.title",{name:e.name}):"",description:e?f("telegram_ui.send_chat_id",{id:e.chat_id||"—"}):"",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:c,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:p,loading:c,children:f("chat_ui.send")})]}),children:r.jsx(de,{label:f("telegram_ui.message_label"),children:r.jsx(cn,{rows:4,value:o,onChange:m=>l(m.target.value)})})})}function g2({bare:e=!1}){const n=at(),{contacts:s,roles:o,channelOwners:l,isLoading:c,mutate:d}=mb(),p=new Set(l.filter(v=>v.owner_user_id!=null).map(v=>String(v.owner_user_id))),m=Array.from(new Set(["owner","guest",...Object.keys(o)])),g=async(v,k)=>{try{await An.contacts.patch(v.user_id,{role:k}),n.success(f("telegram_ui.role_assigned",{name:v.name||v.user_id,role:k})),d()}catch(S){n.error(S.message)}},h=async v=>{if(confirm(f("telegram_contacts.delete_confirm",{name:v.name||String(v.user_id)})))try{await An.contacts.remove(v.user_id),n.success(f("telegram_contacts.removed")),d()}catch(k){n.error(k.message)}},_=r.jsxs(r.Fragment,{children:[c&&r.jsx(nt,{}),!c&&s.length===0&&r.jsx(pt,{children:f("telegram_contacts.empty")}),s.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:s.map(v=>{const k=p.has(String(v.user_id)),S=k?"owner":v.role||"guest";return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:v.name||"—"}),v.username&&r.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",v.username]}),k&&r.jsx(Ve,{tone:"success",children:f("telegram_contacts.owner_badge")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bz,{value:S,disabled:k,onChange:j=>g(v,j.target.value),title:f(k?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:m.map(j=>r.jsx("option",{value:j,children:j},j))}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>h(v),children:f("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["user_id: ",String(v.user_id)]}),r.jsxs("span",{children:[f("telegram_contacts.last_seen")," ",v.last_seen?v.last_seen.slice(0,10):"—"]}),r.jsx("span",{children:$z(o[S])})]})]},String(v.user_id))})})]});return e?_:r.jsx(Ge,{title:f("telegram_contacts.title"),description:f("telegram_contacts.desc"),children:_})}function $z(e){return!e||e.tools===void 0?"":e.tools==="*"?f("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${f("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:f("telegram_contacts.tools_none"):""}function Gz(){const e=la(),n=at(),{health:s,isUp:o}=f2(),{projects:l,isLoading:c,mutate:d}=Oc(),{engines:p,isLoading:m}=Vz(),{status:g,mutate:h}=qz(),{channels:_,isLoading:v,mutate:k}=pb(),[S,j]=x.useState(null),[w,C]=x.useState(null),E=async()=>{try{await kl.reload(),n.success(f("admin.reload_success"))}catch(O){n.error(O.message)}},N=async()=>{try{g?.enabled?(await An.stop(),n.info(f("admin.telegram_polling_stopped"))):(await An.start(),n.success(f("admin.telegram_polling_started"))),h()}catch(O){n.error(O.message)}},R=async O=>{if(confirm(f("telegram_channels.delete_confirm",{name:O})))try{await An.channels.remove(O),n.success(f("admin.telegram_channel_removed")),k()}catch(A){n.error(A.message)}},T=async(O,A)=>{if(confirm(f("admin.unregister_confirm",{label:A})))try{await aa.remove(O),n.success(f("project.unregistered")),d()}catch(z){n.error(z.message)}};return r.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[r.jsxs("header",{className:"flex items-end justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:f("admin.title")}),r.jsx("p",{className:"text-sm text-muted-fg",children:f("admin.subtitle")})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ge,{size:"sm",onClick:E,title:f("daemon.reload_hint"),children:[f("common.reload")," config"]}),r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>e("/?action=add-project"),children:[r.jsx(nn,{size:14})," ",f("nav.project")]})]})]}),r.jsx(Ge,{title:f("daemon.version"),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(Ng,{label:f("daemon.version"),value:s?.version||"—"}),r.jsx(Ng,{label:f("daemon.uptime"),value:s?`${s.uptime_s}s`:"—"}),r.jsx(Ng,{label:f("daemon.status"),value:f(o?"daemon.running":"daemon.down"),ok:o})]})}),r.jsxs(Ge,{title:f("admin.engines_title"),description:f("admin.engines_subtitle"),children:[m&&r.jsx(nt,{}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(O=>r.jsx(Ve,{tone:"info",children:O},O))})]}),r.jsxs(Ge,{title:f("admin.telegram_title"),description:f("admin.telegram_subtitle"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zt,{checked:!!g?.enabled,onChange:N,label:g?.enabled?f("admin.telegram_polling_on"):f("admin.telegram_polling_off")}),r.jsxs(ge,{size:"sm",onClick:()=>j({name:""}),children:[r.jsx(nn,{size:14})," ",f("admin.telegram_add_channel")]})]}),children:[v&&r.jsx(nt,{}),_.length===0&&r.jsx(pt,{children:f("common.none_yet")}),r.jsx("ul",{className:"space-y-2 text-sm",children:_.map(O=>r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:O.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[O.project&&r.jsxs(Ve,{tone:"success",children:["project = ",O.project]}),r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>C(O),children:[r.jsx(Ya,{size:13})," ",f("admin.telegram_send_test")]}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>j(O),children:f("common.edit")}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>R(O.name),children:f("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",O.chat_id||"—"]}),r.jsxs("span",{children:["route_to_agent: ",O.route_to_agent||"default APX"]}),r.jsxs("span",{children:["engine: ",O.respond_with_engine?f("admin.engine_badge"):f("admin.engine_badge_no")]})]})]},O.name))})]}),r.jsx(g2,{}),r.jsxs(Ge,{title:f("admin.projects_title"),description:f("admin.projects_subtitle"),children:[c&&r.jsx(nt,{}),r.jsx("ul",{className:"divide-y divide-border",children:l.map(O=>r.jsxs("li",{className:"flex items-center gap-3 py-2",children:[r.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",O.id]}),r.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${O.id}`),children:[r.jsx("span",{className:"font-medium",children:O.name||O.path.split("/").pop()}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:O.path})]}),r.jsxs(Ve,{children:[O.agents??0," ",f("admin.agents_badge")]}),Number(O.id)!==0&&r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>T(String(O.id),O.name||O.path),children:f("admin.unregister")})]},O.id))})]}),r.jsx(p2,{channel:S,onClose:()=>j(null),onSaved:()=>{j(null),k()}}),r.jsx(m2,{channel:w,onClose:()=>C(null)})]})}function Ng({label:e,value:n,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(Rf,{ok:s}),r.jsx("span",{children:n})]})]})}function h2(e){const[n,s]=x.useState(!1);x.useEffect(()=>{try{s(localStorage.getItem(e)==="true")}catch{}},[e]);const o=x.useCallback(()=>s(l=>{const c=!l;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:n,toggle:o}}function Fz({collapsed:e,onToggle:n}){return r.jsx(Tt,{content:f(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),side:"bottom",children:r.jsx("button",{type:"button",onClick:n,"aria-label":f(e?"settings_ui.expand_menu":"settings_ui.collapse_menu"),className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:r.jsx(ek,{className:Oe("size-4 transition-transform",e&&"rotate-180")})})})}function Yz({sections:e,active:n,onChange:s,collapsed:o=!1}){return r.jsx("nav",{className:Oe("hidden md:flex shrink-0 flex-col gap-1 py-3 transition-all",o?"w-12 items-center px-1":"w-52 px-2"),children:e.map((l,c)=>r.jsxs("div",{className:Oe("w-full",c>0&&"mt-2"),children:[!o&&l.title&&r.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:l.title}),r.jsx("div",{className:"space-y-0.5",children:l.items.map(({key:d,label:p,icon:m,badge:g})=>{const h=n===d,_=r.jsxs("button",{type:"button",onClick:()=>s(d),"data-testid":`tabnav-${d||"index"}`,className:Oe("flex cursor-pointer items-center rounded-lg transition-colors",o?"size-9 justify-center":"w-full gap-2 px-2.5 py-1.5",h?"bg-accent text-accent-fg":"text-muted-fg hover:bg-accent/60 hover:text-foreground"),children:[r.jsx(m,{className:"size-4 shrink-0"}),!o&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"flex-1 truncate text-left text-xs",children:p}),g!==void 0&&r.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:g})]})]});return o?r.jsx(Tt,{content:p,side:"right",children:_},d):r.jsx(x.Fragment,{children:_},d)})})]},c))})}const x2=x.createContext(null),b2=x.createContext(null),_2=x.createContext(""),v2=x.createContext(null),y2=x.createContext(null),j2=x.createContext(null);function Xz({children:e}){const[n,s]=x.useState(null),[o,l]=x.useState(""),[c,d]=x.useState(null);return r.jsx(b2.Provider,{value:s,children:r.jsx(x2.Provider,{value:n,children:r.jsx(v2.Provider,{value:l,children:r.jsx(_2.Provider,{value:o,children:r.jsx(j2.Provider,{value:d,children:r.jsx(y2.Provider,{value:c,children:e})})})})})})}function Kz(){return x.useContext(x2)}function Qz(e,n){const s=x.useContext(b2);x.useEffect(()=>(s?.({collapsed:e,toggle:n}),()=>s?.(null)),[e,n,s])}function Zz(){return x.useContext(_2)}function Wz(e){const n=x.useContext(v2);x.useEffect(()=>(n?.(e),()=>n?.("")),[e,n])}function Jz(){return x.useContext(y2)}function eD(e){const n=x.useContext(j2);x.useEffect(()=>(n?.(e),()=>n?.(null)),[e,n])}function w2({sections:e,active:n,onChange:s,collapsed:o,onToggleCollapse:l,actions:c,contentClassName:d,testId:p,children:m}){return Qz(o,l),r.jsxs("div",{className:"flex h-full",children:[r.jsx(Yz,{sections:e,active:n,onChange:s,collapsed:o}),r.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-hidden",children:[c?r.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 px-6 pt-3",children:c}):null,r.jsx("div",{className:Oe("flex-1 min-h-0 overflow-y-auto",d),"data-testid":p,children:m})]})]})}const W1={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 k2({mood:e="happy",className:n}){const s=W1[e]??W1.happy,[o,l]=s.eyes,c="text-emerald-700 dark:text-emerald-600/70";return r.jsxs("div",{"aria-hidden":!0,className:Et("select-none whitespace-pre font-mono leading-none text-emerald-400",n),children:[s.top&&r.jsx("div",{children:r.jsx("span",{className:c,children:` ${s.top}`})}),r.jsx("div",{children:" ▄███████▄"}),r.jsxs("div",{children:[" █ ",r.jsx("span",{className:c,children:"██"})," ",r.jsx("span",{className:c,children:"██"})," █"]}),r.jsx("div",{children:` █ ${o} ${l} █`}),r.jsx("div",{children:` █ ${s.mouth} █`}),r.jsx("div",{children:" ▀███████▀"})]})}function S2({mood:e="confused",title:n,titleClassName:s,message:o,action:l,className:c,testId:d}){return r.jsx("div",{className:Et("grid h-full place-items-center p-8",c),"data-testid":d,children:r.jsxs("div",{className:"flex flex-col items-center text-center",children:[r.jsx(k2,{mood:e,className:"mb-6 text-sm"}),n!=null&&r.jsx("div",{className:Et("font-mono font-semibold leading-none tracking-tight text-foreground",s),children:n}),o!=null&&r.jsx("p",{className:"mt-4 max-w-sm text-sm text-muted-fg",children:o}),l&&r.jsx("div",{className:"mt-6",children:l})]})})}function J1({pid:e}){const n=Qe(`/projects/${e}/tasks?state=open`,()=>_r.list(e)),s=Qe(`/projects/${e}/routines`,()=>br.list(e)),o=Qe(`/projects/${e}/agents`,()=>tn.list(e)),l=Qe(`/projects/${e}/mcps`,()=>vr.list(e));return r.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[r.jsx(Bi,{title:f("project.overview.tasks_open"),value:n.data?.length??"…",href:`/p/${e}/tasks`,icon:dc}),r.jsx(Bi,{title:f("project.overview.routines"),value:s.data?.length??"…",href:`/p/${e}/routines`,icon:_l}),r.jsx(Bi,{title:f("project.overview.agents"),value:o.data?.length??"…",href:`/p/${e}/agents`,icon:gn}),r.jsx(Bi,{title:f("project.overview.mcps"),value:l.data?.length??"…",href:`/p/${e}/mcps`,icon:gh}),r.jsx(Bi,{title:f("project.overview.chat"),value:f("project.overview.chat_value"),href:`/p/${e}/chat`,icon:Od})]})}function Bi({title:e,value:n,href:s,icon:o}){return r.jsxs(Iw,{to:s,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[r.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:r.jsx(o,{size:20})}),r.jsxs("div",{children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"text-2xl font-semibold",children:n})]})]})}function tD(){const e=la(),{projects:n,isLoading:s}=Oc();return r.jsxs(Ge,{title:f("base.workspaces_title"),description:f("base.workspaces_desc"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[r.jsx(nn,{size:14})," ",f("base.workspaces_new")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(pt,{children:f("base.workspaces_empty")}),r.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(o=>{const l=String(o.id)==="0",c=l?f("base.title"):o.name||o.path.split("/").pop()||String(o.id);return r.jsxs("button",{type:"button",onClick:()=>e(`/p/${o.id}`),className:"flex cursor-pointer flex-col gap-2 rounded-xl border border-border bg-card p-4 text-left transition-colors hover:border-muted-fg/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Kw,{className:"size-4 text-muted-fg"}),r.jsx("span",{className:"truncate text-sm font-semibold",children:c}),r.jsx(Ve,{tone:l?"success":"info",children:l?f("base.title"):GS(o.kind)})]}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:o.path})]},o.id)})})]})}const C2=x.createContext(null),E2=x.createContext(null);function cs(){const e=x.useContext(C2);if(e===null)throw new Error(Mn(60));return e}function N2(){const e=x.useContext(E2);if(e===null)throw new Error(Mn(61));return e}const nD=(e,n)=>Object.is(e,n);function El(e,n,s){return e==null||n==null?Object.is(e,n):s(e,n)}function aD(e,n,s){return!e||e.length===0?!1:e.some(o=>o===void 0?!1:El(n,o,s))}function oc(e,n,s){return!e||e.length===0?-1:e.findIndex(o=>o===void 0?!1:El(o,n,s))}function sD(e,n,s){return e.filter(o=>!El(n,o,s))}function Vh(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function R2(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function rD(e){if(!Array.isArray(e))return e!=null&&"null"in e;const n=e;if(R2(n)){for(const s of n)for(const o of s.items)if(o&&o.value==null&&o.label!=null)return!0;return!1}for(const s of n)if(s&&s.value==null&&s.label!=null)return!0;return!1}function T2(e,n){if(n&&e!=null)return n(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 Vh(e)}function cl(e,n){return n&&e!=null?n(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Vh(e.value):Vh(e)}function A2(e,n,s){function o(){return T2(e,s)}if(s&&e!=null)return s(e);if(e&&typeof e=="object"&&"label"in e&&e.label!=null)return e.label;if(n&&!Array.isArray(n))return n[e]??o();if(Array.isArray(n)){const l=n,c=R2(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 oD(e,n,s){return e.reduce((o,l,c)=>(c>0&&o.push(", "),o.push(r.jsx(x.Fragment,{children:A2(l,n,s)},c)),o),[])}const We={id:ze(e=>e.id),labelId:ze(e=>e.labelId),modal:ze(e=>e.modal),multiple:ze(e=>e.multiple),items:ze(e=>e.items),itemToStringLabel:ze(e=>e.itemToStringLabel),itemToStringValue:ze(e=>e.itemToStringValue),isItemEqualToValue:ze(e=>e.isItemEqualToValue),value:ze(e=>e.value),hasSelectedValue:ze(e=>{const{value:n,multiple:s,itemToStringValue:o}=e;return n==null?!1:s&&Array.isArray(n)?n.length>0:cl(n,o)!==""}),hasNullItemLabel:ze((e,n)=>n?rD(e.items):!1),open:ze(e=>e.open),mounted:ze(e=>e.mounted),forceMount:ze(e=>e.forceMount),transitionStatus:ze(e=>e.transitionStatus),openMethod:ze(e=>e.openMethod),activeIndex:ze(e=>e.activeIndex),selectedIndex:ze(e=>e.selectedIndex),isActive:ze((e,n)=>e.activeIndex===n),isSelected:ze((e,n,s)=>{const o=e.isItemEqualToValue,l=e.value;return e.multiple?Array.isArray(l)&&l.some(c=>El(s,c,o)):e.selectedIndex===n&&e.selectedIndex!==null?!0:El(s,l,o)}),isSelectedByFocus:ze((e,n)=>e.selectedIndex===n),popupProps:ze(e=>e.popupProps),triggerProps:ze(e=>e.triggerProps),triggerElement:ze(e=>e.triggerElement),positionerElement:ze(e=>e.positionerElement),listElement:ze(e=>e.listElement),popupSide:ze(e=>e.popupSide),scrollUpArrowVisible:ze(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:ze(e=>e.scrollDownArrowVisible),hasScrollArrows:ze(e=>e.hasScrollArrows)};function Zi(e,n=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(n,Math.min(e,s))}const Va=1;function gb(e,n){return Math.max(0,e-n)}function Wd(e,n){if(n<=0)return 0;const s=Zi(e,0,n),o=s,l=n-s,c=o<=Va,d=l<=Va;return c&&d?o<=l?0:n:c?0:d?n:s}function lD(e){const{id:n,value:s,defaultValue:o=null,onValueChange:l,open:c,defaultOpen:d=!1,onOpenChange:p,name:m,form:g,autoComplete:h,disabled:_=!1,readOnly:v=!1,required:k=!1,modal:S=!0,actionsRef:j,inputRef:w,onOpenChangeComplete:C,items:E,multiple:N=!1,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:O=nD,highlightItemOnHover:A=!0,children:z}=e,{clearErrors:B}=XS(),{setDirty:L,setTouched:D,setFocused:P,shouldValidateOnChange:H,validityData:q,setFilled:Y,name:V,disabled:$,validation:Z,validationMode:G}=zc(),X=Af({id:n}),U=$||_,K=V??m,[F,J]=vc({controlled:s,default:N?o??mc:o,name:"Select",state:"value"}),[ie,re]=vc({controlled:c,default:d,name:"Select",state:"open"}),oe=x.useRef([]),ce=x.useRef([]),ee=x.useRef(null),Te=x.useRef(null),Fe=x.useRef(0),_e=x.useRef(null),Se=x.useRef([]),Ne=x.useRef(!1),Pe=x.useRef(!1),Ie=x.useRef(null),be=x.useRef(null),Ae=x.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),we=x.useRef(!1),{mounted:Be,setMounted:Xe,transitionStatus:Ye}=Tc(ie),{openMethod:De,triggerProps:ve}=Mz(ie),le=va(()=>new fS({id:X,labelId:void 0,modal:S,multiple:N,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:O,value:F,open:ie,mounted:Be,transitionStatus:Ye,items:E,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,je=tt(le,We.activeIndex),ke=tt(le,We.selectedIndex),Ue=tt(le,We.triggerElement),Je=tt(le,We.positionerElement),yt=T4(De),zt=De??yt,pe=x.useMemo(()=>N&&Array.isArray(F)&&F.length===0?"":cl(F,T),[N,F,T]),Ee=x.useMemo(()=>N&&Array.isArray(F)?F.map(it=>cl(it,T)):cl(F,T),[N,F,T]),Re=mn(le.state.triggerElement),qe=Le(()=>Ee);cb(Re,X,F,qe);const st=x.useRef(F),an=N?Array.isArray(F)&&F.length>0:F!=null;Me(()=>{F!==st.current&&le.set("forceMount",!0)},[le,F]),Me(()=>{Y(an)},[an,Y]),Me(function(){const Dt=Se.current;let kn;if(N){const rn=Array.isArray(F)?F:[];if(rn.length===0)kn=null;else{const At=rn[rn.length-1],hn=oc(Dt,At,O);kn=hn===-1?null:hn}}else{const rn=oc(Dt,F,O);kn=rn===-1?null:rn}kn===null&&(be.current=null),!ie&&le.set("selectedIndex",kn)},[an,N,ie,F,Se,O,le,be]),ub(F,()=>{B(K),L(F!==q.initialValue),H()?Z.commit(F):Z.commit(F,!0)});const Vt=Le((it,Dt)=>{if(p?.(it,Dt),!Dt.isCanceled&&(re(it),!it&&(Dt.reason===bf||Dt.reason===Nx)&&(D(!0),P(!1),G==="onBlur"&&Z.commit(F)),!it&&le.state.activeIndex!==null)){const kn=oe.current[le.state.activeIndex];queueMicrotask(()=>{kn?.setAttribute("tabindex","-1")})}}),mt=Le(()=>{Xe(!1),le.update({activeIndex:null,openMethod:null}),C?.(!1)});zr({enabled:!j,open:ie,ref:ee,onComplete(){ie||mt()}}),x.useImperativeHandle(j,()=>({unmount:mt}),[mt]);const Rt=Le((it,Dt)=>{l?.(it,Dt),!Dt.isCanceled&&J(it)}),Wt=Le(()=>{const it=le.state.listElement||ee.current;if(!it)return;const Dt=gb(it.scrollHeight,it.clientHeight),kn=Wd(it.scrollTop,Dt),rn=kn>0,At=kn<Dt;le.state.scrollUpArrowVisible!==rn&&le.set("scrollUpArrowVisible",rn),le.state.scrollDownArrowVisible!==At&&le.set("scrollDownArrowVisible",At)}),kt=jS({open:ie,onOpenChange:Vt,elements:{reference:Ue,floating:Je}}),sn=M3(kt,{enabled:!v&&!U,event:"mousedown"}),Ft=Ux(kt),dn=Z5(kt,{enabled:!v&&!U,listRef:oe,activeIndex:je,selectedIndex:ke,disabledIndices:mc,onNavigate(it){it===null&&!ie||le.set("activeIndex",it)},focusItemOnHover:A}),On=W5(kt,{enabled:!v&&!U&&(ie||!N),listRef:ce,activeIndex:je,selectedIndex:ke,onMatch(it){ie?le.set("activeIndex",it):Rt(Se.current[it],lt("none"))},onTyping(it){Ne.current=it}}),Kn=x.useMemo(()=>{const it=Da(On.reference,dn.reference,Ft.reference,sn.reference,ve);return X&&(it.id=X),it},[sn.reference,On.reference,dn.reference,Ft.reference,ve,X]),ca=x.useMemo(()=>Da(Sf,On.floating,dn.floating,Ft.floating),[On.floating,dn.floating,Ft.floating]),Qn=dn.item??un;yx(()=>{le.update({popupProps:ca,triggerProps:Kn})}),Me(()=>{le.update({id:X,modal:S,multiple:N,value:F,open:ie,mounted:Be,transitionStatus:Ye,popupProps:ca,triggerProps:Kn,items:E,itemToStringLabel:R,itemToStringValue:T,isItemEqualToValue:O,openMethod:zt})},[le,X,S,N,F,ie,Be,Ye,ca,Kn,E,R,T,O,zt]);const us=x.useMemo(()=>({store:le,name:K,required:k,disabled:U,readOnly:v,multiple:N,highlightItemOnHover:A,setValue:Rt,setOpen:Vt,listRef:oe,popupRef:ee,scrollHandlerRef:Te,handleScrollArrowVisibility:Wt,scrollArrowsMountedCountRef:Fe,itemProps:Qn,events:kt.context.events,valueRef:_e,valuesRef:Se,labelsRef:ce,typingRef:Ne,selectionRef:Ae,firstItemTextRef:Ie,selectedItemTextRef:be,validation:Z,onOpenChangeComplete:C,keyboardActiveRef:Pe,alignItemWithTriggerActiveRef:we,initialValueRef:st}),[le,K,k,U,v,N,A,Rt,Vt,Qn,kt.context.events,Z,C,Wt]),zn=Vs(w,Z.inputRef),ua=N&&Array.isArray(F)&&F.length>0,Ia=N?void 0:K,ds=x.useMemo(()=>!N||!Array.isArray(F)||!K?null:F.map(it=>{const Dt=cl(it,T);return r.jsx("input",{type:"hidden",form:g,name:K,value:Dt},Dt)}),[N,F,g,K,T]);return r.jsx(C2.Provider,{value:us,children:r.jsxs(E2.Provider,{value:kt,children:[z,r.jsx("input",{...Z.getInputValidationProps({onFocus(){le.state.triggerElement?.focus({focusVisible:!0})},onChange(it){if(it.nativeEvent.defaultPrevented||U||v){it.preventBaseUIHandler?.();return}const Dt=it.currentTarget.value,kn=lt(Hs,it.nativeEvent);function rn(){if(N)return;const At=Se.current.find(hn=>cl(hn,T).toLowerCase()===Dt.toLowerCase()||T2(hn,R).toLowerCase()===Dt.toLowerCase());At!=null&&(L(At!==q.initialValue),Rt(At,kn),H()&&Z.commit(At))}le.set("forceMount",!0),queueMicrotask(rn)}}),id:X&&Ia==null?`${X}-hidden-input`:void 0,form:g,name:Ia,autoComplete:h,value:pe,disabled:U,required:k&&!ua,readOnly:v,ref:zn,style:K?Rk:Ax,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ds]})})}function iD(e,n){return e??n}function cD(e){const n=e.getBoundingClientRect(),s=Qt(e),o=s.getComputedStyle(e,"::before"),l=s.getComputedStyle(e,"::after");if(!(o.content!=="none"||l.content!=="none"))return n;const d=parseFloat(o.width)||0,p=parseFloat(o.height)||0,m=parseFloat(l.width)||0,g=parseFloat(l.height)||0,h=Math.max(n.width,d,m),_=Math.max(n.height,p,g),v=h-n.width,k=_-n.height;return{left:n.left-v/2,right:n.right+v/2,top:n.top-k/2,bottom:n.bottom+k/2}}const od=2,uD=400,dD={...d4,...ib,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},fD=x.forwardRef(function(n,s){const{render:o,className:l,id:c,disabled:d=!1,nativeButton:p=!0,style:m,...g}=n,{setTouched:h,setFocused:_,validationMode:v,state:k,disabled:S}=zc(),{labelId:j}=Tf(),{store:w,setOpen:C,selectionRef:E,validation:N,readOnly:R,required:T,alignItemWithTriggerActiveRef:O,disabled:A,keyboardActiveRef:z}=cs(),B=S||A||d,L=tt(w,We.open),D=tt(w,We.mounted),P=tt(w,We.value),H=tt(w,We.triggerProps),q=tt(w,We.positionerElement),Y=tt(w,We.listElement),V=tt(w,We.popupSide),$=tt(w,We.id),Z=tt(w,We.labelId),G=tt(w,We.hasSelectedValue),X=D&&q?V:null,U=c??$,K=iD(j,Z);Af({id:U});const F=mn(q),J=x.useRef(null),{getButtonProps:ie,buttonRef:re}=Ul({disabled:B,native:p}),oe=Le(Ne=>{w.set("triggerElement",Ne)}),ce=Vs(s,J,re,oe),ee=sa(),Te=sa(),Fe=sa();x.useEffect(()=>{if(L)return Fe.start(uD,()=>{E.current.allowUnselectedMouseUp=!0,E.current.allowSelectedMouseUp=!0}),()=>{Fe.clear()};E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},Te.clear()},[L,E,Te,Fe]);const _e=Da(H,{id:U,role:"combobox","aria-expanded":L?"true":"false","aria-haspopup":"listbox","aria-controls":L?Y?.id??Pd(q)?.id:void 0,"aria-labelledby":K,"aria-readonly":R||void 0,"aria-required":T||void 0,tabIndex:B?-1:0,ref:ce,onFocus(Ne){_(!0),L&&O.current&&C(!1,lt(Hs,Ne.nativeEvent)),ee.start(0,()=>{w.set("forceMount",!0)})},onBlur(Ne){Ze(q,Ne.relatedTarget)||(h(!0),_(!1),v==="onBlur"&&N.commit(P))},onPointerMove(){z.current=!1},onKeyDown(){z.current=!0},onMouseDown(Ne){if(L)return;const Pe=vt(Ne.currentTarget);function Ie(be){if(!J.current)return;const Ae=be.target;if(Ze(J.current,Ae)||Ze(F.current,Ae)||Ae===J.current)return;const we=cD(J.current);be.clientX>=we.left-od&&be.clientX<=we.right+od&&be.clientY>=we.top-od&&be.clientY<=we.bottom+od||C(!1,lt(TM,be))}Te.start(0,()=>{Pe.addEventListener("mouseup",Ie,{once:!0})})}},N.getValidationProps,g,ie);_e.role="combobox";const Se={...k,open:L,disabled:B,value:P,readOnly:R,popupSide:X,placeholder:!G};return Ht("button",n,{ref:[s,J],state:Se,stateAttributesMapping:dD,props:_e})}),pD={value:()=>null},mD=x.forwardRef(function(n,s){const{className:o,render:l,children:c,placeholder:d,style:p,...m}=n,{store:g,valueRef:h}=cs(),_=tt(g,We.value),v=tt(g,We.items),k=tt(g,We.itemToStringLabel),S=tt(g,We.hasSelectedValue),j=!S&&d!=null&&c==null,w=tt(g,We.hasNullItemLabel,j),C={value:_,placeholder:!S};let E=null;return typeof c=="function"?E=c(_):c!=null?E=c:!S&&d!=null&&!w?E=d:Array.isArray(_)?E=oD(_,v,k):E=A2(_,v,k),Ht("span",n,{state:C,ref:[s,h],props:[{children:E},m],stateAttributesMapping:pD})}),gD=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,{store:p}=cs(),g={open:tt(p,We.open)};return Ht("span",n,{state:g,ref:s,props:[{"aria-hidden":!0,children:"▼"},d],stateAttributesMapping:kS})}),hD=x.createContext(void 0),xD=x.forwardRef(function(n,s){const{store:o}=cs(),l=tt(o,We.mounted),c=tt(o,We.forceMount);return l||c?r.jsx(hD.Provider,{value:!0,children:r.jsx(eS,{ref:s,...n})}):null}),M2=x.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function bD(){return x.useContext(M2)}function hb(e){const{children:n,elementsRef:s,labelsRef:o,onMapChange:l}=e,c=Le(l),d=x.useRef(0),p=va(vD).current,m=va(_D).current,[g,h]=x.useState(0),_=x.useRef(g),v=Le((C,E)=>{m.set(C,E??null),_.current+=1,h(_.current)}),k=Le(C=>{m.delete(C),_.current+=1,h(_.current)}),S=x.useMemo(()=>{const C=new Map;return Array.from(m.keys()).filter(N=>N.isConnected).sort(yD).forEach((N,R)=>{const T=m.get(N)??{};C.set(N,{...T,index:R})}),C},[m,g]);Me(()=>{if(typeof MutationObserver!="function"||S.size===0)return;const C=new MutationObserver(E=>{const N=new Set,R=T=>N.has(T)?N.delete(T):N.add(T);E.forEach(T=>{T.removedNodes.forEach(R),T.addedNodes.forEach(R)}),N.size===0&&(_.current+=1,h(_.current))});return S.forEach((E,N)=>{N.parentElement&&C.observe(N.parentElement,{childList:!0})}),()=>{C.disconnect()}},[S]),Me(()=>{_.current===g&&(s.current.length!==S.size&&(s.current.length=S.size),o&&o.current.length!==S.size&&(o.current.length=S.size),d.current=S.size),c(S)},[c,S,s,o,g]),Me(()=>()=>{s.current=[]},[s]),Me(()=>()=>{o&&(o.current=[])},[o]);const j=Le(C=>(p.add(C),()=>{p.delete(C)}));Me(()=>{p.forEach(C=>C(S))},[p,S]);const w=x.useMemo(()=>({register:v,unregister:k,subscribeMapChange:j,elementsRef:s,labelsRef:o,nextIndexRef:d}),[v,k,j,s,o,d]);return r.jsx(M2.Provider,{value:w,children:n})}function _D(){return new Map}function vD(){return new Set}function yD(e,n){const s=e.compareDocumentPosition(n);return s&Node.DOCUMENT_POSITION_FOLLOWING||s&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_CONTAINS?1:0}const O2=x.createContext(void 0);function xb(){const e=x.useContext(O2);if(!e)throw new Error(Mn(59));return e}function Jd(e,n){e&&Object.assign(e.style,n)}const z2={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},jD=20;function wD(e,n,s,o){const[l,c]=x.useState(!1);Me(()=>{if(!e||!n||s==null){c(!1);return}const d=vt(s).documentElement.clientWidth,p=s.offsetWidth;c(d>0&&p>0&&p>=d-jD)},[e,n,s]),i2(e&&(!n||l),o)}const kD={position:"fixed"},SD=x.forwardRef(function(n,s){const{anchor:o,positionMethod:l="absolute",className:c,render:d,side:p="bottom",align:m="center",sideOffset:g=0,alignOffset:h=0,collisionBoundary:_="clipping-ancestors",collisionPadding:v,arrowPadding:k=5,sticky:S=!1,disableAnchorTracking:j,alignItemWithTrigger:w=!0,collisionAvoidance:C=j3,style:E,...N}=n,{store:R,listRef:T,labelsRef:O,alignItemWithTriggerActiveRef:A,selectedItemTextRef:z,valuesRef:B,initialValueRef:L,popupRef:D,setValue:P}=cs(),H=N2(),q=tt(R,We.open),Y=tt(R,We.mounted),V=tt(R,We.modal),$=tt(R,We.value),Z=tt(R,We.openMethod),G=tt(R,We.positionerElement),X=tt(R,We.triggerElement),U=tt(R,We.isItemEqualToValue),K=tt(R,We.transitionStatus),F=x.useRef(null),J=x.useRef(null),[ie,re]=x.useState(w),oe=Y&&ie&&Z!=="touch";!Y&&ie!==w&&re(w),Me(()=>{Y||(We.scrollUpArrowVisible(R.state)&&R.set("scrollUpArrowVisible",!1),We.scrollDownArrowVisible(R.state)&&R.set("scrollDownArrowVisible",!1))},[R,Y]),x.useImperativeHandle(A,()=>oe),wD((oe||V)&&q,Z==="touch",G,X);const ce=AS({anchor:o,floatingRootContext:H,positionMethod:l,mounted:Y,side:p,sideOffset:g,align:m,alignOffset:h,arrowPadding:k,collisionBoundary:_,collisionPadding:v,sticky:S,disableAnchorTracking:j??oe,collisionAvoidance:C,keepMounted:!0}),ee=oe?"none":ce.side,Te=oe?kD:ce.positionerStyles,Fe={open:q,side:ee,align:ce.align,anchorHidden:ce.anchorHidden};Me(()=>{R.set("popupSide",ce.side)},[R,ce.side]);const _e=Le(be=>{R.set("positionerElement",be)}),Se=MS(n,Fe,{styles:Te,transitionStatus:K,props:N,refs:[s,_e],hidden:!Y,inert:!q}),Ne=x.useRef(0),Pe=Le(be=>{if(be.size===0&&Ne.current===0||B.current.length===0)return;const Ae=Ne.current;if(Ne.current=be.size,be.size===Ae)return;const we=lt(Hs);if(Ae!==0&&!R.state.multiple&&$!==null&&oc(B.current,$,U)===-1){const Xe=L.current,De=Xe!=null&&oc(B.current,Xe,U)!==-1?Xe:null;P(De,we),De===null&&(R.set("selectedIndex",null),z.current=null)}if(Ae!==0&&R.state.multiple&&Array.isArray($)){const Be=Ye=>oc(B.current,Ye,U)!==-1,Xe=$.filter(Ye=>Be(Ye));(Xe.length!==$.length||Xe.some(Ye=>!aD($,Ye,U)))&&(P(Xe,we),Xe.length===0&&(R.set("selectedIndex",null),z.current=null))}if(q&&oe){R.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Be={height:""};Jd(G,Be),Jd(D.current,Be)}}),Ie=x.useMemo(()=>({...ce,side:ee,alignItemWithTriggerActive:oe,setControlledAlignItemWithTrigger:re,scrollUpArrowRef:F,scrollDownArrowRef:J}),[ce,ee,oe,re]);return r.jsx(hb,{elementsRef:T,labelsRef:O,onMapChange:Pe,children:r.jsxs(O2.Provider,{value:Ie,children:[Y&&V&&r.jsx(o2,{inert:Kx(!q),cutout:X}),Se]})})}),ld="base-ui-disable-scrollbar",qh={className:ld,getElement(e){return r.jsx("style",{nonce:e,href:ld,precedence:"base-ui:low",children:`.${ld}{scrollbar-width:none}.${ld}::-webkit-scrollbar{display:none}`})}},CD=x.createContext(void 0);function ED(e){return x.useContext(CD)}const ND=x.createContext(void 0),RD={disableStyleElements:!1};function TD(){return x.useContext(ND)??RD}const AD={...Bl,...Il},MD=x.forwardRef(function(n,s){const{render:o,className:l,style:c,finalFocus:d,...p}=n,{store:m,popupRef:g,onOpenChangeComplete:h,setOpen:_,valueRef:v,firstItemTextRef:k,selectedItemTextRef:S,keyboardActiveRef:j,multiple:w,handleScrollArrowVisibility:C,scrollHandlerRef:E,listRef:N,highlightItemOnHover:R}=cs(),{side:T,align:O,alignItemWithTriggerActive:A,isPositioned:z,setControlledAlignItemWithTrigger:B,scrollDownArrowRef:L,scrollUpArrowRef:D}=xb(),P=ED()!=null,H=N2(),q=Yx(),{nonce:Y,disableStyleElements:V}=TD(),$=tt(m,We.id),Z=tt(m,We.open),G=tt(m,We.mounted),X=tt(m,We.popupProps),U=tt(m,We.transitionStatus),K=tt(m,We.triggerElement),F=tt(m,We.positionerElement),J=tt(m,We.listElement),ie=x.useRef(!1),re=x.useRef(!1),oe=x.useRef({}),ce=yl(),ee=Le(Se=>{if(!F||!g.current||!re.current)return;if(ie.current||!A){C();return}const Ne=F.style.top==="0px",Pe=F.style.bottom==="0px";if(!Ne&&!Pe){C();return}const Ie=tj(F),be=Wi(F.getBoundingClientRect().height,"y",Ie),Ae=vt(F),we=getComputedStyle(F),Be=parseFloat(we.marginTop),Xe=parseFloat(we.marginBottom),Ye=ej(getComputedStyle(g.current)),De=Math.min(Ae.documentElement.clientHeight-Be-Xe,Ye),ve=Se.scrollTop,le=id(Se);let je=0,ke=null,Ue=!1,Je=!1;const yt=Re=>{F.style.height=`${Re}px`},zt=(Re,qe)=>{const st=Zi(Re,0,De-be);st>0&&yt(be+st),Se.scrollTop=qe,De-(be+st)<=Va&&(ie.current=!0),C()},pe=Ne?le-ve:ve,Ee=Math.min(be+pe,De);if(je=Ee,pe<=Va){zt(pe,Ne?le:0);return}if(De-Ee>Va)Ne?Je=!0:ke=0;else if(Ue=!0,Pe&&ve<le){const Re=be+pe-De;ke=ve-(pe-Re)}if(je=Math.ceil(je),je!==0&&yt(je),Je||ke!=null){const Re=id(Se),qe=Je?Re:Zi(ke,0,Re);Math.abs(Se.scrollTop-qe)>Va&&(Se.scrollTop=qe)}(Ue||je>=De-Va)&&(ie.current=!0),C()});x.useImperativeHandle(E,()=>ee,[ee]),zr({open:Z,ref:g,onComplete(){Z&&h?.(!0)}});const Te={open:Z,transitionStatus:U,side:T,align:O};Me(()=>{!F||!g.current||Object.keys(oe.current).length||(oe.current={top:F.style.top||"0",left:F.style.left||"0",right:F.style.right,height:F.style.height,bottom:F.style.bottom,minHeight:F.style.minHeight,maxHeight:F.style.maxHeight,marginTop:F.style.marginTop,marginBottom:F.style.marginBottom})},[g,F]),Me(()=>{Z||A||(re.current=!1,ie.current=!1,Jd(F,oe.current))},[Z,A,F,g]),Me(()=>{const Se=g.current;if(!Z||!K||!F||!Se||A&&!z||m.state.transitionStatus==="ending")return;if(!A){re.current=!0,ce.request(C),Se.style.removeProperty("--transform-origin");return}const Ne=OD(Se);Se.style.removeProperty("--transform-origin");try{let Pe=S.current;Pe?.isConnected||(Pe=!We.hasSelectedValue(m.state)&&k.current?.isConnected?k.current:null);const Ie=v.current,be=getComputedStyle(F),Ae=getComputedStyle(Se),we=vt(K),Be=Qt(F),Xe=tj(K),Ye=cd(K.getBoundingClientRect(),Xe),De=cd(F.getBoundingClientRect(),Xe),ve=Ye.height,le=J||Se,je=le.scrollHeight,ke=parseFloat(Ae.borderBottomWidth),Ue=parseFloat(be.marginTop)||10,Je=parseFloat(be.marginBottom)||10,yt=parseFloat(be.minHeight)||100,zt=ej(Ae),pe=5,Ee=5,Re=20,qe=we.documentElement.clientHeight-Ue-Je,st=we.documentElement.clientWidth,an=qe-Ye.bottom+ve;let Vt,mt=q==="rtl"?Ye.right-De.width:Ye.left,Rt=0;if(Pe&&Ie){const zn=cd(Ie.getBoundingClientRect(),Xe);Vt=cd(Pe.getBoundingClientRect(),Xe),mt=De.left+(q==="rtl"?zn.right-Vt.right:zn.left-Vt.left);const ua=zn.top-Ye.top+zn.height/2;Rt=Vt.top-De.top+Vt.height/2-ua}const Wt=an+Rt+Je+ke;let kt=Math.min(qe,Wt);const sn=qe-Ue-Je,Ft=Wt-kt,dn=st-Ee;F.style.left=`${Zi(mt,pe,dn-De.width)}px`,F.style.height=`${kt}px`,F.style.maxHeight="auto",F.style.marginTop=`${Ue}px`,F.style.marginBottom=`${Je}px`,Se.style.height="100%";const On=id(le),Kn=Ft>=On-Va;Kn&&(kt=Math.min(qe,De.height)-(Ft-On));const ca=Ye.top<Re||Ye.bottom>qe-Re||Math.ceil(kt)+Va<Math.min(je,yt),Qn=(Be.visualViewport?.scale??1)!==1&&wx;if(ca||Qn){re.current=!0,Jd(F,oe.current),B(!1);return}const us=Math.max(yt,kt);if(Kn){const zn=Math.max(0,qe-Wt);F.style.top=De.height>=sn?"0":`${zn}px`,F.style.height=`${kt}px`,le.scrollTop=id(le)}else F.style.bottom="0",le.scrollTop=Ft;if(Vt){const zn=De.top,ua=De.height,Ia=Vt.top+Vt.height/2,ds=ua>0?(Ia-zn)/ua*100:50,it=Zi(ds,0,100);Se.style.setProperty("--transform-origin",`50% ${it}%`)}(us===qe||kt>=zt)&&(ie.current=!0),C(),R&&m.state.selectedIndex===null&&m.state.activeIndex===null&&N.current[0]!=null&&m.set("activeIndex",0),re.current=!0}finally{Ne()}},[m,Z,F,K,v,k,S,g,C,A,B,ce,L,D,J,N,R,q,z]),x.useEffect(()=>{if(!A||!F||!Z)return;const Se=Qt(F);function Ne(Pe){_(!1,lt(AM,Pe))}return ft(Se,"resize",Ne)},[_,A,F,Z]);const Fe={...J?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":w||void 0,id:`${$}-list`},onKeyDown(Se){j.current=!0,P&&db.has(Se.key)&&Se.stopPropagation()},onMouseMove(){j.current=!1},onScroll(Se){J||ee(Se.currentTarget)},...A&&{style:J?{height:"100%"}:z2}},_e=Ht("div",n,{ref:[s,g],state:Te,stateAttributesMapping:AD,props:[X,Fe,Xx(U),{className:!J&&A?qh.className:void 0},p]});return r.jsxs(x.Fragment,{children:[!V&&qh.getElement(Y),r.jsx(tS,{context:H,modal:!1,disabled:!G,returnFocus:d,restoreFocus:!0,children:_e})]})});function ej(e){const n=e.maxHeight||"";return n.endsWith("px")&&parseFloat(n)||1/0}function id(e){return gb(e.scrollHeight,e.clientHeight)}function tj(e){return iS.getScale(e)}function Wi(e,n,s){return e/s[n]}function cd(e,n){return hc({x:Wi(e.x,"x",n),y:Wi(e.y,"y",n),width:Wi(e.width,"x",n),height:Wi(e.height,"y",n)})}const nj=[["transform","none"],["scale","1"],["translate","0 0"]];function OD(e){const{style:n}=e,s={};for(const[o,l]of nj)s[o]=n.getPropertyValue(o),n.setProperty(o,l,"important");return()=>{for(const[o]of nj){const l=s[o];l?n.setProperty(o,l):n.removeProperty(o)}}}const zD=x.forwardRef(function(n,s){const{render:o,className:l,style:c,...d}=n,{store:p,scrollHandlerRef:m}=cs(),{alignItemWithTriggerActive:g}=xb(),h=tt(p,We.hasScrollArrows),_=tt(p,We.openMethod),v=tt(p,We.multiple),S={id:`${tt(p,We.id)}-list`,role:"listbox","aria-multiselectable":v||void 0,onScroll(w){m.current?.(w.currentTarget)},...g&&{style:z2},className:h&&_!=="touch"?qh.className:void 0},j=Le(w=>{p.set("listElement",w)});return Ht("div",n,{ref:[s,j],props:[S,d]})});let D2=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function bb(e={}){const{label:n,metadata:s,textRef:o,indexGuessBehavior:l,index:c}=e,{register:d,unregister:p,subscribeMapChange:m,elementsRef:g,labelsRef:h,nextIndexRef:_}=bD(),v=x.useRef(-1),[k,S]=x.useState(c??(l===D2.GuessFromOrder?()=>{if(v.current===-1){const C=_.current;_.current+=1,v.current=C}return v.current}:-1)),j=x.useRef(null),w=x.useCallback(C=>{if(j.current=C,k!==-1&&C!==null&&(g.current[k]=C,h)){const E=n!==void 0;h.current[k]=E?n:o?.current?.textContent??C.textContent}},[k,g,h,n,o]);return Me(()=>{if(c!=null)return;const C=j.current;if(C)return d(C,s),()=>{p(C)}},[c,d,p,s]),Me(()=>{if(c==null)return m(C=>{const E=j.current?C.get(j.current)?.index:null;E!=null&&S(E)})},[c,m,S]),x.useMemo(()=>({ref:w,index:k}),[k,w])}const L2=x.createContext(void 0);function _b(){const e=x.useContext(L2);if(!e)throw new Error(Mn(57));return e}const DD=x.memo(x.forwardRef(function(n,s){const{render:o,className:l,style:c,value:d=null,label:p,disabled:m=!1,nativeButton:g=!1,...h}=n,_=x.useRef(null),v=bb({label:p,textRef:_,indexGuessBehavior:D2.GuessFromOrder}),{store:k,itemProps:S,setOpen:j,setValue:w,selectionRef:C,typingRef:E,valuesRef:N,multiple:R,selectedItemTextRef:T}=cs(),O=tt(k,We.isActive,v.index),A=tt(k,We.isSelected,v.index,d),z=tt(k,We.isSelectedByFocus,v.index),B=tt(k,We.isItemEqualToValue),L=v.index,D=L!==-1,P=x.useRef(null);Me(()=>{if(!D)return;const J=N.current;return J[L]=d,()=>{delete J[L]}},[D,L,d,N]),Me(()=>{if(!D)return;const J=k.state.value;let ie=J;R&&Array.isArray(J)&&J.length>0&&(ie=J[J.length-1]),ie!==void 0&&El(d,ie,B)&&(k.set("selectedIndex",L),_.current&&(T.current=_.current))},[D,L,R,B,k,d,T]);const H=x.useRef(null),q=x.useRef("mouse"),Y=x.useRef(!1),{getButtonProps:V,buttonRef:$}=Ul({disabled:m,focusableWhenDisabled:!0,native:g,composite:!0}),Z={disabled:m,selected:A,highlighted:O};function G(J){const ie=k.state.value;if(R){const re=Array.isArray(ie)?ie:[],oe=A?sD(re,d,B):[...re,d];w(oe,lt(rg,J))}else w(d,lt(rg,J)),j(!1,lt(rg,J))}function X(){C.current.dragY=0}const U={role:"option","aria-selected":A,tabIndex:O?0:-1,onKeyDown(J){H.current=J.key,k.set("activeIndex",L),J.key===" "&&E.current&&J.preventDefault()},onClick(J){const ie=J.type==="click"&&q.current!=="touch",re=J.nativeEvent.pointerType,oe=ie&&kx(J.nativeEvent)&&(re!==void 0||O),ce=ie&&!oe&&!Y.current;Y.current=!1,!(J.type==="keydown"&&H.current===null)&&(m||J.type==="keydown"&&H.current===" "&&E.current||ce||(H.current=null,G(J.nativeEvent)))},onPointerEnter(J){q.current=J.pointerType},onPointerMove(J){if(J.pointerType==="mouse"&&J.buttons===1){const ie=C.current;ie.dragY+=J.movementY,ie.dragY**2>=64&&(ie.allowUnselectedMouseUp=!0)}},onPointerDown(J){q.current=J.pointerType,Y.current=!0,X()},onMouseUp(){if(X(),m||q.current==="touch"||Y.current)return;const J=!C.current.allowSelectedMouseUp&&A,ie=!C.current.allowUnselectedMouseUp&&!A;J||ie||(Y.current=!0,P.current?.click(),Y.current=!1)}},K=Ht("div",n,{ref:[$,s,v.ref,P],state:Z,props:[S,U,h,V]}),F=x.useMemo(()=>({selected:A,index:L,textRef:_,selectedByFocus:z,hasRegistered:D}),[A,L,_,z,D]);return r.jsx(L2.Provider,{value:F,children:K})})),LD=x.forwardRef(function(n,s){const o=n.keepMounted??!1,{selected:l}=_b();return o||l?r.jsx(PD,{...n,ref:s}):null}),PD=x.memo(x.forwardRef((e,n)=>{const{render:s,className:o,style:l,keepMounted:c,...d}=e,{selected:p}=_b(),m=x.useRef(null),{transitionStatus:g,setMounted:h}=Tc(p),v=Ht("span",e,{ref:[n,m],state:{selected:p,transitionStatus:g},props:[{"aria-hidden":!0,children:"✔️"},d],stateAttributesMapping:Il});return zr({open:p,ref:m,onComplete(){p||h(!1)}}),v})),ID=x.memo(x.forwardRef(function(n,s){const{index:o,textRef:l,selectedByFocus:c,hasRegistered:d}=_b(),{firstItemTextRef:p,selectedItemTextRef:m}=cs(),{render:g,className:h,style:_,...v}=n,k=x.useCallback(j=>{j&&(d&&o===0&&(p.current=j),d&&c&&(m.current=j))},[p,m,o,c,d]);return Ht("div",n,{ref:[k,s,l],props:v})})),P2=x.forwardRef(function(n,s){const{render:o,className:l,style:c,direction:d,keepMounted:p=!1,...m}=n,g=d==="up",{store:h,popupRef:_,listRef:v,handleScrollArrowVisibility:k,scrollArrowsMountedCountRef:S}=cs(),{side:j,scrollDownArrowRef:w,scrollUpArrowRef:C}=xb(),E=g?We.scrollUpArrowVisible:We.scrollDownArrowVisible,N=tt(h,E),R=tt(h,We.openMethod),T=N&&R!=="touch",O=sa(),A=g?C:w,{transitionStatus:z,setMounted:B}=Tc(T);Me(()=>(S.current+=1,h.state.hasScrollArrows||h.set("hasScrollArrows",!0),()=>{S.current=Math.max(0,S.current-1),S.current===0&&h.state.hasScrollArrows&&h.set("hasScrollArrows",!1)}),[h,S]),zr({open:T,ref:A,onComplete(){T||B(!1)}});const P=Ht("div",n,{ref:[s,A],state:{direction:d,visible:T,side:j,transitionStatus:z},props:[{"aria-hidden":!0,children:g?"▲":"▼",style:{position:"absolute"},onMouseMove(q){if(q.movementX===0&&q.movementY===0||O.isStarted())return;h.set("activeIndex",null);function Y(){const V=h.state.listElement??_.current;if(!V)return;h.set("activeIndex",null),k();const $=gb(V.scrollHeight,V.clientHeight),Z=Wd(V.scrollTop,$),G=Z===(g?0:$),X=v.current;if(Z!==V.scrollTop&&(V.scrollTop=Z),X.length===0&&h.set(g?"scrollUpArrowVisible":"scrollDownArrowVisible",!G),G){O.clear();return}if(X.length>0){const U=A.current?.offsetHeight||0;V.scrollTop=BD(X,g,Z,V.clientHeight,U,$)}O.start(40,Y)}O.start(40,Y)},onMouseLeave(){O.clear()}},m]});return T||p?P:null});function BD(e,n,s,o,l,c){if(n){let h=0;const _=s+l-Va;for(let S=0;S<e.length;S+=1){const j=e[S];if(j&&j.offsetTop>=_){h=S;break}}const v=Math.max(0,h-1),k=e[v];return v<h&&k?Wd(k.offsetTop-l,c):0}let d=e.length-1;const p=s+o-l+Va;for(let h=0;h<e.length;h+=1){const _=e[h];if(_&&_.offsetTop+_.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?Wd(g.offsetTop+g.offsetHeight-o+l,c):c}const UD=x.forwardRef(function(n,s){return r.jsx(P2,{...n,ref:s,direction:"down"})}),HD=x.forwardRef(function(n,s){return r.jsx(P2,{...n,ref:s,direction:"up"})}),VD=lD;function qD({className:e,...n}){return r.jsx(mD,{"data-slot":"select-value",className:Et("flex flex-1 text-left",e),...n})}function $D({className:e,size:n="default",children:s,...o}){return r.jsxs(fD,{"data-slot":"select-trigger","data-size":n,className:Et("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...o,children:[s,r.jsx(gD,{render:r.jsx(Ar,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function GD({className:e,children:n,side:s="bottom",sideOffset:o=4,align:l="center",alignOffset:c=0,alignItemWithTrigger:d=!0,...p}){return r.jsx(xD,{children:r.jsx(SD,{side:s,sideOffset:o,align:l,alignOffset:c,alignItemWithTrigger:d,className:"isolate z-50",children:r.jsxs(MD,{"data-slot":"select-content","data-align-trigger":d,className:Et("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...p,children:[r.jsx(YD,{}),r.jsx(zD,{children:n}),r.jsx(XD,{})]})})})}function FD({className:e,children:n,...s}){return r.jsxs(DD,{"data-slot":"select-item",className:Et("relative flex w-full cursor-default items-center gap-2 rounded-md py-2 pr-8 pl-2.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...s,children:[r.jsx(ID,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:n}),r.jsx(LD,{render:r.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:r.jsx(uc,{className:"pointer-events-none"})})]})}function YD({className:e,...n}){return r.jsx(HD,{"data-slot":"select-scroll-up-button",className:Et("top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...n,children:r.jsx(Fw,{})})}function XD({className:e,...n}){return r.jsx(UD,{"data-slot":"select-scroll-down-button",className:Et("bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4",e),...n,children:r.jsx(Ar,{})})}function wt({value:e,onChange:n,options:s,placeholder:o="— elegir —",disabled:l,className:c,showIcon:d=!1}){return r.jsxs(VD,{value:e,onValueChange:p=>n(p??""),disabled:l,children:[r.jsx($D,{className:Oe("h-9 w-full",c),children:r.jsx(qD,{placeholder:o,children:p=>{const m=s.find(h=>h.value===p),g=d?m?.icon:void 0;return r.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[g&&r.jsx(g,{className:"size-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:m?.label??p})]})}})}),r.jsx(GD,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:s.map(p=>{const m=p.icon;return r.jsx(FD,{value:p.value,children:r.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[m?r.jsx(m,{className:"size-4 shrink-0 text-muted-fg"}):null,p.description?r.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[r.jsx("span",{className:"truncate font-medium",children:p.label}),r.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:p.description})]}):r.jsx("span",{className:"truncate",children:p.label})]})},p.value)})})]})}const aj=320;function KD(e){const n=new Date(e);return Number.isNaN(n.getTime())?e:n.toLocaleString(void 0,{month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function QD(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function ZD({m:e}){const[n,s]=x.useState(!1),o=(e.body?.length||0)>aj,l=!o||n?e.body:`${e.body.slice(0,aj)}…`;return r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?r.jsx(qw,{size:14,className:"text-blue-400"}):r.jsx(Gw,{size:14,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:KD(e.ts)}),r.jsx(Ve,{tone:"info",children:e.channel}),e.type&&r.jsx(Ve,{children:e.type}),r.jsx("span",{className:"font-medium text-foreground",children:QD(e)})]}),e.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:l}),o&&r.jsx("button",{type:"button",onClick:()=>s(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:f(n?"logs.show_less":"logs.show_more")})]})]})}function WD(){const[e,n]=x.useState(!1),s=Qe(e?"/admin/logs?errors":null,()=>kl.logs("errors",200)),o=s.data?.entries||[];return r.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:l=>n(l.target.open),children:[r.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[f("logs.daemon_errors"),o.length?` · ${o.length}`:""]}),r.jsxs("div",{className:"border-t border-border p-3",children:[s.isLoading&&r.jsx(nt,{}),e&&!s.isLoading&&o.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:f("logs.no_errors")}),r.jsx("ul",{className:"space-y-1",children:o.map((l,c)=>r.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof l.ts=="string"&&r.jsx("span",{className:"font-mono",children:new Date(l.ts).toLocaleString()}),typeof l.level=="string"&&r.jsx("span",{className:"text-destructive",children:l.level})]}),r.jsx("p",{className:"whitespace-pre-wrap break-words font-mono",children:String(l.msg??l.message??l.error??l.raw??JSON.stringify(l)).slice(0,500)})]},c))})]})]})}function JD({pid:e}){const n=!e||String(e)==="0",[s,o]=x.useState(""),[l,c]=x.useState(""),[d,p]=x.useState(""),[m,g]=x.useState(""),h=s.trim()||void 0,_=n?`/messages/global?channel=${h??""}`:`/projects/${e}/messages?channel=${h??""}`,v=Qe(_,()=>n?Ph.global({channel:h,limit:300}):Ph.project(e,{channel:h,limit:300})),k=x.useMemo(()=>[...v.data||[]].sort((w,C)=>(C.ts||"").localeCompare(w.ts||"")),[v.data]),S=x.useMemo(()=>Array.from(new Set(k.map(w=>w.type).filter(Boolean))),[k]),j=x.useMemo(()=>k.filter(w=>!(l&&w.direction!==l||d&&w.type!==d||m&&!(w.body||"").toLowerCase().includes(m.toLowerCase()))),[k,l,d,m]);return r.jsxs(Ge,{title:f("logs.title"),description:f(n?"logs.desc_global":"logs.desc_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ce,{placeholder:f("logs.filter_channel"),value:s,onChange:w=>o(w.target.value),className:"w-44"}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>v.mutate(),children:r.jsx(os,{size:13})})]}),children:[n&&r.jsx(WD,{}),r.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[r.jsx("div",{className:"w-36",children:r.jsx(wt,{value:l,onChange:c,placeholder:f("logs.filter_dir"),options:[{value:"",label:f("logs.all_directions")},{value:"in",label:f("logs.in")},{value:"out",label:f("logs.out")}]})}),r.jsx("div",{className:"w-40",children:r.jsx(wt,{value:d,onChange:p,placeholder:f("logs.filter_type"),options:[{value:"",label:f("logs.all_types")},...S.map(w=>({value:w,label:w}))]})}),r.jsx(Ce,{placeholder:f("logs.search_text"),value:m,onChange:w=>g(w.target.value),className:"w-56"}),r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[j.length," ",f("logs.count_of")," ",k.length]})]}),v.isLoading&&r.jsx(nt,{}),v.error&&r.jsx(pt,{children:f("logs.error",{msg:v.error.message})}),!v.isLoading&&!v.error&&j.length===0&&r.jsx(pt,{children:h?f("logs.no_activity_ch",{ch:h}):f("logs.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:j.map((w,C)=>r.jsx(ZD,{m:w},`${w.ts}-${C}`))})]})}function I2({value:e,onChange:n,options:s,placeholder:o=f("shared_ui.model_combobox_ph"),invalid:l,invalidHint:c,className:d}){const[p,m]=x.useState(!1),[g,h]=x.useState(e),_=x.useRef(null),v=x.useRef(null),[k,S]=x.useState(null);x.useEffect(()=>{h(e)},[e]),x.useLayoutEffect(()=>{if(!p)return;const N=()=>{const R=_.current;if(!R)return;const T=R.getBoundingClientRect();S({top:T.bottom+4,left:T.left,width:T.width})};return N(),window.addEventListener("scroll",N,!0),window.addEventListener("resize",N),()=>{window.removeEventListener("scroll",N,!0),window.removeEventListener("resize",N)}},[p]),x.useEffect(()=>{if(!p)return;const N=R=>{const T=R.target;_.current?.contains(T)||v.current?.contains(T)||m(!1)};return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[p]);const j=g.trim().toLowerCase(),C=j&&!(g===e)?s.filter(N=>N.toLowerCase().includes(j)):s,E=N=>{n(N),h(N),m(!1)};return r.jsxs("div",{ref:_,className:Oe("relative",d),children:[r.jsxs("div",{className:Oe("flex items-center gap-1 rounded-lg border bg-background px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring",l?"border-amber-500/60":"border-border"),children:[l&&r.jsx("span",{title:c||f("models_ui.invalid_hint"),children:r.jsx(ak,{className:"size-3.5 shrink-0 text-amber-400"})}),r.jsx("input",{value:g,placeholder:o,onChange:N=>{h(N.target.value),n(N.target.value),m(!0)},onFocus:()=>m(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),r.jsx("button",{type:"button",tabIndex:-1,onClick:()=>m(N=>!N),className:"shrink-0 text-muted-fg hover:text-foreground",children:r.jsx(Ar,{className:"size-4"})})]}),p&&C.length>0&&k&&Tr.createPortal(r.jsx("ul",{ref:v,style:{position:"fixed",top:k.top,left:k.left,width:k.width},className:"z-[1000] max-h-56 overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:C.map(N=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:R=>{R.preventDefault(),E(N)},className:Oe("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",N===e&&"bg-accent/50"),children:r.jsx("span",{className:"truncate font-mono text-xs",children:N})})},N))}),document.body)]})}function Lr(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/admin/config",()=>kl.config.get()),l=async(c,d)=>{const p=await kl.config.patch({set:c,unset:d});return await o({config:p.config},{revalidate:!1}),p.config};return{config:e?.config||{},error:n,isLoading:s,mutate:o,patch:l}}function B2(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/admin/super-agent",()=>kl.superAgent());return{superAgent:e,error:n,isLoading:s,mutate:o}}const eL={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"},tL={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 Rg(e,n){return n&&n in e?e[n]:e.custom}const ef={anthropic:ls,openai:gn,gemini:eA,groq:dc,openrouter:px,ollama:tk,azure:HT,mock:Xw,custom:zl},io={anthropic:{base_url:"",default_model:"claude-sonnet-4.6",api_key_env:"ANTHROPIC_API_KEY",known_models:["claude-opus-4.8","claude-opus-4.7","claude-opus-4.6","claude-sonnet-4.6","claude-sonnet-4.5","claude-haiku-4.5"]},openai:{base_url:"https://api.openai.com/v1",default_model:"gpt-4o-mini",api_key_env:"OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","o3-mini"]},gemini:{base_url:"https://generativelanguage.googleapis.com/v1beta/openai",default_model:"gemini-2.5-flash",api_key_env:"GEMINI_API_KEY",known_models:["gemini-3.5-pro","gemini-3.5-flash","gemini-3.1-pro","gemini-3.1-flash","gemini-2.5-pro","gemini-2.5-flash","gemini-2.5-flash-lite"]},groq:{base_url:"https://api.groq.com/openai/v1",default_model:"llama-3.3-70b-versatile",api_key_env:"GROQ_API_KEY",known_models:["llama-3.3-70b-versatile","llama-3.1-8b-instant","meta-llama/llama-4-scout-17b-16e-instruct","openai/gpt-oss-120b","openai/gpt-oss-20b","groq/compound","groq/compound-mini","qwen/qwen3-32b","whisper-large-v3-turbo"]},openrouter:{base_url:"https://openrouter.ai/api/v1",default_model:"openrouter/auto",api_key_env:"OPENROUTER_API_KEY",known_models:["openrouter/auto","openrouter/free","deepseek/deepseek-r1:free","meta-llama/llama-3.3-70b-instruct:free","google/gemini-2.0-flash-exp:free","qwen/qwen3-235b-a22b:free","anthropic/claude-sonnet-4.5","openai/gpt-4o-mini"]},ollama:{base_url:"http://127.0.0.1:11434",default_model:"gemma2:9b",api_key_env:"",known_models:[]},azure:{base_url:"",default_model:"gpt-4o-mini",api_key_env:"AZURE_OPENAI_API_KEY",known_models:["gpt-4o","gpt-4o-mini"]},mock:{base_url:"",default_model:"mock",api_key_env:"",known_models:["mock"]},custom:{base_url:"",default_model:"",api_key_env:"",known_models:[]}};function U2(e){const n=e.indexOf(":");return n<0?{provider:e,model:""}:{provider:e.slice(0,n),model:e.slice(n+1)}}function Tg({value:e,onChange:n,providers:s}){const{provider:o,model:l}=U2(e),c=s.find(h=>h.slug===o),d=!!o&&!c,p=x.useMemo(()=>{const h=c?io[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...h]))},[c]),m=h=>{const _=s.find(k=>k.slug===h),v=_?.default_model||io[_?.engine]?.default_model||"";n(v?`${h}:${v}`:`${h}:`)},g=h=>n(`${o}:${h}`);return r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsx(wt,{value:o,onChange:m,placeholder:d?f("router_panel.provider_not_found",{name:o}):f("router_panel.provider_ph"),options:s.map(h=>({value:h.slug,label:h.slug,icon:ef[h.engine]}))}),r.jsx(I2,{value:l,onChange:g,options:p,invalid:d,invalidHint:f("router_panel.provider_not_configured",{name:o})})]})}function nL(){const e=at(),{superAgent:n,isLoading:s,mutate:o}=B2(),{config:l,patch:c}=Lr(),[d,p]=x.useState(""),[m,g]=x.useState([]),[h,_]=x.useState(""),[v,k]=x.useState(null),[S,j]=x.useState(!1),[w,C]=x.useState({model:"",fallback:[]});x.useEffect(()=>{if(!n)return;const L=n.model_fallback?.models||[],D=Array.isArray(L)?L:[];p(n.model||""),g(D),C({model:n.model||"",fallback:D})},[n]);const E=x.useMemo(()=>{const L=l.engines||{};return Object.entries(L).map(([D,P])=>({slug:D,engine:P?.engine||D,default_model:P?.default_model||io[P?.engine||D]?.default_model}))},[l.engines]),N=L=>{const{provider:D}=U2(L);return E.some(P=>P.slug===D)};if(s||!n)return r.jsx(nt,{});const R=d!==w.model||JSON.stringify(m)!==JSON.stringify(w.fallback),T=async()=>{j(!0);try{await c({"super_agent.model":d,"super_agent.model_fallback.enabled":m.length>0,"super_agent.model_fallback.models":m}),e.success(f("router_panel.saved_toast")),C({model:d,fallback:m}),o()}catch(L){e.error(L.message)}finally{j(!1)}},O=()=>{const L=h.trim().replace(/:$/,"");!L||!L.includes(":")||m.includes(L)||(g([...m,L]),_(""))},A=(L,D)=>{const P=[...m];P[L]=D,g(P)},z=L=>{g(m.filter((D,P)=>P!==L)),v===L&&k(null)},B=(L,D)=>{const P=L+D;if(P<0||P>=m.length)return;const H=[...m];[H[L],H[P]]=[H[P],H[L]],g(H)};return r.jsx(Ge,{title:f("router_panel.title"),description:f("router_panel.description"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs(Ve,{tone:"success",children:[r.jsx(px,{size:11})," ",f("router_panel.badge_default")]}),r.jsx("span",{className:`font-mono text-xs ${!N(d)&&d?"text-amber-400":""}`,children:d||"—"}),m.map(L=>r.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[r.jsx($w,{size:12}),r.jsx("span",{className:`font-mono text-xs ${N(L)?"":"text-amber-400"}`,children:L})]},L))]}),E.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:f("router_panel.no_providers")}):r.jsx(de,{label:f("router_panel.active_model_label"),hint:f("router_panel.active_model_hint"),children:r.jsx(Tg,{value:d,onChange:p,providers:E})}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2",children:[r.jsx("div",{className:"text-sm font-medium",children:f("router_panel.fallback_title")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("router_panel.fallback_desc")})]}),r.jsxs("ul",{className:"mb-3 space-y-1",children:[m.map((L,D)=>{const P=!N(L),H=v===D;return r.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"w-6 text-muted-fg",children:["#",D+1]}),H?r.jsx("div",{className:"flex-1",children:r.jsx(Tg,{value:L,onChange:q=>A(D,q),providers:E})}):r.jsxs("button",{type:"button",onClick:()=>k(D),className:"flex flex-1 items-center gap-1.5 text-left",children:[P&&r.jsx(ak,{size:12,className:"text-amber-400"}),r.jsx("span",{className:`font-mono ${P?"text-amber-400":""}`,children:L})]}),H?r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>k(null),children:f("router_panel.done")}):r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>k(D),children:r.jsx(Ol,{size:12})}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>B(D,-1),disabled:D===0,children:"↑"}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>B(D,1),disabled:D===m.length-1,children:"↓"}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>z(D),children:r.jsx(ia,{size:12})})]})},`${D}-${L}`)}),m.length===0&&r.jsx("li",{className:"text-xs text-muted-fg",children:f("router_panel.fallback_empty")})]}),E.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-xs text-muted-fg",children:f("router_panel.add_to_chain")}),r.jsx(Tg,{value:h,onChange:_,providers:E}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:O,disabled:!h.includes(":")||h.endsWith(":"),children:[r.jsx(nn,{size:13})," ",f("router_panel.add_to_chain")]})]})]}),r.jsx(ge,{variant:"primary",loading:S,disabled:!R,onClick:T,children:f(R?"router_panel.save":"router_panel.saved")})]})})}function aL({provider:e,onEdit:n,onDelete:s,onToggle:o}){const l=Rg(eL,e.engine),c=Rg(tL,e.engine),d=Rg(ef,e.engine),p=lc.find(_=>_.value===e.engine)?.label||e.engine,m=typeof e.api_key=="string"&&e.api_key.length>0,g=Cl(e.api_key),h=e.is_active!==!1;return r.jsxs("div",{className:"group flex h-full cursor-pointer flex-col gap-3 rounded-xl border border-border bg-card p-4 transition-colors hover:border-muted-fg/50",onClick:n,children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:Oe("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",l),children:r.jsx(d,{className:"size-5 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),r.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),r.jsxs("span",{className:Oe("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[r.jsx(d,{className:"size-3"})," ",p]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[r.jsx(Tt,{content:f(h?"providers_modal.toggle_active":"providers_modal.toggle_inactive"),children:r.jsxs("button",{type:"button",onClick:_=>{_.stopPropagation(),o()},className:Oe("flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[10px] font-medium transition-colors",h?"border-emerald-500/40 text-emerald-400 hover:bg-emerald-500/10":"border-border text-muted-fg hover:text-foreground"),children:[r.jsx("span",{className:Oe("size-1.5 rounded-full",h?"bg-emerald-400":"bg-muted-fg/40")}),f(h?"providers_card.active":"providers_card.off")]})}),r.jsx(Tt,{content:f("providers_modal.delete"),children:r.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),s()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:r.jsx(ia,{className:"size-3.5"})})})]})]}),r.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[r.jsx(Ui,{label:f("providers_card.model"),value:e.default_model||"—",mono:!0}),e.base_url&&r.jsx(Ui,{label:f("providers_card.base_url"),value:e.base_url,mono:!0,truncate:!0}),r.jsx(Ui,{label:f("providers_card.api_key"),value:m?g?`…${g}`:f("providers_card.key_set"):"—",mono:!!g}),e.default_temperature!==void 0&&r.jsx(Ui,{label:f("providers_card.temp"),value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&r.jsx(Ui,{label:f("providers_card.price_io"),value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function Ui({label:e,value:n,mono:s,truncate:o}){return r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:e}),r.jsx("span",{className:Oe("text-foreground",s&&"font-mono",o&&"max-w-[180px] truncate"),children:n})]})}const sj={name:"",slug:"",engine:"anthropic",base_url:"",api_key_value:"",default_model:"",default_temperature:.7,default_max_tokens:4096,is_active:!0,context_limit_tokens:2e5,model_context_limits_json:"",p_input:"",p_output:"",p_cache_read:"",p_cache_write:""},sL=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function Hi(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function ud(e){if(e==null)return"";const n=Number(e);return Number.isFinite(n)?String(n):""}function rL(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:ud(e.pricing?.input_per_million),p_output:ud(e.pricing?.output_per_million),p_cache_read:ud(e.pricing?.cache_read_per_million),p_cache_write:ud(e.pricing?.cache_write_per_million)}}function oL({open:e,initial:n,existingSlugs:s,onClose:o,onSave:l}){const c=!!n,[d,p]=x.useState(sj),[m,g]=x.useState(!1),[h,_]=x.useState(null),[v,k]=x.useState([]),[S,j]=x.useState(!1),[w,C]=x.useState(null),[E,N]=x.useState(!1),[R,T]=x.useState("");x.useEffect(()=>{if(!e)return;const G=n?rL(n):sj;p(G),_(null),C(null),N(!1);const X=io[G.engine];k(X?.known_models||[])},[e,n]);const O=G=>p(X=>({...X,...G})),A=G=>{const X=io[G];O({engine:G,name:G==="custom"?d.name:lc.find(U=>U.value===G)?.label||G,slug:G==="custom"?d.slug:G,base_url:X.base_url,default_model:X.default_model}),k(X.known_models),C(null)},z=G=>{const X=io[G];O({engine:G,base_url:d.base_url||X.base_url,default_model:d.default_model||X.default_model}),k(X.known_models)},B=async()=>{j(!0),C(null);try{const G=await Kd.models({engine:d.engine,slug:d.slug||Hi(d.name),base_url:d.base_url||void 0,api_key:d.api_key_value||void 0});if(G.error){C(G.error);return}k(G.models),G.models.length===0&&C(f("providers_modal.err_no_models"))}catch(G){C(G.message||f("providers_modal.err_list_models"))}finally{j(!1)}},L=x.useMemo(()=>d.default_model&&!v.includes(d.default_model)?[d.default_model,...v]:v,[v,d.default_model]),D=()=>{const G=(d.slug||Hi(d.name)).trim();if(!G)return _(f("providers_modal.err_slug_required")),null;if(!c&&s.includes(G))return _(f("providers_modal.err_slug_exists",{slug:G})),null;let X;if(d.model_context_limits_json.trim())try{const F=JSON.parse(d.model_context_limits_json);if(!F||typeof F!="object"||Array.isArray(F))throw new Error;X=F}catch{return _(f("providers_modal.err_model_limits_json")),null}const K=[d.p_input,d.p_output,d.p_cache_read,d.p_cache_write].map(F=>F.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:X,pricing:K},modelLimits:X}},P=()=>{const G=D();if(!G)return;const{provider:X}=G,U={name:X.name,engine:X.engine,is_active:X.is_active!==!1,default_temperature:X.default_temperature,default_max_tokens:X.default_max_tokens};X.base_url&&(U.base_url=X.base_url),X.default_model&&(U.default_model=X.default_model),X.context_limit_tokens&&(U.context_limit_tokens=X.context_limit_tokens),X.model_context_limits&&(U.model_context_limits=X.model_context_limits),X.pricing&&(U.pricing=X.pricing),d.api_key_value.trim()&&(U.api_key=d.api_key_value.trim()),T(JSON.stringify(U,null,2)),_(null),N(!0)},H=async()=>{g(!0),_(null);try{if(E){const X=(d.slug||Hi(d.name)).trim();if(!X){_(f("providers_modal.err_slug_required_form"));return}let U;try{U=JSON.parse(R)}catch{_(f("providers_modal.err_json_invalid"));return}if(!U||typeof U!="object"||Array.isArray(U)){_(f("providers_modal.err_json_object"));return}const K=U;if(!K.engine||typeof K.engine!="string"){_(f("providers_modal.err_engine_missing"));return}const F={slug:X,name:typeof K.name=="string"?K.name:X,engine:String(K.engine),base_url:typeof K.base_url=="string"?K.base_url:void 0,default_model:typeof K.default_model=="string"?K.default_model:void 0,is_active:K.is_active!==!1};await l({provider:F,raw:K,originalSlug:n?.slug}),o();return}const G=D();if(!G)return;await l({provider:G.provider,apiKeyValue:d.api_key_value.trim()||void 0,originalSlug:n?.slug}),o()}catch(G){_(G.message||f("providers_modal.err_save"))}finally{g(!1)}},q=c&&qa(n?.api_key),Y=Cl(n?.api_key),V=q?f("providers_modal.api_key_set",{suffix:Y??""}):"sk-…",$=d.engine==="ollama",Z=io[d.engine]?.api_key_env;return r.jsx(Vn,{open:e,onClose:o,title:c?f("providers_modal.edit_title",{name:n?.name||n?.slug||""}):f("providers_modal.new_title"),description:f("providers_modal.description"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:o,disabled:m,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:H,loading:m,children:f(c?"common.save":"common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[c?r.jsx("span",{}):r.jsx("div",{className:"flex flex-wrap gap-1.5",children:sL.map(G=>{const X=ef[G],U=G==="custom"?f("providers_modal.custom"):lc.find(F=>F.value===G)?.label||G,K=d.engine===G;return r.jsxs("button",{type:"button",onClick:()=>A(G),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${K?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:border-muted-fg/60 hover:text-foreground"}`,children:[r.jsx(X,{className:"size-3.5"})," ",U]},G)})}),r.jsxs("button",{type:"button",onClick:()=>E?N(!1):P(),className:`flex shrink-0 items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${E?"border-sky-500/50 bg-sky-500/10 text-sky-400":"border-border text-muted-fg hover:text-foreground"}`,children:[r.jsx(DT,{className:"size-3.5"})," ",f(E?"providers_modal.form_mode":"providers_modal.json_mode")]})]}),E?r.jsxs("div",{className:"space-y-2",children:[r.jsx(de,{label:f("providers_modal.json_label"),hint:f("providers_modal.json_hint",{slug:d.slug||Hi(d.name)||"<slug>"}),children:r.jsx(cn,{rows:14,className:"font-mono text-xs",value:R,onChange:G=>T(G.target.value),spellCheck:!1})}),r.jsx("p",{className:"text-[11px] text-muted-fg",children:f("providers_modal.json_help")})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("providers_modal.name_label"),children:r.jsx(Ce,{value:d.name,onChange:G=>O({name:G.target.value,slug:c?d.slug:Hi(G.target.value)}),placeholder:f("providers_modal.name_ph")})}),r.jsx(de,{label:f("providers_modal.engine_label"),children:r.jsx(wt,{value:d.engine,onChange:G=>z(G),options:lc.map(G=>({value:G.value,label:G.label,icon:ef[G.value]}))})})]}),r.jsx(de,{label:f("providers_modal.base_url_label"),hint:f("providers_modal.base_url_hint"),children:r.jsx(Ce,{value:d.base_url,onChange:G=>O({base_url:G.target.value}),placeholder:f("providers_modal.base_url_ph")})}),!$&&r.jsx(de,{label:f("providers_modal.api_key_label"),hint:q?f("providers_modal.api_key_hint_existing"):Z?f("providers_modal.api_key_hint_env",{env:Z}):f("providers_modal.api_key_hint"),children:r.jsx(Ce,{type:"password",autoComplete:"new-password",value:d.api_key_value,onChange:G=>O({api_key_value:G.target.value}),placeholder:V})}),r.jsx(de,{label:f("providers_modal.model_label"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(I2,{value:d.default_model,onChange:G=>O({default_model:G}),options:L,className:"flex-1"}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:B,disabled:S,title:f("providers_modal.list_models_hint"),"aria-label":f("providers_modal.list_models_hint"),children:[S?r.jsx(uf,{className:"size-3.5 animate-spin"}):r.jsx(os,{className:"size-3.5"}),f("providers_modal.load_models")]})]}),w&&r.jsx("p",{className:"text-[11px] text-amber-400",children:w})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("providers_modal.max_tokens_label"),children:r.jsx(Ce,{type:"number",min:256,step:256,value:d.default_max_tokens,onChange:G=>O({default_max_tokens:parseInt(G.target.value)||4096})})}),r.jsx(de,{label:f("providers_modal.temperature_label",{value:d.default_temperature.toFixed(1)}),children:r.jsx("input",{type:"range",min:0,max:2,step:.1,value:d.default_temperature,onChange:G=>O({default_temperature:parseFloat(G.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),r.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[r.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:f("providers_modal.pricing_summary")}),r.jsxs("div",{className:"mt-3 space-y-3",children:[r.jsx(de,{label:f("providers_modal.context_limit_label"),children:r.jsx(Ce,{type:"number",min:0,step:1024,value:d.context_limit_tokens,onChange:G=>O({context_limit_tokens:parseInt(G.target.value)||0})})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("providers_modal.price_input"),children:r.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_input,onChange:G=>O({p_input:G.target.value}),placeholder:"0.15"})}),r.jsx(de,{label:f("providers_modal.price_output"),children:r.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_output,onChange:G=>O({p_output:G.target.value}),placeholder:"0.60"})}),r.jsx(de,{label:f("providers_modal.price_cache_read"),children:r.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_cache_read,onChange:G=>O({p_cache_read:G.target.value}),placeholder:"0.03"})}),r.jsx(de,{label:f("providers_modal.price_cache_write"),children:r.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_cache_write,onChange:G=>O({p_cache_write:G.target.value}),placeholder:"0.00"})})]}),r.jsx(de,{label:f("providers_modal.model_limits_label"),hint:'{"gpt-4o-mini":128000}',children:r.jsx(cn,{rows:3,className:"font-mono text-xs",value:d.model_context_limits_json,onChange:G=>O({model_context_limits_json:G.target.value})})})]})]}),r.jsx(Zt,{checked:d.is_active,onChange:G=>O({is_active:G}),label:f("providers_modal.active_label")})]}),h&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:h})]})})}const lL=new Set(lc.map(e=>e.value));function iL(e,n){const s=typeof n.engine=="string"&&n.engine||(lL.has(e)?e:"custom");return{slug:e,name:typeof n.name=="string"?n.name:void 0,engine:s,base_url:typeof n.base_url=="string"?n.base_url:void 0,api_key:typeof n.api_key=="string"?n.api_key:void 0,default_model:typeof n.default_model=="string"?n.default_model:void 0,default_temperature:typeof n.default_temperature=="number"?n.default_temperature:void 0,default_max_tokens:typeof n.default_max_tokens=="number"?n.default_max_tokens:void 0,is_active:typeof n.is_active=="boolean"?n.is_active:void 0,context_limit_tokens:typeof n.context_limit_tokens=="number"?n.context_limit_tokens:void 0,model_context_limits:n.model_context_limits||void 0,pricing:n.pricing||void 0}}function cL(){const e=at(),{config:n,isLoading:s,patch:o,mutate:l}=Lr(),[c,d]=x.useState(!1),[p,m]=x.useState(null);if(s)return r.jsx(nt,{});const g=n.engines||{},h=Object.entries(g).map(([C,E])=>iL(C,E||{})),_=h.map(C=>C.slug),v=()=>{m(null),d(!0)},k=C=>{m(C),d(!0)},S=async({provider:C,apiKeyValue:E,raw:N})=>{if(N){await o({[`engines.${C.slug}`]:N}),e.success(f("engines_panel.saved_json")),l();return}const R=`engines.${C.slug}`,T={[`${R}.name`]:C.name,[`${R}.engine`]:C.engine,[`${R}.is_active`]:C.is_active!==!1,[`${R}.default_temperature`]:C.default_temperature,[`${R}.default_max_tokens`]:C.default_max_tokens},O=[],A=(z,B)=>{B===void 0||B===""?O.push(`${R}.${z}`):T[`${R}.${z}`]=B};A("base_url",C.base_url),A("default_model",C.default_model),A("context_limit_tokens",C.context_limit_tokens),A("pricing",C.pricing),A("model_context_limits",C.model_context_limits),E&&(T[`${R}.api_key`]=E),await o(T,O),e.success(f("engines_panel.saved")),l()},j=async C=>{try{await o({[`engines.${C.slug}.is_active`]:C.is_active===!1}),l()}catch(E){e.error(E.message)}},w=async C=>{if(confirm(f("engines_panel.delete_confirm",{name:C.name||C.slug})))try{await o(void 0,[`engines.${C.slug}`]),e.success(f("engines_panel.deleted")),l()}catch(E){e.error(E.message)}};return r.jsxs(Ge,{title:f("engines_panel.title"),description:f("engines_panel.description"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:v,children:[r.jsx(nn,{size:14})," ",f("engines_panel.new_btn")]}),children:[h.length===0?r.jsx(pt,{children:f("engines_panel.empty")}):r.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[h.map(C=>r.jsx(aL,{provider:C,onEdit:()=>k(C),onDelete:()=>w(C),onToggle:()=>j(C)},C.slug)),r.jsxs("button",{type:"button",onClick:v,className:"flex min-h-[120px] flex-col items-center justify-center gap-2 rounded-xl border border-dashed border-border text-muted-fg transition-colors hover:border-muted-fg/60 hover:text-foreground",children:[r.jsx(nn,{size:20}),r.jsx("span",{className:"text-sm font-medium",children:f("engines_panel.add_card")})]})]}),r.jsx(oL,{open:c,initial:p,existingSlugs:_,onClose:()=>{d(!1),m(null)},onSave:S})]})}function H2(){return r.jsxs("div",{className:"space-y-6",children:[r.jsx(nL,{}),r.jsx(cL,{})]})}function uL(){const e=at(),[n,s]=x.useState(!1),l=Qe(n?"/agents/vault?include_removed=1":"/agents/vault",()=>tn.vault({includeRemoved:n})),c=l.data||[],[d,p]=x.useState(null),m=async h=>{const _=h.source!=="user",v=_?f("base.defaults_tombstone_msg",{slug:h.slug}):f("base.defaults_delete_msg",{slug:h.slug});if(confirm(v))try{await tn.vaultRemove(h.slug),e.success(f(_?"base.defaults_hidden":"base.defaults_deleted")),l.mutate()}catch(k){e.error(k.message)}},g=async h=>{try{await tn.vaultRestore(h),e.success(f("base.defaults_restored")),l.mutate()}catch(_){e.error(_.message)}};return r.jsxs(Ge,{title:f("base.defaults_title"),description:f("base.defaults_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zt,{checked:n,onChange:s,label:f("base.defaults_show_removed")}),r.jsxs(ge,{size:"sm",onClick:()=>p("new"),children:[r.jsx(nn,{size:14})," ",f("base.defaults_new")]})]}),children:[l.isLoading&&r.jsx(nt,{}),!l.isLoading&&c.length===0&&r.jsx(pt,{children:f("base.defaults_empty")}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(h=>{const _=n&&h.tombstoned;return r.jsxs("div",{className:`flex flex-col gap-2 rounded-xl border bg-card p-4 ${_?"border-dashed border-border opacity-60":"border-border"}`,children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[r.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-slate-600 to-gray-600",children:h.is_master?r.jsx(Bs,{className:"size-4 text-white"}):r.jsx(gn,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:h.slug}),r.jsx(dL,{source:h.source})]}),r.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:_?r.jsx(Ag,{label:f("base.defaults_restore"),onClick:()=>g(h.slug),variant:"secondary",children:r.jsx(hx,{size:13})}):r.jsxs(r.Fragment,{children:[r.jsx(Ag,{label:f("base.defaults_edit"),onClick:()=>p(h),variant:"ghost",children:r.jsx(Ol,{size:13})}),r.jsx(Ag,{label:h.source==="user"?f("base.defaults_delete"):f("base.defaults_hide"),onClick:()=>m(h),variant:"ghost-destructive",children:r.jsx(ia,{size:13})})]})})]}),h.model?r.jsx(Ve,{tone:"info",children:h.model}):r.jsx("span",{className:"text-[10px] text-muted-fg",children:f("agents_ui.model_router_default")}),h.description&&r.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:h.description}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.role&&r.jsx(Ve,{children:h.role}),h.skills?.map(v=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(ls,{size:9})," ",v]},v)),h.tools?.map(v=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(zl,{size:9})," ",v]},v))]})]},h.slug)})}),d!==null&&r.jsx(fL,{agent:d==="new"?null:d,onClose:()=>p(null),onSaved:()=>{p(null),l.mutate()}})]})}function dL({source:e}){return e==="user"?r.jsx(Ve,{tone:"success",children:f("agents_ui.source_user")}):e==="user-override"?r.jsx(Ve,{tone:"warning",children:f("agents_ui.source_override")}):r.jsx(Ve,{tone:"muted",children:f("agents_ui.source_bundled")})}function Ag({label:e,onClick:n,variant:s="ghost",children:o}){const l="inline-flex size-7 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",c={ghost:"text-muted-fg hover:bg-accent hover:text-accent-fg","ghost-destructive":"text-muted-fg hover:bg-destructive/15 hover:text-destructive",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"};return r.jsxs(Qx,{children:[r.jsx(Zx,{render:r.jsx("button",{type:"button",onClick:n,"aria-label":e,className:`${l} ${c[s]}`,children:o})}),r.jsx(Wx,{children:e})]})}function fL({agent:e,onClose:n,onSaved:s}){const o=at(),[l,c]=x.useState(!1),d=!e,[p,m]=x.useState(e?.slug??""),[g,h]=x.useState(e?.role??""),[_,v]=x.useState(e?.model??""),[k,S]=x.useState(e?.description??""),[j,w]=x.useState(e?.language??"es"),[C,E]=x.useState((e?.skills??[]).join(", ")),[N,R]=x.useState((e?.tools??[]).join(", ")),[T,O]=x.useState(!!e?.is_master),[A,z]=x.useState(e?.body??""),B=async()=>{const L={role:g||void 0,model:_||void 0,description:k||void 0,language:j||void 0,skills:C,tools:N,is_master:T};c(!0);try{if(d){if(!/^[a-z][a-z0-9_-]*$/.test(p))throw new Error(f("base.defaults_slug_invalid"));await tn.vaultCreate(p,L,A),o.success(f("base.defaults_created",{slug:p}))}else await tn.vaultPatch(e.slug,{fields:L,body:A}),o.success(f("base.defaults_saved",{slug:e.slug}));s()}catch(D){o.error(D.message)}finally{c(!1)}};return r.jsx(Vn,{open:!0,onClose:n,title:d?f("base.defaults_new_title"):f("base.defaults_edit_title",{slug:e.slug}),description:d?f("base.defaults_new_desc"):e.source==="bundled"?f("base.defaults_bundled_desc"):f("base.defaults_user_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:l,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:B,loading:l,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[d&&r.jsx(de,{label:"slug",hint:f("agents_ui.slug_kebab_hint"),children:r.jsx(Ce,{autoFocus:!0,value:p,onChange:L=>m(L.target.value),placeholder:"reviewer"})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:"role",children:r.jsx(Ce,{value:g,onChange:L=>h(L.target.value),placeholder:"Code reviewer"})}),r.jsx(de,{label:"model",children:r.jsx(Ce,{value:_,onChange:L=>v(L.target.value),placeholder:"openrouter:..."})}),r.jsx(de,{label:"language",children:r.jsx(Ce,{value:j,onChange:L=>w(L.target.value),placeholder:"es"})}),r.jsx(de,{label:"is_master",children:r.jsx("div",{className:"flex h-9 items-center",children:r.jsx(Zt,{checked:T,onChange:O,label:f("base.defaults_master_label")})})})]}),r.jsx(de,{label:"description",children:r.jsx(Ce,{value:k,onChange:L=>S(L.target.value)})}),r.jsx(de,{label:"skills",hint:f("agents_ui.comma_separated"),children:r.jsx(Ce,{value:C,onChange:L=>E(L.target.value),placeholder:"code-review, git"})}),r.jsx(de,{label:"tools",hint:f("agents_ui.comma_separated"),children:r.jsx(Ce,{value:N,onChange:L=>R(L.target.value),placeholder:"read, write, run"})}),r.jsx(de,{label:"body",hint:f("agents_ui.body_hint"),children:r.jsx(cn,{value:A,onChange:L=>z(L.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const pL={apx:"success",claude:"info",codex:"warning"};function mL(){const[e,n]=x.useState(""),s=Qe(`/sessions?engine=${e}`,()=>gO.global(e||void 0)),o=s.data?.sessions||[];return r.jsxs(Ge,{title:f("base.sessions_title"),description:f("base.sessions_desc"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-40",children:r.jsx(wt,{value:e,onChange:n,options:[{value:"",label:f("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>s.mutate(),children:r.jsx(os,{size:13})})]}),children:[s.isLoading&&r.jsx(nt,{}),s.error&&r.jsx(pt,{children:f("base.sessions_error",{msg:s.error.message})}),!s.isLoading&&!s.error&&o.length===0&&r.jsx(pt,{children:f("base.sessions_empty")}),r.jsx("ul",{className:"space-y-1 text-sm",children:o.map((l,c)=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx(Ve,{tone:pL[l.engine]||"muted",children:l.engine}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"truncate",children:l.title||l.id}),r.jsx("div",{className:"truncate font-mono text-[10px] text-muted-fg",children:l.cwd})]}),l.mtime>0&&r.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(l.mtime).toLocaleString()})]},`${l.engine}-${l.id}-${c}`))})]})}function gL(){const e=la(),[n,s]=x.useState("open"),o=Qe(`/tasks?state=${n}`,()=>_r.global(n));return r.jsxs(Ge,{title:f("project.global_tasks.title"),description:f("project.global_tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(l=>r.jsx(ge,{size:"sm",variant:n===l?"primary":"ghost",onClick:()=>s(l),children:l},l))}),children:[o.isLoading&&r.jsx(nt,{}),!o.isLoading&&(o.data?.length??0)===0&&r.jsx(pt,{children:f("project.global_tasks.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(o.data||[]).map(l=>r.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("button",{type:"button",onClick:()=>e(`/p/${l.project_id}/tasks`),title:f("project.global_tasks.go_project"),children:r.jsx(Ve,{tone:"info",children:(l.project_name||"").split("/").pop()||l.project_id})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"font-medium",children:l.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[r.jsx("span",{children:l.state}),l.agent&&r.jsxs(Ve,{tone:"muted",children:["@",l.agent]}),l.tags?.map(c=>r.jsxs("span",{children:["#",c]},c)),l.due&&r.jsxs("span",{children:[f("project.global_tasks.due")," ",l.due]})]})]})]},`${l.project_id}-${l.id}`))})]})}const V2=x.createContext(void 0);function vb(){const e=x.useContext(V2);if(e===void 0)throw new Error(Mn(64));return e}let hL=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const yb={tabActivationDirection:e=>({[hL.activationDirection]:e})},xL=x.forwardRef(function(n,s){const{className:o,defaultValue:l=0,onValueChange:c,orientation:d="horizontal",render:p,value:m,style:g,...h}=n,_=n.defaultValue!==void 0,v=x.useRef([]),[k,S]=x.useState(()=>new Map),[j,w]=vc({controlled:m,default:l,name:"Tabs",state:"value"}),C=m!==void 0,[E,N]=x.useState(()=>new Map),R=x.useCallback(oe=>{if(oe===void 0)return null;for(const[ce,ee]of E.entries())if(ee!=null&&oe===(ee.value??ee.index))return ce;return null},[E]),[T,O]=x.useState(()=>({previousValue:j,tabActivationDirection:"none"})),{previousValue:A,tabActivationDirection:z}=T;let B=z,L=!1;A!==j&&(B=rj(A,j,d,E),L=A!=null&&j!=null&&R(j)==null);const D=L?A:j,P=A!==D||z!==B;Me(()=>{P&&O({previousValue:D,tabActivationDirection:B})},[D,P,B]);const H=Le((oe,ce)=>{const ee=rj(j,oe,d,E);ce.activationDirection=ee,c?.(oe,ce),!ce.isCanceled&&w(oe)}),q=Le((oe,ce)=>{c?.(oe,lt(ce,void 0,void 0,{activationDirection:"none"}))}),Y=Le((oe,ce)=>{S(ee=>{if(ee.get(oe)===ce)return ee;const Te=new Map(ee);return Te.set(oe,ce),Te})}),V=Le((oe,ce)=>{S(ee=>{if(!ee.has(oe)||ee.get(oe)!==ce)return ee;const Te=new Map(ee);return Te.delete(oe),Te})}),$=x.useCallback(oe=>k.get(oe),[k]),Z=x.useCallback(oe=>{for(const ce of E.values())if(oe===ce?.value)return ce?.id},[E]),G=x.useMemo(()=>({getTabElementBySelectedValue:R,getTabIdByPanelValue:Z,getTabPanelIdByValue:$,onValueChange:H,orientation:d,registerMountedTabPanel:Y,setTabMap:N,unregisterMountedTabPanel:V,tabActivationDirection:B,value:j}),[R,Z,$,H,d,Y,N,V,B,j]),X=x.useMemo(()=>{for(const oe of E.values())if(oe!=null&&oe.value===j)return oe},[E,j]),U=x.useMemo(()=>{for(const oe of E.values())if(oe!=null&&!oe.disabled)return oe.value},[E]),K=x.useRef(!_),F=x.useRef(_),J=x.useRef(!1);Me(()=>{if(C)return;function oe(Fe,_e){w(Fe),O(Se=>Se.previousValue===Fe&&Se.tabActivationDirection==="none"?Se:{previousValue:Fe,tabActivationDirection:"none"}),q(Fe,_e),K.current=!1}if(E.size===0){if(!J.current||j===null)return;oe(null,J0);return}J.current=!0;const ce=X?.disabled,ee=X==null&&j!==null;if(!ce&&j===l&&(F.current=!1),F.current&&ce&&j===l)return;const Te=K.current;if(ce||ee){const Fe=U??null;if(j===Fe){K.current=!1;return}let _e=J0;Te?_e=e1:ce&&(_e=wk),oe(Fe,_e);return}Te&&X!=null&&(q(j,e1),K.current=!1)},[l,U,C,q,X,w,E,j]);const re=Ht("div",n,{state:{orientation:d,tabActivationDirection:B},ref:s,props:h,stateAttributesMapping:yb});return r.jsx(V2.Provider,{value:G,children:r.jsx(hb,{elementsRef:v,children:re})})});function rj(e,n,s,o){if(e==null||n==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),n===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 n?s==="horizontal"?n>e?"right":"left":n>e?"down":"up":"none";const d=l.getBoundingClientRect(),p=c.getBoundingClientRect();if(s==="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 q2="data-composite-item-active";function bL(e={}){const{highlightItemOnHover:n,highlightedIndex:s,onHighlightedIndexChange:o}=YS(),{ref:l,index:c}=bb(e),d=s===c,p=x.useRef(null),m=Vs(l,p);return{compositeProps:x.useMemo(()=>({tabIndex:d?0:-1,onFocus(){o(c)},onMouseMove(){const h=p.current;if(!n||!h)return;const _=h.hasAttribute("disabled")||h.ariaDisabled==="true";!d&&!_&&h.focus()}}),[d,o,c,n]),compositeRef:m,index:c}}const $2=x.createContext(void 0);function _L(){const e=x.useContext($2);if(e===void 0)throw new Error(Mn(65));return e}const vL=x.forwardRef(function(n,s){const{className:o,disabled:l=!1,render:c,value:d,id:p,nativeButton:m=!0,style:g,...h}=n,{value:_,getTabPanelIdByValue:v,orientation:k}=vb(),{activateOnFocus:S,highlightedTabIndex:j,onTabActivation:w,registerTabResizeObserverElement:C,setHighlightedTabIndex:E,tabsListElement:N}=_L(),R=Dr(p),T=x.useMemo(()=>({disabled:l,id:R,value:d}),[l,R,d]),{compositeProps:O,compositeRef:A,index:z}=bL({metadata:T}),B=d===_,L=x.useRef(!1),D=x.useRef(null);x.useEffect(()=>{const K=D.current;if(K)return C(K)},[C]),Me(()=>{if(L.current){L.current=!1;return}if(!(B&&z>-1&&j!==z))return;const K=N;if(K!=null){const F=Pn(vt(K));if(F&&Ze(K,F))return}l||E(z)},[B,z,j,E,l,N]);const{getButtonProps:P,buttonRef:H}=Ul({disabled:l,native:m,focusableWhenDisabled:!0}),q=v(d),Y=x.useRef(!1),V=x.useRef(!1);function $(K){B||l||w(d,lt(Hs,K.nativeEvent,void 0,{activationDirection:"none"}))}function Z(K){B||(z>-1&&!l&&E(z),!l&&S&&(!Y.current||Y.current&&V.current)&&w(d,lt(Hs,K.nativeEvent,void 0,{activationDirection:"none"})))}function G(K){if(B||l)return;Y.current=!0;function F(){Y.current=!1,V.current=!1}(!K.button||K.button===0)&&(V.current=!0,vt(K.currentTarget).addEventListener("pointerup",F,{once:!0}))}return Ht("button",n,{state:{disabled:l,active:B,orientation:k},ref:[s,H,A,D],props:[O,{role:"tab","aria-controls":q,"aria-selected":B,id:R,onClick:$,onFocus:Z,onPointerDown:G,[q2]:B?"":void 0,onKeyDownCapture(){L.current=!0}},h,P]})});let yL=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=po.startingStyle]="startingStyle",e[e.endingStyle=po.endingStyle]="endingStyle",e})({});const jL={...yb,...Il},wL=x.forwardRef(function(n,s){const{className:o,value:l,render:c,keepMounted:d=!1,style:p,...m}=n,{value:g,getTabIdByPanelValue:h,orientation:_,tabActivationDirection:v,registerMountedTabPanel:k,unregisterMountedTabPanel:S}=vb(),j=Dr(),w=x.useMemo(()=>({id:j,value:l}),[j,l]),{ref:C,index:E}=bb({metadata:w}),N=l===g,{mounted:R,transitionStatus:T,setMounted:O}=Tc(N),A=!R,z=h(l),B={hidden:A,orientation:_,tabActivationDirection:v,transitionStatus:T},L=x.useRef(null),D=Ht("div",n,{state:B,ref:[s,C,L],props:[{"aria-labelledby":z,hidden:A,id:j,role:"tabpanel",tabIndex:N?0:-1,inert:Kx(!N),[yL.index]:E},m],stateAttributesMapping:jL});return zr({open:N,ref:L,onComplete(){N||O(!1)}}),Me(()=>{if(!(A&&!d)&&j!=null)return k(l,j),()=>{S(l,j)}},[A,d,l,j,k,S]),d||R?D:null});function kL(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const SL=[];function CL(e){const{itemSizes:n,cols:s=1,loopFocus:o=!0,onLoop:l,dense:c=!1,orientation:d="both",direction:p,highlightedIndex:m,onHighlightedIndexChange:g,rootRef:h,enableHomeAndEndKeys:_=!1,stopEventPropagation:v=!1,disabledIndices:k,modifierKeys:S=SL}=e,[j,w]=x.useState(0),C=s>1,E=x.useRef(null),N=Vs(E,h),R=x.useRef([]),T=x.useRef(!1),O=m??j,A=Le((D,P=!1)=>{if((g??w)(D),P){const H=R.current[D];F1(E.current,H,p,d)}}),z=Le(D=>{if(D.size===0||T.current)return;T.current=!0;const P=Array.from(D.keys()),H=P.find(Y=>Y?.hasAttribute(q2))??null,q=H?P.indexOf(H):-1;q!==-1&&A(q),F1(E.current,H,p,d)}),B=Le((D,P,H)=>l?l?.(D,P,H,R):H),L=x.useMemo(()=>({"aria-orientation":d==="both"?void 0:d,ref:N,onFocus(D){const P=E.current,H=Tn(D.nativeEvent);!P||H==null||!G1(H)||H.setSelectionRange(0,H.value.length??0)},onKeyDown(D){const P=_?db:s2;if(!P.has(D.key)||EL(D,S)||!E.current)return;const q=p==="rtl",Y=q?Zd:rc,V={horizontal:Y,vertical:dl,both:Y}[d],$=q?rc:Zd,Z={horizontal:$,vertical:sc,both:$}[d],G=Tn(D.nativeEvent);if(G!=null&&G1(G)&&!kL(G)){const re=G.selectionStart,oe=G.selectionEnd,ce=G.value??"";if(re==null||D.shiftKey||re!==oe||D.key!==Z&&re<ce.length||D.key!==V&&re>0)return}let X=O;const U=jd(R,k),K=Sh(R,k);if(C){const re=n||Array.from({length:R.current.length},()=>({width:1,height:1})),oe=Mk(re,s,c),ce=oe.findIndex(Te=>Te!=null&&!Ps(R.current,Te,k)),ee=oe.reduce((Te,Fe,_e)=>Fe!=null&&!Ps(R.current,Fe,k)?_e:Te,-1);X=oe[Ak(oe.map(Te=>Te!=null?R.current[Te]:null),{event:D,orientation:d,loopFocus:o,onLoop:B,cols:s,disabledIndices:zk([...k||R.current.map((Te,Fe)=>Ps(R.current,Fe)?Fe:void 0),void 0],oe),minIndex:ce,maxIndex:ee,prevIndex:Ok(O>K?U:O,re,oe,s,D.key===dl?"bl":D.key===rc?"tr":"tl"),rtl:q})]}const F={horizontal:[Y],vertical:[dl],both:[Y,dl]}[d],J={horizontal:[$],vertical:[sc],both:[$,sc]}[d],ie=C?P:{horizontal:_?uz:n2,vertical:_?dz:a2,both:P}[d];_&&(D.key===Of?X=U:D.key===zf&&(X=K)),X===O&&(F.includes(D.key)||J.includes(D.key))&&(o&&X===K&&F.includes(D.key)?(X=U,l&&(X=l(D,O,X,R))):o&&X===U&&J.includes(D.key)?(X=K,l&&(X=l(D,O,X,R))):X=Ln(R.current,{startingIndex:X,decrement:J.includes(D.key),disabledIndices:k})),X!==O&&!xc(R.current,X)&&(v&&D.stopPropagation(),ie.has(D.key)&&D.preventDefault(),A(X,!0),queueMicrotask(()=>{R.current[X]?.focus()}))}}),[s,c,p,k,R,_,O,C,n,o,l,B,N,S,A,d,v]);return x.useMemo(()=>({props:L,highlightedIndex:O,onHighlightedIndexChange:A,elementsRef:R,disabledIndices:k,onMapChange:z,relayKeyboardEvent:L.onKeyDown}),[L,O,A,R,k,z])}function EL(e,n){for(const s of hz.values())if(!n.includes(s)&&e.getModifierState(s))return!0;return!1}function NL(e){const{render:n,className:s,style:o,refs:l=mc,props:c=mc,state:d=un,stateAttributesMapping:p,highlightedIndex:m,onHighlightedIndexChange:g,orientation:h,dense:_,itemSizes:v,loopFocus:k,onLoop:S,cols:j,enableHomeAndEndKeys:w,onMapChange:C,stopEventPropagation:E=!0,rootRef:N,disabledIndices:R,modifierKeys:T,highlightItemOnHover:O=!1,tag:A="div",...z}=e,B=Yx(),{props:L,highlightedIndex:D,onHighlightedIndexChange:P,elementsRef:H,onMapChange:q,relayKeyboardEvent:Y}=CL({itemSizes:v,cols:j,loopFocus:k,onLoop:S,dense:_,orientation:h,highlightedIndex:m,onHighlightedIndexChange:g,rootRef:N,stopEventPropagation:E,enableHomeAndEndKeys:w,direction:B,disabledIndices:R,modifierKeys:T}),V=Ht(A,e,{state:d,ref:l,props:[L,...c,z],stateAttributesMapping:p}),$=x.useMemo(()=>({highlightedIndex:D,onHighlightedIndexChange:P,highlightItemOnHover:O,relayKeyboardEvent:Y}),[D,P,O,Y]);return r.jsx(FS.Provider,{value:$,children:r.jsx(hb,{elementsRef:H,onMapChange:Z=>{C?.(Z),q(Z)},children:V})})}const RL=x.forwardRef(function(n,s){const{activateOnFocus:o=!1,className:l,loopFocus:c=!0,render:d,style:p,...m}=n,{onValueChange:g,orientation:h,value:_,setTabMap:v,tabActivationDirection:k}=vb(),[S,j]=x.useState(0),[w,C]=x.useState(null),E=x.useRef(new Set),N=x.useRef(new Set),R=x.useRef(null);x.useEffect(()=>{if(typeof ResizeObserver>"u")return;const D=new ResizeObserver(()=>{E.current.forEach(P=>{P()})});return R.current=D,w&&D.observe(w),N.current.forEach(P=>{D.observe(P)}),()=>{D.disconnect(),R.current=null}},[w]);const T=Le(D=>(E.current.add(D),()=>{E.current.delete(D)})),O=Le(D=>(N.current.add(D),R.current?.observe(D),()=>{N.current.delete(D),R.current?.unobserve(D)})),A=Le((D,P)=>{D!==_&&g(D,P)}),z={orientation:h,tabActivationDirection:k},B={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},L=x.useMemo(()=>({activateOnFocus:o,highlightedTabIndex:S,registerIndicatorUpdateListener:T,registerTabResizeObserverElement:O,onTabActivation:A,setHighlightedTabIndex:j,tabsListElement:w}),[o,S,T,O,A,j,w]);return r.jsx($2.Provider,{value:L,children:r.jsx(NL,{render:d,className:l,style:p,state:z,refs:[s,C],props:[B,m],stateAttributesMapping:yb,highlightedIndex:S,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:j,onMapChange:v,disabledIndices:mc})})});function Df({className:e,...n}){return r.jsx(xL,{"data-slot":"tabs",className:Et("flex flex-col gap-4",e),...n})}const TL=lb("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 Lf({className:e,variant:n="default",...s}){return r.jsx(RL,{"data-slot":"tabs-list","data-variant":n,className:Et(TL({variant:n}),e),...s})}function ns({className:e,...n}){return r.jsx(vL,{"data-slot":"tabs-trigger",className:Et("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),...n})}function za({className:e,...n}){return r.jsx(wL,{"data-slot":"tabs-content",className:Et("text-sm outline-none",e),...n})}function oj(e,n){let s=e;for(const o of n.split(".")){if(!s||typeof s!="object"||Array.isArray(s))return;s=s[o]}return s}function jb(e,n=""){const s={};for(const[o,l]of Object.entries(e)){const c=n?`${n}.${o}`:o;l&&typeof l=="object"&&!Array.isArray(l)?Object.assign(s,jb(l,c)):s[c]=l}return s}function AL(e){const n=JSON.parse(e);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("JSON debe ser objeto.");return n}function $h({sections:e,source:n,placeholderSource:s,jsonTitle:o,jsonDescription:l,saveLabel:c=f("common.save"),onSaveFields:d,onSaveJson:p,busy:m}){const g=e[0]?.key||"json",[h,_]=x.useState({}),[v,k]=x.useState(""),[S,j]=x.useState("");x.useEffect(()=>{const N={};for(const R of e.flatMap(T=>T.fields))N[R.path]=oj(n,R.path)??"";_(N),k(JSON.stringify(n||{},null,2)),j("")},[n,e]);const w=x.useMemo(()=>new Set(e.flatMap(N=>N.fields.map(R=>R.path))),[e]),C=async()=>{const N={},R=[];for(const T of e.flatMap(O=>O.fields)){const O=h[T.path];if(!qa(O)){if(O===""||O===void 0||O===null){R.push(T.path);continue}if(T.kind==="number"){const A=Number(O);Number.isFinite(A)&&(N[T.path]=A)}else N[T.path]=O}}await d(N,R.filter(T=>w.has(T)))},E=async()=>{j("");try{await p(AL(v))}catch(N){j(N.message)}};return r.jsxs(Df,{defaultValue:g,className:"space-y-4",children:[r.jsxs(Lf,{className:"flex flex-wrap",children:[e.map(N=>r.jsx(ns,{value:N.key,children:N.label},N.key)),r.jsx(ns,{value:"json",children:"JSON"})]}),e.map(N=>r.jsx(za,{value:N.key,children:r.jsxs("div",{className:"space-y-4",children:[N.description&&r.jsx("p",{className:"text-sm text-muted-fg",children:N.description}),r.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:N.fields.map(R=>r.jsx(ML,{field:R,value:h[R.path],inherited:oj(s,R.path),onChange:T=>_(O=>({...O,[R.path]:T}))},R.path))}),r.jsx(ge,{variant:"primary",loading:m,onClick:C,children:c})]})},N.key)),r.jsx(za,{value:"json",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"text-sm font-medium",children:o}),l&&r.jsx("p",{className:"text-xs text-muted-fg",children:l})]}),r.jsx(cn,{rows:18,className:"font-mono text-xs",value:v,onChange:N=>k(N.target.value)}),S&&r.jsx("p",{className:"text-xs text-destructive",children:S}),r.jsx(ge,{variant:"primary",loading:m,onClick:E,children:f("settings_ui.save_json")})]})})]})}function ML({field:e,value:n,inherited:s,onChange:o}){const l=e.placeholder||lj(s)||(qa(n)?Sr(n):""),c=e.hint||(s!==void 0?`Heredado: ${lj(s)}`:void 0);return e.kind==="boolean"?r.jsx("div",{className:"flex items-end pb-1",children:r.jsx(Zt,{checked:n===!0,onChange:o,label:e.label})}):r.jsx(de,{label:e.label,hint:c,children:e.kind==="select"?r.jsx(wt,{value:String(n||""),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"?r.jsx(cn,{rows:4,value:String(n||""),placeholder:l,onChange:d=>o(d.target.value)}):r.jsx(Ce,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(qa(n)?"":n||""),placeholder:e.kind==="password"&&qa(n)?Sr(n):e.kind==="password"&&qa(s)?Sr(s):l,onChange:d=>o(d.target.value)})})}function lj(e){return e==null||e===""?"":qa(e)?Sr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}function OL(){return[{key:"routing",label:f("settings_ui.cfg_overrides_label"),description:f("settings_ui.cfg_overrides_desc"),fields:[{path:"route_to_agent",label:f("settings_ui.cfg_route_to_agent"),placeholder:"master"},{path:"super_agent.model",label:f("settings_ui.cfg_super_agent_model")},{path:"super_agent.permission_mode",label:f("settings_ui.cfg_permission_mode"),kind:"select",options:bx.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:f("settings_ui.cfg_extra_prompt"),kind:"textarea"}]},{key:"telegram",label:f("settings_ui.cfg_telegram_label"),fields:[{path:"telegram.route_to_agent",label:f("settings_ui.cfg_route_to_agent")},{path:"telegram.chat_id",label:f("settings_ui.cfg_chat_id")},{path:"telegram.bot_token",label:f("settings_ui.cfg_bot_token"),kind:"password"},{path:"telegram.respond_with_engine",label:f("settings_ui.cfg_respond_with_engine"),kind:"boolean"}]},{key:"engines",label:f("settings_ui.cfg_engines_label"),fields:[{path:"engines.ollama.base_url",label:f("settings_ui.cfg_ollama_url")},{path:"engines.anthropic.api_key",label:f("settings_ui.cfg_anthropic_key"),kind:"password"},{path:"engines.openai.api_key",label:f("settings_ui.cfg_openai_key"),kind:"password"},{path:"engines.groq.api_key",label:f("settings_ui.cfg_groq_key"),kind:"password"},{path:"engines.openrouter.api_key",label:f("settings_ui.cfg_openrouter_key"),kind:"password"},{path:"engines.gemini.api_key",label:f("settings_ui.cfg_gemini_key"),kind:"password"}]}]}function zL(){return[{key:"identity",label:f("settings_ui.cfg_project_label"),description:f("settings_ui.cfg_project_desc"),fields:[{path:"name",label:f("settings_ui.cfg_name")},{path:"version",label:f("settings_ui.cfg_version")},{path:"apf",label:f("settings_ui.cfg_apc_spec")},{path:"apx",label:f("settings_ui.cfg_apx_install")},{path:"apx_id",label:f("settings_ui.cfg_apx_storage_id")}]}]}function DL({pid:e}){const n=at(),s=la(),{project:o,mutate:l}=ab(e),c=Qe(`/projects/${e}/config`,()=>aa.config.show(e)),d=String(e)==="0";if(c.isLoading)return r.jsx(nt,{});if(!c.data)return r.jsx(pt,{children:f("project.config.no_data")});const p=async g=>{await aa.apcProject.put(e,g),n.success(f("project.config.save_project")),c.mutate()},m=async g=>{await aa.config.put(e,g),n.success(f("project.config.save_override")),c.mutate()};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{title:f("project.config.section_title"),description:f("project.config.section_desc"),children:r.jsxs(Df,{defaultValue:"override",className:"space-y-4",children:[r.jsxs(Lf,{children:[r.jsx(ns,{value:"override",children:"Override"}),r.jsx(ns,{value:"project",children:"APC project"}),r.jsx(ns,{value:"effective",children:"Effective"})]}),r.jsx(za,{value:"override",children:r.jsx($h,{sections:OL(),source:c.data.project_only,placeholderSource:c.data.effective,jsonTitle:c.data.project_config_path,jsonDescription:".apc/config.json. Overrides del proyecto.",onSaveFields:async(g,h)=>{await aa.config.set(e,g),h.length&&await aa.config.unset(e,h),n.success(f("project.config.save_fields_success")),c.mutate()},onSaveJson:m})}),r.jsx(za,{value:"project",children:r.jsx($h,{sections:zL(),source:c.data.apc_project||{},jsonTitle:c.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(g,h)=>{await aa.apcProject.set(e,PL(g),h),n.success(f("project.config.save_meta_success")),c.mutate()},onSaveJson:p})}),r.jsx(za,{value:"effective",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.config.effective_read")}),r.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg border border-border bg-muted/40 p-3 text-xs",children:JSON.stringify(c.data.effective,null,2)})]})})]})}),!d&&o?r.jsx(LL,{pid:e,label:o.name||o.path,onRebuilt:()=>c.mutate(),onUnregistered:()=>{l(),s("/")}}):null]})}function LL({pid:e,label:n,onRebuilt:s,onUnregistered:o}){const l=at(),[c,d]=x.useState(null),[p,m]=x.useState(null),g=async()=>{d("rebuild");try{await aa.rebuild(e),l.success(f("project.rebuild_done")),s()}catch(_){l.error(_.message)}finally{d(null),m(null)}},h=async()=>{d("unregister");try{await aa.remove(e),l.success(f("project.unregistered")),o()}catch(_){l.error(_.message)}finally{d(null),m(null)}};return r.jsxs(r.Fragment,{children:[r.jsx(Ge,{title:f("project.danger.title"),description:f("project.danger.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-border bg-muted/30 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("project.rebuild")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.danger.rebuild_desc")})]}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>m("rebuild"),children:[r.jsx(os,{size:13})," ",f("project.rebuild")]})]}),r.jsxs("div",{className:"flex items-start justify-between gap-3 rounded-md border border-red-500/40 bg-red-500/5 px-3 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("admin.unregister")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f("project.danger.unregister_desc")})]}),r.jsxs(ge,{size:"sm",variant:"destructive",onClick:()=>m("unregister"),children:[r.jsx(ia,{size:13})," ",f("admin.unregister")]})]})]})}),r.jsx(Vn,{open:p==="rebuild",onClose:()=>c?null:m(null),title:f("project.danger.rebuild_confirm_title"),description:f("project.danger.rebuild_confirm_desc",{label:n}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:g,loading:c==="rebuild",children:f("project.rebuild")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.danger.rebuild_long")})}),r.jsx(Vn,{open:p==="unregister",onClose:()=>c?null:m(null),title:f("project.danger.unregister_confirm_title"),description:f("project.unregister_confirm",{label:n}),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:()=>m(null),disabled:c!==null,children:f("common.cancel")}),r.jsx(ge,{variant:"destructive",onClick:h,loading:c==="unregister",children:f("admin.unregister")})]}),children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.danger.unregister_long")})})]})}function PL(e){const n={};for(const[s,o]of Object.entries(jb(e)))qa(o)||(n[s]=o);return n}const IL=["","es","en","pt","fr","it","de"],ij=e=>e.split(",").map(n=>n.trim()).filter(Boolean);function G2(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:Bs}:{gradient:"from-slate-600 to-gray-600",Icon:gn}}function BL(e){const n=e.filter(d=>d.is_master),s=n.length===1?n[0]:null,o=d=>d.parent?d.parent:s&&!d.is_master&&d.slug!==s.slug?s.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 UL({pid:e}){const n=la();at();const s=Qe(`/projects/${e}/agents`,()=>tn.list(e)),[o,l]=x.useState("hierarchy"),[c,d]=x.useState(!1),[p,m]=x.useState(!1),g=s.data||[],h=S=>n(`/p/${e}/agents/${S}`),_=S=>n(S?`/p/${e}/chat?agent=${S}`:`/p/${e}/chat`),{roots:v,childrenByParent:k}=x.useMemo(()=>BL(g),[g]);return r.jsxs(Ge,{title:f("project.agents.title"),description:f("project.agents.subtitle_full"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[r.jsxs("button",{onClick:()=>l("hierarchy"),className:Oe("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(px,{size:13})," ",f("project.agents.hierarchy")]}),r.jsxs("button",{onClick:()=>l("list"),className:Oe("flex items-center gap-1 rounded-md px-2 py-1 text-xs",o==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[r.jsx(cA,{size:13})," ",f("project.agents.list_view")]})]}),r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>m(!0),children:[r.jsx(yA,{size:13})," ",f("project.agents.import")]}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>_(),children:[r.jsx(Ya,{size:13})," ",f("project.agents.chat")]}),r.jsxs(ge,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>d(!0),children:[r.jsx(nn,{size:14})," ",f("project.agents.new")]})]}),children:[s.isLoading&&r.jsx(nt,{}),!s.isLoading&&g.length===0&&r.jsx(pt,{children:f("project.agents.empty_text")}),!s.isLoading&&g.length>0&&(o==="hierarchy"?r.jsx(VL,{roots:v,childrenByParent:k,onOpen:h,onChat:_}):r.jsx(qL,{agents:g,onOpen:h,onChat:_})),r.jsx($L,{open:c,pid:e,agents:g,onClose:()=>d(!1),onCreated:()=>{d(!1),s.mutate()}}),r.jsx(HL,{open:p,pid:e,existing:g.map(S=>S.slug),onClose:()=>m(!1),onImported:()=>s.mutate()})]})}function HL({open:e,onClose:n,onImported:s,pid:o,existing:l}){const c=at(),d=Qe(e?"/agents/vault":null,()=>tn.vault()),[p,m]=x.useState(""),g=d.data||[],h=async _=>{m(_);try{await tn.import(o,_),c.success(f("project.agents.import_success",{slug:_})),s()}catch(v){c.error(v.message)}finally{m("")}};return r.jsxs(Vn,{open:e,onClose:n,title:f("project.agents.import_title"),description:f("project.agents.import_desc"),size:"lg",footer:r.jsx(ge,{variant:"ghost",onClick:n,children:f("common.close")}),children:[d.isLoading&&r.jsx(nt,{}),!d.isLoading&&g.length===0&&r.jsx(pt,{children:f("project.agents.import_empty")}),r.jsx("ul",{className:"space-y-2",children:g.map(_=>{const v=l.includes(_.slug);return r.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[r.jsx(gn,{size:16,className:"shrink-0 text-muted-fg"}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:_.slug}),_.is_master&&r.jsxs(Ve,{tone:"success",children:[r.jsx(Bs,{size:9})," ",f("project.agents.orchestrator")]}),_.model&&r.jsx(Ve,{tone:"info",children:_.model})]}),_.description&&r.jsx("p",{className:"truncate text-xs text-muted-fg",children:_.description})]}),r.jsx(ge,{size:"sm",variant:"primary",disabled:v||p===_.slug,loading:p===_.slug,onClick:()=>h(_.slug),children:f(v?"project.agents.import_already":"project.agents.import_btn")})]},_.slug)})})]})}function VL({roots:e,childrenByParent:n,onOpen:s,onChat:o}){return r.jsx("div",{className:"space-y-8",children:e.map(l=>{const c=n.get(l.slug)||[];return r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Mg,{agent:l,onOpen:s,onChat:o,wide:!0}),c.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-5 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4 border-t border-border pt-5",children:c.map(d=>r.jsxs("div",{className:"flex flex-col items-center",children:[r.jsx(Mg,{agent:d,onOpen:s,onChat:o}),(n.get(d.slug)||[]).length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-px bg-border"}),r.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(n.get(d.slug)||[]).map(p=>r.jsx(Mg,{agent:p,onOpen:s,onChat:o,compact:!0},p.slug))})]})]},d.slug))})]})]},l.slug)})})}function Mg({agent:e,onOpen:n,onChat:s,wide:o,compact:l}){const{gradient:c,Icon:d}=G2(e);return r.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:Oe("cursor-pointer rounded-xl border border-border bg-card p-3 transition-colors hover:border-muted-fg/50",o?"w-64":l?"w-44":"w-52"),onClick:()=>n(e.slug),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:Oe("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:r.jsx(d,{className:"size-4 text-white"})}),r.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),r.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&r.jsxs(Ve,{tone:"success",children:[r.jsx(Bs,{size:9})," ",f("project.agents.orchestrator")]}),e.role&&r.jsx(Ve,{children:e.role}),e.model&&!l&&r.jsx(Ve,{tone:"info",children:e.model})]}),r.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-border pt-2 text-xs text-muted-fg",onClick:p=>p.stopPropagation(),children:[r.jsxs("button",{onClick:()=>n(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(lf,{size:12})," ",f("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Ya,{size:12})," ",f("project.agents.chat")]})]})]})}function qL({agents:e,onOpen:n,onChat:s}){const o=[...e].sort((l,c)=>+!!c.is_master-+!!l.is_master||l.slug.localeCompare(c.slug));return r.jsx("div",{className:"space-y-2",children:o.map(l=>{const{gradient:c,Icon:d}=G2(l);return r.jsxs("div",{"data-testid":`agent-card-${l.slug}`,className:"flex cursor-pointer items-center gap-4 rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>n(l.slug),children:[r.jsx("div",{className:Oe("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:r.jsx(d,{className:"size-4 text-white"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("span",{className:"text-sm font-semibold",children:l.slug}),l.is_master&&r.jsxs(Ve,{tone:"success",children:[r.jsx(Bs,{size:10})," ",f("project.agents.orchestrator")]}),l.role&&r.jsx(Ve,{children:l.role}),l.model&&r.jsx(Ve,{tone:"info",children:l.model}),l.parent&&r.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",l.parent]})]}),l.description&&r.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:l.description}),r.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[l.skills?.map(p=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(ls,{size:9})," ",p]},p)),l.tools?.map(p=>r.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[r.jsx(zl,{size:9})," ",p]},p))]})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:p=>p.stopPropagation(),children:[r.jsxs("button",{onClick:()=>n(l.slug),className:"flex items-center gap-1 hover:text-foreground",children:[r.jsx(lf,{size:12})," ",f("project.agents.view")]}),r.jsxs("button",{onClick:()=>s(l.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[r.jsx(Ya,{size:12})," ",f("project.agents.chat")]})]})]},l.slug)})})}function $L({open:e,onClose:n,onCreated:s,pid:o,agents:l}){const c=at(),[d,p]=x.useState(""),[m,g]=x.useState(""),[h,_]=x.useState(""),[v,k]=x.useState(""),[S,j]=x.useState(""),[w,C]=x.useState(""),[E,N]=x.useState(""),[R,T]=x.useState(!1),[O,A]=x.useState(""),[z,B]=x.useState(!1),L=()=>{p(""),g(""),_(""),k(""),j(""),C(""),N(""),T(!1),A("")},D=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(d)){c.error(f("project.agents.slug_invalid"));return}B(!0);try{await tn.create(o,{slug:d,role:m||void 0,model:h||void 0,language:v||void 0,description:S||void 0,skills:ij(w),tools:ij(E),is_master:R,parent:O||void 0}),c.success(f("project.agents.create_success",{slug:d})),s(),L()}catch(P){c.error(P?.message||f("project.agents.create_error"))}finally{B(!1)}};return r.jsx(Vn,{open:e,onClose:n,title:f("project.agents.new_title"),description:f("project.agents.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:z,children:f("common.cancel")}),r.jsx(ge,{variant:"primary","data-testid":"agent-create-submit",onClick:D,loading:z,children:f("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("project.agents.slug_label"),children:r.jsx(Ce,{autoFocus:!0,"data-testid":"agent-slug",value:d,onChange:P=>p(P.target.value),placeholder:f("project.agents.slug_ph")})}),r.jsx(de,{label:f("project.agents.role_label"),children:r.jsx(Ce,{value:m,onChange:P=>g(P.target.value),placeholder:f("project.agents.role_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("project.agents.model_label"),hint:f("project.agents.model_hint"),children:r.jsx(Ce,{value:h,onChange:P=>_(P.target.value)})}),r.jsx(de,{label:f("project.agents.lang_label"),children:r.jsx(wt,{value:v,onChange:k,options:IL.map(P=>({value:P,label:P||"—"}))})})]}),r.jsx(de,{label:f("project.agents.desc_label"),children:r.jsx(cn,{rows:2,value:S,onChange:P=>j(P.target.value),placeholder:f("project.agents.desc_ph")})}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("project.agents.skills_label"),children:r.jsx(Ce,{value:w,onChange:P=>C(P.target.value),placeholder:f("project.agents.skills_ph")})}),r.jsx(de,{label:f("project.agents.tools_label"),children:r.jsx(Ce,{value:E,onChange:P=>N(P.target.value),placeholder:f("project.agents.tools_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[r.jsx(de,{label:f("project.agents.parent_label"),hint:f("project.agents.parent_hint"),children:r.jsx(wt,{value:O,onChange:A,placeholder:f("project.agents.none_parent"),options:[{value:"",label:f("project.agents.none_parent")},...l.filter(P=>P.slug!==d).map(P=>({value:P.slug,label:P.slug}))]})}),r.jsx(Zt,{checked:R,onChange:T,label:f("project.agents.master_label")})]})]})})}function dd(e){return e.split(`
603
- `).map(n=>n.trim()).filter(Boolean)}function tf(){return{exec_agent:{label:f("agents_ui.kind_exec_agent"),desc:f("agents_ui.kind_exec_agent_desc"),icon:gn},super_agent:{label:f("agents_ui.kind_super_agent"),desc:f("agents_ui.kind_super_agent_desc"),icon:Bs},telegram:{label:f("agents_ui.kind_telegram"),desc:f("agents_ui.kind_telegram_desc"),icon:Ya},shell:{label:f("agents_ui.kind_shell"),desc:f("agents_ui.kind_shell_desc"),icon:Er},heartbeat:{label:f("agents_ui.kind_heartbeat"),desc:f("agents_ui.kind_heartbeat_desc"),icon:_l}}}function GL(){const e=tf();return Object.keys(e).map(n=>({value:n,label:e[n].label,description:e[n].desc,icon:e[n].icon}))}function F2(e){if(!e)return"—";if(e.startsWith("every:")){const n=e.slice(6),s=n.match(/^(\d+)(s|m|h|d)$/);if(s){const o=s[1],l={s:f("agents_ui.unit_seconds"),m:f("agents_ui.unit_minutes"),h:f("agents_ui.unit_hours"),d:f("agents_ui.unit_days")}[s[2]]||s[2];return f("agents_ui.every_n_unit",{n:o,unit:l})}return f("agents_ui.every_v",{v:n})}return e.startsWith("once:")?`once · ${new Date(e.slice(5)).toLocaleString()}`:e.startsWith("cron ")?`cron · ${e.slice(5)}`:e}function FL(){return[{label:f("agents_ui.preset_every_10m"),value:"every:10m"},{label:f("agents_ui.preset_hourly"),value:"every:1h"},{label:f("agents_ui.preset_daily_9am"),value:"cron 0 9 * * *"},{label:f("agents_ui.preset_weekdays_9am"),value:"cron 0 9 * * 1-5"}]}function YL(){return[{v:"{{pre_output}}",where:"prompt",desc:f("agents_ui.var_pre_output_prompt")},{v:"$APX_LLM_OUTPUT",where:"post",desc:f("agents_ui.var_llm_output")},{v:"$APX_STATUS",where:"post",desc:f("agents_ui.var_status")},{v:"$APX_SKIPPED",where:"post",desc:f("agents_ui.var_skipped")},{v:"$APX_PRE_OUTPUT",where:"post",desc:f("agents_ui.var_pre_output")},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:f("agents_ui.var_pre_output_file")},{v:"$APX_PRE_EXIT",where:"post",desc:f("agents_ui.var_pre_exit")},{v:"$APX_ROUTINE",where:"pre/post",desc:f("agents_ui.var_routine")}]}function XL(e,n){switch(e){case"exec_agent":return n.agent?f("agents_ui.summary_runs_agent",{agent:String(n.agent)}):f("agents_ui.summary_runs_agent_none");case"super_agent":return f("agents_ui.summary_super_agent");case"telegram":return f("agents_ui.summary_telegram",{channel:String(n.channel||"default")});case"shell":return n.command?f("agents_ui.summary_runs_cmd",{cmd:String(n.command).slice(0,40)}):f("agents_ui.summary_shell");case"heartbeat":return f("agents_ui.summary_heartbeat")}}function KL({pid:e}){const n=at(),s=Qe(`/projects/${e}/routines`,()=>br.list(e)),[o,l]=x.useState(null),c=async m=>{try{await(m.enabled?br.disable:br.enable)(e,m.name),s.mutate()}catch(g){n.error(g?.message||f("project.routines.toggle_error"))}},d=async m=>{try{await br.run(e,m.name),n.success(f("project.routines.run_success",{name:m.name}))}catch(g){n.error(g?.message||f("project.routines.run_error"))}},p=async m=>{if(confirm(f("project.routines.delete_confirm",{name:m.name})))try{await br.remove(e,m.name),n.success(f("project.routines.delete_success")),s.mutate()}catch(g){n.error(g?.message||f("project.routines.delete_error"))}};return r.jsxs(Ge,{title:f("project.routines.title"),description:f("project.routines.subtitle"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>l({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[r.jsx(nn,{size:14})," ",f("project.routines.new_btn")]}),children:[s.isLoading&&r.jsx(nt,{}),!s.isLoading&&(s.data?.length??0)===0&&r.jsx(pt,{children:f("project.routines.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(m=>{const g=tf()[m.kind],h=g?.icon||dc,_=m.last_status==="error";return r.jsxs("li",{className:"cursor-pointer rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>l({...m}),children:[r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Oe("flex size-7 items-center justify-center rounded-lg",m.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:r.jsx(h,{size:14})}),r.jsx("span",{className:"font-medium",children:m.name}),r.jsx(Ve,{tone:m.kind==="shell"?"warning":"info",children:g?.label||m.kind}),!m.enabled&&r.jsx(Ve,{tone:"muted",children:f("project.routines.paused")})]}),r.jsxs("div",{className:"flex items-center gap-2",onClick:v=>v.stopPropagation(),children:[r.jsx(Zt,{checked:m.enabled,onChange:()=>c(m)}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>d(m),children:[r.jsx(gx,{size:13})," ",f("common.run")]}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>p(m),children:r.jsx(ia,{size:13})})]})]}),r.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[r.jsxs("span",{children:["⏱ ",F2(m.schedule)]}),r.jsx("span",{children:XL(m.kind,m.spec||{})}),m.next_run_at&&r.jsxs("span",{children:[f("project.routines.next_run")," ",new Date(m.next_run_at).toLocaleString()]}),r.jsxs("span",{className:Oe(m.last_status==="ok"&&"text-emerald-500",_&&"text-destructive"),children:[f("agents_ui.last_label")," ",m.last_status||"—"]})]}),m.last_error&&r.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:m.last_error})]},m.name)})}),r.jsx(QL,{draft:o,onClose:()=>l(null),onSaved:()=>{l(null),s.mutate()},pid:e})]})}function QL({draft:e,onClose:n,onSaved:s,pid:o}){const l=at(),c=Qe(e?`/projects/${o}/agents`:null,()=>tn.list(o)),[d,p]=x.useState(!1),[m,g]=x.useState(""),[h,_]=x.useState("super_agent"),[v,k]=x.useState("every:10m"),[S,j]=x.useState(!0),[w,C]=x.useState(""),[E,N]=x.useState(""),[R,T]=x.useState("default"),[O,A]=x.useState(""),[z,B]=x.useState(""),[L,D]=x.useState(""),[P,H]=x.useState("heartbeat"),[q,Y]=x.useState(""),[V,$]=x.useState(""),[Z,G]=x.useState("");x.useEffect(()=>{if(!e)return;const ee=e.spec&&typeof e.spec=="object"?e.spec:{};g(e.name||""),_(e.kind||"super_agent"),k(e.schedule||"every:10m"),j(e.enabled??!0),C(ee.agent||""),N(ee.prompt||""),T(ee.channel||"default"),A(ee.chat_id?String(ee.chat_id):""),B(ee.text||""),D(ee.command||""),H(ee.channel||"heartbeat"),Y(ee.message||""),$((e.pre_commands||[]).join(`
604
- `)),G((e.post_commands||[]).join(`
605
- `))},[e]);const X=()=>{switch(h){case"exec_agent":return{agent:w,prompt:E};case"super_agent":return{prompt:E};case"telegram":return{channel:R,...O?{chat_id:O}:{},text:z};case"shell":return{command:L};case"heartbeat":return{channel:P,message:q}}},U=async()=>{if(!m){l.error(f("project.routines.name_required"));return}p(!0);try{const ee=h==="exec_agent"||h==="super_agent";await br.upsert(o,{name:m,kind:h,schedule:v,enabled:S,spec:X(),pre_commands:ee?dd(V):[],post_commands:ee?dd(Z):[]}),l.success(f("project.routines.saved")),s()}catch(ee){l.error(ee?.message||f("project.routines.save_error"))}finally{p(!1)}},K=h==="exec_agent"||h==="super_agent",F=K?dd(V):[],J=K?dd(Z):[],ie=(()=>{switch(h){case"exec_agent":return w?f("agents_ui.action_agent_answers",{agent:w}):f("agents_ui.action_agent_pick_answers");case"super_agent":return f("agents_ui.action_super_answers");case"telegram":return f("agents_ui.action_telegram_channel",{channel:R});case"shell":return L?f("agents_ui.summary_runs_cmd",{cmd:L.slice(0,48)}):f("agents_ui.action_runs_shell");case"heartbeat":return f("agents_ui.summary_heartbeat")}})(),re=K,oe=tf()[h].icon,ce=[...F.map((ee,Te)=>({id:`pre-${Te}`,icon:Er,label:f("agents_ui.step_pre"),detail:ee,action:!1})),{id:"action",icon:oe,label:ie,detail:re&&E?E.slice(0,90):void 0,action:!0},...J.map((ee,Te)=>({id:`post-${Te}`,icon:Er,label:f("agents_ui.step_post"),detail:ee,action:!1}))];return r.jsx(Vn,{open:!!e,onClose:n,title:e?.name?f("project.routines.edit_title",{name:e.name}):f("project.routines.new_title"),description:f("project.routines.dialog_desc"),size:"xl",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:d,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:U,loading:d,children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[r.jsx(Zt,{checked:S,onChange:j,label:f("project.routines.enabled_label")}),r.jsx("span",{className:"text-[11px] text-muted-fg",children:f(S?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:f("project.routines.name_field"),hint:e?.name?f("project.routines.name_no_edit"):void 0,children:r.jsx(Ce,{value:m,disabled:!!e?.name,onChange:ee=>g(ee.target.value),placeholder:"resumen-diario"})}),r.jsx(de,{label:f("project.routines.kind_field"),children:r.jsx(wt,{value:h,onChange:ee=>_(ee),options:GL()})}),r.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:tf()[h].desc}),h==="exec_agent"&&r.jsx(de,{label:f("project.routines.agent_field"),hint:f("project.routines.agent_hint"),children:r.jsx(wt,{value:w,onChange:C,placeholder:c.isLoading?f("project.routines.agent_loading"):f("project.routines.agent_pick"),options:(c.data||[]).map(ee=>({value:ee.slug,label:ee.slug,description:[ee.role,ee.model].filter(Boolean).join(" · ")||void 0}))})}),r.jsx(de,{label:f("project.routines.schedule_field"),hint:f("project.routines.schedule_hint"),children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex flex-wrap gap-1",children:[FL().map(ee=>r.jsx("button",{type:"button",onClick:()=>k(ee.value),className:Oe("rounded-md border px-2 py-0.5 text-[11px]",v===ee.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:ee.label},ee.value)),r.jsx("button",{type:"button",onClick:()=>k("manual"),className:Oe("rounded-md border px-2 py-0.5 text-[11px]",v==="manual"?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:f("agents_ui.preset_manual")})]}),r.jsx(Ce,{value:v,onChange:ee=>k(ee.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})})]}),r.jsxs("div",{className:"space-y-3",children:[K&&r.jsx(de,{label:f("project.routines.pre_field"),hint:f("project.routines.pre_hint"),children:r.jsx(cn,{rows:2,className:"font-mono text-xs",value:V,onChange:ee=>$(ee.target.value),placeholder:"curl -s https://wttr.in/Bariloche"})}),h==="exec_agent"&&r.jsx(de,{label:f("project.routines.prompt_exec"),children:r.jsx(cn,{rows:4,value:E,onChange:ee=>N(ee.target.value),placeholder:f("project.routines.prompt_exec_ph")})}),h==="super_agent"&&r.jsx(de,{label:f("project.routines.prompt_super"),children:r.jsx(cn,{rows:4,value:E,onChange:ee=>N(ee.target.value),placeholder:f("project.routines.prompt_super_ph")})}),h==="telegram"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("project.routines.tg_channel"),children:r.jsx(Ce,{value:R,onChange:ee=>T(ee.target.value),placeholder:"default"})}),r.jsx(de,{label:f("project.routines.tg_chat_id"),children:r.jsx(Ce,{value:O,onChange:ee=>A(ee.target.value),placeholder:f("agents_ui.tg_chat_id_ph")})})]}),r.jsx(de,{label:f("project.routines.tg_text"),hint:f("project.routines.tg_text_hint"),children:r.jsx(cn,{rows:8,value:z,onChange:ee=>B(ee.target.value),placeholder:f("agents_ui.tg_text_ph")})})]}),h==="shell"&&r.jsx(de,{label:f("project.routines.shell_field"),hint:f("project.routines.shell_hint"),children:r.jsx(cn,{rows:11,className:"font-mono text-xs",value:L,onChange:ee=>D(ee.target.value),placeholder:"cd /repo && git pull && npm test"})}),h==="heartbeat"&&r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("project.routines.hb_channel"),children:r.jsx(Ce,{value:P,onChange:ee=>H(ee.target.value),placeholder:"heartbeat"})}),r.jsx(de,{label:f("project.routines.hb_message"),children:r.jsx(Ce,{value:q,onChange:ee=>Y(ee.target.value),placeholder:f("agents_ui.hb_message_ph")})})]}),K&&r.jsx(de,{label:f("project.routines.post_field"),hint:f("project.routines.post_hint"),children:r.jsx(cn,{rows:2,className:"font-mono text-xs",value:Z,onChange:ee=>G(ee.target.value),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})})]})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[r.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:f("project.routines.vars_title")}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:YL().map(ee=>r.jsxs("span",{title:ee.desc,className:"inline-flex items-center gap-1 rounded-md border border-border bg-card px-1.5 py-0.5 font-mono text-[10px]",children:[ee.v,r.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",ee.where]})]},ee.v))})]}),r.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[f("project.routines.what_happens")," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",F2(v)]})]}),r.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:ce.map((ee,Te)=>r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsxs("div",{className:Oe("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",ee.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[r.jsxs("div",{className:Oe("flex items-center gap-1.5 text-[11px] font-medium",ee.action?"text-emerald-400":"text-muted-fg"),children:[r.jsx(ee.icon,{size:12})," ",ee.label]}),ee.detail&&r.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:ee.detail})]}),Te<ce.length-1&&r.jsx($w,{size:14,className:"shrink-0 self-center text-muted-fg"})]},ee.id))})]})]})})}function ZL({pid:e}){const[n,s]=x.useState("open"),o=at(),l=Qe(`/projects/${e}/tasks?state=${n}`,()=>_r.list(e,n),{dedupingInterval:0,revalidateOnFocus:!0}),[c,d]=x.useState(""),[p,m]=x.useState(!1),g=async()=>{if(c.trim()){m(!0);try{await _r.add(e,{title:c.trim()}),d(""),o.success(f("project.tasks.created")),l.mutate()}catch(_){o.error(_?.message||f("project.tasks.create_error"))}finally{m(!1)}}},h=async(_,v)=>{try{await _(),o.success(v),l.mutate()}catch(k){o.error(k?.message||f("common.error_generic"))}};return r.jsxs(Ge,{title:f("project.tasks.title"),description:f("project.tasks.subtitle"),action:r.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(_=>r.jsx(ge,{size:"sm","data-testid":`task-filter-${_}`,variant:n===_?"primary":"ghost",onClick:()=>s(_),children:_},_))}),children:[r.jsxs("div",{className:"mb-4 flex items-end gap-2",children:[r.jsx(de,{label:f("project.tasks.add_label"),children:r.jsx(Ce,{"data-testid":"task-input",placeholder:f("project.tasks.add_placeholder"),value:c,onChange:_=>d(_.target.value),onKeyDown:_=>{_.key==="Enter"&&g()}})}),r.jsxs(ge,{variant:"primary","data-testid":"task-add",onClick:g,loading:p,children:[r.jsx(nn,{size:14})," ",f("project.tasks.add")]})]}),l.isLoading&&r.jsx(nt,{}),!l.isLoading&&(l.data?.length??0)===0&&r.jsxs(pt,{children:[n==="open"?f("project.tasks.empty_open"):f("project.tasks.empty",{state:n})," ",r.jsx("code",{children:'apx task add "…"'})]}),r.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:(l.data||[]).map(_=>r.jsxs("li",{"data-testid":`task-${_.id}`,className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 font-mono text-[10px] text-muted-fg",children:_.id}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium",children:_.title}),r.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[_.tags?.map(v=>r.jsxs(Ve,{children:["#",v]},v)),_.agent&&r.jsxs(Ve,{tone:"info",children:["@",_.agent]}),_.source&&r.jsxs("span",{children:[f("project.tasks.via")," ",_.source]}),_.due&&r.jsxs("span",{children:[f("project.tasks.due")," ",_.due]})]})]}),r.jsxs("div",{className:"flex gap-1",children:[n==="open"&&r.jsxs(r.Fragment,{children:[r.jsx(ge,{size:"sm",variant:"secondary","aria-label":f("project.tasks.aria_done"),"data-testid":`task-done-${_.id}`,onClick:()=>h(()=>_r.done(e,_.id),f("project.tasks.done")),children:r.jsx(uc,{size:13})}),r.jsx(ge,{size:"sm",variant:"destructive","aria-label":f("project.tasks.aria_drop"),"data-testid":`task-drop-${_.id}`,onClick:()=>h(()=>_r.drop(e,_.id),f("project.tasks.drop")),children:r.jsx(ia,{size:13})})]}),n!=="open"&&r.jsx(ge,{size:"sm",variant:"ghost","aria-label":f("project.tasks.aria_reopen"),"data-testid":`task-reopen-${_.id}`,onClick:()=>h(()=>_r.reopen(e,_.id),f("project.tasks.reopen")),children:r.jsx(hx,{size:13})})]})]},_.id))})]})}const WL="\\$\\{var\\.([^}\\s]+)\\}";function Y2(e="g"){return new RegExp(WL,e)}function X2(e){return Y2("").test(e)}function JL(e){const n=[];let s=0;for(const o of e.matchAll(Y2("g"))){const l=o.index??0;l>s&&n.push({type:"text",value:e.slice(s,l)}),n.push({type:"var",value:o[1]}),s=l+o[0].length}return s<e.length&&n.push({type:"text",value:e.slice(s)}),n}function Og(e){let n="";for(const s of Array.from(e.childNodes))if(s.nodeType===Node.TEXT_NODE)n+=s.textContent??"";else if(s instanceof HTMLElement){const o=s.dataset.varName;o?n+=`\${var.${o}}`:s.tagName==="BR"?n+="":n+=s.textContent??""}return n.replace(/[\u200B-\u200F\u202A-\u202E\u2060\uFEFF]/g,"").replace(/\u00A0/g," ")}function cj(e,n){e.replaceChildren();const s=JL(n);for(const o of s)o.type==="text"?e.appendChild(document.createTextNode(o.value)):e.appendChild(K2(o.value));(s.length===0||s[s.length-1].type==="var")&&e.appendChild(document.createTextNode(""))}function K2(e){const n=document.createElement("span");return n.contentEditable="false",n.dataset.varName=e,n.className="inline-flex items-baseline px-1 rounded bg-primary/10 text-primary font-mono text-[12px] select-none cursor-default whitespace-nowrap",n.textContent=`$${e}`,n.title=`\${var.${e}}`,n}function e6(e,n){e.deleteContents(),e.insertNode(n),e.setStartAfter(n),e.collapse(!0);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(e)}function t6(e){const n=document.createRange();n.selectNodeContents(e),n.collapse(!1);const s=window.getSelection();s?.removeAllRanges(),s?.addRange(n)}const wb=x.forwardRef(function({value:n,onChange:s,placeholder:o,className:l,varNames:c=[],onCreateVar:d},p){const m=x.useRef(null),g=x.useRef(null),[h,_]=x.useState(!1),[v,k]=x.useState(""),S=x.useRef(n);x.useEffect(()=>{const T=m.current;T&&(n===S.current&&T.childNodes.length>0||(cj(T,n),S.current=n))},[n]);const j=x.useCallback(()=>{const T=m.current;if(!T)return;const O=Og(T);S.current=O,O!==n&&s(O)},[s,n]),w=x.useCallback(()=>{const T=m.current;if(!T)return;const O=Og(T);if(X2(O)&&a6(T)){const A=s6(T);cj(T,O),A!=null&&r6(T,A)}S.current=Og(T),S.current!==n&&s(S.current)},[s,n]),C=x.useCallback(()=>{const T=window.getSelection();if(!T||T.rangeCount===0)return;const O=T.getRangeAt(0),A=m.current;A&&A.contains(O.startContainer)&&(g.current=O.cloneRange())},[]),E=x.useCallback(T=>{if(T.key==="Enter"){T.preventDefault(),T.currentTarget.blur();return}if(T.key==="Backspace"){const O=window.getSelection();if(!O||O.rangeCount===0)return;const A=O.getRangeAt(0);if(!A.collapsed)return;const{startContainer:z,startOffset:B}=A;if(z.nodeType===Node.TEXT_NODE&&B===0){const L=z.previousSibling;if(L instanceof HTMLElement&&L.dataset.varName){T.preventDefault(),L.remove(),j();return}}else if(z===m.current){const L=z.childNodes[B-1];if(L instanceof HTMLElement&&L.dataset.varName){T.preventDefault(),L.remove(),j();return}}}},[j]),N=x.useCallback(T=>{const O=m.current;if(!O)return;const A=g.current;O.focus();let z;A&&O.contains(A.startContainer)?z=A:(z=document.createRange(),z.selectNodeContents(O),z.collapse(!1)),e6(z,K2(T)),g.current=null,j()},[j]);x.useImperativeHandle(p,()=>({insertVar:N,focus:()=>m.current?.focus()}),[N]);const R=c.filter(T=>T.toLowerCase().includes(v.toLowerCase()));return r.jsxs("div",{className:Oe("group flex items-stretch w-full min-w-0 rounded-lg border border-input bg-transparent dark:bg-input/30 transition-colors","focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50",l),children:[r.jsxs("div",{className:"relative flex-1 min-w-0",children:[r.jsx("div",{ref:m,role:"textbox",contentEditable:!0,suppressContentEditableWarning:!0,onInput:w,onKeyDown:E,onBlur:j,onFocus:C,onMouseUp:C,onKeyUp:C,className:Oe("h-8 w-full whitespace-nowrap overflow-x-auto px-2.5 py-1 text-sm rounded-l-lg","focus:outline-none font-mono leading-7","[&_*]:align-baseline"),"data-placeholder":o||"",style:{caretColor:"currentColor"}}),n===""&&o&&r.jsx("span",{className:"pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 select-none text-sm text-muted-foreground font-mono",children:o})]}),r.jsxs("div",{className:"relative flex",children:[r.jsx("button",{type:"button",onMouseDown:T=>{T.preventDefault(),C()},onClick:()=>_(T=>!T),"aria-label":f("chat_ui.insert_variable"),title:f("chat_ui.insert_variable"),className:Oe("flex items-center justify-center px-2 min-w-8 border-l border-input text-muted-foreground rounded-r-lg","hover:bg-muted/60 hover:text-foreground transition-colors",h&&"bg-muted/60 text-foreground"),children:r.jsx(nn,{size:14})}),h&&r.jsx(n6,{query:v,onQuery:k,varNames:R,onPick:T=>{N(T),_(!1),k("")},onClose:()=>{_(!1),k("")},onCreateVar:d})]})]})});function n6({query:e,onQuery:n,varNames:s,onPick:o,onClose:l,onCreateVar:c}){const d=x.useRef(null),p=x.useRef(null);return x.useEffect(()=>{p.current?.focus({preventScroll:!0})},[]),x.useEffect(()=>{function m(g){d.current&&!d.current.contains(g.target)&&l()}return document.addEventListener("mousedown",m),()=>document.removeEventListener("mousedown",m)},[l]),r.jsxs("div",{ref:d,className:"absolute right-0 top-full z-50 mt-1 w-64 rounded-md border border-border bg-popover shadow-lg",children:[r.jsx("div",{className:"border-b border-border p-2",children:r.jsx("input",{ref:p,value:e,onChange:m=>n(m.target.value),placeholder:f("shared_ui.search_variable_ph"),className:"w-full rounded bg-muted/40 px-2 py-1 text-xs font-mono outline-none"})}),r.jsxs("ul",{className:"max-h-44 overflow-auto p-1 text-xs",children:[s.length===0&&r.jsx("li",{className:"px-2 py-1.5 text-muted-foreground",children:f("shared_ui.no_matches")}),s.map(m=>r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:g=>g.preventDefault(),onClick:()=>o(m),className:"block w-full rounded px-2 py-1.5 text-left font-mono hover:bg-muted/60",children:m})},m))]}),c&&r.jsx("div",{className:"border-t border-border p-1",children:r.jsxs("button",{type:"button",onMouseDown:m=>m.preventDefault(),onClick:()=>{c(),l()},className:"flex w-full items-center gap-1 rounded px-2 py-1.5 text-left text-xs hover:bg-muted/60",children:[r.jsx(nn,{size:12})," ",f("shared_ui.create_variable")]})})]})}function a6(e){for(const n of Array.from(e.childNodes))if(n.nodeType===Node.TEXT_NODE&&X2(n.textContent??""))return!0;return!1}function s6(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const s=n.getRangeAt(0);if(!e.contains(s.startContainer))return null;const o=s.cloneRange();return o.selectNodeContents(e),o.setEnd(s.startContainer,s.startOffset),o.toString().length}function r6(e,n){const s=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=n,l=s.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=s.nextNode()}t6(e)}function uj(e){return e?Object.entries(e).map(([n,s])=>({key:n,value:String(s)})):[]}function dj(e){const n={};for(const s of e)s.key.trim()&&(n[s.key.trim()]=s.value);return n}function fj({rows:e,onChange:n,keyPlaceholder:s=f("shared_ui.kv_key_ph"),valuePlaceholder:o=f("shared_ui.kv_value_ph"),varNames:l,onCreateVar:c,emptyLabel:d}){const p=(h,_)=>{const v=e.slice();v[h]={...v[h],..._},n(v)},m=h=>n(e.filter((_,v)=>v!==h)),g=()=>n([...e,{key:"",value:""}]);return r.jsxs("div",{className:"space-y-2",children:[e.length===0&&d&&r.jsx("p",{className:"text-[11px] text-muted-foreground",children:d}),e.map((h,_)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(Ce,{value:h.key,onChange:v=>p(_,{key:v.target.value}),placeholder:s,className:"w-40 font-mono text-xs"}),r.jsx("div",{className:"flex-1",children:r.jsx(wb,{value:h.value,onChange:v=>p(_,{value:v}),placeholder:o,varNames:l,onCreateVar:c})}),r.jsx(ge,{type:"button",size:"sm",variant:"ghost",onClick:()=>m(_),"aria-label":f("shared_ui.remove_row"),children:r.jsx(ia,{size:13})})]},_)),r.jsxs(ge,{type:"button",size:"sm",variant:"ghost",onClick:g,children:[r.jsx(nn,{size:12})," ",f("shared_ui.add_row")]})]})}const o6={apc:"info",runtime:"success",global:"muted"};function Gh(e){return e==="runtime"?"runtime":e==="global"?"global":"shared"}function l6(e){return e==="apc"?f("project.mcps.scope_shared"):e==="runtime"?f("project.mcps.scope_runtime"):e==="global"?f("project.mcps.scope_global"):e}function i6({pid:e}){const n=at(),s=Qe(`/projects/${e}/mcps`,()=>vr.list(e)),o=Qe(`/projects/${e}/mcps/check`,()=>vr.check(e)),l=Qe(`/projects/${e}/vars`,()=>_c.list(e)),[c,d]=x.useState(null),[p,m]=x.useState(null),[g,h]=x.useState(null),_=x.useMemo(()=>l.data?Object.keys(l.data.effective).sort():[],[l.data]),v=async(j,w)=>{if(confirm(f("project.mcps.delete_confirm",{name:j,scope:w})))try{await vr.remove(e,j,w),n.success(f("project.mcps.removed")),s.mutate(),p===j&&m(null)}catch(C){n.error(C?.message||f("common.error_generic"))}},k=async j=>{try{await vr.add(e,Gh(j.source),{name:j.name,enabled:!j.enabled}),s.mutate()}catch(w){n.error(w?.message||f("common.error_generic"))}},S=async j=>{m(j),h({name:j,busy:!0});try{const w=await vr.test(e,j);h({name:j,result:w})}catch(w){h({name:j,result:{ok:!1,error:w?.message||"error"}})}};return r.jsxs("div",{className:"grid grid-cols-1 gap-4 lg:grid-cols-4",children:[r.jsx("div",{className:"lg:col-span-3",children:r.jsxs(Ge,{title:f("project.mcps.title"),description:f("project.mcps.subtitle"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>d({kind:"new"}),children:[r.jsx(nn,{size:14})," ",f("project.mcps.new")]}),children:[o.data?.conflicts?.length?r.jsx("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:f("project.mcps.conflicts",{names:o.data.conflicts.map(j=>j.name).join(", ")})}):null,s.isLoading&&r.jsx(nt,{}),!s.isLoading&&(s.data?.length??0)===0&&r.jsx(pt,{children:f("project.mcps.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(j=>{const w=j.source==="apc"||j.source==="runtime"||j.source==="global",C=Gh(j.source),E=p===j.name;return r.jsxs("li",{className:"rounded-md border px-3 py-2 transition-colors "+(E?"border-primary/50 bg-primary/5":"border-border bg-muted/30 hover:bg-muted/50"),onClick:()=>m(j.name),role:"button",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[r.jsx("span",{className:"font-medium",children:j.name}),r.jsx(Ve,{tone:o6[j.source]??"muted",children:l6(j.source)}),r.jsx("span",{className:"ml-auto text-xs text-muted-fg",children:(j.transport||"stdio").toUpperCase()}),r.jsx("div",{onClick:N=>N.stopPropagation(),children:r.jsx(Zt,{checked:j.enabled!==!1,onChange:()=>k(j),label:""})}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:N=>{N.stopPropagation(),S(j.name)},"aria-label":f("project.mcps.test_btn"),title:f("project.mcps.test_btn"),children:r.jsx(Xw,{size:13})}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:N=>{N.stopPropagation(),m(j.name)},"aria-label":f("project.mcps.logs_btn"),title:f("project.mcps.logs_btn"),children:r.jsx(zd,{size:13})}),w&&r.jsx(ge,{size:"sm",variant:"ghost",onClick:N=>{N.stopPropagation(),d({kind:"edit",entry:j})},"aria-label":f("project.mcps.edit_btn"),title:f("project.mcps.edit_btn"),children:r.jsx(Ol,{size:13})}),w&&r.jsx(ge,{size:"sm",variant:"destructive",onClick:N=>{N.stopPropagation(),v(j.name,C)},children:r.jsx(ia,{size:13})})]}),g?.name===j.name&&r.jsx(c6,{result:g.result,busy:!!g.busy,onClose:()=>h(null)})]},`${j.source}-${j.name}`)})}),c&&r.jsx(d6,{mode:c,pid:e,varNames:_,onClose:()=>d(null),onSaved:()=>{d(null),s.mutate()},onVarsChanged:()=>l.mutate()})]})}),r.jsx("div",{className:"lg:col-span-1",children:r.jsx(u6,{pid:e,mcpName:p,runningTest:!!g?.busy})})]})}function c6({result:e,busy:n,onClose:s}){return r.jsxs("div",{className:"mt-2 rounded border border-border/60 bg-background/40 p-2 text-xs",children:[r.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[n&&r.jsx("span",{className:"text-muted-fg",children:f("project.mcps.testing")}),!n&&e?.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-emerald-400",children:[r.jsx(ux,{size:12})," ",f("project.mcps.test_ok",{n:String(e.tool_count??0)})]}),!n&&e&&!e.ok&&r.jsxs("span",{className:"flex items-center gap-1 text-red-400",children:[r.jsx(PT,{size:12})," ",e.error]}),r.jsx("button",{className:"ml-auto text-muted-fg hover:text-fg",onClick:s,children:"×"})]}),!n&&e?.ok&&e.tools&&e.tools.length>0&&r.jsxs("ul",{className:"space-y-0.5 font-mono",children:[e.tools.slice(0,10).map(o=>r.jsxs("li",{className:"truncate",children:[r.jsx("span",{className:"text-primary",children:o.name}),o.description&&r.jsxs("span",{className:"ml-2 text-muted-fg",children:["— ",o.description]})]},o.name)),e.tools.length>10&&r.jsxs("li",{className:"text-muted-fg",children:["… +",e.tools.length-10]})]})]})}function u6({pid:e,mcpName:n,runningTest:s}){const[o,l]=x.useState(null),[c,d]=x.useState(null),p=x.useRef(null);x.useEffect(()=>{if(!n){l(null),d(null);return}p.current!==n&&(l(null),d(null),p.current=n);let g=!1;const h=async()=>{try{const k=await vr.logs(e,n);g||(l(k),d(null))}catch(k){g||d(k?.message||"error")}};h();const v=setInterval(h,s?1200:4e3);return()=>{g=!0,clearInterval(v)}},[e,n,s]);const m=x.useRef(null);return x.useEffect(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[o?.events?.length,o?.stderr_tail]),r.jsxs("div",{className:"sticky top-3 flex h-[calc(100vh-7rem)] min-h-[24rem] flex-col rounded-xl border border-border bg-card",children:[r.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-3 py-2 text-xs",children:[r.jsx(Er,{size:13,className:"text-muted-fg"}),r.jsx("span",{className:"font-medium",children:f("project.mcps.logs_panel_title")}),n?r.jsx(Ve,{tone:"info",children:n}):r.jsxs("span",{className:"text-muted-fg",children:["— ",f("project.mcps.logs_panel_pick")]})]}),r.jsxs("div",{ref:m,className:"flex-1 overflow-auto bg-background/60 px-3 py-2 font-mono text-[11px]",children:[!n&&r.jsx("p",{className:"text-muted-fg",children:f("project.mcps.logs_panel_hint")}),n&&c&&r.jsx("p",{className:"text-red-400",children:c}),n&&!c&&o&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"mb-2 text-muted-fg",children:[o.transport.toUpperCase(),o.url?` · ${o.url}`:o.command?` · ${o.command}`:"",o.last_error?` · last_error: ${o.last_error}`:""]}),o.note&&r.jsx("p",{className:"text-muted-fg",children:o.note}),(!o.events||o.events.length===0)&&!o.stderr_tail&&!o.note&&r.jsx("p",{className:"text-muted-fg",children:f("project.mcps.logs_panel_idle")}),o.events?.map((g,h)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:g.ts.slice(11,19)}),r.jsx("span",{className:g.level==="error"?"text-red-400":g.level==="stderr"?"text-amber-400":"text-emerald-400",children:g.level}),r.jsx("span",{className:"flex-1 break-all",children:g.msg})]},h)),o.stderr_tail&&r.jsxs("div",{className:"mt-2 border-t border-border/60 pt-2",children:[r.jsx("div",{className:"mb-1 text-muted-fg",children:"stderr"}),r.jsx("pre",{className:"whitespace-pre-wrap break-all text-amber-300/80",children:o.stderr_tail})]})]})]})]})}function d6({mode:e,pid:n,varNames:s,onClose:o,onSaved:l,onVarsChanged:c}){const d=at(),p=e.kind==="edit",m=p?e.entry:null,[g,h]=x.useState(!1),[_,v]=x.useState(m?Gh(m.source):"runtime"),[k,S]=x.useState(m?.name||""),[j,w]=x.useState(m?.transport==="http"||m?.url?"http":"stdio"),[C,E]=x.useState(m?.command||""),[N,R]=x.useState(m?.args&&m.args.length?m.args:[""]),[T,O]=x.useState(uj(m?.env)),[A,z]=x.useState(m?.url||""),[B,L]=x.useState(uj(m?.headers)),[D,P]=x.useState(m?.enabled!==!1),[H,q]=x.useState(!1),Y=async()=>{if(!k.trim()){d.error(f("project.mcps.name_required"));return}h(!0);try{const V=N.map(Z=>Z.trim()).filter(Boolean),$=j==="stdio"?{name:k.trim(),command:C.trim(),args:V.length?V:void 0,env:T.length?dj(T):void 0,enabled:D}:{name:k.trim(),url:A.trim(),headers:B.length?dj(B):void 0,enabled:D};await vr.add(n,_,$),d.success(f(p?"project.mcps.updated":"project.mcps.added")),l()}catch(V){d.error(V?.message||f("common.error_generic"))}finally{h(!1)}};return r.jsxs(r.Fragment,{children:[r.jsx(Vn,{open:!0,onClose:()=>g?null:o(),title:f(p?"project.mcps.edit_title":"project.mcps.new_title"),description:p?m?.name:f("project.mcps.new_desc"),size:"lg",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:o,disabled:g,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:Y,loading:g,children:f(p?"project.mcps.save_btn":"project.mcps.add_btn")})]}),children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("project.mcps.scope_label"),children:r.jsx(wt,{value:_,onChange:V=>v(V),options:[{value:"runtime",label:f("project.mcps.scope_runtime"),description:f("project.mcps.scope_runtime_desc")},{value:"shared",label:f("project.mcps.scope_shared"),description:f("project.mcps.scope_shared_desc")},{value:"global",label:f("project.mcps.scope_global"),description:f("project.mcps.scope_global_desc")}]})}),r.jsx(de,{label:f("project.mcps.transport_label"),children:r.jsx(wt,{value:j,onChange:V=>w(V),options:[{value:"stdio",label:f("project.mcps.transport_stdio"),description:f("project.mcps.transport_stdio_desc")},{value:"http",label:f("project.mcps.transport_http"),description:f("project.mcps.transport_http_desc")}]})})]}),r.jsx(de,{label:f("project.mcps.name_label"),children:r.jsx(Ce,{value:k,onChange:V=>S(V.target.value),placeholder:f("project.mcps.name_ph"),disabled:p})}),j==="stdio"?r.jsxs(r.Fragment,{children:[r.jsx(de,{label:f("project.mcps.cmd_label"),children:r.jsx(Ce,{value:C,onChange:V=>E(V.target.value),placeholder:f("project.mcps.cmd_ph")})}),r.jsx(de,{label:f("project.mcps.args_label"),hint:f("project.mcps.args_hint_tokens"),children:r.jsx(f6,{args:N,onChange:R,varNames:s,onCreateVar:()=>q(!0)})}),r.jsx(de,{label:f("project.mcps.env_label"),hint:f("project.mcps.env_hint_tokens"),children:r.jsx(fj,{rows:T,onChange:O,keyPlaceholder:"API_KEY",valuePlaceholder:"${var.MY_TOKEN}",varNames:s,onCreateVar:()=>q(!0),emptyLabel:f("project.mcps.env_empty")})})]}):r.jsxs(r.Fragment,{children:[r.jsx(de,{label:f("project.mcps.url_label"),children:r.jsx(wb,{value:A,onChange:z,placeholder:f("project.mcps.url_ph"),varNames:s,onCreateVar:()=>q(!0)})}),r.jsx(de,{label:f("project.mcps.headers_label"),hint:f("project.mcps.headers_hint"),children:r.jsx(fj,{rows:B,onChange:L,keyPlaceholder:"Authorization",valuePlaceholder:"Bearer ${var.TOKEN}",varNames:s,onCreateVar:()=>q(!0),emptyLabel:f("project.mcps.headers_empty")})})]}),r.jsx(Zt,{checked:D,onChange:P,label:f("project.mcps.enabled_label")})]})}),H&&r.jsx(p6,{pid:n,onClose:()=>q(!1),onCreated:()=>{q(!1),c()}})]})}function f6({args:e,onChange:n,varNames:s,onCreateVar:o}){const l=(p,m)=>{const g=e.slice();g[p]=m,n(g)},c=p=>n(e.filter((m,g)=>g!==p)),d=()=>n([...e,""]);return r.jsxs("div",{className:"space-y-2",children:[e.map((p,m)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx("div",{className:"flex-1",children:r.jsx(wb,{value:p,onChange:g=>l(m,g),placeholder:f("agents_ui.arg_placeholder"),varNames:s,onCreateVar:o})}),r.jsx(ge,{type:"button",size:"sm",variant:"ghost",onClick:()=>c(m),"aria-label":f("agents_ui.remove_arg"),children:r.jsx(ia,{size:13})})]},m)),r.jsxs(ge,{type:"button",size:"sm",variant:"ghost",onClick:d,children:[r.jsx(nn,{size:12})," ",f("project.mcps.add_arg")]})]})}function p6({pid:e,onClose:n,onCreated:s}){const o=at(),l=String(e)==="0",[c,d]=x.useState(""),[p,m]=x.useState(""),[g,h]=x.useState(!1),[_,v]=x.useState(l?"global":"project"),k=async()=>{if(!c.trim()){o.error(f("project.vars.name_required"));return}if(!p){o.error(f("project.vars.value_required"));return}h(!0);try{await _c.upsert(e,{name:c.trim(),value:p,scope:_}),o.success(f("project.vars.added")),s()}catch(S){o.error(S?.message||f("common.error_generic"))}finally{h(!1)}};return r.jsx(Vn,{open:!0,onClose:()=>g?null:n(),title:f("project.vars.new_title"),description:f("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:g,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:k,loading:g,children:f("project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:f("project.vars.scope_label"),children:r.jsx(wt,{value:_,onChange:S=>v(S),options:[...l?[]:[{value:"project",label:f("project.vars.scope_project"),description:f("project.vars.scope_project_desc")}],{value:"global",label:f("project.vars.scope_global"),description:f("project.vars.scope_global_desc")}]})}),r.jsx(de,{label:f("project.vars.name_label"),hint:f("project.vars.name_hint"),children:r.jsx(Ce,{value:c,onChange:S=>d(S.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",autoFocus:!0})}),r.jsx(de,{label:f("project.vars.value_label"),hint:f("project.vars.value_hint"),children:r.jsx(Ce,{type:"password",value:p,onChange:S=>m(S.target.value),className:"font-mono text-xs"})})]})})}function m6({pid:e}){const n=at(),s=String(e)==="0",[o,l]=x.useState(s?"global":"all"),[c,d]=x.useState(!1),p=Qe(`/projects/${e}/vars?reveal=${c?1:0}`,()=>_c.list(e,{reveal:c})),[m,g]=x.useState(null),h=x.useMemo(()=>{if(!p.data)return[];const v=[],k=p.data.project||{},S=p.data.global||{};for(const[j,w]of Object.entries(k))v.push({name:j,scope:"project",masked:w});for(const[j,w]of Object.entries(S))k[j]===void 0&&v.push({name:j,scope:"global",masked:w});return v.filter(j=>o==="all"?!0:j.scope===o).sort((j,w)=>j.name.localeCompare(w.name))},[p.data,o]),_=async(v,k)=>{if(confirm(f("project.vars.delete_confirm",{name:v,scope:k})))try{await _c.remove(e,v,k),n.success(f("project.vars.removed")),p.mutate()}catch(S){n.error(S?.message||f("common.error_generic"))}};return r.jsxs(Ge,{title:f("project.vars.title"),description:f(s?"project.vars.subtitle_base":"project.vars.subtitle_project"),action:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zt,{checked:c,onChange:d,label:f("project.vars.reveal_all")}),r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>g({}),children:[r.jsx(nn,{size:14})," ",f("project.vars.new")]})]}),children:[!s&&r.jsxs("div",{className:"mb-3 flex items-center gap-2 text-xs",children:[r.jsx("span",{className:"text-muted-fg",children:f("project.vars.filter_label")}),r.jsx(zg,{active:o==="all",onClick:()=>l("all"),children:f("project.vars.filter_all")}),r.jsx(zg,{active:o==="project",onClick:()=>l("project"),children:f("project.vars.filter_project")}),r.jsx(zg,{active:o==="global",onClick:()=>l("global"),children:f("project.vars.filter_global")})]}),p.isLoading&&r.jsx(nt,{}),!p.isLoading&&h.length===0&&r.jsx(pt,{children:f("project.vars.empty")}),h.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:h.map(v=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-mono text-xs font-medium",children:v.name}),r.jsx(Ve,{tone:v.scope==="project"?"info":"muted",children:v.scope==="project"?f("project.vars.scope_project"):f("project.vars.scope_global")}),r.jsx("span",{className:"ml-2 font-mono text-xs text-muted-fg",children:v.masked}),r.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>g({name:v.name,scope:v.scope}),"aria-label":f("project.vars.edit_btn"),children:r.jsx(Ol,{size:13})}),!(s&&v.scope==="project")&&r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>_(v.name,v.scope),"aria-label":f("project.vars.delete_btn"),children:r.jsx(ia,{size:13})})]})]},`${v.scope}-${v.name}`))}),r.jsx(g6,{open:m!==null,initial:m||void 0,onClose:()=>g(null),pid:e,isBase:s,onSaved:()=>{g(null),p.mutate()}})]})}function zg({active:e,onClick:n,children:s}){return r.jsx("button",{type:"button",onClick:n,className:e?"rounded-full border border-primary/50 bg-primary/10 px-2 py-0.5 text-xs":"rounded-full border border-border bg-muted/30 px-2 py-0.5 text-xs hover:bg-muted/60",children:s})}function g6({open:e,onClose:n,pid:s,isBase:o,initial:l,onSaved:c}){const d=at(),[p,m]=x.useState(!1),[g,h]=x.useState(!1),[_,v]=x.useState(l?.name||""),[k,S]=x.useState(l?.value||""),[j,w]=x.useState(l?.scope||(o?"global":"project")),C=!!l?.name;x.useEffect(()=>{e&&(v(l?.name||""),S(l?.value||""),w(l?.scope||(o?"global":"project")),h(!1))},[e,l?.name,l?.scope,l?.value,o]);const E=async()=>{if(!_.trim()){d.error(f("project.vars.name_required"));return}if(!k){d.error(f("project.vars.value_required"));return}m(!0);try{await _c.upsert(s,{name:_.trim(),value:k,scope:j}),d.success(f(C?"project.vars.updated":"project.vars.added")),c()}catch(N){d.error(N?.message||f("common.error_generic"))}finally{m(!1)}};return r.jsx(Vn,{open:e,onClose:()=>p?null:n(),title:f(C?"project.vars.edit_title":"project.vars.new_title"),description:f("project.vars.new_desc"),size:"sm",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:p,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:E,loading:p,children:f(C?"project.vars.save_btn":"project.vars.add_btn")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:f("project.vars.scope_label"),children:r.jsx(wt,{value:j,onChange:N=>w(N),options:[...o?[]:[{value:"project",label:f("project.vars.scope_project"),description:f("project.vars.scope_project_desc")}],{value:"global",label:f("project.vars.scope_global"),description:f("project.vars.scope_global_desc")}]})}),r.jsx(de,{label:f("project.vars.name_label"),hint:f("project.vars.name_hint"),children:r.jsx(Ce,{value:_,onChange:N=>v(N.target.value.toUpperCase().replace(/[^A-Z0-9_]/g,"_")),placeholder:"MY_API_KEY",disabled:C,autoFocus:!C})}),r.jsx(de,{label:f("project.vars.value_label"),hint:f("project.vars.value_hint"),children:r.jsxs("div",{className:"relative",children:[r.jsx(Ce,{type:g?"text":"password",value:k,onChange:N=>S(N.target.value),placeholder:C?f("project.vars.value_edit_ph"):"",className:"pr-9 font-mono text-xs",autoFocus:C}),r.jsx("button",{type:"button",onClick:()=>h(N=>!N),className:"absolute right-2 top-1/2 -translate-y-1/2 text-muted-fg hover:text-fg","aria-label":f(g?"project.vars.hide":"project.vars.reveal"),children:g?r.jsx(GT,{size:14}):r.jsx(lf,{size:14})})]})})]})})}function kb({value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l=!1,disabled:c=!1,placeholder:d,autoFocus:p,minRows:m=2,maxRows:g=8,footer:h,className:_}){const v=x.useRef(null);x.useLayoutEffect(()=>{const S=v.current;if(!S)return;const j=()=>{S.style.height="auto",S.offsetHeight;const C=parseFloat(getComputedStyle(S).lineHeight)||20,E=C*m,N=C*g;S.style.height=`${Math.min(Math.max(S.scrollHeight,E),N)}px`,S.style.overflowY=S.scrollHeight>N?"auto":"hidden"};j();const w=requestAnimationFrame(j);return()=>cancelAnimationFrame(w)},[e,m,g]);const k=e.trim().length>0&&!c;return r.jsxs("div",{className:Et("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",_),children:[r.jsx("textarea",{ref:v,rows:m,value:e,autoFocus:p,disabled:c,placeholder:d,onChange:S=>n(S.target.value),onKeyDown:S=>{if(S.key==="Enter"&&!S.shiftKey){if(S.preventDefault(),l||!k)return;s()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),r.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[r.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:h}),l&&o?r.jsx($s,{type:"button",size:"icon-sm",variant:"destructive",onClick:o,"aria-label":f("chat_ui.stop"),title:f("chat_ui.stop"),children:r.jsx(nk,{className:"size-3.5",fill:"currentColor"})}):r.jsx($s,{type:"button",size:"icon-sm",variant:"default",onClick:s,disabled:!k,"aria-label":f("chat_ui.send"),title:f("chat_ui.send"),children:r.jsx(MT,{className:"size-4"})})]})]})}function Sb({value:e,onChange:n,disabled:s}){const[o,l]=x.useState(!1),[c,d]=x.useState(""),[p,m]=x.useState([]),[g,h]=x.useState(!1),_=x.useRef(null);x.useEffect(()=>{if(!o)return;const w=C=>{_.current&&!_.current.contains(C.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:C}=await Kd.list(),E=await Promise.all(C.map(N=>Kd.models({engine:N}).then(R=>(R.models||[]).map(T=>T.includes(":")?T:`${N}:${T}`)).catch(()=>[])));if(!w){const N=Array.from(new Set(E.flat())).sort();m(N),h(!0)}}catch{w||h(!0)}})(),()=>{w=!0}},[o,g]);const v=c.trim().toLowerCase(),k=v?p.filter(w=>w.toLowerCase().includes(v)):p,S=e||f("shared_ui.auto"),j=w=>{n(w),l(!1),d("")};return r.jsxs("div",{ref:_,className:"relative",children:[r.jsxs("button",{type:"button",disabled:s,onClick:()=>l(w=>!w),"data-testid":"chat-model-picker",className:Oe("flex max-w-[200px] items-center gap-1 rounded-md border border-transparent px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors","hover:bg-accent/60 hover:text-foreground",e&&"text-foreground"),title:f("chat_ui.pick_model"),"aria-label":f("chat_ui.pick_model"),children:[r.jsx(tk,{className:"size-3 shrink-0"}),r.jsx("span",{className:"truncate font-mono",children:S}),r.jsx(Ar,{className:"size-3 shrink-0 opacity-60"})]}),o&&r.jsxs("div",{className:"absolute bottom-full left-0 z-50 mb-1.5 w-64 rounded-lg border border-border bg-popover p-1.5 shadow-md ring-1 ring-foreground/10",children:[r.jsx("input",{autoFocus:!0,value:c,placeholder:f("shared_ui.model_filter_ph"),onChange:w=>d(w.target.value),onKeyDown:w=>{w.key==="Enter"&&c.trim()&&j(c.trim())},className:"mb-1 w-full rounded-md border border-border bg-background px-2 py-1 text-xs outline-none focus:border-foreground/30"}),r.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:w=>{w.preventDefault(),j("")},className:Oe("flex w-full items-center justify-between rounded-md px-2 py-1 text-left text-xs hover:bg-accent hover:text-accent-fg",!e&&"bg-accent/50"),children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(bo,{className:"size-3"})," ",f("shared_ui.auto_router")]}),!e&&r.jsx(uc,{className:"size-3"})]})}),!g&&r.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:f("shared_ui.loading_models")}),g&&k.length===0&&c.trim()&&r.jsx("li",{children:r.jsx("button",{type:"button",onMouseDown:w=>{w.preventDefault(),j(c.trim())},className:"w-full rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",children:f("shared_ui.use_value",{value:c.trim()})})}),k.map(w=>r.jsx("li",{children:r.jsxs("button",{type:"button",onMouseDown:C=>{C.preventDefault(),j(w)},className:Oe("flex w-full items-center justify-between rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",w===e&&"bg-accent/50"),children:[r.jsx("span",{className:"truncate",children:w}),w===e&&r.jsx(uc,{className:"size-3 shrink-0"})]})},w))]})]})]})}function h6({onSend:e,onStop:n,streaming:s,model:o,onModelChange:l}){const[c,d]=x.useState(""),p=()=>{const m=c.trim();m&&(d(""),e(m))};return r.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:r.jsx(kb,{value:c,onValueChange:d,onSubmit:p,onStop:n,busy:s,placeholder:f("project.chat.placeholder"),maxRows:12,footer:l?r.jsx(Sb,{value:o||"",onChange:l,disabled:s}):void 0})})}function x6(){return{read_file:{icon:KT,label:f("shared_ui.tool_read_file")},write_file:{icon:XT,label:f("shared_ui.tool_write_file")},edit_file:{icon:Md,label:f("shared_ui.tool_edit_file")},list_files:{icon:Qw,label:f("shared_ui.tool_list_files")},search_files:{icon:vd,label:f("shared_ui.tool_search_files")},search_messages:{icon:vd,label:f("shared_ui.tool_search_messages")},tail_messages:{icon:vd,label:f("shared_ui.tool_tail_messages")},run_shell:{icon:Er,label:f("shared_ui.tool_run_shell")},send_telegram:{icon:Ya,label:f("shared_ui.tool_send_telegram")},call_agent:{icon:gn,label:f("shared_ui.tool_call_agent")},call_mcp:{icon:mA,label:f("shared_ui.tool_call_mcp")},call_runtime:{icon:gn,label:f("shared_ui.tool_call_runtime")},create_task:{icon:iA,label:f("shared_ui.tool_create_task")}}}const Q2=new Set(["write_file","edit_file"]);function b6(e){return x6()[e]||{icon:zl,label:e}}function _6(e,n){if(!n)return"";const s=l=>typeof n[l]=="string"?n[l]:void 0,o=s("path")||s("file")||s("pattern")||s("query")||s("command")||s("slug")||s("name")||s("agent");return o?String(o):""}function pj(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function v6({status:e}){return e==="running"?r.jsx(uf,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?r.jsx(bo,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?r.jsx(qT,{className:"size-3 shrink-0 text-amber-400"}):r.jsx(uc,{className:"size-3 shrink-0 text-emerald-400"})}function y6({part:e}){const[n,s]=x.useState(!1),{icon:o,label:l}=b6(e.tool),c=_6(e.tool,e.args),d=Q2.has(e.tool),p=!!e.args||e.result!==void 0;return r.jsxs("div",{className:Oe("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[r.jsxs("button",{type:"button",onClick:()=>p&&s(m=>!m),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[p?r.jsx(Ec,{className:Oe("size-3 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")}):r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(o,{className:Oe("size-3.5 shrink-0",d?"text-violet-400":"text-muted-foreground")}),r.jsx("span",{className:"shrink-0 font-medium",children:l}),c&&r.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),r.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&r.jsx("span",{className:"text-[10px] text-amber-400",children:f("shared_ui.dedup")}),r.jsx(v6,{status:e.status})]})]}),n&&p&&r.jsxs("div",{className:"space-y-2 border-t border-border/60 px-2.5 py-2",children:[e.args&&Object.keys(e.args).length>0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:f("shared_ui.args")}),r.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:pj(e.args)})]}),e.result!==void 0&&r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:f("shared_ui.result")}),r.jsx("pre",{className:Oe("max-h-64 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed",e.status==="error"?"text-rose-300":"text-foreground"),children:pj(e.result)})]})]})]})}function j6(e){const n=e.args;return(n&&Array.isArray(n.questions)?n.questions:[]).map(o=>typeof o=="string"?o:o&&typeof o=="object"&&typeof o.question=="string"?o.question:null).filter(o=>!!o)}function w6({part:e,pending:n}){const s=j6(e),o=f(n?"ask_panel.status_waiting":"ask_panel.status_received");return r.jsxs("div",{className:Oe("rounded-2xl border px-3 py-2 text-sm shadow-sm",n?"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":n?"pending":"answered",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[n?r.jsx(uf,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):r.jsx(ux,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),r.jsx(Zw,{className:"size-3.5 shrink-0 text-muted-foreground"}),r.jsx("span",{className:"text-[12px] font-medium",children:o}),s.length>1&&r.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[s.length," preguntas"]})]}),s.length>0&&r.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:s.map((l,c)=>r.jsx("li",{className:"list-disc",children:l},c))})]})}function Z2(e){const n=e.split(`
606
- `),s=[];let o=null;for(const l of n)if(l.startsWith("- "))o&&s.push(o),o={question:l.slice(2),answer:"",skipped:!1};else if(l.startsWith(" → ")&&o){const c=l.slice(4);o.answer=c,o.skipped=c==="(omitido)"}else return null;return o&&s.push(o),s.length>0?s:null}function k6({text:e}){const n=Z2(e);return n?r.jsx("div",{className:"flex w-full justify-center",children:r.jsxs("div",{className:"w-full max-w-[85%] rounded-2xl border border-border/70 bg-card/40 px-4 py-3 shadow-sm","data-testid":"ask-answers-card",children:[r.jsxs("div",{className:"mb-2 flex items-center gap-1.5 text-[11px] font-medium text-muted-foreground",children:[r.jsx(Zw,{className:"size-3.5"}),r.jsx("span",{children:f("ask_panel.answers_header")})]}),r.jsx("ul",{className:"space-y-2.5",children:n.map((s,o)=>r.jsxs("li",{className:"space-y-0.5",children:[r.jsx("div",{className:"text-sm font-medium leading-snug text-foreground",children:s.question}),r.jsx("div",{className:Oe("whitespace-pre-wrap text-[13px] leading-snug",s.skipped?"italic text-muted-foreground/70":"text-muted-foreground"),children:s.answer})]},o))})]})}):null}function Fh(e){return e.parts.filter(n=>n.kind==="text").map(n=>n.text).join(`
607
-
608
- `).trim()}function S6(e){const n=e.args?.questions;if(!Array.isArray(n)||n.length===0)return null;const s=n.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 s.length===0?null:`[ask_questions]
609
- ${s.join(`
610
- `)}`}function C6(e){const n=[];for(const s of e.parts)if(s.kind==="text"&&s.text)n.push(s.text);else if(s.kind==="tool"&&s.tool==="ask_questions"){const o=S6(s);o&&n.push(o)}return n.join(`
611
-
612
- `).trim()}const E6=e=>[{kind:"text",text:e}];function N6(e){if(!e||typeof e!="object")return!1;const n=e;return"error"in n&&!!n.error}function Cb(e,n){const s=o=>({...e,notes:[...e.notes||[],o]});switch(n.type){case"model_start":return n.model?{...e,model:n.model}:e;case"model_routed":{const o=n.model?{...e,model:n.model}:e;return n.from_fallback?{...o,notes:[...o.notes||[],`routing fell back → ${n.model}`]}:o}case"engine_failed":return s(`engine ${n.model||"?"} failed → ${n.retry_with||"retry"}`);case"model_retry":return s(`retry (${n.reason||"?"})`);case"tools_suppressed":return s(`tools suppressed: ${(n.tools||[]).join(", ")}`);case"skill_inspector":{const o=n.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 n.text?{...e,parts:[...e.parts,{kind:"text",text:n.text}]}:e;case"tool_start":return n.trace?{...e,parts:[...e.parts,{kind:"tool",id:n.trace.id,tool:n.trace.tool,args:n.trace.args,status:"running"}]}:e;case"tool_deduped":return n.trace?{...e,parts:e.parts.map(o=>o.kind==="tool"&&o.id===n.trace.id?{...o,status:"deduped"}:o)}:e;case"tool_result":if(!n.trace)return e;{const o=N6(n.trace.result);return{...e,parts:e.parts.map(l=>l.kind==="tool"&&l.id===n.trace.id?{...l,result:n.trace.result,status:o?"error":l.status==="deduped"?"deduped":"done"}:l)}}case"final":return{...e,pending:!1,usage:n.result?.usage??e.usage,model:e.model??n.result?.name,parts:n.result?.text&&!e.parts.some(o=>o.kind==="text")?[...e.parts,{kind:"text",text:n.result.text}]:e.parts};default:{const o=n.delta||n.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 R6(e,n){const[s,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.useCallback(w=>{o(C=>{const E=[...C],N=E[E.length-1];return N&&N.role==="assistant"&&(E[E.length-1]=w(N)),E})},[]),_=x.useCallback(w=>{if(w.type==="error"){n?.(w.error||f("shared_ui.err_stream"));return}h(C=>Cb(C,w))},[h,n]),v=x.useCallback(async(w,C={})=>{const E=w.trim();if(!E||l)return;const N=()=>new Date().toISOString(),R=s.map(O=>({role:O.role,content:C6(O)}));if(o(O=>[...O,{role:"user",parts:E6(E),ts:N()},{role:"assistant",parts:[],ts:N(),pending:!0}]),c(!0),C.agentSlug){try{const O=await tn.chat(e,C.agentSlug,{prompt:E,conversation_id:g.current,model:C.model||void 0,channel:"web"});g.current=O.conversation_id,p(O.conversation_id),h(A=>({...A,pending:!1,model:O.engine,parts:[{kind:"text",text:O.text}]}))}catch(O){n?.(O?.message||f("shared_ui.err_chat_failed")),o(A=>A.filter((z,B)=>B!==A.length-1))}finally{c(!1)}return}const T=new AbortController;m.current=T;try{await qS.stream(e,{prompt:E,previousMessages:R,model:C.model||void 0,channel:"web"},_,T.signal),h(O=>({...O,pending:!1}))}catch(O){T.signal.aborted?h(A=>({...A,pending:!1,parts:[...A.parts,{kind:"text",text:f("code_module.stopped")}]})):(n?.(O?.message||f("shared_ui.err_stream_failed")),o(A=>A.filter((z,B)=>B!==A.length-1)))}finally{c(!1),m.current=null}},[e,s,l,_,h,n]),k=x.useCallback(()=>m.current?.abort(),[]),S=x.useCallback(()=>{l||(g.current=void 0,p(void 0),o([]))},[l]),j=x.useCallback(async(w,C)=>{if(!l)try{const N=(await nb.get(e,w,C)).messages.filter(R=>R.role==="user"||R.role==="assistant").map(R=>({role:R.role,parts:[{kind:"text",text:R.content}],ts:R.ts||new Date().toISOString()}));g.current=C,p(C),o(N)}catch(E){n?.(E?.message||f("shared_ui.err_load_conversation"))}},[e,l,n]);return{msgs:s,send:v,stop:k,clear:S,load:j,streaming:l,conversationId:d}}function T6({msg:e,isLast:n,isAskAnswer:s,onCopy:o}){const l=e.role==="user",c=Fh(e),d=e.parts.some(p=>p.kind==="tool");if(l&&s){const p=Fh(e);if(Z2(p))return r.jsx(k6,{text:p})}return r.jsxs("div",{className:Oe("group flex items-start gap-2",l?"justify-end":"justify-start"),children:[!l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(gn,{size:14})}),r.jsxs("div",{className:Oe("flex min-w-0 flex-col gap-1.5",l?"items-end":"w-full max-w-[85%]"),children:[!l&&e.notes&&e.notes.length>0&&r.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((p,m)=>r.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[r.jsx(rA,{size:10})," ",p]},m))}),!l&&e.inspector&&(e.inspector.loaded?.length||e.inspector.hinted?.length)?r.jsxs("div",{className:"flex flex-wrap items-center gap-1 text-[10px] text-sky-400/90",title:f("shared_ui.skill_inspector_title",{embedder:e.inspector.embedder||"RAG"}),children:[r.jsx(ls,{size:10}),e.inspector.loaded?.map(p=>r.jsx("span",{className:"rounded bg-sky-500/15 px-1 py-0.5 font-mono",children:p},`l-${p}`)),e.inspector.hinted?.map(p=>r.jsxs("span",{className:"rounded border border-sky-500/30 px-1 py-0.5 font-mono opacity-70",children:[p,"?"]},`h-${p}`))]}):null,e.parts.map((p,m)=>p.kind==="tool"?p.tool==="ask_questions"&&!l?r.jsx(w6,{part:p,pending:!!n},`${p.id}-${m}`):r.jsx(y6,{part:p},`${p.id}-${m}`):p.text?r.jsx("div",{className:Oe("whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed shadow-sm",l?"rounded-br-sm border border-emerald-500/30 bg-emerald-500/10 text-foreground dark:bg-emerald-500/15":"w-full rounded-bl-sm border border-border bg-card text-foreground"),children:p.text},m):null),!l&&e.pending&&e.parts.length===0&&r.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),r.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[r.jsx("span",{children:A6(e.ts)}),!l&&e.model&&r.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!l&&d&&r.jsxs("span",{children:["· ",f("shared_ui.tools_count",{n:e.parts.filter(p=>p.kind==="tool").length})]}),o&&c&&r.jsxs("button",{type:"button",onClick:()=>o(c),className:"inline-flex items-center gap-1 hover:text-foreground",title:f("chat_ui.copy"),"aria-label":f("chat_ui.copy"),children:[r.jsx(Ad,{size:10})," ",f("chat_ui.copy")]})]})]}),l&&r.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:r.jsx(xx,{size:14})})]})}function A6(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function Eb({msgs:e,onCopy:n}){const s=x.useRef(null);if(x.useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(pt,{children:f("project.chat.empty")})});const o=e.length-1;return r.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((l,c)=>r.jsx(T6,{msg:l,isLast:c===o,isAskAnswer:M6(e,c),onCopy:n},c)),r.jsx("div",{ref:s})]})}function M6(e,n){const s=e[n];if(!s||s.role!=="user")return!1;const o=e[n-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 O6(e){if(!e)return;const n=e.path??e.file??e.filename;return typeof n=="string"?n:void 0}function W2({msgs:e}){const[n,s]=x.useState(!1),{inTok:o,outTok:l,toolCount:c,changed:d,model:p}=x.useMemo(()=>{let g=0,h=0,_=0,v;const k=new Set,S=[];for(const j of e)if(j.role==="assistant"){j.usage&&(g+=j.usage.input_tokens||0,h+=j.usage.output_tokens||0),j.model&&(v=j.model);for(const w of j.parts)if(w.kind==="tool"&&(_+=1,Q2.has(w.tool)&&w.status!=="error")){const C=O6(w.args);C&&!k.has(C)&&(k.add(C),S.push({path:C,tool:w.tool}))}}return{inTok:g,outTok:h,toolCount:_,changed:S,model:v}},[e]),m=o+l;return m===0&&c===0?null:r.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[r.jsxs("button",{type:"button",onClick:()=>d.length>0&&s(g=>!g),className:Oe("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",d.length>0&&"hover:text-foreground"),children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(cf,{size:12})," ",Dg(m)," tok",r.jsxs("span",{className:"text-muted-foreground/60",children:["(",Dg(o),"↑ / ",Dg(l),"↓)"]})]}),c>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zl,{size:12})," ",c," tools"]}),d.length>0&&r.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[r.jsx(Md,{size:12})," ",d.length," archivos"]}),p&&r.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:p}),d.length>0&&r.jsx(Ar,{className:Oe("size-3 shrink-0 transition-transform",n&&"rotate-180")})]}),n&&d.length>0&&r.jsx("ul",{className:"max-h-40 space-y-0.5 overflow-y-auto border-t border-border/60 px-4 py-2",children:d.map(g=>r.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[r.jsx(Md,{size:11,className:"shrink-0 text-violet-400"}),r.jsx("span",{className:"truncate",children:g.path}),r.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:g.tool==="write_file"?"write":"edit"})]},g.path))})]})}function Dg(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function ul(){return{picked:new Set,text:"",skipped:!1}}function mj(e,n){const s=[];return e.forEach((o,l)=>{const c=n[l]||ul();if(c.skipped){s.push(`- ${o.question}
613
- → (omitido)`);return}const d=[];if(o.options&&o.options.length>0){const g=[...c.picked].sort((h,_)=>h-_).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)";s.push(`- ${o.question}
614
- → ${m}`)}),s.join(`
615
- `)}function J2({turnKey:e,questions:n,onSubmit:s,onDismiss:o,disabled:l}){const c=n.length,[d,p]=x.useState(0),[m,g]=x.useState(()=>n.map(()=>ul()));x.useEffect(()=>{p(0),g(n.map(()=>ul()))},[e,n]);const h=n[d],_=m[d]||ul(),v=!!h?.options&&h.options.length>0,k=!!h?.multiSelect,S=h?.allowText!==!1,j=O=>{g(A=>{const z=[...A],B=z[d]||ul();return z[d]={...B,...O,skipped:!1},z})},w=O=>{g(A=>{const z=[...A],B=z[d]||ul(),L=new Set(B.picked);return k?L.has(O)?L.delete(O):L.add(O):(L.clear(),L.add(O)),z[d]={...B,picked:L,skipped:!1},z})},C=x.useMemo(()=>!0,[]),E=d===c-1,N=()=>p(O=>Math.max(0,O-1)),R=()=>{if(E){s(mj(n,m));return}p(O=>Math.min(c-1,O+1))},T=()=>{if(g(O=>{const A=[...O];return A[d]={picked:new Set,text:"",skipped:!0},A}),E){const O=m.map((A,z)=>z===d?{picked:new Set,text:"",skipped:!0}:A);s(mj(n,O))}else p(O=>Math.min(c-1,O+1))};return x.useEffect(()=>{const O=A=>{if(l)return;const z=A.target?.tagName?.toLowerCase(),B=z==="input"||z==="textarea";if(A.key==="Enter"&&(A.metaKey||A.ctrlKey)){A.preventDefault(),R();return}if(!B&&v&&/^[1-9]$/.test(A.key)){const L=parseInt(A.key,10)-1;L<(h?.options?.length||0)&&(A.preventDefault(),w(L))}};return window.addEventListener("keydown",O),()=>window.removeEventListener("keydown",O)}),!h||c===0?null:r.jsxs("div",{className:Oe("mx-3 mb-2 rounded-xl border border-border bg-card/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-card/80",l&&"pointer-events-none opacity-60"),"data-testid":"inline-ask-panel",children:[r.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[r.jsxs("span",{className:"mt-0.5 shrink-0 rounded-md bg-amber-500/15 px-1.5 py-0.5 text-[10px] font-mono font-medium text-amber-700 dark:text-amber-300",children:[d+1,"/",c]}),h.header&&r.jsx("span",{className:"mt-0.5 shrink-0 rounded-md bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:h.header}),r.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:h.question}),o&&r.jsx("button",{type:"button",onClick:o,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":f("common.close"),children:r.jsx(bo,{className:"size-3.5"})})]}),r.jsxs("div",{className:"space-y-1 px-2 py-2",children:[v&&h.options.map((O,A)=>{const z=_.picked.has(A);return r.jsxs("button",{type:"button",onClick:()=>w(A),className:Oe("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",z?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("div",{className:"text-xs font-medium",children:O.label}),O.description&&r.jsx("div",{className:"text-[11px] text-muted-foreground",children:O.description})]}),k?r.jsx("span",{className:Oe("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",z?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:z&&r.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):r.jsx("span",{className:Oe("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",z?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:A+1})]},`${A}:${O.label}`)}),(S||!v)&&r.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[v&&r.jsx("div",{className:"mb-1 text-xs font-medium",children:f("ask_panel.other")}),r.jsx("input",{type:"text",value:_.text,onChange:O=>j({text:O.target.value}),placeholder:f(v?"ask_panel.other_placeholder":"ask_panel.text_placeholder"),className:"w-full rounded border border-border bg-background px-2 py-1 text-xs outline-none focus:border-emerald-500"})]})]}),r.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[r.jsx("button",{type:"button",onClick:N,disabled:d===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:f("ask_panel.back")}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx("button",{type:"button",onClick:T,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:f("ask_panel.skip")}),r.jsxs("button",{type:"button",onClick:R,disabled:!C,className:"inline-flex items-center gap-1 rounded bg-emerald-500/15 px-2 py-1 text-[11px] font-medium text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[f(E?"ask_panel.submit":"ask_panel.next"),r.jsx(VT,{className:"size-3 opacity-60"})]})]})]})]})}function z6(e){if(typeof e=="string")return{question:e,options:[],multiSelect:!1,allowText:!0};if(!e||typeof e!="object")return null;const n=e,s=typeof n.question=="string"?n.question:"";if(!s)return null;const l=(Array.isArray(n.options)?n.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:s,header:typeof n.header=="string"?n.header:void 0,options:l,multiSelect:n.multiSelect===!0,allowText:n.allowText!==!1}}function eC(e){if(!e.length)return null;const n=e[e.length-1];if(n.role!=="assistant")return null;let s=null,o=-1;for(let g=n.parts.length-1;g>=0;g--){const h=n.parts[g];if(h.kind==="tool"&&h.tool==="ask_questions"){s=h,o=g;break}}if(!s||o<0)return null;let l=null;if(typeof s.result=="string")try{l=JSON.parse(s.result)}catch{l=null}else s.result&&typeof s.result=="object"&&(l=s.result);const c=[];Array.isArray(s.args?.questions)&&c.push(s.args.questions),l&&Array.isArray(l.questions)&&c.push(l.questions);let d=[];for(const g of c)if(d=g.map(z6).filter(h=>!!h),d.length>0)break;return d.length?{turnKey:`${n.ts||""}#${o}`,questions:d}:null}const Yh={live:{label:"Live",icon:ls,order:0},telegram:{label:"Telegram",icon:Ya,order:1},voice:{label:"Voice",icon:Ww,order:2},desktop:{label:"Desktop",icon:Jw,order:3},web:{label:"Web",icon:mx,order:4},a2a:{label:"Agent ↔ Agent",icon:gn,order:5},schedule:{label:"Schedule",icon:vA,order:6},other:{label:"Other",icon:fx,order:7}};function D6(e){if(!e)return"web";const n=e.toLowerCase();return n==="telegram"?"telegram":n==="voice"||n==="overlay"?"voice":n==="desktop"?"desktop":n==="web"||n==="sidebar"||n==="web-sidebar"?"web":n==="a2a"||n.startsWith("agent")?"a2a":n==="schedule"||n==="cron"||n==="routine"?"schedule":"other"}function L6({pid:e,slug:n,onLoaded:s}){const{data:o}=Qe(`/projects/${e}/agents/${n}/conversations`,()=>nb.list(e,n),{revalidateOnFocus:!1});return x.useEffect(()=>{s(n,o)},[n,o]),null}function P6({pid:e,agents:n,superAgentSlug:s,superAgentLabel:o,selected:l,onSelect:c,onNewChat:d}){const[p,m]=x.useState(""),[g,h]=x.useState(""),[_,v]=x.useState({}),[k,S]=x.useState({}),j=(A,z)=>{z&&S(B=>{const L=B[A];return L&&L.length===z.length&&L===z?B:{...B,[A]:z}})},w=x.useMemo(()=>{const A=[];for(const z of n)for(const B of k[z.slug]||[])A.push({...B,agent_slug:B.agent_slug||z.slug});return A},[n,k]),C=x.useMemo(()=>{const A=p.trim().toLowerCase();return w.filter(z=>!(g&&z.agent_slug!==g||A&&!`${z.title||""} ${z.id} ${z.agent_slug}`.toLowerCase().includes(A)))},[w,p,g]),E=x.useMemo(()=>{const A=new Map;for(const z of C){const B=D6(z.channel),L=A.get(B);L?L.push(z):A.set(B,[z])}return Array.from(A.entries()).map(([z,B])=>({key:z,items:B.sort((L,D)=>new Date(D.started_at||0).getTime()-new Date(L.started_at||0).getTime())})).sort((z,B)=>Yh[z.key].order-Yh[B.key].order)},[C]),N=x.useMemo(()=>{if(g===s)return[{slug:s,label:o}];const A=[];g||A.push({slug:s,label:o});for(const z of n)g&&z.slug!==g||A.push({slug:z.slug,label:z.slug});return A},[n,g,s,o]),R=x.useMemo(()=>[{value:"",label:f("project.chat.list.all_agents")},{value:s,label:o},...n.map(A=>({value:A.slug,label:A.slug}))],[n,s,o]),T=w.length+N.length,O=Object.keys(k).length>0||n.length===0;return r.jsxs("aside",{className:"flex h-full w-72 shrink-0 flex-col border-r border-border bg-card/30",children:[n.map(A=>r.jsx(L6,{pid:e,slug:A.slug,onLoaded:j},A.slug)),r.jsxs("header",{className:"flex h-[57px] shrink-0 items-center justify-between gap-2 border-b border-border px-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"truncate text-sm font-semibold",children:f("project.chat.list.title")}),r.jsx("p",{className:"text-[10px] text-muted-fg",children:f("project.chat.list.count",{n:T})})]}),r.jsxs("button",{type:"button",onClick: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:[r.jsx(nn,{className:"size-3"})," ",f("project.chat.list.new")]})]}),r.jsxs("div",{className:"space-y-2 border-b border-border p-2",children:[r.jsx(Ce,{value:p,onChange:A=>m(A.target.value),placeholder:f("project.chat.list.search")}),r.jsx(wt,{value:g,onChange:h,options:R})]}),r.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-2",children:[!O&&r.jsx("div",{className:"px-2 py-1",children:r.jsx(nt,{})}),N.length>0&&r.jsx(gj,{keyName:"live",count:N.length,collapsed:!!_.live,onToggle:()=>v(A=>({...A,live:!A.live})),children:N.map(A=>{const z=A.slug===s,B=l.kind==="live"&&l.agentSlug===A.slug;return r.jsx(hj,{title:z?A.label:f("project.chat.list.live_with",{slug:A.slug}),subtitle:f("project.chat.list.live_subtitle"),badge:z?"super":A.slug,selected:B,onClick:()=>c({kind:"live",agentSlug:A.slug})},`live-${A.slug}`)})}),E.map(A=>r.jsx(gj,{keyName:A.key,count:A.items.length,collapsed:!!_[A.key],onToggle:()=>v(z=>({...z,[A.key]:!z[A.key]})),children:A.items.map(z=>{const B=l.kind==="conv"&&l.agentSlug===z.agent_slug&&l.convId===z.id;return r.jsx(hj,{title:z.title||z.id,subtitle:[z.agent_slug,`${z.messages??0} msg`].filter(Boolean).join(" · "),badge:z.agent_slug,timeAgo:z.started_at,selected:B,onClick:()=>c({kind:"conv",agentSlug:z.agent_slug,convId:z.id})},`${z.agent_slug}-${z.id}`)})},A.key)),O&&w.length===0&&r.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-fg",children:f("project.chat.list.empty")})]})]})}function gj({keyName:e,count:n,collapsed:s,onToggle:o,children:l}){const c=Yh[e],d=c.icon;return r.jsxs("section",{className:"space-y-1",children:[r.jsxs("button",{type:"button",onClick:o,className:"flex w-full items-center justify-between rounded-md px-2 py-1 text-muted-fg hover:bg-accent/30",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s?r.jsx(Ec,{className:"size-3"}):r.jsx(Ar,{className:"size-3"}),r.jsx(d,{className:"size-3"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider",children:c.label})]}),r.jsx("span",{className:"text-[10px]",children:n})]}),!s&&r.jsx("div",{className:"space-y-0.5",children:l})]})}function hj({title:e,subtitle:n,badge:s,timeAgo:o,selected:l,onClick:c}){return r.jsxs("button",{type:"button",onClick:c,className:fc("w-full rounded-md border px-2.5 py-2 text-left transition-colors",l?"border-primary/50 bg-primary/10":"border-transparent hover:border-border hover:bg-accent/40"),children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("p",{className:fc("truncate text-sm",l?"font-semibold":"font-medium"),children:e}),o&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-0.5 text-[10px] text-muted-fg",children:[r.jsx(UT,{className:"size-2.5"}),I6(o)]})]}),r.jsxs("div",{className:"mt-0.5 flex items-center justify-between gap-2 text-[10px] text-muted-fg",children:[r.jsx("span",{className:"truncate",children:n}),s&&r.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded bg-accent/50 px-1.5 py-0.5",children:[r.jsx(xx,{className:"size-2.5"}),s]})]})]})}function I6(e){if(!e)return"";const n=new Date(e).getTime();if(!Number.isFinite(n))return"";const s=Date.now()-n,o=Math.floor(s/6e4);if(o<1)return"now";if(o<60)return`${o}m`;const l=Math.floor(o/60);return l<24?`${l}h`:`${Math.floor(l/24)}d`}const fd="__super_agent__";function B6({pid:e}){const n=at(),[s]=Uw(),o=Qe(`/projects/${e}/agents`,()=>tn.list(e)),[l,c]=x.useState(!1),[d,p]=x.useState(""),[m,g]=x.useState(null),{msgs:h,send:_,stop:v,clear:k,load:S,streaming:j,conversationId:w}=R6(e,q=>n.error(q)),C=ob(),E=s.get("agent"),[N,R]=x.useState(E?{kind:"live",agentSlug:E}:{kind:"live",agentSlug:fd}),T=o.data||[],O=q=>q===fd,A=x.useMemo(()=>N.kind==="live"?T.find(q=>q.slug===N.agentSlug):T.find(q=>q.slug===N.agentSlug),[T,N]),z=O(N.agentSlug);x.useEffect(()=>{N.kind==="conv"?S(N.agentSlug,N.convId):w&&k()},[N.kind,N.kind==="conv"?N.convId:N.agentSlug]);const B=async q=>{if(z){await _(q,{model:d||void 0});return}A&&await _(q,{model:d||void 0,agentSlug:A.slug})},L=async q=>{try{await navigator.clipboard.writeText(q),n.info(f("project.chat.copied"))}catch{}},D=()=>{R({kind:"live",agentSlug:fd}),k()},P=z?f("project.chat.superagent_title",{persona:C}):N.kind==="conv"?N.convId:f("project.chat.title"),H=z?f("project.chat.superagent_subtitle",{persona:C}):N.kind==="conv"?f("project.chat.loaded_subtitle",{slug:N.agentSlug}):f("project.chat.subtitle");return o.isLoading?r.jsx(nt,{}):r.jsxs("div",{className:"flex h-full overflow-hidden rounded-xl border border-border bg-card/40",children:[r.jsx(P6,{pid:e,agents:T,superAgentSlug:fd,superAgentLabel:f("agents_ui.super_agent_label",{persona:C}),selected:N,onSelect:R,onNewChat:D}),r.jsxs("section",{className:"flex min-w-0 flex-1 flex-col",children:[r.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("h2",{className:"truncate text-sm font-semibold",children:P}),r.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:H})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[z?r.jsx(Ve,{tone:"success",children:f("agents_ui.super_agent_badge")}):A?.model&&r.jsx(Ve,{tone:"info",children:A.model}),N.kind==="conv"&&r.jsx(Ve,{tone:"info",children:w||"…"}),!T.length&&!z&&r.jsxs(ge,{variant:"primary",size:"sm",onClick:()=>c(!0),children:[r.jsx(nn,{size:14})," ",f("project.chat.create_agent")]}),r.jsxs(ge,{variant:"ghost",size:"sm",disabled:j||h.length===0,onClick:D,children:[r.jsx(ia,{size:13})," ",f("project.chat.clear")]})]})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:h.length?r.jsx(Eb,{msgs:h,onCopy:L}):r.jsx("div",{className:"flex h-full items-center justify-center p-8",children:r.jsx("p",{className:"text-sm text-muted-fg",children:f("project.chat.empty")})})}),r.jsx(W2,{msgs:h}),(()=>{const q=j?null:eC(h);return!q||q.turnKey===m?null:r.jsx(J2,{turnKey:q.turnKey,questions:q.questions,onSubmit:Y=>void B(Y),onDismiss:()=>g(q.turnKey),disabled:j})})(),r.jsx(h6,{onSend:B,onStop:v,streaming:j,model:d,onModelChange:p})]}),r.jsx(U6,{open:l,pid:e,onClose:()=>c(!1),onCreated:()=>{c(!1),o.mutate()}})]})}function U6({open:e,onClose:n,onCreated:s,pid:o}){const l=at(),[c,d]=x.useState(""),[p,m]=x.useState("master"),[g,h]=x.useState(""),[_,v]=x.useState(!0),[k,S]=x.useState(!1),j=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){l.error(f("project.agents.slug_invalid"));return}S(!0);try{await tn.create(o,{slug:c,role:p,model:g||void 0,is_master:_}),l.success(f("project.agents.created",{slug:c})),d(""),m("master"),h(""),v(!0),s()}catch(w){l.error(w.message)}finally{S(!1)}};return r.jsx(Vn,{open:e,onClose:n,title:f("project.chat.create_agent_title"),description:f("project.chat.create_agent_desc"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:k,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:j,loading:k,children:f("common.create")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:"slug",children:r.jsx(Ce,{autoFocus:!0,value:c,onChange:w=>d(w.target.value),placeholder:"master"})}),r.jsx(de,{label:f("project.chat.role_label"),children:r.jsx(Ce,{value:p,onChange:w=>m(w.target.value),placeholder:"master"})}),r.jsx(de,{label:f("project.chat.model_label"),hint:f("project.chat.model_hint"),children:r.jsx(Ce,{value:g,onChange:w=>h(w.target.value)})}),r.jsx(Zt,{checked:_,onChange:v,label:f("project.chat.master_label")})]})})}function H6({pid:e}){const n=at(),{project:s}=ab(e),{channels:o,isLoading:l,mutate:c}=pb(),d=String(e),p=s?.name||s?.path?.split("/").pop()||d,m=`proj-${d}`,g=o.find(A=>A.project===d||A.project===p||A.name===m),[h,_]=x.useState(!!g),[v,k]=x.useState(""),[S,j]=x.useState(""),[w,C]=x.useState(""),[E,N]=x.useState(!0),[R,T]=x.useState(!1);if(x.useEffect(()=>{g?(_(!0),k(""),j(g.chat_id||""),C(g.route_to_agent||""),N(g.respond_with_engine??!0)):(_(!1),k(""),j(""),C(""),N(!0))},[g?.name,g?.chat_id,g?.route_to_agent]),l)return r.jsx(nt,{});const O=async()=>{T(!0);try{if(!h){g&&(await An.channels.remove(g.name),n.success(f("project.telegram.cleared"))),await c();return}const A={name:g?.name||m,project:d,chat_id:S,route_to_agent:w,respond_with_engine:E,...v?{bot_token:v}:{}};g?await An.channels.patch(g.name,A):await An.channels.upsert(A),n.success(f("project.telegram.saved")),await c(),k("")}catch(A){n.error(A.message)}finally{T(!1)}};return r.jsx(Ge,{title:f("project.telegram.title"),description:f("project.telegram.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Zt,{checked:h,onChange:_,label:f(h?"project.telegram.override_active":"project.telegram.use_default")}),g&&r.jsx(Ve,{tone:"success",children:f("project.telegram.channel_badge",{name:g.name})})]}),h&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("project.telegram.bot_token"),hint:g?.bot_token?`${Sr(g.bot_token)} ${f("telegram_ui.empty_keep")}`:f("project.telegram.bot_hint_none"),children:r.jsx(Ce,{type:"password",value:v,onChange:A=>k(A.target.value),placeholder:g?.bot_token?Sr(g.bot_token):""})}),r.jsx(de,{label:f("project.telegram.chat_id"),children:r.jsx(Ce,{value:S,onChange:A=>j(A.target.value)})}),r.jsx(de,{label:f("project.telegram.route_agent"),hint:f("project.telegram.route_hint"),children:r.jsx(Ce,{value:w,onChange:A=>C(A.target.value)})})]}),r.jsx(Zt,{checked:E,onChange:N,label:f("project.telegram.respond_engine")})]}),r.jsx("div",{className:"pt-2",children:r.jsx(ge,{variant:"primary",loading:R,onClick:O,children:f("common.save")})}),!h&&!g&&r.jsx(pt,{children:f("project.telegram.no_override")})]})})}function tC({load:e,save:n,rows:s=10,placeholder:o}){const l=at(),[c,d]=x.useState(null),[p,m]=x.useState(""),[g,h]=x.useState(!1);if(x.useEffect(()=>{let k=!0;return e().then(S=>{k&&(d(S),m(S))}).catch(()=>{k&&(d(""),m(""))}),()=>{k=!1}},[e]),c===null)return r.jsx(nt,{});const _=p!==c,v=async()=>{h(!0);try{await n(p),d(p),l.success(f("project.memories.saved"))}catch(k){l.error(k.message)}finally{h(!1)}};return r.jsxs("div",{className:"space-y-2",children:[r.jsx(cn,{rows:s,className:"font-mono text-xs",value:p,onChange:k=>m(k.target.value),placeholder:o}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[p.length," ",f("project.memories.chars")]}),r.jsxs(ge,{size:"sm",variant:"primary",loading:g,disabled:!_,onClick:v,children:[r.jsx(df,{size:12})," ",f("project.memories.save_btn")]})]})]})}function V6({pid:e,agent:n}){const[s,o]=x.useState(!1),l=n.is_master?Bs:gn;return r.jsxs("li",{className:"rounded-xl border border-border bg-muted/30",children:[r.jsxs("button",{type:"button",onClick:()=>o(c=>!c),className:"flex w-full items-center gap-3 px-3 py-2 text-left",children:[s?r.jsx(Ar,{size:14,className:"text-muted-fg"}):r.jsx(Ec,{size:14,className:"text-muted-fg"}),r.jsx(l,{size:14,className:n.is_master?"text-violet-400":"text-muted-fg"}),r.jsx("span",{className:"text-sm font-medium",children:n.slug}),n.role&&r.jsxs("span",{className:"text-xs text-muted-fg",children:["· ",n.role]})]}),s&&r.jsx("div",{className:"border-t border-border p-3",children:r.jsx(tC,{rows:8,load:()=>tn.memory.get(e,n.slug).then(c=>c.body),save:c=>tn.memory.put(e,n.slug,c).then(()=>{})})})]})}function q6({pid:e}){const n=Qe(`/projects/${e}/agents`,()=>tn.list(e));return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{title:f("project.memories.project_title"),description:f("project.memories.project_desc"),children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"mt-1 flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br from-sky-600 to-indigo-600",children:r.jsx(Td,{className:"size-4 text-white"})}),r.jsx("div",{className:"min-w-0 flex-1",children:r.jsx(tC,{rows:12,load:()=>aa.memory.get(e).then(s=>s.body),save:s=>aa.memory.put(e,s).then(()=>{}),placeholder:f("project.memories.project_ph")})})]})}),r.jsxs(Ge,{title:f("project.memories.agents_title"),description:f("project.memories.agents_desc"),children:[n.isLoading&&r.jsx(nt,{}),!n.isLoading&&(n.data?.length??0)===0&&r.jsx(pt,{children:f("project.memories.no_agents")}),r.jsx("ul",{className:"space-y-2",children:(n.data||[]).map(s=>r.jsx(V6,{pid:e,agent:s},s.slug))})]})]})}function $6(e,n){var s,o=1;e==null&&(e=0),n==null&&(n=0);function l(){var c,d=s.length,p,m=0,g=0;for(c=0;c<d;++c)p=s[c],m+=p.x,g+=p.y;for(m=(m/d-e)*o,g=(g/d-n)*o,c=0;c<d;++c)p=s[c],p.x-=m,p.y-=g}return l.initialize=function(c){s=c},l.x=function(c){return arguments.length?(e=+c,l):e},l.y=function(c){return arguments.length?(n=+c,l):n},l.strength=function(c){return arguments.length?(o=+c,l):o},l}function G6(e){const n=+this._x.call(null,e),s=+this._y.call(null,e);return nC(this.cover(n,s),n,s,e)}function nC(e,n,s,o){if(isNaN(n)||isNaN(s))return e;var l,c=e._root,d={data:o},p=e._x0,m=e._y0,g=e._x1,h=e._y1,_,v,k,S,j,w,C,E;if(!c)return e._root=d,e;for(;c.length;)if((j=n>=(_=(p+g)/2))?p=_:g=_,(w=s>=(v=(m+h)/2))?m=v:h=v,l=c,!(c=c[C=w<<1|j]))return l[C]=d,e;if(k=+e._x.call(null,c.data),S=+e._y.call(null,c.data),n===k&&s===S)return d.next=c,l?l[C]=d:e._root=d,e;do l=l?l[C]=new Array(4):e._root=new Array(4),(j=n>=(_=(p+g)/2))?p=_:g=_,(w=s>=(v=(m+h)/2))?m=v:h=v;while((C=w<<1|j)===(E=(S>=v)<<1|k>=_));return l[E]=c,l[C]=d,e}function F6(e){var n,s,o=e.length,l,c,d=new Array(o),p=new Array(o),m=1/0,g=1/0,h=-1/0,_=-1/0;for(s=0;s<o;++s)isNaN(l=+this._x.call(null,n=e[s]))||isNaN(c=+this._y.call(null,n))||(d[s]=l,p[s]=c,l<m&&(m=l),l>h&&(h=l),c<g&&(g=c),c>_&&(_=c));if(m>h||g>_)return this;for(this.cover(m,g).cover(h,_),s=0;s<o;++s)nC(this,d[s],p[s],e[s]);return this}function Y6(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var s=this._x0,o=this._y0,l=this._x1,c=this._y1;if(isNaN(s))l=(s=Math.floor(e))+1,c=(o=Math.floor(n))+1;else{for(var d=l-s||1,p=this._root,m,g;s>e||e>=l||o>n||n>=c;)switch(g=(n<o)<<1|e<s,m=new Array(4),m[g]=p,p=m,d*=2,g){case 0:l=s+d,c=o+d;break;case 1:s=l-d,c=o+d;break;case 2:l=s+d,o=c-d;break;case 3:s=l-d,o=c-d;break}this._root&&this._root.length&&(this._root=p)}return this._x0=s,this._y0=o,this._x1=l,this._y1=c,this}function X6(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function K6(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 Gn(e,n,s,o,l){this.node=e,this.x0=n,this.y0=s,this.x1=o,this.y1=l}function Q6(e,n,s){var o,l=this._x0,c=this._y0,d,p,m,g,h=this._x1,_=this._y1,v=[],k=this._root,S,j;for(k&&v.push(new Gn(k,l,c,h,_)),s==null?s=1/0:(l=e-s,c=n-s,h=e+s,_=n+s,s*=s);S=v.pop();)if(!(!(k=S.node)||(d=S.x0)>h||(p=S.y0)>_||(m=S.x1)<l||(g=S.y1)<c))if(k.length){var w=(d+m)/2,C=(p+g)/2;v.push(new Gn(k[3],w,C,m,g),new Gn(k[2],d,C,w,g),new Gn(k[1],w,p,m,C),new Gn(k[0],d,p,w,C)),(j=(n>=C)<<1|e>=w)&&(S=v[v.length-1],v[v.length-1]=v[v.length-1-j],v[v.length-1-j]=S)}else{var E=e-+this._x.call(null,k.data),N=n-+this._y.call(null,k.data),R=E*E+N*N;if(R<s){var T=Math.sqrt(s=R);l=e-T,c=n-T,h=e+T,_=n+T,o=k.data}}return o}function Z6(e){if(isNaN(h=+this._x.call(null,e))||isNaN(_=+this._y.call(null,e)))return this;var n,s=this._root,o,l,c,d=this._x0,p=this._y0,m=this._x1,g=this._y1,h,_,v,k,S,j,w,C;if(!s)return this;if(s.length)for(;;){if((S=h>=(v=(d+m)/2))?d=v:m=v,(j=_>=(k=(p+g)/2))?p=k:g=k,n=s,!(s=s[w=j<<1|S]))return this;if(!s.length)break;(n[w+1&3]||n[w+2&3]||n[w+3&3])&&(o=n,C=w)}for(;s.data!==e;)if(l=s,!(s=s.next))return this;return(c=s.next)&&delete s.next,l?(c?l.next=c:delete l.next,this):n?(c?n[w]=c:delete n[w],(s=n[0]||n[1]||n[2]||n[3])&&s===(n[3]||n[2]||n[1]||n[0])&&!s.length&&(o?o[C]=s:this._root=s),this):(this._root=c,this)}function W6(e){for(var n=0,s=e.length;n<s;++n)this.remove(e[n]);return this}function J6(){return this._root}function eP(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function tP(e){var n=[],s,o=this._root,l,c,d,p,m;for(o&&n.push(new Gn(o,this._x0,this._y0,this._x1,this._y1));s=n.pop();)if(!e(o=s.node,c=s.x0,d=s.y0,p=s.x1,m=s.y1)&&o.length){var g=(c+p)/2,h=(d+m)/2;(l=o[3])&&n.push(new Gn(l,g,h,p,m)),(l=o[2])&&n.push(new Gn(l,c,h,g,m)),(l=o[1])&&n.push(new Gn(l,g,d,p,h)),(l=o[0])&&n.push(new Gn(l,c,d,g,h))}return this}function nP(e){var n=[],s=[],o;for(this._root&&n.push(new Gn(this._root,this._x0,this._y0,this._x1,this._y1));o=n.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,_=(p+g)/2;(c=l[0])&&n.push(new Gn(c,d,p,h,_)),(c=l[1])&&n.push(new Gn(c,h,p,m,_)),(c=l[2])&&n.push(new Gn(c,d,_,h,g)),(c=l[3])&&n.push(new Gn(c,h,_,m,g))}s.push(o)}for(;o=s.pop();)e(o.node,o.x0,o.y0,o.x1,o.y1);return this}function aP(e){return e[0]}function sP(e){return arguments.length?(this._x=e,this):this._x}function rP(e){return e[1]}function oP(e){return arguments.length?(this._y=e,this):this._y}function Nb(e,n,s){var o=new Rb(n??aP,s??rP,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function Rb(e,n,s,o,l,c){this._x=e,this._y=n,this._x0=s,this._y0=o,this._x1=l,this._y1=c,this._root=void 0}function xj(e){for(var n={data:e.data},s=n;e=e.next;)s=s.next={data:e.data};return n}var Xn=Nb.prototype=Rb.prototype;Xn.copy=function(){var e=new Rb(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,s,o;if(!n)return e;if(!n.length)return e._root=xj(n),e;for(s=[{source:n,target:e._root=new Array(4)}];n=s.pop();)for(var l=0;l<4;++l)(o=n.source[l])&&(o.length?s.push({source:o,target:n.target[l]=new Array(4)}):n.target[l]=xj(o));return e};Xn.add=G6;Xn.addAll=F6;Xn.cover=Y6;Xn.data=X6;Xn.extent=K6;Xn.find=Q6;Xn.remove=Z6;Xn.removeAll=W6;Xn.root=J6;Xn.size=eP;Xn.visit=tP;Xn.visitAfter=nP;Xn.x=sP;Xn.y=oP;function co(e){return function(){return e}}function jr(e){return(e()-.5)*1e-6}function lP(e){return e.x+e.vx}function iP(e){return e.y+e.vy}function cP(e){var n,s,o,l=1,c=1;typeof e!="function"&&(e=co(e==null?1:+e));function d(){for(var g,h=n.length,_,v,k,S,j,w,C=0;C<c;++C)for(_=Nb(n,lP,iP).visitAfter(p),g=0;g<h;++g)v=n[g],j=s[v.index],w=j*j,k=v.x+v.vx,S=v.y+v.vy,_.visit(E);function E(N,R,T,O,A){var z=N.data,B=N.r,L=j+B;if(z){if(z.index>v.index){var D=k-z.x-z.vx,P=S-z.y-z.vy,H=D*D+P*P;H<L*L&&(D===0&&(D=jr(o),H+=D*D),P===0&&(P=jr(o),H+=P*P),H=(L-(H=Math.sqrt(H)))/H*l,v.vx+=(D*=H)*(L=(B*=B)/(w+B)),v.vy+=(P*=H)*L,z.vx-=D*(L=1-L),z.vy-=P*L)}return}return R>k+L||O<k-L||T>S+L||A<S-L}}function p(g){if(g.data)return g.r=s[g.data.index];for(var h=g.r=0;h<4;++h)g[h]&&g[h].r>g.r&&(g.r=g[h].r)}function m(){if(n){var g,h=n.length,_;for(s=new Array(h),g=0;g<h;++g)_=n[g],s[_.index]=+e(_,g,n)}}return d.initialize=function(g,h){n=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:co(+g),m(),d):e},d}function uP(e){return e.index}function bj(e,n){var s=e.get(n);if(!s)throw new Error("node not found: "+n);return s}function dP(e){var n=uP,s=_,o,l=co(30),c,d,p,m,g,h=1;e==null&&(e=[]);function _(w){return 1/Math.min(p[w.source.index],p[w.target.index])}function v(w){for(var C=0,E=e.length;C<h;++C)for(var N=0,R,T,O,A,z,B,L;N<E;++N)R=e[N],T=R.source,O=R.target,A=O.x+O.vx-T.x-T.vx||jr(g),z=O.y+O.vy-T.y-T.vy||jr(g),B=Math.sqrt(A*A+z*z),B=(B-c[N])/B*w*o[N],A*=B,z*=B,O.vx-=A*(L=m[N]),O.vy-=z*L,T.vx+=A*(L=1-L),T.vy+=z*L}function k(){if(d){var w,C=d.length,E=e.length,N=new Map(d.map((T,O)=>[n(T,O,d),T])),R;for(w=0,p=new Array(C);w<E;++w)R=e[w],R.index=w,typeof R.source!="object"&&(R.source=bj(N,R.source)),typeof R.target!="object"&&(R.target=bj(N,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(E);w<E;++w)R=e[w],m[w]=p[R.source.index]/(p[R.source.index]+p[R.target.index]);o=new Array(E),S(),c=new Array(E),j()}}function S(){if(d)for(var w=0,C=e.length;w<C;++w)o[w]=+s(e[w],w,e)}function j(){if(d)for(var w=0,C=e.length;w<C;++w)c[w]=+l(e[w],w,e)}return v.initialize=function(w,C){d=w,g=C,k()},v.links=function(w){return arguments.length?(e=w,k(),v):e},v.id=function(w){return arguments.length?(n=w,v):n},v.iterations=function(w){return arguments.length?(h=+w,v):h},v.strength=function(w){return arguments.length?(s=typeof w=="function"?w:co(+w),S(),v):s},v.distance=function(w){return arguments.length?(l=typeof w=="function"?w:co(+w),j(),v):l},v}var fP={value:()=>{}};function aC(){for(var e=0,n=arguments.length,s={},o;e<n;++e){if(!(o=arguments[e]+"")||o in s||/[\s.]/.test(o))throw new Error("illegal type: "+o);s[o]=[]}return new Cd(s)}function Cd(e){this._=e}function pP(e,n){return e.trim().split(/^|\s+/).map(function(s){var o="",l=s.indexOf(".");if(l>=0&&(o=s.slice(l+1),s=s.slice(0,l)),s&&!n.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:o}})}Cd.prototype=aC.prototype={constructor:Cd,on:function(e,n){var s=this._,o=pP(e+"",s),l,c=-1,d=o.length;if(arguments.length<2){for(;++c<d;)if((l=(e=o[c]).type)&&(l=mP(s[l],e.name)))return l;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++c<d;)if(l=(e=o[c]).type)s[l]=_j(s[l],e.name,n);else if(n==null)for(l in s)s[l]=_j(s[l],e.name,null);return this},copy:function(){var e={},n=this._;for(var s in n)e[s]=n[s].slice();return new Cd(e)},call:function(e,n){if((l=arguments.length-2)>0)for(var s=new Array(l),o=0,l,c;o<l;++o)s[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(c=this._[e],o=0,l=c.length;o<l;++o)c[o].value.apply(n,s)},apply:function(e,n,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],l=0,c=o.length;l<c;++l)o[l].value.apply(n,s)}};function mP(e,n){for(var s=0,o=e.length,l;s<o;++s)if((l=e[s]).name===n)return l.value}function _j(e,n,s){for(var o=0,l=e.length;o<l;++o)if(e[o].name===n){e[o]=fP,e=e.slice(0,o).concat(e.slice(o+1));break}return s!=null&&e.push({name:n,value:s}),e}var Nl=0,Ji=0,Vi=0,sC=1e3,nf,ec,af=0,mo=0,Pf=0,yc=typeof performance=="object"&&performance.now?performance:Date,rC=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function oC(){return mo||(rC(gP),mo=yc.now()+Pf)}function gP(){mo=0}function Xh(){this._call=this._time=this._next=null}Xh.prototype=lC.prototype={constructor:Xh,restart:function(e,n,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?oC():+s)+(n==null?0:+n),!this._next&&ec!==this&&(ec?ec._next=this:nf=this,ec=this),this._call=e,this._time=s,Kh()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kh())}};function lC(e,n,s){var o=new Xh;return o.restart(e,n,s),o}function hP(){oC(),++Nl;for(var e=nf,n;e;)(n=mo-e._time)>=0&&e._call.call(void 0,n),e=e._next;--Nl}function vj(){mo=(af=yc.now())+Pf,Nl=Ji=0;try{hP()}finally{Nl=0,bP(),mo=0}}function xP(){var e=yc.now(),n=e-af;n>sC&&(Pf-=n,af=e)}function bP(){for(var e,n=nf,s,o=1/0;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(s=n._next,n._next=null,n=e?e._next=s:nf=s);ec=e,Kh(o)}function Kh(e){if(!Nl){Ji&&(Ji=clearTimeout(Ji));var n=e-mo;n>24?(e<1/0&&(Ji=setTimeout(vj,e-yc.now()-Pf)),Vi&&(Vi=clearInterval(Vi))):(Vi||(af=yc.now(),Vi=setInterval(xP,sC)),Nl=1,rC(vj))}}const _P=1664525,vP=1013904223,yj=4294967296;function yP(){let e=1;return()=>(e=(_P*e+vP)%yj)/yj}function jP(e){return e.x}function wP(e){return e.y}var kP=10,SP=Math.PI*(3-Math.sqrt(5));function CP(e){var n,s=1,o=.001,l=1-Math.pow(o,1/300),c=0,d=.6,p=new Map,m=lC(_),g=aC("tick","end"),h=yP();e==null&&(e=[]);function _(){v(),g.call("tick",n),s<o&&(m.stop(),g.call("end",n))}function v(j){var w,C=e.length,E;j===void 0&&(j=1);for(var N=0;N<j;++N)for(s+=(c-s)*l,p.forEach(function(R){R(s)}),w=0;w<C;++w)E=e[w],E.fx==null?E.x+=E.vx*=d:(E.x=E.fx,E.vx=0),E.fy==null?E.y+=E.vy*=d:(E.y=E.fy,E.vy=0);return n}function k(){for(var j=0,w=e.length,C;j<w;++j){if(C=e[j],C.index=j,C.fx!=null&&(C.x=C.fx),C.fy!=null&&(C.y=C.fy),isNaN(C.x)||isNaN(C.y)){var E=kP*Math.sqrt(.5+j),N=j*SP;C.x=E*Math.cos(N),C.y=E*Math.sin(N)}(isNaN(C.vx)||isNaN(C.vy))&&(C.vx=C.vy=0)}}function S(j){return j.initialize&&j.initialize(e,h),j}return k(),n={tick:v,restart:function(){return m.restart(_),n},stop:function(){return m.stop(),n},nodes:function(j){return arguments.length?(e=j,k(),p.forEach(S),n):e},alpha:function(j){return arguments.length?(s=+j,n):s},alphaMin:function(j){return arguments.length?(o=+j,n):o},alphaDecay:function(j){return arguments.length?(l=+j,n):+l},alphaTarget:function(j){return arguments.length?(c=+j,n):c},velocityDecay:function(j){return arguments.length?(d=1-j,n):1-d},randomSource:function(j){return arguments.length?(h=j,p.forEach(S),n):h},force:function(j,w){return arguments.length>1?(w==null?p.delete(j):p.set(j,S(w)),n):p.get(j)},find:function(j,w,C){var E=0,N=e.length,R,T,O,A,z;for(C==null?C=1/0:C*=C,E=0;E<N;++E)A=e[E],R=j-A.x,T=w-A.y,O=R*R+T*T,O<C&&(z=A,C=O);return z},on:function(j,w){return arguments.length>1?(g.on(j,w),n):g.on(j)}}}function EP(){var e,n,s,o,l=co(-30),c,d=1,p=1/0,m=.81;function g(k){var S,j=e.length,w=Nb(e,jP,wP).visitAfter(_);for(o=k,S=0;S<j;++S)n=e[S],w.visit(v)}function h(){if(e){var k,S=e.length,j;for(c=new Array(S),k=0;k<S;++k)j=e[k],c[j.index]=+l(j,k,e)}}function _(k){var S=0,j,w,C=0,E,N,R;if(k.length){for(E=N=R=0;R<4;++R)(j=k[R])&&(w=Math.abs(j.value))&&(S+=j.value,C+=w,E+=w*j.x,N+=w*j.y);k.x=E/C,k.y=N/C}else{j=k,j.x=j.data.x,j.y=j.data.y;do S+=c[j.data.index];while(j=j.next)}k.value=S}function v(k,S,j,w){if(!k.value)return!0;var C=k.x-n.x,E=k.y-n.y,N=w-S,R=C*C+E*E;if(N*N/m<R)return R<p&&(C===0&&(C=jr(s),R+=C*C),E===0&&(E=jr(s),R+=E*E),R<d&&(R=Math.sqrt(d*R)),n.vx+=C*k.value*o/R,n.vy+=E*k.value*o/R),!0;if(k.length||R>=p)return;(k.data!==n||k.next)&&(C===0&&(C=jr(s),R+=C*C),E===0&&(E=jr(s),R+=E*E),R<d&&(R=Math.sqrt(d*R)));do k.data!==n&&(N=c[k.data.index]*o/R,n.vx+=C*N,n.vy+=E*N);while(k=k.next)}return g.initialize=function(k,S){e=k,s=S,h()},g.strength=function(k){return arguments.length?(l=typeof k=="function"?k:co(+k),h(),g):l},g.distanceMin=function(k){return arguments.length?(d=k*k,g):Math.sqrt(d)},g.distanceMax=function(k){return arguments.length?(p=k*k,g):Math.sqrt(p)},g.theta=function(k){return arguments.length?(m=k*k,g):Math.sqrt(m)},g}const qi={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"};function NP(){return{agent:f("agents_ui.kind_agent"),memory:f("agents_ui.kind_memory"),thread:f("agents_ui.kind_thread"),task:f("agents_ui.kind_task"),routine:f("agents_ui.kind_routine"),agentlink:f("agents_ui.kind_hierarchy")}}const $i=760,Gi=460;function RP({center:e,nodes:n}){const s=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:$i/2,y:Gi/2,fx:$i/2,fy:Gi/2},C=[w,...n.map(R=>({...R}))],E=C.slice(1).map(R=>({source:w,target:R}));l.current=C,c.current=E;const N=CP(C).force("link",dP(E).distance(120).strength(.5)).force("charge",EP().strength(-220)).force("center",$6($i/2,Gi/2).strength(.05)).force("collide",cP(26)).on("tick",()=>p(R=>R+1));return o.current=N,()=>{N.stop()}},[e,n]);const h=w=>{const C=s.current.getBoundingClientRect();return{x:(w.clientX-C.left)/C.width*$i,y:(w.clientY-C.top)/C.height*Gi}},_=w=>C=>{w.id!=="__center"&&(d.current=w,C.target.setPointerCapture?.(C.pointerId),o.current?.alphaTarget(.3).restart())},v=w=>{const C=d.current;if(!C)return;const{x:E,y:N}=h(w);C.fx=E,C.fy=N},k=()=>{const w=d.current;w&&(w.fx=null,w.fy=null),d.current=null,o.current?.alphaTarget(0)},S=l.current,j=c.current;return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-muted/10",children:r.jsxs("svg",{ref:s,viewBox:`0 0 ${$i} ${Gi}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:v,onPointerUp:k,onPointerLeave:k,children:[j.map((w,C)=>r.jsx("line",{x1:w.source.x,y1:w.source.y,x2:w.target.x,y2:w.target.y,stroke:qi[w.target.kind],strokeOpacity:.22,strokeWidth:1.5},C)),S.map(w=>{if(w.id==="__center")return r.jsxs("g",{transform:`translate(${w.x},${w.y})`,children:[r.jsx("circle",{r:22,fill:qi.agent}),r.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},w.id);const C=m?.id===w.id;return r.jsxs("g",{transform:`translate(${w.x},${w.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:_(w),onClick:()=>g(w),children:[r.jsx("circle",{r:C?9:6,fill:qi[w.kind],fillOpacity:C?1:.9,stroke:C?"#fff":"none",strokeWidth:C?2:0}),r.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:w.label.length>22?`${w.label.slice(0,22)}…`:w.label})]},w.id)})]})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[(()=>{const w=NP();return Object.keys(w).filter(C=>C!=="agent").map(C=>r.jsxs("span",{className:"inline-flex items-center gap-1",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:qi[C]}})," ",w[C]]},C))})(),r.jsx("span",{className:"ml-auto",children:f("agents_ui.nodes_drag_hint",{n:String(n.length)})})]}),m&&r.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-xs",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"size-2 rounded-full",style:{background:qi[m.kind]}}),r.jsx("span",{className:"font-medium",children:m.label}),r.jsxs("span",{className:"text-muted-fg",children:["· ",m.relation]})]}),m.detail&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:m.detail})]})]})}function TP(){return[{key:"overview",label:f("agents_ui.tab_explorer"),icon:cf},{key:"memories",label:f("project.nav.memories"),icon:Td},{key:"records",label:f("project.agent_detail.records_title"),icon:Vw},{key:"sleep",label:f("project.agent_detail.sleep_title"),icon:_l},{key:"brain",label:f("project.agent_detail.brain_title"),icon:ls},{key:"config",label:f("settings.tabs.advanced"),icon:Dd}]}function AP(){return[{value:"",label:f("agents_ui.type_none")},{value:"orchestrator",label:f("agents_ui.type_orchestrator"),description:f("agents_ui.type_orchestrator_desc")},{value:"specialist",label:f("agents_ui.type_specialist"),description:f("agents_ui.type_specialist_desc")},{value:"assistant",label:f("agents_ui.type_assistant"),description:f("agents_ui.type_assistant_desc")},{value:"worker",label:f("agents_ui.type_worker"),description:f("agents_ui.type_worker_desc")},{value:"monitor",label:f("agents_ui.type_monitor"),description:f("agents_ui.type_monitor_desc")}]}const Qh=e=>e.split(",").map(n=>n.trim()).filter(Boolean),MP=(e,n)=>e.filter(s=>s.spec?.agent===n||n==="super-agent"&&s.kind==="super_agent");function OP(e){return e.split(`
616
- `).map(n=>n.replace(/^[-*#>\s]+/,"").trim()).filter(n=>n.length>2&&!n.startsWith("```")).slice(0,12)}function zP({pid:e}){const{slug:n=""}=Aw(),s=la(),[o,l]=x.useState("overview"),c=TP(),d=Qe(`/projects/${e}/agents/${n}`,()=>tn.get(e,n)),p=Qe(`/projects/${e}/agents`,()=>tn.list(e)),m=Qe(`/projects/${e}/routines`,()=>br.list(e)),g=Qe(`/projects/${e}/messages?agent=${n}`,()=>Ph.project(e,{agent:n,limit:200})),h=Qe(`/projects/${e}/agents/${n}/conversations`,()=>nb.list(e,n)),_=Qe(`/projects/${e}/tasks?all`,()=>_r.list(e,"all")),v=d.data,k=MP(m.data||[],n),S=(_.data||[]).filter(C=>C.agent===n),j=(p.data||[]).filter(C=>C.parent===n);if(d.isLoading)return r.jsx(nt,{});if(!v)return r.jsx("div",{className:"text-sm text-muted-fg",children:f("project.agent_detail.not_found")});const w=v.is_master?Bs:gn;return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-3",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("button",{onClick:()=>s(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:r.jsx(AT,{size:16})}),r.jsx("div",{className:Oe("flex size-11 items-center justify-center rounded-xl bg-gradient-to-br",v.is_master?"from-violet-600 to-indigo-600":"from-slate-600 to-gray-600"),children:r.jsx(w,{className:"size-5 text-white"})}),r.jsxs("div",{children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx("h1",{className:"text-lg font-semibold",children:v.slug}),v.is_master&&r.jsxs(Ve,{tone:"success",children:[r.jsx(Bs,{size:10})," ",f("project.agents.orchestrator")]}),v.role&&r.jsx(Ve,{children:v.role}),v.model&&r.jsx(Ve,{tone:"info",children:v.model}),v.parent&&r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${v.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[f("project.agent_detail.reports_to")," ",v.parent]})]}),v.description&&r.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:v.description})]})]}),r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>s(`/p/${e}/chat?agent=${n}`),children:[r.jsx(Ya,{size:13})," ",f("project.agent_detail.chat_btn",{slug:v.slug})]})]}),r.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:C,label:E,icon:N})=>r.jsxs("button",{onClick:()=>l(C),className:Oe("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",o===C?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[r.jsx(N,{size:14})," ",E]},C))}),o==="overview"&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[r.jsx(pd,{label:f("agents_ui.stat_threads"),value:h.data?.length??0,icon:Od}),r.jsx(pd,{label:f("agents_ui.stat_records"),value:g.data?.length??0,icon:Vw}),r.jsx(pd,{label:f("agents_ui.stat_tasks"),value:S.length,icon:cf}),r.jsx(pd,{label:f("agents_ui.stat_heartbeats"),value:k.length,icon:_l})]}),r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(Ge,{title:f("agent_detail_extra.skills_title"),description:"",children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[v.skills?.map(C=>r.jsxs(Ve,{tone:"info",children:[r.jsx(ls,{size:10})," ",C]},C)),v.tools?.map(C=>r.jsxs(Ve,{children:[r.jsx(zl,{size:10})," ",C]},C)),!v.skills?.length&&!v.tools?.length&&r.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),r.jsx(Ge,{title:f("project.agent_detail.threads_recent"),description:"",children:r.jsxs("ul",{className:"space-y-1 text-xs",children:[(h.data||[]).slice(0,6).map(C=>r.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[r.jsx("span",{className:"truncate",children:C.title||C.filename}),r.jsxs("span",{className:"shrink-0 text-muted-fg",children:[C.messages??0," ",f("project.agent_detail.msgs_count")]})]},C.id)),!h.data?.length&&r.jsx("li",{className:"text-muted-fg",children:f("project.agent_detail.no_threads")})]})})]}),j.length>0&&r.jsx(Ge,{title:f("project.agent_detail.subagents"),description:f("project.agent_detail.subagents_desc"),children:r.jsx("div",{className:"flex flex-wrap gap-2",children:j.map(C=>r.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${C.slug}`),className:"flex items-center gap-2 rounded-lg border border-border bg-muted/30 px-3 py-1.5 text-sm hover:border-muted-fg/50",children:[r.jsx(gn,{size:14,className:"text-muted-fg"})," ",C.slug]},C.slug))})})]}),o==="memories"&&r.jsx(LP,{pid:e,slug:n,initial:v.memory||"",onSaved:()=>d.mutate()}),o==="records"&&r.jsx(PP,{records:g.data||[],loading:g.isLoading}),o==="sleep"&&r.jsx(IP,{routines:k}),o==="brain"&&r.jsx(UP,{slug:n,memory:v.memory||"",threads:(h.data||[]).map(C=>({id:C.id,label:C.title||C.filename})),tasks:S.map(C=>({id:C.id,label:C.title,detail:C.body||void 0})),routines:k,parent:v.parent||null,children:j.map(C=>C.slug)}),o==="config"&&r.jsx(DP,{pid:e,agent:v,agents:p.data||[],onSaved:()=>{d.mutate(),p.mutate()},onDeleted:()=>{p.mutate(),s(`/p/${e}/agents`)}})]})}function DP({pid:e,agent:n,agents:s,onSaved:o,onDeleted:l}){const c=at(),[d,p]=x.useState(n.type||""),[m,g]=x.useState(n.area||""),[h,_]=x.useState(n.role||""),[v,k]=x.useState(n.model||""),[S,j]=x.useState(n.parent||""),[w,C]=x.useState(!!n.is_master),[E,N]=x.useState((n.skills||[]).join(", ")),[R,T]=x.useState((n.tools||[]).join(", ")),[O,A]=x.useState(n.description||""),[z,B]=x.useState(n.system||""),[L,D]=x.useState(!1),P=async()=>{D(!0);try{await tn.update(e,n.slug,{type:d||null,area:m||null,role:h||null,model:v||null,parent:S||null,is_master:w||d==="orchestrator",skills:Qh(E),tools:Qh(R),description:O||null,system:z}),c.success(f("project.agent_detail.update_success")),o()}catch(q){c.error(q.message)}finally{D(!1)}},H=async()=>{if(confirm(f("project.agent_detail.delete_confirm",{slug:n.slug})))try{await tn.remove(e,n.slug),c.success(f("project.agent_detail.delete_success")),l()}catch(q){c.error(q.message)}};return r.jsx(Ge,{title:f("project.agent_detail.config_title"),description:`.apc/agents/${n.slug}.md — ${f("agents_ui.config_def_desc")}`,children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("project.agent_detail.type_label"),children:r.jsx(wt,{value:d,onChange:p,options:AP()})}),r.jsx(de,{label:f("project.agent_detail.area_label"),hint:f("project.agent_detail.area_hint"),children:r.jsx(Ce,{value:m,onChange:q=>g(q.target.value),placeholder:f("project.agent_detail.area_ph")})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("project.agent_detail.role_label"),children:r.jsx(Ce,{value:h,onChange:q=>_(q.target.value),placeholder:"Operations Lead"})}),r.jsx(de,{label:f("project.agent_detail.parent_label"),children:r.jsx(wt,{value:S,onChange:j,placeholder:f("project.agent_detail.none_parent"),options:[{value:"",label:f("project.agent_detail.none_parent")},...s.filter(q=>q.slug!==n.slug).map(q=>({value:q.slug,label:q.slug}))]})})]}),r.jsx(de,{label:f("project.agent_detail.model_label"),hint:f("project.agent_detail.model_hint"),children:r.jsx(Ce,{value:v,onChange:q=>k(q.target.value),placeholder:f("project.agent_detail.model_ph")})}),r.jsx(de,{label:f("project.agent_detail.skills_label"),children:r.jsx(Ce,{value:E,onChange:q=>N(q.target.value),placeholder:"skill-a, skill-b"})}),r.jsx(BP,{value:R,onChange:T}),r.jsx(de,{label:f("project.agent_detail.bio_label"),children:r.jsx(cn,{rows:2,value:O,onChange:q=>A(q.target.value)})}),r.jsx(de,{label:f("project.agent_detail.system_label"),hint:f("project.agent_detail.system_hint"),children:r.jsx(cn,{rows:10,className:"font-mono text-xs",value:z,onChange:q=>B(q.target.value),placeholder:"You are…"})}),r.jsx(Zt,{checked:w,onChange:C,label:f("project.agent_detail.master_label")}),r.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[r.jsxs(ge,{variant:"destructive",onClick:H,children:[r.jsx(ia,{size:13})," ",f("project.agent_detail.delete_btn")]}),r.jsxs(ge,{variant:"primary",loading:L,onClick:P,children:[r.jsx(df,{size:13})," ",f("project.agent_detail.save_btn")]})]})]})})}function pd({label:e,value:n,icon:s}){return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(s,{size:13})," ",e]}),r.jsx("div",{className:"mt-1 text-2xl font-semibold",children:n})]})}function LP({pid:e,slug:n,initial:s,onSaved:o}){const l=at(),[c,d]=x.useState(s),[p,m]=x.useState(!1);x.useEffect(()=>{d(s)},[s]);const g=c!==s,h=async()=>{m(!0);try{await tn.memory.put(e,n,c),l.success(f("project.agent_detail.memory_saved")),o()}catch(_){l.error(_.message)}finally{m(!1)}};return r.jsxs(Ge,{title:f("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${n}/memory.md — ${f("agents_ui.memory_durable_desc")}`,children:[r.jsx(cn,{rows:16,className:"font-mono text-xs",value:c,onChange:_=>d(_.target.value),placeholder:f("project.agent_detail.memory_empty")}),r.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[r.jsxs("span",{className:"text-[11px] text-muted-fg",children:[c.length," ",f("project.memories.chars")]}),r.jsxs(ge,{size:"sm",variant:"primary",loading:p,disabled:!g,onClick:h,children:[r.jsx(df,{size:12})," ",f("project.memories.save_btn")]})]})]})}function PP({records:e,loading:n}){const s=x.useMemo(()=>[...e].sort((o,l)=>(l.ts||"").localeCompare(o.ts||"")),[e]);return r.jsxs(Ge,{title:f("project.agent_detail.records_title"),description:f("project.agent_detail.records_desc"),children:[n&&r.jsx(nt,{}),!n&&s.length===0&&r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.agent_detail.no_activity")}),r.jsx("ul",{className:"space-y-1 text-sm",children:s.map((o,l)=>r.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"mt-0.5 shrink-0",children:o.direction==="in"?r.jsx(qw,{size:13,className:"text-blue-400"}):r.jsx(Gw,{size:13,className:"text-emerald-400"})}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-mono",children:new Date(o.ts).toLocaleString()}),r.jsx(Ve,{tone:"info",children:o.channel}),o.type&&r.jsx(Ve,{children:o.type})]}),o.body&&r.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:o.body.length>400?`${o.body.slice(0,400)}…`:o.body})]})]},`${o.ts}-${l}`))})]})}function IP({routines:e}){return e.length===0?r.jsx(Ge,{title:f("project.agent_detail.sleep_title"),description:f("project.agent_detail.sleep_desc"),children:r.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[r.jsx("div",{className:"font-medium text-amber-400",children:f("project.agent_detail.sleep_deep")}),r.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:f("project.agent_detail.sleep_deep_desc")})]})}):r.jsx(Ge,{title:f("project.agent_detail.sleep_title"),description:f("project.agent_detail.sleep_desc"),children:r.jsx("div",{className:"space-y-3",children:e.map(n=>{const s=n.enabled,o=n.last_status==="error";return r.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:Oe("size-2 rounded-full",o?"bg-destructive":s?"bg-emerald-400":"bg-muted-fg/40")}),r.jsx("span",{className:"text-sm font-medium",children:n.name}),r.jsx(Ve,{tone:s?"success":"muted",children:f(s?"agents_ui.running":"agents_ui.paused")}),o&&r.jsx(Ve,{tone:"danger",children:f("agents_ui.last_error")})]}),r.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[r.jsx(md,{label:f("agents_ui.field_tick"),value:n.schedule}),r.jsx(md,{label:f("agents_ui.field_next_tick"),value:n.next_run_at?new Date(n.next_run_at).toLocaleString():"—"}),r.jsx(md,{label:f("agents_ui.field_last_tick"),value:n.last_run_at?new Date(n.last_run_at).toLocaleString():"—"}),r.jsx(md,{label:f("agents_ui.field_last_run"),value:n.last_status||"—"})]}),n.last_error&&r.jsx("p",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-[11px] text-destructive",children:n.last_error})]},n.name)})})})}function md({label:e,value:n}){return r.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[r.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),r.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:n})]})}function BP({value:e,onChange:n}){const s=Qe("/tools",()=>hO.list()),o=Qh(e),l=s.data||[],c=p=>{const m=new Set(o);m.has(p)?m.delete(p):m.add(p),n([...m].join(", "))},d=o.filter(p=>!l.some(m=>m.name===p));return r.jsxs(de,{label:f("agents_ui.tools_label"),hint:f("project.agent_detail.tools_hint"),children:[r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[l.map(p=>{const m=o.includes(p.name);return r.jsx("button",{type:"button",title:p.description||p.name,onClick:()=>c(p.name),className:Oe("rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",m?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:p.name},p.name)}),d.map(p=>r.jsxs("button",{type:"button",onClick:()=>c(p),className:"rounded-md border border-sky-500/50 bg-sky-500/10 px-2 py-0.5 font-mono text-[11px] text-sky-400",children:[p," ✕"]},p))]}),r.jsx(Ce,{className:"mt-2",value:e,onChange:p=>n(p.target.value),placeholder:f("project.agent_detail.tools_custom_ph")})]})}function UP({slug:e,memory:n,threads:s,tasks:o,routines:l,parent:c,children:d}){const p=x.useMemo(()=>{const m=[];return OP(n).forEach((g,h)=>m.push({id:`m${h}`,label:g,kind:"memory",relation:"knows",detail:g})),s.slice(0,8).forEach(g=>m.push({id:`th-${g.id}`,label:g.label,kind:"thread",relation:"in_thread"})),o.slice(0,8).forEach(g=>m.push({id:`ts-${g.id}`,label:g.label,kind:"task",relation:"handles_task",detail:g.detail})),l.forEach(g=>m.push({id:`rt-${g.name}`,label:g.name,kind:"routine",relation:"ticks",detail:`schedule: ${g.schedule}`})),c&&m.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),d.forEach(g=>m.push({id:`c-${g}`,label:g,kind:"agentlink",relation:"orchestrates"})),m},[n,s,o,l,c,d]);return r.jsx(Ge,{title:f("project.agent_detail.brain_title"),description:f("project.agent_detail.brain_desc"),children:p.length===0?r.jsx("p",{className:"text-xs text-muted-fg",children:f("project.agent_detail.brain_empty")}):r.jsx(RP,{center:e,nodes:p})})}function HP(){const e=la(),n=Yn(),{pid:s=""}=Aw(),{project:o}=ab(s),{collapsed:l,toggle:c}=h2(Rn.sidebarCollapsed+".project"),d=String(s)==="0",p=x.useMemo(()=>d?[{title:f("base.nav_general"),items:[{key:"",label:"Dashboard",icon:oA},{key:"workspaces",label:f("base.workspaces_title"),icon:zT},{key:"models",label:f("settings.tabs.engines"),icon:dx},{key:"agent-defaults",label:f("base.defaults_title"),icon:gn}]},{title:f("base.nav_activity"),items:[{key:"chat",label:f("project.nav.chat"),icon:Od},{key:"sessions",label:f("base.sessions_title"),icon:aA},{key:"tasks",label:f("project.nav.tasks"),icon:dc},{key:"logs",label:f("project.nav.logs"),icon:zd}]},{title:f("base.nav_system"),items:[{key:"agents",label:f("project.nav.agents"),icon:gn},{key:"memories",label:f("project.nav.memories"),icon:Td},{key:"routines",label:f("project.nav.routines"),icon:_l},{key:"mcps",label:f("project.nav.mcps"),icon:gh},{key:"vars",label:f("project.nav.vars"),icon:mh},{key:"config",label:f("project.nav.config"),icon:Dd}]}]:[{title:f("project.sections.workspace"),items:[{key:"",label:f("project.nav.overview"),icon:Kw},{key:"telegram",label:f("project.nav.telegram"),icon:Ya},{key:"chat",label:f("project.nav.chat"),icon:Od},{key:"agents",label:f("project.nav.agents"),icon:gn},{key:"memories",label:f("project.nav.memories"),icon:Td}]},{title:f("project.sections.automation"),items:[{key:"routines",label:f("project.nav.routines"),icon:_l},{key:"tasks",label:f("project.nav.tasks"),icon:dc},{key:"mcps",label:f("project.nav.mcps"),icon:gh},{key:"vars",label:f("project.nav.vars"),icon:mh},{key:"logs",label:f("project.nav.logs"),icon:zd}]},{title:f("project.sections.config"),items:[{key:"config",label:f("project.nav.config"),icon:Dd}]}],[d]),m=n.pathname.replace(`/p/${s}`,"").replace(/^\//,"").split("/")[0];if(!o)return r.jsx(S2,{testId:"screen-project-not-found",mood:"confused",message:f("project.not_found",{pid:s}),action:r.jsx($s,{variant:"outline",onClick:()=>e("/"),children:f("not_found.home")})});const g=h=>{const _=h?`/p/${s}/${h}`:`/p/${s}`;e(_)};return r.jsx(w2,{sections:p,active:m,onChange:g,collapsed:l,onToggleCollapse:c,contentClassName:"w-full space-y-6 p-6 pt-3",testId:`project-tab-${m||"overview"}`,children:r.jsxs(Dw,{children:[r.jsx($t,{index:!0,element:r.jsx(J1,{pid:s})}),r.jsx($t,{path:"workspaces",element:r.jsx(tD,{})}),r.jsx($t,{path:"models",element:r.jsx(H2,{})}),r.jsx($t,{path:"agent-defaults",element:r.jsx(uL,{})}),r.jsx($t,{path:"sessions",element:r.jsx(mL,{})}),r.jsx($t,{path:"logs",element:r.jsx(JD,{pid:s})}),r.jsx($t,{path:"config",element:r.jsx(DL,{pid:s})}),r.jsx($t,{path:"telegram",element:r.jsx(H6,{pid:s})}),r.jsx($t,{path:"agents",element:r.jsx(UL,{pid:s})}),r.jsx($t,{path:"agents/:slug",element:r.jsx(zP,{pid:s})}),r.jsx($t,{path:"memories",element:r.jsx(q6,{pid:s})}),r.jsx($t,{path:"routines",element:r.jsx(KL,{pid:s})}),r.jsx($t,{path:"tasks",element:d?r.jsx(gL,{}):r.jsx(ZL,{pid:s})}),r.jsx($t,{path:"mcps",element:r.jsx(i6,{pid:s})}),r.jsx($t,{path:"vars",element:r.jsx(m6,{pid:s})}),r.jsx($t,{path:"threads",element:r.jsx(YR,{to:`/p/${s}/chat`,replace:!0})}),r.jsx($t,{path:"chat",element:r.jsx(B6,{pid:s})}),r.jsx($t,{path:"*",element:r.jsx(J1,{pid:s})})]})})}const VP=["es","en","pt","fr","it","de"];function qP(){const e=at(),{identity:n,isLoading:s,save:o}=rb(),[l,c]=x.useState({}),[d,p]=x.useState(!1);if(x.useEffect(()=>{c(n)},[n]),s)return r.jsx(nt,{});const m=async()=>{p(!0);try{await o({owner_name:l.owner_name,owner_context:l.owner_context,language:l.language,timezone:l.timezone}),e.success(f("settings.identity.saved"))}catch(g){e.error(g.message)}finally{p(!1)}};return r.jsxs(Ge,{title:f("settings.identity.title"),description:f("settings.identity.subtitle"),children:[n?null:r.jsx(pt,{children:f("common.none_yet")}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("settings.identity.owner_name"),children:r.jsx(Ce,{value:l.owner_name||"",onChange:g=>c({...l,owner_name:g.target.value})})}),r.jsx(de,{label:f("settings.identity.language"),children:r.jsx(wt,{value:l.language||"es",onChange:g=>c({...l,language:g}),options:VP.map(g=>({value:g,label:g}))})}),r.jsx(de,{label:f("settings.identity.timezone"),hint:f("settings.identity.timezone_hint"),children:r.jsx(Ce,{value:l.timezone||"",onChange:g=>c({...l,timezone:g.target.value})})})]}),r.jsx("div",{className:"mt-3",children:r.jsx(de,{label:f("settings.identity.owner_context"),hint:f("settings.identity.owner_context_hint"),children:r.jsx(cn,{rows:3,value:l.owner_context||"",onChange:g=>c({...l,owner_context:g.target.value})})})}),r.jsx("div",{className:"mt-4",children:r.jsx(ge,{variant:"primary",loading:d,onClick:m,children:f("common.save")})})]})}function $P(){const e=at(),n=la(),{superAgent:s,isLoading:o,mutate:l}=B2(),{patch:c}=Lr(),{identity:d,save:p}=rb(),[m,g]=x.useState(!0),[h,_]=x.useState(""),[v,k]=x.useState(""),[S,j]=x.useState("permiso"),[w,C]=x.useState(!1);if(x.useEffect(()=>{s&&(g(!!s.enabled),_(s.system||""),j(s.permission_mode||"permiso"))},[s]),x.useEffect(()=>{k(d.personality||"")},[d.personality]),o||!s)return r.jsx(nt,{});const E=async()=>{C(!0);try{await c({"super_agent.enabled":m,"super_agent.system":h,"super_agent.permission_mode":S},["super_agent.name"]),await p({personality:v}),e.success(f("settings.super_agent.saved")),l()}catch(N){e.error(N.message)}finally{C(!1)}};return r.jsx(Ge,{title:f("settings.super_agent.title"),description:f("settings.super_agent.behavior_subtitle"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"flex items-center gap-3",children:r.jsx(Zt,{checked:m,onChange:g,label:f("settings.super_agent.enabled_label")})}),r.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("settings.super_agent.model_active")}),r.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:s.model||"—"})]}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>n("/p/0/models"),children:[r.jsx(dx,{size:13})," ",f("settings.super_agent.model_configure")]})]}),r.jsx(de,{label:f("settings.super_agent.permission_mode"),children:r.jsx(wt,{value:S,onChange:j,options:bx.map(N=>({value:N,label:N}))})}),r.jsx(de,{label:f("settings.super_agent.personality"),children:r.jsx(cn,{rows:2,value:v,onChange:N=>k(N.target.value)})}),r.jsx(de,{label:f("settings.super_agent.system"),hint:f("settings.super_agent.system_hint"),children:r.jsx(cn,{rows:6,className:"font-mono text-xs",value:h,onChange:N=>_(N.target.value),placeholder:f("settings.super_agent.system_ph")})}),r.jsx(ge,{variant:"primary",loading:w,onClick:E,children:f("common.save")})]})})}const Lg={providers:()=>me.get("/embeddings/providers"),test:(e={})=>me.post("/embeddings/test",e),reindex:()=>me.post("/embeddings/reindex",{})},GP=()=>[{value:"auto",label:f("memory_panel.provider_auto")},{value:"ollama",label:f("memory_panel.provider_ollama")},{value:"gemini",label:f("memory_panel.provider_gemini")},{value:"openai",label:f("memory_panel.provider_openai")},{value:"tf",label:f("memory_panel.provider_tf")}],FP=()=>[{value:"chain",label:f("memory_panel.mode_chain")},{value:"single",label:f("memory_panel.mode_single")}],jj=e=>e.startsWith("***");function YP(){const e=at(),{config:n,isLoading:s,patch:o}=Lr(),{data:l,mutate:c}=Qe("/embeddings/providers",()=>Lg.providers()),[d,p]=x.useState(!1),[m,g]=x.useState(null);if(s)return r.jsx(nt,{});const h=n.memory||{},_=h.embeddings||{},v=l?.configured_provider||_.provider||"auto",k=l?.mode||_.mode||"chain",S=l?.engines||[],j=async E=>{p(!0);try{await o(E),await c()}catch(N){e.error(f("memory_panel.save_failed",{msg:N.message}))}finally{p(!1)}},w=async()=>{p(!0),g(null);try{const E=await Lg.test({});g(`${E.embedder} · dim ${E.dim} · ${E.ms}ms`),e.success(f("memory_panel.test_ok",{embedder:E.embedder}))}catch(E){e.error(f("memory_panel.test_failed",{msg:E.message}))}finally{p(!1)}},C=async()=>{p(!0);try{const E=await Lg.reindex();e.success(f("memory_panel.reindexed",{indexed:E.indexed,cleared:E.cleared}))}catch(E){e.error(f("memory_panel.reindex_failed",{msg:E.message}))}finally{p(!1)}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ge,{title:f("memory_panel.embeddings_title"),description:f("memory_panel.embeddings_desc"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:f("memory_panel.provider_label"),hint:f("memory_panel.provider_hint"),children:r.jsx(wt,{value:v,onChange:E=>j({"memory.embeddings.provider":E}),options:GP(),disabled:d,className:"max-w-xl"})}),r.jsx(de,{label:f("memory_panel.mode_label"),hint:f("memory_panel.mode_hint"),children:r.jsx(wt,{value:k,onChange:E=>j({"memory.embeddings.mode":E}),options:FP(),disabled:d,className:"max-w-md"})}),r.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:S.map(E=>r.jsxs(Ve,{tone:E.available?"success":"muted",children:[E.id,": ",E.available?f("memory_panel.available"):f("memory_panel.unavailable")]},E.id))}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(ge,{variant:"secondary",onClick:w,loading:d,children:[r.jsx(ls,{size:14})," ",f("memory_panel.test_btn")]}),r.jsxs(ge,{variant:"secondary",onClick:C,loading:d,children:[r.jsx(Yw,{size:14})," ",f("memory_panel.reindex_btn")]}),m&&r.jsx("span",{className:"text-sm text-muted-foreground",children:m})]})]})}),r.jsxs(Ge,{title:f("memory_panel.ollama_title"),description:f("memory_panel.ollama_desc"),children:[r.jsx(de,{label:f("memory_panel.model_label"),children:r.jsx(Ce,{defaultValue:_.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:d,onBlur:E=>{const N=E.target.value.trim();N&&N!==_.ollama?.model&&j({"memory.embeddings.ollama.model":N})},className:"max-w-md"})}),r.jsx(de,{label:f("memory_panel.base_url_label"),hint:f("memory_panel.ollama_base_url_hint"),children:r.jsx(Ce,{defaultValue:_.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:d,onBlur:E=>j({"memory.embeddings.ollama.base_url":E.target.value.trim()}),className:"max-w-md"})})]}),r.jsxs(Ge,{title:f("memory_panel.openai_title"),description:f("memory_panel.openai_desc"),children:[r.jsx(de,{label:f("memory_panel.model_label"),children:r.jsx(Ce,{defaultValue:_.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:d,onBlur:E=>{const N=E.target.value.trim();N&&N!==_.openai?.model&&j({"memory.embeddings.openai.model":N})},className:"max-w-md"})}),r.jsx(de,{label:f("memory_panel.api_key_label"),hint:f("memory_panel.openai_key_hint"),children:r.jsx(Ce,{type:"password",defaultValue:_.openai?.api_key||"",placeholder:"sk-…",disabled:d,onBlur:E=>{const N=E.target.value;N&&!jj(N)&&j({"memory.embeddings.openai.api_key":N})},className:"max-w-md"})})]}),r.jsxs(Ge,{title:f("memory_panel.gemini_title"),description:f("memory_panel.gemini_desc"),children:[r.jsx(de,{label:f("memory_panel.model_label"),children:r.jsx(Ce,{defaultValue:_.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:d,onBlur:E=>{const N=E.target.value.trim();N&&N!==_.gemini?.model&&j({"memory.embeddings.gemini.model":N})},className:"max-w-md"})}),r.jsx(de,{label:f("memory_panel.api_key_label"),hint:f("memory_panel.gemini_key_hint"),children:r.jsx(Ce,{type:"password",defaultValue:_.gemini?.api_key||"",placeholder:"AIza…",disabled:d,onBlur:E=>{const N=E.target.value;N&&!jj(N)&&j({"memory.embeddings.gemini.api_key":N})},className:"max-w-md"})})]}),r.jsxs(Ge,{title:f("memory_panel.compaction_title"),description:f("memory_panel.compaction_desc"),children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:f("memory_panel.threshold_label"),hint:f("memory_panel.threshold_hint"),children:r.jsx(Ce,{type:"number",min:1,defaultValue:h.compact_threshold??60,placeholder:"60",disabled:d,onBlur:E=>{const N=parseInt(E.target.value,10);Number.isFinite(N)&&N>0&&N!==h.compact_threshold&&j({"memory.compact_threshold":N})},className:"max-w-[10rem]"})}),r.jsx(de,{label:f("memory_panel.keep_recent_label"),hint:f("memory_panel.keep_recent_hint"),children:r.jsx(Ce,{type:"number",min:1,defaultValue:h.keep_recent??40,placeholder:"40",disabled:d,onBlur:E=>{const N=parseInt(E.target.value,10);Number.isFinite(N)&&N>0&&N!==h.keep_recent&&j({"memory.keep_recent":N})},className:"max-w-[10rem]"})})]}),r.jsx(de,{label:f("memory_panel.compact_model_label"),hint:f("memory_panel.compact_model_hint"),children:r.jsx(Ce,{defaultValue:h.compact_model||"ollama:gemma4:31b-cloud",placeholder:"ollama:gemma4:31b-cloud",disabled:d,onBlur:E=>{const N=E.target.value.trim();N&&N!==h.compact_model&&j({"memory.compact_model":N})},className:"max-w-md"})}),r.jsx(de,{label:f("memory_panel.compact_fallback_label"),hint:f("memory_panel.compact_fallback_hint"),children:r.jsx(Ce,{defaultValue:h.compact_fallback_model||"",placeholder:f("memory_panel.compact_fallback_ph"),disabled:d,onBlur:E=>{const N=E.target.value.trim();N!==(h.compact_fallback_model||"")&&j({"memory.compact_fallback_model":N})},className:"max-w-md"})})]})]})}function XP(){return[{key:"load_threshold",label:f("settings_ui.knob_load_threshold"),hint:f("settings_ui.knob_load_threshold_hint"),step:.01,min:0,max:1},{key:"hint_threshold",label:f("settings_ui.knob_hint_threshold"),hint:f("settings_ui.knob_hint_threshold_hint"),step:.01,min:0,max:1},{key:"margin",label:f("settings_ui.knob_margin"),hint:f("settings_ui.knob_margin_hint"),step:.01,min:0,max:1},{key:"max_loaded",label:f("settings_ui.knob_max_loaded"),hint:f("settings_ui.knob_max_loaded_hint"),step:1,min:0,max:5},{key:"max_hints",label:f("settings_ui.knob_max_hints"),hint:f("settings_ui.knob_max_hints_hint"),step:1,min:0,max:8},{key:"prompt_floor",label:f("settings_ui.knob_prompt_floor"),hint:f("settings_ui.knob_prompt_floor_hint"),step:1,min:0,max:40},{key:"body_char_cap",label:f("settings_ui.knob_body_char_cap"),hint:f("settings_ui.knob_body_char_cap_hint"),step:500,min:500,max:2e4}]}function KP(){const e=at(),{data:n,mutate:s,isLoading:o}=Qe("/skills/inspector",()=>Ki.inspector()),[l,c]=x.useState(!1),[d,p]=x.useState(""),[m,g]=x.useState(null);if(o||!n)return r.jsx(nt,{});const h=n.config,_=n.index,v=async j=>{c(!0);try{await Ki.updateInspector(j),await s()}catch(w){e.error(f("settings_ui.could_not_save",{msg:w.message}))}finally{c(!1)}},k=async(j=!1)=>{c(!0);try{const w=await Ki.index({force:j});e.success(f("settings_ui.indexed_with",{embedder:w.embedder,dim:w.dim,added:w.changed.added,refreshed:w.changed.refreshed,removed:w.changed.removed})),await s()}catch(w){e.error(f("settings_ui.index_failed",{msg:w.message}))}finally{c(!1)}},S=async()=>{if(d.trim()){c(!0),g(null);try{const j=await Ki.inspect(d.trim());g(j.trace)}catch(j){e.error(f("settings_ui.dry_run_failed",{msg:j.message}))}finally{c(!1)}}};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ge,{title:f("settings_ui.inspector_title"),description:f("settings_ui.inspector_desc"),children:r.jsxs("div",{className:"space-y-4",children:[r.jsx(de,{label:f("settings_ui.enable_inspector"),hint:f("settings_ui.enable_inspector_hint"),children:r.jsx(Zt,{checked:h.enabled,disabled:l,onChange:j=>v({enabled:j}),label:h.enabled?f("settings_ui.on"):f("settings_ui.off")})}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:[r.jsx(Ve,{tone:_.count>0?"success":"warning",children:f("settings_ui.index_count",{n:_.count})}),r.jsx(Ve,{tone:"muted",children:_.embedder||f("settings_ui.not_indexed")}),_.dim?r.jsx(Ve,{tone:"muted",children:f("settings_ui.dim",{dim:_.dim})}):null,_.updated_at?r.jsx("span",{className:"text-xs text-muted-foreground",children:f("settings_ui.updated_at",{date:new Date(_.updated_at).toLocaleString()})}):null]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[r.jsxs(ge,{variant:"secondary",onClick:()=>k(!1),loading:l,children:[r.jsx(os,{size:14})," ",f("settings_ui.reindex")]}),r.jsxs(ge,{variant:"secondary",onClick:()=>k(!0),loading:l,children:[r.jsx(os,{size:14})," ",f("settings_ui.reindex_forced")]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:f("settings_ui.embedder_source")})]})]})}),r.jsx(Ge,{title:f("settings_ui.thresholds_title"),description:f("settings_ui.thresholds_desc"),children:r.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2",children:XP().map(j=>r.jsx(de,{label:j.label,hint:j.hint,children:r.jsx(Ce,{type:"number",step:j.step,min:j.min,max:j.max,defaultValue:String(h[j.key]),disabled:l,onBlur:w=>{const C=Number(w.target.value);Number.isFinite(C)&&C!==h[j.key]&&v({[j.key]:C})},className:"max-w-[12rem]"})},j.key))})}),r.jsx(Ge,{title:f("settings_ui.test_title"),description:f("settings_ui.test_desc"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(Ce,{value:d,placeholder:f("settings_ui.test_placeholder"),disabled:l,onChange:j=>p(j.target.value),onKeyDown:j=>{j.key==="Enter"&&S()},className:"max-w-xl flex-1"}),r.jsxs(ge,{variant:"primary",onClick:S,loading:l,children:[r.jsx(wA,{size:14})," ",f("settings_ui.test_btn")]})]}),m&&r.jsxs("div",{className:"rounded-md border border-border/60 bg-muted/30 p-3 text-sm",children:[r.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[r.jsx(ls,{size:14,className:"text-muted-foreground"}),r.jsx("span",{className:"text-muted-foreground",children:m.embedder||"—"}),m.jit?r.jsx(Ve,{tone:"warning",children:f("settings_ui.jit_empty_index")}):null,m.reason&&!m.loaded?.length&&!m.hinted?.length?r.jsx(Ve,{tone:"muted",children:m.reason}):null]}),m.loaded?.length?r.jsxs("div",{className:"mb-1",children:[r.jsxs("span",{className:"text-muted-foreground",children:[f("settings_ui.loaded_label")," "]}),m.loaded.map(j=>r.jsx(Ve,{tone:"success",className:"mr-1",children:j},j))]}):null,m.hinted?.length?r.jsxs("div",{className:"mb-1",children:[r.jsxs("span",{className:"text-muted-foreground",children:[f("settings_ui.suggested_label")," "]}),m.hinted.map(j=>r.jsx(Ve,{tone:"info",className:"mr-1",children:j},j))]}):null,m.scored?.length?r.jsx("div",{className:"mt-2 space-y-0.5 font-mono text-xs text-muted-foreground",children:m.scored.map(j=>r.jsxs("div",{children:[j.sim.toFixed(3)," ",j.slug]},j.slug))}):null]})]})})]})}function QP(){const e=at(),{config:n,isLoading:s,patch:o,mutate:l}=Lr(),c=n.telegram?.channels||[],d=Math.max(0,c.findIndex(T=>T.name==="default")),p=c[d],[m,g]=x.useState(!0),[h,_]=x.useState(1500),[v,k]=x.useState(!0),[S,j]=x.useState(""),[w,C]=x.useState(""),[E,N]=x.useState(!1);if(x.useEffect(()=>{g(!!n.telegram?.enabled),_(Number(n.telegram?.poll_interval_ms||1500)),k(!!n.telegram?.respond_with_engine),j(""),C(p?.chat_id||"")},[n,p?.chat_id]),s)return r.jsx(nt,{});const R=async()=>{N(!0);try{const T=c.slice(),O={name:"default",chat_id:w,respond_with_engine:v,...S?{bot_token:S}:{}};c.length===0?T.push(O):T[d]={...p,...O},await o({"telegram.enabled":m,"telegram.poll_interval_ms":h,"telegram.respond_with_engine":v,"telegram.channels":T}),e.success(f("settings.telegram_global.saved")),l(),j("")}catch(T){e.error(T.message)}finally{N(!1)}};return r.jsx(Ge,{title:f("settings.telegram_global.title"),description:f("settings.telegram_global.subtitle"),children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Zt,{checked:m,onChange:g,label:f("settings.telegram_global.enabled")}),r.jsx(Zt,{checked:v,onChange:k,label:f("settings.telegram_global.respond_with_engine")})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("settings.telegram_global.bot_token"),hint:p?.bot_token?`…${Cl(p.bot_token)??""} ${f("telegram_ui.secret_set_replace")}`:f("telegram_ui.bot_token_hint_short"),children:r.jsx(Ce,{type:"password",value:S,onChange:T=>j(T.target.value),placeholder:p?.bot_token?`…${Cl(p.bot_token)??""} ${f("telegram_ui.secret_already_set")}`:""})}),r.jsx(de,{label:f("settings.telegram_global.chat_id"),children:r.jsx(Ce,{value:w,onChange:T=>C(T.target.value),placeholder:"889721252"})}),r.jsx(de,{label:f("settings.telegram_global.poll_interval"),children:r.jsx(Ce,{type:"number",value:String(h),onChange:T=>_(Number(T.target.value)||1500)})})]}),r.jsx(ge,{variant:"primary",loading:E,onClick:R,children:f("common.save")})]})})}function ZP(){const e=at(),{channels:n,isLoading:s,mutate:o}=pb(),{contacts:l}=mb(),[c,d]=x.useState(null),[p,m]=x.useState(null),g=new Map;for(const _ of l)g.set(String(_.user_id),_.name||`@${_.username||_.user_id}`);const h=async _=>{if(confirm(f("telegram_channels.delete_confirm",{name:_})))try{await An.channels.remove(_),e.success(f("telegram_channels.removed")),o()}catch(v){e.error(v.message)}};return r.jsxs(Ge,{title:f("telegram_channels.title"),description:f("telegram_channels.desc"),action:r.jsxs(ge,{size:"sm",onClick:()=>d({name:""}),children:[r.jsx(nn,{size:14})," ",f("telegram_channels.new_btn")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(pt,{children:f("telegram_channels.empty")}),r.jsx("ul",{className:"space-y-2 text-sm",children:n.map(_=>{const v=_.owner_user_id!=null?g.get(String(_.owner_user_id))||f("telegram_ui.user_id_fallback",{id:_.owner_user_id}):f("telegram_channels.no_owner");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsx("span",{className:"font-medium",children:_.name}),r.jsxs("div",{className:"flex items-center gap-2",children:[_.project&&r.jsxs(Ve,{tone:"success",children:["project = ",_.project]}),r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>m(_),children:[r.jsx(Ya,{size:13})," ",f("admin.telegram_send_test")]}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>d(_),children:f("common.edit")}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>h(_.name),children:f("common.delete")})]})]}),r.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[r.jsxs("span",{children:["chat_id: ",_.chat_id||"—"]}),r.jsxs("span",{children:["bot_token: ",_.bot_token?`…${Cl(_.bot_token)??""}`:"—"]}),r.jsxs("span",{children:["route_to_agent: ",_.route_to_agent||f("telegram_ui.default_apx")]}),r.jsxs("span",{children:["engine: ",_.respond_with_engine?f("telegram_ui.yes"):f("telegram_ui.no")]}),r.jsxs("span",{className:"col-span-2",children:[f("telegram_channels.owner_label")," ",v]})]})]},_.name)})}),r.jsx(p2,{channel:c,onClose:()=>d(null),onSaved:()=>{d(null),o()}}),r.jsx(m2,{channel:p,onClose:()=>m(null)})]})}const wj=new Set(["owner","guest"]);function WP(){const e=at(),{roles:n,mutate:s,isLoading:o}=mb(),[l,c]=x.useState(""),[d,p]=x.useState(""),[m,g]=x.useState(!1),[h,_]=x.useState(!1),v=async()=>{const j=l.trim();if(!j){e.error(f("telegram_roles.name_required"));return}if(wj.has(j)){e.error(f("telegram_roles.builtin_error",{name:j}));return}_(!0);try{const w=m?"*":d.split(",").map(C=>C.trim()).filter(Boolean);await An.roles.set(j,w),e.success(f("telegram_roles.saved",{name:j})),c(""),p(""),g(!1),s()}catch(w){e.error(w.message)}finally{_(!1)}},k=async j=>{if(confirm(f("telegram_roles.delete_confirm",{name:j})))try{await An.roles.remove(j),e.success(f("telegram_roles.removed")),s()}catch(w){e.error(w.message)}},S=Object.entries(n);return r.jsxs(Ge,{title:f("telegram_roles.title"),description:f("telegram_roles.desc"),children:[o&&r.jsx(nt,{}),S.length===0&&!o&&r.jsx(pt,{children:f("telegram_roles.empty")}),S.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:S.map(([j,w])=>{const C=wj.has(j),E=w?.tools==="*"?f("telegram_roles.tools_all"):Array.isArray(w?.tools)&&w.tools.length>0?w.tools.join(", "):f("telegram_roles.tools_none");return r.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("span",{className:"font-medium",children:j}),C&&r.jsx(Ve,{tone:"info",children:f("telegram_roles.builtin")})]}),!C&&r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>k(j),children:f("telegram_roles.delete_btn")})]}),r.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:[f("telegram_contacts.tools_label")," ",E]})]},j)})}),r.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(nn,{size:14})," ",f("telegram_roles.new_title")]}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsx(de,{label:f("telegram_roles.name_label"),children:r.jsx(Ce,{value:l,onChange:j=>c(j.target.value),placeholder:f("telegram_roles.name_ph")})}),r.jsx(de,{label:f("telegram_roles.tools_label"),hint:f("telegram_roles.tools_hint"),children:r.jsx(Ce,{value:d,onChange:j=>p(j.target.value),disabled:m,placeholder:f("telegram_roles.tools_ph")})})]}),r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Zt,{checked:m,onChange:g,label:f("telegram_roles.full_access")}),r.jsx(ge,{variant:"primary",loading:h,onClick:v,children:f("telegram_roles.save_btn")})]})]})]})}const iC="apx.settings.telegramTab";function JP(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(iC);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function e8(){const[e,n]=x.useState("default");x.useEffect(()=>{n(JP())},[]);const s=o=>{const l=o==="channels"||o==="contacts"||o==="roles"||o==="default"?o:"default";n(l);try{window.localStorage.setItem(iC,l)}catch{}};return r.jsxs(Df,{value:e,onValueChange:s,className:"w-full",children:[r.jsxs(Lf,{children:[r.jsx(ns,{value:"default",children:f("settings.telegram_global.title")}),r.jsx(ns,{value:"channels",children:f("telegram_channels.title")}),r.jsx(ns,{value:"contacts",children:f("telegram_contacts.title")}),r.jsx(ns,{value:"roles",children:f("telegram_roles.title")})]}),r.jsx(za,{value:"default",className:"mt-4",children:r.jsx(QP,{})}),r.jsx(za,{value:"channels",className:"mt-4",children:r.jsx(ZP,{})}),r.jsx(za,{value:"contacts",className:"mt-4",children:r.jsx(g2,{})}),r.jsx(za,{value:"roles",className:"mt-4",children:r.jsx(WP,{})})]})}function t8(){const{data:e,error:n,isLoading:s,mutate:o}=Qe("/pair/list",()=>Sl.list(),{refreshInterval:ff.pairList});return{clients:e?.clients||[],error:n,isLoading:s,mutate:o}}var ll={},Pg,kj;function n8(){return kj||(kj=1,Pg=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Pg}var Ig={},xr={},Sj;function vo(){if(Sj)return xr;Sj=1;let e;const n=[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 xr.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},xr.getSymbolTotalCodewords=function(o){return n[o]},xr.getBCHDigit=function(s){let o=0;for(;s!==0;)o++,s>>>=1;return o},xr.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},xr.isKanjiModeEnabled=function(){return typeof e<"u"},xr.toSJIS=function(o){return e(o)},xr}var Bg={},Cj;function Tb(){return Cj||(Cj=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function n(s){if(typeof s!="string")throw new Error("Param is not a string");switch(s.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+s)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,l){if(e.isValid(o))return o;try{return n(o)}catch{return l}}})(Bg)),Bg}var Ug,Ej;function a8(){if(Ej)return Ug;Ej=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(n){const s=Math.floor(n/8);return(this.buffer[s]>>>7-n%8&1)===1},put:function(n,s){for(let o=0;o<s;o++)this.putBit((n>>>s-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(n){const s=Math.floor(this.length/8);this.buffer.length<=s&&this.buffer.push(0),n&&(this.buffer[s]|=128>>>this.length%8),this.length++}},Ug=e,Ug}var Hg,Nj;function s8(){if(Nj)return Hg;Nj=1;function e(n){if(!n||n<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=n,this.data=new Uint8Array(n*n),this.reservedBit=new Uint8Array(n*n)}return e.prototype.set=function(n,s,o,l){const c=n*this.size+s;this.data[c]=o,l&&(this.reservedBit[c]=!0)},e.prototype.get=function(n,s){return this.data[n*this.size+s]},e.prototype.xor=function(n,s,o){this.data[n*this.size+s]^=o},e.prototype.isReserved=function(n,s){return this.reservedBit[n*this.size+s]},Hg=e,Hg}var Vg={},Rj;function r8(){return Rj||(Rj=1,(function(e){const n=vo().getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const l=Math.floor(o/7)+2,c=n(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}})(Vg)),Vg}var qg={},Tj;function o8(){if(Tj)return qg;Tj=1;const e=vo().getSymbolSize,n=7;return qg.getPositions=function(o){const l=e(o);return[[0,0],[l-n,0],[0,l-n]]},qg}var $g={},Aj;function l8(){return Aj||(Aj=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const n={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 _=0;_<c;_++){p=m=0,g=h=null;for(let v=0;v<c;v++){let k=l.get(_,v);k===g?p++:(p>=5&&(d+=n.N1+(p-5)),g=k,p=1),k=l.get(v,_),k===h?m++:(m>=5&&(d+=n.N1+(m-5)),h=k,m=1)}p>=5&&(d+=n.N1+(p-5)),m>=5&&(d+=n.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*n.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*n.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)*n.N4};function s(o,l,c){switch(o){case e.Patterns.PATTERN000:return(l+c)%2===0;case e.Patterns.PATTERN001:return l%2===0;case e.Patterns.PATTERN010:return c%3===0;case e.Patterns.PATTERN011:return(l+c)%3===0;case e.Patterns.PATTERN100:return(Math.floor(l/2)+Math.floor(c/3))%2===0;case e.Patterns.PATTERN101:return l*c%2+l*c%3===0;case e.Patterns.PATTERN110:return(l*c%2+l*c%3)%2===0;case e.Patterns.PATTERN111:return(l*c%3+(l+c)%2)%2===0;default:throw new Error("bad maskPattern:"+o)}}e.applyMask=function(l,c){const 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,s(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}})($g)),$g}var gd={},Mj;function cC(){if(Mj)return gd;Mj=1;const e=Tb(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],s=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return gd.getBlocksCount=function(l,c){switch(c){case e.L:return n[(l-1)*4+0];case e.M:return n[(l-1)*4+1];case e.Q:return n[(l-1)*4+2];case e.H:return n[(l-1)*4+3];default:return}},gd.getTotalCodewordsCount=function(l,c){switch(c){case e.L:return s[(l-1)*4+0];case e.M:return s[(l-1)*4+1];case e.Q:return s[(l-1)*4+2];case e.H:return s[(l-1)*4+3];default:return}},gd}var Gg={},Fi={},Oj;function i8(){if(Oj)return Fi;Oj=1;const e=new Uint8Array(512),n=new Uint8Array(256);return(function(){let o=1;for(let l=0;l<255;l++)e[l]=o,n[o]=l,o<<=1,o&256&&(o^=285);for(let l=255;l<512;l++)e[l]=e[l-255]})(),Fi.log=function(o){if(o<1)throw new Error("log("+o+")");return n[o]},Fi.exp=function(o){return e[o]},Fi.mul=function(o,l){return o===0||l===0?0:e[n[o]+n[l]]},Fi}var zj;function c8(){return zj||(zj=1,(function(e){const n=i8();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]^=n.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]^=n.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,n.exp(c)]));return l}})(Gg)),Gg}var Fg,Dj;function u8(){if(Dj)return Fg;Dj=1;const e=c8();function n(s){this.genPoly=void 0,this.degree=s,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(o){this.degree=o,this.genPoly=e.generateECPolynomial(this.degree)},n.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},Fg=n,Fg}var Yg={},Xg={},Kg={},Lj;function uC(){return Lj||(Lj=1,Kg.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),Kg}var Wa={},Pj;function dC(){if(Pj)return Wa;Pj=1;const e="[0-9]+",n="[A-Z $%*+\\-./:]+";let s="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";s=s.replace(/u/g,"\\u");const o="(?:(?![A-Z0-9 $%*+\\-./:]|"+s+`)(?:.|[\r
617
- ]))+`;Wa.KANJI=new RegExp(s,"g"),Wa.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Wa.BYTE=new RegExp(o,"g"),Wa.NUMERIC=new RegExp(e,"g"),Wa.ALPHANUMERIC=new RegExp(n,"g");const l=new RegExp("^"+s+"$"),c=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Wa.testKanji=function(m){return l.test(m)},Wa.testNumeric=function(m){return c.test(m)},Wa.testAlphanumeric=function(m){return d.test(m)},Wa}var Ij;function yo(){return Ij||(Ij=1,(function(e){const n=uC(),s=dC();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(!n.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 s.testNumeric(c)?e.NUMERIC:s.testAlphanumeric(c)?e.ALPHANUMERIC:s.testKanji(c)?e.KANJI:e.BYTE},e.toString=function(c){if(c&&c.id)return c.id;throw new Error("Invalid mode")},e.isValid=function(c){return c&&c.bit&&c.ccBits};function o(l){if(typeof l!="string")throw new Error("Param is not a string");switch(l.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+l)}}e.from=function(c,d){if(e.isValid(c))return c;try{return o(c)}catch{return d}}})(Xg)),Xg}var Bj;function d8(){return Bj||(Bj=1,(function(e){const n=vo(),s=cC(),o=Tb(),l=yo(),c=uC(),d=7973,p=n.getBCHDigit(d);function m(v,k,S){for(let j=1;j<=40;j++)if(k<=e.getCapacity(j,S,v))return j}function g(v,k){return l.getCharCountIndicator(v,k)+4}function h(v,k){let S=0;return v.forEach(function(j){const w=g(j.mode,k);S+=w+j.getBitsLength()}),S}function _(v,k){for(let S=1;S<=40;S++)if(h(v,S)<=e.getCapacity(S,k,l.MIXED))return S}e.from=function(k,S){return c.isValid(k)?parseInt(k,10):S},e.getCapacity=function(k,S,j){if(!c.isValid(k))throw new Error("Invalid QR Code version");typeof j>"u"&&(j=l.BYTE);const w=n.getSymbolTotalCodewords(k),C=s.getTotalCodewordsCount(k,S),E=(w-C)*8;if(j===l.MIXED)return E;const N=E-g(j,k);switch(j){case l.NUMERIC:return Math.floor(N/10*3);case l.ALPHANUMERIC:return Math.floor(N/11*2);case l.KANJI:return Math.floor(N/13);case l.BYTE:default:return Math.floor(N/8)}},e.getBestVersionForData=function(k,S){let j;const w=o.from(S,o.M);if(Array.isArray(k)){if(k.length>1)return _(k,w);if(k.length===0)return 1;j=k[0]}else j=k;return m(j.mode,j.getLength(),w)},e.getEncodedBits=function(k){if(!c.isValid(k)||k<7)throw new Error("Invalid QR Code version");let S=k<<12;for(;n.getBCHDigit(S)-p>=0;)S^=d<<n.getBCHDigit(S)-p;return k<<12|S}})(Yg)),Yg}var Qg={},Uj;function f8(){if(Uj)return Qg;Uj=1;const e=vo(),n=1335,s=21522,o=e.getBCHDigit(n);return Qg.getEncodedBits=function(c,d){const p=c.bit<<3|d;let m=p<<10;for(;e.getBCHDigit(m)-o>=0;)m^=n<<e.getBCHDigit(m)-o;return(p<<10|m)^s},Qg}var Zg={},Wg,Hj;function p8(){if(Hj)return Wg;Hj=1;const e=yo();function n(s){this.mode=e.NUMERIC,this.data=s.toString()}return n.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.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))},Wg=n,Wg}var Jg,Vj;function m8(){if(Vj)return Jg;Vj=1;const e=yo(),n=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function s(o){this.mode=e.ALPHANUMERIC,this.data=o}return s.getBitsLength=function(l){return 11*Math.floor(l/2)+6*(l%2)},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(l){let c;for(c=0;c+2<=this.data.length;c+=2){let d=n.indexOf(this.data[c])*45;d+=n.indexOf(this.data[c+1]),l.put(d,11)}this.data.length%2&&l.put(n.indexOf(this.data[c]),6)},Jg=s,Jg}var eh,qj;function g8(){if(qj)return eh;qj=1;const e=yo();function n(s){this.mode=e.BYTE,typeof s=="string"?this.data=new TextEncoder().encode(s):this.data=new Uint8Array(s)}return n.getBitsLength=function(o){return o*8},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)},n.prototype.write=function(s){for(let o=0,l=this.data.length;o<l;o++)s.put(this.data[o],8)},eh=n,eh}var th,$j;function h8(){if($j)return th;$j=1;const e=yo(),n=vo();function s(o){this.mode=e.KANJI,this.data=o}return s.getBitsLength=function(l){return l*13},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(o){let l;for(l=0;l<this.data.length;l++){let c=n.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]+`
618
- Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),o.put(c,13)}},th=s,th}var nh={exports:{}},Gj;function x8(){return Gj||(Gj=1,(function(e){var n={single_source_shortest_paths:function(s,o,l){var c={},d={};d[o]=0;var p=n.PriorityQueue.make();p.push(o,0);for(var m,g,h,_,v,k,S,j,w;!p.empty();){m=p.pop(),g=m.value,_=m.cost,v=s[g]||{};for(h in v)v.hasOwnProperty(h)&&(k=v[h],S=_+k,j=d[h],w=typeof d[h]>"u",(w||j>S)&&(d[h]=S,p.push(h,S),c[h]=g))}if(typeof l<"u"&&typeof d[l]>"u"){var C=["Could not find a path from ",o," to ",l,"."].join("");throw new Error(C)}return c},extract_shortest_path_from_predecessor_list:function(s,o){for(var l=[],c=o;c;)l.push(c),s[c],c=s[c];return l.reverse(),l},find_path:function(s,o,l){var c=n.single_source_shortest_paths(s,o,l);return n.extract_shortest_path_from_predecessor_list(c,l)},PriorityQueue:{make:function(s){var o=n.PriorityQueue,l={},c;s=s||{};for(c in o)o.hasOwnProperty(c)&&(l[c]=o[c]);return l.queue=[],l.sorter=s.sorter||o.default_sorter,l},default_sorter:function(s,o){return s.cost-o.cost},push:function(s,o){var l={value:s,cost:o};this.queue.push(l),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=n})(nh)),nh.exports}var Fj;function b8(){return Fj||(Fj=1,(function(e){const n=yo(),s=p8(),o=m8(),l=g8(),c=h8(),d=dC(),p=vo(),m=x8();function g(C){return unescape(encodeURIComponent(C)).length}function h(C,E,N){const R=[];let T;for(;(T=C.exec(N))!==null;)R.push({data:T[0],index:T.index,mode:E,length:T[0].length});return R}function _(C){const E=h(d.NUMERIC,n.NUMERIC,C),N=h(d.ALPHANUMERIC,n.ALPHANUMERIC,C);let R,T;return p.isKanjiModeEnabled()?(R=h(d.BYTE,n.BYTE,C),T=h(d.KANJI,n.KANJI,C)):(R=h(d.BYTE_KANJI,n.BYTE,C),T=[]),E.concat(N,R,T).sort(function(A,z){return A.index-z.index}).map(function(A){return{data:A.data,mode:A.mode,length:A.length}})}function v(C,E){switch(E){case n.NUMERIC:return s.getBitsLength(C);case n.ALPHANUMERIC:return o.getBitsLength(C);case n.KANJI:return c.getBitsLength(C);case n.BYTE:return l.getBitsLength(C)}}function k(C){return C.reduce(function(E,N){const R=E.length-1>=0?E[E.length-1]:null;return R&&R.mode===N.mode?(E[E.length-1].data+=N.data,E):(E.push(N),E)},[])}function S(C){const E=[];for(let N=0;N<C.length;N++){const R=C[N];switch(R.mode){case n.NUMERIC:E.push([R,{data:R.data,mode:n.ALPHANUMERIC,length:R.length},{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.ALPHANUMERIC:E.push([R,{data:R.data,mode:n.BYTE,length:R.length}]);break;case n.KANJI:E.push([R,{data:R.data,mode:n.BYTE,length:g(R.data)}]);break;case n.BYTE:E.push([{data:R.data,mode:n.BYTE,length:g(R.data)}])}}return E}function j(C,E){const N={},R={start:{}};let T=["start"];for(let O=0;O<C.length;O++){const A=C[O],z=[];for(let B=0;B<A.length;B++){const L=A[B],D=""+O+B;z.push(D),N[D]={node:L,lastCount:0},R[D]={};for(let P=0;P<T.length;P++){const H=T[P];N[H]&&N[H].node.mode===L.mode?(R[H][D]=v(N[H].lastCount+L.length,L.mode)-v(N[H].lastCount,L.mode),N[H].lastCount+=L.length):(N[H]&&(N[H].lastCount=L.length),R[H][D]=v(L.length,L.mode)+4+n.getCharCountIndicator(L.mode,E))}}T=z}for(let O=0;O<T.length;O++)R[T[O]].end=0;return{map:R,table:N}}function w(C,E){let N;const R=n.getBestModeForData(C);if(N=n.from(E,R),N!==n.BYTE&&N.bit<R.bit)throw new Error('"'+C+'" cannot be encoded with mode '+n.toString(N)+`.
619
- Suggested mode is: `+n.toString(R));switch(N===n.KANJI&&!p.isKanjiModeEnabled()&&(N=n.BYTE),N){case n.NUMERIC:return new s(C);case n.ALPHANUMERIC:return new o(C);case n.KANJI:return new c(C);case n.BYTE:return new l(C)}}e.fromArray=function(E){return E.reduce(function(N,R){return typeof R=="string"?N.push(w(R,null)):R.data&&N.push(w(R.data,R.mode)),N},[])},e.fromString=function(E,N){const R=_(E,p.isKanjiModeEnabled()),T=S(R),O=j(T,N),A=m.find_path(O.map,"start","end"),z=[];for(let B=1;B<A.length-1;B++)z.push(O.table[A[B]].node);return e.fromArray(k(z))},e.rawSplit=function(E){return e.fromArray(_(E,p.isKanjiModeEnabled()))}})(Zg)),Zg}var Yj;function _8(){if(Yj)return Ig;Yj=1;const e=vo(),n=Tb(),s=a8(),o=s8(),l=r8(),c=o8(),d=l8(),p=cC(),m=u8(),g=d8(),h=f8(),_=yo(),v=b8();function k(O,A){const z=O.size,B=c.getPositions(A);for(let L=0;L<B.length;L++){const D=B[L][0],P=B[L][1];for(let H=-1;H<=7;H++)if(!(D+H<=-1||z<=D+H))for(let q=-1;q<=7;q++)P+q<=-1||z<=P+q||(H>=0&&H<=6&&(q===0||q===6)||q>=0&&q<=6&&(H===0||H===6)||H>=2&&H<=4&&q>=2&&q<=4?O.set(D+H,P+q,!0,!0):O.set(D+H,P+q,!1,!0))}}function S(O){const A=O.size;for(let z=8;z<A-8;z++){const B=z%2===0;O.set(z,6,B,!0),O.set(6,z,B,!0)}}function j(O,A){const z=l.getPositions(A);for(let B=0;B<z.length;B++){const L=z[B][0],D=z[B][1];for(let P=-2;P<=2;P++)for(let H=-2;H<=2;H++)P===-2||P===2||H===-2||H===2||P===0&&H===0?O.set(L+P,D+H,!0,!0):O.set(L+P,D+H,!1,!0)}}function w(O,A){const z=O.size,B=g.getEncodedBits(A);let L,D,P;for(let H=0;H<18;H++)L=Math.floor(H/3),D=H%3+z-8-3,P=(B>>H&1)===1,O.set(L,D,P,!0),O.set(D,L,P,!0)}function C(O,A,z){const B=O.size,L=h.getEncodedBits(A,z);let D,P;for(D=0;D<15;D++)P=(L>>D&1)===1,D<6?O.set(D,8,P,!0):D<8?O.set(D+1,8,P,!0):O.set(B-15+D,8,P,!0),D<8?O.set(8,B-D-1,P,!0):D<9?O.set(8,15-D-1+1,P,!0):O.set(8,15-D-1,P,!0);O.set(B-8,8,1,!0)}function E(O,A){const z=O.size;let B=-1,L=z-1,D=7,P=0;for(let H=z-1;H>0;H-=2)for(H===6&&H--;;){for(let q=0;q<2;q++)if(!O.isReserved(L,H-q)){let Y=!1;P<A.length&&(Y=(A[P]>>>D&1)===1),O.set(L,H-q,Y),D--,D===-1&&(P++,D=7)}if(L+=B,L<0||z<=L){L-=B,B=-B;break}}}function N(O,A,z){const B=new s;z.forEach(function(q){B.put(q.mode.bit,4),B.put(q.getLength(),_.getCharCountIndicator(q.mode,O)),q.write(B)});const L=e.getSymbolTotalCodewords(O),D=p.getTotalCodewordsCount(O,A),P=(L-D)*8;for(B.getLengthInBits()+4<=P&&B.put(0,4);B.getLengthInBits()%8!==0;)B.putBit(0);const H=(P-B.getLengthInBits())/8;for(let q=0;q<H;q++)B.put(q%2?17:236,8);return R(B,O,A)}function R(O,A,z){const B=e.getSymbolTotalCodewords(A),L=p.getTotalCodewordsCount(A,z),D=B-L,P=p.getBlocksCount(A,z),H=B%P,q=P-H,Y=Math.floor(B/P),V=Math.floor(D/P),$=V+1,Z=Y-V,G=new m(Z);let X=0;const U=new Array(P),K=new Array(P);let F=0;const J=new Uint8Array(O.buffer);for(let ee=0;ee<P;ee++){const Te=ee<q?V:$;U[ee]=J.slice(X,X+Te),K[ee]=G.encode(U[ee]),X+=Te,F=Math.max(F,Te)}const ie=new Uint8Array(B);let re=0,oe,ce;for(oe=0;oe<F;oe++)for(ce=0;ce<P;ce++)oe<U[ce].length&&(ie[re++]=U[ce][oe]);for(oe=0;oe<Z;oe++)for(ce=0;ce<P;ce++)ie[re++]=K[ce][oe];return ie}function T(O,A,z,B){let L;if(Array.isArray(O))L=v.fromArray(O);else if(typeof O=="string"){let Y=A;if(!Y){const V=v.rawSplit(O);Y=g.getBestVersionForData(V,z)}L=v.fromString(O,Y||40)}else throw new Error("Invalid data");const D=g.getBestVersionForData(L,z);if(!D)throw new Error("The amount of data is too big to be stored in a QR Code");if(!A)A=D;else if(A<D)throw new Error(`
620
- The chosen QR Code version cannot contain this amount of data.
621
- Minimum version required to store current data is: `+D+`.
622
- `);const P=N(A,z,L),H=e.getSymbolSize(A),q=new o(H);return k(q,A),S(q),j(q,A),C(q,z,0),A>=7&&w(q,A),E(q,P),isNaN(B)&&(B=d.getBestMask(q,C.bind(null,q,z))),d.applyMask(B,q),C(q,z,B),{modules:q,version:A,errorCorrectionLevel:z,maskPattern:B,segments:L}}return Ig.create=function(A,z){if(typeof A>"u"||A==="")throw new Error("No input text");let B=n.M,L,D;return typeof z<"u"&&(B=n.from(z.errorCorrectionLevel,n.M),L=g.from(z.version),D=d.from(z.maskPattern),z.toSJISFunc&&e.setToSJISFunction(z.toSJISFunc)),T(A,L,B,D)},Ig}var ah={},sh={},Xj;function fC(){return Xj||(Xj=1,(function(e){function n(s){if(typeof s=="number"&&(s=s.toString()),typeof s!="string")throw new Error("Color should be defined as hex string");let o=s.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+s);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(c){return[c,c]}))),o.length===6&&o.push("F","F");const l=parseInt(o.join(""),16);return{r:l>>24&255,g:l>>16&255,b:l>>8&255,a:l&255,hex:"#"+o.slice(0,6).join("")}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const l=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,c=o.width&&o.width>=21?o.width:void 0,d=o.scale||4;return{width:c,scale:c?4:d,margin:l,color:{dark:n(o.color.dark||"#000000ff"),light:n(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,_=[c.color.light,c.color.dark];for(let v=0;v<g;v++)for(let k=0;k<g;k++){let S=(v*g+k)*4,j=c.color.light;if(v>=h&&k>=h&&v<g-h&&k<g-h){const w=Math.floor((v-h)/m),C=Math.floor((k-h)/m);j=_[p[w*d+C]?1:0]}o[S++]=j.r,o[S++]=j.g,o[S++]=j.b,o[S]=j.a}}})(sh)),sh}var Kj;function v8(){return Kj||(Kj=1,(function(e){const n=fC();function s(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=n.getOptions(m);const h=n.getImageWidth(c.modules.size,m),_=g.getContext("2d"),v=_.createImageData(h,h);return n.qrToImageData(v.data,c,m),s(_,g,h),_.putImageData(v,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",_=m.rendererOpts||{};return g.toDataURL(h,_.quality)}})(ah)),ah}var rh={},Qj;function y8(){if(Qj)return rh;Qj=1;const e=fC();function n(l,c){const d=l.a/255,p=c+'="'+l.hex+'"';return d<1?p+" "+c+'-opacity="'+d.toFixed(2).slice(1)+'"':p}function s(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 _=0;_<l.length;_++){const v=Math.floor(_%c),k=Math.floor(_/c);!v&&!g&&(g=!0),l[_]?(h++,_>0&&v>0&&l[_-1]||(p+=g?s("M",v+d,.5+k+d):s("m",m,0),m=0,g=!1),v+1<c&&l[_+1]||(p+=s("h",h),h=0)):m++}return p}return rh.render=function(c,d,p){const m=e.getOptions(d),g=c.modules.size,h=c.modules.data,_=g+m.margin*2,v=m.color.light.a?"<path "+n(m.color.light,"fill")+' d="M0 0h'+_+"v"+_+'H0z"/>':"",k="<path "+n(m.color.dark,"stroke")+' d="'+o(h,g,m.margin)+'"/>',S='viewBox="0 0 '+_+" "+_+'"',w='<svg xmlns="http://www.w3.org/2000/svg" '+(m.width?'width="'+m.width+'" height="'+m.width+'" ':"")+S+' shape-rendering="crispEdges">'+v+k+`</svg>
623
- `;return typeof p=="function"&&p(null,w),w},rh}var Zj;function j8(){if(Zj)return ll;Zj=1;const e=n8(),n=_8(),s=v8(),o=y8();function l(c,d,p,m,g){const h=[].slice.call(arguments,1),_=h.length,v=typeof h[_-1]=="function";if(!v&&!e())throw new Error("Callback required as last argument");if(v){if(_<2)throw new Error("Too few arguments provided");_===2?(g=p,p=d,d=m=void 0):_===3&&(d.getContext&&typeof g>"u"?(g=m,m=void 0):(g=m,m=p,p=d,d=void 0))}else{if(_<1)throw new Error("Too few arguments provided");return _===1?(p=d,d=m=void 0):_===2&&!d.getContext&&(m=p,p=d,d=void 0),new Promise(function(k,S){try{const j=n.create(p,m);k(c(j,d,m))}catch(j){S(j)}})}try{const k=n.create(p,m);g(null,c(k,d,m))}catch(k){g(k)}}return ll.create=n.create,ll.toCanvas=l.bind(null,s.render),ll.toDataURL=l.bind(null,s.renderToDataURL),ll.toString=l.bind(null,function(c,d,p){return o.render(c,p)}),ll}var w8=j8();const k8=ex(w8);function S8({value:e,size:n=200}){const[s,o]=x.useState(null);return x.useEffect(()=>{let l=!0;return k8.toDataURL(e,{margin:2,width:n*2,errorCorrectionLevel:"M"}).then(c=>{l&&o(c)}).catch(()=>{l&&o(null)}),()=>{l=!1}},[e,n]),r.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:n+24,height:n+24},children:s?r.jsx("img",{src:s,width:n,height:n,alt:"QR"}):r.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function C8(e){return e.find(n=>!n.includes("127.0.0.1")&&!n.includes("localhost"))||e[0]||window.location.origin}function E8({open:e,onClose:n,onPaired:s}){const o=at(),[l,c]=x.useState(null),[d,p]=x.useState(null),[m,g]=x.useState(0),[h,_]=x.useState(!1),v=x.useRef(null),k=x.useCallback(async()=>{c(null),p(null),_(!1);try{const E=await Sl.init();c(E),g(Math.round((E.ttl_ms||9e4)/1e3))}catch(E){E instanceof Mc&&E.status===403?p(f("settings.devices_pair_localhost_only")):p(E.message)}},[]);x.useEffect(()=>{e?k():(c(null),p(null),_(!1))},[e,k]),x.useEffect(()=>{if(!l||h||m<=0)return;const E=window.setTimeout(()=>g(N=>N-1),1e3);return()=>window.clearTimeout(E)},[l,m,h]),x.useEffect(()=>{if(!e||!l||h)return;let E=!0;const N=async()=>{try{const R=await Sl.status(l.pairing_id);if(!E)return;if(R.status==="confirmed"){_(!0),o.success(f("settings.devices_pair_done")),s(),window.setTimeout(()=>{E&&n()},900);return}if(R.status==="expired"||R.status==="unknown"){g(0);return}}catch{}v.current=window.setTimeout(N,1500)};return v.current=window.setTimeout(N,1500),()=>{E=!1,v.current&&window.clearTimeout(v.current)}},[e,l,h,n,s,o]);const S=!!l&&!h&&m<=0,j=l?C8(l.lan_urls):"",w=l?`${j}/#pair=${l.pairing_id}`:"",C=async(E,N)=>{try{await navigator.clipboard.writeText(E),o.success(N)}catch{o.error(E)}};return r.jsxs(Vn,{open:e,onClose:n,title:f("settings.devices_pair_title"),description:f("settings.devices_pair_desc"),footer:r.jsx(ge,{variant:"secondary",onClick:n,children:f("common.close")}),children:[d&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:d}),!d&&!l&&r.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[r.jsx(Pa,{})," ",f("common.loading")]}),!d&&l&&r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx("div",{className:S?"opacity-40":"",children:r.jsx(S8,{value:w,size:196})}),h?r.jsx("p",{className:"text-sm font-medium text-emerald-500",children:f("settings.devices_pair_done")}):S?r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("p",{className:"text-sm text-muted-fg",children:f("settings.devices_pair_expired")}),r.jsx(ge,{variant:"primary",onClick:()=>void k(),children:f("settings.devices_pair_regen")})]}):r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"text-center text-xs text-muted-fg",children:f("settings.devices_pair_scan")}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[r.jsx(Pa,{size:12}),r.jsx("span",{children:f("settings.devices_pair_waiting")}),r.jsxs("span",{className:"tabular-nums",children:["· ",f("settings.devices_pair_expires",{s:m})]})]}),r.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("settings.devices_pair_link")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:w}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>C(w,f("settings.devices_pair_copied")),title:f("settings.devices_pair_copy"),children:r.jsx(Ad,{size:14})})]})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs text-muted-fg",children:f("settings.devices_pair_code")}),r.jsxs("div",{className:"flex items-stretch gap-2",children:[r.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-center text-sm",children:l.pairing_id}),r.jsx(ge,{size:"sm",variant:"secondary",onClick:()=>C(l.pairing_id,f("settings.devices_pair_copied_code")),title:f("settings.devices_pair_copy"),children:r.jsx(Ad,{size:14})})]})]})]})]})]})]})}function N8(){const e=at(),{clients:n,isLoading:s,mutate:o}=t8(),[l,c]=x.useState(!1),d=async p=>{if(confirm(f("settings.devices_revoke_confirm",{id:p})))try{await Sl.revoke(p),e.success(f("settings.devices_revoke_success")),o()}catch(m){e.error(m.message)}};return r.jsxs(Ge,{title:f("settings.devices"),description:f("settings.devices_sub"),action:r.jsxs(ge,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[r.jsx(gA,{size:14})," ",f("settings.devices_pair_btn")]}),children:[s&&r.jsx(nt,{}),!s&&n.length===0&&r.jsx(pt,{children:f("settings.devices_empty")}),n.length>0&&r.jsx("ul",{className:"space-y-2 text-sm",children:n.map(p=>r.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[r.jsx("span",{className:"font-medium",children:p.label||p.id}),r.jsx(Ve,{tone:p.kind==="web"?"info":p.kind==="deck"?"success":"muted",children:p.kind}),r.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",p.token_suffix]}),r.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[f("settings.devices_last_seen")," ",p.last_seen?new Date(p.last_seen).toLocaleString():f("settings.devices_never")]}),r.jsx(ge,{size:"sm",variant:"destructive",onClick:()=>d(p.id),children:f("settings.devices_revoke")})]},p.id))}),r.jsx(E8,{open:l,onClose:()=>c(!1),onPaired:()=>o()})]})}const R8=[{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:bx.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 T8(){const{config:e,isLoading:n,patch:s,mutate:o}=Lr();if(n)return r.jsx(nt,{});const l=async c=>{const d={};for(const[p,m]of Object.entries(jb(c)))qa(m)||(d[p]=m);await s(d),o()};return r.jsx(Ge,{title:f("global_config.title"),description:f("settings_ui.global_config_desc"),children:r.jsx($h,{sections:R8,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:f("settings_ui.global_json_desc"),onSaveFields:async(c,d)=>{await s(c,d),o()},onSaveJson:l})})}function A8(){const e=at(),{health:n,isUp:s}=f2(),o=async()=>{try{await kl.reload(),e.success(f("settings.advanced.reload_success"))}catch(l){e.error(l.message)}};return r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{title:f("daemon.version"),action:r.jsx(ge,{size:"sm",onClick:o,children:f("common.reload")}),children:r.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[r.jsx(oh,{label:f("daemon.version"),value:n?.version||"—"}),r.jsx(oh,{label:f("daemon.uptime"),value:n?`${n.uptime_s}s`:"—"}),r.jsx(oh,{label:f("daemon.status"),value:f(s?"daemon.running":"daemon.down"),ok:s})]})}),r.jsx(T8,{})]})}function oh({label:e,value:n,ok:s}){return r.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[r.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),r.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&r.jsx(Rf,{ok:s}),r.jsx("span",{children:n})]})]})}function M8(){const e=at(),{theme:n,set:s}=_x(),[o,l]=x.useState(""),[c,d]=x.useState(RO()),p=()=>{const g=o.trim();if(g){ro(g);try{localStorage.setItem(Rn.token,g)}catch{}l(""),e.success(f("settings.token_saved"))}},m=g=>{EO(g),d(g),window.location.reload()};return r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2 xl:items-start",children:[r.jsx(Ge,{title:f("settings.appearance"),children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ge,{variant:n==="light"?"primary":"secondary",onClick:()=>s("light"),children:f("settings.light_mode")}),r.jsx(ge,{variant:n==="dark"?"primary":"secondary",onClick:()=>s("dark"),children:f("settings.dark_mode")})]})}),r.jsx(Ge,{title:f("settings.language"),children:r.jsx("div",{className:"flex items-center gap-2",children:NO.map(g=>r.jsx(ge,{variant:c===g.value?"primary":"secondary",onClick:()=>m(g.value),children:g.label},g.value))})}),r.jsxs(Ge,{title:f("settings.token"),description:f("settings.token_sub"),children:[r.jsx(de,{label:f("settings_ui.bearer_label"),children:r.jsx(Ce,{type:"password",placeholder:tb()?f("settings.token_active"):f("settings.token_paste"),value:o,onChange:g=>l(g.target.value),className:"font-mono",onKeyDown:g=>{g.key==="Enter"&&p()}})}),r.jsx("div",{className:"mt-2",children:r.jsx(ge,{variant:"primary",onClick:p,children:f("common.save")})})]})]})}const O8=[{title:f("settings.account_section"),items:[{key:"identity",label:f("settings.tabs.identity"),icon:xx},{key:"appearance",label:f("settings.appearance"),icon:fA}]},{title:f("settings.agents_section"),items:[{key:"super_agent",label:f("settings.tabs.super_agent"),icon:gn},{key:"engines",label:f("settings.tabs.engines"),icon:dx},{key:"memory",label:"Memory (RAG)",icon:Yw},{key:"skills",label:"Skills (RAG)",icon:ls}]},{title:f("settings.channels_section"),items:[{key:"telegram",label:f("settings.tabs.telegram"),icon:Ya},{key:"devices",label:f("settings.tabs.devices"),icon:xA}]},{title:f("settings.advanced_section"),items:[{key:"advanced",label:f("settings.tabs.advanced"),icon:zd}]}],z8=new Set(["engines","telegram","memory","skills","appearance"]),D8={identity:()=>r.jsx(qP,{}),super_agent:()=>r.jsx($P,{}),engines:()=>r.jsx(H2,{}),memory:()=>r.jsx(YP,{}),skills:()=>r.jsx(KP,{}),telegram:()=>r.jsx(e8,{}),devices:()=>r.jsx(N8,{}),appearance:()=>r.jsx(M8,{}),advanced:()=>r.jsx(A8,{})};function L8(){const e=la(),n=Yn(),s=P8(n.pathname),o=D8[s],{collapsed:l,toggle:c}=h2(Rn.sidebarCollapsed+".settings");return r.jsx(w2,{sections:O8,active:s,onChange:d=>e(d==="identity"?"/settings":`/settings/${I8(d)}`),collapsed:l,onToggleCollapse:c,contentClassName:`w-full ${z8.has(s)?"":"mx-auto max-w-3xl"} space-y-6 p-6 pt-3`,testId:`settings-tab-${s}`,children:r.jsx(o,{})})}function P8(e){switch(e.split("/").filter(Boolean)[1]||"identity"){case"super-agent":return"super_agent";case"engines":return"engines";case"memory":return"memory";case"skills":return"skills";case"telegram":return"telegram";case"devices":return"devices";case"appearance":return"appearance";case"config":case"advanced":return"advanced";default:return"identity"}}function I8(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function B8({engines:e,order:n,mode:s,configuredProvider:o,onSetMode:l,onSetDefault:c,onToggleEnabled:d,onReorder:p,onConfigure:m,busy:g}){const h=new Map(e.map(S=>[S.id,S])),_=[...n.filter(S=>h.has(S)),...e.map(S=>S.id).filter(S=>!n.includes(S))],v=s==="chain",k=(S,j)=>{const w=_.indexOf(S),C=w+j;if(w<0||C<0||C>=_.length)return;const E=[..._];[E[w],E[C]]=[E[C],E[w]],p(E)};return r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"rounded-lg border border-border p-3",children:r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"text-sm font-medium",children:f("voice_ui.selection_mode")}),r.jsx("div",{className:"text-xs text-muted-fg",children:f(v?"voice_ui.mode_chain_desc":"voice_ui.mode_single_desc")})]}),r.jsxs("div",{className:"flex shrink-0 overflow-hidden rounded-md border border-border",role:"group",children:[r.jsx("button",{type:"button",onClick:()=>l("chain"),disabled:g,"data-testid":"voice-mode-chain",className:Oe("px-3 py-1.5 text-xs font-medium transition-colors",v?"bg-emerald-500/15 text-emerald-300":"text-muted-fg hover:text-fg"),children:f("voice_ui.mode_chain_btn")}),r.jsx("button",{type:"button",onClick:()=>l("single"),disabled:g,"data-testid":"voice-mode-single",className:Oe("border-l border-border px-3 py-1.5 text-xs font-medium transition-colors",v?"text-muted-fg hover:text-fg":"bg-emerald-500/15 text-emerald-300"),children:f("voice_ui.mode_single_btn")})]})]})}),r.jsx("div",{className:"space-y-2",children:_.map((S,j)=>{const w=h.get(S),C=Qd[S]||{name:S,note:""},E=!v&&o===S,N=S==="mock";return r.jsxs("div",{"data-testid":`voice-provider-${S}`,className:Oe("flex items-center gap-3 rounded-lg border px-3 py-2.5",E?"border-emerald-500/50 bg-emerald-500/10":"border-border",v&&!N&&!w.enabled&&"opacity-60"),children:[v&&r.jsxs("div",{className:"flex flex-col",children:[r.jsx("button",{type:"button",onClick:()=>k(S,-1),disabled:g||j===0,"aria-label":f("voice_ui.move_up"),"data-testid":`voice-provider-${S}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(Fw,{className:"size-3.5"})}),r.jsx("button",{type:"button",onClick:()=>k(S,1),disabled:g||j===_.length-1,"aria-label":f("voice_ui.move_down"),"data-testid":`voice-provider-${S}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:r.jsx(Ar,{className:"size-3.5"})})]}),r.jsx(Rf,{ok:w.available?!0:w.configured?!1:null}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm font-medium",children:C.name}),C.local&&r.jsx(Ve,{tone:"info",children:f("voice_ui.badge_local")}),w.available?r.jsx(Ve,{tone:"success",children:f("voice_ui.badge_available")}):w.configured?r.jsx(Ve,{tone:"warning",children:f("voice_ui.badge_unavailable")}):r.jsx(Ve,{tone:"muted",children:f("voice_ui.badge_not_configured")}),E&&r.jsx(Ve,{tone:"success",children:f("voice_ui.badge_default")})]}),r.jsx("div",{className:"truncate text-xs text-muted-fg",children:C.note})]}),r.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[v?r.jsx(Zt,{checked:N?!0:w.enabled,onChange:R=>d(S,R),disabled:g||N}):!E&&r.jsxs(ge,{size:"sm",variant:"ghost",onClick:()=>c(S),disabled:g,"data-testid":`voice-provider-${S}-default`,children:[r.jsx(IT,{className:"size-3.5"})," ",f("voice_ui.set_as_default")]}),E&&r.jsx(ux,{className:"size-4 text-emerald-400"}),r.jsxs(ge,{size:"sm",variant:"secondary",onClick:()=>m(S),"data-testid":`voice-provider-${S}-config`,children:[r.jsx(hA,{className:"size-3.5"})," ",f("voice_ui.configure")]})]})]},S)})})]})}function Ma(e){return typeof e=="string"?e:e==null?"":String(e)}function U8({open:e,providerId:n,config:s,onClose:o,onSave:l}){const[c,d]=x.useState(!1),[p,m]=x.useState(null),[g,h]=x.useState(""),[_,v]=x.useState({});if(x.useEffect(()=>{if(!e||!n)return;m(null),h("");const R=s||{};if(n==="piper"){const T=R;v({bin:Ma(T.bin),model:Ma(T.model),speaker:Ma(T.speaker)})}else if(n==="elevenlabs"){const T=R;v({model:Ma(T.model),voice_id:Ma(T.voice_id),output_format:Ma(T.output_format)})}else if(n==="openai"){const T=R;v({model:Ma(T.model)||"tts-1",voice:Ma(T.voice)||"alloy",format:Ma(T.format)||"mp3"})}else if(n==="gemini"){const T=R;v({model:Ma(T.model),voice:Ma(T.voice)||"Kore",style:Ma(T.style)})}else v({})},[e,n,s]),!n)return null;const k=Qd[n],S=`voice.tts.${n}`,j=R=>v(T=>({...T,...R})),w=n!=="piper"&&n!=="mock",C=w&&qa(s?.api_key),E=C?f("voice_ui.api_key_set",{suffix:Cl(s?.api_key)??""}):f("voice_ui.api_key_label"),N=async()=>{d(!0),m(null);try{const R={},T=[],O=(A,z)=>{z.trim()?R[`${S}.${A}`]=z.trim():T.push(`${S}.${A}`)};n==="piper"?(O("bin",_.bin),O("model",_.model),_.speaker.trim()?R[`${S}.speaker`]=_.speaker.trim():T.push(`${S}.speaker`)):n==="elevenlabs"?(O("model",_.model),O("voice_id",_.voice_id),O("output_format",_.output_format)):n==="openai"?(O("model",_.model),O("voice",_.voice),O("format",_.format)):n==="gemini"&&(O("model",_.model),O("voice",_.voice),O("style",_.style)),w&&g.trim()&&(R[`${S}.api_key`]=g.trim()),await l({set:R,unset:T}),o()}catch(R){m(R.message||f("voice_ui.err_save"))}finally{d(!1)}};return r.jsx(Vn,{open:e,onClose:o,title:f("voice_screen.configure_provider",{name:k?.name||n||""}),description:k?.note,size:"md",footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:o,disabled:c,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:N,loading:c,"data-testid":"voice-provider-save",children:f("common.save")})]}),children:r.jsxs("div",{className:"space-y-3",children:[n==="piper"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:f("voice_ui.piper_bin_label"),hint:f("voice_ui.piper_bin_hint"),children:r.jsx(Ce,{value:_.bin,onChange:R=>j({bin:R.target.value}),placeholder:"piper"})}),r.jsx(de,{label:f("voice_ui.piper_model_label"),hint:f("voice_ui.piper_model_hint"),children:r.jsx(Ce,{value:_.model,onChange:R=>j({model:R.target.value}),placeholder:"/abs/path/voice.onnx"})}),r.jsx(de,{label:f("voice_ui.piper_speaker_label"),hint:f("voice_ui.piper_speaker_hint"),children:r.jsx(Ce,{value:_.speaker,onChange:R=>j({speaker:R.target.value}),placeholder:"0"})})]}),n==="elevenlabs"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:f("voice_ui.api_key_label"),hint:C?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_secret_hint",{env:"ELEVENLABS_API_KEY"}),children:r.jsx(Ce,{type:"password",autoComplete:"new-password",value:g,onChange:R=>h(R.target.value),placeholder:E})}),r.jsx(de,{label:f("voice_ui.model_label"),children:r.jsx(wt,{value:_.model||"",onChange:R=>j({model:R}),options:vO.map(R=>({value:R,label:R})),placeholder:"eleven_multilingual_v2"})}),r.jsx(de,{label:f("voice_ui.voice_id_label"),hint:f("voice_ui.voice_id_hint"),children:r.jsx(Ce,{value:_.voice_id,onChange:R=>j({voice_id:R.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),r.jsx(de,{label:f("voice_ui.output_format_label"),children:r.jsx(Ce,{value:_.output_format,onChange:R=>j({output_format:R.target.value}),placeholder:"mp3_44100_128"})})]}),n==="openai"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:f("voice_ui.api_key_label"),hint:C?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.openai.api_key",env:"OPENAI_API_KEY"}),children:r.jsx(Ce,{type:"password",autoComplete:"new-password",value:g,onChange:R=>h(R.target.value),placeholder:E})}),r.jsx(de,{label:f("voice_ui.model_label"),children:r.jsx(wt,{value:_.model||"tts-1",onChange:R=>j({model:R}),options:yO.map(R=>({value:R,label:R}))})}),r.jsx(de,{label:f("voice_ui.voice_label"),children:r.jsx(wt,{value:_.voice||"alloy",onChange:R=>j({voice:R}),options:bO.map(R=>({value:R,label:R}))})}),r.jsx(de,{label:f("voice_ui.format_label"),children:r.jsx(wt,{value:_.format||"mp3",onChange:R=>j({format:R}),options:["mp3","opus","aac","flac","wav"].map(R=>({value:R,label:R}))})})]}),n==="gemini"&&r.jsxs(r.Fragment,{children:[r.jsx(de,{label:f("voice_ui.api_key_label"),hint:C?f("voice_ui.api_key_keep_hint"):f("voice_ui.api_key_reuse_hint",{engine:"engines.gemini.api_key",env:"GEMINI_API_KEY"}),children:r.jsx(Ce,{type:"password",autoComplete:"new-password",value:g,onChange:R=>h(R.target.value),placeholder:E})}),r.jsx(de,{label:f("voice_ui.model_label"),hint:f("voice_ui.gemini_model_hint"),children:r.jsx(Ce,{value:_.model,onChange:R=>j({model:R.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),r.jsx(de,{label:f("voice_ui.voice_label"),children:r.jsx(wt,{value:_.voice||"Kore",onChange:R=>j({voice:R}),options:_O.map(R=>({value:R,label:R}))})}),r.jsx(de,{label:f("voice_ui.style_label"),hint:f("voice_ui.style_hint"),children:r.jsx(cn,{rows:2,value:_.style||"",onChange:R=>j({style:R.target.value}),placeholder:f("voice_ui.style_ph")})})]}),n==="mock"&&r.jsx("p",{className:"text-sm text-muted-fg",children:f("voice_ui.mock_desc")}),p&&r.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p})]})})}function H8(){const e=x.useRef(null),n=x.useRef(null),[s,o]=x.useState(!1),[l,c]=x.useState(!1),d=x.useCallback(()=>{n.current&&(URL.revokeObjectURL(n.current),n.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 wO(g);n.current=h,e.current||(e.current=new Audio);const _=e.current;_.src=h,_.onended=()=>o(!1),_.onerror=()=>o(!1),await _.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:s,loading:l}}function V8({engines:e,defaultProvider:n,mode:s}){const o=at(),{play:l,stop:c,playing:d,loading:p}=H8(),[m,g]=x.useState(f("voice_ui.test_default_text")),[h,_]=x.useState(""),[v,k]=x.useState(""),[S,j]=x.useState(!1),[w,C]=x.useState(null),N=[{value:"",label:s==="single"&&n&&n!=="auto"?f("voice_ui.test_default_engine",{name:Qd[n]?.name||n}):f("voice_ui.test_default_chain")},...e.map(T=>({value:T.id,label:`${Qd[T.id]?.name||T.id}${T.available?"":f("voice_ui.test_unavailable_suffix")}`}))],R=async()=>{const T=m.trim();if(!T){o.error(f("voice_ui.test_empty_error"));return}j(!0);try{const O=await $S.say({text:T,provider:h||void 0,style:v.trim()||void 0});C(O),await l(O.audio_path)}catch(O){o.error(O.message||f("voice_ui.test_synth_error"))}finally{j(!1)}};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:f("voice_ui.test_engine_label"),hint:f("voice_ui.test_engine_hint"),children:r.jsx(wt,{value:h,onChange:_,options:N})}),r.jsx(de,{label:f("voice_ui.test_style_label"),hint:f("voice_ui.test_style_hint"),children:r.jsx(Ce,{value:v,onChange:T=>k(T.target.value),placeholder:f("voice_ui.style_ph"),"data-testid":"voice-test-style"})})]}),r.jsx(de,{label:f("voice_ui.test_text_label"),children:r.jsx(cn,{rows:2,value:m,onChange:T=>g(T.target.value),placeholder:f("voice_ui.test_text_ph"),"data-testid":"voice-test-input"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ge,{variant:"primary",onClick:R,loading:S,disabled:p,"data-testid":"voice-test-say",children:[r.jsx(jA,{className:"size-4"})," ",f("voice_ui.say_this")]}),d?r.jsxs(ge,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[r.jsx(nk,{className:"size-4"})," ",f("voice_ui.stop")]}):w?r.jsxs(ge,{variant:"secondary",onClick:()=>l(w.audio_path),loading:p,"data-testid":"voice-test-replay",children:[r.jsx(gx,{className:"size-4"})," ",f("voice_ui.replay")]}):null,w&&r.jsxs("span",{className:"text-xs text-muted-fg",children:[f("voice_ui.engine_result"),": ",r.jsx("strong",{children:w.provider}),w.duration_s?` · ${w.duration_s.toFixed(1)}s`:""]})]})]})}const q8=()=>[{value:"auto",label:f("voice_ui.stt_provider_auto")},{value:"local",label:f("voice_ui.stt_provider_local")},{value:"openai",label:f("voice_ui.stt_provider_openai")}],$8=()=>[{value:"auto",label:f("voice_ui.lang_auto")},{value:"es",label:f("voice_ui.lang_es")},{value:"en",label:f("voice_ui.lang_en")},{value:"pt",label:f("voice_ui.lang_pt")},{value:"fr",label:f("voice_ui.lang_fr")},{value:"it",label:f("voice_ui.lang_it")},{value:"de",label:f("voice_ui.lang_de")}];function G8({config:e,onPatch:n,busy:s}){const o=e.provider||"auto",l=e.local||{},c=l.model||"small",d=l.language||"auto",p=o!=="openai";return r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:f("voice_ui.stt_engine_label"),hint:f("voice_ui.stt_engine_hint"),children:r.jsx(wt,{value:o,onChange:m=>n({"transcription.provider":m}),options:q8(),disabled:s,className:"max-w-md"})}),p&&r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:f("voice_ui.stt_model_label"),hint:f("voice_ui.stt_model_hint"),children:r.jsx(wt,{value:c,onChange:m=>n({"transcription.local.model":m}),options:jO.map(m=>({value:m,label:m})),disabled:s})}),r.jsx(de,{label:f("voice_ui.stt_language_label"),hint:f("voice_ui.stt_language_hint"),children:r.jsx(wt,{value:d,onChange:m=>n({"transcription.local.language":m}),options:$8(),disabled:s})})]})]})}function F8(){const e=at(),{config:n,isLoading:s,patch:o,mutate:l}=Lr(),{data:c,isLoading:d,error:p,mutate:m}=Qe("/tts/providers",()=>$S.providers()),[g,h]=x.useState(null),[_,v]=x.useState(!1),k=n,S=k.voice?.tts||{},j=k.transcription||{},w=c?.configured_provider||S.provider||"auto",C=c?.mode||S.mode||"chain",E=c?.engines||[],N=c?.order||[],R=x.useMemo(()=>g?S[g]||{}:{},[g,S]),T=async D=>{v(!0);try{await o({"voice.tts.provider":D,"voice.tts.mode":"single"}),await m(),e.success(f("voice_ui.toast_default_engine",{id:D}))}catch(P){e.error(P.message)}finally{v(!1)}},O=async D=>{v(!0);try{const P={"voice.tts.mode":D};if(D==="single"&&(w==="auto"||!w)){const H=E.find(q=>q.available)?.id||N[0]||"mock";P["voice.tts.provider"]=H}await o(P),await m(),e.success(f(D==="chain"?"voice_ui.toast_mode_chain":"voice_ui.toast_mode_single"))}catch(P){e.error(P.message)}finally{v(!1)}},A=async(D,P)=>{v(!0);try{await o({[`voice.tts.${D}.enabled`]:P}),await m()}catch(H){e.error(H.message)}finally{v(!1)}},z=async D=>{v(!0);try{await o({"voice.tts.order":D}),await m()}catch(P){e.error(P.message)}finally{v(!1)}},B=async({set:D,unset:P})=>{await o(D,P.length?P:void 0),await m(),await l(),e.success(f("voice_ui.toast_config_saved"))},L=async(D,P)=>{try{await o(D,P),e.success(f("voice_ui.toast_transcription_updated"))}catch(H){e.error(H.message)}};return r.jsxs("div",{className:"p-6","data-testid":"screen-voice",children:[r.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[r.jsx(Ge,{title:f("voice_screen.providers_title"),description:f("voice_ui.providers_desc"),children:d||s?r.jsx(nt,{}):p?r.jsx(pt,{children:f("voice_ui.providers_load_error",{msg:p.message})}):r.jsx(B8,{engines:E,order:N,mode:C,configuredProvider:w,onSetMode:O,onSetDefault:T,onToggleEnabled:A,onReorder:z,onConfigure:D=>h(D),busy:_})}),r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ge,{title:f("voice_screen.test_title"),description:f("voice_ui.test_desc"),children:r.jsx(V8,{engines:E,defaultProvider:w,mode:C})}),r.jsx(Ge,{title:f("voice_screen.stt_title"),description:f("voice_ui.stt_desc"),children:s?r.jsx(nt,{}):r.jsx(G8,{config:j,onPatch:L})})]})]}),r.jsx(U8,{open:!!g,providerId:g,config:R,onClose:()=>h(null),onSave:B})]})}const lh={status:()=>me.get("/desktop/status"),autostartGet:()=>me.get("/desktop/autostart"),autostartSet:e=>me.post("/desktop/autostart",{enable:e})};function Y8(e=30){return me.get(`/messages/global?channel=desktop&limit=${e}`)}const Wj="CommandOrControl+G",X8=()=>[{value:"left",label:f("modules_ui.desktop_pos_left")},{value:"center",label:f("modules_ui.desktop_pos_center")},{value:"right",label:f("modules_ui.desktop_pos_right")}],K8=()=>[{value:"light",label:f("modules_ui.desktop_theme_light")},{value:"dark",label:f("modules_ui.desktop_theme_dark")}];function Q8(){const e=at(),{config:n,isLoading:s,patch:o}=Lr(),l=n,c=l.desktop?.shortcut||l.overlay?.shortcut||Wj,d=l.desktop?.enabled!==!1,p=l.desktop?.theme||"light",m=l.desktop?.position||"right",{data:g,isLoading:h,mutate:_}=Qe("/desktop/status",()=>lh.status(),{refreshInterval:5e3}),v=!!g?.running,{data:k,mutate:S}=Qe("/desktop/autostart",()=>lh.autostartGet()),{data:j,isLoading:w,mutate:C}=Qe("/messages/global?channel=desktop",()=>Y8(40),{refreshInterval:8e3}),[E,N]=x.useState(c),[R,T]=x.useState(!1),[O,A]=x.useState(!1);x.useEffect(()=>N(c),[c]);const z=async()=>{const D=E.trim();if(!(!D||D===c)){T(!0);try{await o({"desktop.shortcut":D}),e.success(f("modules_ui.desktop_shortcut_saved"))}catch(P){e.error(P.message)}finally{T(!1)}}},B=async(D,P,H)=>{T(!0);try{await o({[D]:P}),e.success(H)}catch(q){e.error(q.message)}finally{T(!1)}},L=async D=>{A(!0);try{await lh.autostartSet(D),await S(),e.success(f(D?"modules_ui.desktop_autostart_on":"modules_ui.desktop_autostart_off"))}catch(P){e.error(P.message)}finally{A(!1)}};return r.jsx("div",{className:"mx-auto max-w-6xl space-y-6 p-6","data-testid":"screen-desktop",children:r.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1fr_1fr]",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ge,{title:f("desktop_screen.status_title"),description:f("modules_ui.desktop_status_desc"),children:[h?r.jsx(nt,{}):r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Rf,{ok:v}),r.jsx("span",{className:"font-medium",children:f(v?"modules_ui.desktop_running":"modules_ui.desktop_stopped")}),r.jsx("button",{type:"button",onClick:()=>_(),className:"ml-2 text-xs text-muted-fg underline-offset-2 hover:underline",children:f("modules_ui.desktop_refresh")})]}),r.jsxs("p",{className:"mt-3 text-xs text-muted-fg",children:[f("modules_ui.desktop_from_terminal")," ",r.jsx(U1,{children:"apx desktop start"})," · ",r.jsx(U1,{children:"apx desktop --debug"})]})]}),r.jsx(Ge,{title:f("desktop_screen.autostart_title"),description:f("modules_ui.desktop_autostart_desc"),children:k?r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsx(Zt,{checked:k.enabled,onChange:L,disabled:O,label:k.enabled?f("common.enabled"):f("common.disabled")}),r.jsx("span",{className:"text-xs text-muted-fg",children:f("modules_ui.desktop_platform",{platform:k.platform})})]}):r.jsx(nt,{})}),r.jsx(Ge,{title:f("desktop_screen.shortcut_title"),description:f("modules_ui.desktop_shortcut_desc"),children:s?r.jsx(nt,{}):r.jsxs("div",{className:"flex items-end gap-3",children:[r.jsx("div",{className:"flex-1",children:r.jsx(de,{label:f("modules_ui.desktop_accelerator"),hint:f("modules_ui.desktop_accelerator_hint"),children:r.jsx(Ce,{value:E,onChange:D=>N(D.target.value),onKeyDown:D=>{D.key==="Enter"&&z()},placeholder:Wj,className:"max-w-md font-mono",disabled:R})})}),r.jsx(ge,{variant:"primary",onClick:z,loading:R,disabled:!E.trim()||E.trim()===c,children:f("common.save")})]})}),r.jsx(Ge,{title:f("desktop_screen.appearance_title"),description:f("modules_ui.desktop_appearance_desc"),children:s?r.jsx(nt,{}):r.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[r.jsx(de,{label:f("modules_ui.desktop_theme"),hint:f("modules_ui.desktop_restart_apply"),children:r.jsx(wt,{value:p,onChange:D=>B("desktop.theme",D,f("modules_ui.desktop_theme_set",{value:D})),options:K8(),disabled:R})}),r.jsx(de,{label:f("modules_ui.desktop_position"),hint:f("modules_ui.desktop_position_hint"),children:r.jsx(wt,{value:m,onChange:D=>B("desktop.position",D,f("modules_ui.desktop_position_set",{value:D})),options:X8(),disabled:R})})]})}),r.jsx(Ge,{title:f("desktop_screen.activation_title"),description:f("modules_ui.desktop_activation_desc"),children:s?r.jsx(nt,{}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(Zt,{checked:d,onChange:D=>B("desktop.enabled",D,f(D?"modules_ui.desktop_enabled_toast":"modules_ui.desktop_disabled_toast")),disabled:R,label:f(d?"modules_ui.desktop_plugin_on":"modules_ui.desktop_plugin_off")}),r.jsxs("p",{className:"text-xs text-muted-fg",children:[f("modules_ui.desktop_stt_engine")," ",r.jsx(cx,{to:"/m/voice",className:"font-medium text-fg underline underline-offset-2",children:f("nav.modules.voice")})," ",f("modules_ui.desktop_stt_engine_suffix")]})]})})]}),r.jsx("div",{children:r.jsx(Ge,{title:f("desktop_screen.last_conv_title"),description:f("modules_ui.desktop_last_conv_desc"),action:r.jsx("button",{type:"button",onClick:()=>C(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:f("modules_ui.desktop_refresh")}),children:r.jsx(Z8,{messages:j||[],loading:w})})})]})})}function Z8({messages:e,loading:n}){const s=x.useMemo(()=>J8(e),[e]);return n?r.jsx(nt,{}):e.length?r.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:s.slice().reverse().map((o,l)=>r.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:o.map((c,d)=>r.jsx(W8,{m:c},d))},l))}):r.jsx(pt,{children:f("modules_ui.desktop_no_messages")})}function W8({m:e}){const n=e.direction==="in",s=e7(e.ts);return r.jsxs("div",{className:"py-1",children:[r.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[r.jsx("span",{className:"font-semibold",children:f(n?"modules_ui.desktop_you":"modules_ui.desktop_roby")}),r.jsx("span",{children:s})]}),r.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(n?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||r.jsx("span",{className:"italic opacity-50",children:f("modules_ui.desktop_empty_msg")})})]})}function J8(e){const n=[];for(const s of e)s.direction==="in"||!n.length?n.push([s]):n[n.length-1].push(s);return n}function e7(e){try{const n=new Date(e);return n.toDateString()===new Date().toDateString()?n.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}):n.toLocaleString([],{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}catch{return""}}function t7(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 n7({manifest:e}){const n=e.daemon,s=e.safety;return r.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[r.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[r.jsxs("span",{className:"font-semibold text-foreground",children:[n.name," ",r.jsxs("span",{className:"font-normal text-muted-fg",children:["v",n.version]})]}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_daemon_active",{uptime:t7(n.uptime_s)})})]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs("span",{className:"text-muted-fg",children:[n.host,":",n.port]}),r.jsx("span",{className:"text-muted-fg",children:"·"}),r.jsxs("span",{className:"text-muted-fg",children:[f("modules_ui.deck_daemon_started")," ",new Date(n.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),r.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[s.direct_shell===!1&&r.jsx(Ve,{tone:"success",children:f("modules_ui.deck_safety_no_shell")}),s.arbitrary_commands===!1&&r.jsx(Ve,{tone:"success",children:f("modules_ui.deck_safety_no_arbitrary")}),s.dangerous_actions_require_confirmation&&r.jsx(Ve,{tone:"info",children:f("modules_ui.deck_safety_confirm")})]})]})}function a7(e){return e==="available"?"success":e==="configured"?"info":"muted"}function s7(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function r7(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function o7({widget:e,onToggle:n}){const s=e.source==="external",[o,l]=x.useState(!1),c=e.user_enabled===!0,d=async p=>{if(!(!n||o)){l(!0);try{await n(p)}finally{l(!1)}}};return r.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:Oe("flex items-center gap-3 rounded-lg border px-3 py-2.5 text-sm transition-colors",s?"border-border bg-muted/20 hover:border-muted-fg/30":"border-border/50 bg-muted/10"),children:[r.jsx("span",{title:e.source==="apx"?f("deck_screen.widget_native"):f("deck_screen.widget_external"),className:Oe("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")}),r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"font-medium",children:e.title}),r.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),r.jsx(Ve,{tone:r7(e.kind),children:e.kind}),r.jsx(Ve,{tone:a7(e.status),children:s7(e.status)}),s?r.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:r.jsx(Zt,{checked:c,onChange:d,disabled:o||!n})}):r.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function l7({desktop:e,widgets:n,onToggle:s}){return n.length===0?null:r.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[r.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),r.jsx("ul",{className:"space-y-1.5",children:n.map(o=>r.jsx(o7,{widget:o,onToggle:o.source==="external"?l=>s(o.id,l):void 0},o.id))})]})}function i7(){const e=at(),{data:n,error:s,isLoading:o,mutate:l}=Qe("/deck/manifest",()=>B1.manifest(),{refreshInterval:3e4}),c=async(_,v)=>{try{await B1.setWidget(_,{enabled:v}),await l(k=>k&&{...k,deck:{...k.deck,widgets:k.deck.widgets.map(S=>S.id===_?{...S,user_enabled:v,status:v?S.daemon_status?"available":"configured":"disabled"}:S)}},{revalidate:!1}),e.success(v?f("modules_ui.deck_widget_enabled",{id:_}):f("modules_ui.deck_widget_disabled",{id:_})),setTimeout(()=>l(),800)}catch(k){const S=k instanceof Error?k.message:f("modules_ui.deck_save_error");e.error(S)}},d=n?.deck.desktops??[],p=n?.deck.widgets??[],m=d.map(_=>({desktop:_,widgets:p.filter(v=>v.desktop===_.id)})),h=p.filter(_=>_.source==="external").filter(_=>_.user_enabled===!0).length;return r.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6","data-testid":"screen-deck",children:[n&&r.jsx(n7,{manifest:n}),r.jsxs(Ge,{title:f("deck_screen.widgets_title"),description:o?f("modules_ui.deck_loading_manifest"):s?f("modules_ui.deck_manifest_error"):f("modules_ui.deck_widgets_summary",{count:p.length,enabled:h}),action:r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>l(),disabled:o,title:f("deck_screen.reload_manifest"),"aria-label":f("deck_screen.reload_manifest"),children:r.jsx(os,{size:14,className:o?"animate-spin":""})}),children:[o&&r.jsx(nt,{label:f("modules_ui.deck_loading_manifest_full")}),!o&&s&&r.jsxs(pt,{children:[f("modules_ui.deck_manifest_load_failed")," ",r.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>l(),children:f("modules_ui.deck_retry")})]}),!o&&!s&&p.length===0&&r.jsx(pt,{children:f("modules_ui.deck_no_widgets")}),!o&&!s&&p.length>0&&r.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:m.filter(_=>_.widgets.length>0).map(_=>r.jsx(l7,{desktop:_.desktop,widgets:_.widgets,onToggle:c},_.desktop.id))})]}),n?.apx&&r.jsx(Ge,{title:f("deck_screen.context_title"),description:f("modules_ui.deck_context_desc"),children:r.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_active_project")}),r.jsx("span",{className:"font-medium",children:n.apx.active_project?n.apx.active_project.name:f("modules_ui.deck_none")})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_registered_projects")}),r.jsx("span",{className:"font-medium",children:n.apx.projects.length})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-muted-fg",children:f("modules_ui.deck_active_plugins")}),r.jsx("span",{className:"font-medium",children:Object.keys(n.apx.plugins).join(", ")||"—"})]})]})})]})}function c7(e,n){const s=getComputedStyle(e),o=parseFloat(s.fontSize);return n*o}function u7(e,n){const s=getComputedStyle(e.ownerDocument.documentElement),o=parseFloat(s.fontSize);return n*o}function d7(e){return e/100*window.innerHeight}function f7(e){return e/100*window.innerWidth}function p7(e){switch(typeof e){case"number":return[e,"px"];case"string":{const n=parseFloat(e);return e.endsWith("%")?[n,"%"]:e.endsWith("px")?[n,"px"]:e.endsWith("rem")?[n,"rem"]:e.endsWith("em")?[n,"em"]:e.endsWith("vh")?[n,"vh"]:e.endsWith("vw")?[n,"vw"]:[n,"%"]}}}function tc({groupSize:e,panelElement:n,styleProp:s}){let o;const[l,c]=p7(s);switch(c){case"%":{o=l/100*e;break}case"px":{o=l;break}case"rem":{o=u7(n,l);break}case"em":{o=c7(n,l);break}case"vh":{o=d7(l);break}case"vw":{o=f7(l);break}}return o}function Fn(e){return parseFloat(e.toFixed(3))}function Rl({group:e}){const{orientation:n,panels:s}=e;return s.reduce((o,l)=>(o+=n==="horizontal"?l.element.offsetWidth:l.element.offsetHeight,o),0)}function Zh(e){const{panels:n}=e,s=Rl({group:e});return s===0?n.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})):n.map(o=>{const{element:l,panelConstraints:c}=o;let d=0;if(c.collapsedSize!==void 0){const h=tc({groupSize:s,panelElement:l,styleProp:c.collapsedSize});d=Fn(h/s*100)}let p;if(c.defaultSize!==void 0){const h=tc({groupSize:s,panelElement:l,styleProp:c.defaultSize});p=Fn(h/s*100)}let m=0;if(c.minSize!==void 0){const h=tc({groupSize:s,panelElement:l,styleProp:c.minSize});m=Fn(h/s*100)}let g=100;if(c.maxSize!==void 0){const h=tc({groupSize:s,panelElement:l,styleProp:c.maxSize});g=Fn(h/s*100)}return{groupResizeBehavior:c.groupResizeBehavior,collapsedSize:d,collapsible:c.collapsible===!0,defaultSize:p,disabled:c.disabled,minSize:m,maxSize:g,panelId:o.id}})}function Ut(e,n="Assertion error"){if(!e)throw Error(n)}function Wh(e,n){return Array.from(n).sort(e==="horizontal"?m7:g7)}function m7(e,n){const s=e.element.offsetLeft-n.element.offsetLeft;return s!==0?s:e.element.offsetWidth-n.element.offsetWidth}function g7(e,n){const s=e.element.offsetTop-n.element.offsetTop;return s!==0?s:e.element.offsetHeight-n.element.offsetHeight}function pC(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function mC(e,n){return{x:e.x>=n.left&&e.x<=n.right?0:Math.min(Math.abs(e.x-n.left),Math.abs(e.x-n.right)),y:e.y>=n.top&&e.y<=n.bottom?0:Math.min(Math.abs(e.y-n.top),Math.abs(e.y-n.bottom))}}function h7({orientation:e,rects:n,targetRect:s}){const o={x:s.x+s.width/2,y:s.y+s.height/2};let l,c=Number.MAX_VALUE;for(const d of n){const{x:p,y:m}=mC(o,d),g=e==="horizontal"?p:m;g<c&&(c=g,l=d)}return Ut(l,"No rect found"),l}let hd;function x7(){return hd===void 0&&(typeof matchMedia=="function"?hd=!!matchMedia("(pointer:coarse)").matches:hd=!1),hd}function gC(e){const{element:n,orientation:s,panels:o,separators:l}=e,c=Wh(s,Array.from(n.children).filter(pC).map(S=>({element:S}))).map(({element:S})=>S),d=[];let p=!1,m=!1,g=-1,h=-1,_=0,v,k=[];{let S=-1;for(const j of c)j.hasAttribute("data-panel")&&(S++,j.hasAttribute("data-disabled")||(_++,g===-1&&(g=S),h=S))}if(_>1){let S=-1;for(const j of c)if(j.hasAttribute("data-panel")){S++;const w=o.find(C=>C.element===j);if(w){if(v){const C=v.element.getBoundingClientRect(),E=j.getBoundingClientRect();let N;if(m){const R=s==="horizontal"?new DOMRect(C.right,C.top,0,C.height):new DOMRect(C.left,C.bottom,C.width,0),T=s==="horizontal"?new DOMRect(E.left,E.top,0,E.height):new DOMRect(E.left,E.top,E.width,0);switch(k.length){case 0:{N=[R,T];break}case 1:{const O=k[0],A=h7({orientation:s,rects:[C,E],targetRect:O.element.getBoundingClientRect()});N=[O,A===C?T:R];break}default:{N=k;break}}}else k.length?N=k:N=[s==="horizontal"?new DOMRect(C.right,E.top,E.left-C.right,E.height):new DOMRect(E.left,C.bottom,E.width,E.top-C.bottom)];for(const R of N){let T="width"in R?R:R.element.getBoundingClientRect();const O=x7()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(T.width<O){const z=O-T.width;T=new DOMRect(T.x-z/2,T.y,T.width+z,T.height)}if(T.height<O){const z=O-T.height;T=new DOMRect(T.x,T.y-z/2,T.width,T.height+z)}const A=S<=g||S>h;!p&&!A&&d.push({group:e,groupSize:Rl({group:e}),panels:[v,w],separator:"width"in R?void 0:R,rect:T}),p=!1}}m=!1,v=w,k=[]}}else if(j.hasAttribute("data-separator")){j.ariaDisabled!==null&&(p=!0);const w=l.find(C=>C.element===j);w?k.push(w):(v=void 0,k=[])}else m=!0}return d}class hC{#e={};addListener(n,s){const o=this.#e[n];return o===void 0?this.#e[n]=[s]:o.includes(s)||o.push(s),()=>{this.removeListener(n,s)}}emit(n,s){const o=this.#e[n];if(o!==void 0)if(o.length===1)o[0].call(null,s);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,s)}catch(g){c===null&&(l=!0,c=g)}}if(l)throw c}}removeAllListeners(){this.#e={}}removeListener(n,s){const o=this.#e[n];if(o!==void 0){const l=o.indexOf(s);l>=0&&o.splice(l,1)}}}let as=new Map;const xC=new hC;function b7(e){as=new Map(as),as.delete(e)}function Jj(e,n){for(const[s]of as)if(s.id===e)return s}function Cr(e,n){for(const[s,o]of as)if(s.id===e)return o;if(n)throw Error(`Could not find data for Group with id ${e}`)}function jo(){return as}function Ab(e,n){return xC.addListener("groupChange",s=>{s.group.id===e&&n(s)})}function Gs(e,n){const s=as.get(e);as=new Map(as),as.set(e,n),xC.emit("groupChange",{group:e,prev:s,next:n})}function _7(e,n,s){let o,l={x:1/0,y:1/0};for(const c of n){const d=mC(s,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 v7(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function y7(e,n){if(e===n)throw new Error("Cannot compare node with itself");const s={a:nw(e),b:nw(n)};let o;for(;s.a.at(-1)===s.b.at(-1);)o=s.a.pop(),s.b.pop();Ut(o,"Stacking order can only be calculated for elements with a common ancestor");const l={a:tw(ew(s.a)),b:tw(ew(s.b))};if(l.a===l.b){const c=o.childNodes,d={a:s.a.at(-1),b:s.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 j7=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function w7(e){const n=getComputedStyle(bC(e)??e).display;return n==="flex"||n==="inline-flex"}function k7(e){const n=getComputedStyle(e);return!!(n.position==="fixed"||n.zIndex!=="auto"&&(n.position!=="static"||w7(e))||+n.opacity<1||"transform"in n&&n.transform!=="none"||"webkitTransform"in n&&n.webkitTransform!=="none"||"mixBlendMode"in n&&n.mixBlendMode!=="normal"||"filter"in n&&n.filter!=="none"||"webkitFilter"in n&&n.webkitFilter!=="none"||"isolation"in n&&n.isolation==="isolate"||j7.test(n.willChange)||n.webkitOverflowScrolling==="touch")}function ew(e){let n=e.length;for(;n--;){const s=e[n];if(Ut(s,"Missing node"),k7(s))return s}return null}function tw(e){return e&&Number(getComputedStyle(e).zIndex)||0}function nw(e){const n=[];for(;e;)n.push(e),e=bC(e);return n}function bC(e){const{parentNode:n}=e;return v7(n)?n.host:n}function S7(e,n){return e.x<n.x+n.width&&e.x+e.width>n.x&&e.y<n.y+n.height&&e.y+e.height>n.y}function C7({groupElement:e,hitRegion:n,pointerEventTarget:s}){if(!pC(s)||s.contains(e)||e.contains(s))return!0;if(y7(s,e)>0){let o=s;for(;o;){if(o.contains(e))return!0;if(S7(o.getBoundingClientRect(),n))return!1;o=o.parentElement}}return!0}function Mb(e,n){const s=[];return n.forEach((o,l)=>{if(l.disabled)return;const c=gC(l),d=_7(l.orientation,c,{x:e.clientX,y:e.clientY});d&&d.distance.x<=0&&d.distance.y<=0&&C7({groupElement:l.element,hitRegion:d.hitRegion.rect,pointerEventTarget:e.target})&&s.push(d.hitRegion)}),s}function E7(e,n){if(e.length!==n.length)return!1;for(let s=0;s<e.length;s++)if(e[s]!=n[s])return!1;return!0}function In(e,n,s=0){return Math.abs(Fn(e)-Fn(n))<=s}function Ja(e,n){return In(e,n)?0:e>n?1:-1}function fl({overrideDisabledPanels:e,panelConstraints:n,prevSize:s,size:o}){const{collapsedSize:l=0,collapsible:c,disabled:d,maxSize:p=100,minSize:m=0}=n;if(d&&!e)return s;if(Ja(o,m)<0)if(c){const g=(l+m)/2;Ja(o,g)<0?o=l:o=m}else o=m;return o=Math.min(p,o),o=Fn(o),o}function jc({delta:e,initialLayout:n,panelConstraints:s,pivotIndices:o,prevLayout:l,trigger:c}){if(In(e,0))return n;const d=c==="imperative-api",p=Object.values(n),m=Object.values(l),g=[...p],[h,_]=o;Ut(h!=null,"Invalid first pivot index"),Ut(_!=null,"Invalid second pivot index");let v=0;switch(c){case"keyboard":{{const j=e<0?_:h,w=s[j];Ut(w,`Panel constraints not found for index ${j}`);const{collapsedSize:C=0,collapsible:E,minSize:N=0}=w;if(E){const R=p[j];if(Ut(R!=null,`Previous layout not found for panel index ${j}`),In(R,C)){const T=N-R;Ja(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}{const j=e<0?h:_,w=s[j];Ut(w,`No panel constraints found for index ${j}`);const{collapsedSize:C=0,collapsible:E,minSize:N=0}=w;if(E){const R=p[j];if(Ut(R!=null,`Previous layout not found for panel index ${j}`),In(R,N)){const T=R-C;Ja(T,Math.abs(e))>0&&(e=e<0?0-T:T)}}}break}default:{const j=e<0?_:h,w=s[j];Ut(w,`Panel constraints not found for index ${j}`);const C=p[j],{collapsible:E,collapsedSize:N,minSize:R}=w;if(E&&Ja(C,R)<0)if(e>0){const T=R-N,O=T/2,A=C+e;Ja(A,R)<0&&(e=Ja(e,O)<=0?0:T)}else{const T=R-N,O=100-T/2,A=C-e;Ja(A,R)<0&&(e=Ja(100+e,O)>0?0:-T)}break}}{const j=e<0?1:-1;let w=e<0?_:h,C=0;for(;;){const N=p[w];Ut(N!=null,`Previous layout not found for panel index ${w}`);const R=fl({overrideDisabledPanels:d,panelConstraints:s[w],prevSize:N,size:100})-N;if(C+=R,w+=j,w<0||w>=s.length)break}const E=Math.min(Math.abs(e),Math.abs(C));e=e<0?0-E:E}{let j=e<0?h:_;for(;j>=0&&j<s.length;){const w=Math.abs(e)-Math.abs(v),C=p[j];Ut(C!=null,`Previous layout not found for panel index ${j}`);const E=C-w,N=fl({overrideDisabledPanels:d,panelConstraints:s[j],prevSize:C,size:E});if(!In(C,N)&&(v+=C-N,g[j]=N,v.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?j--:j++}}if(E7(m,g))return l;{const j=e<0?_:h,w=p[j];Ut(w!=null,`Previous layout not found for panel index ${j}`);const C=w+v,E=fl({overrideDisabledPanels:d,panelConstraints:s[j],prevSize:w,size:C});if(g[j]=E,!In(E,C)){let N=C-E,R=e<0?_:h;for(;R>=0&&R<s.length;){const T=g[R];Ut(T!=null,`Previous layout not found for panel index ${R}`);const O=T+N,A=fl({overrideDisabledPanels:d,panelConstraints:s[R],prevSize:T,size:O});if(In(T,A)||(N-=A-T,g[R]=A),In(N,0))break;e>0?R--:R++}}}const k=Object.values(g).reduce((j,w)=>w+j,0);if(!In(k,100,.1))return l;const S=Object.keys(l);return g.reduce((j,w,C)=>(j[S[C]]=w,j),{})}function go(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(n[s]===void 0||Ja(e[s],n[s])!==0)return!1;return!0}function ho({layout:e,panelConstraints:n}){const s=Object.values(e),o=[...s],l=o.reduce((p,m)=>p+m,0);if(o.length!==n.length)throw Error(`Invalid ${n.length} panel layout: ${o.map(p=>`${p}%`).join(", ")}`);if(!In(l,100)&&o.length>0)for(let p=0;p<n.length;p++){const m=o[p];Ut(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<n.length;p++){const m=s[p];Ut(m!=null,`No layout data found for index ${p}`);const g=o[p];Ut(g!=null,`No layout data found for index ${p}`);const h=fl({overrideDisabledPanels:!0,panelConstraints:n[p],prevSize:m,size:g});g!=h&&(c+=g-h,o[p]=h)}if(!In(c,0))for(let p=0;p<n.length;p++){const m=o[p];Ut(m!=null,`No layout data found for index ${p}`);const g=m+c,h=fl({overrideDisabledPanels:!0,panelConstraints:n[p],prevSize:m,size:g});if(m!==h&&(c-=h-m,o[p]=h,In(c,0)))break}const d=Object.keys(e);return o.reduce((p,m,g)=>(p[d[g]]=m,p),{})}function _C({groupId:e,panelId:n}){const s=()=>{const m=jo();for(const[g,{defaultLayoutDeferred:h,derivedPanelConstraints:_,layout:v,groupSize:k,separatorToPanels:S}]of m)if(g.id===e)return{defaultLayoutDeferred:h,derivedPanelConstraints:_,group:g,groupSize:k,layout:v,separatorToPanels:S};throw Error(`Group ${e} not found`)},o=()=>{const m=s().derivedPanelConstraints.find(g=>g.panelId===n);if(m!==void 0)return m;throw Error(`Panel constraints not found for Panel ${n}`)},l=()=>{const m=s().group.panels.find(g=>g.id===n);if(m!==void 0)return m;throw Error(`Layout not found for Panel ${n}`)},c=()=>{const m=s().layout[n];if(m!==void 0)return m;throw Error(`Layout not found for Panel ${n}`)},d=({nextSize:m,panels:g,prevLayout:h,derivedPanelConstraints:_})=>{const v=c(),k=g.findIndex(w=>w.id===n),S=k===0,j=k===g.length-1;if(j&&m<v&&(S||g.slice(0,k).every((w,C)=>{const E=_[C];return E?.collapsible&&In(E.collapsedSize,h[E.panelId])}))){const w=g.slice(0,k).reduce((C,E)=>C+h[E.id],0);return{...h,[n]:Fn(100-w)}}return jc({delta:j?v-m:m-v,initialLayout:h,panelConstraints:_,pivotIndices:j?[k-1,k]:[k,k+1],prevLayout:h,trigger:"imperative-api"})},p=m=>{const g=c();if(m===g)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:_,group:v,groupSize:k,layout:S,separatorToPanels:j}=s(),w=d({nextSize:m,panels:v.panels,prevLayout:S,derivedPanelConstraints:_}),C=ho({layout:w,panelConstraints:_});go(S,C)||Gs(v,{defaultLayoutDeferred:h,derivedPanelConstraints:_,groupSize:k,layout:C,separatorToPanels:j})};return{collapse:()=>{const{collapsible:m,collapsedSize:g}=o(),{mutableValues:h}=l(),_=c();m&&_!==g&&(h.expandToSize=_,p(g))},expand:()=>{const{collapsible:m,collapsedSize:g,minSize:h}=o(),{mutableValues:_}=l(),v=c();if(m&&v===g){let k=_.expandToSize??h;k===0&&(k=1),p(k)}},getSize:()=>{const{group:m}=s(),g=c(),{element:h}=l(),_=m.orientation==="horizontal"?h.offsetWidth:h.offsetHeight;return{asPercentage:g,inPixels:_}},isCollapsed:()=>{const{collapsible:m,collapsedSize:g}=o(),h=c();return m&&In(g,h)},resize:m=>{const{group:g}=s(),{element:h}=l(),_=Rl({group:g}),v=tc({groupSize:_,panelElement:h,styleProp:m}),k=Fn(v/_*100);p(k)}}}function aw(e){if(e.defaultPrevented)return;const n=jo();Mb(e,n).forEach(s=>{if(s.separator&&!s.separator.disableDoubleClick){const o=s.panels.find(l=>l.panelConstraints.defaultSize!==void 0);if(o){const l=o.panelConstraints.defaultSize,c=_C({groupId:s.group.id,panelId:o.id});c&&l!==void 0&&(c.resize(l),e.preventDefault())}}})}function Ed(e){const n=jo();for(const[s]of n)if(s.separators.some(o=>o.element===e))return s;throw Error("Could not find parent Group for separator element")}function vC({groupId:e}){const n=()=>{const s=jo();for(const[o,l]of s)if(o.id===e)return{group:o,...l};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:s,layout:o}=n();return s?{}:o},setLayout(s){const{defaultLayoutDeferred:o,derivedPanelConstraints:l,group:c,groupSize:d,layout:p,separatorToPanels:m}=n(),g=ho({layout:s,panelConstraints:l});return o?p:(go(p,g)||Gs(c,{defaultLayoutDeferred:o,derivedPanelConstraints:l,groupSize:d,layout:g,separatorToPanels:m}),g)}}}function ao(e,n){const s=Ed(e),o=Cr(s.id,!0),l=s.separators.find(h=>h.element===e);Ut(l,"Matching separator not found");const c=o.separatorToPanels.get(l);Ut(c,"Matching panels not found");const d=c.map(h=>s.panels.indexOf(h)),p=vC({groupId:s.id}).getLayout(),m=jc({delta:n,initialLayout:p,panelConstraints:o.derivedPanelConstraints,pivotIndices:d,prevLayout:p,trigger:"keyboard"}),g=ho({layout:m,panelConstraints:o.derivedPanelConstraints});go(p,g)||Gs(s,{defaultLayoutDeferred:o.defaultLayoutDeferred,derivedPanelConstraints:o.derivedPanelConstraints,groupSize:o.groupSize,layout:g,separatorToPanels:o.separatorToPanels})}function sw(e){if(e.defaultPrevented)return;const n=e.currentTarget,s=Ed(n);if(!s.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),s.orientation==="vertical"&&ao(n,5);break}case"ArrowLeft":{e.preventDefault(),s.orientation==="horizontal"&&ao(n,-5);break}case"ArrowRight":{e.preventDefault(),s.orientation==="horizontal"&&ao(n,5);break}case"ArrowUp":{e.preventDefault(),s.orientation==="vertical"&&ao(n,-5);break}case"End":{e.preventDefault(),ao(n,100);break}case"Enter":{e.preventDefault();const o=Ed(n),l=Cr(o.id,!0),{derivedPanelConstraints:c,layout:d,separatorToPanels:p}=l,m=o.separators.find(v=>v.element===n);Ut(m,"Matching separator not found");const g=p.get(m);Ut(g,"Matching panels not found");const h=g[0],_=c.find(v=>v.panelId===h.id);if(Ut(_,"Panel metadata not found"),_.collapsible){const v=d[h.id],k=_.collapsedSize===v?o.mutableState.expandedPanelSizes[h.id]??_.minSize:_.collapsedSize;ao(n,k-v)}break}case"F6":{e.preventDefault();const o=Ed(n).separators.map(d=>d.element),l=Array.from(o).findIndex(d=>d===e.currentTarget);Ut(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(),ao(n,-100);break}}}let xl={cursorFlags:0,state:"inactive"};const Ob=new hC;function xo(){return xl}function N7(e){return Ob.addListener("change",e)}function R7(e){const n=xl,s={...xl};s.cursorFlags=e,xl=s,Ob.emit("change",{prev:n,next:s})}function bl(e){const n=xl;xl=e,Ob.emit("change",{prev:n,next:e})}function rw(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const n=jo(),s=Mb(e,n),o=new Map;let l=!1;s.forEach(c=>{c.separator&&(l||(l=!0,c.separator.element.focus({focusVisible:!1,preventScroll:!0})));const d=n.get(c.group);d&&o.set(c.group,d.layout)}),bl({cursorFlags:0,hitRegions:s,initialLayoutMap:o,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),s.length&&e.preventDefault()}const T7=e=>e,ih=()=>{},yC=1,jC=2,wC=4,kC=8,ow=3,lw=12;let xd;function iw(){return xd===void 0&&(xd=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(xd=!0)),xd}function A7({cursorFlags:e,groups:n,state:s}){let o=0,l=0;switch(s){case"active":case"hover":n.forEach(c=>{if(!c.mutableState.disableCursor)switch(c.orientation){case"horizontal":{o++;break}case"vertical":{l++;break}}})}if(!(o===0&&l===0)){switch(s){case"active":{if(e&&iw()){const c=(e&yC)!==0,d=(e&jC)!==0,p=(e&wC)!==0,m=(e&kC)!==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 iw()?o>0&&l>0?"move":o>0?"ew-resize":"ns-resize":o>0&&l>0?"grab":o>0?"col-resize":"row-resize"}}const cw=new WeakMap;function zb(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:n,styleSheet:s}=cw.get(e)??{};s===void 0&&(s=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(s):e.adoptedStyleSheets=[...e.adoptedStyleSheets,s]));const o=xo();switch(o.state){case"active":case"hover":{const l=A7({cursorFlags:o.cursorFlags,groups:o.hitRegions.map(d=>d.group),state:o.state}),c=`*, *:hover {cursor: ${l} !important; }`;if(n===c)return;n=c,l?s.cssRules.length===0?s.insertRule(c):s.replaceSync(c):s.cssRules.length===1&&s.deleteRule(0);break}case"inactive":{n=void 0,s.cssRules.length===1&&s.deleteRule(0);break}}cw.set(e,{prevStyle:n,styleSheet:s})}function SC({document:e,event:n,hitRegions:s,initialLayoutMap:o,mountedGroups:l,pointerDownAtPoint:c,prevCursorFlags:d}){let p=0;s.forEach(g=>{const{group:h,groupSize:_}=g,{orientation:v,panels:k}=h,{disableCursor:S}=h.mutableState;let j=0;c?v==="horizontal"?j=(n.clientX-c.x)/_*100:j=(n.clientY-c.y)/_*100:v==="horizontal"?j=n.clientX<0?-100:100:j=n.clientY<0?-100:100;const w=o.get(h),C=l.get(h);if(!w||!C)return;const{defaultLayoutDeferred:E,derivedPanelConstraints:N,groupSize:R,layout:T,separatorToPanels:O}=C;if(N&&T&&O){const A=jc({delta:j,initialLayout:w,panelConstraints:N,pivotIndices:g.panels.map(z=>k.indexOf(z)),prevLayout:T,trigger:"mouse-or-touch"});if(go(A,T)){if(j!==0&&!S)switch(v){case"horizontal":{p|=j<0?yC:jC;break}case"vertical":{p|=j<0?wC:kC;break}}}else Gs(g.group,{defaultLayoutDeferred:E,derivedPanelConstraints:N,groupSize:R,layout:A,separatorToPanels:O})}});let m=0;n.movementX===0?m|=d&ow:m|=p&ow,n.movementY===0?m|=d&lw:m|=p&lw,R7(m),zb(e)}function uw(e){const n=jo(),s=xo();switch(s.state){case"active":SC({document:e.currentTarget,event:e,hitRegions:s.hitRegions,initialLayoutMap:s.initialLayoutMap,mountedGroups:n,prevCursorFlags:s.cursorFlags})}}function dw(e){if(e.defaultPrevented)return;const n=xo(),s=jo();switch(n.state){case"active":{if(e.buttons===0){bl({cursorFlags:0,state:"inactive"}),n.hitRegions.forEach(o=>{const l=Cr(o.group.id,!0);Gs(o.group,l)});return}for(const o of n.hitRegions)if(o.separator){const{element:l}=o.separator;l.hasPointerCapture?.(e.pointerId)||l.setPointerCapture?.(e.pointerId)}SC({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:s,pointerDownAtPoint:n.pointerDownAtPoint,prevCursorFlags:n.cursorFlags});break}default:{const o=Mb(e,s);o.length===0?n.state!=="inactive"&&bl({cursorFlags:0,state:"inactive"}):bl({cursorFlags:0,hitRegions:o,state:"hover"}),zb(e.currentTarget);break}}}function fw(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(xo().state){case"hover":bl({cursorFlags:0,state:"inactive"})}}function pw(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const n=xo();switch(n.state){case"active":bl({cursorFlags:0,state:"inactive"}),n.hitRegions.length>0&&(zb(e.currentTarget),n.hitRegions.forEach(s=>{const o=Cr(s.group.id,!0);Gs(s.group,o)}),e.preventDefault())}}function mw(e){let n=0,s=0;const o={};for(const c of e)if(c.defaultSize!==void 0){n++;const d=Fn(c.defaultSize);s+=d,o[c.panelId]=d}else o[c.panelId]=void 0;const l=e.length-n;if(l!==0){const c=Fn((100-s)/l);for(const d of e)d.defaultSize===void 0&&(o[d.panelId]=c)}return o}function M7(e,n,s){if(!s[0])return;const o=e.panels.find(m=>m.element===n);if(!o||!o.onResize)return;const l=Rl({group:e}),c=e.orientation==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,d=o.mutableValues.prevSize,p={asPercentage:Fn(c/l*100),inPixels:c};o.mutableValues.prevSize=p,o.onResize(p,o.id,d)}function O7(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(e[s]!==n[s])return!1;return!0}function z7({group:e,nextGroupSize:n,prevGroupSize:s,prevLayout:o}){if(s<=0||n<=0||s===n)return o;let l=0,c=0,d=!1;const p=new Map,m=[];for(const _ of e.panels){const v=o[_.id]??0;switch(_.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{d=!0;const k=v/100*s,S=Fn(k/n*100);p.set(_.id,S),l+=S;break}case"preserve-relative-size":default:{m.push(_.id),c+=v;break}}}if(!d||m.length===0)return o;const g=100-l,h={...o};if(p.forEach((_,v)=>{h[v]=_}),c>0)for(const _ of m){const v=o[_]??0;h[_]=Fn(v/c*g)}else{const _=Fn(g/m.length);for(const v of m)h[v]=_}return h}function D7(e,n){const s=e.map(l=>l.id),o=Object.keys(n);if(s.length!==o.length)return!1;for(const l of s)if(!o.includes(l))return!1;return!0}const il=new Map;function L7(e){let n=!0;Ut(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const s=e.element.ownerDocument.defaultView.ResizeObserver,o=new Set,l=new Set,c=new s(S=>{for(const j of S){const{borderBoxSize:w,target:C}=j;if(C===e.element){if(n){const E=Rl({group:e});if(E===0)return;const N=Cr(e.id);if(!N)return;const R=Zh(e),T=N.defaultLayoutDeferred?mw(R):N.layout,O=z7({group:e,nextGroupSize:E,prevGroupSize:N.groupSize,prevLayout:T}),A=ho({layout:O,panelConstraints:R});if(!N.defaultLayoutDeferred&&go(N.layout,A)&&O7(N.derivedPanelConstraints,R)&&N.groupSize===E)return;Gs(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:R,groupSize:E,layout:A,separatorToPanels:N.separatorToPanels})}}else M7(e,C,w)}});c.observe(e.element),e.panels.forEach(S=>{Ut(!o.has(S.id),`Panel ids must be unique; id "${S.id}" was used more than once`),o.add(S.id),S.onResize&&c.observe(S.element)});const d=Rl({group:e}),p=Zh(e),m=e.panels.map(({id:S})=>S).join(",");let g=e.mutableState.defaultLayout;g&&(D7(e.panels,g)||(g=void 0));const h=e.mutableState.layouts[m]??g??mw(p),_=ho({layout:h,panelConstraints:p}),v=e.element.ownerDocument;il.set(v,(il.get(v)??0)+1);const k=new Map;return gC(e).forEach(S=>{S.separator&&k.set(S.separator,S.panels)}),Gs(e,{defaultLayoutDeferred:d===0,derivedPanelConstraints:p,groupSize:d,layout:_,separatorToPanels:k}),e.separators.forEach(S=>{Ut(!l.has(S.id),`Separator ids must be unique; id "${S.id}" was used more than once`),l.add(S.id),S.element.addEventListener("keydown",sw)}),il.get(v)===1&&(v.addEventListener("dblclick",aw,!0),v.addEventListener("pointerdown",rw,!0),v.addEventListener("pointerleave",uw),v.addEventListener("pointermove",dw),v.addEventListener("pointerout",fw),v.addEventListener("pointerup",pw,!0)),function(){n=!1,il.set(v,Math.max(0,(il.get(v)??0)-1)),b7(e),e.separators.forEach(S=>{S.element.removeEventListener("keydown",sw)}),il.get(v)||(v.removeEventListener("dblclick",aw,!0),v.removeEventListener("pointerdown",rw,!0),v.removeEventListener("pointerleave",uw),v.removeEventListener("pointermove",dw),v.removeEventListener("pointerout",fw),v.removeEventListener("pointerup",pw,!0)),c.disconnect()}}function P7(){const[e,n]=x.useState({}),s=x.useCallback(()=>n({}),[]);return[e,s]}function Db(e){const n=x.useId();return`${e??n}`}const wo=typeof window<"u"?x.useLayoutEffect:x.useEffect;function ic(e){const n=x.useRef(e);return wo(()=>{n.current=e},[e]),x.useCallback((...s)=>n.current?.(...s),[n])}function Lb(...e){return ic(n=>{e.forEach(s=>{if(s)switch(typeof s){case"function":{s(n);break}case"object":{s.current=n;break}}})})}function Pb(e){const n=x.useRef({...e});return wo(()=>{for(const s in e)n.current[s]=e[s]},[e]),n.current}const CC=x.createContext(null);function I7(e,n){const s=x.useRef({getLayout:()=>({}),setLayout:T7});x.useImperativeHandle(n,()=>s.current,[]),wo(()=>{Object.assign(s.current,vC({groupId:e}))})}function Jh({children:e,className:n,defaultLayout:s,disableCursor:o,disabled:l,elementRef:c,groupRef:d,id:p,onLayoutChange:m,onLayoutChanged:g,orientation:h="horizontal",resizeTargetMinimumSize:_={coarse:20,fine:10},style:v,...k}){const S=x.useRef({onLayoutChange:{},onLayoutChanged:{}}),j=ic(D=>{go(S.current.onLayoutChange,D)||(S.current.onLayoutChange=D,m?.(D))}),w=ic(D=>{go(S.current.onLayoutChanged,D)||(S.current.onLayoutChanged=D,g?.(D))}),C=Db(p),E=x.useRef(null),[N,R]=P7(),T=x.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:_,separators:[]}),O=Lb(E,c);I7(C,d);const A=ic((D,P)=>{const H=xo(),q=Jj(D),Y=Cr(D);if(Y){let V=!1;switch(H.state){case"active":{V=H.hitRegions.some($=>$.group===q);break}}return{flexGrow:Y.layout[P]??1,pointerEvents:V?"none":void 0}}if(s?.[P])return{flexGrow:s?.[P]}}),z=Pb({defaultLayout:s,disableCursor:o}),B=x.useMemo(()=>({get disableCursor(){return!!z.disableCursor},getPanelStyles:A,id:C,orientation:h,registerPanel:D=>{const P=T.current;return P.panels=Wh(h,[...P.panels,D]),R(),()=>{P.panels=P.panels.filter(H=>H!==D),R()}},registerSeparator:D=>{const P=T.current;return P.separators=Wh(h,[...P.separators,D]),R(),()=>{P.separators=P.separators.filter(H=>H!==D),R()}},updatePanelProps:(D,{disabled:P})=>{const H=T.current.panels.find(V=>V.id===D);H&&(H.panelConstraints.disabled=P);const q=Jj(C),Y=Cr(C);q&&Y&&Gs(q,{...Y,derivedPanelConstraints:Zh(q)})},updateSeparatorProps:(D,{disabled:P,disableDoubleClick:H})=>{const q=T.current.separators.find(Y=>Y.id===D);q&&(q.disabled=P,q.disableDoubleClick=H)}}),[A,C,R,h,z]),L=x.useRef(null);return wo(()=>{const D=E.current;if(D===null)return;const P=T.current;let H;if(z.defaultLayout!==void 0&&Object.keys(z.defaultLayout).length===P.panels.length){H={};for(const X of P.panels){const U=z.defaultLayout[X.id];U!==void 0&&(H[X.id]=U)}}const q={disabled:!!l,element:D,id:C,mutableState:{defaultLayout:H,disableCursor:!!z.disableCursor,expandedPanelSizes:T.current.lastExpandedPanelSizes,layouts:T.current.layouts},orientation:h,panels:P.panels,resizeTargetMinimumSize:P.resizeTargetMinimumSize,separators:P.separators};L.current=q;const Y=L7(q),{defaultLayoutDeferred:V,derivedPanelConstraints:$,layout:Z}=Cr(q.id,!0);!V&&$.length>0&&(j(Z),w(Z));const G=Ab(C,X=>{const{defaultLayoutDeferred:U,derivedPanelConstraints:K,layout:F}=X.next;if(U||K.length===0)return;const J=q.panels.map(({id:re})=>re).join(",");q.mutableState.layouts[J]=F,K.forEach(re=>{if(re.collapsible){const{layout:oe}=X.prev??{};if(oe){const ce=In(re.collapsedSize,F[re.panelId]),ee=In(re.collapsedSize,oe[re.panelId]);ce&&!ee&&(q.mutableState.expandedPanelSizes[re.panelId]=oe[re.panelId])}}});const ie=xo().state!=="active";j(F),ie&&w(F)});return()=>{L.current=null,Y(),G()}},[l,C,w,j,h,N,z]),x.useEffect(()=>{const D=L.current;D&&(D.mutableState.defaultLayout=s,D.mutableState.disableCursor=!!o)}),r.jsx(CC.Provider,{value:B,children:r.jsx("div",{...k,className:n,"data-group":!0,"data-testid":C,id:C,ref:O,style:{height:"100%",width:"100%",overflow:"hidden",...v,display:"flex",flexDirection:h==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:h==="horizontal"?"pan-y":"pan-x"},children:e})})}Jh.displayName="Group";function Ib(){const e=x.useContext(CC);return Ut(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function B7(e,n){const{id:s}=Ib(),o=x.useRef({collapse:ih,expand:ih,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ih});x.useImperativeHandle(n,()=>o.current,[]),wo(()=>{Object.assign(o.current,_C({groupId:s,panelId:e}))})}function so({children:e,className:n,collapsedSize:s="0%",collapsible:o=!1,defaultSize:l,disabled:c,elementRef:d,groupResizeBehavior:p="preserve-relative-size",id:m,maxSize:g="100%",minSize:h="0%",onResize:_,panelRef:v,style:k,...S}){const j=!!m,w=Db(m),C=Pb({disabled:c}),E=x.useRef(null),N=Lb(E,d),{getPanelStyles:R,id:T,orientation:O,registerPanel:A,updatePanelProps:z}=Ib(),B=_!==null,L=ic((q,Y,V)=>{_?.(q,m,V)});wo(()=>{const q=E.current;if(q!==null){const Y={element:q,id:w,idIsStable:j,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:B?L:void 0,panelConstraints:{groupResizeBehavior:p,collapsedSize:s,collapsible:o,defaultSize:l,disabled:C.disabled,maxSize:g,minSize:h}};return A(Y)}},[p,s,o,l,B,w,j,g,h,L,A,C]),x.useEffect(()=>{z(w,{disabled:c})},[c,w,z]),B7(w,v);const D=()=>{const q=R(T,w);if(q)return JSON.stringify(q)},P=x.useSyncExternalStore(q=>Ab(T,q),D,D);let H;return P?H=JSON.parse(P):l!==void 0?H={flexGrow:void 0,flexShrink:void 0,flexBasis:l}:H={flexGrow:1},r.jsx("div",{...S,"data-disabled":c||void 0,"data-panel":!0,"data-testid":w,id:w,ref:N,style:{...U7,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...H},children:r.jsx("div",{className:n,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...k,touchAction:O==="horizontal"?"pan-y":"pan-x"},children:e})})}so.displayName="Panel";const U7={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function H7({layout:e,panelConstraints:n,panelId:s,panelIndex:o}){let l,c;const d=e[s],p=n.find(m=>m.panelId===s);if(p){const m=p.maxSize,g=p.collapsible?p.collapsedSize:p.minSize,h=[o,o+1];c=ho({layout:jc({delta:g-d,initialLayout:e,panelConstraints:n,pivotIndices:h,prevLayout:e}),panelConstraints:n})[s],l=ho({layout:jc({delta:m-d,initialLayout:e,panelConstraints:n,pivotIndices:h,prevLayout:e}),panelConstraints:n})[s]}return{valueControls:s,valueMax:l,valueMin:c,valueNow:d}}function Bb({children:e,className:n,disabled:s,disableDoubleClick:o,elementRef:l,id:c,style:d,...p}){const m=Db(c),g=Pb({disabled:s,disableDoubleClick:o}),[h,_]=x.useState({}),[v,k]=x.useState("inactive"),[S,j]=x.useState(!1),w=x.useRef(null),C=Lb(w,l),{disableCursor:E,id:N,orientation:R,registerSeparator:T,updateSeparatorProps:O}=Ib(),A=R==="horizontal"?"vertical":"horizontal";wo(()=>{const L=w.current;if(L!==null){const D={disabled:g.disabled,disableDoubleClick:g.disableDoubleClick,element:L,id:m},P=T(D),H=N7(Y=>{k(Y.next.state!=="inactive"&&Y.next.hitRegions.some(V=>V.separator===D)?Y.next.state:"inactive")}),q=Ab(N,Y=>{const{derivedPanelConstraints:V,layout:$,separatorToPanels:Z}=Y.next,G=Z.get(D);if(G){const X=G[0],U=G.indexOf(X);_(H7({layout:$,panelConstraints:V,panelId:X.id,panelIndex:U}))}});return()=>{H(),q(),P()}}},[N,m,T,g]),x.useEffect(()=>{O(m,{disabled:s,disableDoubleClick:o})},[s,o,m,O]);let z;s&&!E&&(z="not-allowed");let B;if(s)B="disabled";else switch(v){case"active":{B="active";break}default:S?B="focus":B=v}return r.jsx("div",{...p,"aria-controls":h.valueControls,"aria-disabled":s||void 0,"aria-orientation":A,"aria-valuemax":h.valueMax,"aria-valuemin":h.valueMin,"aria-valuenow":h.valueNow,children:e,className:n,"data-separator":B,"data-testid":m,id:m,onBlur:()=>j(!1),onFocus:()=>j(!0),ref:C,role:"separator",style:{flexBasis:"auto",cursor:z,...d,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:s?void 0:0})}Bb.displayName="Separator";function V7({projects:e,value:n,onChange:s,disabled:o}){const l=e.map(c=>{const d=c.path?.split("/").filter(Boolean).pop()||f("modules_ui.code_project_fallback",{id:c.id});return{value:String(c.id),label:c.name||d,icon:WT,description:c.path}});return r.jsx("div",{className:"w-full","data-testid":"code-project-select",children:r.jsx(wt,{value:n,onChange:s,options:l,placeholder:f("modules_ui.code_pick_project_ph"),disabled:o})})}function q7({sessions:e,activeId:n,busy:s,onSelect:o,onCreate:l,onRename:c,onDelete:d}){return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:f("code_module.sessions")}),r.jsx(Tt,{content:f("code_module.new_session"),children:r.jsxs("button",{type:"button",onClick:l,disabled:s,"data-testid":"code-new-session",className:"flex items-center gap-1 rounded-md border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:bg-accent hover:text-foreground disabled:opacity-50",children:[r.jsx(nn,{className:"size-3"})," ",f("code_module.new_session")]})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?r.jsx("div",{className:"p-2",children:r.jsx(pt,{children:f("code_module.no_sessions")})}):r.jsx("ul",{className:"space-y-0.5",children:e.map(p=>r.jsxs("li",{className:"group/item relative",children:[r.jsxs("button",{type:"button",onClick:()=>o(p.id),className:Oe("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",p.id===n?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[r.jsx(mx,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),r.jsxs("span",{className:"min-w-0 flex-1",children:[r.jsx("span",{className:"block truncate font-medium",children:p.title}),r.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[p.mode," · ",p.messageCount," msg",p.model?` · ${p.model}`:""]})]})]}),r.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[r.jsx(Tt,{content:f("code_module.rename"),children:r.jsx("button",{type:"button",onClick:()=>c(p.id,p.title),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:r.jsx(Ol,{className:"size-3"})})}),r.jsx(Tt,{content:f("code_module.delete"),children:r.jsx("button",{type:"button",onClick:()=>d(p.id),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:r.jsx(ia,{className:"size-3"})})})]})]},p.id))})})]})}function $7({mode:e,onChange:n,disabled:s}){const o=(l,c,d,p)=>r.jsx(Tt,{content:d,children:r.jsxs("button",{type:"button",disabled:s,"data-testid":`code-mode-${l}`,"aria-pressed":e===l,onClick:()=>n(l),className:Oe("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors disabled:opacity-50",e===l?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(p,{className:"size-3.5"})," ",c]})});return r.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[o("build",f("code_module.mode_build"),f("code_module.mode_build_hint"),nA),o("plan",f("code_module.mode_plan"),f("code_module.mode_plan_hint"),BT)]})}function G7({value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l,disabled:c,mode:d,onModeChange:p,model:m,onModelChange:g}){return r.jsx(kb,{value:e,onValueChange:n,onSubmit:s,onStop:o,busy:l,disabled:c,placeholder:f("code_module.placeholder"),minRows:1,maxRows:6,footer:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($7,{mode:d,onChange:p,disabled:l}),r.jsx(Sb,{value:m,onChange:g,disabled:l})]})})}function ch(e,n){let s=0;for(const o of e.parts||[])o.kind==="text"&&n.text&&(s+=o.text.length),o.kind==="tool"&&n.tool&&(o.args&&(s+=JSON.stringify(o.args).length),o.result!==void 0&&(s+=JSON.stringify(o.result).length));return Math.ceil(s/4)}function F7(e){let n=null,s=0,o=0;for(const d of e)d.role==="user"?s++:o++,d.role==="assistant"&&d.usage&&(n={input:d.usage.input_tokens,output:d.usage.output_tokens,model:d.model});const l=n?.input??0,c=n?.output??0;return{model:n?.model??null,input:l,output:c,total:l+c,hasUsage:!!n,messages:e.length,userMsgs:s,assistantMsgs:o}}function Y7(e){let n=0,s=0,o=0;for(const d of e)d.role==="user"?n+=ch(d,{text:!0}):s+=ch(d,{text:!0}),o+=ch(d,{tool:!0});const l=n+s+o||1,c=(d,p)=>({key:d,tokens:p,percent:Math.round(p/l*100)});return[c("user",n),c("assistant",s),c("tool",o)].filter(d=>d.tokens>0)}const gw={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function Ms({label:e,value:n}){return r.jsxs("div",{className:"flex items-baseline justify-between gap-2 py-0.5",children:[r.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),r.jsx("span",{className:"min-w-0 truncate text-right font-mono text-xs text-foreground",children:n})]})}function hw(e){if(!e)return"";const n=new Date(e),s=o=>String(o).padStart(2,"0");return`${s(n.getDate())} ${n.toLocaleString("es",{month:"short"})} ${n.getFullYear()}, ${s(n.getHours())}:${s(n.getMinutes())}`}function X7({turns:e,session:n}){const s=x.useMemo(()=>F7(e),[e]),o=x.useMemo(()=>Y7(e),[e]);return e.length===0?r.jsx("div",{className:"p-3",children:r.jsx(pt,{children:f("code_module.ctx_none")})}):r.jsxs("div",{className:"space-y-1 p-3","data-testid":"code-context-tab",children:[r.jsx(Ms,{label:f("code_module.ctx_model"),value:s.model||f("modules_ui.code_ctx_auto")}),n?.mode&&r.jsx(Ms,{label:f("modules_ui.code_ctx_mode"),value:n.mode}),n?.agentSlug&&r.jsx(Ms,{label:f("modules_ui.code_ctx_agent"),value:n.agentSlug}),r.jsx(Ms,{label:f("code_module.ctx_messages"),value:f("modules_ui.code_ctx_msgs_value",{user:s.userMsgs,assistant:s.assistantMsgs})}),r.jsx(Ms,{label:f("code_module.ctx_input"),value:s.input.toLocaleString()}),r.jsx(Ms,{label:f("code_module.ctx_output"),value:s.output.toLocaleString()}),r.jsx(Ms,{label:f("modules_ui.code_ctx_tokens_total"),value:(s.input+s.output).toLocaleString()}),n?.createdAt&&r.jsx(Ms,{label:f("modules_ui.code_ctx_created"),value:hw(n.createdAt)}),n?.updatedAt&&r.jsx(Ms,{label:f("modules_ui.code_ctx_activity"),value:hw(n.updatedAt)}),r.jsx("hr",{className:"border-border my-2"}),r.jsxs("div",{children:[r.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:f("code_module.ctx_breakdown")}),o.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:o.map(l=>r.jsx(Tt,{content:`${l.key}: ${l.tokens} (${l.percent}%)`,children:r.jsx("div",{className:gw[l.key],style:{width:`${l.percent}%`}})},l.key))}),r.jsx("ul",{className:"mt-2 space-y-1",children:o.map(l=>r.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[r.jsx("span",{className:`size-2 rounded-full ${gw[l.key]}`}),r.jsx("span",{className:"flex-1 text-foreground/80",children:f(`code_module.seg_${l.key}`)}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[l.tokens," · ",l.percent,"%"]})]},l.key))})]}):r.jsx("p",{className:"text-[11px] text-muted-foreground",children:f("code_module.ctx_none")})]})]})}function K7(e){const n=[];for(const s of(e||"").split(`
624
- `))s.startsWith("diff --git")||s.startsWith("index ")||s.startsWith("--- ")||s.startsWith("+++ ")||s.startsWith("new file")||s.startsWith("deleted file")||s.startsWith("similarity index")||s.startsWith("rename ")||(s.startsWith("@@")?n.push({kind:"hunk",text:s}):s.startsWith("+")?n.push({kind:"add",text:s.slice(1)}):s.startsWith("-")?n.push({kind:"del",text:s.slice(1)}):n.push({kind:"ctx",text:s.replace(/^ /,"")}));for(;n.length&&n[n.length-1].kind==="ctx"&&n[n.length-1].text==="";)n.pop();return n}function Q7({patch:e}){const n=x.useMemo(()=>K7(e),[e]);return n.length?r.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:r.jsx("code",{className:"block",children:n.map((s,o)=>r.jsxs("div",{className:Oe("px-2 whitespace-pre",s.kind==="add"&&"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",s.kind==="del"&&"bg-rose-500/10 text-rose-600 dark:text-rose-400",s.kind==="hunk"&&"bg-muted/60 text-muted-foreground",s.kind==="ctx"&&"text-foreground/70"),children:[r.jsx("span",{className:"select-none opacity-50",children:s.kind==="add"?"+":s.kind==="del"?"-":" "}),s.text]},o))})}):null}const Z7={added:YT,modified:Md,deleted:QT},W7={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 J7({file:e}){const[n,s]=x.useState(!1),o=Z7[e.status];return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("button",{type:"button",onClick:()=>s(l=>!l),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[r.jsx(Ec,{className:Oe("size-3 shrink-0 transition-transform",n&&"rotate-90")}),r.jsx(o,{className:Oe("size-3.5 shrink-0",W7[e.status])}),r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&r.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&r.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),n&&r.jsx("div",{className:"border-t border-border p-1.5",children:r.jsx(Q7,{patch:e.patch})})]})}function eI({changes:e,loading:n,onRefresh:s}){const o=e?.files||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:o.length>0?f("code_module.changes_files",{n:o.length}):""}),r.jsx(Tt,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:s,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:n?r.jsx(Pa,{size:12}):r.jsx(os,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?r.jsx(pt,{children:f("code_module.changes_no_git")}):o.length===0?r.jsx(pt,{children:f("code_module.changes_none")}):r.jsx("ul",{className:"space-y-1.5",children:o.map(l=>r.jsx(J7,{file:l},l.path))})})]})}function tI({pid:e,entry:n,onDeleted:s,onRenamed:o,onRunInTerminal:l,onEditArtifact:c}){const[d,p]=x.useState(!1),[m,g]=x.useState(null),h=at(),[_,v]=x.useState(!1),[k,S]=x.useState(n.name),j=x.useRef(null),[w,C]=x.useState(!1),[E,N]=x.useState(!1),[R,T]=x.useState(!1),O=w?["artifact",e,n.name]:null,A=Qe(O,()=>hl.read(e,n.name),{revalidateOnFocus:!1}),z=!A.data?.content||A.data.content.startsWith("#!"),B=async H=>{try{await navigator.clipboard.writeText(H),h.info(f("modules_ui.code_copied"))}catch{}},L=async()=>{T(!0);try{await hl.remove(e,n.name),N(!1),s()}catch(H){h.error(H.message)}finally{T(!1)}},D=()=>{S(n.name),v(!0),requestAnimationFrame(()=>j.current?.select())},P=async()=>{const H=k.trim();if(v(!1),!(!H||H===n.name))try{await hl.rename(e,n.name,H),o()}catch(q){h.error(q.message)}};return r.jsxs("li",{className:"rounded-md border border-border",children:[r.jsxs("div",{className:"flex w-full items-center gap-2 px-2 py-1.5 text-xs",children:[r.jsx(FT,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),_?r.jsx("input",{ref:j,value:k,onChange:H=>S(H.target.value),onBlur:()=>void P(),onKeyDown:H=>{H.key==="Enter"&&P(),H.key==="Escape"&&v(!1)},autoFocus:!0,className:"min-w-0 flex-1 rounded border border-border bg-background px-1 py-0.5 font-mono text-xs outline-none focus:ring-1 focus:ring-ring"}):r.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:n.name}),r.jsx(Tt,{content:f("code_module.artifacts_rename"),children:r.jsx("button",{type:"button",onClick:D,className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Ol,{className:"size-3"})})}),r.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[n.size,"b"]})]}),r.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[r.jsxs("div",{className:"flex w-full min-w-0 items-center gap-1 rounded bg-muted px-1.5 py-0.5",children:[r.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-[10px] text-muted-foreground",children:n.path}),r.jsx(Tt,{content:f("code_module.artifacts_copy_path"),children:r.jsx("button",{type:"button",onClick:()=>void B(n.path),className:"shrink-0 rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(Ad,{className:"size-3"})})})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mt-1",children:[r.jsxs(Ih,{open:w,onOpenChange:C,children:[r.jsx(Tt,{content:f("code_module.artifacts_view"),children:r.jsxs("button",{type:"button",onClick:()=>C(!0),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-blue-500/15 text-blue-700 hover:bg-blue-500/25 dark:text-blue-300",children:[r.jsx(lf,{className:"size-3"}),f("modules_ui.code_artifact_view_short")]})}),r.jsxs(Bh,{className:"sm:max-w-lg",children:[r.jsx(Uh,{children:r.jsx(Hh,{className:"font-mono text-sm",children:n.name})}),A.isLoading?r.jsx("div",{className:"flex justify-center py-6",children:r.jsx(Pa,{size:16})}):r.jsx("pre",{className:"max-h-96 overflow-auto rounded bg-muted/50 p-3 font-mono text-[11px] leading-tight whitespace-pre-wrap break-all",children:A.data?.content??""}),r.jsx(Z1,{showCloseButton:!0})]})]}),r.jsx(Tt,{content:f("code_module.artifacts_edit"),children:r.jsxs("button",{type:"button",onClick:()=>c?.(n.name),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-violet-500/15 text-violet-700 hover:bg-violet-500/25 dark:text-violet-300",children:[r.jsx(bA,{className:"size-3"}),f("modules_ui.code_artifact_edit_short")]})}),z&&r.jsx(Tt,{content:f("code_module.artifacts_run"),children:r.jsxs("button",{type:"button",onClick:()=>l?.(`apx artifact run ${n.name}`),className:"inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300",children:[r.jsx(gx,{className:"size-3"}),f("code_module.artifacts_run")]})}),r.jsxs(Ih,{open:E,onOpenChange:N,children:[r.jsx(Tt,{content:f("code_module.artifacts_delete"),children:r.jsx("button",{type:"button",onClick:()=>N(!0),className:"ml-auto rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:r.jsx(ia,{className:"size-3"})})}),r.jsxs(Bh,{className:"sm:max-w-sm",children:[r.jsx(Uh,{children:r.jsxs(Hh,{className:"font-mono text-sm",children:[f("code_module.artifacts_delete")," — ",n.name]})}),r.jsx("p",{className:"px-1 text-sm text-muted-foreground",children:f("code_module.artifacts_delete_confirm")}),r.jsxs(Z1,{children:[r.jsx(zz,{render:r.jsx("button",{type:"button",className:"rounded px-3 py-1.5 text-xs font-medium hover:bg-accent"}),children:f("common.cancel")}),r.jsxs("button",{type:"button",onClick:()=>void L(),disabled:R,className:Oe("inline-flex items-center gap-1.5 rounded px-3 py-1.5 text-xs font-medium",R?"bg-muted text-muted-foreground":"bg-rose-500/15 text-rose-700 hover:bg-rose-500/25 dark:text-rose-300"),children:[R&&r.jsx(Pa,{size:10}),f("code_module.delete")]})]})]})]})]}),r.jsxs("div",{className:"mt-1 text-[10px] text-muted-foreground",children:[f("code_module.artifacts_run_hint")," ",r.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",n.name]})]}),m&&r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[r.jsx("span",{className:Oe("rounded px-1.5 py-0.5 font-mono",m.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-rose-500/15 text-rose-700 dark:text-rose-300"),children:f("modules_ui.code_artifact_exit_badge",{code:m.exitCode??m.signal??"?"})}),m.timedOut&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:f("modules_ui.code_artifact_timeout")}),m.truncated&&r.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:f("modules_ui.code_artifact_truncated")}),r.jsxs("span",{className:"font-mono text-muted-foreground",children:[m.durationMs,"ms"]})]}),m.stdout&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:m.stdout}),m.stderr&&r.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-rose-500/5 p-2 text-[10px] leading-tight text-rose-700 dark:text-rose-300",children:m.stderr})]})]})]})}function nI({pid:e,onRunInTerminal:n,onEditArtifact:s}){const o=Qe(e?["artifacts",e]:null,()=>hl.list(e)),l=o.data||[];return r.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[r.jsx("span",{className:"text-[11px] text-muted-foreground",children:l.length>0?f("code_module.artifacts_count",{n:l.length}):""}),r.jsx(Tt,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void o.mutate(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o.isLoading?r.jsx(Pa,{size:12}):r.jsx(os,{className:"size-3"})})})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:l.length===0?r.jsx(pt,{children:f("code_module.artifacts_none")}):r.jsx("ul",{className:"space-y-1.5",children:l.map(c=>r.jsx(tI,{pid:e,entry:c,onDeleted:()=>void o.mutate(),onRenamed:()=>void o.mutate(),onRunInTerminal:n,onEditArtifact:s},c.name))})})]})}const aI=[{value:"context",icon:cf,label:"tab_context"},{value:"changes",icon:tA,label:"tab_changes"},{value:"artifacts",icon:dA,label:"tab_artifacts"}];function sI({pid:e,turns:n,changes:s,changesLoading:o,onRefreshChanges:l,session:c,onRunInTerminal:d,onEditArtifact:p}){const[m,g]=x.useState("context"),h=s?.files.length||0;return r.jsxs(Df,{value:m,onValueChange:g,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[r.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:r.jsx(Lf,{variant:"line",className:"w-full",children:aI.map(({value:_,icon:v,label:k})=>{const S=m===_,j=f(`code_module.${k}`);return r.jsx(Tt,{content:j,children:r.jsxs(ns,{value:_,className:S?"flex-1 min-w-0":"w-8 shrink-0",children:[r.jsx(v,{className:"size-3.5 shrink-0"}),S&&r.jsx("span",{className:"truncate text-xs",children:j}),_==="changes"&&h>0&&r.jsx("span",{className:"ml-0.5 rounded-full bg-muted px-1 text-[10px] text-muted-foreground leading-none py-0.5",children:h})]})},_)})})}),r.jsx(za,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:r.jsx(X7,{turns:n,session:c})}),r.jsx(za,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(eI,{changes:s,loading:o,onRefresh:l})}),r.jsx(za,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(nI,{pid:e,onRunInTerminal:d,onEditArtifact:p})})]})}function rI(e){const n=[];for(const o of e){const l=o.split("/").filter(Boolean);let c=n,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 s=o=>(o.forEach(l=>{l.children&&(l.children=s(l.children))}),o.sort((l,c)=>l.type!==c.type?l.type==="dir"?-1:1:l.name.localeCompare(c.name)));return s(n)}function EC({node:e,depth:n,onOpenFile:s,openDirs:o,toggleDir:l}){const c=e.type==="dir",d=c&&o.has(e.path);return r.jsxs("li",{children:[r.jsxs("button",{type:"button",onClick:()=>c?l(e.path):s(e.path),style:{paddingLeft:`${n*12+6}px`},className:Oe("flex w-full items-center gap-1.5 py-0.5 pr-2 text-left text-[11px] rounded transition-colors","hover:bg-accent/40",c?"text-foreground/80":"text-foreground/70"),children:[c?r.jsxs(r.Fragment,{children:[r.jsx(Ec,{className:Oe("size-3 shrink-0 transition-transform",d&&"rotate-90")}),d?r.jsx(fx,{className:"size-3.5 shrink-0 text-amber-400"}):r.jsx(JT,{className:"size-3.5 shrink-0 text-amber-400"})]}):r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"size-3 shrink-0"}),r.jsx(ZT,{className:"size-3.5 shrink-0 text-sky-400"})]}),r.jsx("span",{className:"truncate",children:e.name})]}),c&&d&&e.children&&e.children.length>0&&r.jsx("ul",{children:e.children.map(p=>r.jsx(EC,{node:p,depth:n+1,onOpenFile:s,openDirs:o,toggleDir:l},p.path))})]})}function oI({pid:e,projectPath:n,className:s,onOpenFile:o}){const[l,c]=x.useState([]),[d,p]=x.useState(!1),[m,g]=x.useState(!1),[h,_]=x.useState(()=>new Set),v=x.useCallback(async()=>{p(!0);try{const E=(await me.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(`
625
- `).map(N=>N.trim()).filter(Boolean);c(E),g(!0)}catch{g(!0)}finally{p(!1)}},[e]);x.useEffect(()=>{_(new Set),v()},[v]);const k=x.useCallback(C=>{_(E=>{const N=new Set(E);return N.has(C)?N.delete(C):N.add(C),N})},[]),S=x.useCallback(()=>{_(new Set)},[]),j=rI(l),w=h.size>0;return r.jsxs("div",{className:Oe("flex h-full flex-col",s),"data-testid":"code-file-tree",children:[r.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Archivos"}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(Tt,{content:f("code_module.tree_collapse_all"),children:r.jsx("button",{type:"button",onClick:S,disabled:!w,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40 disabled:hover:bg-transparent",children:r.jsx(LT,{className:"size-3"})})}),r.jsx(Tt,{content:f("code_module.reload"),children:r.jsx("button",{type:"button",onClick:()=>void v(),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:d?r.jsx(Pa,{size:12}):r.jsx(os,{className:"size-3"})})})]})]}),r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto py-1",children:m?j.length===0?r.jsx("div",{className:"p-3",children:r.jsx(pt,{children:"Sin archivos"})}):r.jsx("ul",{children:j.map(C=>r.jsx(EC,{node:C,depth:0,onOpenFile:o??(()=>{}),openDirs:h,toggleDir:k},C.path))}):r.jsx("div",{className:"flex justify-center pt-6",children:r.jsx(Pa,{size:14})})})]})}function lI({path:e,content:n,loading:s,onSave:o}){const l=typeof o=="function",[c,d]=x.useState(n),[p,m]=x.useState(!1);x.useEffect(()=>{d(n)},[n]);const g=l&&c!==n,h=async()=>{if(!(!o||!g)){m(!0);try{await o(c)}finally{m(!1)}}};return r.jsxs("div",{className:"flex h-full min-h-0 flex-col bg-card/40","data-testid":"code-file-viewer",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1.5",children:[r.jsxs("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-muted-foreground",children:[e,g&&r.jsx("span",{className:"ml-1 text-amber-400",children:"•"})]}),l&&r.jsxs(r.Fragment,{children:[r.jsx(Tt,{content:f("code_module.discard_changes"),children:r.jsxs("button",{type:"button",onClick:()=>d(n),disabled:!g||p,className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-40",children:[r.jsx(hx,{className:"size-3"}),"Descartar"]})}),r.jsx(Tt,{content:f("code_module.save_shortcut_hint"),children:r.jsxs("button",{type:"button",onClick:()=>void h(),disabled:!g||p,className:Oe("inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-medium transition-colors",g&&!p?"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300":"bg-muted text-muted-foreground"),children:[p?r.jsx(Pa,{size:10}):r.jsx(df,{className:"size-3"}),"Guardar"]})})]})]}),s?r.jsx("div",{className:"flex flex-1 items-center justify-center",children:r.jsx(Pa,{size:16})}):l?r.jsx("textarea",{value:c,onChange:_=>d(_.target.value),onKeyDown:_=>{(_.metaKey||_.ctrlKey)&&_.key==="s"&&(_.preventDefault(),h())},className:"min-h-0 flex-1 resize-none bg-transparent p-3 font-mono text-[12px] leading-[1.6] text-foreground/90 outline-none",spellCheck:!1}):r.jsx("div",{className:"min-h-0 flex-1 overflow-auto",children:r.jsx("table",{className:"w-full border-collapse font-mono text-[12px] leading-[1.6]",children:r.jsx("tbody",{children:n.split(`
626
- `).map((_,v)=>r.jsxs("tr",{className:"hover:bg-accent/20",children:[r.jsx("td",{className:"w-12 select-none border-r border-border/30 px-3 py-0 text-right align-top text-[10px] text-muted-foreground/40","aria-hidden":"true",children:v+1}),r.jsx("td",{className:"px-4 py-0 align-top text-foreground/90 whitespace-pre",children:_||" "})]},v))})})})]})}function iI({pid:e,className:n,initCmd:s,onClose:o}){const[l,c]=x.useState([]),[d,p]=x.useState(""),[m,g]=x.useState(!1),[h,_]=x.useState([]),[v,k]=x.useState(-1),S=x.useRef(null),j=x.useRef(null);x.useEffect(()=>{S.current?.scrollIntoView({behavior:"smooth"})},[l]),x.useEffect(()=>{s&&(p(s),setTimeout(()=>j.current?.focus(),50))},[s]);const w=async E=>{const N=E.trim();if(N){_(R=>[N,...R.slice(0,49)]),k(-1),c(R=>[...R,{type:"cmd",text:`$ ${N}`}]),g(!0);try{const R=await me.post("/run",{cmd:N,project:e});R.stdout&&c(T=>[...T,{type:"out",text:R.stdout}]),R.stderr&&c(T=>[...T,{type:"err",text:R.stderr}])}catch(R){c(T=>[...T,{type:"err",text:String(R.message)}])}finally{g(!1)}}},C=E=>{if(E.key==="Enter")w(d),p("");else if(E.key==="ArrowUp"){E.preventDefault();const N=Math.min(v+1,h.length-1);k(N),p(h[N]??"")}else if(E.key==="ArrowDown"){E.preventDefault();const N=Math.max(v-1,-1);k(N),p(N===-1?"":h[N]??"")}};return r.jsxs("div",{className:Oe("flex h-full min-h-0 flex-col bg-card/60",n),"data-testid":"code-terminal",children:[r.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border px-3 py-1",children:[r.jsx(Er,{className:"size-3 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-[11px] text-muted-foreground",children:"Terminal"}),r.jsx(Tt,{content:f("code_module.terminal_clear"),children:r.jsx("button",{type:"button",onClick:()=>c([]),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx($T,{className:"size-3"})})}),r.jsx(Tt,{content:f("code_module.terminal_close"),children:r.jsx("button",{type:"button",onClick:()=>o?.(),className:"rounded p-0.5 text-muted-foreground hover:bg-accent hover:text-foreground",children:r.jsx(bo,{className:"size-3"})})})]}),r.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 py-1 font-mono text-[11px] leading-snug cursor-text",onClick:()=>j.current?.focus(),children:[l.map((E,N)=>r.jsx("div",{className:Oe("whitespace-pre-wrap break-all",E.type==="cmd"&&"text-emerald-400",E.type==="err"&&"text-rose-400",E.type==="out"&&"text-foreground/90"),children:E.text},N)),r.jsx("div",{ref:S})]}),r.jsxs("div",{className:"flex shrink-0 items-center border-t border-border px-3 py-1",children:[r.jsx("span",{className:"mr-2 text-[11px] text-emerald-400 font-mono",children:"$"}),r.jsx("input",{ref:j,value:d,onChange:E=>p(E.target.value),onKeyDown:C,disabled:m,placeholder:m?"ejecutando…":"comando…",className:"flex-1 bg-transparent font-mono text-[11px] text-foreground outline-none placeholder:text-muted-foreground/50 disabled:opacity-50",spellCheck:!1,autoComplete:"off"})]})]})}const Yi="super-agent";function uh(){return r.jsx(Bb,{className:"relative z-10 w-px shrink-0 cursor-col-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function cI(){return r.jsx(Bb,{className:"relative z-10 h-px shrink-0 cursor-row-resize bg-border transition-colors hover:bg-primary/50 active:bg-primary/70"})}function uI(){const e=at(),n=Qe("/projects",()=>aa.list()),s=x.useMemo(()=>n.data||[],[n.data]),[o,l]=x.useState(""),[c,d]=x.useState(null),[p,m]=x.useState(Yi),[g,h]=x.useState([]),[_,v]=x.useState(""),[k,S]=x.useState(!1),[j,w]=x.useState(!0),[C,E]=x.useState(!0),[N,R]=x.useState(!1),[T,O]=x.useState(""),[A,z]=x.useState(!1),B=x.useRef(null),[L,D]=x.useState([]),[P,H]=x.useState("chat"),q=x.useCallback(pe=>{R(!0),O(pe)},[]);x.useEffect(()=>{!o&&s.length&&l(String(s[0].id))},[o,s]);const Y=Qe(o?["code-sessions",o]:null,()=>As.sessions.list(o)),V=Qe(o?["agents",o]:null,()=>tn.list(o)),$=Qe(o&&c?["code-session",o,c]:null,()=>As.sessions.get(o,c)),Z=Qe(o&&c?["code-changes",o,c]:null,()=>As.changes(o,c));x.useEffect(()=>{const pe=Y.data||[];!c&&pe.length&&d(pe[0].id),c&&pe.length&&!pe.some(Ee=>Ee.id===c)&&d(pe[0]?.id??null)},[Y.data,c]),x.useEffect(()=>{$.data&&m($.data.agentSlug||Yi)},[$.data]),x.useEffect(()=>{k||($.data?h($.data.messages||[]):c||h([]))},[$.data,c,k]),x.useEffect(()=>()=>B.current?.abort(),[]);const G=$.data,X=G?.mode==="plan"?"plan":"build",U=G?.model||"",K=pe=>{pe===o||k||(l(pe),d(null),h([]))},F=pe=>{k||pe===c||(d(pe),h([]))},J=async()=>{if(!(!o||k))try{const pe=await As.sessions.create(o,{title:f("code_module.untitled"),agentSlug:p!==Yi?p:null});await Y.mutate(),d(pe.id),h([])}catch(pe){e.error(pe.message)}},ie=async(pe,Ee)=>{const Re=window.prompt(f("code_module.rename"),Ee);if(!(!Re||Re===Ee))try{await As.sessions.update(o,pe,{title:Re}),await Y.mutate(),pe===c&&await $.mutate()}catch(qe){e.error(qe.message)}},re=async pe=>{if(!k&&window.confirm(f("code_module.delete_confirm")))try{await As.sessions.remove(o,pe),pe===c&&(d(null),h([])),await Y.mutate()}catch(Ee){e.error(Ee.message)}},oe=async pe=>{if(m(pe),!!c)try{await As.sessions.update(o,c,{agentSlug:pe!==Yi?pe:null}),await Promise.all([$.mutate(),Y.mutate()])}catch(Ee){e.error(Ee.message)}},ce=x.useCallback(async pe=>{if(c)try{await As.sessions.update(o,c,pe),await Promise.all([$.mutate(),Y.mutate()])}catch(Ee){e.error(Ee.message)}},[o,c,$,Y,e]),ee=()=>{B.current?.abort(),S(!1)},Te=pe=>h(Ee=>{const Re=[...Ee],qe=Re[Re.length-1];return qe&&qe.role==="assistant"&&(Re[Re.length-1]=pe(qe)),Re}),Fe=async pe=>{const Ee=(pe??_).trim();if(!Ee||k||!o||!c)return;const Re=new Date().toISOString();h(an=>[...an,{role:"user",parts:[{kind:"text",text:Ee}],ts:Re},{role:"assistant",parts:[],ts:Re,pending:!0}]),v(""),S(!0);const qe=new AbortController;B.current=qe;const st=an=>{if(an.type==="error"){e.error(an.error||f("modules_ui.code_stream_error"));return}Te(Vt=>Cb(Vt,an))};try{await As.stream(o,c,{prompt:Ee},st,qe.signal),Te(an=>({...an,pending:!1}))}catch(an){qe.signal.aborted?Te(Vt=>({...Vt,pending:!1,parts:[...Vt.parts,{kind:"text",text:f("code_module.stopped")}]})):(e.error(an.message),h(Vt=>Vt.filter((mt,Rt)=>Rt!==Vt.length-1)))}finally{B.current===qe&&(B.current=null),S(!1),$.mutate(),Y.mutate(),Z.mutate()}},_e=async pe=>{try{await navigator.clipboard.writeText(pe),e.info(f("modules_ui.code_copied"))}catch{}},Se=x.useCallback(pe=>{H(pe),D(Ee=>Ee.some(Re=>Re.path===pe)?Ee:[...Ee,{path:pe,content:"",loading:!0}]),me.post("/run",{cmd:`cat "${pe}"`,project:o}).then(Ee=>{const Re=Ee.stdout||Ee.stderr||f("modules_ui.code_file_empty");D(qe=>qe.map(st=>st.path===pe?{...st,content:Re,loading:!1}:st))}).catch(Ee=>{D(Re=>Re.map(qe=>qe.path===pe?{...qe,content:f("modules_ui.code_file_error",{msg:Ee.message}),loading:!1}:qe))})},[o]),Ne=x.useCallback(pe=>{D(Ee=>Ee.filter(Re=>Re.path!==pe)),H(Ee=>Ee===pe?"chat":Ee)},[]),Pe=x.useCallback(pe=>{const Ee=`artifacts/${pe}`;H(Ee),D(Re=>Re.some(qe=>qe.path===Ee)?Re:[...Re,{path:Ee,content:"",loading:!0,artifactName:pe}]),hl.read(o,pe).then(Re=>{D(qe=>qe.map(st=>st.path===Ee?{...st,content:Re.content,loading:!1}:st))}).catch(Re=>{D(qe=>qe.map(st=>st.path===Ee?{...st,content:f("modules_ui.code_file_error",{msg:Re.message}),loading:!1}:st))})},[o]),Ie=x.useCallback(async(pe,Ee)=>{const Re=L.find(qe=>qe.path===pe);if(Re?.artifactName)try{await hl.write(o,Re.artifactName,Ee),D(qe=>qe.map(st=>st.path===pe?{...st,content:Ee}:st)),e.info(f("modules_ui.code_saved"))}catch(qe){e.error(qe.message)}},[L,o,e]),be=!n.isLoading&&s.length>0,Ae=x.useMemo(()=>{const pe=[{value:Yi,label:f("modules_ui.code_super_agent"),icon:gn,description:f("modules_ui.code_super_agent_desc")}],Ee=(V.data||[]).map(Re=>({value:Re.slug,label:Re.slug,icon:gn,description:Re.description||Re.role||void 0}));return[...pe,...Ee]},[V.data]),we=x.useMemo(()=>g,[g]),Be=x.useMemo(()=>Y.data?.find(pe=>pe.id===c)?.title||"",[Y.data,c]),Xe=x.useMemo(()=>s.find(pe=>String(pe.id)===o),[s,o]);Wz(Be);const[Ye,De]=x.useState(null),ve=k?null:eC(g),le=ve&&ve.turnKey!==Ye,je=pe=>{Fe(pe)},ke=x.useCallback(()=>w(pe=>!pe),[]),Ue=x.useCallback(()=>z(pe=>!pe),[]),Je=x.useCallback(()=>R(pe=>!pe),[]),yt=x.useCallback(()=>E(pe=>!pe),[]),zt=x.useMemo(()=>c?r.jsx("div",{className:"flex items-center gap-0.5",children:[{Icon:ek,open:j,toggle:ke,title:f("modules_ui.code_panel_sessions")},{Icon:Qw,open:A,toggle:Ue,title:f("modules_ui.code_panel_tree")},{Icon:Er,open:N,toggle:Je,title:f("modules_ui.code_panel_terminal")},{Icon:pA,open:C,toggle:yt,title:f("modules_ui.code_panel_context")}].map(({Icon:pe,open:Ee,toggle:Re,title:qe})=>r.jsx(Tt,{content:qe,children:r.jsx("button",{type:"button",onClick:Re,"data-active":Ee,className:"rounded p-1 text-muted-fg transition-colors hover:bg-accent hover:text-accent-fg data-[active=true]:bg-accent data-[active=true]:text-accent-fg",children:r.jsx(pe,{className:"size-3.5"})})},qe))}):null,[c,j,A,N,C,ke,Ue,Je,yt]);return eD(zt),r.jsx("div",{className:"flex h-full min-h-0 flex-col","data-testid":"screen-code",children:n.isLoading?r.jsx(nt,{}):be?r.jsxs(Jh,{orientation:"vertical",id:"code-layout-v",className:"min-h-0 flex-1",children:[r.jsx(so,{id:"top",defaultSize:N?"55%":"100%",minSize:"20%",children:r.jsxs(Jh,{orientation:"horizontal",id:"code-layout",className:"h-full",children:[j&&r.jsxs(r.Fragment,{children:[r.jsx(so,{id:"left",defaultSize:"14%",minSize:"8%",children:r.jsxs("aside",{className:"flex h-full flex-col",children:[r.jsx("div",{className:"shrink-0 border-b border-border p-2",children:r.jsx(V7,{projects:s,value:o,onChange:K,disabled:k})}),r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:r.jsx(q7,{sessions:Y.data||[],activeId:c,busy:k,onSelect:F,onCreate:J,onRename:ie,onDelete:re})}),r.jsx("div",{className:"shrink-0 border-t border-border p-2",children:r.jsx(wt,{value:p,onChange:oe,options:Ae,disabled:k,showIcon:!0})})]})}),r.jsx(uh,{})]}),A&&r.jsxs(r.Fragment,{children:[r.jsx(so,{id:"tree",defaultSize:"13%",minSize:"8%",children:r.jsx("div",{className:"h-full",children:r.jsx(oI,{pid:o,projectPath:Xe?.path,onOpenFile:Se})})}),r.jsx(uh,{})]}),r.jsx(so,{id:"main",defaultSize:"50%",minSize:"20%",children:r.jsxs("div",{className:"flex h-full flex-col",children:[L.length>0&&r.jsxs("div",{className:"flex shrink-0 items-center gap-0 overflow-x-auto border-b border-border",children:[r.jsxs("button",{type:"button",onClick:()=>H("chat"),"data-active":P==="chat",className:"flex shrink-0 items-center gap-1.5 border-r border-border px-3 py-2 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(mx,{className:"size-3 shrink-0"}),f("modules_ui.code_chat_tab")]}),L.map(pe=>{const Ee=pe.path.split("/").pop()??pe.path,Re=P===pe.path;return r.jsxs("div",{"data-active":Re,className:"group flex shrink-0 items-center gap-1 border-r border-border px-2 py-2 text-[11px] text-muted-foreground transition-colors hover:bg-accent/40 data-[active=true]:text-foreground",children:[r.jsx(Tt,{content:pe.path,children:r.jsx("button",{type:"button",onClick:()=>H(pe.path),className:"min-w-0 max-w-[140px] truncate font-mono",children:Ee})}),r.jsx(Tt,{content:f("code_module.close"),children:r.jsx("button",{type:"button",onClick:()=>Ne(pe.path),className:"shrink-0 rounded p-0.5 opacity-60 hover:bg-accent hover:opacity-100",children:r.jsx(bo,{className:"size-2.5"})})})]},pe.path)})]}),P==="chat"?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?g.length?r.jsx(Eb,{msgs:g,onCopy:_e}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(pt,{children:f("code_module.empty_chat")})}):r.jsx("div",{className:"grid h-full place-items-center p-6",children:r.jsx(pt,{children:f("code_module.pick_project")})})}),le&&ve&&r.jsx(J2,{turnKey:ve.turnKey,questions:ve.questions,onSubmit:je,onDismiss:()=>De(ve.turnKey),disabled:k})]}):r.jsx("div",{className:"min-h-0 flex-1 overflow-hidden",children:(()=>{const pe=L.find(Ee=>Ee.path===P);return pe?r.jsx(lI,{path:pe.path,content:pe.content,loading:pe.loading,onSave:pe.artifactName?Ee=>Ie(pe.path,Ee):void 0}):null})()}),r.jsx("div",{className:"shrink-0 border-t border-border p-2","data-testid":"code-input",children:r.jsx(G7,{value:_,onValueChange:v,onSubmit:()=>void Fe(),onStop:ee,busy:k,disabled:!c,mode:X,onModeChange:pe=>void ce({mode:pe}),model:U,onModelChange:pe=>void ce({model:pe||null})})})]})}),C&&r.jsxs(r.Fragment,{children:[r.jsx(uh,{}),r.jsx(so,{id:"right",defaultSize:"22%",minSize:"15%",children:r.jsx("aside",{className:"flex h-full flex-col",children:r.jsx(sI,{pid:o,turns:we,changes:Z.data,changesLoading:Z.isLoading,onRefreshChanges:()=>void Z.mutate(),session:$.data?{title:$.data.title,mode:$.data.mode,createdAt:$.data.createdAt,updatedAt:$.data.updatedAt,agentSlug:$.data.agentSlug??null}:null,onRunInTerminal:q,onEditArtifact:Pe})})})]})]})}),N&&o&&r.jsxs(r.Fragment,{children:[r.jsx(cI,{}),r.jsx(so,{id:"terminal",defaultSize:"45%",minSize:"10%",maxSize:"80%",children:r.jsx(iI,{pid:o,initCmd:T,onClose:Je,className:"h-full"})})]})]}):r.jsx("div",{className:"grid flex-1 place-items-center",children:r.jsx(pt,{children:f("code_module.no_projects")})})})}function dI({open:e,onClose:n}){const{mutate:s}=HS(),o=at(),[l,c]=x.useState(""),[d,p]=x.useState(""),[m,g]=x.useState([]),[h,_]=x.useState(null),[v,k]=x.useState(""),[S,j]=x.useState(!1),[w,C]=x.useState(!1),E=async(R,T=!1)=>{j(!0),k("");try{const O=await xO.dirs(R||"~");p(O.path),c(O.path),_(O.parent),g(O.entries)}catch(O){const A=O.message;k(A),T||o.error(A)}finally{j(!1)}};x.useEffect(()=>{e&&!d&&E(l||"~",!0)},[e]);const N=async()=>{const R=l.trim();if(!R){o.error(f("add_project.path_required"));return}C(!0);try{const T=await aa.register(R);o.success(f("add_project.registered",{id:T.id})),await s("/projects"),c(""),n()}catch(T){o.error(T.message)}finally{C(!1)}};return r.jsx(Vn,{open:e,onClose:n,title:f("add_project.title"),description:f("add_project.subtitle"),footer:r.jsxs(r.Fragment,{children:[r.jsx(ge,{variant:"ghost",onClick:n,disabled:w,children:f("common.cancel")}),r.jsx(ge,{variant:"primary",onClick:N,loading:w,children:f("add_project.register")})]}),children:r.jsxs("div",{className:"space-y-3",children:[r.jsx(de,{label:f("add_project.path_label"),hint:f("add_project.path_hint"),children:r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ce,{autoFocus:!0,placeholder:f("add_project.path_placeholder"),value:l,onChange:R=>c(R.target.value),onKeyDown:R=>{R.key==="Enter"&&N()}}),r.jsxs(ge,{onClick:()=>E(l||"~"),disabled:S,children:[r.jsx(vd,{size:14})," ",f("add_project.search_btn")]})]})}),r.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[r.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[r.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:d||l||"~"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>E("~"),disabled:S,children:r.jsx(sA,{size:13})}),r.jsx(ge,{size:"sm",variant:"ghost",onClick:()=>h&&E(h),disabled:!h||S,children:".."})]})]}),r.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[S&&r.jsx(nt,{}),!S&&v&&r.jsx(pt,{children:f("add_project.browser_unavailable")}),!S&&!v&&m.length===0&&r.jsx(pt,{children:f("add_project.no_folders")}),!S&&!v&&m.map(R=>r.jsxs("button",{type:"button",onClick:()=>E(R),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[r.jsx(fx,{size:14,className:"text-muted-fg"}),r.jsx("span",{className:"truncate",children:R.split("/").pop()}),r.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:R})]},R))]})]})]})})}function fI({onPaired:e}){const[n,s]=x.useState(""),[o,l]=x.useState(pI()),[c,d]=x.useState(!1),[p,m]=x.useState(null);async function g(){const h=n.trim();if(!h){m(f("pairing.err_required"));return}d(!0),m(null);try{const _=await Sl.confirm({pairing_id:h,label:o.trim()||void 0});ro(_.token);try{localStorage.setItem(Rn.token,_.token)}catch{}e()}catch(_){m(mI(_)),d(!1)}}return r.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:r.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[r.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[r.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:r.jsx(mh,{size:20})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-base font-semibold",children:f("pairing.title")}),r.jsx("p",{className:"text-xs text-muted-fg",children:f("pairing.subtitle")})]})]}),r.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[r.jsx("li",{className:"font-medium text-foreground",children:f("pairing.steps_title")}),r.jsxs("li",{children:["1. ",f("pairing.step_1")]}),r.jsxs("li",{children:["2. ",f("pairing.step_2")]}),r.jsxs("li",{children:["3. ",f("pairing.step_3")]})]}),r.jsxs("form",{className:"space-y-3",onSubmit:h=>{h.preventDefault(),g()},children:[r.jsx(de,{label:f("pairing.code_label"),children:r.jsx(Ce,{value:n,onChange:h=>s(h.target.value),placeholder:f("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),r.jsx(de,{label:f("pairing.label_label"),hint:f("pairing.revoke_hint"),children:r.jsx(Ce,{value:o,onChange:h=>l(h.target.value),placeholder:f("pairing.label_ph")})}),p&&r.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:p}),r.jsx(ge,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:f(c?"pairing.linking":"pairing.submit")})]})]})})}function pI(){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 mI(e){if(e instanceof Mc){if(e.status===410)return f("pairing.err_expired");if(e.status===404||e.status===409)return f("pairing.err_unknown")}return f("pairing.err_generic")}function gI({...e}){return r.jsx(c2,{"data-slot":"sheet",...e})}function hI({...e}){return r.jsx(l2,{"data-slot":"sheet-portal",...e})}function xI({className:e,...n}){return r.jsx(JS,{"data-slot":"sheet-overlay",className:Et("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),...n})}function bI({className:e,children:n,side:s="right",showCloseButton:o=!0,...l}){return r.jsxs(hI,{children:[r.jsx(xI,{}),r.jsxs(r2,{"data-slot":"sheet-content","data-side":s,className:Et("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:[n,o&&r.jsxs(Mf,{"data-slot":"sheet-close",render:r.jsx($s,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[r.jsx(bo,{}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function _I({className:e,...n}){return r.jsx("div",{"data-slot":"sheet-header",className:Et("flex flex-col gap-0.5 p-4",e),...n})}function vI({className:e,...n}){return r.jsx(u2,{"data-slot":"sheet-title",className:Et("font-heading text-base font-medium text-foreground",e),...n})}function yI({className:e,...n}){return r.jsx(e2,{"data-slot":"sheet-description",className:Et("text-sm text-muted-foreground",e),...n})}function jI({value:e,projectPath:n,onPick:s}){const o=wI(e),l=o?kI(e):"",{data:c}=Qe(o?["/skills",n||""]:null,()=>Ki.list(n)),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:r.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[r.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:p.map(m=>r.jsx("li",{children:r.jsxs("button",{type:"button",onClick:()=>s(m.slug),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-accent hover:text-accent-foreground",children:[r.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",m.slug]}),r.jsx("span",{className:"truncate text-xs text-muted-foreground",children:m.description})]})},m.slug))}),r.jsx("div",{className:"border-t border-border px-3 py-1.5 text-[10px] text-muted-foreground",children:"Type a name to filter · click to insert · the skill body will be loaded for this turn."})]})}function wI(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function kI(e){const n=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return n?n[1]:""}function SI(){try{const e=localStorage.getItem(Rn.robyChat);if(!e)return[];const n=JSON.parse(e);return Array.isArray(n)?n.filter(s=>s&&Array.isArray(s.parts)&&!s.pending):[]}catch{return[]}}function CI({open:e,onOpenChange:n}){const s=ob(),o=at(),[l,c]=x.useState(SI),[d,p]=x.useState(""),[m,g]=x.useState(!1),[h,_]=x.useState(""),v=x.useRef(null);x.useEffect(()=>{const E=l.filter(N=>!N.pending);try{E.length?localStorage.setItem(Rn.robyChat,JSON.stringify(E)):localStorage.removeItem(Rn.robyChat)}catch{}},[l]);const k=()=>{if(!m){c([]),p("");try{localStorage.removeItem(Rn.robyChat)}catch{}}};x.useEffect(()=>()=>v.current?.abort(),[]);const S=()=>{v.current?.abort(),g(!1)},j=E=>c(N=>{const R=[...N],T=R[R.length-1];return T?.role==="assistant"&&(R[R.length-1]=E(T)),R}),w=async()=>{const E=d.trim();if(!E||m)return;const N=new Date().toISOString(),R=l.filter(z=>!z.pending).map(z=>({role:z.role,content:Fh(z)}));c(z=>[...z,{role:"user",parts:[{kind:"text",text:E}],ts:N},{role:"assistant",parts:[],ts:N,pending:!0}]),p(""),g(!0);const T=new AbortController;v.current=T;let O=!1;const A=z=>{if(z?.type==="error"){O=!0,o.error(z.error||"error"),c(B=>{const L=[...B],D=L[L.length-1];return D?.role==="assistant"&&D.pending&&L.pop(),L});return}j(B=>Cb(B,z))};try{await qS.stream(0,{prompt:E,previousMessages:R,model:h||void 0,channel:"web_sidebar"},A,T.signal),j(z=>({...z,pending:!1}))}catch(z){T.signal.aborted?j(B=>({...B,pending:!1,parts:[...B.parts,{kind:"text",text:f("project.chat.stopped_marker")}]})):O||(o.error(z.message),c(B=>{const L=[...B],D=L[L.length-1];return D?.role==="assistant"&&D.pending&&L.pop(),L}))}finally{v.current===T&&(v.current=null),g(!1)}},C=async E=>{try{await navigator.clipboard.writeText(E),o.info(f("project.chat.copied"))}catch{}};return r.jsx(gI,{open:e,onOpenChange:n,children:r.jsxs(bI,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[r.jsxs(_I,{className:"pr-12",children:[r.jsxs(vI,{className:"flex items-center gap-2",children:[r.jsx(gn,{size:18})," ",f("superagent.title",{persona:s}),r.jsx("span",{className:"text-xs font-normal text-muted-fg",children:f("superagent.badge")})]}),r.jsx(yI,{children:f("superagent.desc")})]}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:l.length===0?r.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:f("superagent.empty",{persona:s})}):r.jsx(Eb,{msgs:l,onCopy:C})}),r.jsx(W2,{msgs:l}),r.jsxs("div",{className:"border-t border-border p-3",children:[r.jsx("div",{className:"mb-1.5",children:r.jsx(jI,{value:d,onPick:E=>p(`/${E} `)})}),r.jsx(kb,{value:d,onValueChange:p,onSubmit:()=>void w(),onStop:S,busy:m,placeholder:f("superagent.placeholder"),footer:r.jsx(Sb,{value:h,onChange:_,disabled:m})}),r.jsx("div",{className:"mt-1.5 flex justify-end",children:r.jsxs($s,{size:"xs",variant:"ghost",onClick:k,disabled:m||l.length===0,children:[r.jsx(nn,{className:"size-3"})," ",f("superagent.new_chat")]})})]})]})})}function EI(){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 NI(){const[e,n]=x.useState({status:"loading"}),[s,o]=x.useState(0),l=x.useCallback(()=>{n({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||n({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 Sl.confirm({pairing_id:m,label:EI(),kind:"web"});ro(h.token);try{localStorage.setItem(Rn.token,h.token)}catch{}c||n({status:"ok"});return}catch{}}const g=p.get("token");if(g){ro(g);try{localStorage.setItem(Rn.token,g)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const h=localStorage.getItem(Rn.token);h&&ro(h)}catch{}try{const h=await fetch("/admin/web-token");if(h.ok){const _=await h.json();if(_?.token){ro(_.token);try{localStorage.setItem(Rn.token,_.token)}catch{}}}}catch{}if(!tb()){c||n({status:"unpaired"});return}try{await me.get("/projects"),c||n({status:"ok"})}catch(h){if(h instanceof Mc&&(h.status===401||h.status===403)){ro(null);try{localStorage.removeItem(Rn.token)}catch{}c||n({status:"unpaired"})}else c||n({status:"error",reason:String(h)})}})(),()=>{c=!0}},[s]),{...e,reload:l}}function RI(){const e=NI();return e.status==="loading"?r.jsx(xw,{text:f("daemon.connecting")}):e.status==="error"?r.jsx(xw,{mood:"sad",text:f("daemon.unreachable"),sub:`${f("daemon.unreachable_hint")}
627
-
628
- ${e.reason}`}):e.status==="unpaired"?r.jsx(fI,{onPaired:e.reload}):r.jsx(Hz,{children:r.jsx(A4,{delay:300,children:r.jsx(TI,{})})})}function TI(){const e=la(),n=Yn(),[s,o]=Uw(),{theme:l,toggle:c}=_x(),d=s.get("action")==="add-project",[p,m]=x.useState(!1),g=()=>{const h=new URLSearchParams(s);h.delete("action"),o(h,{replace:!0})};return r.jsx(Xz,{children:r.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[r.jsx(zO,{onSelect:h=>e(h),onOpenRoby:()=>m(!0)}),r.jsxs("main",{className:"m-2 ml-0 flex min-w-0 flex-1 flex-col overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[r.jsx(AI,{onToggleTheme:c,isDark:l==="dark",pathname:n.pathname}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:r.jsxs(Dw,{children:[r.jsx($t,{path:"/",element:r.jsx(Gz,{})}),r.jsx($t,{path:"/settings/*",element:r.jsx(L8,{})}),r.jsx($t,{path:"/m/voice/*",element:r.jsx(F8,{})}),r.jsx($t,{path:"/m/desktop/*",element:r.jsx(Q8,{})}),r.jsx($t,{path:"/m/deck/*",element:r.jsx(i7,{})}),r.jsx($t,{path:"/m/code/*",element:r.jsx(uI,{})}),r.jsx($t,{path:"/p/:pid/*",element:r.jsx(HP,{})}),r.jsx($t,{path:"*",element:r.jsx(DI,{})})]})})]}),r.jsx(dI,{open:d,onClose:g}),r.jsx(CI,{open:p,onOpenChange:m})]})})}function AI({onToggleTheme:e,isDark:n,pathname:s}){const{projects:o}=Oc(),l=Zz(),c=s.split("/").filter(Boolean),d=c[0]==="p"?o.find(S=>String(S.id)===c[1]):void 0,p=c[0]==="settings"?OI(c[1]):c[0]==="p"?zI(c[2]):"",m=c[0]==="p"&&c[1]==="0",g=d?.name||d?.path?.split("/").pop()||f("nav.project"),h=s==="/"?f("topbar.breadcrumb_root"):c[0]==="settings"?[f("topbar.breadcrumb_root"),f("nav.settings"),p].filter(Boolean).join(" › "):c[0]==="m"?[f("topbar.breadcrumb_root"),MI(c[1]),l].filter(Boolean).join(" › "):c[0]==="p"?m?[f("topbar.breadcrumb_root"),f("topbar.breadcrumb_base"),p].filter(Boolean).join(" › "):[f("topbar.breadcrumb_root"),f("topbar.breadcrumb_projects"),g,p].filter(Boolean).join(" › "):f("topbar.breadcrumb_root"),_=s==="/"?"":c[0]==="settings"?f("settings.subtitle"):c[0]==="p"?m?f("base.subtitle"):d?`${GS(d.kind)} · ${d.path}`:"":"",v=Kz(),k=Jz();return r.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[v&&r.jsx(Fz,{collapsed:v.collapsed,onToggle:v.toggle}),r.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[h,_&&r.jsxs("span",{className:"text-muted-fg/50",children:[" · ",_]})]}),k,r.jsx("button",{type:"button","data-testid":"theme-toggle",onClick:e,title:f(n?"topbar.light":"topbar.dark"),className:"shrink-0 rounded-md p-1.5 text-muted-fg hover:bg-accent hover:text-accent-fg",children:n?r.jsx(_A,{size:14}):r.jsx(uA,{size:14})})]})}function MI(e){switch(e){case"voice":return f("nav.modules.voice");case"desktop":return f("nav.modules.desktop");case"deck":return f("nav.modules.deck");case"code":return f("nav.modules.code");default:return e||""}}function OI(e){switch(e){case"super-agent":return f("settings.tabs.super_agent");case"engines":return f("settings.tabs.engines");case"telegram":return f("settings.tabs.telegram");case"devices":return f("settings.tabs.devices");case"appearance":return f("settings.appearance");case"config":case"advanced":return f("settings.tabs.advanced");case"identity":default:return e||""}}function zI(e){switch(e){case"chat":return f("project.nav.chat");case"telegram":return f("project.nav.telegram");case"agents":return f("project.nav.agents");case"routines":return f("project.nav.routines");case"tasks":return f("project.nav.tasks");case"mcps":return f("project.nav.mcps");case"config":return f("project.nav.config");case"workspaces":return f("base.workspaces_title");case"models":return f("settings.tabs.engines");case"agent-defaults":return f("base.defaults_title");case"sessions":return f("base.sessions_title");case"logs":return f("project.nav.logs");case"memories":return f("project.nav.memories");default:return""}}function xw({text:e,sub:n,mood:s="happy"}){return r.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:r.jsxs("div",{className:"flex flex-col items-center text-center",children:[r.jsx(k2,{mood:s,className:"mb-4 text-xs"}),r.jsx("div",{className:"text-foreground",children:e}),n&&r.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:n})]})})}function DI(){const e=la();return r.jsx(S2,{testId:"screen-not-found",mood:"confused",title:f("not_found.title"),titleClassName:"text-7xl",message:f("not_found.message"),action:r.jsx($s,{variant:"outline",onClick:()=>e("/"),children:f("not_found.home")})})}QN.createRoot(document.getElementById("root")).render(r.jsx(kc.StrictMode,{children:r.jsx(_T,{children:r.jsx(CA,{children:r.jsx(RI,{})})})}));
629
- //# sourceMappingURL=index-CQc_5t8F.js.map