@agentprojectcontext/apx 1.32.2 → 1.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/package.json +1 -1
  2. package/src/core/agent/prompts/action-discipline.md +12 -5
  3. package/src/core/agent/prompts/channels/telegram.md +9 -5
  4. package/src/core/stores/code-sessions.js +4 -1
  5. package/src/host/daemon/api/artifacts.js +25 -0
  6. package/src/host/daemon/api/code.js +14 -1
  7. package/src/host/daemon/api/exec.js +17 -2
  8. package/src/host/daemon/plugins/telegram/index.js +2 -14
  9. package/src/interfaces/web/dist/assets/index-7dVT2O1S.css +1 -0
  10. package/src/interfaces/web/dist/assets/index-DWsE_8Nz.js +602 -0
  11. package/src/interfaces/web/dist/assets/index-DWsE_8Nz.js.map +1 -0
  12. package/src/interfaces/web/dist/index.html +2 -2
  13. package/src/interfaces/web/package-lock.json +3 -3
  14. package/src/interfaces/web/src/App.tsx +3 -1
  15. package/src/interfaces/web/src/components/UiSelect.tsx +12 -2
  16. package/src/interfaces/web/src/components/code/CodeArtifactsTab.tsx +253 -111
  17. package/src/interfaces/web/src/components/code/CodeChangesTab.tsx +10 -8
  18. package/src/interfaces/web/src/components/code/CodeComposer.tsx +20 -17
  19. package/src/interfaces/web/src/components/code/CodeContextTab.tsx +43 -18
  20. package/src/interfaces/web/src/components/code/CodeFileTree.tsx +212 -0
  21. package/src/interfaces/web/src/components/code/CodeFileViewer.tsx +121 -0
  22. package/src/interfaces/web/src/components/code/CodeSessionList.tsx +30 -26
  23. package/src/interfaces/web/src/components/code/CodeSidePanel.tsx +23 -19
  24. package/src/interfaces/web/src/components/code/CodeTerminal.tsx +140 -0
  25. package/src/interfaces/web/src/components/common/TabLayout.tsx +3 -3
  26. package/src/interfaces/web/src/components/ui/chat-input.tsx +17 -6
  27. package/src/interfaces/web/src/hooks/useChat.ts +1 -0
  28. package/src/interfaces/web/src/hooks/useNavCollapseCtx.tsx +25 -1
  29. package/src/interfaces/web/src/i18n/es.ts +1 -1
  30. package/src/interfaces/web/src/lib/api/agents.ts +1 -1
  31. package/src/interfaces/web/src/lib/api/artifacts.ts +10 -0
  32. package/src/interfaces/web/src/lib/api/code.ts +4 -2
  33. package/src/interfaces/web/src/screens/modules/CodeScreen.tsx +423 -79
  34. package/src/interfaces/web/src/screens/project/ChatTab.tsx +7 -10
  35. package/src/core/util/text-similarity.js +0 -52
  36. package/src/interfaces/web/dist/assets/index-34U_Mp1M.css +0 -1
  37. package/src/interfaces/web/dist/assets/index-BkybwwRn.js +0 -570
  38. package/src/interfaces/web/dist/assets/index-BkybwwRn.js.map +0 -1
@@ -1,570 +0,0 @@
1
- function UE(e,n){for(var s=0;s<n.length;s++){const r=n[s];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const c=Object.getOwnPropertyDescriptor(r,i);c&&Object.defineProperty(e,i,c.get?c:{enumerable:!0,get:()=>r[i]})}}}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 i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const c of i)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&r(d)}).observe(document,{childList:!0,subtree:!0});function s(i){const c={};return i.integrity&&(c.integrity=i.integrity),i.referrerPolicy&&(c.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?c.credentials="include":i.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(i){if(i.ep)return;i.ep=!0;const c=s(i);fetch(i.href,c)}})();function rh(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var dp={exports:{}},ri={};/**
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 j0;function HE(){if(j0)return ri;j0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.fragment");function s(r,i,c){var d=null;if(c!==void 0&&(d=""+c),i.key!==void 0&&(d=""+i.key),"key"in i){c={};for(var f in i)f!=="key"&&(c[f]=i[f])}else c=i;return i=c.ref,{$$typeof:e,type:r,key:d,ref:i!==void 0?i:null,props:c}}return ri.Fragment=n,ri.jsx=s,ri.jsxs=s,ri}var S0;function qE(){return S0||(S0=1,dp.exports=HE()),dp.exports}var o=qE(),fp={exports:{}},We={};/**
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 w0;function VE(){if(w0)return We;w0=1;var e=Symbol.for("react.transitional.element"),n=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),d=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),y=Symbol.iterator;function S(I){return I===null||typeof I!="object"?null:(I=y&&I[y]||I["@@iterator"],typeof I=="function"?I:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,j={};function k(I,V,$){this.props=I,this.context=V,this.refs=j,this.updater=$||w}k.prototype.isReactComponent={},k.prototype.setState=function(I,V){if(typeof I!="object"&&typeof I!="function"&&I!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,I,V,"setState")},k.prototype.forceUpdate=function(I){this.updater.enqueueForceUpdate(this,I,"forceUpdate")};function E(){}E.prototype=k.prototype;function R(I,V,$){this.props=I,this.context=V,this.refs=j,this.updater=$||w}var N=R.prototype=new E;N.constructor=R,_(N,k.prototype),N.isPureReactComponent=!0;var M=Array.isArray;function A(){}var O={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function U(I,V,$){var W=$.ref;return{$$typeof:e,type:I,key:V,ref:W!==void 0?W:null,props:$}}function P(I,V){return U(I.type,V,I.props)}function B(I){return typeof I=="object"&&I!==null&&I.$$typeof===e}function D(I){var V={"=":"=0",":":"=2"};return"$"+I.replace(/[=:]/g,function($){return V[$]})}var H=/\/+/g;function Y(I,V){return typeof I=="object"&&I!==null&&I.key!=null?D(""+I.key):V.toString(36)}function Q(I){switch(I.status){case"fulfilled":return I.value;case"rejected":throw I.reason;default:switch(typeof I.status=="string"?I.then(A,A):(I.status="pending",I.then(function(V){I.status==="pending"&&(I.status="fulfilled",I.value=V)},function(V){I.status==="pending"&&(I.status="rejected",I.reason=V)})),I.status){case"fulfilled":return I.value;case"rejected":throw I.reason}}throw I}function q(I,V,$,W,oe){var ce=typeof I;(ce==="undefined"||ce==="boolean")&&(I=null);var se=!1;if(I===null)se=!0;else switch(ce){case"bigint":case"string":case"number":se=!0;break;case"object":switch(I.$$typeof){case e:case n:se=!0;break;case h:return se=I._init,q(se(I._payload),V,$,W,oe)}}if(se)return oe=oe(I),se=W===""?"."+Y(I,0):W,M(oe)?($="",se!=null&&($=se.replace(H,"$&/")+"/"),q(oe,V,$,"",function(ke){return ke})):oe!=null&&(B(oe)&&(oe=P(oe,$+(oe.key==null||I&&I.key===oe.key?"":(""+oe.key).replace(H,"$&/")+"/")+se)),V.push(oe)),1;se=0;var ie=W===""?".":W+":";if(M(I))for(var te=0;te<I.length;te++)W=I[te],ce=ie+Y(W,te),se+=q(W,V,$,ce,oe);else if(te=S(I),typeof te=="function")for(I=te.call(I),te=0;!(W=I.next()).done;)W=W.value,ce=ie+Y(W,te++),se+=q(W,V,$,ce,oe);else if(ce==="object"){if(typeof I.then=="function")return q(Q(I),V,$,W,oe);throw V=String(I),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(I).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return se}function X(I,V,$){if(I==null)return I;var W=[],oe=0;return q(I,W,"","",function(ce){return V.call($,ce,oe++)}),W}function Z(I){if(I._status===-1){var V=I._result;V=V(),V.then(function($){(I._status===0||I._status===-1)&&(I._status=1,I._result=$)},function($){(I._status===0||I._status===-1)&&(I._status=2,I._result=$)}),I._status===-1&&(I._status=0,I._result=V)}if(I._status===1)return I._result.default;throw I._result}var G=typeof reportError=="function"?reportError:function(I){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof I=="object"&&I!==null&&typeof I.message=="string"?String(I.message):String(I),error:I});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",I);return}console.error(I)},K={map:X,forEach:function(I,V,$){X(I,function(){V.apply(this,arguments)},$)},count:function(I){var V=0;return X(I,function(){V++}),V},toArray:function(I){return X(I,function(V){return V})||[]},only:function(I){if(!B(I))throw Error("React.Children.only expected to receive a single React element child.");return I}};return We.Activity=x,We.Children=K,We.Component=k,We.Fragment=s,We.Profiler=i,We.PureComponent=R,We.StrictMode=r,We.Suspense=p,We.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,We.__COMPILER_RUNTIME={__proto__:null,c:function(I){return O.H.useMemoCache(I)}},We.cache=function(I){return function(){return I.apply(null,arguments)}},We.cacheSignal=function(){return null},We.cloneElement=function(I,V,$){if(I==null)throw Error("The argument must be a React element, but you passed "+I+".");var W=_({},I.props),oe=I.key;if(V!=null)for(ce in V.key!==void 0&&(oe=""+V.key),V)!L.call(V,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&V.ref===void 0||(W[ce]=V[ce]);var ce=arguments.length-2;if(ce===1)W.children=$;else if(1<ce){for(var se=Array(ce),ie=0;ie<ce;ie++)se[ie]=arguments[ie+2];W.children=se}return U(I.type,oe,W)},We.createContext=function(I){return I={$$typeof:d,_currentValue:I,_currentValue2:I,_threadCount:0,Provider:null,Consumer:null},I.Provider=I,I.Consumer={$$typeof:c,_context:I},I},We.createElement=function(I,V,$){var W,oe={},ce=null;if(V!=null)for(W in V.key!==void 0&&(ce=""+V.key),V)L.call(V,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(oe[W]=V[W]);var se=arguments.length-2;if(se===1)oe.children=$;else if(1<se){for(var ie=Array(se),te=0;te<se;te++)ie[te]=arguments[te+2];oe.children=ie}if(I&&I.defaultProps)for(W in se=I.defaultProps,se)oe[W]===void 0&&(oe[W]=se[W]);return U(I,ce,oe)},We.createRef=function(){return{current:null}},We.forwardRef=function(I){return{$$typeof:f,render:I}},We.isValidElement=B,We.lazy=function(I){return{$$typeof:h,_payload:{_status:-1,_result:I},_init:Z}},We.memo=function(I,V){return{$$typeof:m,type:I,compare:V===void 0?null:V}},We.startTransition=function(I){var V=O.T,$={};O.T=$;try{var W=I(),oe=O.S;oe!==null&&oe($,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(A,G)}catch(ce){G(ce)}finally{V!==null&&$.types!==null&&(V.types=$.types),O.T=V}},We.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},We.use=function(I){return O.H.use(I)},We.useActionState=function(I,V,$){return O.H.useActionState(I,V,$)},We.useCallback=function(I,V){return O.H.useCallback(I,V)},We.useContext=function(I){return O.H.useContext(I)},We.useDebugValue=function(){},We.useDeferredValue=function(I,V){return O.H.useDeferredValue(I,V)},We.useEffect=function(I,V){return O.H.useEffect(I,V)},We.useEffectEvent=function(I){return O.H.useEffectEvent(I)},We.useId=function(){return O.H.useId()},We.useImperativeHandle=function(I,V,$){return O.H.useImperativeHandle(I,V,$)},We.useInsertionEffect=function(I,V){return O.H.useInsertionEffect(I,V)},We.useLayoutEffect=function(I,V){return O.H.useLayoutEffect(I,V)},We.useMemo=function(I,V){return O.H.useMemo(I,V)},We.useOptimistic=function(I,V){return O.H.useOptimistic(I,V)},We.useReducer=function(I,V,$){return O.H.useReducer(I,V,$)},We.useRef=function(I){return O.H.useRef(I)},We.useState=function(I){return O.H.useState(I)},We.useSyncExternalStore=function(I,V,$){return O.H.useSyncExternalStore(I,V,$)},We.useTransition=function(){return O.H.useTransition()},We.version="19.2.7",We}var C0;function Ki(){return C0||(C0=1,fp.exports=VE()),fp.exports}var b=Ki();const Qi=rh(b),$E=UE({__proto__:null,default:Qi},[b]);var mp={exports:{}},oi={},pp={exports:{}},gp={};/**
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 E0;function GE(){return E0||(E0=1,(function(e){function n(q,X){var Z=q.length;q.push(X);e:for(;0<Z;){var G=Z-1>>>1,K=q[G];if(0<i(K,X))q[G]=X,q[Z]=K,Z=G;else break e}}function s(q){return q.length===0?null:q[0]}function r(q){if(q.length===0)return null;var X=q[0],Z=q.pop();if(Z!==X){q[0]=Z;e:for(var G=0,K=q.length,I=K>>>1;G<I;){var V=2*(G+1)-1,$=q[V],W=V+1,oe=q[W];if(0>i($,Z))W<K&&0>i(oe,$)?(q[G]=oe,q[W]=Z,G=W):(q[G]=$,q[V]=Z,G=V);else if(W<K&&0>i(oe,Z))q[G]=oe,q[W]=Z,G=W;else break e}}return X}function i(q,X){var Z=q.sortIndex-X.sortIndex;return Z!==0?Z:q.id-X.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,f=d.now();e.unstable_now=function(){return d.now()-f}}var p=[],m=[],h=1,x=null,y=3,S=!1,w=!1,_=!1,j=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function N(q){for(var X=s(m);X!==null;){if(X.callback===null)r(m);else if(X.startTime<=q)r(m),X.sortIndex=X.expirationTime,n(p,X);else break;X=s(m)}}function M(q){if(_=!1,N(q),!w)if(s(p)!==null)w=!0,A||(A=!0,D());else{var X=s(m);X!==null&&Q(M,X.startTime-q)}}var A=!1,O=-1,L=5,U=-1;function P(){return j?!0:!(e.unstable_now()-U<L)}function B(){if(j=!1,A){var q=e.unstable_now();U=q;var X=!0;try{e:{w=!1,_&&(_=!1,E(O),O=-1),S=!0;var Z=y;try{t:{for(N(q),x=s(p);x!==null&&!(x.expirationTime>q&&P());){var G=x.callback;if(typeof G=="function"){x.callback=null,y=x.priorityLevel;var K=G(x.expirationTime<=q);if(q=e.unstable_now(),typeof K=="function"){x.callback=K,N(q),X=!0;break t}x===s(p)&&r(p),N(q)}else r(p);x=s(p)}if(x!==null)X=!0;else{var I=s(m);I!==null&&Q(M,I.startTime-q),X=!1}}break e}finally{x=null,y=Z,S=!1}X=void 0}}finally{X?D():A=!1}}}var D;if(typeof R=="function")D=function(){R(B)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,Y=H.port2;H.port1.onmessage=B,D=function(){Y.postMessage(null)}}else D=function(){k(B,0)};function Q(q,X){O=k(function(){q(e.unstable_now())},X)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(q){q.callback=null},e.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<q?Math.floor(1e3/q):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(q){switch(y){case 1:case 2:case 3:var X=3;break;default:X=y}var Z=y;y=X;try{return q()}finally{y=Z}},e.unstable_requestPaint=function(){j=!0},e.unstable_runWithPriority=function(q,X){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var Z=y;y=q;try{return X()}finally{y=Z}},e.unstable_scheduleCallback=function(q,X,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,q){case 1:var K=-1;break;case 2:K=250;break;case 5:K=1073741823;break;case 4:K=1e4;break;default:K=5e3}return K=Z+K,q={id:h++,callback:X,priorityLevel:q,startTime:Z,expirationTime:K,sortIndex:-1},Z>G?(q.sortIndex=Z,n(m,q),s(p)===null&&q===s(m)&&(_?(E(O),O=-1):_=!0,Q(M,Z-G))):(q.sortIndex=K,n(p,q),w||S||(w=!0,A||(A=!0,D()))),q},e.unstable_shouldYield=P,e.unstable_wrapCallback=function(q){var X=y;return function(){var Z=y;y=X;try{return q.apply(this,arguments)}finally{y=Z}}}})(gp)),gp}var k0;function YE(){return k0||(k0=1,pp.exports=GE()),pp.exports}var hp={exports:{}},Mn={};/**
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 N0;function FE(){if(N0)return Mn;N0=1;var e=Ki();function n(p){var m="https://react.dev/errors/"+p;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var h=2;h<arguments.length;h++)m+="&args[]="+encodeURIComponent(arguments[h])}return"Minified React error #"+p+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var r={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},i=Symbol.for("react.portal");function c(p,m,h){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:x==null?null:""+x,children:p,containerInfo:m,implementation:h}}var d=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(p,m){if(p==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Mn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Mn.createPortal=function(p,m){var h=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(n(299));return c(p,m,null,h)},Mn.flushSync=function(p){var m=d.T,h=r.p;try{if(d.T=null,r.p=2,p)return p()}finally{d.T=m,r.p=h,r.d.f()}},Mn.preconnect=function(p,m){typeof p=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(p,m))},Mn.prefetchDNS=function(p){typeof p=="string"&&r.d.D(p)},Mn.preinit=function(p,m){if(typeof p=="string"&&m&&typeof m.as=="string"){var h=m.as,x=f(h,m.crossOrigin),y=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;h==="style"?r.d.S(p,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:x,integrity:y,fetchPriority:S}):h==="script"&&r.d.X(p,{crossOrigin:x,integrity:y,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Mn.preinitModule=function(p,m){if(typeof p=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var h=f(m.as,m.crossOrigin);r.d.M(p,{crossOrigin:h,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(p)},Mn.preload=function(p,m){if(typeof p=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var h=m.as,x=f(h,m.crossOrigin);r.d.L(p,h,{crossOrigin:x,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Mn.preloadModule=function(p,m){if(typeof p=="string")if(m){var h=f(m.as,m.crossOrigin);r.d.m(p,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:h,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(p)},Mn.requestFormReset=function(p){r.d.r(p)},Mn.unstable_batchedUpdates=function(p,m){return p(m)},Mn.useFormState=function(p,m,h){return d.H.useFormState(p,m,h)},Mn.useFormStatus=function(){return d.H.useHostTransitionStatus()},Mn.version="19.2.7",Mn}var R0;function U_(){if(R0)return hp.exports;R0=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(),hp.exports=FE(),hp.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 T0;function XE(){if(T0)return oi;T0=1;var e=YE(),n=Ki(),s=U_();function r(t){var a="https://react.dev/errors/"+t;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)a+="&args[]="+encodeURIComponent(arguments[l])}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 i(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function c(t){var a=t,l=t;if(t.alternate)for(;a.return;)a=a.return;else{t=a;do a=t,(a.flags&4098)!==0&&(l=a.return),t=a.return;while(t)}return a.tag===3?l: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 f(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 p(t){if(c(t)!==t)throw Error(r(188))}function m(t){var a=t.alternate;if(!a){if(a=c(t),a===null)throw Error(r(188));return a!==t?null:t}for(var l=t,u=a;;){var g=l.return;if(g===null)break;var v=g.alternate;if(v===null){if(u=g.return,u!==null){l=u;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===l)return p(g),t;if(v===u)return p(g),a;v=v.sibling}throw Error(r(188))}if(l.return!==u.return)l=g,u=v;else{for(var T=!1,z=g.child;z;){if(z===l){T=!0,l=g,u=v;break}if(z===u){T=!0,u=g,l=v;break}z=z.sibling}if(!T){for(z=v.child;z;){if(z===l){T=!0,l=v,u=g;break}if(z===u){T=!0,u=v,l=g;break}z=z.sibling}if(!T)throw Error(r(189))}}if(l.alternate!==u)throw Error(r(190))}if(l.tag!==3)throw Error(r(188));return l.stateNode.current===l?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 x=Object.assign,y=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),R=Symbol.for("react.context"),N=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),P=Symbol.for("react.memo_cache_sentinel"),B=Symbol.iterator;function D(t){return t===null||typeof t!="object"?null:(t=B&&t[B]||t["@@iterator"],typeof t=="function"?t:null)}var H=Symbol.for("react.client.reference");function Y(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 _:return"Fragment";case k:return"Profiler";case j:return"StrictMode";case M:return"Suspense";case A:return"SuspenseList";case U:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case R:return t.displayName||"Context";case E:return(t._context.displayName||"Context")+".Consumer";case N:var a=t.render;return t=t.displayName,t||(t=a.displayName||a.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case O:return a=t.displayName||null,a!==null?a:Y(t.type)||"Memo";case L:a=t._payload,t=t._init;try{return Y(t(a))}catch{}}return null}var Q=Array.isArray,q=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},G=[],K=-1;function I(t){return{current:t}}function V(t){0>K||(t.current=G[K],G[K]=null,K--)}function $(t,a){K++,G[K]=t.current,t.current=a}var W=I(null),oe=I(null),ce=I(null),se=I(null);function ie(t,a){switch($(ce,a),$(oe,t),$(W,null),a.nodeType){case 9:case 11:t=(t=a.documentElement)&&(t=t.namespaceURI)?Gy(t):0;break;default:if(t=a.tagName,a=a.namespaceURI)a=Gy(a),t=Yy(a,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}V(W),$(W,t)}function te(){V(W),V(oe),V(ce)}function ke(t){t.memoizedState!==null&&$(se,t);var a=W.current,l=Yy(a,t.type);a!==l&&($(oe,t),$(W,l))}function $e(t){oe.current===t&&(V(W),V(oe)),se.current===t&&(V(se),ti._currentValue=Z)}var be,Se;function Ee(t){if(be===void 0)try{throw Error()}catch(l){var a=l.stack.trim().match(/\n( *(at )?)/);be=a&&a[1]||"",Se=-1<l.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+be+t+Se}var ze=!1;function De(t,a){if(!t||ze)return"";ze=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(ue){var re=ue}Reflect.construct(t,[],pe)}else{try{pe.call()}catch(ue){re=ue}t.call(pe.prototype)}}else{try{throw Error()}catch(ue){re=ue}(pe=t())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(ue){if(ue&&re&&typeof ue.stack=="string")return[ue.stack,re.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=u.DetermineComponentFrameRoot(),T=v[0],z=v[1];if(T&&z){var F=T.split(`
44
- `),ae=z.split(`
45
- `);for(g=u=0;u<F.length&&!F[u].includes("DetermineComponentFrameRoot");)u++;for(;g<ae.length&&!ae[g].includes("DetermineComponentFrameRoot");)g++;if(u===F.length||g===ae.length)for(u=F.length-1,g=ae.length-1;1<=u&&0<=g&&F[u]!==ae[g];)g--;for(;1<=u&&0<=g;u--,g--)if(F[u]!==ae[g]){if(u!==1||g!==1)do if(u--,g--,0>g||F[u]!==ae[g]){var de=`
46
- `+F[u].replace(" at new "," at ");return t.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",t.displayName)),de}while(1<=u&&0<=g);break}}}finally{ze=!1,Error.prepareStackTrace=l}return(l=t?t.displayName||t.name:"")?Ee(l):""}function xe(t,a){switch(t.tag){case 26:case 27:case 5:return Ee(t.type);case 16:return Ee("Lazy");case 13:return t.child!==a&&a!==null?Ee("Suspense Fallback"):Ee("Suspense");case 19:return Ee("SuspenseList");case 0:case 15:return De(t.type,!1);case 11:return De(t.type.render,!1);case 1:return De(t.type,!0);case 31:return Ee("Activity");default:return""}}function Ne(t){try{var a="",l=null;do a+=xe(t,l),l=t,t=t.return;while(t);return a}catch(u){return`
47
- Error generating stack: `+u.message+`
48
- `+u.stack}}var _e=Object.prototype.hasOwnProperty,Le=e.unstable_scheduleCallback,Ge=e.unstable_cancelCallback,qe=e.unstable_shouldYield,Oe=e.unstable_requestPaint,ve=e.unstable_now,le=e.unstable_getCurrentPriorityLevel,ye=e.unstable_ImmediatePriority,je=e.unstable_UserBlockingPriority,Be=e.unstable_NormalPriority,Ze=e.unstable_LowPriority,_t=e.unstable_IdlePriority,Ht=e.log,vt=e.unstable_setDisableYieldValue,ut=null,it=null;function Et(t){if(typeof Ht=="function"&&vt(t),it&&typeof it.setStrictMode=="function")try{it.setStrictMode(ut,t)}catch{}}var Bt=Math.clz32?Math.clz32:dt,pa=Math.log,gn=Math.LN2;function dt(t){return t>>>=0,t===0?32:31-(pa(t)/gn|0)|0}var Tt=256,Xt=262144,yt=4194304;function Wt(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 Vt(t,a,l){var u=t.pendingLanes;if(u===0)return 0;var g=0,v=t.suspendedLanes,T=t.pingedLanes;t=t.warmLanes;var z=u&134217727;return z!==0?(u=z&~v,u!==0?g=Wt(u):(T&=z,T!==0?g=Wt(T):l||(l=z&~t,l!==0&&(g=Wt(l))))):(z=u&~v,z!==0?g=Wt(z):T!==0?g=Wt(T):l||(l=u&~t,l!==0&&(g=Wt(l)))),g===0?0:a!==0&&a!==g&&(a&v)===0&&(v=g&-g,l=a&-a,v>=l||v===32&&(l&4194048)!==0)?a:g}function rn(t,a){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&a)===0}function Tn(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 qn(){var t=yt;return yt<<=1,(yt&62914560)===0&&(yt=4194304),t}function ta(t){for(var a=[],l=0;31>l;l++)a.push(t);return a}function Vn(t,a){t.pendingLanes|=a,a!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function ts(t,a,l,u,g,v){var T=t.pendingLanes;t.pendingLanes=l,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=l,t.entangledLanes&=l,t.errorRecoveryDisabledLanes&=l,t.shellSuspendCounter=0;var z=t.entanglements,F=t.expirationTimes,ae=t.hiddenUpdates;for(l=T&~l;0<l;){var de=31-Bt(l),pe=1<<de;z[de]=0,F[de]=-1;var re=ae[de];if(re!==null)for(ae[de]=null,de=0;de<re.length;de++){var ue=re[de];ue!==null&&(ue.lane&=-536870913)}l&=~pe}u!==0&&An(t,u,0),v!==0&&g===0&&t.tag!==0&&(t.suspendedLanes|=v&~(T&~a))}function An(t,a,l){t.pendingLanes|=a,t.suspendedLanes&=~a;var u=31-Bt(a);t.entangledLanes|=a,t.entanglements[u]=t.entanglements[u]|1073741824|l&261930}function na(t,a){var l=t.entangledLanes|=a;for(t=t.entanglements;l;){var u=31-Bt(l),g=1<<u;g&a|t[u]&a&&(t[u]|=a),l&=~g}}function Ta(t,a){var l=a&-a;return l=(l&42)!==0?1:ns(l),(l&(t.suspendedLanes|a))!==0?0:l}function ns(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 at(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function At(){var t=X.p;return t!==0?t:(t=window.event,t===void 0?32:g0(t.type))}function yn(t,a){var l=X.p;try{return X.p=t,a()}finally{X.p=l}}var en=Math.random().toString(36).slice(2),kt="__reactFiber$"+en,un="__reactProps$"+en,_r="__reactContainer$"+en,ic="__reactEvents$"+en,R2="__reactListeners$"+en,T2="__reactHandles$"+en,Mx="__reactResources$"+en,hl="__reactMarker$"+en;function nf(t){delete t[kt],delete t[un],delete t[ic],delete t[R2],delete t[T2]}function ao(t){var a=t[kt];if(a)return a;for(var l=t.parentNode;l;){if(a=l[_r]||l[kt]){if(l=a.alternate,a.child!==null||l!==null&&l.child!==null)for(t=Wy(t);t!==null;){if(l=t[kt])return l;t=Wy(t)}return a}t=l,l=t.parentNode}return null}function so(t){if(t=t[kt]||t[_r]){var a=t.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return t}return null}function xl(t){var a=t.tag;if(a===5||a===26||a===27||a===6)return t.stateNode;throw Error(r(33))}function ro(t){var a=t[Mx];return a||(a=t[Mx]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function xn(t){t[hl]=!0}var Ox=new Set,zx={};function jr(t,a){oo(t,a),oo(t+"Capture",a)}function oo(t,a){for(zx[t]=a,t=0;t<a.length;t++)Ox.add(a[t])}var A2=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]*$"),Dx={},Lx={};function M2(t){return _e.call(Lx,t)?!0:_e.call(Dx,t)?!1:A2.test(t)?Lx[t]=!0:(Dx[t]=!0,!1)}function cc(t,a,l){if(M2(a))if(l===null)t.removeAttribute(a);else{switch(typeof l){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,""+l)}}function uc(t,a,l){if(l===null)t.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(a);return}t.setAttribute(a,""+l)}}function as(t,a,l,u){if(u===null)t.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(l);return}t.setAttributeNS(a,l,""+u)}}function ga(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Px(t){var a=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function O2(t,a,l){var u=Object.getOwnPropertyDescriptor(t.constructor.prototype,a);if(!t.hasOwnProperty(a)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var g=u.get,v=u.set;return Object.defineProperty(t,a,{configurable:!0,get:function(){return g.call(this)},set:function(T){l=""+T,v.call(this,T)}}),Object.defineProperty(t,a,{enumerable:u.enumerable}),{getValue:function(){return l},setValue:function(T){l=""+T},stopTracking:function(){t._valueTracker=null,delete t[a]}}}}function af(t){if(!t._valueTracker){var a=Px(t)?"checked":"value";t._valueTracker=O2(t,a,""+t[a])}}function Bx(t){if(!t)return!1;var a=t._valueTracker;if(!a)return!0;var l=a.getValue(),u="";return t&&(u=Px(t)?t.checked?"true":"false":t.value),t=u,t!==l?(a.setValue(t),!0):!1}function dc(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 z2=/[\n"\\]/g;function ha(t){return t.replace(z2,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function sf(t,a,l,u,g,v,T,z){t.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?t.type=T:t.removeAttribute("type"),a!=null?T==="number"?(a===0&&t.value===""||t.value!=a)&&(t.value=""+ga(a)):t.value!==""+ga(a)&&(t.value=""+ga(a)):T!=="submit"&&T!=="reset"||t.removeAttribute("value"),a!=null?rf(t,T,ga(a)):l!=null?rf(t,T,ga(l)):u!=null&&t.removeAttribute("value"),g==null&&v!=null&&(t.defaultChecked=!!v),g!=null&&(t.checked=g&&typeof g!="function"&&typeof g!="symbol"),z!=null&&typeof z!="function"&&typeof z!="symbol"&&typeof z!="boolean"?t.name=""+ga(z):t.removeAttribute("name")}function Ix(t,a,l,u,g,v,T,z){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(t.type=v),a!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){af(t);return}l=l!=null?""+ga(l):"",a=a!=null?""+ga(a):l,z||a===t.value||(t.value=a),t.defaultValue=a}u=u??g,u=typeof u!="function"&&typeof u!="symbol"&&!!u,t.checked=z?t.checked:!!u,t.defaultChecked=!!u,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(t.name=T),af(t)}function rf(t,a,l){a==="number"&&dc(t.ownerDocument)===t||t.defaultValue===""+l||(t.defaultValue=""+l)}function lo(t,a,l,u){if(t=t.options,a){a={};for(var g=0;g<l.length;g++)a["$"+l[g]]=!0;for(l=0;l<t.length;l++)g=a.hasOwnProperty("$"+t[l].value),t[l].selected!==g&&(t[l].selected=g),g&&u&&(t[l].defaultSelected=!0)}else{for(l=""+ga(l),a=null,g=0;g<t.length;g++){if(t[g].value===l){t[g].selected=!0,u&&(t[g].defaultSelected=!0);return}a!==null||t[g].disabled||(a=t[g])}a!==null&&(a.selected=!0)}}function Ux(t,a,l){if(a!=null&&(a=""+ga(a),a!==t.value&&(t.value=a),l==null)){t.defaultValue!==a&&(t.defaultValue=a);return}t.defaultValue=l!=null?""+ga(l):""}function Hx(t,a,l,u){if(a==null){if(u!=null){if(l!=null)throw Error(r(92));if(Q(u)){if(1<u.length)throw Error(r(93));u=u[0]}l=u}l==null&&(l=""),a=l}l=ga(a),t.defaultValue=l,u=t.textContent,u===l&&u!==""&&u!==null&&(t.value=u),af(t)}function io(t,a){if(a){var l=t.firstChild;if(l&&l===t.lastChild&&l.nodeType===3){l.nodeValue=a;return}}t.textContent=a}var D2=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 qx(t,a,l){var u=a.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?u?t.setProperty(a,""):a==="float"?t.cssFloat="":t[a]="":u?t.setProperty(a,l):typeof l!="number"||l===0||D2.has(a)?a==="float"?t.cssFloat=l:t[a]=(""+l).trim():t[a]=l+"px"}function Vx(t,a,l){if(a!=null&&typeof a!="object")throw Error(r(62));if(t=t.style,l!=null){for(var u in l)!l.hasOwnProperty(u)||a!=null&&a.hasOwnProperty(u)||(u.indexOf("--")===0?t.setProperty(u,""):u==="float"?t.cssFloat="":t[u]="");for(var g in a)u=a[g],a.hasOwnProperty(g)&&l[g]!==u&&qx(t,g,u)}else for(var v in a)a.hasOwnProperty(v)&&qx(t,v,a[v])}function of(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 L2=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"]]),P2=/^[\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 fc(t){return P2.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function ss(){}var lf=null;function cf(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var co=null,uo=null;function $x(t){var a=so(t);if(a&&(t=a.stateNode)){var l=t[un]||null;e:switch(t=a.stateNode,a.type){case"input":if(sf(t,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),a=l.name,l.type==="radio"&&a!=null){for(l=t;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+ha(""+a)+'"][type="radio"]'),a=0;a<l.length;a++){var u=l[a];if(u!==t&&u.form===t.form){var g=u[un]||null;if(!g)throw Error(r(90));sf(u,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(a=0;a<l.length;a++)u=l[a],u.form===t.form&&Bx(u)}break e;case"textarea":Ux(t,l.value,l.defaultValue);break e;case"select":a=l.value,a!=null&&lo(t,!!l.multiple,a,!1)}}}var uf=!1;function Gx(t,a,l){if(uf)return t(a,l);uf=!0;try{var u=t(a);return u}finally{if(uf=!1,(co!==null||uo!==null)&&(Wc(),co&&(a=co,t=uo,uo=co=null,$x(a),t)))for(a=0;a<t.length;a++)$x(t[a])}}function bl(t,a){var l=t.stateNode;if(l===null)return null;var u=l[un]||null;if(u===null)return null;l=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(l&&typeof l!="function")throw Error(r(231,a,typeof l));return l}var rs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),df=!1;if(rs)try{var vl={};Object.defineProperty(vl,"passive",{get:function(){df=!0}}),window.addEventListener("test",vl,vl),window.removeEventListener("test",vl,vl)}catch{df=!1}var Os=null,ff=null,mc=null;function Yx(){if(mc)return mc;var t,a=ff,l=a.length,u,g="value"in Os?Os.value:Os.textContent,v=g.length;for(t=0;t<l&&a[t]===g[t];t++);var T=l-t;for(u=1;u<=T&&a[l-u]===g[v-u];u++);return mc=g.slice(t,1<u?1-u:void 0)}function pc(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 gc(){return!0}function Fx(){return!1}function $n(t){function a(l,u,g,v,T){this._reactName=l,this._targetInst=g,this.type=u,this.nativeEvent=v,this.target=T,this.currentTarget=null;for(var z in t)t.hasOwnProperty(z)&&(l=t[z],this[z]=l?l(v):v[z]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?gc:Fx,this.isPropagationStopped=Fx,this}return x(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=gc)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=gc)},persist:function(){},isPersistent:gc}),a}var Sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hc=$n(Sr),yl=x({},Sr,{view:0,detail:0}),B2=$n(yl),mf,pf,_l,xc=x({},yl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:hf,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!==_l&&(_l&&t.type==="mousemove"?(mf=t.screenX-_l.screenX,pf=t.screenY-_l.screenY):pf=mf=0,_l=t),mf)},movementY:function(t){return"movementY"in t?t.movementY:pf}}),Xx=$n(xc),I2=x({},xc,{dataTransfer:0}),U2=$n(I2),H2=x({},yl,{relatedTarget:0}),gf=$n(H2),q2=x({},Sr,{animationName:0,elapsedTime:0,pseudoElement:0}),V2=$n(q2),$2=x({},Sr,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),G2=$n($2),Y2=x({},Sr,{data:0}),Kx=$n(Y2),F2={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},X2={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"},K2={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Q2(t){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(t):(t=K2[t])?!!a[t]:!1}function hf(){return Q2}var Z2=x({},yl,{key:function(t){if(t.key){var a=F2[t.key]||t.key;if(a!=="Unidentified")return a}return t.type==="keypress"?(t=pc(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?X2[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:hf,charCode:function(t){return t.type==="keypress"?pc(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?pc(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),J2=$n(Z2),W2=x({},xc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qx=$n(W2),eC=x({},yl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:hf}),tC=$n(eC),nC=x({},Sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),aC=$n(nC),sC=x({},xc,{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}),rC=$n(sC),oC=x({},Sr,{newState:0,oldState:0}),lC=$n(oC),iC=[9,13,27,32],xf=rs&&"CompositionEvent"in window,jl=null;rs&&"documentMode"in document&&(jl=document.documentMode);var cC=rs&&"TextEvent"in window&&!jl,Zx=rs&&(!xf||jl&&8<jl&&11>=jl),Jx=" ",Wx=!1;function eb(t,a){switch(t){case"keyup":return iC.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tb(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var fo=!1;function uC(t,a){switch(t){case"compositionend":return tb(a);case"keypress":return a.which!==32?null:(Wx=!0,Jx);case"textInput":return t=a.data,t===Jx&&Wx?null:t;default:return null}}function dC(t,a){if(fo)return t==="compositionend"||!xf&&eb(t,a)?(t=Yx(),mc=ff=Os=null,fo=!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 Zx&&a.locale!=="ko"?null:a.data;default:return null}}var fC={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 nb(t){var a=t&&t.nodeName&&t.nodeName.toLowerCase();return a==="input"?!!fC[t.type]:a==="textarea"}function ab(t,a,l,u){co?uo?uo.push(u):uo=[u]:co=u,a=ou(a,"onChange"),0<a.length&&(l=new hc("onChange","change",null,l,u),t.push({event:l,listeners:a}))}var Sl=null,wl=null;function mC(t){Iy(t,0)}function bc(t){var a=xl(t);if(Bx(a))return t}function sb(t,a){if(t==="change")return a}var rb=!1;if(rs){var bf;if(rs){var vf="oninput"in document;if(!vf){var ob=document.createElement("div");ob.setAttribute("oninput","return;"),vf=typeof ob.oninput=="function"}bf=vf}else bf=!1;rb=bf&&(!document.documentMode||9<document.documentMode)}function lb(){Sl&&(Sl.detachEvent("onpropertychange",ib),wl=Sl=null)}function ib(t){if(t.propertyName==="value"&&bc(wl)){var a=[];ab(a,wl,t,cf(t)),Gx(mC,a)}}function pC(t,a,l){t==="focusin"?(lb(),Sl=a,wl=l,Sl.attachEvent("onpropertychange",ib)):t==="focusout"&&lb()}function gC(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return bc(wl)}function hC(t,a){if(t==="click")return bc(a)}function xC(t,a){if(t==="input"||t==="change")return bc(a)}function bC(t,a){return t===a&&(t!==0||1/t===1/a)||t!==t&&a!==a}var aa=typeof Object.is=="function"?Object.is:bC;function Cl(t,a){if(aa(t,a))return!0;if(typeof t!="object"||t===null||typeof a!="object"||a===null)return!1;var l=Object.keys(t),u=Object.keys(a);if(l.length!==u.length)return!1;for(u=0;u<l.length;u++){var g=l[u];if(!_e.call(a,g)||!aa(t[g],a[g]))return!1}return!0}function cb(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ub(t,a){var l=cb(t);t=0;for(var u;l;){if(l.nodeType===3){if(u=t+l.textContent.length,t<=a&&u>=a)return{node:l,offset:a-t};t=u}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=cb(l)}}function db(t,a){return t&&a?t===a?!0:t&&t.nodeType===3?!1:a&&a.nodeType===3?db(t,a.parentNode):"contains"in t?t.contains(a):t.compareDocumentPosition?!!(t.compareDocumentPosition(a)&16):!1:!1}function fb(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var a=dc(t.document);a instanceof t.HTMLIFrameElement;){try{var l=typeof a.contentWindow.location.href=="string"}catch{l=!1}if(l)t=a.contentWindow;else break;a=dc(t.document)}return a}function yf(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 vC=rs&&"documentMode"in document&&11>=document.documentMode,mo=null,_f=null,El=null,jf=!1;function mb(t,a,l){var u=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;jf||mo==null||mo!==dc(u)||(u=mo,"selectionStart"in u&&yf(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}),El&&Cl(El,u)||(El=u,u=ou(_f,"onSelect"),0<u.length&&(a=new hc("onSelect","select",null,a,l),t.push({event:a,listeners:u}),a.target=mo)))}function wr(t,a){var l={};return l[t.toLowerCase()]=a.toLowerCase(),l["Webkit"+t]="webkit"+a,l["Moz"+t]="moz"+a,l}var po={animationend:wr("Animation","AnimationEnd"),animationiteration:wr("Animation","AnimationIteration"),animationstart:wr("Animation","AnimationStart"),transitionrun:wr("Transition","TransitionRun"),transitionstart:wr("Transition","TransitionStart"),transitioncancel:wr("Transition","TransitionCancel"),transitionend:wr("Transition","TransitionEnd")},Sf={},pb={};rs&&(pb=document.createElement("div").style,"AnimationEvent"in window||(delete po.animationend.animation,delete po.animationiteration.animation,delete po.animationstart.animation),"TransitionEvent"in window||delete po.transitionend.transition);function Cr(t){if(Sf[t])return Sf[t];if(!po[t])return t;var a=po[t],l;for(l in a)if(a.hasOwnProperty(l)&&l in pb)return Sf[t]=a[l];return t}var gb=Cr("animationend"),hb=Cr("animationiteration"),xb=Cr("animationstart"),yC=Cr("transitionrun"),_C=Cr("transitionstart"),jC=Cr("transitioncancel"),bb=Cr("transitionend"),vb=new Map,wf="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(" ");wf.push("scrollEnd");function Aa(t,a){vb.set(t,a),jr(a,[t])}var vc=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)},xa=[],go=0,Cf=0;function yc(){for(var t=go,a=Cf=go=0;a<t;){var l=xa[a];xa[a++]=null;var u=xa[a];xa[a++]=null;var g=xa[a];xa[a++]=null;var v=xa[a];if(xa[a++]=null,u!==null&&g!==null){var T=u.pending;T===null?g.next=g:(g.next=T.next,T.next=g),u.pending=g}v!==0&&yb(l,g,v)}}function _c(t,a,l,u){xa[go++]=t,xa[go++]=a,xa[go++]=l,xa[go++]=u,Cf|=u,t.lanes|=u,t=t.alternate,t!==null&&(t.lanes|=u)}function Ef(t,a,l,u){return _c(t,a,l,u),jc(t)}function Er(t,a){return _c(t,null,null,a),jc(t)}function yb(t,a,l){t.lanes|=l;var u=t.alternate;u!==null&&(u.lanes|=l);for(var g=!1,v=t.return;v!==null;)v.childLanes|=l,u=v.alternate,u!==null&&(u.childLanes|=l),v.tag===22&&(t=v.stateNode,t===null||t._visibility&1||(g=!0)),t=v,v=v.return;return t.tag===3?(v=t.stateNode,g&&a!==null&&(g=31-Bt(l),t=v.hiddenUpdates,u=t[g],u===null?t[g]=[a]:u.push(a),a.lane=l|536870912),v):null}function jc(t){if(50<Xl)throw Xl=0,Dm=null,Error(r(185));for(var a=t.return;a!==null;)t=a,a=t.return;return t.tag===3?t.stateNode:null}var ho={};function SC(t,a,l,u){this.tag=t,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=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 sa(t,a,l,u){return new SC(t,a,l,u)}function kf(t){return t=t.prototype,!(!t||!t.isReactComponent)}function os(t,a){var l=t.alternate;return l===null?(l=sa(t.tag,a,t.key,t.mode),l.elementType=t.elementType,l.type=t.type,l.stateNode=t.stateNode,l.alternate=t,t.alternate=l):(l.pendingProps=a,l.type=t.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=t.flags&65011712,l.childLanes=t.childLanes,l.lanes=t.lanes,l.child=t.child,l.memoizedProps=t.memoizedProps,l.memoizedState=t.memoizedState,l.updateQueue=t.updateQueue,a=t.dependencies,l.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},l.sibling=t.sibling,l.index=t.index,l.ref=t.ref,l.refCleanup=t.refCleanup,l}function _b(t,a){t.flags&=65011714;var l=t.alternate;return l===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=l.childLanes,t.lanes=l.lanes,t.child=l.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=l.memoizedProps,t.memoizedState=l.memoizedState,t.updateQueue=l.updateQueue,t.type=l.type,a=l.dependencies,t.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),t}function Sc(t,a,l,u,g,v){var T=0;if(u=t,typeof t=="function")kf(t)&&(T=1);else if(typeof t=="string")T=NE(t,l,W.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(t){case U:return t=sa(31,l,a,g),t.elementType=U,t.lanes=v,t;case _:return kr(l.children,g,v,a);case j:T=8,g|=24;break;case k:return t=sa(12,l,a,g|2),t.elementType=k,t.lanes=v,t;case M:return t=sa(13,l,a,g),t.elementType=M,t.lanes=v,t;case A:return t=sa(19,l,a,g),t.elementType=A,t.lanes=v,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case R:T=10;break e;case E:T=9;break e;case N:T=11;break e;case O:T=14;break e;case L:T=16,u=null;break e}T=29,l=Error(r(130,t===null?"null":typeof t,"")),u=null}return a=sa(T,l,a,g),a.elementType=t,a.type=u,a.lanes=v,a}function kr(t,a,l,u){return t=sa(7,t,u,a),t.lanes=l,t}function Nf(t,a,l){return t=sa(6,t,null,a),t.lanes=l,t}function jb(t){var a=sa(18,null,null,0);return a.stateNode=t,a}function Rf(t,a,l){return a=sa(4,t.children!==null?t.children:[],t.key,a),a.lanes=l,a.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},a}var Sb=new WeakMap;function ba(t,a){if(typeof t=="object"&&t!==null){var l=Sb.get(t);return l!==void 0?l:(a={value:t,source:a,stack:Ne(a)},Sb.set(t,a),a)}return{value:t,source:a,stack:Ne(a)}}var xo=[],bo=0,wc=null,kl=0,va=[],ya=0,zs=null,Ua=1,Ha="";function ls(t,a){xo[bo++]=kl,xo[bo++]=wc,wc=t,kl=a}function wb(t,a,l){va[ya++]=Ua,va[ya++]=Ha,va[ya++]=zs,zs=t;var u=Ua;t=Ha;var g=32-Bt(u)-1;u&=~(1<<g),l+=1;var v=32-Bt(a)+g;if(30<v){var T=g-g%5;v=(u&(1<<T)-1).toString(32),u>>=T,g-=T,Ua=1<<32-Bt(a)+g|l<<g|u,Ha=v+t}else Ua=1<<v|l<<g|u,Ha=t}function Tf(t){t.return!==null&&(ls(t,1),wb(t,1,0))}function Af(t){for(;t===wc;)wc=xo[--bo],xo[bo]=null,kl=xo[--bo],xo[bo]=null;for(;t===zs;)zs=va[--ya],va[ya]=null,Ha=va[--ya],va[ya]=null,Ua=va[--ya],va[ya]=null}function Cb(t,a){va[ya++]=Ua,va[ya++]=Ha,va[ya++]=zs,Ua=a.id,Ha=a.overflow,zs=t}var _n=null,$t=null,bt=!1,Ds=null,_a=!1,Mf=Error(r(519));function Ls(t){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Nl(ba(a,t)),Mf}function Eb(t){var a=t.stateNode,l=t.type,u=t.memoizedProps;switch(a[kt]=t,a[un]=u,l){case"dialog":mt("cancel",a),mt("close",a);break;case"iframe":case"object":case"embed":mt("load",a);break;case"video":case"audio":for(l=0;l<Ql.length;l++)mt(Ql[l],a);break;case"source":mt("error",a);break;case"img":case"image":case"link":mt("error",a),mt("load",a);break;case"details":mt("toggle",a);break;case"input":mt("invalid",a),Ix(a,u.value,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name,!0);break;case"select":mt("invalid",a);break;case"textarea":mt("invalid",a),Hx(a,u.value,u.defaultValue,u.children)}l=u.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||a.textContent===""+l||u.suppressHydrationWarning===!0||Vy(a.textContent,l)?(u.popover!=null&&(mt("beforetoggle",a),mt("toggle",a)),u.onScroll!=null&&mt("scroll",a),u.onScrollEnd!=null&&mt("scrollend",a),u.onClick!=null&&(a.onclick=ss),a=!0):a=!1,a||Ls(t,!0)}function kb(t){for(_n=t.return;_n;)switch(_n.tag){case 5:case 31:case 13:_a=!1;return;case 27:case 3:_a=!0;return;default:_n=_n.return}}function vo(t){if(t!==_n)return!1;if(!bt)return kb(t),bt=!0,!1;var a=t.tag,l;if((l=a!==3&&a!==27)&&((l=a===5)&&(l=t.type,l=!(l!=="form"&&l!=="button")||Qm(t.type,t.memoizedProps)),l=!l),l&&$t&&Ls(t),kb(t),a===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));$t=Jy(t)}else if(a===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(317));$t=Jy(t)}else a===27?(a=$t,Qs(t.type)?(t=tp,tp=null,$t=t):$t=a):$t=_n?Sa(t.stateNode.nextSibling):null;return!0}function Nr(){$t=_n=null,bt=!1}function Of(){var t=Ds;return t!==null&&(Xn===null?Xn=t:Xn.push.apply(Xn,t),Ds=null),t}function Nl(t){Ds===null?Ds=[t]:Ds.push(t)}var zf=I(null),Rr=null,is=null;function Ps(t,a,l){$(zf,a._currentValue),a._currentValue=l}function cs(t){t._currentValue=zf.current,V(zf)}function Df(t,a,l){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===l)break;t=t.return}}function Lf(t,a,l,u){var g=t.child;for(g!==null&&(g.return=t);g!==null;){var v=g.dependencies;if(v!==null){var T=g.child;v=v.firstContext;e:for(;v!==null;){var z=v;v=g;for(var F=0;F<a.length;F++)if(z.context===a[F]){v.lanes|=l,z=v.alternate,z!==null&&(z.lanes|=l),Df(v.return,l,t),u||(T=null);break e}v=z.next}}else if(g.tag===18){if(T=g.return,T===null)throw Error(r(341));T.lanes|=l,v=T.alternate,v!==null&&(v.lanes|=l),Df(T,l,t),T=null}else T=g.child;if(T!==null)T.return=g;else for(T=g;T!==null;){if(T===t){T=null;break}if(g=T.sibling,g!==null){g.return=T.return,T=g;break}T=T.return}g=T}}function yo(t,a,l,u){t=null;for(var g=a,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var T=g.alternate;if(T===null)throw Error(r(387));if(T=T.memoizedProps,T!==null){var z=g.type;aa(g.pendingProps.value,T.value)||(t!==null?t.push(z):t=[z])}}else if(g===se.current){if(T=g.alternate,T===null)throw Error(r(387));T.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(t!==null?t.push(ti):t=[ti])}g=g.return}t!==null&&Lf(a,t,l,u),a.flags|=262144}function Cc(t){for(t=t.firstContext;t!==null;){if(!aa(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Tr(t){Rr=t,is=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function jn(t){return Nb(Rr,t)}function Ec(t,a){return Rr===null&&Tr(t),Nb(t,a)}function Nb(t,a){var l=a._currentValue;if(a={context:a,memoizedValue:l,next:null},is===null){if(t===null)throw Error(r(308));is=a,t.dependencies={lanes:0,firstContext:a},t.flags|=524288}else is=is.next=a;return l}var wC=typeof AbortController<"u"?AbortController:function(){var t=[],a=this.signal={aborted:!1,addEventListener:function(l,u){t.push(u)}};this.abort=function(){a.aborted=!0,t.forEach(function(l){return l()})}},CC=e.unstable_scheduleCallback,EC=e.unstable_NormalPriority,dn={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Pf(){return{controller:new wC,data:new Map,refCount:0}}function Rl(t){t.refCount--,t.refCount===0&&CC(EC,function(){t.controller.abort()})}var Tl=null,Bf=0,_o=0,jo=null;function kC(t,a){if(Tl===null){var l=Tl=[];Bf=0,_o=Hm(),jo={status:"pending",value:void 0,then:function(u){l.push(u)}}}return Bf++,a.then(Rb,Rb),a}function Rb(){if(--Bf===0&&Tl!==null){jo!==null&&(jo.status="fulfilled");var t=Tl;Tl=null,_o=0,jo=null;for(var a=0;a<t.length;a++)(0,t[a])()}}function NC(t,a){var l=[],u={status:"pending",value:null,reason:null,then:function(g){l.push(g)}};return t.then(function(){u.status="fulfilled",u.value=a;for(var g=0;g<l.length;g++)(0,l[g])(a)},function(g){for(u.status="rejected",u.reason=g,g=0;g<l.length;g++)(0,l[g])(void 0)}),u}var Tb=q.S;q.S=function(t,a){my=ve(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&kC(t,a),Tb!==null&&Tb(t,a)};var Ar=I(null);function If(){var t=Ar.current;return t!==null?t:It.pooledCache}function kc(t,a){a===null?$(Ar,Ar.current):$(Ar,a.pool)}function Ab(){var t=If();return t===null?null:{parent:dn._currentValue,pool:t}}var So=Error(r(460)),Uf=Error(r(474)),Nc=Error(r(542)),Rc={then:function(){}};function Mb(t){return t=t.status,t==="fulfilled"||t==="rejected"}function Ob(t,a,l){switch(l=t[l],l===void 0?t.push(a):l!==a&&(a.then(ss,ss),a=l),a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Db(t),t;default:if(typeof a.status=="string")a.then(ss,ss);else{if(t=It,t!==null&&100<t.shellSuspendCounter)throw Error(r(482));t=a,t.status="pending",t.then(function(u){if(a.status==="pending"){var g=a;g.status="fulfilled",g.value=u}},function(u){if(a.status==="pending"){var g=a;g.status="rejected",g.reason=u}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw t=a.reason,Db(t),t}throw Or=a,So}}function Mr(t){try{var a=t._init;return a(t._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Or=l,So):l}}var Or=null;function zb(){if(Or===null)throw Error(r(459));var t=Or;return Or=null,t}function Db(t){if(t===So||t===Nc)throw Error(r(483))}var wo=null,Al=0;function Tc(t){var a=Al;return Al+=1,wo===null&&(wo=[]),Ob(wo,t,a)}function Ml(t,a){a=a.props.ref,t.ref=a!==void 0?a:null}function Ac(t,a){throw a.$$typeof===y?Error(r(525)):(t=Object.prototype.toString.call(a),Error(r(31,t==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":t)))}function Lb(t){function a(ee,J){if(t){var ne=ee.deletions;ne===null?(ee.deletions=[J],ee.flags|=16):ne.push(J)}}function l(ee,J){if(!t)return null;for(;J!==null;)a(ee,J),J=J.sibling;return null}function u(ee){for(var J=new Map;ee!==null;)ee.key!==null?J.set(ee.key,ee):J.set(ee.index,ee),ee=ee.sibling;return J}function g(ee,J){return ee=os(ee,J),ee.index=0,ee.sibling=null,ee}function v(ee,J,ne){return ee.index=ne,t?(ne=ee.alternate,ne!==null?(ne=ne.index,ne<J?(ee.flags|=67108866,J):ne):(ee.flags|=67108866,J)):(ee.flags|=1048576,J)}function T(ee){return t&&ee.alternate===null&&(ee.flags|=67108866),ee}function z(ee,J,ne,me){return J===null||J.tag!==6?(J=Nf(ne,ee.mode,me),J.return=ee,J):(J=g(J,ne),J.return=ee,J)}function F(ee,J,ne,me){var Ve=ne.type;return Ve===_?de(ee,J,ne.props.children,me,ne.key):J!==null&&(J.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===L&&Mr(Ve)===J.type)?(J=g(J,ne.props),Ml(J,ne),J.return=ee,J):(J=Sc(ne.type,ne.key,ne.props,null,ee.mode,me),Ml(J,ne),J.return=ee,J)}function ae(ee,J,ne,me){return J===null||J.tag!==4||J.stateNode.containerInfo!==ne.containerInfo||J.stateNode.implementation!==ne.implementation?(J=Rf(ne,ee.mode,me),J.return=ee,J):(J=g(J,ne.children||[]),J.return=ee,J)}function de(ee,J,ne,me,Ve){return J===null||J.tag!==7?(J=kr(ne,ee.mode,me,Ve),J.return=ee,J):(J=g(J,ne),J.return=ee,J)}function pe(ee,J,ne){if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return J=Nf(""+J,ee.mode,ne),J.return=ee,J;if(typeof J=="object"&&J!==null){switch(J.$$typeof){case S:return ne=Sc(J.type,J.key,J.props,null,ee.mode,ne),Ml(ne,J),ne.return=ee,ne;case w:return J=Rf(J,ee.mode,ne),J.return=ee,J;case L:return J=Mr(J),pe(ee,J,ne)}if(Q(J)||D(J))return J=kr(J,ee.mode,ne,null),J.return=ee,J;if(typeof J.then=="function")return pe(ee,Tc(J),ne);if(J.$$typeof===R)return pe(ee,Ec(ee,J),ne);Ac(ee,J)}return null}function re(ee,J,ne,me){var Ve=J!==null?J.key:null;if(typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint")return Ve!==null?null:z(ee,J,""+ne,me);if(typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:return ne.key===Ve?F(ee,J,ne,me):null;case w:return ne.key===Ve?ae(ee,J,ne,me):null;case L:return ne=Mr(ne),re(ee,J,ne,me)}if(Q(ne)||D(ne))return Ve!==null?null:de(ee,J,ne,me,null);if(typeof ne.then=="function")return re(ee,J,Tc(ne),me);if(ne.$$typeof===R)return re(ee,J,Ec(ee,ne),me);Ac(ee,ne)}return null}function ue(ee,J,ne,me,Ve){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return ee=ee.get(ne)||null,z(J,ee,""+me,Ve);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case S:return ee=ee.get(me.key===null?ne:me.key)||null,F(J,ee,me,Ve);case w:return ee=ee.get(me.key===null?ne:me.key)||null,ae(J,ee,me,Ve);case L:return me=Mr(me),ue(ee,J,ne,me,Ve)}if(Q(me)||D(me))return ee=ee.get(ne)||null,de(J,ee,me,Ve,null);if(typeof me.then=="function")return ue(ee,J,ne,Tc(me),Ve);if(me.$$typeof===R)return ue(ee,J,ne,Ec(J,me),Ve);Ac(J,me)}return null}function Pe(ee,J,ne,me){for(var Ve=null,jt=null,Ie=J,st=J=0,gt=null;Ie!==null&&st<ne.length;st++){Ie.index>st?(gt=Ie,Ie=null):gt=Ie.sibling;var St=re(ee,Ie,ne[st],me);if(St===null){Ie===null&&(Ie=gt);break}t&&Ie&&St.alternate===null&&a(ee,Ie),J=v(St,J,st),jt===null?Ve=St:jt.sibling=St,jt=St,Ie=gt}if(st===ne.length)return l(ee,Ie),bt&&ls(ee,st),Ve;if(Ie===null){for(;st<ne.length;st++)Ie=pe(ee,ne[st],me),Ie!==null&&(J=v(Ie,J,st),jt===null?Ve=Ie:jt.sibling=Ie,jt=Ie);return bt&&ls(ee,st),Ve}for(Ie=u(Ie);st<ne.length;st++)gt=ue(Ie,ee,st,ne[st],me),gt!==null&&(t&&gt.alternate!==null&&Ie.delete(gt.key===null?st:gt.key),J=v(gt,J,st),jt===null?Ve=gt:jt.sibling=gt,jt=gt);return t&&Ie.forEach(function(tr){return a(ee,tr)}),bt&&ls(ee,st),Ve}function Ke(ee,J,ne,me){if(ne==null)throw Error(r(151));for(var Ve=null,jt=null,Ie=J,st=J=0,gt=null,St=ne.next();Ie!==null&&!St.done;st++,St=ne.next()){Ie.index>st?(gt=Ie,Ie=null):gt=Ie.sibling;var tr=re(ee,Ie,St.value,me);if(tr===null){Ie===null&&(Ie=gt);break}t&&Ie&&tr.alternate===null&&a(ee,Ie),J=v(tr,J,st),jt===null?Ve=tr:jt.sibling=tr,jt=tr,Ie=gt}if(St.done)return l(ee,Ie),bt&&ls(ee,st),Ve;if(Ie===null){for(;!St.done;st++,St=ne.next())St=pe(ee,St.value,me),St!==null&&(J=v(St,J,st),jt===null?Ve=St:jt.sibling=St,jt=St);return bt&&ls(ee,st),Ve}for(Ie=u(Ie);!St.done;st++,St=ne.next())St=ue(Ie,ee,st,St.value,me),St!==null&&(t&&St.alternate!==null&&Ie.delete(St.key===null?st:St.key),J=v(St,J,st),jt===null?Ve=St:jt.sibling=St,jt=St);return t&&Ie.forEach(function(IE){return a(ee,IE)}),bt&&ls(ee,st),Ve}function zt(ee,J,ne,me){if(typeof ne=="object"&&ne!==null&&ne.type===_&&ne.key===null&&(ne=ne.props.children),typeof ne=="object"&&ne!==null){switch(ne.$$typeof){case S:e:{for(var Ve=ne.key;J!==null;){if(J.key===Ve){if(Ve=ne.type,Ve===_){if(J.tag===7){l(ee,J.sibling),me=g(J,ne.props.children),me.return=ee,ee=me;break e}}else if(J.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===L&&Mr(Ve)===J.type){l(ee,J.sibling),me=g(J,ne.props),Ml(me,ne),me.return=ee,ee=me;break e}l(ee,J);break}else a(ee,J);J=J.sibling}ne.type===_?(me=kr(ne.props.children,ee.mode,me,ne.key),me.return=ee,ee=me):(me=Sc(ne.type,ne.key,ne.props,null,ee.mode,me),Ml(me,ne),me.return=ee,ee=me)}return T(ee);case w:e:{for(Ve=ne.key;J!==null;){if(J.key===Ve)if(J.tag===4&&J.stateNode.containerInfo===ne.containerInfo&&J.stateNode.implementation===ne.implementation){l(ee,J.sibling),me=g(J,ne.children||[]),me.return=ee,ee=me;break e}else{l(ee,J);break}else a(ee,J);J=J.sibling}me=Rf(ne,ee.mode,me),me.return=ee,ee=me}return T(ee);case L:return ne=Mr(ne),zt(ee,J,ne,me)}if(Q(ne))return Pe(ee,J,ne,me);if(D(ne)){if(Ve=D(ne),typeof Ve!="function")throw Error(r(150));return ne=Ve.call(ne),Ke(ee,J,ne,me)}if(typeof ne.then=="function")return zt(ee,J,Tc(ne),me);if(ne.$$typeof===R)return zt(ee,J,Ec(ee,ne),me);Ac(ee,ne)}return typeof ne=="string"&&ne!==""||typeof ne=="number"||typeof ne=="bigint"?(ne=""+ne,J!==null&&J.tag===6?(l(ee,J.sibling),me=g(J,ne),me.return=ee,ee=me):(l(ee,J),me=Nf(ne,ee.mode,me),me.return=ee,ee=me),T(ee)):l(ee,J)}return function(ee,J,ne,me){try{Al=0;var Ve=zt(ee,J,ne,me);return wo=null,Ve}catch(Ie){if(Ie===So||Ie===Nc)throw Ie;var jt=sa(29,Ie,null,ee.mode);return jt.lanes=me,jt.return=ee,jt}finally{}}}var zr=Lb(!0),Pb=Lb(!1),Bs=!1;function Hf(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qf(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 Is(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Us(t,a,l){var u=t.updateQueue;if(u===null)return null;if(u=u.shared,(wt&2)!==0){var g=u.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),u.pending=a,a=jc(t),yb(t,null,l),a}return _c(t,u,a,l),jc(t)}function Ol(t,a,l){if(a=a.updateQueue,a!==null&&(a=a.shared,(l&4194048)!==0)){var u=a.lanes;u&=t.pendingLanes,l|=u,a.lanes=l,na(t,l)}}function Vf(t,a){var l=t.updateQueue,u=t.alternate;if(u!==null&&(u=u.updateQueue,l===u)){var g=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var T={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?g=v=T:v=v.next=T,l=l.next}while(l!==null);v===null?g=v=a:v=v.next=a}else g=v=a;l={baseState:u.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:u.shared,callbacks:u.callbacks},t.updateQueue=l;return}t=l.lastBaseUpdate,t===null?l.firstBaseUpdate=a:t.next=a,l.lastBaseUpdate=a}var $f=!1;function zl(){if($f){var t=jo;if(t!==null)throw t}}function Dl(t,a,l,u){$f=!1;var g=t.updateQueue;Bs=!1;var v=g.firstBaseUpdate,T=g.lastBaseUpdate,z=g.shared.pending;if(z!==null){g.shared.pending=null;var F=z,ae=F.next;F.next=null,T===null?v=ae:T.next=ae,T=F;var de=t.alternate;de!==null&&(de=de.updateQueue,z=de.lastBaseUpdate,z!==T&&(z===null?de.firstBaseUpdate=ae:z.next=ae,de.lastBaseUpdate=F))}if(v!==null){var pe=g.baseState;T=0,de=ae=F=null,z=v;do{var re=z.lane&-536870913,ue=re!==z.lane;if(ue?(pt&re)===re:(u&re)===re){re!==0&&re===_o&&($f=!0),de!==null&&(de=de.next={lane:0,tag:z.tag,payload:z.payload,callback:null,next:null});e:{var Pe=t,Ke=z;re=a;var zt=l;switch(Ke.tag){case 1:if(Pe=Ke.payload,typeof Pe=="function"){pe=Pe.call(zt,pe,re);break e}pe=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=Ke.payload,re=typeof Pe=="function"?Pe.call(zt,pe,re):Pe,re==null)break e;pe=x({},pe,re);break e;case 2:Bs=!0}}re=z.callback,re!==null&&(t.flags|=64,ue&&(t.flags|=8192),ue=g.callbacks,ue===null?g.callbacks=[re]:ue.push(re))}else ue={lane:re,tag:z.tag,payload:z.payload,callback:z.callback,next:null},de===null?(ae=de=ue,F=pe):de=de.next=ue,T|=re;if(z=z.next,z===null){if(z=g.shared.pending,z===null)break;ue=z,z=ue.next,ue.next=null,g.lastBaseUpdate=ue,g.shared.pending=null}}while(!0);de===null&&(F=pe),g.baseState=F,g.firstBaseUpdate=ae,g.lastBaseUpdate=de,v===null&&(g.shared.lanes=0),Gs|=T,t.lanes=T,t.memoizedState=pe}}function Bb(t,a){if(typeof t!="function")throw Error(r(191,t));t.call(a)}function Ib(t,a){var l=t.callbacks;if(l!==null)for(t.callbacks=null,t=0;t<l.length;t++)Bb(l[t],a)}var Co=I(null),Mc=I(0);function Ub(t,a){t=bs,$(Mc,t),$(Co,a),bs=t|a.baseLanes}function Gf(){$(Mc,bs),$(Co,Co.current)}function Yf(){bs=Mc.current,V(Co),V(Mc)}var ra=I(null),ja=null;function Hs(t){var a=t.alternate;$(on,on.current&1),$(ra,t),ja===null&&(a===null||Co.current!==null||a.memoizedState!==null)&&(ja=t)}function Ff(t){$(on,on.current),$(ra,t),ja===null&&(ja=t)}function Hb(t){t.tag===22?($(on,on.current),$(ra,t),ja===null&&(ja=t)):qs()}function qs(){$(on,on.current),$(ra,ra.current)}function oa(t){V(ra),ja===t&&(ja=null),V(on)}var on=I(0);function Oc(t){for(var a=t;a!==null;){if(a.tag===13){var l=a.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Wm(l)||ep(l)))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 us=0,et=null,Mt=null,fn=null,zc=!1,Eo=!1,Dr=!1,Dc=0,Ll=0,ko=null,RC=0;function tn(){throw Error(r(321))}function Xf(t,a){if(a===null)return!1;for(var l=0;l<a.length&&l<t.length;l++)if(!aa(t[l],a[l]))return!1;return!0}function Kf(t,a,l,u,g,v){return us=v,et=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,q.H=t===null||t.memoizedState===null?wv:um,Dr=!1,v=l(u,g),Dr=!1,Eo&&(v=Vb(a,l,u,g)),qb(t),v}function qb(t){q.H=Il;var a=Mt!==null&&Mt.next!==null;if(us=0,fn=Mt=et=null,zc=!1,Ll=0,ko=null,a)throw Error(r(300));t===null||mn||(t=t.dependencies,t!==null&&Cc(t)&&(mn=!0))}function Vb(t,a,l,u){et=t;var g=0;do{if(Eo&&(ko=null),Ll=0,Eo=!1,25<=g)throw Error(r(301));if(g+=1,fn=Mt=null,t.updateQueue!=null){var v=t.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}q.H=Cv,v=a(l,u)}while(Eo);return v}function TC(){var t=q.H,a=t.useState()[0];return a=typeof a.then=="function"?Pl(a):a,t=t.useState()[0],(Mt!==null?Mt.memoizedState:null)!==t&&(et.flags|=1024),a}function Qf(){var t=Dc!==0;return Dc=0,t}function Zf(t,a,l){a.updateQueue=t.updateQueue,a.flags&=-2053,t.lanes&=~l}function Jf(t){if(zc){for(t=t.memoizedState;t!==null;){var a=t.queue;a!==null&&(a.pending=null),t=t.next}zc=!1}us=0,fn=Mt=et=null,Eo=!1,Ll=Dc=0,ko=null}function Bn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return fn===null?et.memoizedState=fn=t:fn=fn.next=t,fn}function ln(){if(Mt===null){var t=et.alternate;t=t!==null?t.memoizedState:null}else t=Mt.next;var a=fn===null?et.memoizedState:fn.next;if(a!==null)fn=a,Mt=t;else{if(t===null)throw et.alternate===null?Error(r(467)):Error(r(310));Mt=t,t={memoizedState:Mt.memoizedState,baseState:Mt.baseState,baseQueue:Mt.baseQueue,queue:Mt.queue,next:null},fn===null?et.memoizedState=fn=t:fn=fn.next=t}return fn}function Lc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Pl(t){var a=Ll;return Ll+=1,ko===null&&(ko=[]),t=Ob(ko,t,a),a=et,(fn===null?a.memoizedState:fn.next)===null&&(a=a.alternate,q.H=a===null||a.memoizedState===null?wv:um),t}function Pc(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Pl(t);if(t.$$typeof===R)return jn(t)}throw Error(r(438,String(t)))}function Wf(t){var a=null,l=et.updateQueue;if(l!==null&&(a=l.memoCache),a==null){var u=et.alternate;u!==null&&(u=u.updateQueue,u!==null&&(u=u.memoCache,u!=null&&(a={data:u.data.map(function(g){return g.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),l===null&&(l=Lc(),et.updateQueue=l),l.memoCache=a,l=a.data[a.index],l===void 0)for(l=a.data[a.index]=Array(t),u=0;u<t;u++)l[u]=P;return a.index++,l}function ds(t,a){return typeof a=="function"?a(t):a}function Bc(t){var a=ln();return em(a,Mt,t)}function em(t,a,l){var u=t.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=l;var g=t.baseQueue,v=u.pending;if(v!==null){if(g!==null){var T=g.next;g.next=v.next,v.next=T}a.baseQueue=g=v,u.pending=null}if(v=t.baseState,g===null)t.memoizedState=v;else{a=g.next;var z=T=null,F=null,ae=a,de=!1;do{var pe=ae.lane&-536870913;if(pe!==ae.lane?(pt&pe)===pe:(us&pe)===pe){var re=ae.revertLane;if(re===0)F!==null&&(F=F.next={lane:0,revertLane:0,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null}),pe===_o&&(de=!0);else if((us&re)===re){ae=ae.next,re===_o&&(de=!0);continue}else pe={lane:0,revertLane:ae.revertLane,gesture:null,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},F===null?(z=F=pe,T=v):F=F.next=pe,et.lanes|=re,Gs|=re;pe=ae.action,Dr&&l(v,pe),v=ae.hasEagerState?ae.eagerState:l(v,pe)}else re={lane:pe,revertLane:ae.revertLane,gesture:ae.gesture,action:ae.action,hasEagerState:ae.hasEagerState,eagerState:ae.eagerState,next:null},F===null?(z=F=re,T=v):F=F.next=re,et.lanes|=pe,Gs|=pe;ae=ae.next}while(ae!==null&&ae!==a);if(F===null?T=v:F.next=z,!aa(v,t.memoizedState)&&(mn=!0,de&&(l=jo,l!==null)))throw l;t.memoizedState=v,t.baseState=T,t.baseQueue=F,u.lastRenderedState=v}return g===null&&(u.lanes=0),[t.memoizedState,u.dispatch]}function tm(t){var a=ln(),l=a.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=t;var u=l.dispatch,g=l.pending,v=a.memoizedState;if(g!==null){l.pending=null;var T=g=g.next;do v=t(v,T.action),T=T.next;while(T!==g);aa(v,a.memoizedState)||(mn=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),l.lastRenderedState=v}return[v,u]}function $b(t,a,l){var u=et,g=ln(),v=bt;if(v){if(l===void 0)throw Error(r(407));l=l()}else l=a();var T=!aa((Mt||g).memoizedState,l);if(T&&(g.memoizedState=l,mn=!0),g=g.queue,sm(Fb.bind(null,u,g,t),[t]),g.getSnapshot!==a||T||fn!==null&&fn.memoizedState.tag&1){if(u.flags|=2048,No(9,{destroy:void 0},Yb.bind(null,u,g,l,a),null),It===null)throw Error(r(349));v||(us&127)!==0||Gb(u,a,l)}return l}function Gb(t,a,l){t.flags|=16384,t={getSnapshot:a,value:l},a=et.updateQueue,a===null?(a=Lc(),et.updateQueue=a,a.stores=[t]):(l=a.stores,l===null?a.stores=[t]:l.push(t))}function Yb(t,a,l,u){a.value=l,a.getSnapshot=u,Xb(a)&&Kb(t)}function Fb(t,a,l){return l(function(){Xb(a)&&Kb(t)})}function Xb(t){var a=t.getSnapshot;t=t.value;try{var l=a();return!aa(t,l)}catch{return!0}}function Kb(t){var a=Er(t,2);a!==null&&Kn(a,t,2)}function nm(t){var a=Bn();if(typeof t=="function"){var l=t;if(t=l(),Dr){Et(!0);try{l()}finally{Et(!1)}}}return a.memoizedState=a.baseState=t,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:t},a}function Qb(t,a,l,u){return t.baseState=l,em(t,Mt,typeof u=="function"?u:ds)}function AC(t,a,l,u,g){if(Hc(t))throw Error(r(485));if(t=a.action,t!==null){var v={payload:g,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){v.listeners.push(T)}};q.T!==null?l(!0):v.isTransition=!1,u(v),l=a.pending,l===null?(v.next=a.pending=v,Zb(a,v)):(v.next=l.next,a.pending=l.next=v)}}function Zb(t,a){var l=a.action,u=a.payload,g=t.state;if(a.isTransition){var v=q.T,T={};q.T=T;try{var z=l(g,u),F=q.S;F!==null&&F(T,z),Jb(t,a,z)}catch(ae){am(t,a,ae)}finally{v!==null&&T.types!==null&&(v.types=T.types),q.T=v}}else try{v=l(g,u),Jb(t,a,v)}catch(ae){am(t,a,ae)}}function Jb(t,a,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(u){Wb(t,a,u)},function(u){return am(t,a,u)}):Wb(t,a,l)}function Wb(t,a,l){a.status="fulfilled",a.value=l,ev(a),t.state=l,a=t.pending,a!==null&&(l=a.next,l===a?t.pending=null:(l=l.next,a.next=l,Zb(t,l)))}function am(t,a,l){var u=t.pending;if(t.pending=null,u!==null){u=u.next;do a.status="rejected",a.reason=l,ev(a),a=a.next;while(a!==u)}t.action=null}function ev(t){t=t.listeners;for(var a=0;a<t.length;a++)(0,t[a])()}function tv(t,a){return a}function nv(t,a){if(bt){var l=It.formState;if(l!==null){e:{var u=et;if(bt){if($t){t:{for(var g=$t,v=_a;g.nodeType!==8;){if(!v){g=null;break t}if(g=Sa(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){$t=Sa(g.nextSibling),u=g.data==="F!";break e}}Ls(u)}u=!1}u&&(a=l[0])}}return l=Bn(),l.memoizedState=l.baseState=a,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tv,lastRenderedState:a},l.queue=u,l=_v.bind(null,et,u),u.dispatch=l,u=nm(!1),v=cm.bind(null,et,!1,u.queue),u=Bn(),g={state:a,dispatch:null,action:t,pending:null},u.queue=g,l=AC.bind(null,et,g,v,l),g.dispatch=l,u.memoizedState=t,[a,l,!1]}function av(t){var a=ln();return sv(a,Mt,t)}function sv(t,a,l){if(a=em(t,a,tv)[0],t=Bc(ds)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var u=Pl(a)}catch(T){throw T===So?Nc:T}else u=a;a=ln();var g=a.queue,v=g.dispatch;return l!==a.memoizedState&&(et.flags|=2048,No(9,{destroy:void 0},MC.bind(null,g,l),null)),[u,v,t]}function MC(t,a){t.action=a}function rv(t){var a=ln(),l=Mt;if(l!==null)return sv(a,l,t);ln(),a=a.memoizedState,l=ln();var u=l.queue.dispatch;return l.memoizedState=t,[a,u,!1]}function No(t,a,l,u){return t={tag:t,create:l,deps:u,inst:a,next:null},a=et.updateQueue,a===null&&(a=Lc(),et.updateQueue=a),l=a.lastEffect,l===null?a.lastEffect=t.next=t:(u=l.next,l.next=t,t.next=u,a.lastEffect=t),t}function ov(){return ln().memoizedState}function Ic(t,a,l,u){var g=Bn();et.flags|=t,g.memoizedState=No(1|a,{destroy:void 0},l,u===void 0?null:u)}function Uc(t,a,l,u){var g=ln();u=u===void 0?null:u;var v=g.memoizedState.inst;Mt!==null&&u!==null&&Xf(u,Mt.memoizedState.deps)?g.memoizedState=No(a,v,l,u):(et.flags|=t,g.memoizedState=No(1|a,v,l,u))}function lv(t,a){Ic(8390656,8,t,a)}function sm(t,a){Uc(2048,8,t,a)}function OC(t){et.flags|=4;var a=et.updateQueue;if(a===null)a=Lc(),et.updateQueue=a,a.events=[t];else{var l=a.events;l===null?a.events=[t]:l.push(t)}}function iv(t){var a=ln().memoizedState;return OC({ref:a,nextImpl:t}),function(){if((wt&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function cv(t,a){return Uc(4,2,t,a)}function uv(t,a){return Uc(4,4,t,a)}function dv(t,a){if(typeof a=="function"){t=t();var l=a(t);return function(){typeof l=="function"?l():a(null)}}if(a!=null)return t=t(),a.current=t,function(){a.current=null}}function fv(t,a,l){l=l!=null?l.concat([t]):null,Uc(4,4,dv.bind(null,a,t),l)}function rm(){}function mv(t,a){var l=ln();a=a===void 0?null:a;var u=l.memoizedState;return a!==null&&Xf(a,u[1])?u[0]:(l.memoizedState=[t,a],t)}function pv(t,a){var l=ln();a=a===void 0?null:a;var u=l.memoizedState;if(a!==null&&Xf(a,u[1]))return u[0];if(u=t(),Dr){Et(!0);try{t()}finally{Et(!1)}}return l.memoizedState=[u,a],u}function om(t,a,l){return l===void 0||(us&1073741824)!==0&&(pt&261930)===0?t.memoizedState=a:(t.memoizedState=l,t=gy(),et.lanes|=t,Gs|=t,l)}function gv(t,a,l,u){return aa(l,a)?l:Co.current!==null?(t=om(t,l,u),aa(t,a)||(mn=!0),t):(us&42)===0||(us&1073741824)!==0&&(pt&261930)===0?(mn=!0,t.memoizedState=l):(t=gy(),et.lanes|=t,Gs|=t,a)}function hv(t,a,l,u,g){var v=X.p;X.p=v!==0&&8>v?v:8;var T=q.T,z={};q.T=z,cm(t,!1,a,l);try{var F=g(),ae=q.S;if(ae!==null&&ae(z,F),F!==null&&typeof F=="object"&&typeof F.then=="function"){var de=NC(F,u);Bl(t,a,de,ca(t))}else Bl(t,a,u,ca(t))}catch(pe){Bl(t,a,{then:function(){},status:"rejected",reason:pe},ca())}finally{X.p=v,T!==null&&z.types!==null&&(T.types=z.types),q.T=T}}function zC(){}function lm(t,a,l,u){if(t.tag!==5)throw Error(r(476));var g=xv(t).queue;hv(t,g,a,Z,l===null?zC:function(){return bv(t),l(u)})}function xv(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:ds,lastRenderedState:Z},next:null};var l={};return a.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ds,lastRenderedState:l},next:null},t.memoizedState=a,t=t.alternate,t!==null&&(t.memoizedState=a),a}function bv(t){var a=xv(t);a.next===null&&(a=t.alternate.memoizedState),Bl(t,a.next.queue,{},ca())}function im(){return jn(ti)}function vv(){return ln().memoizedState}function yv(){return ln().memoizedState}function DC(t){for(var a=t.return;a!==null;){switch(a.tag){case 24:case 3:var l=ca();t=Is(l);var u=Us(a,t,l);u!==null&&(Kn(u,a,l),Ol(u,a,l)),a={cache:Pf()},t.payload=a;return}a=a.return}}function LC(t,a,l){var u=ca();l={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Hc(t)?jv(a,l):(l=Ef(t,a,l,u),l!==null&&(Kn(l,t,u),Sv(l,a,u)))}function _v(t,a,l){var u=ca();Bl(t,a,l,u)}function Bl(t,a,l,u){var g={lane:u,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(Hc(t))jv(a,g);else{var v=t.alternate;if(t.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var T=a.lastRenderedState,z=v(T,l);if(g.hasEagerState=!0,g.eagerState=z,aa(z,T))return _c(t,a,g,0),It===null&&yc(),!1}catch{}finally{}if(l=Ef(t,a,g,u),l!==null)return Kn(l,t,u),Sv(l,a,u),!0}return!1}function cm(t,a,l,u){if(u={lane:2,revertLane:Hm(),gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Hc(t)){if(a)throw Error(r(479))}else a=Ef(t,l,u,2),a!==null&&Kn(a,t,2)}function Hc(t){var a=t.alternate;return t===et||a!==null&&a===et}function jv(t,a){Eo=zc=!0;var l=t.pending;l===null?a.next=a:(a.next=l.next,l.next=a),t.pending=a}function Sv(t,a,l){if((l&4194048)!==0){var u=a.lanes;u&=t.pendingLanes,l|=u,a.lanes=l,na(t,l)}}var Il={readContext:jn,use:Pc,useCallback:tn,useContext:tn,useEffect:tn,useImperativeHandle:tn,useLayoutEffect:tn,useInsertionEffect:tn,useMemo:tn,useReducer:tn,useRef:tn,useState:tn,useDebugValue:tn,useDeferredValue:tn,useTransition:tn,useSyncExternalStore:tn,useId:tn,useHostTransitionStatus:tn,useFormState:tn,useActionState:tn,useOptimistic:tn,useMemoCache:tn,useCacheRefresh:tn};Il.useEffectEvent=tn;var wv={readContext:jn,use:Pc,useCallback:function(t,a){return Bn().memoizedState=[t,a===void 0?null:a],t},useContext:jn,useEffect:lv,useImperativeHandle:function(t,a,l){l=l!=null?l.concat([t]):null,Ic(4194308,4,dv.bind(null,a,t),l)},useLayoutEffect:function(t,a){return Ic(4194308,4,t,a)},useInsertionEffect:function(t,a){Ic(4,2,t,a)},useMemo:function(t,a){var l=Bn();a=a===void 0?null:a;var u=t();if(Dr){Et(!0);try{t()}finally{Et(!1)}}return l.memoizedState=[u,a],u},useReducer:function(t,a,l){var u=Bn();if(l!==void 0){var g=l(a);if(Dr){Et(!0);try{l(a)}finally{Et(!1)}}}else g=a;return u.memoizedState=u.baseState=g,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:g},u.queue=t,t=t.dispatch=LC.bind(null,et,t),[u.memoizedState,t]},useRef:function(t){var a=Bn();return t={current:t},a.memoizedState=t},useState:function(t){t=nm(t);var a=t.queue,l=_v.bind(null,et,a);return a.dispatch=l,[t.memoizedState,l]},useDebugValue:rm,useDeferredValue:function(t,a){var l=Bn();return om(l,t,a)},useTransition:function(){var t=nm(!1);return t=hv.bind(null,et,t.queue,!0,!1),Bn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,a,l){var u=et,g=Bn();if(bt){if(l===void 0)throw Error(r(407));l=l()}else{if(l=a(),It===null)throw Error(r(349));(pt&127)!==0||Gb(u,a,l)}g.memoizedState=l;var v={value:l,getSnapshot:a};return g.queue=v,lv(Fb.bind(null,u,v,t),[t]),u.flags|=2048,No(9,{destroy:void 0},Yb.bind(null,u,v,l,a),null),l},useId:function(){var t=Bn(),a=It.identifierPrefix;if(bt){var l=Ha,u=Ua;l=(u&~(1<<32-Bt(u)-1)).toString(32)+l,a="_"+a+"R_"+l,l=Dc++,0<l&&(a+="H"+l.toString(32)),a+="_"}else l=RC++,a="_"+a+"r_"+l.toString(32)+"_";return t.memoizedState=a},useHostTransitionStatus:im,useFormState:nv,useActionState:nv,useOptimistic:function(t){var a=Bn();a.memoizedState=a.baseState=t;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=l,a=cm.bind(null,et,!0,l),l.dispatch=a,[t,a]},useMemoCache:Wf,useCacheRefresh:function(){return Bn().memoizedState=DC.bind(null,et)},useEffectEvent:function(t){var a=Bn(),l={impl:t};return a.memoizedState=l,function(){if((wt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}},um={readContext:jn,use:Pc,useCallback:mv,useContext:jn,useEffect:sm,useImperativeHandle:fv,useInsertionEffect:cv,useLayoutEffect:uv,useMemo:pv,useReducer:Bc,useRef:ov,useState:function(){return Bc(ds)},useDebugValue:rm,useDeferredValue:function(t,a){var l=ln();return gv(l,Mt.memoizedState,t,a)},useTransition:function(){var t=Bc(ds)[0],a=ln().memoizedState;return[typeof t=="boolean"?t:Pl(t),a]},useSyncExternalStore:$b,useId:vv,useHostTransitionStatus:im,useFormState:av,useActionState:av,useOptimistic:function(t,a){var l=ln();return Qb(l,Mt,t,a)},useMemoCache:Wf,useCacheRefresh:yv};um.useEffectEvent=iv;var Cv={readContext:jn,use:Pc,useCallback:mv,useContext:jn,useEffect:sm,useImperativeHandle:fv,useInsertionEffect:cv,useLayoutEffect:uv,useMemo:pv,useReducer:tm,useRef:ov,useState:function(){return tm(ds)},useDebugValue:rm,useDeferredValue:function(t,a){var l=ln();return Mt===null?om(l,t,a):gv(l,Mt.memoizedState,t,a)},useTransition:function(){var t=tm(ds)[0],a=ln().memoizedState;return[typeof t=="boolean"?t:Pl(t),a]},useSyncExternalStore:$b,useId:vv,useHostTransitionStatus:im,useFormState:rv,useActionState:rv,useOptimistic:function(t,a){var l=ln();return Mt!==null?Qb(l,Mt,t,a):(l.baseState=t,[t,l.queue.dispatch])},useMemoCache:Wf,useCacheRefresh:yv};Cv.useEffectEvent=iv;function dm(t,a,l,u){a=t.memoizedState,l=l(u,a),l=l==null?a:x({},a,l),t.memoizedState=l,t.lanes===0&&(t.updateQueue.baseState=l)}var fm={enqueueSetState:function(t,a,l){t=t._reactInternals;var u=ca(),g=Is(u);g.payload=a,l!=null&&(g.callback=l),a=Us(t,g,u),a!==null&&(Kn(a,t,u),Ol(a,t,u))},enqueueReplaceState:function(t,a,l){t=t._reactInternals;var u=ca(),g=Is(u);g.tag=1,g.payload=a,l!=null&&(g.callback=l),a=Us(t,g,u),a!==null&&(Kn(a,t,u),Ol(a,t,u))},enqueueForceUpdate:function(t,a){t=t._reactInternals;var l=ca(),u=Is(l);u.tag=2,a!=null&&(u.callback=a),a=Us(t,u,l),a!==null&&(Kn(a,t,l),Ol(a,t,l))}};function Ev(t,a,l,u,g,v,T){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(u,v,T):a.prototype&&a.prototype.isPureReactComponent?!Cl(l,u)||!Cl(g,v):!0}function kv(t,a,l,u){t=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(l,u),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(l,u),a.state!==t&&fm.enqueueReplaceState(a,a.state,null)}function Lr(t,a){var l=a;if("ref"in a){l={};for(var u in a)u!=="ref"&&(l[u]=a[u])}if(t=t.defaultProps){l===a&&(l=x({},l));for(var g in t)l[g]===void 0&&(l[g]=t[g])}return l}function Nv(t){vc(t)}function Rv(t){console.error(t)}function Tv(t){vc(t)}function qc(t,a){try{var l=t.onUncaughtError;l(a.value,{componentStack:a.stack})}catch(u){setTimeout(function(){throw u})}}function Av(t,a,l){try{var u=t.onCaughtError;u(l.value,{componentStack:l.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function mm(t,a,l){return l=Is(l),l.tag=3,l.payload={element:null},l.callback=function(){qc(t,a)},l}function Mv(t){return t=Is(t),t.tag=3,t}function Ov(t,a,l,u){var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var v=u.value;t.payload=function(){return g(v)},t.callback=function(){Av(a,l,u)}}var T=l.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(t.callback=function(){Av(a,l,u),typeof g!="function"&&(Ys===null?Ys=new Set([this]):Ys.add(this));var z=u.stack;this.componentDidCatch(u.value,{componentStack:z!==null?z:""})})}function PC(t,a,l,u,g){if(l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){if(a=l.alternate,a!==null&&yo(a,l,g,!0),l=ra.current,l!==null){switch(l.tag){case 31:case 13:return ja===null?eu():l.alternate===null&&nn===0&&(nn=3),l.flags&=-257,l.flags|=65536,l.lanes=g,u===Rc?l.flags|=16384:(a=l.updateQueue,a===null?l.updateQueue=new Set([u]):a.add(u),Bm(t,u,g)),!1;case 22:return l.flags|=65536,u===Rc?l.flags|=16384:(a=l.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([u])},l.updateQueue=a):(l=a.retryQueue,l===null?a.retryQueue=new Set([u]):l.add(u)),Bm(t,u,g)),!1}throw Error(r(435,l.tag))}return Bm(t,u,g),eu(),!1}if(bt)return a=ra.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=g,u!==Mf&&(t=Error(r(422),{cause:u}),Nl(ba(t,l)))):(u!==Mf&&(a=Error(r(423),{cause:u}),Nl(ba(a,l))),t=t.current.alternate,t.flags|=65536,g&=-g,t.lanes|=g,u=ba(u,l),g=mm(t.stateNode,u,g),Vf(t,g),nn!==4&&(nn=2)),!1;var v=Error(r(520),{cause:u});if(v=ba(v,l),Fl===null?Fl=[v]:Fl.push(v),nn!==4&&(nn=2),a===null)return!0;u=ba(u,l),l=a;do{switch(l.tag){case 3:return l.flags|=65536,t=g&-g,l.lanes|=t,t=mm(l.stateNode,u,t),Vf(l,t),!1;case 1:if(a=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ys===null||!Ys.has(v))))return l.flags|=65536,g&=-g,l.lanes|=g,g=Mv(g),Ov(g,t,l,u),Vf(l,g),!1}l=l.return}while(l!==null);return!1}var pm=Error(r(461)),mn=!1;function Sn(t,a,l,u){a.child=t===null?Pb(a,null,l,u):zr(a,t.child,l,u)}function zv(t,a,l,u,g){l=l.render;var v=a.ref;if("ref"in u){var T={};for(var z in u)z!=="ref"&&(T[z]=u[z])}else T=u;return Tr(a),u=Kf(t,a,l,T,v,g),z=Qf(),t!==null&&!mn?(Zf(t,a,g),fs(t,a,g)):(bt&&z&&Tf(a),a.flags|=1,Sn(t,a,u,g),a.child)}function Dv(t,a,l,u,g){if(t===null){var v=l.type;return typeof v=="function"&&!kf(v)&&v.defaultProps===void 0&&l.compare===null?(a.tag=15,a.type=v,Lv(t,a,v,u,g)):(t=Sc(l.type,null,u,a,a.mode,g),t.ref=a.ref,t.return=a,a.child=t)}if(v=t.child,!jm(t,g)){var T=v.memoizedProps;if(l=l.compare,l=l!==null?l:Cl,l(T,u)&&t.ref===a.ref)return fs(t,a,g)}return a.flags|=1,t=os(v,u),t.ref=a.ref,t.return=a,a.child=t}function Lv(t,a,l,u,g){if(t!==null){var v=t.memoizedProps;if(Cl(v,u)&&t.ref===a.ref)if(mn=!1,a.pendingProps=u=v,jm(t,g))(t.flags&131072)!==0&&(mn=!0);else return a.lanes=t.lanes,fs(t,a,g)}return gm(t,a,l,u,g)}function Pv(t,a,l,u){var g=u.children,v=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(v=v!==null?v.baseLanes|l:l,t!==null){for(u=a.child=t.child,g=0;u!==null;)g=g|u.lanes|u.childLanes,u=u.sibling;u=g&~v}else u=0,a.child=null;return Bv(t,a,v,l,u)}if((l&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},t!==null&&kc(a,v!==null?v.cachePool:null),v!==null?Ub(a,v):Gf(),Hb(a);else return u=a.lanes=536870912,Bv(t,a,v!==null?v.baseLanes|l:l,l,u)}else v!==null?(kc(a,v.cachePool),Ub(a,v),qs(),a.memoizedState=null):(t!==null&&kc(a,null),Gf(),qs());return Sn(t,a,g,l),a.child}function Ul(t,a){return t!==null&&t.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Bv(t,a,l,u,g){var v=If();return v=v===null?null:{parent:dn._currentValue,pool:v},a.memoizedState={baseLanes:l,cachePool:v},t!==null&&kc(a,null),Gf(),Hb(a),t!==null&&yo(t,a,u,!0),a.childLanes=g,null}function Vc(t,a){return a=Gc({mode:a.mode,children:a.children},t.mode),a.ref=t.ref,t.child=a,a.return=t,a}function Iv(t,a,l){return zr(a,t.child,null,l),t=Vc(a,a.pendingProps),t.flags|=2,oa(a),a.memoizedState=null,t}function BC(t,a,l){var u=a.pendingProps,g=(a.flags&128)!==0;if(a.flags&=-129,t===null){if(bt){if(u.mode==="hidden")return t=Vc(a,u),a.lanes=536870912,Ul(null,t);if(Ff(a),(t=$t)?(t=Zy(t,_a),t=t!==null&&t.data==="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:zs!==null?{id:Ua,overflow:Ha}:null,retryLane:536870912,hydrationErrors:null},l=jb(t),l.return=a,a.child=l,_n=a,$t=null)):t=null,t===null)throw Ls(a);return a.lanes=536870912,null}return Vc(a,u)}var v=t.memoizedState;if(v!==null){var T=v.dehydrated;if(Ff(a),g)if(a.flags&256)a.flags&=-257,a=Iv(t,a,l);else if(a.memoizedState!==null)a.child=t.child,a.flags|=128,a=null;else throw Error(r(558));else if(mn||yo(t,a,l,!1),g=(l&t.childLanes)!==0,mn||g){if(u=It,u!==null&&(T=Ta(u,l),T!==0&&T!==v.retryLane))throw v.retryLane=T,Er(t,T),Kn(u,t,T),pm;eu(),a=Iv(t,a,l)}else t=v.treeContext,$t=Sa(T.nextSibling),_n=a,bt=!0,Ds=null,_a=!1,t!==null&&Cb(a,t),a=Vc(a,u),a.flags|=4096;return a}return t=os(t.child,{mode:u.mode,children:u.children}),t.ref=a.ref,a.child=t,t.return=a,t}function $c(t,a){var l=a.ref;if(l===null)t!==null&&t.ref!==null&&(a.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(r(284));(t===null||t.ref!==l)&&(a.flags|=4194816)}}function gm(t,a,l,u,g){return Tr(a),l=Kf(t,a,l,u,void 0,g),u=Qf(),t!==null&&!mn?(Zf(t,a,g),fs(t,a,g)):(bt&&u&&Tf(a),a.flags|=1,Sn(t,a,l,g),a.child)}function Uv(t,a,l,u,g,v){return Tr(a),a.updateQueue=null,l=Vb(a,u,l,g),qb(t),u=Qf(),t!==null&&!mn?(Zf(t,a,v),fs(t,a,v)):(bt&&u&&Tf(a),a.flags|=1,Sn(t,a,l,v),a.child)}function Hv(t,a,l,u,g){if(Tr(a),a.stateNode===null){var v=ho,T=l.contextType;typeof T=="object"&&T!==null&&(v=jn(T)),v=new l(u,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=fm,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=u,v.state=a.memoizedState,v.refs={},Hf(a),T=l.contextType,v.context=typeof T=="object"&&T!==null?jn(T):ho,v.state=a.memoizedState,T=l.getDerivedStateFromProps,typeof T=="function"&&(dm(a,l,T,u),v.state=a.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(T=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),T!==v.state&&fm.enqueueReplaceState(v,v.state,null),Dl(a,u,v,g),zl(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),u=!0}else if(t===null){v=a.stateNode;var z=a.memoizedProps,F=Lr(l,z);v.props=F;var ae=v.context,de=l.contextType;T=ho,typeof de=="object"&&de!==null&&(T=jn(de));var pe=l.getDerivedStateFromProps;de=typeof pe=="function"||typeof v.getSnapshotBeforeUpdate=="function",z=a.pendingProps!==z,de||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(z||ae!==T)&&kv(a,v,u,T),Bs=!1;var re=a.memoizedState;v.state=re,Dl(a,u,v,g),zl(),ae=a.memoizedState,z||re!==ae||Bs?(typeof pe=="function"&&(dm(a,l,pe,u),ae=a.memoizedState),(F=Bs||Ev(a,l,F,u,re,ae,T))?(de||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=u,a.memoizedState=ae),v.props=u,v.state=ae,v.context=T,u=F):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),u=!1)}else{v=a.stateNode,qf(t,a),T=a.memoizedProps,de=Lr(l,T),v.props=de,pe=a.pendingProps,re=v.context,ae=l.contextType,F=ho,typeof ae=="object"&&ae!==null&&(F=jn(ae)),z=l.getDerivedStateFromProps,(ae=typeof z=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T!==pe||re!==F)&&kv(a,v,u,F),Bs=!1,re=a.memoizedState,v.state=re,Dl(a,u,v,g),zl();var ue=a.memoizedState;T!==pe||re!==ue||Bs||t!==null&&t.dependencies!==null&&Cc(t.dependencies)?(typeof z=="function"&&(dm(a,l,z,u),ue=a.memoizedState),(de=Bs||Ev(a,l,de,u,re,ue,F)||t!==null&&t.dependencies!==null&&Cc(t.dependencies))?(ae||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(u,ue,F),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(u,ue,F)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||T===t.memoizedProps&&re===t.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||T===t.memoizedProps&&re===t.memoizedState||(a.flags|=1024),a.memoizedProps=u,a.memoizedState=ue),v.props=u,v.state=ue,v.context=F,u=de):(typeof v.componentDidUpdate!="function"||T===t.memoizedProps&&re===t.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||T===t.memoizedProps&&re===t.memoizedState||(a.flags|=1024),u=!1)}return v=u,$c(t,a),u=(a.flags&128)!==0,v||u?(v=a.stateNode,l=u&&typeof l.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,t!==null&&u?(a.child=zr(a,t.child,null,g),a.child=zr(a,null,l,g)):Sn(t,a,l,g),a.memoizedState=v.state,t=a.child):t=fs(t,a,g),t}function qv(t,a,l,u){return Nr(),a.flags|=256,Sn(t,a,l,u),a.child}var hm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xm(t){return{baseLanes:t,cachePool:Ab()}}function bm(t,a,l){return t=t!==null?t.childLanes&~l:0,a&&(t|=ia),t}function Vv(t,a,l){var u=a.pendingProps,g=!1,v=(a.flags&128)!==0,T;if((T=v)||(T=t!==null&&t.memoizedState===null?!1:(on.current&2)!==0),T&&(g=!0,a.flags&=-129),T=(a.flags&32)!==0,a.flags&=-33,t===null){if(bt){if(g?Hs(a):qs(),(t=$t)?(t=Zy(t,_a),t=t!==null&&t.data!=="&"?t:null,t!==null&&(a.memoizedState={dehydrated:t,treeContext:zs!==null?{id:Ua,overflow:Ha}:null,retryLane:536870912,hydrationErrors:null},l=jb(t),l.return=a,a.child=l,_n=a,$t=null)):t=null,t===null)throw Ls(a);return ep(t)?a.lanes=32:a.lanes=536870912,null}var z=u.children;return u=u.fallback,g?(qs(),g=a.mode,z=Gc({mode:"hidden",children:z},g),u=kr(u,g,l,null),z.return=a,u.return=a,z.sibling=u,a.child=z,u=a.child,u.memoizedState=xm(l),u.childLanes=bm(t,T,l),a.memoizedState=hm,Ul(null,u)):(Hs(a),vm(a,z))}var F=t.memoizedState;if(F!==null&&(z=F.dehydrated,z!==null)){if(v)a.flags&256?(Hs(a),a.flags&=-257,a=ym(t,a,l)):a.memoizedState!==null?(qs(),a.child=t.child,a.flags|=128,a=null):(qs(),z=u.fallback,g=a.mode,u=Gc({mode:"visible",children:u.children},g),z=kr(z,g,l,null),z.flags|=2,u.return=a,z.return=a,u.sibling=z,a.child=u,zr(a,t.child,null,l),u=a.child,u.memoizedState=xm(l),u.childLanes=bm(t,T,l),a.memoizedState=hm,a=Ul(null,u));else if(Hs(a),ep(z)){if(T=z.nextSibling&&z.nextSibling.dataset,T)var ae=T.dgst;T=ae,u=Error(r(419)),u.stack="",u.digest=T,Nl({value:u,source:null,stack:null}),a=ym(t,a,l)}else if(mn||yo(t,a,l,!1),T=(l&t.childLanes)!==0,mn||T){if(T=It,T!==null&&(u=Ta(T,l),u!==0&&u!==F.retryLane))throw F.retryLane=u,Er(t,u),Kn(T,t,u),pm;Wm(z)||eu(),a=ym(t,a,l)}else Wm(z)?(a.flags|=192,a.child=t.child,a=null):(t=F.treeContext,$t=Sa(z.nextSibling),_n=a,bt=!0,Ds=null,_a=!1,t!==null&&Cb(a,t),a=vm(a,u.children),a.flags|=4096);return a}return g?(qs(),z=u.fallback,g=a.mode,F=t.child,ae=F.sibling,u=os(F,{mode:"hidden",children:u.children}),u.subtreeFlags=F.subtreeFlags&65011712,ae!==null?z=os(ae,z):(z=kr(z,g,l,null),z.flags|=2),z.return=a,u.return=a,u.sibling=z,a.child=u,Ul(null,u),u=a.child,z=t.child.memoizedState,z===null?z=xm(l):(g=z.cachePool,g!==null?(F=dn._currentValue,g=g.parent!==F?{parent:F,pool:F}:g):g=Ab(),z={baseLanes:z.baseLanes|l,cachePool:g}),u.memoizedState=z,u.childLanes=bm(t,T,l),a.memoizedState=hm,Ul(t.child,u)):(Hs(a),l=t.child,t=l.sibling,l=os(l,{mode:"visible",children:u.children}),l.return=a,l.sibling=null,t!==null&&(T=a.deletions,T===null?(a.deletions=[t],a.flags|=16):T.push(t)),a.child=l,a.memoizedState=null,l)}function vm(t,a){return a=Gc({mode:"visible",children:a},t.mode),a.return=t,t.child=a}function Gc(t,a){return t=sa(22,t,null,a),t.lanes=0,t}function ym(t,a,l){return zr(a,t.child,null,l),t=vm(a,a.pendingProps.children),t.flags|=2,a.memoizedState=null,t}function $v(t,a,l){t.lanes|=a;var u=t.alternate;u!==null&&(u.lanes|=a),Df(t.return,a,l)}function _m(t,a,l,u,g,v){var T=t.memoizedState;T===null?t.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:u,tail:l,tailMode:g,treeForkCount:v}:(T.isBackwards=a,T.rendering=null,T.renderingStartTime=0,T.last=u,T.tail=l,T.tailMode=g,T.treeForkCount=v)}function Gv(t,a,l){var u=a.pendingProps,g=u.revealOrder,v=u.tail;u=u.children;var T=on.current,z=(T&2)!==0;if(z?(T=T&1|2,a.flags|=128):T&=1,$(on,T),Sn(t,a,u,l),u=bt?kl:0,!z&&t!==null&&(t.flags&128)!==0)e:for(t=a.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&$v(t,l,a);else if(t.tag===19)$v(t,l,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(g){case"forwards":for(l=a.child,g=null;l!==null;)t=l.alternate,t!==null&&Oc(t)===null&&(g=l),l=l.sibling;l=g,l===null?(g=a.child,a.child=null):(g=l.sibling,l.sibling=null),_m(a,!1,g,l,v,u);break;case"backwards":case"unstable_legacy-backwards":for(l=null,g=a.child,a.child=null;g!==null;){if(t=g.alternate,t!==null&&Oc(t)===null){a.child=g;break}t=g.sibling,g.sibling=l,l=g,g=t}_m(a,!0,l,null,v,u);break;case"together":_m(a,!1,null,null,void 0,u);break;default:a.memoizedState=null}return a.child}function fs(t,a,l){if(t!==null&&(a.dependencies=t.dependencies),Gs|=a.lanes,(l&a.childLanes)===0)if(t!==null){if(yo(t,a,l,!1),(l&a.childLanes)===0)return null}else return null;if(t!==null&&a.child!==t.child)throw Error(r(153));if(a.child!==null){for(t=a.child,l=os(t,t.pendingProps),a.child=l,l.return=a;t.sibling!==null;)t=t.sibling,l=l.sibling=os(t,t.pendingProps),l.return=a;l.sibling=null}return a.child}function jm(t,a){return(t.lanes&a)!==0?!0:(t=t.dependencies,!!(t!==null&&Cc(t)))}function IC(t,a,l){switch(a.tag){case 3:ie(a,a.stateNode.containerInfo),Ps(a,dn,t.memoizedState.cache),Nr();break;case 27:case 5:ke(a);break;case 4:ie(a,a.stateNode.containerInfo);break;case 10:Ps(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Ff(a),null;break;case 13:var u=a.memoizedState;if(u!==null)return u.dehydrated!==null?(Hs(a),a.flags|=128,null):(l&a.child.childLanes)!==0?Vv(t,a,l):(Hs(a),t=fs(t,a,l),t!==null?t.sibling:null);Hs(a);break;case 19:var g=(t.flags&128)!==0;if(u=(l&a.childLanes)!==0,u||(yo(t,a,l,!1),u=(l&a.childLanes)!==0),g){if(u)return Gv(t,a,l);a.flags|=128}if(g=a.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),$(on,on.current),u)break;return null;case 22:return a.lanes=0,Pv(t,a,l,a.pendingProps);case 24:Ps(a,dn,t.memoizedState.cache)}return fs(t,a,l)}function Yv(t,a,l){if(t!==null)if(t.memoizedProps!==a.pendingProps)mn=!0;else{if(!jm(t,l)&&(a.flags&128)===0)return mn=!1,IC(t,a,l);mn=(t.flags&131072)!==0}else mn=!1,bt&&(a.flags&1048576)!==0&&wb(a,kl,a.index);switch(a.lanes=0,a.tag){case 16:e:{var u=a.pendingProps;if(t=Mr(a.elementType),a.type=t,typeof t=="function")kf(t)?(u=Lr(t,u),a.tag=1,a=Hv(null,a,t,u,l)):(a.tag=0,a=gm(null,a,t,u,l));else{if(t!=null){var g=t.$$typeof;if(g===N){a.tag=11,a=zv(null,a,t,u,l);break e}else if(g===O){a.tag=14,a=Dv(null,a,t,u,l);break e}}throw a=Y(t)||t,Error(r(306,a,""))}}return a;case 0:return gm(t,a,a.type,a.pendingProps,l);case 1:return u=a.type,g=Lr(u,a.pendingProps),Hv(t,a,u,g,l);case 3:e:{if(ie(a,a.stateNode.containerInfo),t===null)throw Error(r(387));u=a.pendingProps;var v=a.memoizedState;g=v.element,qf(t,a),Dl(a,u,null,l);var T=a.memoizedState;if(u=T.cache,Ps(a,dn,u),u!==v.cache&&Lf(a,[dn],l,!0),zl(),u=T.element,v.isDehydrated)if(v={element:u,isDehydrated:!1,cache:T.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=qv(t,a,u,l);break e}else if(u!==g){g=ba(Error(r(424)),a),Nl(g),a=qv(t,a,u,l);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($t=Sa(t.firstChild),_n=a,bt=!0,Ds=null,_a=!0,l=Pb(a,null,u,l),a.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Nr(),u===g){a=fs(t,a,l);break e}Sn(t,a,u,l)}a=a.child}return a;case 26:return $c(t,a),t===null?(l=a0(a.type,null,a.pendingProps,null))?a.memoizedState=l:bt||(l=a.type,t=a.pendingProps,u=lu(ce.current).createElement(l),u[kt]=a,u[un]=t,wn(u,l,t),xn(u),a.stateNode=u):a.memoizedState=a0(a.type,t.memoizedProps,a.pendingProps,t.memoizedState),null;case 27:return ke(a),t===null&&bt&&(u=a.stateNode=e0(a.type,a.pendingProps,ce.current),_n=a,_a=!0,g=$t,Qs(a.type)?(tp=g,$t=Sa(u.firstChild)):$t=g),Sn(t,a,a.pendingProps.children,l),$c(t,a),t===null&&(a.flags|=4194304),a.child;case 5:return t===null&&bt&&((g=u=$t)&&(u=gE(u,a.type,a.pendingProps,_a),u!==null?(a.stateNode=u,_n=a,$t=Sa(u.firstChild),_a=!1,g=!0):g=!1),g||Ls(a)),ke(a),g=a.type,v=a.pendingProps,T=t!==null?t.memoizedProps:null,u=v.children,Qm(g,v)?u=null:T!==null&&Qm(g,T)&&(a.flags|=32),a.memoizedState!==null&&(g=Kf(t,a,TC,null,null,l),ti._currentValue=g),$c(t,a),Sn(t,a,u,l),a.child;case 6:return t===null&&bt&&((t=l=$t)&&(l=hE(l,a.pendingProps,_a),l!==null?(a.stateNode=l,_n=a,$t=null,t=!0):t=!1),t||Ls(a)),null;case 13:return Vv(t,a,l);case 4:return ie(a,a.stateNode.containerInfo),u=a.pendingProps,t===null?a.child=zr(a,null,u,l):Sn(t,a,u,l),a.child;case 11:return zv(t,a,a.type,a.pendingProps,l);case 7:return Sn(t,a,a.pendingProps,l),a.child;case 8:return Sn(t,a,a.pendingProps.children,l),a.child;case 12:return Sn(t,a,a.pendingProps.children,l),a.child;case 10:return u=a.pendingProps,Ps(a,a.type,u.value),Sn(t,a,u.children,l),a.child;case 9:return g=a.type._context,u=a.pendingProps.children,Tr(a),g=jn(g),u=u(g),a.flags|=1,Sn(t,a,u,l),a.child;case 14:return Dv(t,a,a.type,a.pendingProps,l);case 15:return Lv(t,a,a.type,a.pendingProps,l);case 19:return Gv(t,a,l);case 31:return BC(t,a,l);case 22:return Pv(t,a,l,a.pendingProps);case 24:return Tr(a),u=jn(dn),t===null?(g=If(),g===null&&(g=It,v=Pf(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=l),g=v),a.memoizedState={parent:u,cache:g},Hf(a),Ps(a,dn,g)):((t.lanes&l)!==0&&(qf(t,a),Dl(a,null,null,l),zl()),g=t.memoizedState,v=a.memoizedState,g.parent!==u?(g={parent:u,cache:u},a.memoizedState=g,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=g),Ps(a,dn,u)):(u=v.cache,Ps(a,dn,u),u!==g.cache&&Lf(a,[dn],l,!0))),Sn(t,a,a.pendingProps.children,l),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function ms(t){t.flags|=4}function Sm(t,a,l,u,g){if((a=(t.mode&32)!==0)&&(a=!1),a){if(t.flags|=16777216,(g&335544128)===g)if(t.stateNode.complete)t.flags|=8192;else if(vy())t.flags|=8192;else throw Or=Rc,Uf}else t.flags&=-16777217}function Fv(t,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!i0(a))if(vy())t.flags|=8192;else throw Or=Rc,Uf}function Yc(t,a){a!==null&&(t.flags|=4),t.flags&16384&&(a=t.tag!==22?qn():536870912,t.lanes|=a,Mo|=a)}function Hl(t,a){if(!bt)switch(t.tailMode){case"hidden":a=t.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t.tail=null:l.sibling=null;break;case"collapsed":l=t.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?a||t.tail===null?t.tail=null:t.tail.sibling=null:u.sibling=null}}function Gt(t){var a=t.alternate!==null&&t.alternate.child===t.child,l=0,u=0;if(a)for(var g=t.child;g!==null;)l|=g.lanes|g.childLanes,u|=g.subtreeFlags&65011712,u|=g.flags&65011712,g.return=t,g=g.sibling;else for(g=t.child;g!==null;)l|=g.lanes|g.childLanes,u|=g.subtreeFlags,u|=g.flags,g.return=t,g=g.sibling;return t.subtreeFlags|=u,t.childLanes=l,a}function UC(t,a,l){var u=a.pendingProps;switch(Af(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Gt(a),null;case 1:return Gt(a),null;case 3:return l=a.stateNode,u=null,t!==null&&(u=t.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),cs(dn),te(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(t===null||t.child===null)&&(vo(a)?ms(a):t===null||t.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Of())),Gt(a),null;case 26:var g=a.type,v=a.memoizedState;return t===null?(ms(a),v!==null?(Gt(a),Fv(a,v)):(Gt(a),Sm(a,g,null,u,l))):v?v!==t.memoizedState?(ms(a),Gt(a),Fv(a,v)):(Gt(a),a.flags&=-16777217):(t=t.memoizedProps,t!==u&&ms(a),Gt(a),Sm(a,g,t,u,l)),null;case 27:if($e(a),l=ce.current,g=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&ms(a);else{if(!u){if(a.stateNode===null)throw Error(r(166));return Gt(a),null}t=W.current,vo(a)?Eb(a):(t=e0(g,u,l),a.stateNode=t,ms(a))}return Gt(a),null;case 5:if($e(a),g=a.type,t!==null&&a.stateNode!=null)t.memoizedProps!==u&&ms(a);else{if(!u){if(a.stateNode===null)throw Error(r(166));return Gt(a),null}if(v=W.current,vo(a))Eb(a);else{var T=lu(ce.current);switch(v){case 1:v=T.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=T.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=T.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=T.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=T.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof u.is=="string"?T.createElement("select",{is:u.is}):T.createElement("select"),u.multiple?v.multiple=!0:u.size&&(v.size=u.size);break;default:v=typeof u.is=="string"?T.createElement(g,{is:u.is}):T.createElement(g)}}v[kt]=a,v[un]=u;e:for(T=a.child;T!==null;){if(T.tag===5||T.tag===6)v.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&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}a.stateNode=v;e:switch(wn(v,g,u),g){case"button":case"input":case"select":case"textarea":u=!!u.autoFocus;break e;case"img":u=!0;break e;default:u=!1}u&&ms(a)}}return Gt(a),Sm(a,a.type,t===null?null:t.memoizedProps,a.pendingProps,l),null;case 6:if(t&&a.stateNode!=null)t.memoizedProps!==u&&ms(a);else{if(typeof u!="string"&&a.stateNode===null)throw Error(r(166));if(t=ce.current,vo(a)){if(t=a.stateNode,l=a.memoizedProps,u=null,g=_n,g!==null)switch(g.tag){case 27:case 5:u=g.memoizedProps}t[kt]=a,t=!!(t.nodeValue===l||u!==null&&u.suppressHydrationWarning===!0||Vy(t.nodeValue,l)),t||Ls(a,!0)}else t=lu(t).createTextNode(u),t[kt]=a,a.stateNode=t}return Gt(a),null;case 31:if(l=a.memoizedState,t===null||t.memoizedState!==null){if(u=vo(a),l!==null){if(t===null){if(!u)throw Error(r(318));if(t=a.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(r(557));t[kt]=a}else Nr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Gt(a),t=!1}else l=Of(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=l),t=!0;if(!t)return a.flags&256?(oa(a),a):(oa(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Gt(a),null;case 13:if(u=a.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(g=vo(a),u!==null&&u.dehydrated!==null){if(t===null){if(!g)throw Error(r(318));if(g=a.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[kt]=a}else Nr(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Gt(a),g=!1}else g=Of(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=g),g=!0;if(!g)return a.flags&256?(oa(a),a):(oa(a),null)}return oa(a),(a.flags&128)!==0?(a.lanes=l,a):(l=u!==null,t=t!==null&&t.memoizedState!==null,l&&(u=a.child,g=null,u.alternate!==null&&u.alternate.memoizedState!==null&&u.alternate.memoizedState.cachePool!==null&&(g=u.alternate.memoizedState.cachePool.pool),v=null,u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(v=u.memoizedState.cachePool.pool),v!==g&&(u.flags|=2048)),l!==t&&l&&(a.child.flags|=8192),Yc(a,a.updateQueue),Gt(a),null);case 4:return te(),t===null&&Gm(a.stateNode.containerInfo),Gt(a),null;case 10:return cs(a.type),Gt(a),null;case 19:if(V(on),u=a.memoizedState,u===null)return Gt(a),null;if(g=(a.flags&128)!==0,v=u.rendering,v===null)if(g)Hl(u,!1);else{if(nn!==0||t!==null&&(t.flags&128)!==0)for(t=a.child;t!==null;){if(v=Oc(t),v!==null){for(a.flags|=128,Hl(u,!1),t=v.updateQueue,a.updateQueue=t,Yc(a,t),a.subtreeFlags=0,t=l,l=a.child;l!==null;)_b(l,t),l=l.sibling;return $(on,on.current&1|2),bt&&ls(a,u.treeForkCount),a.child}t=t.sibling}u.tail!==null&&ve()>Zc&&(a.flags|=128,g=!0,Hl(u,!1),a.lanes=4194304)}else{if(!g)if(t=Oc(v),t!==null){if(a.flags|=128,g=!0,t=t.updateQueue,a.updateQueue=t,Yc(a,t),Hl(u,!0),u.tail===null&&u.tailMode==="hidden"&&!v.alternate&&!bt)return Gt(a),null}else 2*ve()-u.renderingStartTime>Zc&&l!==536870912&&(a.flags|=128,g=!0,Hl(u,!1),a.lanes=4194304);u.isBackwards?(v.sibling=a.child,a.child=v):(t=u.last,t!==null?t.sibling=v:a.child=v,u.last=v)}return u.tail!==null?(t=u.tail,u.rendering=t,u.tail=t.sibling,u.renderingStartTime=ve(),t.sibling=null,l=on.current,$(on,g?l&1|2:l&1),bt&&ls(a,u.treeForkCount),t):(Gt(a),null);case 22:case 23:return oa(a),Yf(),u=a.memoizedState!==null,t!==null?t.memoizedState!==null!==u&&(a.flags|=8192):u&&(a.flags|=8192),u?(l&536870912)!==0&&(a.flags&128)===0&&(Gt(a),a.subtreeFlags&6&&(a.flags|=8192)):Gt(a),l=a.updateQueue,l!==null&&Yc(a,l.retryQueue),l=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),u=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(u=a.memoizedState.cachePool.pool),u!==l&&(a.flags|=2048),t!==null&&V(Ar),null;case 24:return l=null,t!==null&&(l=t.memoizedState.cache),a.memoizedState.cache!==l&&(a.flags|=2048),cs(dn),Gt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function HC(t,a){switch(Af(a),a.tag){case 1:return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 3:return cs(dn),te(),t=a.flags,(t&65536)!==0&&(t&128)===0?(a.flags=t&-65537|128,a):null;case 26:case 27:case 5:return $e(a),null;case 31:if(a.memoizedState!==null){if(oa(a),a.alternate===null)throw Error(r(340));Nr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 13:if(oa(a),t=a.memoizedState,t!==null&&t.dehydrated!==null){if(a.alternate===null)throw Error(r(340));Nr()}return t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 19:return V(on),null;case 4:return te(),null;case 10:return cs(a.type),null;case 22:case 23:return oa(a),Yf(),t!==null&&V(Ar),t=a.flags,t&65536?(a.flags=t&-65537|128,a):null;case 24:return cs(dn),null;case 25:return null;default:return null}}function Xv(t,a){switch(Af(a),a.tag){case 3:cs(dn),te();break;case 26:case 27:case 5:$e(a);break;case 4:te();break;case 31:a.memoizedState!==null&&oa(a);break;case 13:oa(a);break;case 19:V(on);break;case 10:cs(a.type);break;case 22:case 23:oa(a),Yf(),t!==null&&V(Ar);break;case 24:cs(dn)}}function ql(t,a){try{var l=a.updateQueue,u=l!==null?l.lastEffect:null;if(u!==null){var g=u.next;l=g;do{if((l.tag&t)===t){u=void 0;var v=l.create,T=l.inst;u=v(),T.destroy=u}l=l.next}while(l!==g)}}catch(z){Rt(a,a.return,z)}}function Vs(t,a,l){try{var u=a.updateQueue,g=u!==null?u.lastEffect:null;if(g!==null){var v=g.next;u=v;do{if((u.tag&t)===t){var T=u.inst,z=T.destroy;if(z!==void 0){T.destroy=void 0,g=a;var F=l,ae=z;try{ae()}catch(de){Rt(g,F,de)}}}u=u.next}while(u!==v)}}catch(de){Rt(a,a.return,de)}}function Kv(t){var a=t.updateQueue;if(a!==null){var l=t.stateNode;try{Ib(a,l)}catch(u){Rt(t,t.return,u)}}}function Qv(t,a,l){l.props=Lr(t.type,t.memoizedProps),l.state=t.memoizedState;try{l.componentWillUnmount()}catch(u){Rt(t,a,u)}}function Vl(t,a){try{var l=t.ref;if(l!==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 l=="function"?t.refCleanup=l(u):l.current=u}}catch(g){Rt(t,a,g)}}function qa(t,a){var l=t.ref,u=t.refCleanup;if(l!==null)if(typeof u=="function")try{u()}catch(g){Rt(t,a,g)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(g){Rt(t,a,g)}else l.current=null}function Zv(t){var a=t.type,l=t.memoizedProps,u=t.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":l.autoFocus&&u.focus();break e;case"img":l.src?u.src=l.src:l.srcSet&&(u.srcset=l.srcSet)}}catch(g){Rt(t,t.return,g)}}function wm(t,a,l){try{var u=t.stateNode;cE(u,t.type,l,a),u[un]=a}catch(g){Rt(t,t.return,g)}}function Jv(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&Qs(t.type)||t.tag===4}function Cm(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Jv(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&&Qs(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 Em(t,a,l){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(t,a):(a=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,a.appendChild(t),l=l._reactRootContainer,l!=null||a.onclick!==null||(a.onclick=ss));else if(u!==4&&(u===27&&Qs(t.type)&&(l=t.stateNode,a=null),t=t.child,t!==null))for(Em(t,a,l),t=t.sibling;t!==null;)Em(t,a,l),t=t.sibling}function Fc(t,a,l){var u=t.tag;if(u===5||u===6)t=t.stateNode,a?l.insertBefore(t,a):l.appendChild(t);else if(u!==4&&(u===27&&Qs(t.type)&&(l=t.stateNode),t=t.child,t!==null))for(Fc(t,a,l),t=t.sibling;t!==null;)Fc(t,a,l),t=t.sibling}function Wv(t){var a=t.stateNode,l=t.memoizedProps;try{for(var u=t.type,g=a.attributes;g.length;)a.removeAttributeNode(g[0]);wn(a,u,l),a[kt]=t,a[un]=l}catch(v){Rt(t,t.return,v)}}var ps=!1,pn=!1,km=!1,ey=typeof WeakSet=="function"?WeakSet:Set,bn=null;function qC(t,a){if(t=t.containerInfo,Xm=pu,t=fb(t),yf(t)){if("selectionStart"in t)var l={start:t.selectionStart,end:t.selectionEnd};else e:{l=(l=t.ownerDocument)&&l.defaultView||window;var u=l.getSelection&&l.getSelection();if(u&&u.rangeCount!==0){l=u.anchorNode;var g=u.anchorOffset,v=u.focusNode;u=u.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break e}var T=0,z=-1,F=-1,ae=0,de=0,pe=t,re=null;t:for(;;){for(var ue;pe!==l||g!==0&&pe.nodeType!==3||(z=T+g),pe!==v||u!==0&&pe.nodeType!==3||(F=T+u),pe.nodeType===3&&(T+=pe.nodeValue.length),(ue=pe.firstChild)!==null;)re=pe,pe=ue;for(;;){if(pe===t)break t;if(re===l&&++ae===g&&(z=T),re===v&&++de===u&&(F=T),(ue=pe.nextSibling)!==null)break;pe=re,re=pe.parentNode}pe=ue}l=z===-1||F===-1?null:{start:z,end:F}}else l=null}l=l||{start:0,end:0}}else l=null;for(Km={focusedElem:t,selectionRange:l},pu=!1,bn=a;bn!==null;)if(a=bn,t=a.child,(a.subtreeFlags&1028)!==0&&t!==null)t.return=a,bn=t;else for(;bn!==null;){switch(a=bn,v=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(l=0;l<t.length;l++)g=t[l],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&v!==null){t=void 0,l=a,g=v.memoizedProps,v=v.memoizedState,u=l.stateNode;try{var Pe=Lr(l.type,g);t=u.getSnapshotBeforeUpdate(Pe,v),u.__reactInternalSnapshotBeforeUpdate=t}catch(Ke){Rt(l,l.return,Ke)}}break;case 3:if((t&1024)!==0){if(t=a.stateNode.containerInfo,l=t.nodeType,l===9)Jm(t);else if(l===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Jm(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(r(163))}if(t=a.sibling,t!==null){t.return=a.return,bn=t;break}bn=a.return}}function ty(t,a,l){var u=l.flags;switch(l.tag){case 0:case 11:case 15:hs(t,l),u&4&&ql(5,l);break;case 1:if(hs(t,l),u&4)if(t=l.stateNode,a===null)try{t.componentDidMount()}catch(T){Rt(l,l.return,T)}else{var g=Lr(l.type,a.memoizedProps);a=a.memoizedState;try{t.componentDidUpdate(g,a,t.__reactInternalSnapshotBeforeUpdate)}catch(T){Rt(l,l.return,T)}}u&64&&Kv(l),u&512&&Vl(l,l.return);break;case 3:if(hs(t,l),u&64&&(t=l.updateQueue,t!==null)){if(a=null,l.child!==null)switch(l.child.tag){case 27:case 5:a=l.child.stateNode;break;case 1:a=l.child.stateNode}try{Ib(t,a)}catch(T){Rt(l,l.return,T)}}break;case 27:a===null&&u&4&&Wv(l);case 26:case 5:hs(t,l),a===null&&u&4&&Zv(l),u&512&&Vl(l,l.return);break;case 12:hs(t,l);break;case 31:hs(t,l),u&4&&sy(t,l);break;case 13:hs(t,l),u&4&&ry(t,l),u&64&&(t=l.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(l=ZC.bind(null,l),xE(t,l))));break;case 22:if(u=l.memoizedState!==null||ps,!u){a=a!==null&&a.memoizedState!==null||pn,g=ps;var v=pn;ps=u,(pn=a)&&!v?xs(t,l,(l.subtreeFlags&8772)!==0):hs(t,l),ps=g,pn=v}break;case 30:break;default:hs(t,l)}}function ny(t){var a=t.alternate;a!==null&&(t.alternate=null,ny(a)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(a=t.stateNode,a!==null&&nf(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 Kt=null,Gn=!1;function gs(t,a,l){for(l=l.child;l!==null;)ay(t,a,l),l=l.sibling}function ay(t,a,l){if(it&&typeof it.onCommitFiberUnmount=="function")try{it.onCommitFiberUnmount(ut,l)}catch{}switch(l.tag){case 26:pn||qa(l,a),gs(t,a,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:pn||qa(l,a);var u=Kt,g=Gn;Qs(l.type)&&(Kt=l.stateNode,Gn=!1),gs(t,a,l),Jl(l.stateNode),Kt=u,Gn=g;break;case 5:pn||qa(l,a);case 6:if(u=Kt,g=Gn,Kt=null,gs(t,a,l),Kt=u,Gn=g,Kt!==null)if(Gn)try{(Kt.nodeType===9?Kt.body:Kt.nodeName==="HTML"?Kt.ownerDocument.body:Kt).removeChild(l.stateNode)}catch(v){Rt(l,a,v)}else try{Kt.removeChild(l.stateNode)}catch(v){Rt(l,a,v)}break;case 18:Kt!==null&&(Gn?(t=Kt,Ky(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,l.stateNode),Uo(t)):Ky(Kt,l.stateNode));break;case 4:u=Kt,g=Gn,Kt=l.stateNode.containerInfo,Gn=!0,gs(t,a,l),Kt=u,Gn=g;break;case 0:case 11:case 14:case 15:Vs(2,l,a),pn||Vs(4,l,a),gs(t,a,l);break;case 1:pn||(qa(l,a),u=l.stateNode,typeof u.componentWillUnmount=="function"&&Qv(l,a,u)),gs(t,a,l);break;case 21:gs(t,a,l);break;case 22:pn=(u=pn)||l.memoizedState!==null,gs(t,a,l),pn=u;break;default:gs(t,a,l)}}function sy(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Uo(t)}catch(l){Rt(a,a.return,l)}}}function ry(t,a){if(a.memoizedState===null&&(t=a.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Uo(t)}catch(l){Rt(a,a.return,l)}}function VC(t){switch(t.tag){case 31:case 13:case 19:var a=t.stateNode;return a===null&&(a=t.stateNode=new ey),a;case 22:return t=t.stateNode,a=t._retryCache,a===null&&(a=t._retryCache=new ey),a;default:throw Error(r(435,t.tag))}}function Xc(t,a){var l=VC(t);a.forEach(function(u){if(!l.has(u)){l.add(u);var g=JC.bind(null,t,u);u.then(g,g)}})}function Yn(t,a){var l=a.deletions;if(l!==null)for(var u=0;u<l.length;u++){var g=l[u],v=t,T=a,z=T;e:for(;z!==null;){switch(z.tag){case 27:if(Qs(z.type)){Kt=z.stateNode,Gn=!1;break e}break;case 5:Kt=z.stateNode,Gn=!1;break e;case 3:case 4:Kt=z.stateNode.containerInfo,Gn=!0;break e}z=z.return}if(Kt===null)throw Error(r(160));ay(v,T,g),Kt=null,Gn=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)oy(a,t),a=a.sibling}var Ma=null;function oy(t,a){var l=t.alternate,u=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Yn(a,t),Fn(t),u&4&&(Vs(3,t,t.return),ql(3,t),Vs(5,t,t.return));break;case 1:Yn(a,t),Fn(t),u&512&&(pn||l===null||qa(l,l.return)),u&64&&ps&&(t=t.updateQueue,t!==null&&(u=t.callbacks,u!==null&&(l=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=l===null?u:l.concat(u))));break;case 26:var g=Ma;if(Yn(a,t),Fn(t),u&512&&(pn||l===null||qa(l,l.return)),u&4){var v=l!==null?l.memoizedState:null;if(u=t.memoizedState,l===null)if(u===null)if(t.stateNode===null){e:{u=t.type,l=t.memoizedProps,g=g.ownerDocument||g;t:switch(u){case"title":v=g.getElementsByTagName("title")[0],(!v||v[hl]||v[kt]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(u),g.head.insertBefore(v,g.querySelector("head > title"))),wn(v,u,l),v[kt]=t,xn(v),u=v;break e;case"link":var T=o0("link","href",g).get(u+(l.href||""));if(T){for(var z=0;z<T.length;z++)if(v=T[z],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){T.splice(z,1);break t}}v=g.createElement(u),wn(v,u,l),g.head.appendChild(v);break;case"meta":if(T=o0("meta","content",g).get(u+(l.content||""))){for(z=0;z<T.length;z++)if(v=T[z],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){T.splice(z,1);break t}}v=g.createElement(u),wn(v,u,l),g.head.appendChild(v);break;default:throw Error(r(468,u))}v[kt]=t,xn(v),u=v}t.stateNode=u}else l0(g,t.type,t.stateNode);else t.stateNode=r0(g,u,t.memoizedProps);else v!==u?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,u===null?l0(g,t.type,t.stateNode):r0(g,u,t.memoizedProps)):u===null&&t.stateNode!==null&&wm(t,t.memoizedProps,l.memoizedProps)}break;case 27:Yn(a,t),Fn(t),u&512&&(pn||l===null||qa(l,l.return)),l!==null&&u&4&&wm(t,t.memoizedProps,l.memoizedProps);break;case 5:if(Yn(a,t),Fn(t),u&512&&(pn||l===null||qa(l,l.return)),t.flags&32){g=t.stateNode;try{io(g,"")}catch(Pe){Rt(t,t.return,Pe)}}u&4&&t.stateNode!=null&&(g=t.memoizedProps,wm(t,g,l!==null?l.memoizedProps:g)),u&1024&&(km=!0);break;case 6:if(Yn(a,t),Fn(t),u&4){if(t.stateNode===null)throw Error(r(162));u=t.memoizedProps,l=t.stateNode;try{l.nodeValue=u}catch(Pe){Rt(t,t.return,Pe)}}break;case 3:if(uu=null,g=Ma,Ma=iu(a.containerInfo),Yn(a,t),Ma=g,Fn(t),u&4&&l!==null&&l.memoizedState.isDehydrated)try{Uo(a.containerInfo)}catch(Pe){Rt(t,t.return,Pe)}km&&(km=!1,ly(t));break;case 4:u=Ma,Ma=iu(t.stateNode.containerInfo),Yn(a,t),Fn(t),Ma=u;break;case 12:Yn(a,t),Fn(t);break;case 31:Yn(a,t),Fn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Xc(t,u)));break;case 13:Yn(a,t),Fn(t),t.child.flags&8192&&t.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Qc=ve()),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Xc(t,u)));break;case 22:g=t.memoizedState!==null;var F=l!==null&&l.memoizedState!==null,ae=ps,de=pn;if(ps=ae||g,pn=de||F,Yn(a,t),pn=de,ps=ae,Fn(t),u&8192)e:for(a=t.stateNode,a._visibility=g?a._visibility&-2:a._visibility|1,g&&(l===null||F||ps||pn||Pr(t)),l=null,a=t;;){if(a.tag===5||a.tag===26){if(l===null){F=l=a;try{if(v=F.stateNode,g)T=v.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{z=F.stateNode;var pe=F.memoizedProps.style,re=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;z.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(Pe){Rt(F,F.return,Pe)}}}else if(a.tag===6){if(l===null){F=a;try{F.stateNode.nodeValue=g?"":F.memoizedProps}catch(Pe){Rt(F,F.return,Pe)}}}else if(a.tag===18){if(l===null){F=a;try{var ue=F.stateNode;g?Qy(ue,!0):Qy(F.stateNode,!1)}catch(Pe){Rt(F,F.return,Pe)}}}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;l===a&&(l=null),a=a.return}l===a&&(l=null),a.sibling.return=a.return,a=a.sibling}u&4&&(u=t.updateQueue,u!==null&&(l=u.retryQueue,l!==null&&(u.retryQueue=null,Xc(t,l))));break;case 19:Yn(a,t),Fn(t),u&4&&(u=t.updateQueue,u!==null&&(t.updateQueue=null,Xc(t,u)));break;case 30:break;case 21:break;default:Yn(a,t),Fn(t)}}function Fn(t){var a=t.flags;if(a&2){try{for(var l,u=t.return;u!==null;){if(Jv(u)){l=u;break}u=u.return}if(l==null)throw Error(r(160));switch(l.tag){case 27:var g=l.stateNode,v=Cm(t);Fc(t,v,g);break;case 5:var T=l.stateNode;l.flags&32&&(io(T,""),l.flags&=-33);var z=Cm(t);Fc(t,z,T);break;case 3:case 4:var F=l.stateNode.containerInfo,ae=Cm(t);Em(t,ae,F);break;default:throw Error(r(161))}}catch(de){Rt(t,t.return,de)}t.flags&=-3}a&4096&&(t.flags&=-4097)}function ly(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var a=t;ly(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),t=t.sibling}}function hs(t,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)ty(t,a.alternate,a),a=a.sibling}function Pr(t){for(t=t.child;t!==null;){var a=t;switch(a.tag){case 0:case 11:case 14:case 15:Vs(4,a,a.return),Pr(a);break;case 1:qa(a,a.return);var l=a.stateNode;typeof l.componentWillUnmount=="function"&&Qv(a,a.return,l),Pr(a);break;case 27:Jl(a.stateNode);case 26:case 5:qa(a,a.return),Pr(a);break;case 22:a.memoizedState===null&&Pr(a);break;case 30:Pr(a);break;default:Pr(a)}t=t.sibling}}function xs(t,a,l){for(l=l&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var u=a.alternate,g=t,v=a,T=v.flags;switch(v.tag){case 0:case 11:case 15:xs(g,v,l),ql(4,v);break;case 1:if(xs(g,v,l),u=v,g=u.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(ae){Rt(u,u.return,ae)}if(u=v,g=u.updateQueue,g!==null){var z=u.stateNode;try{var F=g.shared.hiddenCallbacks;if(F!==null)for(g.shared.hiddenCallbacks=null,g=0;g<F.length;g++)Bb(F[g],z)}catch(ae){Rt(u,u.return,ae)}}l&&T&64&&Kv(v),Vl(v,v.return);break;case 27:Wv(v);case 26:case 5:xs(g,v,l),l&&u===null&&T&4&&Zv(v),Vl(v,v.return);break;case 12:xs(g,v,l);break;case 31:xs(g,v,l),l&&T&4&&sy(g,v);break;case 13:xs(g,v,l),l&&T&4&&ry(g,v);break;case 22:v.memoizedState===null&&xs(g,v,l),Vl(v,v.return);break;case 30:break;default:xs(g,v,l)}a=a.sibling}}function Nm(t,a){var l=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),t=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(t=a.memoizedState.cachePool.pool),t!==l&&(t!=null&&t.refCount++,l!=null&&Rl(l))}function Rm(t,a){t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Rl(t))}function Oa(t,a,l,u){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)iy(t,a,l,u),a=a.sibling}function iy(t,a,l,u){var g=a.flags;switch(a.tag){case 0:case 11:case 15:Oa(t,a,l,u),g&2048&&ql(9,a);break;case 1:Oa(t,a,l,u);break;case 3:Oa(t,a,l,u),g&2048&&(t=null,a.alternate!==null&&(t=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==t&&(a.refCount++,t!=null&&Rl(t)));break;case 12:if(g&2048){Oa(t,a,l,u),t=a.stateNode;try{var v=a.memoizedProps,T=v.id,z=v.onPostCommit;typeof z=="function"&&z(T,a.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(F){Rt(a,a.return,F)}}else Oa(t,a,l,u);break;case 31:Oa(t,a,l,u);break;case 13:Oa(t,a,l,u);break;case 23:break;case 22:v=a.stateNode,T=a.alternate,a.memoizedState!==null?v._visibility&2?Oa(t,a,l,u):$l(t,a):v._visibility&2?Oa(t,a,l,u):(v._visibility|=2,Ro(t,a,l,u,(a.subtreeFlags&10256)!==0||!1)),g&2048&&Nm(T,a);break;case 24:Oa(t,a,l,u),g&2048&&Rm(a.alternate,a);break;default:Oa(t,a,l,u)}}function Ro(t,a,l,u,g){for(g=g&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=t,T=a,z=l,F=u,ae=T.flags;switch(T.tag){case 0:case 11:case 15:Ro(v,T,z,F,g),ql(8,T);break;case 23:break;case 22:var de=T.stateNode;T.memoizedState!==null?de._visibility&2?Ro(v,T,z,F,g):$l(v,T):(de._visibility|=2,Ro(v,T,z,F,g)),g&&ae&2048&&Nm(T.alternate,T);break;case 24:Ro(v,T,z,F,g),g&&ae&2048&&Rm(T.alternate,T);break;default:Ro(v,T,z,F,g)}a=a.sibling}}function $l(t,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var l=t,u=a,g=u.flags;switch(u.tag){case 22:$l(l,u),g&2048&&Nm(u.alternate,u);break;case 24:$l(l,u),g&2048&&Rm(u.alternate,u);break;default:$l(l,u)}a=a.sibling}}var Gl=8192;function To(t,a,l){if(t.subtreeFlags&Gl)for(t=t.child;t!==null;)cy(t,a,l),t=t.sibling}function cy(t,a,l){switch(t.tag){case 26:To(t,a,l),t.flags&Gl&&t.memoizedState!==null&&RE(l,Ma,t.memoizedState,t.memoizedProps);break;case 5:To(t,a,l);break;case 3:case 4:var u=Ma;Ma=iu(t.stateNode.containerInfo),To(t,a,l),Ma=u;break;case 22:t.memoizedState===null&&(u=t.alternate,u!==null&&u.memoizedState!==null?(u=Gl,Gl=16777216,To(t,a,l),Gl=u):To(t,a,l));break;default:To(t,a,l)}}function uy(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 Yl(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var u=a[l];bn=u,fy(u,t)}uy(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)dy(t),t=t.sibling}function dy(t){switch(t.tag){case 0:case 11:case 15:Yl(t),t.flags&2048&&Vs(9,t,t.return);break;case 3:Yl(t);break;case 12:Yl(t);break;case 22:var a=t.stateNode;t.memoizedState!==null&&a._visibility&2&&(t.return===null||t.return.tag!==13)?(a._visibility&=-3,Kc(t)):Yl(t);break;default:Yl(t)}}function Kc(t){var a=t.deletions;if((t.flags&16)!==0){if(a!==null)for(var l=0;l<a.length;l++){var u=a[l];bn=u,fy(u,t)}uy(t)}for(t=t.child;t!==null;){switch(a=t,a.tag){case 0:case 11:case 15:Vs(8,a,a.return),Kc(a);break;case 22:l=a.stateNode,l._visibility&2&&(l._visibility&=-3,Kc(a));break;default:Kc(a)}t=t.sibling}}function fy(t,a){for(;bn!==null;){var l=bn;switch(l.tag){case 0:case 11:case 15:Vs(8,l,a);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var u=l.memoizedState.cachePool.pool;u!=null&&u.refCount++}break;case 24:Rl(l.memoizedState.cache)}if(u=l.child,u!==null)u.return=l,bn=u;else e:for(l=t;bn!==null;){u=bn;var g=u.sibling,v=u.return;if(ny(u),u===l){bn=null;break e}if(g!==null){g.return=v,bn=g;break e}bn=v}}}var $C={getCacheForType:function(t){var a=jn(dn),l=a.data.get(t);return l===void 0&&(l=t(),a.data.set(t,l)),l},cacheSignal:function(){return jn(dn).controller.signal}},GC=typeof WeakMap=="function"?WeakMap:Map,wt=0,It=null,ft=null,pt=0,Nt=0,la=null,$s=!1,Ao=!1,Tm=!1,bs=0,nn=0,Gs=0,Br=0,Am=0,ia=0,Mo=0,Fl=null,Xn=null,Mm=!1,Qc=0,my=0,Zc=1/0,Jc=null,Ys=null,hn=0,Fs=null,Oo=null,vs=0,Om=0,zm=null,py=null,Xl=0,Dm=null;function ca(){return(wt&2)!==0&&pt!==0?pt&-pt:q.T!==null?Hm():At()}function gy(){if(ia===0)if((pt&536870912)===0||bt){var t=Xt;Xt<<=1,(Xt&3932160)===0&&(Xt=262144),ia=t}else ia=536870912;return t=ra.current,t!==null&&(t.flags|=32),ia}function Kn(t,a,l){(t===It&&(Nt===2||Nt===9)||t.cancelPendingCommit!==null)&&(zo(t,0),Xs(t,pt,ia,!1)),Vn(t,l),((wt&2)===0||t!==It)&&(t===It&&((wt&2)===0&&(Br|=l),nn===4&&Xs(t,pt,ia,!1)),Va(t))}function hy(t,a,l){if((wt&6)!==0)throw Error(r(327));var u=!l&&(a&127)===0&&(a&t.expiredLanes)===0||rn(t,a),g=u?XC(t,a):Pm(t,a,!0),v=u;do{if(g===0){Ao&&!u&&Xs(t,a,0,!1);break}else{if(l=t.current.alternate,v&&!YC(l)){g=Pm(t,a,!1),v=!1;continue}if(g===2){if(v=a,t.errorRecoveryDisabledLanes&v)var T=0;else T=t.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){a=T;e:{var z=t;g=Fl;var F=z.current.memoizedState.isDehydrated;if(F&&(zo(z,T).flags|=256),T=Pm(z,T,!1),T!==2){if(Tm&&!F){z.errorRecoveryDisabledLanes|=v,Br|=v,g=4;break e}v=Xn,Xn=g,v!==null&&(Xn===null?Xn=v:Xn.push.apply(Xn,v))}g=T}if(v=!1,g!==2)continue}}if(g===1){zo(t,0),Xs(t,a,0,!0);break}e:{switch(u=t,v=g,v){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Xs(u,a,ia,!$s);break e;case 2:Xn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(g=Qc+300-ve(),10<g)){if(Xs(u,a,ia,!$s),Vt(u,0,!0)!==0)break e;vs=a,u.timeoutHandle=Fy(xy.bind(null,u,l,Xn,Jc,Mm,a,ia,Br,Mo,$s,v,"Throttled",-0,0),g);break e}xy(u,l,Xn,Jc,Mm,a,ia,Br,Mo,$s,v,null,-0,0)}}break}while(!0);Va(t)}function xy(t,a,l,u,g,v,T,z,F,ae,de,pe,re,ue){if(t.timeoutHandle=-1,pe=a.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:ss},cy(a,v,pe);var Pe=(v&62914560)===v?Qc-ve():(v&4194048)===v?my-ve():0;if(Pe=TE(pe,Pe),Pe!==null){vs=v,t.cancelPendingCommit=Pe(Cy.bind(null,t,a,v,l,u,g,T,z,F,de,pe,null,re,ue)),Xs(t,v,T,!ae);return}}Cy(t,a,v,l,u,g,T,z,F)}function YC(t){for(var a=t;;){var l=a.tag;if((l===0||l===11||l===15)&&a.flags&16384&&(l=a.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var u=0;u<l.length;u++){var g=l[u],v=g.getSnapshot;g=g.value;try{if(!aa(v(),g))return!1}catch{return!1}}if(l=a.child,a.subtreeFlags&16384&&l!==null)l.return=a,a=l;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 Xs(t,a,l,u){a&=~Am,a&=~Br,t.suspendedLanes|=a,t.pingedLanes&=~a,u&&(t.warmLanes|=a),u=t.expirationTimes;for(var g=a;0<g;){var v=31-Bt(g),T=1<<v;u[v]=-1,g&=~T}l!==0&&An(t,l,a)}function Wc(){return(wt&6)===0?(Kl(0),!1):!0}function Lm(){if(ft!==null){if(Nt===0)var t=ft.return;else t=ft,is=Rr=null,Jf(t),wo=null,Al=0,t=ft;for(;t!==null;)Xv(t.alternate,t),t=t.return;ft=null}}function zo(t,a){var l=t.timeoutHandle;l!==-1&&(t.timeoutHandle=-1,fE(l)),l=t.cancelPendingCommit,l!==null&&(t.cancelPendingCommit=null,l()),vs=0,Lm(),It=t,ft=l=os(t.current,null),pt=a,Nt=0,la=null,$s=!1,Ao=rn(t,a),Tm=!1,Mo=ia=Am=Br=Gs=nn=0,Xn=Fl=null,Mm=!1,(a&8)!==0&&(a|=a&32);var u=t.entangledLanes;if(u!==0)for(t=t.entanglements,u&=a;0<u;){var g=31-Bt(u),v=1<<g;a|=t[g],u&=~v}return bs=a,yc(),l}function by(t,a){et=null,q.H=Il,a===So||a===Nc?(a=zb(),Nt=3):a===Uf?(a=zb(),Nt=4):Nt=a===pm?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,la=a,ft===null&&(nn=1,qc(t,ba(a,t.current)))}function vy(){var t=ra.current;return t===null?!0:(pt&4194048)===pt?ja===null:(pt&62914560)===pt||(pt&536870912)!==0?t===ja:!1}function yy(){var t=q.H;return q.H=Il,t===null?Il:t}function _y(){var t=q.A;return q.A=$C,t}function eu(){nn=4,$s||(pt&4194048)!==pt&&ra.current!==null||(Ao=!0),(Gs&134217727)===0&&(Br&134217727)===0||It===null||Xs(It,pt,ia,!1)}function Pm(t,a,l){var u=wt;wt|=2;var g=yy(),v=_y();(It!==t||pt!==a)&&(Jc=null,zo(t,a)),a=!1;var T=nn;e:do try{if(Nt!==0&&ft!==null){var z=ft,F=la;switch(Nt){case 8:Lm(),T=6;break e;case 3:case 2:case 9:case 6:ra.current===null&&(a=!0);var ae=Nt;if(Nt=0,la=null,Do(t,z,F,ae),l&&Ao){T=0;break e}break;default:ae=Nt,Nt=0,la=null,Do(t,z,F,ae)}}FC(),T=nn;break}catch(de){by(t,de)}while(!0);return a&&t.shellSuspendCounter++,is=Rr=null,wt=u,q.H=g,q.A=v,ft===null&&(It=null,pt=0,yc()),T}function FC(){for(;ft!==null;)jy(ft)}function XC(t,a){var l=wt;wt|=2;var u=yy(),g=_y();It!==t||pt!==a?(Jc=null,Zc=ve()+500,zo(t,a)):Ao=rn(t,a);e:do try{if(Nt!==0&&ft!==null){a=ft;var v=la;t:switch(Nt){case 1:Nt=0,la=null,Do(t,a,v,1);break;case 2:case 9:if(Mb(v)){Nt=0,la=null,Sy(a);break}a=function(){Nt!==2&&Nt!==9||It!==t||(Nt=7),Va(t)},v.then(a,a);break e;case 3:Nt=7;break e;case 4:Nt=5;break e;case 7:Mb(v)?(Nt=0,la=null,Sy(a)):(Nt=0,la=null,Do(t,a,v,7));break;case 5:var T=null;switch(ft.tag){case 26:T=ft.memoizedState;case 5:case 27:var z=ft;if(T?i0(T):z.stateNode.complete){Nt=0,la=null;var F=z.sibling;if(F!==null)ft=F;else{var ae=z.return;ae!==null?(ft=ae,tu(ae)):ft=null}break t}}Nt=0,la=null,Do(t,a,v,5);break;case 6:Nt=0,la=null,Do(t,a,v,6);break;case 8:Lm(),nn=6;break e;default:throw Error(r(462))}}KC();break}catch(de){by(t,de)}while(!0);return is=Rr=null,q.H=u,q.A=g,wt=l,ft!==null?0:(It=null,pt=0,yc(),nn)}function KC(){for(;ft!==null&&!qe();)jy(ft)}function jy(t){var a=Yv(t.alternate,t,bs);t.memoizedProps=t.pendingProps,a===null?tu(t):ft=a}function Sy(t){var a=t,l=a.alternate;switch(a.tag){case 15:case 0:a=Uv(l,a,a.pendingProps,a.type,void 0,pt);break;case 11:a=Uv(l,a,a.pendingProps,a.type.render,a.ref,pt);break;case 5:Jf(a);default:Xv(l,a),a=ft=_b(a,bs),a=Yv(l,a,bs)}t.memoizedProps=t.pendingProps,a===null?tu(t):ft=a}function Do(t,a,l,u){is=Rr=null,Jf(a),wo=null,Al=0;var g=a.return;try{if(PC(t,g,a,l,pt)){nn=1,qc(t,ba(l,t.current)),ft=null;return}}catch(v){if(g!==null)throw ft=g,v;nn=1,qc(t,ba(l,t.current)),ft=null;return}a.flags&32768?(bt||u===1?t=!0:Ao||(pt&536870912)!==0?t=!1:($s=t=!0,(u===2||u===9||u===3||u===6)&&(u=ra.current,u!==null&&u.tag===13&&(u.flags|=16384))),wy(a,t)):tu(a)}function tu(t){var a=t;do{if((a.flags&32768)!==0){wy(a,$s);return}t=a.return;var l=UC(a.alternate,a,bs);if(l!==null){ft=l;return}if(a=a.sibling,a!==null){ft=a;return}ft=a=t}while(a!==null);nn===0&&(nn=5)}function wy(t,a){do{var l=HC(t.alternate,t);if(l!==null){l.flags&=32767,ft=l;return}if(l=t.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!a&&(t=t.sibling,t!==null)){ft=t;return}ft=t=l}while(t!==null);nn=6,ft=null}function Cy(t,a,l,u,g,v,T,z,F){t.cancelPendingCommit=null;do nu();while(hn!==0);if((wt&6)!==0)throw Error(r(327));if(a!==null){if(a===t.current)throw Error(r(177));if(v=a.lanes|a.childLanes,v|=Cf,ts(t,l,v,T,z,F),t===It&&(ft=It=null,pt=0),Oo=a,Fs=t,vs=l,Om=v,zm=g,py=u,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,WC(Be,function(){return Ty(),null})):(t.callbackNode=null,t.callbackPriority=0),u=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||u){u=q.T,q.T=null,g=X.p,X.p=2,T=wt,wt|=4;try{qC(t,a,l)}finally{wt=T,X.p=g,q.T=u}}hn=1,Ey(),ky(),Ny()}}function Ey(){if(hn===1){hn=0;var t=Fs,a=Oo,l=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||l){l=q.T,q.T=null;var u=X.p;X.p=2;var g=wt;wt|=4;try{oy(a,t);var v=Km,T=fb(t.containerInfo),z=v.focusedElem,F=v.selectionRange;if(T!==z&&z&&z.ownerDocument&&db(z.ownerDocument.documentElement,z)){if(F!==null&&yf(z)){var ae=F.start,de=F.end;if(de===void 0&&(de=ae),"selectionStart"in z)z.selectionStart=ae,z.selectionEnd=Math.min(de,z.value.length);else{var pe=z.ownerDocument||document,re=pe&&pe.defaultView||window;if(re.getSelection){var ue=re.getSelection(),Pe=z.textContent.length,Ke=Math.min(F.start,Pe),zt=F.end===void 0?Ke:Math.min(F.end,Pe);!ue.extend&&Ke>zt&&(T=zt,zt=Ke,Ke=T);var ee=ub(z,Ke),J=ub(z,zt);if(ee&&J&&(ue.rangeCount!==1||ue.anchorNode!==ee.node||ue.anchorOffset!==ee.offset||ue.focusNode!==J.node||ue.focusOffset!==J.offset)){var ne=pe.createRange();ne.setStart(ee.node,ee.offset),ue.removeAllRanges(),Ke>zt?(ue.addRange(ne),ue.extend(J.node,J.offset)):(ne.setEnd(J.node,J.offset),ue.addRange(ne))}}}}for(pe=[],ue=z;ue=ue.parentNode;)ue.nodeType===1&&pe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof z.focus=="function"&&z.focus(),z=0;z<pe.length;z++){var me=pe[z];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}pu=!!Xm,Km=Xm=null}finally{wt=g,X.p=u,q.T=l}}t.current=a,hn=2}}function ky(){if(hn===2){hn=0;var t=Fs,a=Oo,l=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||l){l=q.T,q.T=null;var u=X.p;X.p=2;var g=wt;wt|=4;try{ty(t,a.alternate,a)}finally{wt=g,X.p=u,q.T=l}}hn=3}}function Ny(){if(hn===4||hn===3){hn=0,Oe();var t=Fs,a=Oo,l=vs,u=py;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?hn=5:(hn=0,Oo=Fs=null,Ry(t,t.pendingLanes));var g=t.pendingLanes;if(g===0&&(Ys=null),at(l),a=a.stateNode,it&&typeof it.onCommitFiberRoot=="function")try{it.onCommitFiberRoot(ut,a,void 0,(a.current.flags&128)===128)}catch{}if(u!==null){a=q.T,g=X.p,X.p=2,q.T=null;try{for(var v=t.onRecoverableError,T=0;T<u.length;T++){var z=u[T];v(z.value,{componentStack:z.stack})}}finally{q.T=a,X.p=g}}(vs&3)!==0&&nu(),Va(t),g=t.pendingLanes,(l&261930)!==0&&(g&42)!==0?t===Dm?Xl++:(Xl=0,Dm=t):Xl=0,Kl(0)}}function Ry(t,a){(t.pooledCacheLanes&=a)===0&&(a=t.pooledCache,a!=null&&(t.pooledCache=null,Rl(a)))}function nu(){return Ey(),ky(),Ny(),Ty()}function Ty(){if(hn!==5)return!1;var t=Fs,a=Om;Om=0;var l=at(vs),u=q.T,g=X.p;try{X.p=32>l?32:l,q.T=null,l=zm,zm=null;var v=Fs,T=vs;if(hn=0,Oo=Fs=null,vs=0,(wt&6)!==0)throw Error(r(331));var z=wt;if(wt|=4,dy(v.current),iy(v,v.current,T,l),wt=z,Kl(0,!1),it&&typeof it.onPostCommitFiberRoot=="function")try{it.onPostCommitFiberRoot(ut,v)}catch{}return!0}finally{X.p=g,q.T=u,Ry(t,a)}}function Ay(t,a,l){a=ba(l,a),a=mm(t.stateNode,a,2),t=Us(t,a,2),t!==null&&(Vn(t,2),Va(t))}function Rt(t,a,l){if(t.tag===3)Ay(t,t,l);else for(;a!==null;){if(a.tag===3){Ay(a,t,l);break}else if(a.tag===1){var u=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof u.componentDidCatch=="function"&&(Ys===null||!Ys.has(u))){t=ba(l,t),l=Mv(2),u=Us(a,l,2),u!==null&&(Ov(l,u,a,t),Vn(u,2),Va(u));break}}a=a.return}}function Bm(t,a,l){var u=t.pingCache;if(u===null){u=t.pingCache=new GC;var g=new Set;u.set(a,g)}else g=u.get(a),g===void 0&&(g=new Set,u.set(a,g));g.has(l)||(Tm=!0,g.add(l),t=QC.bind(null,t,a,l),a.then(t,t))}function QC(t,a,l){var u=t.pingCache;u!==null&&u.delete(a),t.pingedLanes|=t.suspendedLanes&l,t.warmLanes&=~l,It===t&&(pt&l)===l&&(nn===4||nn===3&&(pt&62914560)===pt&&300>ve()-Qc?(wt&2)===0&&zo(t,0):Am|=l,Mo===pt&&(Mo=0)),Va(t)}function My(t,a){a===0&&(a=qn()),t=Er(t,a),t!==null&&(Vn(t,a),Va(t))}function ZC(t){var a=t.memoizedState,l=0;a!==null&&(l=a.retryLane),My(t,l)}function JC(t,a){var l=0;switch(t.tag){case 31:case 13:var u=t.stateNode,g=t.memoizedState;g!==null&&(l=g.retryLane);break;case 19:u=t.stateNode;break;case 22:u=t.stateNode._retryCache;break;default:throw Error(r(314))}u!==null&&u.delete(a),My(t,l)}function WC(t,a){return Le(t,a)}var au=null,Lo=null,Im=!1,su=!1,Um=!1,Ks=0;function Va(t){t!==Lo&&t.next===null&&(Lo===null?au=Lo=t:Lo=Lo.next=t),su=!0,Im||(Im=!0,tE())}function Kl(t,a){if(!Um&&su){Um=!0;do for(var l=!1,u=au;u!==null;){if(t!==0){var g=u.pendingLanes;if(g===0)var v=0;else{var T=u.suspendedLanes,z=u.pingedLanes;v=(1<<31-Bt(42|t)+1)-1,v&=g&~(T&~z),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,Ly(u,v))}else v=pt,v=Vt(u,u===It?v:0,u.cancelPendingCommit!==null||u.timeoutHandle!==-1),(v&3)===0||rn(u,v)||(l=!0,Ly(u,v));u=u.next}while(l);Um=!1}}function eE(){Oy()}function Oy(){su=Im=!1;var t=0;Ks!==0&&dE()&&(t=Ks);for(var a=ve(),l=null,u=au;u!==null;){var g=u.next,v=zy(u,a);v===0?(u.next=null,l===null?au=g:l.next=g,g===null&&(Lo=l)):(l=u,(t!==0||(v&3)!==0)&&(su=!0)),u=g}hn!==0&&hn!==5||Kl(t),Ks!==0&&(Ks=0)}function zy(t,a){for(var l=t.suspendedLanes,u=t.pingedLanes,g=t.expirationTimes,v=t.pendingLanes&-62914561;0<v;){var T=31-Bt(v),z=1<<T,F=g[T];F===-1?((z&l)===0||(z&u)!==0)&&(g[T]=Tn(z,a)):F<=a&&(t.expiredLanes|=z),v&=~z}if(a=It,l=pt,l=Vt(t,t===a?l:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u=t.callbackNode,l===0||t===a&&(Nt===2||Nt===9)||t.cancelPendingCommit!==null)return u!==null&&u!==null&&Ge(u),t.callbackNode=null,t.callbackPriority=0;if((l&3)===0||rn(t,l)){if(a=l&-l,a===t.callbackPriority)return a;switch(u!==null&&Ge(u),at(l)){case 2:case 8:l=je;break;case 32:l=Be;break;case 268435456:l=_t;break;default:l=Be}return u=Dy.bind(null,t),l=Le(l,u),t.callbackPriority=a,t.callbackNode=l,a}return u!==null&&u!==null&&Ge(u),t.callbackPriority=2,t.callbackNode=null,2}function Dy(t,a){if(hn!==0&&hn!==5)return t.callbackNode=null,t.callbackPriority=0,null;var l=t.callbackNode;if(nu()&&t.callbackNode!==l)return null;var u=pt;return u=Vt(t,t===It?u:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),u===0?null:(hy(t,u,a),zy(t,ve()),t.callbackNode!=null&&t.callbackNode===l?Dy.bind(null,t):null)}function Ly(t,a){if(nu())return null;hy(t,a,!0)}function tE(){mE(function(){(wt&6)!==0?Le(ye,eE):Oy()})}function Hm(){if(Ks===0){var t=_o;t===0&&(t=Tt,Tt<<=1,(Tt&261888)===0&&(Tt=256)),Ks=t}return Ks}function Py(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:fc(""+t)}function By(t,a){var l=a.ownerDocument.createElement("input");return l.name=a.name,l.value=a.value,t.id&&l.setAttribute("form",t.id),a.parentNode.insertBefore(l,a),t=new FormData(t),l.parentNode.removeChild(l),t}function nE(t,a,l,u,g){if(a==="submit"&&l&&l.stateNode===g){var v=Py((g[un]||null).action),T=u.submitter;T&&(a=(a=T[un]||null)?Py(a.formAction):T.getAttribute("formAction"),a!==null&&(v=a,T=null));var z=new hc("action","action",null,u,g);t.push({event:z,listeners:[{instance:null,listener:function(){if(u.defaultPrevented){if(Ks!==0){var F=T?By(g,T):new FormData(g);lm(l,{pending:!0,data:F,method:g.method,action:v},null,F)}}else typeof v=="function"&&(z.preventDefault(),F=T?By(g,T):new FormData(g),lm(l,{pending:!0,data:F,method:g.method,action:v},v,F))},currentTarget:g}]})}}for(var qm=0;qm<wf.length;qm++){var Vm=wf[qm],aE=Vm.toLowerCase(),sE=Vm[0].toUpperCase()+Vm.slice(1);Aa(aE,"on"+sE)}Aa(gb,"onAnimationEnd"),Aa(hb,"onAnimationIteration"),Aa(xb,"onAnimationStart"),Aa("dblclick","onDoubleClick"),Aa("focusin","onFocus"),Aa("focusout","onBlur"),Aa(yC,"onTransitionRun"),Aa(_C,"onTransitionStart"),Aa(jC,"onTransitionCancel"),Aa(bb,"onTransitionEnd"),oo("onMouseEnter",["mouseout","mouseover"]),oo("onMouseLeave",["mouseout","mouseover"]),oo("onPointerEnter",["pointerout","pointerover"]),oo("onPointerLeave",["pointerout","pointerover"]),jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),jr("onBeforeInput",["compositionend","keypress","textInput","paste"]),jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ql="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(" "),rE=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ql));function Iy(t,a){a=(a&4)!==0;for(var l=0;l<t.length;l++){var u=t[l],g=u.event;u=u.listeners;e:{var v=void 0;if(a)for(var T=u.length-1;0<=T;T--){var z=u[T],F=z.instance,ae=z.currentTarget;if(z=z.listener,F!==v&&g.isPropagationStopped())break e;v=z,g.currentTarget=ae;try{v(g)}catch(de){vc(de)}g.currentTarget=null,v=F}else for(T=0;T<u.length;T++){if(z=u[T],F=z.instance,ae=z.currentTarget,z=z.listener,F!==v&&g.isPropagationStopped())break e;v=z,g.currentTarget=ae;try{v(g)}catch(de){vc(de)}g.currentTarget=null,v=F}}}}function mt(t,a){var l=a[ic];l===void 0&&(l=a[ic]=new Set);var u=t+"__bubble";l.has(u)||(Uy(a,t,2,!1),l.add(u))}function $m(t,a,l){var u=0;a&&(u|=4),Uy(l,t,u,a)}var ru="_reactListening"+Math.random().toString(36).slice(2);function Gm(t){if(!t[ru]){t[ru]=!0,Ox.forEach(function(l){l!=="selectionchange"&&(rE.has(l)||$m(l,!1,t),$m(l,!0,t))});var a=t.nodeType===9?t:t.ownerDocument;a===null||a[ru]||(a[ru]=!0,$m("selectionchange",!1,a))}}function Uy(t,a,l,u){switch(g0(a)){case 2:var g=OE;break;case 8:g=zE;break;default:g=op}l=g.bind(null,a,l,t),g=void 0,!df||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(g=!0),u?g!==void 0?t.addEventListener(a,l,{capture:!0,passive:g}):t.addEventListener(a,l,!0):g!==void 0?t.addEventListener(a,l,{passive:g}):t.addEventListener(a,l,!1)}function Ym(t,a,l,u,g){var v=u;if((a&1)===0&&(a&2)===0&&u!==null)e:for(;;){if(u===null)return;var T=u.tag;if(T===3||T===4){var z=u.stateNode.containerInfo;if(z===g)break;if(T===4)for(T=u.return;T!==null;){var F=T.tag;if((F===3||F===4)&&T.stateNode.containerInfo===g)return;T=T.return}for(;z!==null;){if(T=ao(z),T===null)return;if(F=T.tag,F===5||F===6||F===26||F===27){u=v=T;continue e}z=z.parentNode}}u=u.return}Gx(function(){var ae=v,de=cf(l),pe=[];e:{var re=vb.get(t);if(re!==void 0){var ue=hc,Pe=t;switch(t){case"keypress":if(pc(l)===0)break e;case"keydown":case"keyup":ue=J2;break;case"focusin":Pe="focus",ue=gf;break;case"focusout":Pe="blur",ue=gf;break;case"beforeblur":case"afterblur":ue=gf;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=Xx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=U2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=tC;break;case gb:case hb:case xb:ue=V2;break;case bb:ue=aC;break;case"scroll":case"scrollend":ue=B2;break;case"wheel":ue=rC;break;case"copy":case"cut":case"paste":ue=G2;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=Qx;break;case"toggle":case"beforetoggle":ue=lC}var Ke=(a&4)!==0,zt=!Ke&&(t==="scroll"||t==="scrollend"),ee=Ke?re!==null?re+"Capture":null:re;Ke=[];for(var J=ae,ne;J!==null;){var me=J;if(ne=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||ne===null||ee===null||(me=bl(J,ee),me!=null&&Ke.push(Zl(J,me,ne))),zt)break;J=J.return}0<Ke.length&&(re=new ue(re,Pe,null,l,de),pe.push({event:re,listeners:Ke}))}}if((a&7)===0){e:{if(re=t==="mouseover"||t==="pointerover",ue=t==="mouseout"||t==="pointerout",re&&l!==lf&&(Pe=l.relatedTarget||l.fromElement)&&(ao(Pe)||Pe[_r]))break e;if((ue||re)&&(re=de.window===de?de:(re=de.ownerDocument)?re.defaultView||re.parentWindow:window,ue?(Pe=l.relatedTarget||l.toElement,ue=ae,Pe=Pe?ao(Pe):null,Pe!==null&&(zt=c(Pe),Ke=Pe.tag,Pe!==zt||Ke!==5&&Ke!==27&&Ke!==6)&&(Pe=null)):(ue=null,Pe=ae),ue!==Pe)){if(Ke=Xx,me="onMouseLeave",ee="onMouseEnter",J="mouse",(t==="pointerout"||t==="pointerover")&&(Ke=Qx,me="onPointerLeave",ee="onPointerEnter",J="pointer"),zt=ue==null?re:xl(ue),ne=Pe==null?re:xl(Pe),re=new Ke(me,J+"leave",ue,l,de),re.target=zt,re.relatedTarget=ne,me=null,ao(de)===ae&&(Ke=new Ke(ee,J+"enter",Pe,l,de),Ke.target=ne,Ke.relatedTarget=zt,me=Ke),zt=me,ue&&Pe)t:{for(Ke=oE,ee=ue,J=Pe,ne=0,me=ee;me;me=Ke(me))ne++;me=0;for(var Ve=J;Ve;Ve=Ke(Ve))me++;for(;0<ne-me;)ee=Ke(ee),ne--;for(;0<me-ne;)J=Ke(J),me--;for(;ne--;){if(ee===J||J!==null&&ee===J.alternate){Ke=ee;break t}ee=Ke(ee),J=Ke(J)}Ke=null}else Ke=null;ue!==null&&Hy(pe,re,ue,Ke,!1),Pe!==null&&zt!==null&&Hy(pe,zt,Pe,Ke,!0)}}e:{if(re=ae?xl(ae):window,ue=re.nodeName&&re.nodeName.toLowerCase(),ue==="select"||ue==="input"&&re.type==="file")var jt=sb;else if(nb(re))if(rb)jt=xC;else{jt=gC;var Ie=pC}else ue=re.nodeName,!ue||ue.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?ae&&of(ae.elementType)&&(jt=sb):jt=hC;if(jt&&(jt=jt(t,ae))){ab(pe,jt,l,de);break e}Ie&&Ie(t,re,ae),t==="focusout"&&ae&&re.type==="number"&&ae.memoizedProps.value!=null&&rf(re,"number",re.value)}switch(Ie=ae?xl(ae):window,t){case"focusin":(nb(Ie)||Ie.contentEditable==="true")&&(mo=Ie,_f=ae,El=null);break;case"focusout":El=_f=mo=null;break;case"mousedown":jf=!0;break;case"contextmenu":case"mouseup":case"dragend":jf=!1,mb(pe,l,de);break;case"selectionchange":if(vC)break;case"keydown":case"keyup":mb(pe,l,de)}var st;if(xf)e:{switch(t){case"compositionstart":var gt="onCompositionStart";break e;case"compositionend":gt="onCompositionEnd";break e;case"compositionupdate":gt="onCompositionUpdate";break e}gt=void 0}else fo?eb(t,l)&&(gt="onCompositionEnd"):t==="keydown"&&l.keyCode===229&&(gt="onCompositionStart");gt&&(Zx&&l.locale!=="ko"&&(fo||gt!=="onCompositionStart"?gt==="onCompositionEnd"&&fo&&(st=Yx()):(Os=de,ff="value"in Os?Os.value:Os.textContent,fo=!0)),Ie=ou(ae,gt),0<Ie.length&&(gt=new Kx(gt,t,null,l,de),pe.push({event:gt,listeners:Ie}),st?gt.data=st:(st=tb(l),st!==null&&(gt.data=st)))),(st=cC?uC(t,l):dC(t,l))&&(gt=ou(ae,"onBeforeInput"),0<gt.length&&(Ie=new Kx("onBeforeInput","beforeinput",null,l,de),pe.push({event:Ie,listeners:gt}),Ie.data=st)),nE(pe,t,ae,l,de)}Iy(pe,a)})}function Zl(t,a,l){return{instance:t,listener:a,currentTarget:l}}function ou(t,a){for(var l=a+"Capture",u=[];t!==null;){var g=t,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=bl(t,l),g!=null&&u.unshift(Zl(t,g,v)),g=bl(t,a),g!=null&&u.push(Zl(t,g,v))),t.tag===3)return u;t=t.return}return[]}function oE(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function Hy(t,a,l,u,g){for(var v=a._reactName,T=[];l!==null&&l!==u;){var z=l,F=z.alternate,ae=z.stateNode;if(z=z.tag,F!==null&&F===u)break;z!==5&&z!==26&&z!==27||ae===null||(F=ae,g?(ae=bl(l,v),ae!=null&&T.unshift(Zl(l,ae,F))):g||(ae=bl(l,v),ae!=null&&T.push(Zl(l,ae,F)))),l=l.return}T.length!==0&&t.push({event:a,listeners:T})}var lE=/\r\n?/g,iE=/\u0000|\uFFFD/g;function qy(t){return(typeof t=="string"?t:""+t).replace(lE,`
49
- `).replace(iE,"")}function Vy(t,a){return a=qy(a),qy(t)===a}function Ot(t,a,l,u,g,v){switch(l){case"children":typeof u=="string"?a==="body"||a==="textarea"&&u===""||io(t,u):(typeof u=="number"||typeof u=="bigint")&&a!=="body"&&io(t,""+u);break;case"className":uc(t,"class",u);break;case"tabIndex":uc(t,"tabindex",u);break;case"dir":case"role":case"viewBox":case"width":case"height":uc(t,l,u);break;case"style":Vx(t,u,v);break;case"data":if(a!=="object"){uc(t,"data",u);break}case"src":case"href":if(u===""&&(a!=="a"||l!=="href")){t.removeAttribute(l);break}if(u==null||typeof u=="function"||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(l);break}u=fc(""+u),t.setAttribute(l,u);break;case"action":case"formAction":if(typeof u=="function"){t.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(l==="formAction"?(a!=="input"&&Ot(t,a,"name",g.name,g,null),Ot(t,a,"formEncType",g.formEncType,g,null),Ot(t,a,"formMethod",g.formMethod,g,null),Ot(t,a,"formTarget",g.formTarget,g,null)):(Ot(t,a,"encType",g.encType,g,null),Ot(t,a,"method",g.method,g,null),Ot(t,a,"target",g.target,g,null)));if(u==null||typeof u=="symbol"||typeof u=="boolean"){t.removeAttribute(l);break}u=fc(""+u),t.setAttribute(l,u);break;case"onClick":u!=null&&(t.onclick=ss);break;case"onScroll":u!=null&&mt("scroll",t);break;case"onScrollEnd":u!=null&&mt("scrollend",t);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(l=u.__html,l!=null){if(g.children!=null)throw Error(r(60));t.innerHTML=l}}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}l=fc(""+u),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(l,""+u):t.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":u&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(l,""):t.removeAttribute(l);break;case"capture":case"download":u===!0?t.setAttribute(l,""):u!==!1&&u!=null&&typeof u!="function"&&typeof u!="symbol"?t.setAttribute(l,u):t.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":u!=null&&typeof u!="function"&&typeof u!="symbol"&&!isNaN(u)&&1<=u?t.setAttribute(l,u):t.removeAttribute(l);break;case"rowSpan":case"start":u==null||typeof u=="function"||typeof u=="symbol"||isNaN(u)?t.removeAttribute(l):t.setAttribute(l,u);break;case"popover":mt("beforetoggle",t),mt("toggle",t),cc(t,"popover",u);break;case"xlinkActuate":as(t,"http://www.w3.org/1999/xlink","xlink:actuate",u);break;case"xlinkArcrole":as(t,"http://www.w3.org/1999/xlink","xlink:arcrole",u);break;case"xlinkRole":as(t,"http://www.w3.org/1999/xlink","xlink:role",u);break;case"xlinkShow":as(t,"http://www.w3.org/1999/xlink","xlink:show",u);break;case"xlinkTitle":as(t,"http://www.w3.org/1999/xlink","xlink:title",u);break;case"xlinkType":as(t,"http://www.w3.org/1999/xlink","xlink:type",u);break;case"xmlBase":as(t,"http://www.w3.org/XML/1998/namespace","xml:base",u);break;case"xmlLang":as(t,"http://www.w3.org/XML/1998/namespace","xml:lang",u);break;case"xmlSpace":as(t,"http://www.w3.org/XML/1998/namespace","xml:space",u);break;case"is":cc(t,"is",u);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=L2.get(l)||l,cc(t,l,u))}}function Fm(t,a,l,u,g,v){switch(l){case"style":Vx(t,u,v);break;case"dangerouslySetInnerHTML":if(u!=null){if(typeof u!="object"||!("__html"in u))throw Error(r(61));if(l=u.__html,l!=null){if(g.children!=null)throw Error(r(60));t.innerHTML=l}}break;case"children":typeof u=="string"?io(t,u):(typeof u=="number"||typeof u=="bigint")&&io(t,""+u);break;case"onScroll":u!=null&&mt("scroll",t);break;case"onScrollEnd":u!=null&&mt("scrollend",t);break;case"onClick":u!=null&&(t.onclick=ss);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!zx.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(g=l.endsWith("Capture"),a=l.slice(2,g?l.length-7:void 0),v=t[un]||null,v=v!=null?v[l]:null,typeof v=="function"&&t.removeEventListener(a,v,g),typeof u=="function")){typeof v!="function"&&v!==null&&(l in t?t[l]=null:t.hasAttribute(l)&&t.removeAttribute(l)),t.addEventListener(a,u,g);break e}l in t?t[l]=u:u===!0?t.setAttribute(l,""):cc(t,l,u)}}}function wn(t,a,l){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":mt("error",t),mt("load",t);var u=!1,g=!1,v;for(v in l)if(l.hasOwnProperty(v)){var T=l[v];if(T!=null)switch(v){case"src":u=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Ot(t,a,v,T,l,null)}}g&&Ot(t,a,"srcSet",l.srcSet,l,null),u&&Ot(t,a,"src",l.src,l,null);return;case"input":mt("invalid",t);var z=v=T=g=null,F=null,ae=null;for(u in l)if(l.hasOwnProperty(u)){var de=l[u];if(de!=null)switch(u){case"name":g=de;break;case"type":T=de;break;case"checked":F=de;break;case"defaultChecked":ae=de;break;case"value":v=de;break;case"defaultValue":z=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,a));break;default:Ot(t,a,u,de,l,null)}}Ix(t,v,z,F,ae,T,g,!1);return;case"select":mt("invalid",t),u=T=v=null;for(g in l)if(l.hasOwnProperty(g)&&(z=l[g],z!=null))switch(g){case"value":v=z;break;case"defaultValue":T=z;break;case"multiple":u=z;default:Ot(t,a,g,z,l,null)}a=v,l=T,t.multiple=!!u,a!=null?lo(t,!!u,a,!1):l!=null&&lo(t,!!u,l,!0);return;case"textarea":mt("invalid",t),v=g=u=null;for(T in l)if(l.hasOwnProperty(T)&&(z=l[T],z!=null))switch(T){case"value":u=z;break;case"defaultValue":g=z;break;case"children":v=z;break;case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(91));break;default:Ot(t,a,T,z,l,null)}Hx(t,u,g,v);return;case"option":for(F in l)if(l.hasOwnProperty(F)&&(u=l[F],u!=null))switch(F){case"selected":t.selected=u&&typeof u!="function"&&typeof u!="symbol";break;default:Ot(t,a,F,u,l,null)}return;case"dialog":mt("beforetoggle",t),mt("toggle",t),mt("cancel",t),mt("close",t);break;case"iframe":case"object":mt("load",t);break;case"video":case"audio":for(u=0;u<Ql.length;u++)mt(Ql[u],t);break;case"image":mt("error",t),mt("load",t);break;case"details":mt("toggle",t);break;case"embed":case"source":case"link":mt("error",t),mt("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 l)if(l.hasOwnProperty(ae)&&(u=l[ae],u!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:Ot(t,a,ae,u,l,null)}return;default:if(of(a)){for(de in l)l.hasOwnProperty(de)&&(u=l[de],u!==void 0&&Fm(t,a,de,u,l,void 0));return}}for(z in l)l.hasOwnProperty(z)&&(u=l[z],u!=null&&Ot(t,a,z,u,l,null))}function cE(t,a,l,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,T=null,z=null,F=null,ae=null,de=null;for(ue in l){var pe=l[ue];if(l.hasOwnProperty(ue)&&pe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":F=pe;default:u.hasOwnProperty(ue)||Ot(t,a,ue,null,u,pe)}}for(var re in u){var ue=u[re];if(pe=l[re],u.hasOwnProperty(re)&&(ue!=null||pe!=null))switch(re){case"type":v=ue;break;case"name":g=ue;break;case"checked":ae=ue;break;case"defaultChecked":de=ue;break;case"value":T=ue;break;case"defaultValue":z=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(r(137,a));break;default:ue!==pe&&Ot(t,a,re,ue,u,pe)}}sf(t,T,z,F,ae,de,v,g);return;case"select":ue=T=z=re=null;for(v in l)if(F=l[v],l.hasOwnProperty(v)&&F!=null)switch(v){case"value":break;case"multiple":ue=F;default:u.hasOwnProperty(v)||Ot(t,a,v,null,u,F)}for(g in u)if(v=u[g],F=l[g],u.hasOwnProperty(g)&&(v!=null||F!=null))switch(g){case"value":re=v;break;case"defaultValue":z=v;break;case"multiple":T=v;default:v!==F&&Ot(t,a,g,v,u,F)}a=z,l=T,u=ue,re!=null?lo(t,!!l,re,!1):!!u!=!!l&&(a!=null?lo(t,!!l,a,!0):lo(t,!!l,l?[]:"",!1));return;case"textarea":ue=re=null;for(z in l)if(g=l[z],l.hasOwnProperty(z)&&g!=null&&!u.hasOwnProperty(z))switch(z){case"value":break;case"children":break;default:Ot(t,a,z,null,u,g)}for(T in u)if(g=u[T],v=l[T],u.hasOwnProperty(T)&&(g!=null||v!=null))switch(T){case"value":re=g;break;case"defaultValue":ue=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(r(91));break;default:g!==v&&Ot(t,a,T,g,u,v)}Ux(t,re,ue);return;case"option":for(var Pe in l)if(re=l[Pe],l.hasOwnProperty(Pe)&&re!=null&&!u.hasOwnProperty(Pe))switch(Pe){case"selected":t.selected=!1;break;default:Ot(t,a,Pe,null,u,re)}for(F in u)if(re=u[F],ue=l[F],u.hasOwnProperty(F)&&re!==ue&&(re!=null||ue!=null))switch(F){case"selected":t.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:Ot(t,a,F,re,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 Ke in l)re=l[Ke],l.hasOwnProperty(Ke)&&re!=null&&!u.hasOwnProperty(Ke)&&Ot(t,a,Ke,null,u,re);for(ae in u)if(re=u[ae],ue=l[ae],u.hasOwnProperty(ae)&&re!==ue&&(re!=null||ue!=null))switch(ae){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,a));break;default:Ot(t,a,ae,re,u,ue)}return;default:if(of(a)){for(var zt in l)re=l[zt],l.hasOwnProperty(zt)&&re!==void 0&&!u.hasOwnProperty(zt)&&Fm(t,a,zt,void 0,u,re);for(de in u)re=u[de],ue=l[de],!u.hasOwnProperty(de)||re===ue||re===void 0&&ue===void 0||Fm(t,a,de,re,u,ue);return}}for(var ee in l)re=l[ee],l.hasOwnProperty(ee)&&re!=null&&!u.hasOwnProperty(ee)&&Ot(t,a,ee,null,u,re);for(pe in u)re=u[pe],ue=l[pe],!u.hasOwnProperty(pe)||re===ue||re==null&&ue==null||Ot(t,a,pe,re,u,ue)}function $y(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function uE(){if(typeof performance.getEntriesByType=="function"){for(var t=0,a=0,l=performance.getEntriesByType("resource"),u=0;u<l.length;u++){var g=l[u],v=g.transferSize,T=g.initiatorType,z=g.duration;if(v&&z&&$y(T)){for(T=0,z=g.responseEnd,u+=1;u<l.length;u++){var F=l[u],ae=F.startTime;if(ae>z)break;var de=F.transferSize,pe=F.initiatorType;de&&$y(pe)&&(F=F.responseEnd,T+=de*(F<z?1:(z-ae)/(F-ae)))}if(--u,a+=8*(v+T)/(g.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 Xm=null,Km=null;function lu(t){return t.nodeType===9?t:t.ownerDocument}function Gy(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 Yy(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 Qm(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 Zm=null;function dE(){var t=window.event;return t&&t.type==="popstate"?t===Zm?!1:(Zm=t,!0):(Zm=null,!1)}var Fy=typeof setTimeout=="function"?setTimeout:void 0,fE=typeof clearTimeout=="function"?clearTimeout:void 0,Xy=typeof Promise=="function"?Promise:void 0,mE=typeof queueMicrotask=="function"?queueMicrotask:typeof Xy<"u"?function(t){return Xy.resolve(null).then(t).catch(pE)}:Fy;function pE(t){setTimeout(function(){throw t})}function Qs(t){return t==="head"}function Ky(t,a){var l=a,u=0;do{var g=l.nextSibling;if(t.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"||l==="/&"){if(u===0){t.removeChild(g),Uo(a);return}u--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")u++;else if(l==="html")Jl(t.ownerDocument.documentElement);else if(l==="head"){l=t.ownerDocument.head,Jl(l);for(var v=l.firstChild;v;){var T=v.nextSibling,z=v.nodeName;v[hl]||z==="SCRIPT"||z==="STYLE"||z==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=T}}else l==="body"&&Jl(t.ownerDocument.body);l=g}while(l);Uo(a)}function Qy(t,a){var l=t;t=0;do{var u=l.nextSibling;if(l.nodeType===1?a?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(a?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),u&&u.nodeType===8)if(l=u.data,l==="/$"){if(t===0)break;t--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||t++;l=u}while(l)}function Jm(t){var a=t.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var l=a;switch(a=a.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Jm(l),nf(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}t.removeChild(l)}}function gE(t,a,l,u){for(;t.nodeType===1;){var g=l;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(v=t.getAttribute("rel"),v==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(v!==g.rel||t.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||t.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||t.getAttribute("title")!==(g.title==null?null:g.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(v=t.getAttribute("src"),(v!==(g.src==null?null:g.src)||t.getAttribute("type")!==(g.type==null?null:g.type)||t.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(a==="input"&&t.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&t.getAttribute("name")===v)return t}else return t;if(t=Sa(t.nextSibling),t===null)break}return null}function hE(t,a,l){if(a==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!l||(t=Sa(t.nextSibling),t===null))return null;return t}function Zy(t,a){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!a||(t=Sa(t.nextSibling),t===null))return null;return t}function Wm(t){return t.data==="$?"||t.data==="$~"}function ep(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function xE(t,a){var l=t.ownerDocument;if(t.data==="$~")t._reactRetry=a;else if(t.data!=="$?"||l.readyState!=="loading")a();else{var u=function(){a(),l.removeEventListener("DOMContentLoaded",u)};l.addEventListener("DOMContentLoaded",u),t._reactRetry=u}}function Sa(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 tp=null;function Jy(t){t=t.nextSibling;for(var a=0;t;){if(t.nodeType===8){var l=t.data;if(l==="/$"||l==="/&"){if(a===0)return Sa(t.nextSibling);a--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||a++}t=t.nextSibling}return null}function Wy(t){t=t.previousSibling;for(var a=0;t;){if(t.nodeType===8){var l=t.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(a===0)return t;a--}else l!=="/$"&&l!=="/&"||a++}t=t.previousSibling}return null}function e0(t,a,l){switch(a=lu(l),t){case"html":if(t=a.documentElement,!t)throw Error(r(452));return t;case"head":if(t=a.head,!t)throw Error(r(453));return t;case"body":if(t=a.body,!t)throw Error(r(454));return t;default:throw Error(r(451))}}function Jl(t){for(var a=t.attributes;a.length;)t.removeAttributeNode(a[0]);nf(t)}var wa=new Map,t0=new Set;function iu(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var ys=X.d;X.d={f:bE,r:vE,D:yE,C:_E,L:jE,m:SE,X:CE,S:wE,M:EE};function bE(){var t=ys.f(),a=Wc();return t||a}function vE(t){var a=so(t);a!==null&&a.tag===5&&a.type==="form"?bv(a):ys.r(t)}var Po=typeof document>"u"?null:document;function n0(t,a,l){var u=Po;if(u&&typeof a=="string"&&a){var g=ha(a);g='link[rel="'+t+'"][href="'+g+'"]',typeof l=="string"&&(g+='[crossorigin="'+l+'"]'),t0.has(g)||(t0.add(g),t={rel:t,crossOrigin:l,href:a},u.querySelector(g)===null&&(a=u.createElement("link"),wn(a,"link",t),xn(a),u.head.appendChild(a)))}}function yE(t){ys.D(t),n0("dns-prefetch",t,null)}function _E(t,a){ys.C(t,a),n0("preconnect",t,a)}function jE(t,a,l){ys.L(t,a,l);var u=Po;if(u&&t&&a){var g='link[rel="preload"][as="'+ha(a)+'"]';a==="image"&&l&&l.imageSrcSet?(g+='[imagesrcset="'+ha(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(g+='[imagesizes="'+ha(l.imageSizes)+'"]')):g+='[href="'+ha(t)+'"]';var v=g;switch(a){case"style":v=Bo(t);break;case"script":v=Io(t)}wa.has(v)||(t=x({rel:"preload",href:a==="image"&&l&&l.imageSrcSet?void 0:t,as:a},l),wa.set(v,t),u.querySelector(g)!==null||a==="style"&&u.querySelector(Wl(v))||a==="script"&&u.querySelector(ei(v))||(a=u.createElement("link"),wn(a,"link",t),xn(a),u.head.appendChild(a)))}}function SE(t,a){ys.m(t,a);var l=Po;if(l&&t){var u=a&&typeof a.as=="string"?a.as:"script",g='link[rel="modulepreload"][as="'+ha(u)+'"][href="'+ha(t)+'"]',v=g;switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Io(t)}if(!wa.has(v)&&(t=x({rel:"modulepreload",href:t},a),wa.set(v,t),l.querySelector(g)===null)){switch(u){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ei(v)))return}u=l.createElement("link"),wn(u,"link",t),xn(u),l.head.appendChild(u)}}}function wE(t,a,l){ys.S(t,a,l);var u=Po;if(u&&t){var g=ro(u).hoistableStyles,v=Bo(t);a=a||"default";var T=g.get(v);if(!T){var z={loading:0,preload:null};if(T=u.querySelector(Wl(v)))z.loading=5;else{t=x({rel:"stylesheet",href:t,"data-precedence":a},l),(l=wa.get(v))&&np(t,l);var F=T=u.createElement("link");xn(F),wn(F,"link",t),F._p=new Promise(function(ae,de){F.onload=ae,F.onerror=de}),F.addEventListener("load",function(){z.loading|=1}),F.addEventListener("error",function(){z.loading|=2}),z.loading|=4,cu(T,a,u)}T={type:"stylesheet",instance:T,count:1,state:z},g.set(v,T)}}}function CE(t,a){ys.X(t,a);var l=Po;if(l&&t){var u=ro(l).hoistableScripts,g=Io(t),v=u.get(g);v||(v=l.querySelector(ei(g)),v||(t=x({src:t,async:!0},a),(a=wa.get(g))&&ap(t,a),v=l.createElement("script"),xn(v),wn(v,"link",t),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(g,v))}}function EE(t,a){ys.M(t,a);var l=Po;if(l&&t){var u=ro(l).hoistableScripts,g=Io(t),v=u.get(g);v||(v=l.querySelector(ei(g)),v||(t=x({src:t,async:!0,type:"module"},a),(a=wa.get(g))&&ap(t,a),v=l.createElement("script"),xn(v),wn(v,"link",t),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},u.set(g,v))}}function a0(t,a,l,u){var g=(g=ce.current)?iu(g):null;if(!g)throw Error(r(446));switch(t){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(a=Bo(l.href),l=ro(g).hoistableStyles,u=l.get(a),u||(u={type:"style",instance:null,count:0,state:null},l.set(a,u)),u):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){t=Bo(l.href);var v=ro(g).hoistableStyles,T=v.get(t);if(T||(g=g.ownerDocument||g,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(t,T),(v=g.querySelector(Wl(t)))&&!v._p&&(T.instance=v,T.state.loading=5),wa.has(t)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},wa.set(t,l),v||kE(g,t,l,T.state))),a&&u===null)throw Error(r(528,""));return T}if(a&&u!==null)throw Error(r(529,""));return null;case"script":return a=l.async,l=l.src,typeof l=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Io(l),l=ro(g).hoistableScripts,u=l.get(a),u||(u={type:"script",instance:null,count:0,state:null},l.set(a,u)),u):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,t))}}function Bo(t){return'href="'+ha(t)+'"'}function Wl(t){return'link[rel="stylesheet"]['+t+"]"}function s0(t){return x({},t,{"data-precedence":t.precedence,precedence:null})}function kE(t,a,l,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}),wn(a,"link",l),xn(a),t.head.appendChild(a))}function Io(t){return'[src="'+ha(t)+'"]'}function ei(t){return"script[async]"+t}function r0(t,a,l){if(a.count++,a.instance===null)switch(a.type){case"style":var u=t.querySelector('style[data-href~="'+ha(l.href)+'"]');if(u)return a.instance=u,xn(u),u;var g=x({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return u=(t.ownerDocument||t).createElement("style"),xn(u),wn(u,"style",g),cu(u,l.precedence,t),a.instance=u;case"stylesheet":g=Bo(l.href);var v=t.querySelector(Wl(g));if(v)return a.state.loading|=4,a.instance=v,xn(v),v;u=s0(l),(g=wa.get(g))&&np(u,g),v=(t.ownerDocument||t).createElement("link"),xn(v);var T=v;return T._p=new Promise(function(z,F){T.onload=z,T.onerror=F}),wn(v,"link",u),a.state.loading|=4,cu(v,l.precedence,t),a.instance=v;case"script":return v=Io(l.src),(g=t.querySelector(ei(v)))?(a.instance=g,xn(g),g):(u=l,(g=wa.get(v))&&(u=x({},l),ap(u,g)),t=t.ownerDocument||t,g=t.createElement("script"),xn(g),wn(g,"link",u),t.head.appendChild(g),a.instance=g);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(u=a.instance,a.state.loading|=4,cu(u,l.precedence,t));return a.instance}function cu(t,a,l){for(var u=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=u.length?u[u.length-1]:null,v=g,T=0;T<u.length;T++){var z=u[T];if(z.dataset.precedence===a)v=z;else if(v!==g)break}v?v.parentNode.insertBefore(t,v.nextSibling):(a=l.nodeType===9?l.head:l,a.insertBefore(t,a.firstChild))}function np(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.title==null&&(t.title=a.title)}function ap(t,a){t.crossOrigin==null&&(t.crossOrigin=a.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=a.referrerPolicy),t.integrity==null&&(t.integrity=a.integrity)}var uu=null;function o0(t,a,l){if(uu===null){var u=new Map,g=uu=new Map;g.set(l,u)}else g=uu,u=g.get(l),u||(u=new Map,g.set(l,u));if(u.has(t))return u;for(u.set(t,null),l=l.getElementsByTagName(t),g=0;g<l.length;g++){var v=l[g];if(!(v[hl]||v[kt]||t==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var T=v.getAttribute(a)||"";T=t+T;var z=u.get(T);z?z.push(v):u.set(T,[v])}}return u}function l0(t,a,l){t=t.ownerDocument||t,t.head.insertBefore(l,a==="title"?t.querySelector("head > title"):null)}function NE(t,a,l){if(l===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 i0(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function RE(t,a,l,u){if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var g=Bo(u.href),v=a.querySelector(Wl(g));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(t.count++,t=du.bind(t),a.then(t,t)),l.state.loading|=4,l.instance=v,xn(v);return}v=a.ownerDocument||a,u=s0(u),(g=wa.get(g))&&np(u,g),v=v.createElement("link"),xn(v);var T=v;T._p=new Promise(function(z,F){T.onload=z,T.onerror=F}),wn(v,"link",u),l.instance=v}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(l,a),(a=l.state.preload)&&(l.state.loading&3)===0&&(t.count++,l=du.bind(t),a.addEventListener("load",l),a.addEventListener("error",l))}}var sp=0;function TE(t,a){return t.stylesheets&&t.count===0&&mu(t,t.stylesheets),0<t.count||0<t.imgCount?function(l){var u=setTimeout(function(){if(t.stylesheets&&mu(t,t.stylesheets),t.unsuspend){var v=t.unsuspend;t.unsuspend=null,v()}},6e4+a);0<t.imgBytes&&sp===0&&(sp=62500*uE());var g=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&mu(t,t.stylesheets),t.unsuspend)){var v=t.unsuspend;t.unsuspend=null,v()}},(t.imgBytes>sp?50:800)+a);return t.unsuspend=l,function(){t.unsuspend=null,clearTimeout(u),clearTimeout(g)}}:null}function du(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)mu(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var fu=null;function mu(t,a){t.stylesheets=null,t.unsuspend!==null&&(t.count++,fu=new Map,a.forEach(AE,t),fu=null,du.call(t))}function AE(t,a){if(!(a.state.loading&4)){var l=fu.get(t);if(l)var u=l.get(null);else{l=new Map,fu.set(t,l);for(var g=t.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var T=g[v];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(l.set(T.dataset.precedence,T),u=T)}u&&l.set(null,u)}g=a.instance,T=g.getAttribute("data-precedence"),v=l.get(T)||u,v===u&&l.set(null,g),l.set(T,g),this.count++,u=du.bind(this),g.addEventListener("load",u),g.addEventListener("error",u),v?v.parentNode.insertBefore(g,v.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(g,t.firstChild)),a.state.loading|=4}}var ti={$$typeof:R,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function ME(t,a,l,u,g,v,T,z,F){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=ta(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ta(0),this.hiddenUpdates=ta(null),this.identifierPrefix=u,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=F,this.incompleteTransitions=new Map}function c0(t,a,l,u,g,v,T,z,F,ae,de,pe){return t=new ME(t,a,l,T,F,ae,de,pe,z),a=1,v===!0&&(a|=24),v=sa(3,null,null,a),t.current=v,v.stateNode=t,a=Pf(),a.refCount++,t.pooledCache=a,a.refCount++,v.memoizedState={element:u,isDehydrated:l,cache:a},Hf(v),t}function u0(t){return t?(t=ho,t):ho}function d0(t,a,l,u,g,v){g=u0(g),u.context===null?u.context=g:u.pendingContext=g,u=Is(a),u.payload={element:l},v=v===void 0?null:v,v!==null&&(u.callback=v),l=Us(t,u,a),l!==null&&(Kn(l,t,a),Ol(l,t,a))}function f0(t,a){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var l=t.retryLane;t.retryLane=l!==0&&l<a?l:a}}function rp(t,a){f0(t,a),(t=t.alternate)&&f0(t,a)}function m0(t){if(t.tag===13||t.tag===31){var a=Er(t,67108864);a!==null&&Kn(a,t,67108864),rp(t,67108864)}}function p0(t){if(t.tag===13||t.tag===31){var a=ca();a=ns(a);var l=Er(t,a);l!==null&&Kn(l,t,a),rp(t,a)}}var pu=!0;function OE(t,a,l,u){var g=q.T;q.T=null;var v=X.p;try{X.p=2,op(t,a,l,u)}finally{X.p=v,q.T=g}}function zE(t,a,l,u){var g=q.T;q.T=null;var v=X.p;try{X.p=8,op(t,a,l,u)}finally{X.p=v,q.T=g}}function op(t,a,l,u){if(pu){var g=lp(u);if(g===null)Ym(t,a,u,gu,l),h0(t,u);else if(LE(g,t,a,l,u))u.stopPropagation();else if(h0(t,u),a&4&&-1<DE.indexOf(t)){for(;g!==null;){var v=so(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var T=Wt(v.pendingLanes);if(T!==0){var z=v;for(z.pendingLanes|=2,z.entangledLanes|=2;T;){var F=1<<31-Bt(T);z.entanglements[1]|=F,T&=~F}Va(v),(wt&6)===0&&(Zc=ve()+500,Kl(0))}}break;case 31:case 13:z=Er(v,2),z!==null&&Kn(z,v,2),Wc(),rp(v,2)}if(v=lp(u),v===null&&Ym(t,a,u,gu,l),v===g)break;g=v}g!==null&&u.stopPropagation()}else Ym(t,a,u,null,l)}}function lp(t){return t=cf(t),ip(t)}var gu=null;function ip(t){if(gu=null,t=ao(t),t!==null){var a=c(t);if(a===null)t=null;else{var l=a.tag;if(l===13){if(t=d(a),t!==null)return t;t=null}else if(l===31){if(t=f(a),t!==null)return t;t=null}else if(l===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;t=null}else a!==t&&(t=null)}}return gu=t,null}function g0(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 ye:return 2;case je:return 8;case Be:case Ze:return 32;case _t:return 268435456;default:return 32}default:return 32}}var cp=!1,Zs=null,Js=null,Ws=null,ni=new Map,ai=new Map,er=[],DE="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 h0(t,a){switch(t){case"focusin":case"focusout":Zs=null;break;case"dragenter":case"dragleave":Js=null;break;case"mouseover":case"mouseout":Ws=null;break;case"pointerover":case"pointerout":ni.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ai.delete(a.pointerId)}}function si(t,a,l,u,g,v){return t===null||t.nativeEvent!==v?(t={blockedOn:a,domEventName:l,eventSystemFlags:u,nativeEvent:v,targetContainers:[g]},a!==null&&(a=so(a),a!==null&&m0(a)),t):(t.eventSystemFlags|=u,a=t.targetContainers,g!==null&&a.indexOf(g)===-1&&a.push(g),t)}function LE(t,a,l,u,g){switch(a){case"focusin":return Zs=si(Zs,t,a,l,u,g),!0;case"dragenter":return Js=si(Js,t,a,l,u,g),!0;case"mouseover":return Ws=si(Ws,t,a,l,u,g),!0;case"pointerover":var v=g.pointerId;return ni.set(v,si(ni.get(v)||null,t,a,l,u,g)),!0;case"gotpointercapture":return v=g.pointerId,ai.set(v,si(ai.get(v)||null,t,a,l,u,g)),!0}return!1}function x0(t){var a=ao(t.target);if(a!==null){var l=c(a);if(l!==null){if(a=l.tag,a===13){if(a=d(l),a!==null){t.blockedOn=a,yn(t.priority,function(){p0(l)});return}}else if(a===31){if(a=f(l),a!==null){t.blockedOn=a,yn(t.priority,function(){p0(l)});return}}else if(a===3&&l.stateNode.current.memoizedState.isDehydrated){t.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}t.blockedOn=null}function hu(t){if(t.blockedOn!==null)return!1;for(var a=t.targetContainers;0<a.length;){var l=lp(t.nativeEvent);if(l===null){l=t.nativeEvent;var u=new l.constructor(l.type,l);lf=u,l.target.dispatchEvent(u),lf=null}else return a=so(l),a!==null&&m0(a),t.blockedOn=l,!1;a.shift()}return!0}function b0(t,a,l){hu(t)&&l.delete(a)}function PE(){cp=!1,Zs!==null&&hu(Zs)&&(Zs=null),Js!==null&&hu(Js)&&(Js=null),Ws!==null&&hu(Ws)&&(Ws=null),ni.forEach(b0),ai.forEach(b0)}function xu(t,a){t.blockedOn===a&&(t.blockedOn=null,cp||(cp=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,PE)))}var bu=null;function v0(t){bu!==t&&(bu=t,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){bu===t&&(bu=null);for(var a=0;a<t.length;a+=3){var l=t[a],u=t[a+1],g=t[a+2];if(typeof u!="function"){if(ip(u||l)===null)continue;break}var v=so(l);v!==null&&(t.splice(a,3),a-=3,lm(v,{pending:!0,data:g,method:l.method,action:u},u,g))}}))}function Uo(t){function a(F){return xu(F,t)}Zs!==null&&xu(Zs,t),Js!==null&&xu(Js,t),Ws!==null&&xu(Ws,t),ni.forEach(a),ai.forEach(a);for(var l=0;l<er.length;l++){var u=er[l];u.blockedOn===t&&(u.blockedOn=null)}for(;0<er.length&&(l=er[0],l.blockedOn===null);)x0(l),l.blockedOn===null&&er.shift();if(l=(t.ownerDocument||t).$$reactFormReplay,l!=null)for(u=0;u<l.length;u+=3){var g=l[u],v=l[u+1],T=g[un]||null;if(typeof v=="function")T||v0(l);else if(T){var z=null;if(v&&v.hasAttribute("formAction")){if(g=v,T=v[un]||null)z=T.formAction;else if(ip(g)!==null)continue}else z=T.action;typeof z=="function"?l[u+1]=z:(l.splice(u,3),u-=3),v0(l)}}}function y0(){function t(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(T){return g=T})},focusReset:"manual",scroll:"manual"})}function a(){g!==null&&(g(),g=null),u||setTimeout(l,20)}function l(){if(!u&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var u=!1,g=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(l,100),function(){u=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),g!==null&&(g(),g=null)}}}function up(t){this._internalRoot=t}vu.prototype.render=up.prototype.render=function(t){var a=this._internalRoot;if(a===null)throw Error(r(409));var l=a.current,u=ca();d0(l,u,t,a,null,null)},vu.prototype.unmount=up.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var a=t.containerInfo;d0(t.current,2,null,t,null,null),Wc(),a[_r]=null}};function vu(t){this._internalRoot=t}vu.prototype.unstable_scheduleHydration=function(t){if(t){var a=At();t={blockedOn:null,target:t,priority:a};for(var l=0;l<er.length&&a!==0&&a<er[l].priority;l++);er.splice(l,0,t),l===0&&x0(t)}};var _0=n.version;if(_0!=="19.2.7")throw Error(r(527,_0,"19.2.7"));X.findDOMNode=function(t){var a=t._reactInternals;if(a===void 0)throw typeof t.render=="function"?Error(r(188)):(t=Object.keys(t).join(","),Error(r(268,t)));return t=m(a),t=t!==null?h(t):null,t=t===null?null:t.stateNode,t};var BE={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var yu=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!yu.isDisabled&&yu.supportsFiber)try{ut=yu.inject(BE),it=yu}catch{}}return oi.createRoot=function(t,a){if(!i(t))throw Error(r(299));var l=!1,u="",g=Nv,v=Rv,T=Tv;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(u=a.identifierPrefix),a.onUncaughtError!==void 0&&(g=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(T=a.onRecoverableError)),a=c0(t,1,!1,null,null,l,u,null,g,v,T,y0),t[_r]=a.current,Gm(t),new up(a)},oi.hydrateRoot=function(t,a,l){if(!i(t))throw Error(r(299));var u=!1,g="",v=Nv,T=Rv,z=Tv,F=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(T=l.onCaughtError),l.onRecoverableError!==void 0&&(z=l.onRecoverableError),l.formState!==void 0&&(F=l.formState)),a=c0(t,1,!0,a,l??null,u,g,F,v,T,z,y0),a.context=u0(null),l=a.current,u=ca(),u=ns(u),g=Is(u),g.callback=null,Us(l,g,u),l=u,a.current.lanes=l,Vn(a,l),Va(a),t[_r]=a.current,Gm(t),new vu(a)},oi.version="19.2.7",oi}var A0;function KE(){if(A0)return mp.exports;A0=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(),mp.exports=XE(),mp.exports}var QE=KE();const ZE=rh(QE);/**
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 M0="popstate";function O0(e){return typeof e=="object"&&e!=null&&"pathname"in e&&"search"in e&&"hash"in e&&"state"in e&&"key"in e}function JE(e={}){function n(r,i){let c=i.state?.masked,{pathname:d,search:f,hash:p}=c||r.location;return Eg("",{pathname:d,search:f,hash:p},i.state&&i.state.usr||null,i.state&&i.state.key||"default",c?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function s(r,i){return typeof i=="string"?i:Pi(i)}return ek(n,s,null,e)}function Zt(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function Pa(e,n){if(!e){typeof console<"u"&&console.warn(n);try{throw new Error(n)}catch{}}}function WE(){return Math.random().toString(36).substring(2,10)}function z0(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 Eg(e,n,s=null,r,i){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof n=="string"?ol(n):n,state:s,key:n&&n.key||r||WE(),mask:i}}function Pi({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 ol(e){let n={};if(e){let s=e.indexOf("#");s>=0&&(n.hash=e.substring(s),e=e.substring(0,s));let r=e.indexOf("?");r>=0&&(n.search=e.substring(r),e=e.substring(0,r)),e&&(n.pathname=e)}return n}function ek(e,n,s,r={}){let{window:i=document.defaultView,v5Compat:c=!1}=r,d=i.history,f="POP",p=null,m=h();m==null&&(m=0,d.replaceState({...d.state,idx:m},""));function h(){return(d.state||{idx:null}).idx}function x(){f="POP";let j=h(),k=j==null?null:j-m;m=j,p&&p({action:f,location:_.location,delta:k})}function y(j,k){f="PUSH";let E=O0(j)?j:Eg(_.location,j,k);m=h()+1;let R=z0(E,m),N=_.createHref(E.mask||E);try{d.pushState(R,"",N)}catch(M){if(M instanceof DOMException&&M.name==="DataCloneError")throw M;i.location.assign(N)}c&&p&&p({action:f,location:_.location,delta:1})}function S(j,k){f="REPLACE";let E=O0(j)?j:Eg(_.location,j,k);m=h();let R=z0(E,m),N=_.createHref(E.mask||E);d.replaceState(R,"",N),c&&p&&p({action:f,location:_.location,delta:0})}function w(j){return tk(i,j)}let _={get action(){return f},get location(){return e(i,d)},listen(j){if(p)throw new Error("A history only accepts one active listener");return i.addEventListener(M0,x),p=j,()=>{i.removeEventListener(M0,x),p=null}},createHref(j){return n(i,j)},createURL:w,encodeLocation(j){let k=w(j);return{pathname:k.pathname,search:k.search,hash:k.hash}},push:y,replace:S,go(j){return d.go(j)}};return _}function tk(e,n,s=!1){let r="http://localhost";e&&(r=e.location.origin!=="null"?e.location.origin:e.location.href),Zt(r,"No window.location.(origin|href) available to create URL");let i=typeof n=="string"?n:Pi(n);return i=i.replace(/ $/,"%20"),!s&&i.startsWith("//")&&(i=r+i),new URL(i,r)}function H_(e,n,s="/"){return nk(e,n,s,!1)}function nk(e,n,s,r,i){let c=typeof n=="string"?ol(n):n,d=ks(c.pathname||"/",s);if(d==null)return null;let f=ak(e),p=null,m=gk(d);for(let h=0;p==null&&h<f.length;++h)p=mk(f[h],m,r);return p}function ak(e){let n=q_(e);return sk(n),n}function q_(e,n=[],s=[],r="",i=!1){let c=(d,f,p=i,m)=>{let h={relativePath:m===void 0?d.path||"":m,caseSensitive:d.caseSensitive===!0,childrenIndex:f,route:d};if(h.relativePath.startsWith("/")){if(!h.relativePath.startsWith(r)&&p)return;Zt(h.relativePath.startsWith(r),`Absolute route path "${h.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(r.length)}let x=La([r,h.relativePath]),y=s.concat(h);d.children&&d.children.length>0&&(Zt(d.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${x}".`),q_(d.children,n,y,x,p)),!(d.path==null&&!d.index)&&n.push({path:x,score:dk(x,d.index),routesMeta:y})};return e.forEach((d,f)=>{if(d.path===""||!d.path?.includes("?"))c(d,f);else for(let p of V_(d.path))c(d,f,!0,p)}),n}function V_(e){let n=e.split("/");if(n.length===0)return[];let[s,...r]=n,i=s.endsWith("?"),c=s.replace(/\?$/,"");if(r.length===0)return i?[c,""]:[c];let d=V_(r.join("/")),f=[];return f.push(...d.map(p=>p===""?c:[c,p].join("/"))),i&&f.push(...d),f.map(p=>e.startsWith("/")&&p===""?"/":p)}function sk(e){e.sort((n,s)=>n.score!==s.score?s.score-n.score:fk(n.routesMeta.map(r=>r.childrenIndex),s.routesMeta.map(r=>r.childrenIndex)))}var rk=/^:[\w-]+$/,ok=3,lk=2,ik=1,ck=10,uk=-2,D0=e=>e==="*";function dk(e,n){let s=e.split("/"),r=s.length;return s.some(D0)&&(r+=uk),n&&(r+=lk),s.filter(i=>!D0(i)).reduce((i,c)=>i+(rk.test(c)?ok:c===""?ik:ck),r)}function fk(e,n){return e.length===n.length&&e.slice(0,-1).every((r,i)=>r===n[i])?e[e.length-1]-n[n.length-1]:0}function mk(e,n,s=!1){let{routesMeta:r}=e,i={},c="/",d=[];for(let f=0;f<r.length;++f){let p=r[f],m=f===r.length-1,h=c==="/"?n:n.slice(c.length)||"/",x=Wu({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},h),y=p.route;if(!x&&m&&s&&!r[r.length-1].route.index&&(x=Wu({path:p.relativePath,caseSensitive:p.caseSensitive,end:!1},h)),!x)return null;Object.assign(i,x.params),d.push({params:i,pathname:La([c,x.pathname]),pathnameBase:vk(La([c,x.pathnameBase])),route:y}),x.pathnameBase!=="/"&&(c=La([c,x.pathnameBase]))}return d}function Wu(e,n){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[s,r]=pk(e.path,e.caseSensitive,e.end),i=n.match(s);if(!i)return null;let c=i[0],d=c.replace(/(.)\/+$/,"$1"),f=i.slice(1);return{params:r.reduce((m,{paramName:h,isOptional:x},y)=>{if(h==="*"){let w=f[y]||"";d=c.slice(0,c.length-w.length).replace(/(.)\/+$/,"$1")}const S=f[y];return x&&!S?m[h]=void 0:m[h]=(S||"").replace(/%2F/g,"/"),m},{}),pathname:c,pathnameBase:d,pattern:e}}function pk(e,n=!1,s=!0){Pa(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 r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(d,f,p,m,h)=>{if(r.push({paramName:f,isOptional:p!=null}),p){let x=h.charAt(m+d.length);return x&&x!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):s?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,n?void 0:"i"),r]}function gk(e){try{return e.split("/").map(n=>decodeURIComponent(n).replace(/\//g,"%2F")).join("/")}catch(n){return Pa(!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 ks(e,n){if(n==="/")return e;if(!e.toLowerCase().startsWith(n.toLowerCase()))return null;let s=n.endsWith("/")?n.length-1:n.length,r=e.charAt(s);return r&&r!=="/"?null:e.slice(s)||"/"}var hk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function xk(e,n="/"){let{pathname:s,search:r="",hash:i=""}=typeof e=="string"?ol(e):e,c;return s?(s=G_(s),s.startsWith("/")?c=L0(s.substring(1),"/"):c=L0(s,n)):c=n,{pathname:c,search:yk(r),hash:_k(i)}}function L0(e,n){let s=ed(n).split("/");return e.split("/").forEach(i=>{i===".."?s.length>1&&s.pop():i!=="."&&s.push(i)}),s.length>1?s.join("/"):"/"}function xp(e,n,s,r){return`Cannot include a '${e}' character in a manually specified \`to.${n}\` field [${JSON.stringify(r)}]. 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 bk(e){return e.filter((n,s)=>s===0||n.route.path&&n.route.path.length>0)}function $_(e){let n=bk(e);return n.map((s,r)=>r===n.length-1?s.pathname:s.pathnameBase)}function oh(e,n,s,r=!1){let i;typeof e=="string"?i=ol(e):(i={...e},Zt(!i.pathname||!i.pathname.includes("?"),xp("?","pathname","search",i)),Zt(!i.pathname||!i.pathname.includes("#"),xp("#","pathname","hash",i)),Zt(!i.search||!i.search.includes("#"),xp("#","search","hash",i)));let c=e===""||i.pathname==="",d=c?"/":i.pathname,f;if(d==null)f=s;else{let x=n.length-1;if(!r&&d.startsWith("..")){let y=d.split("/");for(;y[0]==="..";)y.shift(),x-=1;i.pathname=y.join("/")}f=x>=0?n[x]:"/"}let p=xk(i,f),m=d&&d!=="/"&&d.endsWith("/"),h=(c||d===".")&&s.endsWith("/");return!p.pathname.endsWith("/")&&(m||h)&&(p.pathname+="/"),p}var G_=e=>e.replace(/\/\/+/g,"/"),La=e=>G_(e.join("/")),ed=e=>e.replace(/\/+$/,""),vk=e=>ed(e).replace(/^\/*/,"/"),yk=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,_k=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,jk=class{constructor(e,n,s,r=!1){this.status=e,this.statusText=n||"",this.internal=r,s instanceof Error?(this.data=s.toString(),this.error=s):this.data=s}};function Sk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function wk(e){let n=e.map(s=>s.route.path).filter(Boolean);return La(n)||"/"}var Y_=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function F_(e,n){let s=e;if(typeof s!="string"||!hk.test(s))return{absoluteURL:void 0,isExternal:!1,to:s};let r=s,i=!1;if(Y_)try{let c=new URL(window.location.href),d=s.startsWith("//")?new URL(c.protocol+s):new URL(s),f=ks(d.pathname,n);d.origin===c.origin&&f!=null?s=f+d.search+d.hash:i=!0}catch{Pa(!1,`<Link to="${s}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:s}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var X_=["POST","PUT","PATCH","DELETE"];new Set(X_);var Ck=["GET",...X_];new Set(Ck);var ll=b.createContext(null);ll.displayName="DataRouter";var Ed=b.createContext(null);Ed.displayName="DataRouterState";var K_=b.createContext(!1);function Ek(){return b.useContext(K_)}var Q_=b.createContext({isTransitioning:!1});Q_.displayName="ViewTransition";var kk=b.createContext(new Map);kk.displayName="Fetchers";var Nk=b.createContext(null);Nk.displayName="Await";var Ra=b.createContext(null);Ra.displayName="Navigation";var Zi=b.createContext(null);Zi.displayName="Location";var Qa=b.createContext({outlet:null,matches:[],isDataRoute:!1});Qa.displayName="Route";var lh=b.createContext(null);lh.displayName="RouteError";var Z_="REACT_ROUTER_ERROR",Rk="REDIRECT",Tk="ROUTE_ERROR_RESPONSE";function Ak(e){if(e.startsWith(`${Z_}:${Rk}:{`))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 Mk(e){if(e.startsWith(`${Z_}:${Tk}:{`))try{let n=JSON.parse(e.slice(40));if(typeof n=="object"&&n&&typeof n.status=="number"&&typeof n.statusText=="string")return new jk(n.status,n.statusText,n.data)}catch{}}function Ok(e,{relative:n}={}){Zt(Ji(),"useHref() may be used only in the context of a <Router> component.");let{basename:s,navigator:r}=b.useContext(Ra),{hash:i,pathname:c,search:d}=Wi(e,{relative:n}),f=c;return s!=="/"&&(f=c==="/"?s:La([s,c])),r.createHref({pathname:f,search:d,hash:i})}function Ji(){return b.useContext(Zi)!=null}function ea(){return Zt(Ji(),"useLocation() may be used only in the context of a <Router> component."),b.useContext(Zi).location}var J_="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function W_(e){b.useContext(Ra).static||b.useLayoutEffect(e)}function Ia(){let{isDataRoute:e}=b.useContext(Qa);return e?Yk():zk()}function zk(){Zt(Ji(),"useNavigate() may be used only in the context of a <Router> component.");let e=b.useContext(ll),{basename:n,navigator:s}=b.useContext(Ra),{matches:r}=b.useContext(Qa),{pathname:i}=ea(),c=JSON.stringify($_(r)),d=b.useRef(!1);return W_(()=>{d.current=!0}),b.useCallback((p,m={})=>{if(Pa(d.current,J_),!d.current)return;if(typeof p=="number"){s.go(p);return}let h=oh(p,JSON.parse(c),i,m.relative==="path");e==null&&n!=="/"&&(h.pathname=h.pathname==="/"?n:La([n,h.pathname])),(m.replace?s.replace:s.push)(h,m.state,m)},[n,s,c,i,e])}b.createContext(null);function ej(){let{matches:e}=b.useContext(Qa);return e[e.length-1]?.params??{}}function Wi(e,{relative:n}={}){let{matches:s}=b.useContext(Qa),{pathname:r}=ea(),i=JSON.stringify($_(s));return b.useMemo(()=>oh(e,JSON.parse(i),r,n==="path"),[e,i,r,n])}function Dk(e,n){return tj(e,n)}function tj(e,n,s){Zt(Ji(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=b.useContext(Ra),{matches:i}=b.useContext(Qa),c=i[i.length-1],d=c?c.params:{},f=c?c.pathname:"/",p=c?c.pathnameBase:"/",m=c&&c.route;{let j=m&&m.path||"";aj(f,!m||j.endsWith("*")||j.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${f}" (under <Route path="${j}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
59
-
60
- Please change the parent <Route path="${j}"> to <Route path="${j==="/"?"*":`${j}/*`}">.`)}let h=ea(),x;if(n){let j=typeof n=="string"?ol(n):n;Zt(p==="/"||j.pathname?.startsWith(p),`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 "${p}" but pathname "${j.pathname}" was given in the \`location\` prop.`),x=j}else x=h;let y=x.pathname||"/",S=y;if(p!=="/"){let j=p.replace(/^\//,"").split("/");S="/"+y.replace(/^\//,"").split("/").slice(j.length).join("/")}let w=s&&s.state.matches.length?s.state.matches.map(j=>Object.assign(j,{route:s.manifest[j.route.id]||j.route})):H_(e,{pathname:S});Pa(m||w!=null,`No routes matched location "${x.pathname}${x.search}${x.hash}" `),Pa(w==null||w[w.length-1].route.element!==void 0||w[w.length-1].route.Component!==void 0||w[w.length-1].route.lazy!==void 0,`Matched leaf route at location "${x.pathname}${x.search}${x.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 _=Uk(w&&w.map(j=>Object.assign({},j,{params:Object.assign({},d,j.params),pathname:La([p,r.encodeLocation?r.encodeLocation(j.pathname.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathname]),pathnameBase:j.pathnameBase==="/"?p:La([p,r.encodeLocation?r.encodeLocation(j.pathnameBase.replace(/%/g,"%25").replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:j.pathnameBase])})),i,s);return n&&_?b.createElement(Zi.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",mask:void 0,...x},navigationType:"POP"}},_):_}function Lk(){let e=Gk(),n=Sk(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),s=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",i={padding:"0.5rem",backgroundColor:r},c={padding:"2px 4px",backgroundColor:r},d=null;return console.error("Error handled by React Router default ErrorBoundary:",e),d=b.createElement(b.Fragment,null,b.createElement("p",null,"💿 Hey developer 👋"),b.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",b.createElement("code",{style:c},"ErrorBoundary")," or"," ",b.createElement("code",{style:c},"errorElement")," prop on your route.")),b.createElement(b.Fragment,null,b.createElement("h2",null,"Unexpected Application Error!"),b.createElement("h3",{style:{fontStyle:"italic"}},n),s?b.createElement("pre",{style:i},s):null,d)}var Pk=b.createElement(Lk,null),nj=class extends b.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=Mk(e.digest);s&&(e=s)}let n=e!==void 0?b.createElement(Qa.Provider,{value:this.props.routeContext},b.createElement(lh.Provider,{value:e,children:this.props.component})):this.props.children;return this.context?b.createElement(Bk,{error:e},n):n}};nj.contextType=K_;var bp=new WeakMap;function Bk({children:e,error:n}){let{basename:s}=b.useContext(Ra);if(typeof n=="object"&&n&&"digest"in n&&typeof n.digest=="string"){let r=Ak(n.digest);if(r){let i=bp.get(n);if(i)throw i;let c=F_(r.location,s);if(Y_&&!bp.get(n))if(c.isExternal||r.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const d=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:r.replace}));throw bp.set(n,d),d}return b.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return e}function Ik({routeContext:e,match:n,children:s}){let r=b.useContext(ll);return r&&r.static&&r.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=n.route.id),b.createElement(Qa.Provider,{value:e},s)}function Uk(e,n=[],s){let r=s?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(n.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,c=r?.errors;if(c!=null){let h=i.findIndex(x=>x.route.id&&c?.[x.route.id]!==void 0);Zt(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),i=i.slice(0,Math.min(i.length,h+1))}let d=!1,f=-1;if(s&&r){d=r.renderFallback;for(let h=0;h<i.length;h++){let x=i[h];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(f=h),x.route.id){let{loaderData:y,errors:S}=r,w=x.route.loader&&!y.hasOwnProperty(x.route.id)&&(!S||S[x.route.id]===void 0);if(x.route.lazy||w){s.isStatic&&(d=!0),f>=0?i=i.slice(0,f+1):i=[i[0]];break}}}}let p=s?.onError,m=r&&p?(h,x)=>{p(h,{location:r.location,params:r.matches?.[0]?.params??{},pattern:wk(r.matches),errorInfo:x})}:void 0;return i.reduceRight((h,x,y)=>{let S,w=!1,_=null,j=null;r&&(S=c&&x.route.id?c[x.route.id]:void 0,_=x.route.errorElement||Pk,d&&(f<0&&y===0?(aj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,j=null):f===y&&(w=!0,j=x.route.hydrateFallbackElement||null)));let k=n.concat(i.slice(0,y+1)),E=()=>{let R;return S?R=_:w?R=j:x.route.Component?R=b.createElement(x.route.Component,null):x.route.element?R=x.route.element:R=h,b.createElement(Ik,{match:x,routeContext:{outlet:h,matches:k,isDataRoute:r!=null},children:R})};return r&&(x.route.ErrorBoundary||x.route.errorElement||y===0)?b.createElement(nj,{location:r.location,revalidation:r.revalidation,component:_,error:S,children:E(),routeContext:{outlet:null,matches:k,isDataRoute:!0},onError:m}):E()},null)}function ih(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Hk(e){let n=b.useContext(ll);return Zt(n,ih(e)),n}function qk(e){let n=b.useContext(Ed);return Zt(n,ih(e)),n}function Vk(e){let n=b.useContext(Qa);return Zt(n,ih(e)),n}function ch(e){let n=Vk(e),s=n.matches[n.matches.length-1];return Zt(s.route.id,`${e} can only be used on routes that contain a unique "id"`),s.route.id}function $k(){return ch("useRouteId")}function Gk(){let e=b.useContext(lh),n=qk("useRouteError"),s=ch("useRouteError");return e!==void 0?e:n.errors?.[s]}function Yk(){let{router:e}=Hk("useNavigate"),n=ch("useNavigate"),s=b.useRef(!1);return W_(()=>{s.current=!0}),b.useCallback(async(i,c={})=>{Pa(s.current,J_),s.current&&(typeof i=="number"?await e.navigate(i):await e.navigate(i,{fromRouteId:n,...c}))},[e,n])}var P0={};function aj(e,n,s){!n&&!P0[e]&&(P0[e]=!0,Pa(!1,s))}b.memo(Fk);function Fk({routes:e,manifest:n,future:s,state:r,isStatic:i,onError:c}){return tj(e,void 0,{manifest:n,state:r,isStatic:i,onError:c})}function qt(e){Zt(!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 Xk({basename:e="/",children:n=null,location:s,navigationType:r="POP",navigator:i,static:c=!1,useTransitions:d}){Zt(!Ji(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let f=e.replace(/^\/*/,"/"),p=b.useMemo(()=>({basename:f,navigator:i,static:c,useTransitions:d,future:{}}),[f,i,c,d]);typeof s=="string"&&(s=ol(s));let{pathname:m="/",search:h="",hash:x="",state:y=null,key:S="default",mask:w}=s,_=b.useMemo(()=>{let j=ks(m,f);return j==null?null:{location:{pathname:j,search:h,hash:x,state:y,key:S,mask:w},navigationType:r}},[f,m,h,x,y,S,r,w]);return Pa(_!=null,`<Router basename="${f}"> is not able to match the URL "${m}${h}${x}" because it does not start with the basename, so the <Router> won't render anything.`),_==null?null:b.createElement(Ra.Provider,{value:p},b.createElement(Zi.Provider,{children:n,value:_}))}function sj({children:e,location:n}){return Dk(kg(e),n)}function kg(e,n=[]){let s=[];return b.Children.forEach(e,(r,i)=>{if(!b.isValidElement(r))return;let c=[...n,i];if(r.type===b.Fragment){s.push.apply(s,kg(r.props.children,c));return}Zt(r.type===qt,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Zt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let d={id:r.props.id||c.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(d.children=kg(r.props.children,c)),s.push(d)}),s}var Vu="get",$u="application/x-www-form-urlencoded";function kd(e){return typeof HTMLElement<"u"&&e instanceof HTMLElement}function Kk(e){return kd(e)&&e.tagName.toLowerCase()==="button"}function Qk(e){return kd(e)&&e.tagName.toLowerCase()==="form"}function Zk(e){return kd(e)&&e.tagName.toLowerCase()==="input"}function Jk(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Wk(e,n){return e.button===0&&(!n||n==="_self")&&!Jk(e)}function Ng(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((n,s)=>{let r=e[s];return n.concat(Array.isArray(r)?r.map(i=>[s,i]):[[s,r]])},[]))}function eN(e,n){let s=Ng(e);return n&&n.forEach((r,i)=>{s.has(i)||n.getAll(i).forEach(c=>{s.append(i,c)})}),s}var _u=null;function tN(){if(_u===null)try{new FormData(document.createElement("form"),0),_u=!1}catch{_u=!0}return _u}var nN=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function vp(e){return e!=null&&!nN.has(e)?(Pa(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${$u}"`),null):e}function aN(e,n){let s,r,i,c,d;if(Qk(e)){let f=e.getAttribute("action");r=f?ks(f,n):null,s=e.getAttribute("method")||Vu,i=vp(e.getAttribute("enctype"))||$u,c=new FormData(e)}else if(Kk(e)||Zk(e)&&(e.type==="submit"||e.type==="image")){let f=e.form;if(f==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let p=e.getAttribute("formaction")||f.getAttribute("action");if(r=p?ks(p,n):null,s=e.getAttribute("formmethod")||f.getAttribute("method")||Vu,i=vp(e.getAttribute("formenctype"))||vp(f.getAttribute("enctype"))||$u,c=new FormData(f,e),!tN()){let{name:m,type:h,value:x}=e;if(h==="image"){let y=m?`${m}.`:"";c.append(`${y}x`,"0"),c.append(`${y}y`,"0")}else m&&c.append(m,x)}}else{if(kd(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');s=Vu,r=null,i=$u,d=e}return c&&i==="text/plain"&&(d=c,c=void 0),{action:r,method:s.toLowerCase(),encType:i,formData:c,body:d}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function uh(e,n){if(e===!1||e===null||typeof e>"u")throw new Error(n)}function rj(e,n,s,r){let i=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return s?i.pathname.endsWith("/")?i.pathname=`${i.pathname}_.${r}`:i.pathname=`${i.pathname}.${r}`:i.pathname==="/"?i.pathname=`_root.${r}`:n&&ks(i.pathname,n)==="/"?i.pathname=`${ed(n)}/_root.${r}`:i.pathname=`${ed(i.pathname)}.${r}`,i}async function sN(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 rN(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 oN(e,n,s){let r=await Promise.all(e.map(async i=>{let c=n.routes[i.route.id];if(c){let d=await sN(c,s);return d.links?d.links():[]}return[]}));return uN(r.flat(1).filter(rN).filter(i=>i.rel==="stylesheet"||i.rel==="preload").map(i=>i.rel==="stylesheet"?{...i,rel:"prefetch",as:"style"}:{...i,rel:"prefetch"}))}function B0(e,n,s,r,i,c){let d=(p,m)=>s[m]?p.route.id!==s[m].route.id:!0,f=(p,m)=>s[m].pathname!==p.pathname||s[m].route.path?.endsWith("*")&&s[m].params["*"]!==p.params["*"];return c==="assets"?n.filter((p,m)=>d(p,m)||f(p,m)):c==="data"?n.filter((p,m)=>{let h=r.routes[p.route.id];if(!h||!h.hasLoader)return!1;if(d(p,m)||f(p,m))return!0;if(p.route.shouldRevalidate){let x=p.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:s[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:p.params,defaultShouldRevalidate:!0});if(typeof x=="boolean")return x}return!0}):[]}function lN(e,n,{includeHydrateFallback:s}={}){return iN(e.map(r=>{let i=n.routes[r.route.id];if(!i)return[];let c=[i.module];return i.clientActionModule&&(c=c.concat(i.clientActionModule)),i.clientLoaderModule&&(c=c.concat(i.clientLoaderModule)),s&&i.hydrateFallbackModule&&(c=c.concat(i.hydrateFallbackModule)),i.imports&&(c=c.concat(i.imports)),c}).flat(1))}function iN(e){return[...new Set(e)]}function cN(e){let n={},s=Object.keys(e).sort();for(let r of s)n[r]=e[r];return n}function uN(e,n){let s=new Set;return new Set(n),e.reduce((r,i)=>{let c=JSON.stringify(cN(i));return s.has(c)||(s.add(c),r.push({key:c,link:i})),r},[])}function dh(){let e=b.useContext(ll);return uh(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function dN(){let e=b.useContext(Ed);return uh(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var fh=b.createContext(void 0);fh.displayName="FrameworkContext";function mh(){let e=b.useContext(fh);return uh(e,"You must render this element inside a <HydratedRouter> element"),e}function fN(e,n){let s=b.useContext(fh),[r,i]=b.useState(!1),[c,d]=b.useState(!1),{onFocus:f,onBlur:p,onMouseEnter:m,onMouseLeave:h,onTouchStart:x}=n,y=b.useRef(null);b.useEffect(()=>{if(e==="render"&&d(!0),e==="viewport"){let _=k=>{k.forEach(E=>{d(E.isIntersecting)})},j=new IntersectionObserver(_,{threshold:.5});return y.current&&j.observe(y.current),()=>{j.disconnect()}}},[e]),b.useEffect(()=>{if(r){let _=setTimeout(()=>{d(!0)},100);return()=>{clearTimeout(_)}}},[r]);let S=()=>{i(!0)},w=()=>{i(!1),d(!1)};return s?e!=="intent"?[c,y,{}]:[c,y,{onFocus:li(f,S),onBlur:li(p,w),onMouseEnter:li(m,S),onMouseLeave:li(h,w),onTouchStart:li(x,S)}]:[!1,y,{}]}function li(e,n){return s=>{e&&e(s),s.defaultPrevented||n(s)}}function mN({page:e,...n}){let s=Ek(),{router:r}=dh(),i=b.useMemo(()=>H_(r.routes,e,r.basename),[r.routes,e,r.basename]);return i?s?b.createElement(gN,{page:e,matches:i,...n}):b.createElement(hN,{page:e,matches:i,...n}):null}function pN(e){let{manifest:n,routeModules:s}=mh(),[r,i]=b.useState([]);return b.useEffect(()=>{let c=!1;return oN(e,n,s).then(d=>{c||i(d)}),()=>{c=!0}},[e,n,s]),r}function gN({page:e,matches:n,...s}){let r=ea(),{future:i}=mh(),{basename:c}=dh(),d=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let f=rj(e,c,i.v8_trailingSlashAwareDataRequests,"rsc"),p=!1,m=[];for(let h of n)typeof h.route.shouldRevalidate=="function"?p=!0:m.push(h.route.id);return p&&m.length>0&&f.searchParams.set("_routes",m.join(",")),[f.pathname+f.search]},[c,i.v8_trailingSlashAwareDataRequests,e,r,n]);return b.createElement(b.Fragment,null,d.map(f=>b.createElement("link",{key:f,rel:"prefetch",as:"fetch",href:f,...s})))}function hN({page:e,matches:n,...s}){let r=ea(),{future:i,manifest:c,routeModules:d}=mh(),{basename:f}=dh(),{loaderData:p,matches:m}=dN(),h=b.useMemo(()=>B0(e,n,m,c,r,"data"),[e,n,m,c,r]),x=b.useMemo(()=>B0(e,n,m,c,r,"assets"),[e,n,m,c,r]),y=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let _=new Set,j=!1;if(n.forEach(E=>{let R=c.routes[E.route.id];!R||!R.hasLoader||(!h.some(N=>N.route.id===E.route.id)&&E.route.id in p&&d[E.route.id]?.shouldRevalidate||R.hasClientLoader?j=!0:_.add(E.route.id))}),_.size===0)return[];let k=rj(e,f,i.v8_trailingSlashAwareDataRequests,"data");return j&&_.size>0&&k.searchParams.set("_routes",n.filter(E=>_.has(E.route.id)).map(E=>E.route.id).join(",")),[k.pathname+k.search]},[f,i.v8_trailingSlashAwareDataRequests,p,r,c,h,n,e,d]),S=b.useMemo(()=>lN(x,c),[x,c]),w=pN(x);return b.createElement(b.Fragment,null,y.map(_=>b.createElement("link",{key:_,rel:"prefetch",as:"fetch",href:_,...s})),S.map(_=>b.createElement("link",{key:_,rel:"modulepreload",href:_,...s})),w.map(({key:_,link:j})=>b.createElement("link",{key:_,nonce:s.nonce,...j,crossOrigin:j.crossOrigin??s.crossOrigin})))}function xN(...e){return n=>{e.forEach(s=>{typeof s=="function"?s(n):s!=null&&(s.current=n)})}}var bN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{bN&&(window.__reactRouterVersion="7.17.0")}catch{}function vN({basename:e,children:n,useTransitions:s,window:r}){let i=b.useRef();i.current==null&&(i.current=JE({window:r,v5Compat:!0}));let c=i.current,[d,f]=b.useState({action:c.action,location:c.location}),p=b.useCallback(m=>{s===!1?f(m):b.startTransition(()=>f(m))},[s]);return b.useLayoutEffect(()=>c.listen(p),[c,p]),b.createElement(Xk,{basename:e,children:n,location:d.location,navigationType:d.action,navigator:c,useTransitions:s})}var oj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ph=b.forwardRef(function({onClick:n,discover:s="render",prefetch:r="none",relative:i,reloadDocument:c,replace:d,mask:f,state:p,target:m,to:h,preventScrollReset:x,viewTransition:y,defaultShouldRevalidate:S,...w},_){let{basename:j,navigator:k,useTransitions:E}=b.useContext(Ra),R=typeof h=="string"&&oj.test(h),N=F_(h,j);h=N.to;let M=Ok(h,{relative:i}),A=ea(),O=null;if(f){let Q=oh(f,[],A.mask?A.mask.pathname:"/",!0);j!=="/"&&(Q.pathname=Q.pathname==="/"?j:La([j,Q.pathname])),O=k.createHref(Q)}let[L,U,P]=fN(r,w),B=jN(h,{replace:d,mask:f,state:p,target:m,preventScrollReset:x,relative:i,viewTransition:y,defaultShouldRevalidate:S,useTransitions:E});function D(Q){n&&n(Q),Q.defaultPrevented||B(Q)}let H=!(N.isExternal||c),Y=b.createElement("a",{...w,...P,href:(H?O:void 0)||N.absoluteURL||M,onClick:H?D:n,ref:xN(_,U),target:m,"data-discover":!R&&s==="render"?"true":void 0});return L&&!R?b.createElement(b.Fragment,null,Y,b.createElement(mN,{page:M})):Y});ph.displayName="Link";var lj=b.forwardRef(function({"aria-current":n="page",caseSensitive:s=!1,className:r="",end:i=!1,style:c,to:d,viewTransition:f,children:p,...m},h){let x=Wi(d,{relative:m.relative}),y=ea(),S=b.useContext(Ed),{navigator:w,basename:_}=b.useContext(Ra),j=S!=null&&kN(x)&&f===!0,k=w.encodeLocation?w.encodeLocation(x).pathname:x.pathname,E=y.pathname,R=S&&S.navigation&&S.navigation.location?S.navigation.location.pathname:null;s||(E=E.toLowerCase(),R=R?R.toLowerCase():null,k=k.toLowerCase()),R&&_&&(R=ks(R,_)||R);const N=k!=="/"&&k.endsWith("/")?k.length-1:k.length;let M=E===k||!i&&E.startsWith(k)&&E.charAt(N)==="/",A=R!=null&&(R===k||!i&&R.startsWith(k)&&R.charAt(k.length)==="/"),O={isActive:M,isPending:A,isTransitioning:j},L=M?n:void 0,U;typeof r=="function"?U=r(O):U=[r,M?"active":null,A?"pending":null,j?"transitioning":null].filter(Boolean).join(" ");let P=typeof c=="function"?c(O):c;return b.createElement(ph,{...m,"aria-current":L,className:U,ref:h,style:P,to:d,viewTransition:f},typeof p=="function"?p(O):p)});lj.displayName="NavLink";var yN=b.forwardRef(({discover:e="render",fetcherKey:n,navigate:s,reloadDocument:r,replace:i,state:c,method:d=Vu,action:f,onSubmit:p,relative:m,preventScrollReset:h,viewTransition:x,defaultShouldRevalidate:y,...S},w)=>{let{useTransitions:_}=b.useContext(Ra),j=CN(),k=EN(f,{relative:m}),E=d.toLowerCase()==="get"?"get":"post",R=typeof f=="string"&&oj.test(f),N=M=>{if(p&&p(M),M.defaultPrevented)return;M.preventDefault();let A=M.nativeEvent.submitter,O=A?.getAttribute("formmethod")||d,L=()=>j(A||M.currentTarget,{fetcherKey:n,method:O,navigate:s,replace:i,state:c,relative:m,preventScrollReset:h,viewTransition:x,defaultShouldRevalidate:y});_&&s!==!1?b.startTransition(()=>L()):L()};return b.createElement("form",{ref:w,method:E,action:k,onSubmit:r?p:N,...S,"data-discover":!R&&e==="render"?"true":void 0})});yN.displayName="Form";function _N(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ij(e){let n=b.useContext(ll);return Zt(n,_N(e)),n}function jN(e,{target:n,replace:s,mask:r,state:i,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:p,useTransitions:m}={}){let h=Ia(),x=ea(),y=Wi(e,{relative:d});return b.useCallback(S=>{if(Wk(S,n)){S.preventDefault();let w=s!==void 0?s:Pi(x)===Pi(y),_=()=>h(e,{replace:w,mask:r,state:i,preventScrollReset:c,relative:d,viewTransition:f,defaultShouldRevalidate:p});m?b.startTransition(()=>_()):_()}},[x,h,y,s,r,i,n,e,c,d,f,p,m])}function cj(e){Pa(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=b.useRef(Ng(e)),s=b.useRef(!1),r=ea(),i=b.useMemo(()=>eN(r.search,s.current?null:n.current),[r.search]),c=Ia(),d=b.useCallback((f,p)=>{const m=Ng(typeof f=="function"?f(new URLSearchParams(i)):f);s.current=!0,c("?"+m,p)},[c,i]);return[i,d]}var SN=0,wN=()=>`__${String(++SN)}__`;function CN(){let{router:e}=ij("useSubmit"),{basename:n}=b.useContext(Ra),s=$k(),r=e.fetch,i=e.navigate;return b.useCallback(async(c,d={})=>{let{action:f,method:p,encType:m,formData:h,body:x}=aN(c,n);if(d.navigate===!1){let y=d.fetcherKey||wN();await r(y,s,d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:x,formMethod:d.method||p,formEncType:d.encType||m,flushSync:d.flushSync})}else await i(d.action||f,{defaultShouldRevalidate:d.defaultShouldRevalidate,preventScrollReset:d.preventScrollReset,formData:h,body:x,formMethod:d.method||p,formEncType:d.encType||m,replace:d.replace,state:d.state,fromRouteId:s,flushSync:d.flushSync,viewTransition:d.viewTransition})},[r,i,n,s])}function EN(e,{relative:n}={}){let{basename:s}=b.useContext(Ra),r=b.useContext(Qa);Zt(r,"useFormAction must be used inside a RouteContext");let[i]=r.matches.slice(-1),c={...Wi(e||".",{relative:n})},d=ea();if(e==null){c.search=d.search;let f=new URLSearchParams(c.search),p=f.getAll("index");if(p.some(h=>h==="")){f.delete("index"),p.filter(x=>x).forEach(x=>f.append("index",x));let h=f.toString();c.search=h?`?${h}`:""}}return(!e||e===".")&&i.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),s!=="/"&&(c.pathname=c.pathname==="/"?s:La([s,c.pathname])),Pi(c)}function kN(e,{relative:n}={}){let s=b.useContext(Q_);Zt(s!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=ij("useViewTransitionState"),i=Wi(e,{relative:n});if(!s.isTransitioning)return!1;let c=ks(s.currentLocation.pathname,r)||s.currentLocation.pathname,d=ks(s.nextLocation.pathname,r)||s.nextLocation.pathname;return Wu(i.pathname,d)!=null||Wu(i.pathname,c)!=null}var Zr=U_();/**
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 NN=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),uj=(...e)=>e.filter((n,s,r)=>!!n&&n.trim()!==""&&r.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 RN={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 TN=b.forwardRef(({color:e="currentColor",size:n=24,strokeWidth:s=2,absoluteStrokeWidth:r,className:i="",children:c,iconNode:d,...f},p)=>b.createElement("svg",{ref:p,...RN,width:n,height:n,stroke:e,strokeWidth:r?Number(s)*24/Number(n):s,className:uj("lucide",i),...f},[...d.map(([m,h])=>b.createElement(m,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 we=(e,n)=>{const s=b.forwardRef(({className:r,...i},c)=>b.createElement(TN,{ref:c,iconNode:n,className:uj(`lucide-${NN(e)}`,r),...i}));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 dj=we("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 fj=we("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 AN=we("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 mj=we("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 pj=we("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 MN=we("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 vn=we("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"}]]);/**
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 ON=we("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"}]]);/**
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 zN=we("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"}]]);/**
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 td=we("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"}]]);/**
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 Bi=we("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
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 Jr=we("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
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 Nd=we("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
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 gj=we("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
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 hj=we("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
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 DN=we("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
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 LN=we("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"}]]);/**
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 PN=we("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
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 nd=we("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"}]]);/**
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 BN=we("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/**
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 IN=we("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
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 gh=we("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"}]]);/**
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 Ns=we("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"}]]);/**
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 xj=we("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"}]]);/**
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 bj=we("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"}]]);/**
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 UN=we("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"}]]);/**
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 ad=we("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"}]]);/**
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 HN=we("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"}]]);/**
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 qN=we("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"}]]);/**
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 VN=we("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"}]]);/**
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 $N=we("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"}]]);/**
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 GN=we("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"}]]);/**
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 YN=we("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"}]]);/**
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 vj=we("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"}]]);/**
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 FN=we("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"}]]);/**
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 XN=we("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"}]]);/**
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 Rd=we("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/**
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 KN=we("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"}]]);/**
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 hh=we("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"}]]);/**
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 QN=we("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"}]]);/**
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 ZN=we("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"}]]);/**
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 Xo=we("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"}]]);/**
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 JN=we("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"}]]);/**
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 WN=we("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"}]]);/**
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 eR=we("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
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 tR=we("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"}]]);/**
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 nR=we("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"}]]);/**
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 aR=we("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"}]]);/**
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 sR=we("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"}]]);/**
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 rR=we("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"}]]);/**
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 Td=we("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
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 oR=we("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"}]]);/**
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 lR=we("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"}]]);/**
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 Ri=we("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"}]]);/**
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 iR=we("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"}]]);/**
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 cR=we("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"}]]);/**
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 uR=we("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
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 dR=we("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"}]]);/**
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 fR=we("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"}]]);/**
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 mR=we("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
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 xh=we("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"}]]);/**
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 bh=we("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
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 pR=we("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"}]]);/**
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 Nn=we("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
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 Rg=we("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"}]]);/**
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 gR=we("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"}]]);/**
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 Wr=we("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"}]]);/**
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 yj=we("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"}]]);/**
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 vh=we("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"}]]);/**
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 Tg=we("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"}]]);/**
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 Gu=we("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
436
- * @license lucide-react v0.469.0 - ISC
437
- *
438
- * This source code is licensed under the ISC license.
439
- * See the LICENSE file in the root directory of this source tree.
440
- */const Za=we("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"}]]);/**
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 _j=we("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"}]]);/**
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 hR=we("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"}]]);/**
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 sd=we("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"}]]);/**
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 xR=we("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
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 il=we("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"}]]);/**
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 jj=we("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
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 bR=we("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"}]]);/**
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 Ii=we("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/**
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 Ja=we("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"}]]);/**
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 Sj=we("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"}]]);/**
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 vR=we("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"}]]);/**
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 wj=we("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"}]]);/**
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 yR=we("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"}]]);/**
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 cl=we("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"}]]);/**
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 ec=we("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
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 Ui=we("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"}]]),Ad={health:5e3,projects:15e3,telegramStatus:8e3,pairList:12e3},Cn={theme:"apx.theme",token:"apx.token",sidebarCollapsed:"apx.sidebar.collapsed",language:"apx.lang",robyChat:"apx.roby.chat"},yh=["total","automatico","permiso"],I0=["sky","violet","emerald","amber","rose","indigo","teal","fuchsia"],_R={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 jR(){if(typeof window>"u")return"dark";const e=localStorage.getItem(Cn.theme);return e==="light"||e==="dark"?e:document.documentElement.classList.contains("dark")?"dark":"light"}const Cj=b.createContext(null);function SR({children:e}){const[n,s]=b.useState(jR);b.useEffect(()=>{document.documentElement.classList.toggle("dark",n==="dark");try{localStorage.setItem(Cn.theme,n)}catch{}},[n]);const r=b.useCallback(()=>{s(c=>c==="dark"?"light":"dark")},[]),i=b.useMemo(()=>({theme:n,toggle:r,set:s}),[n,r]);return o.jsx(Cj.Provider,{value:i,children:e})}function _h(){const e=b.useContext(Cj);if(!e)throw new Error("useTheme must be used within ThemeProvider");return e}const wR=1367/458,CR=735/1016;function ER({size:e=32,title:n="APX",variant:s="icon"}){const{theme:r}=_h(),i=_R[s][r];if(s==="full"){const c=e,d=Math.round(e*wR);return o.jsx("img",{src:i,alt:n,width:d,height:c,className:"block object-contain",draggable:!1})}if(s==="vertical"){const c=e,d=Math.round(e/CR);return o.jsx("img",{src:i,alt:n,width:c,height:d,className:"block object-contain",draggable:!1})}return o.jsx("img",{src:i,alt:n,width:e,height:e,className:"block object-contain",draggable:!1})}function Ej(e){var n,s,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(n=0;n<i;n++)e[n]&&(s=Ej(e[n]))&&(r&&(r+=" "),r+=s)}else for(s in e)e[s]&&(r&&(r+=" "),r+=s);return r}function jh(){for(var e,n,s=0,r="",i=arguments.length;s<i;s++)(e=arguments[s])&&(n=Ej(e))&&(r&&(r+=" "),r+=n);return r}const Sh="-",kR=e=>{const n=RR(e),{conflictingClassGroups:s,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:d=>{const f=d.split(Sh);return f[0]===""&&f.length!==1&&f.shift(),kj(f,n)||NR(d)},getConflictingClassGroupIds:(d,f)=>{const p=s[d]||[];return f&&r[d]?[...p,...r[d]]:p}}},kj=(e,n)=>{if(e.length===0)return n.classGroupId;const s=e[0],r=n.nextPart.get(s),i=r?kj(e.slice(1),r):void 0;if(i)return i;if(n.validators.length===0)return;const c=e.join(Sh);return n.validators.find(({validator:d})=>d(c))?.classGroupId},U0=/^\[(.+)\]$/,NR=e=>{if(U0.test(e)){const n=U0.exec(e)[1],s=n?.substring(0,n.indexOf(":"));if(s)return"arbitrary.."+s}},RR=e=>{const{theme:n,prefix:s}=e,r={nextPart:new Map,validators:[]};return AR(Object.entries(e.classGroups),s).forEach(([c,d])=>{Ag(d,r,c,n)}),r},Ag=(e,n,s,r)=>{e.forEach(i=>{if(typeof i=="string"){const c=i===""?n:H0(n,i);c.classGroupId=s;return}if(typeof i=="function"){if(TR(i)){Ag(i(r),n,s,r);return}n.validators.push({validator:i,classGroupId:s});return}Object.entries(i).forEach(([c,d])=>{Ag(d,H0(n,c),s,r)})})},H0=(e,n)=>{let s=e;return n.split(Sh).forEach(r=>{s.nextPart.has(r)||s.nextPart.set(r,{nextPart:new Map,validators:[]}),s=s.nextPart.get(r)}),s},TR=e=>e.isThemeGetter,AR=(e,n)=>n?e.map(([s,r])=>{const i=r.map(c=>typeof c=="string"?n+c:typeof c=="object"?Object.fromEntries(Object.entries(c).map(([d,f])=>[n+d,f])):c);return[s,i]}):e,MR=e=>{if(e<1)return{get:()=>{},set:()=>{}};let n=0,s=new Map,r=new Map;const i=(c,d)=>{s.set(c,d),n++,n>e&&(n=0,r=s,s=new Map)};return{get(c){let d=s.get(c);if(d!==void 0)return d;if((d=r.get(c))!==void 0)return i(c,d),d},set(c,d){s.has(c)?s.set(c,d):i(c,d)}}},Nj="!",OR=e=>{const{separator:n,experimentalParseClassName:s}=e,r=n.length===1,i=n[0],c=n.length,d=f=>{const p=[];let m=0,h=0,x;for(let j=0;j<f.length;j++){let k=f[j];if(m===0){if(k===i&&(r||f.slice(j,j+c)===n)){p.push(f.slice(h,j)),h=j+c;continue}if(k==="/"){x=j;continue}}k==="["?m++:k==="]"&&m--}const y=p.length===0?f:f.substring(h),S=y.startsWith(Nj),w=S?y.substring(1):y,_=x&&x>h?x-h:void 0;return{modifiers:p,hasImportantModifier:S,baseClassName:w,maybePostfixModifierPosition:_}};return s?f=>s({className:f,parseClassName:d}):d},zR=e=>{if(e.length<=1)return e;const n=[];let s=[];return e.forEach(r=>{r[0]==="["?(n.push(...s.sort(),r),s=[]):s.push(r)}),n.push(...s.sort()),n},DR=e=>({cache:MR(e.cacheSize),parseClassName:OR(e),...kR(e)}),LR=/\s+/,PR=(e,n)=>{const{parseClassName:s,getClassGroupId:r,getConflictingClassGroupIds:i}=n,c=[],d=e.trim().split(LR);let f="";for(let p=d.length-1;p>=0;p-=1){const m=d[p],{modifiers:h,hasImportantModifier:x,baseClassName:y,maybePostfixModifierPosition:S}=s(m);let w=!!S,_=r(w?y.substring(0,S):y);if(!_){if(!w){f=m+(f.length>0?" "+f:f);continue}if(_=r(y),!_){f=m+(f.length>0?" "+f:f);continue}w=!1}const j=zR(h).join(":"),k=x?j+Nj:j,E=k+_;if(c.includes(E))continue;c.push(E);const R=i(_,w);for(let N=0;N<R.length;++N){const M=R[N];c.push(k+M)}f=m+(f.length>0?" "+f:f)}return f};function BR(){let e=0,n,s,r="";for(;e<arguments.length;)(n=arguments[e++])&&(s=Rj(n))&&(r&&(r+=" "),r+=s);return r}const Rj=e=>{if(typeof e=="string")return e;let n,s="";for(let r=0;r<e.length;r++)e[r]&&(n=Rj(e[r]))&&(s&&(s+=" "),s+=n);return s};function IR(e,...n){let s,r,i,c=d;function d(p){const m=n.reduce((h,x)=>x(h),e());return s=DR(m),r=s.cache.get,i=s.cache.set,c=f,f(p)}function f(p){const m=r(p);if(m)return m;const h=PR(p,s);return i(p,h),h}return function(){return c(BR.apply(null,arguments))}}const Yt=e=>{const n=s=>s[e]||[];return n.isThemeGetter=!0,n},Tj=/^\[(?:([a-z-]+):)?(.+)\]$/i,UR=/^\d+\/\d+$/,HR=new Set(["px","full","screen"]),qR=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,VR=/\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$/,$R=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,GR=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,YR=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,_s=e=>Go(e)||HR.has(e)||UR.test(e),nr=e=>ul(e,"length",eT),Go=e=>!!e&&!Number.isNaN(Number(e)),yp=e=>ul(e,"number",Go),ii=e=>!!e&&Number.isInteger(Number(e)),FR=e=>e.endsWith("%")&&Go(e.slice(0,-1)),rt=e=>Tj.test(e),ar=e=>qR.test(e),XR=new Set(["length","size","percentage"]),KR=e=>ul(e,XR,Aj),QR=e=>ul(e,"position",Aj),ZR=new Set(["image","url"]),JR=e=>ul(e,ZR,nT),WR=e=>ul(e,"",tT),ci=()=>!0,ul=(e,n,s)=>{const r=Tj.exec(e);return r?r[1]?typeof n=="string"?r[1]===n:n.has(r[1]):s(r[2]):!1},eT=e=>VR.test(e)&&!$R.test(e),Aj=()=>!1,tT=e=>GR.test(e),nT=e=>YR.test(e),aT=()=>{const e=Yt("colors"),n=Yt("spacing"),s=Yt("blur"),r=Yt("brightness"),i=Yt("borderColor"),c=Yt("borderRadius"),d=Yt("borderSpacing"),f=Yt("borderWidth"),p=Yt("contrast"),m=Yt("grayscale"),h=Yt("hueRotate"),x=Yt("invert"),y=Yt("gap"),S=Yt("gradientColorStops"),w=Yt("gradientColorStopPositions"),_=Yt("inset"),j=Yt("margin"),k=Yt("opacity"),E=Yt("padding"),R=Yt("saturate"),N=Yt("scale"),M=Yt("sepia"),A=Yt("skew"),O=Yt("space"),L=Yt("translate"),U=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],B=()=>["auto",rt,n],D=()=>[rt,n],H=()=>["",_s,nr],Y=()=>["auto",Go,rt],Q=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],X=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",rt],K=()=>["auto","avoid","all","avoid-page","page","left","right","column"],I=()=>[Go,rt];return{cacheSize:500,separator:":",theme:{colors:[ci],spacing:[_s,nr],blur:["none","",ar,rt],brightness:I(),borderColor:[e],borderRadius:["none","","full",ar,rt],borderSpacing:D(),borderWidth:H(),contrast:I(),grayscale:G(),hueRotate:I(),invert:G(),gap:D(),gradientColorStops:[e],gradientColorStopPositions:[FR,nr],inset:B(),margin:B(),opacity:I(),padding:D(),saturate:I(),scale:I(),sepia:G(),skew:I(),space:D(),translate:D()},classGroups:{aspect:[{aspect:["auto","square","video",rt]}],container:["container"],columns:[{columns:[ar]}],"break-after":[{"break-after":K()}],"break-before":[{"break-before":K()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Q(),rt]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:U()}],"overscroll-x":[{"overscroll-x":U()}],"overscroll-y":[{"overscroll-y":U()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[_]}],"inset-x":[{"inset-x":[_]}],"inset-y":[{"inset-y":[_]}],start:[{start:[_]}],end:[{end:[_]}],top:[{top:[_]}],right:[{right:[_]}],bottom:[{bottom:[_]}],left:[{left:[_]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ii,rt]}],basis:[{basis:B()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",rt]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",ii,rt]}],"grid-cols":[{"grid-cols":[ci]}],"col-start-end":[{col:["auto",{span:["full",ii,rt]},rt]}],"col-start":[{"col-start":Y()}],"col-end":[{"col-end":Y()}],"grid-rows":[{"grid-rows":[ci]}],"row-start-end":[{row:["auto",{span:[ii,rt]},rt]}],"row-start":[{"row-start":Y()}],"row-end":[{"row-end":Y()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",rt]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",rt]}],gap:[{gap:[y]}],"gap-x":[{"gap-x":[y]}],"gap-y":[{"gap-y":[y]}],"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:[j]}],mx:[{mx:[j]}],my:[{my:[j]}],ms:[{ms:[j]}],me:[{me:[j]}],mt:[{mt:[j]}],mr:[{mr:[j]}],mb:[{mb:[j]}],ml:[{ml:[j]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",rt,n]}],"min-w":[{"min-w":[rt,n,"min","max","fit"]}],"max-w":[{"max-w":[rt,n,"none","full","min","max","fit","prose",{screen:[ar]},ar]}],h:[{h:[rt,n,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[rt,n,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[rt,n,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[rt,n,"auto","min","max","fit"]}],"font-size":[{text:["base",ar,nr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",yp]}],"font-family":[{font:[ci]}],"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",rt]}],"line-clamp":[{"line-clamp":["none",Go,yp]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",_s,rt]}],"list-image":[{"list-image":["none",rt]}],"list-style-type":[{list:["none","disc","decimal",rt]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[k]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[k]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",_s,nr]}],"underline-offset":[{"underline-offset":["auto",_s,rt]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",rt]}],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",rt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[k]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Q(),QR]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",KR]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},JR]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[w]}],"gradient-via-pos":[{via:[w]}],"gradient-to-pos":[{to:[w]}],"gradient-from":[{from:[S]}],"gradient-via":[{via:[S]}],"gradient-to":[{to:[S]}],rounded:[{rounded:[c]}],"rounded-s":[{"rounded-s":[c]}],"rounded-e":[{"rounded-e":[c]}],"rounded-t":[{"rounded-t":[c]}],"rounded-r":[{"rounded-r":[c]}],"rounded-b":[{"rounded-b":[c]}],"rounded-l":[{"rounded-l":[c]}],"rounded-ss":[{"rounded-ss":[c]}],"rounded-se":[{"rounded-se":[c]}],"rounded-ee":[{"rounded-ee":[c]}],"rounded-es":[{"rounded-es":[c]}],"rounded-tl":[{"rounded-tl":[c]}],"rounded-tr":[{"rounded-tr":[c]}],"rounded-br":[{"rounded-br":[c]}],"rounded-bl":[{"rounded-bl":[c]}],"border-w":[{border:[f]}],"border-w-x":[{"border-x":[f]}],"border-w-y":[{"border-y":[f]}],"border-w-s":[{"border-s":[f]}],"border-w-e":[{"border-e":[f]}],"border-w-t":[{"border-t":[f]}],"border-w-r":[{"border-r":[f]}],"border-w-b":[{"border-b":[f]}],"border-w-l":[{"border-l":[f]}],"border-opacity":[{"border-opacity":[k]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[f]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[f]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[k]}],"divide-style":[{divide:q()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[_s,rt]}],"outline-w":[{outline:[_s,nr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:H()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[k]}],"ring-offset-w":[{"ring-offset":[_s,nr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ar,WR]}],"shadow-color":[{shadow:[ci]}],opacity:[{opacity:[k]}],"mix-blend":[{"mix-blend":[...X(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":X()}],filter:[{filter:["","none"]}],blur:[{blur:[s]}],brightness:[{brightness:[r]}],contrast:[{contrast:[p]}],"drop-shadow":[{"drop-shadow":["","none",ar,rt]}],grayscale:[{grayscale:[m]}],"hue-rotate":[{"hue-rotate":[h]}],invert:[{invert:[x]}],saturate:[{saturate:[R]}],sepia:[{sepia:[M]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[s]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[p]}],"backdrop-grayscale":[{"backdrop-grayscale":[m]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[h]}],"backdrop-invert":[{"backdrop-invert":[x]}],"backdrop-opacity":[{"backdrop-opacity":[k]}],"backdrop-saturate":[{"backdrop-saturate":[R]}],"backdrop-sepia":[{"backdrop-sepia":[M]}],"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",rt]}],duration:[{duration:I()}],ease:[{ease:["linear","in","out","in-out",rt]}],delay:[{delay:I()}],animate:[{animate:["none","spin","ping","pulse","bounce",rt]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[N]}],"scale-x":[{"scale-x":[N]}],"scale-y":[{"scale-y":[N]}],rotate:[{rotate:[ii,rt]}],"translate-x":[{"translate-x":[L]}],"translate-y":[{"translate-y":[L]}],"skew-x":[{"skew-x":[A]}],"skew-y":[{"skew-y":[A]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",rt]}],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",rt]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",rt]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[_s,nr,yp]}],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"]}}},Mj=IR(aT);function Ae(...e){return Mj(jh(e))}const q0={};function fa(e,n){const s=b.useRef(q0);return s.current===q0&&(s.current=e(n)),s}const Mg=[];let Og;function sT(){return Og}function rT(e){Mg.push(e)}function Oj(e){const n=(s,r)=>{const i=fa(lT).current;let c;try{Og=i;for(const d of Mg)d.before(i);c=e(s,r);for(const d of Mg)d.after(i);i.didInitialize=!0}finally{Og=void 0}return c};return n.displayName=e.displayName||e.name,n}function oT(e){return b.forwardRef(Oj(e))}function lT(){return{didInitialize:!1}}function wh(e){const n=b.useRef(!0);n.current&&(n.current=!1,e())}const iT=()=>{},Re=typeof document<"u"?b.useLayoutEffect:iT;function cT(e,n){return function(r,...i){const c=new URL(e);return c.searchParams.set("code",r.toString()),i.forEach(d=>c.searchParams.append("args[]",d)),`${n} error #${r}; visit ${c} for the full message.`}}const Rn=cT("https://base-ui.com/production-error","Base UI"),zj=b.createContext(void 0);function tc(e){const n=b.useContext(zj);if(n===void 0&&!e)throw new Error(Rn(72));return n}const uT=[];function Ch(e){b.useEffect(e,uT)}const ui=0;class Ba{static create(){return new Ba}currentId=ui;start(n,s){this.clear(),this.currentId=setTimeout(()=>{this.currentId=ui,s()},n)}isStarted(){return this.currentId!==ui}clear=()=>{this.currentId!==ui&&(clearTimeout(this.currentId),this.currentId=ui)};disposeEffect=()=>this.clear}function Zn(){const e=fa(Ba.create).current;return Ch(e.disposeEffect),e}const dl=typeof navigator<"u",_p=fT(),Dj=pT(),Lj=mT(),Eh=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Pj=_p.platform==="MacIntel"&&_p.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(_p.platform),Bj=dl&&/apple/i.test(navigator.vendor),zg=dl&&/android/i.test(Dj)||/android/i.test(Lj),dT=dl&&Dj.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,Ij=Lj.includes("jsdom/");function fT(){if(!dl)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 mT(){if(!dl)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:n,version:s})=>`${n}/${s}`).join(" "):navigator.userAgent}function pT(){if(!dl)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function ua(e){e.preventDefault(),e.stopPropagation()}function gT(e){return"nativeEvent"in e}function kh(e){return e.pointerType===""&&e.isTrusted?!0:zg&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Uj(e){return Ij?!1:!zg&&e.width===0&&e.height===0||zg&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Fr(e,n){const s=["mouse","pen"];return n||s.push("",void 0),s.includes(e)}function hT(e){const n=e.type;return n==="click"||n==="mousedown"||n==="keydown"||n==="keyup"}function Md(){return typeof window<"u"}function Pn(e){return Nh(e)?(e.nodeName||"").toLowerCase():"#document"}function Ft(e){var n;return(e==null||(n=e.ownerDocument)==null?void 0:n.defaultView)||window}function Wa(e){var n;return(n=(Nh(e)?e.ownerDocument:e.document)||window.document)==null?void 0:n.documentElement}function Nh(e){return Md()?e instanceof Node||e instanceof Ft(e).Node:!1}function lt(e){return Md()?e instanceof Element||e instanceof Ft(e).Element:!1}function Ut(e){return Md()?e instanceof HTMLElement||e instanceof Ft(e).HTMLElement:!1}function Ko(e){return!Md()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ft(e).ShadowRoot}function hr(e){const{overflow:n,overflowX:s,overflowY:r,display:i}=Wn(e);return/auto|scroll|overlay|hidden|clip/.test(n+r+s)&&i!=="inline"&&i!=="contents"}function xT(e){return/^(table|td|th)$/.test(Pn(e))}function Od(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const bT=/transform|translate|scale|rotate|perspective|filter/,vT=/paint|layout|strict|content/,Ir=e=>!!e&&e!=="none";let jp;function Rh(e){const n=lt(e)?Wn(e):e;return Ir(n.transform)||Ir(n.translate)||Ir(n.scale)||Ir(n.rotate)||Ir(n.perspective)||!zd()&&(Ir(n.backdropFilter)||Ir(n.filter))||bT.test(n.willChange||"")||vT.test(n.contain||"")}function yT(e){let n=Rs(e);for(;Ut(n)&&!Cs(n);){if(Rh(n))return n;if(Od(n))return null;n=Rs(n)}return null}function zd(){return jp==null&&(jp=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),jp}function Cs(e){return/^(html|body|#document)$/.test(Pn(e))}function Wn(e){return Ft(e).getComputedStyle(e)}function Dd(e){return lt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rs(e){if(Pn(e)==="html")return e;const n=e.assignedSlot||e.parentNode||Ko(e)&&e.host||Wa(e);return Ko(n)?n.host:n}function Hj(e){const n=Rs(e);return Cs(n)?e.ownerDocument?e.ownerDocument.body:e.body:Ut(n)&&hr(n)?n:Hj(n)}function Hi(e,n,s){var r;n===void 0&&(n=[]),s===void 0&&(s=!0);const i=Hj(e),c=i===((r=e.ownerDocument)==null?void 0:r.body),d=Ft(i);if(c){const f=Dg(d);return n.concat(d,d.visualViewport||[],hr(i)?i:[],f&&s?Hi(f):[])}else return n.concat(i,Hi(i,[],s))}function Dg(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const Lg="data-base-ui-focusable",qj="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",ur="ArrowLeft",dr="ArrowRight",Th="ArrowUp",nc="ArrowDown";function zn(e){let n=e.activeElement;for(;n?.shadowRoot?.activeElement!=null;)n=n.shadowRoot.activeElement;return n}function Ye(e,n){if(!e||!n)return!1;const s=n.getRootNode?.();if(e.contains(n))return!0;if(s&&Ko(s)){let r=n;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function En(e){return"composedPath"in e?e.composedPath()[0]:e.target}function rd(e,n){if(!lt(e))return!1;const s=e;if(n.hasElement(s))return!s.hasAttribute("data-trigger-disabled");for(const[,r]of n.entries())if(Ye(r,s))return!r.hasAttribute("data-trigger-disabled");return!1}function Sp(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 _T(e){return e.matches("html,body")}function Ld(e){return Ut(e)&&e.matches(qj)}function jT(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${qj}`)!=null}function Pg(e){return e?e.getAttribute("role")==="combobox"&&Ld(e):!1}function ST(e){if(!e||Ij)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function od(e){return e?e.hasAttribute(Lg)?e:e.querySelector(`[${Lg}]`)||e:null}function wT(e,n){return n!=null&&!Fr(n)?0:typeof e=="function"?e():e}function ld(e,n,s){const r=wT(e,s);return typeof r=="number"?r:r?.[n]}function V0(e){return typeof e=="function"?e():e}function Vj(e,n){return n||e==="click"||e==="mousedown"}function CT(e){return e?.includes("mouse")&&e!=="mousedown"}function Dn(){}const qi=Object.freeze([]),an=Object.freeze({}),Ts="none",Vi="trigger-press",In="trigger-hover",Yu="trigger-focus",Ah="outside-press",wp="item-press",ET="close-press",Pd="focus-out",Mh="escape-key",$0="list-navigation",kT="cancel-open",$j="disabled",G0="missing",Y0="initial",Gj="imperative-action",NT="window-resize";function tt(e,n,s,r){let i=!1,c=!1;const d=r??an;return{reason:e,event:n??new Event("base-ui"),cancel(){i=!0},allowPropagation(){c=!0},get isCanceled(){return i},get isPropagationAllowed(){return c},trigger:s,...d}}const Yj=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ba,currentIdRef:{current:null},currentContextRef:{current:null}});function RT(e){const{children:n,delay:s,timeoutMs:r=0}=e,i=b.useRef(s),c=b.useRef(s),d=b.useRef(null),f=b.useRef(null),p=Zn();return o.jsx(Yj.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:c,currentIdRef:d,timeoutMs:r,currentContextRef:f,timeout:p}),[r,p]),children:n})}function TT(e,n={open:!1}){const{open:s}=n,r="rootStore"in e?e.rootStore:e,i=r.useState("floatingId"),c=b.useContext(Yj),{currentIdRef:d,delayRef:f,timeoutMs:p,initialDelayRef:m,currentContextRef:h,hasProvider:x,timeout:y}=c,[S,w]=b.useState(!1);return Re(()=>{function _(){w(!1),h.current?.setIsInstantPhase(!1),d.current=null,h.current=null,f.current=m.current}if(d.current&&!s&&d.current===i){if(w(!1),p){const j=i;return y.start(p,()=>{r.select("open")||d.current&&d.current!==j||_()}),()=>{y.clear()}}_()}},[s,i,d,f,p,m,h,y,r]),Re(()=>{if(!s)return;const _=h.current,j=d.current;y.clear(),h.current={onOpenChange:r.setOpen,setIsInstantPhase:w},d.current=i,f.current={open:0,close:ld(m.current,"close")},j!==null&&j!==i?(w(!0),_?.setIsInstantPhase(!0),_?.onOpenChange(!1,tt(Ts))):(w(!1),_?.setIsInstantPhase(!1))},[s,i,r,d,f,m,h,y]),Re(()=>()=>{h.current=null},[h]),b.useMemo(()=>({hasProvider:x,delayRef:f,isInstantPhase:S}),[x,f,S])}function ct(e,n,s,r){return e.addEventListener(n,s,r),()=>{e.removeEventListener(n,s,r)}}function Xa(...e){return()=>{for(let n=0;n<e.length;n+=1){const s=e[n];s&&s()}}}function As(e,n,s,r){const i=fa(Fj).current;return MT(i,e,n,s,r)&&Xj(i,[e,n,s,r]),i.callback}function AT(e){const n=fa(Fj).current;return OT(n,e)&&Xj(n,e),n.callback}function Fj(){return{callback:null,cleanup:null,refs:[]}}function MT(e,n,s,r,i){return e.refs[0]!==n||e.refs[1]!==s||e.refs[2]!==r||e.refs[3]!==i}function OT(e,n){return e.refs.length!==n.length||e.refs.some((s,r)=>s!==n[r])}function Xj(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 r=Array(n.length).fill(null);for(let i=0;i<n.length;i+=1){const c=n[i];if(c!=null)switch(typeof c){case"function":{const d=c(s);typeof d=="function"&&(r[i]=d);break}case"object":{c.current=s;break}}}e.cleanup=()=>{for(let i=0;i<n.length;i+=1){const c=n[i];if(c!=null)switch(typeof c){case"function":{const d=r[i];typeof d=="function"?d():c(null);break}case"object":{c.current=null;break}}}}}}}function cn(e){const n=fa(zT,e).current;return n.next=e,Re(n.effect),n}function zT(e){const n={current:e,next:e,effect:()=>{n.current=n.next}};return n}const Oh={...$E},Cp=Oh.useInsertionEffect,DT=Cp&&Cp!==Oh.useLayoutEffect?Cp:e=>e();function Me(e){const n=fa(LT).current;return n.next=e,DT(n.effect),n.trampoline}function LT(){const e={next:void 0,callback:PT,trampoline:(...n)=>e.callback?.(...n),effect:()=>{e.callback=e.next}};return e}function PT(){}const ju=null;class BT{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=n=>{this.isScheduled=!1;const s=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let i=0;i<s.length;i+=1)s[i]?.(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 Su=new BT;class Ga{static create(){return new Ga}static request(n){return Su.request(n)}static cancel(n){return Su.cancel(n)}currentId=ju;request(n){this.cancel(),this.currentId=Su.request(()=>{this.currentId=ju,n()})}cancel=()=>{this.currentId!==ju&&(Su.cancel(this.currentId),this.currentId=ju)};disposeEffect=()=>this.cancel}function Qo(){const e=fa(Ga.create).current;return Ch(e.disposeEffect),e}function xt(e){return e?.ownerDocument||document}const Kj={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},zh={...Kj,position:"fixed",top:0,left:0},Qj={...Kj,position:"absolute"},id=b.forwardRef(function(n,s){const[r,i]=b.useState();Re(()=>{Bj&&i("button")},[]);const c={tabIndex:0,role:r};return o.jsx("span",{...n,ref:s,style:zh,"aria-hidden":r?void 0:!0,...c,"data-base-ui-focus-guard":""})}),IT=["top","right","bottom","left"],Zo=Math.min,da=Math.max,cd=Math.round,qr=Math.floor,Ka=e=>({x:e,y:e}),UT={left:"right",right:"left",bottom:"top",top:"bottom"};function Bg(e,n,s){return da(e,Zo(n,s))}function Ms(e,n){return typeof e=="function"?e(n):e}function Jn(e){return e.split("-")[0]}function xr(e){return e.split("-")[1]}function Dh(e){return e==="x"?"y":"x"}function Lh(e){return e==="y"?"height":"width"}function Ea(e){const n=e[0];return n==="t"||n==="b"?"y":"x"}function Ph(e){return Dh(Ea(e))}function HT(e,n,s){s===void 0&&(s=!1);const r=xr(e),i=Ph(e),c=Lh(i);let d=i==="x"?r===(s?"end":"start")?"right":"left":r==="start"?"bottom":"top";return n.reference[c]>n.floating[c]&&(d=ud(d)),[d,ud(d)]}function qT(e){const n=ud(e);return[Ig(e),n,Ig(n)]}function Ig(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const F0=["left","right"],X0=["right","left"],VT=["top","bottom"],$T=["bottom","top"];function GT(e,n,s){switch(e){case"top":case"bottom":return s?n?X0:F0:n?F0:X0;case"left":case"right":return n?VT:$T;default:return[]}}function YT(e,n,s,r){const i=xr(e);let c=GT(Jn(e),s==="start",r);return i&&(c=c.map(d=>d+"-"+i),n&&(c=c.concat(c.map(Ig)))),c}function ud(e){const n=Jn(e);return UT[n]+e.slice(n.length)}function FT(e){return{top:0,right:0,bottom:0,left:0,...e}}function Zj(e){return typeof e!="number"?FT(e):{top:e,right:e,bottom:e,left:e}}function $i(e){const{x:n,y:s,width:r,height:i}=e;return{width:r,height:i,top:s,left:n,right:n+r,bottom:s+i,x:n,y:s}}function wu(e,n,s){return Math.floor(e/n)!==s}function Gi(e,n){return n<0||n>=e.length}function Fu(e,n){return On(e.current,{disabledIndices:n})}function Ug(e,n){return On(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:n})}function On(e,{startingIndex:n=-1,decrement:s=!1,disabledIndices:r,amount:i=1}={}){let c=n;do c+=s?-i:i;while(c>=0&&c<=e.length-1&&Es(e,c,r));return c}function Jj(e,{event:n,orientation:s,loopFocus:r,onLoop:i,rtl:c,cols:d,disabledIndices:f,minIndex:p,maxIndex:m,prevIndex:h,stopEvent:x=!1}){let y=h,S;if(n.key===Th?S="up":n.key===nc&&(S="down"),S){const w=[],_=[];let j=!1,k=0;{let U=null,P=-1;e.forEach((B,D)=>{if(B==null)return;k+=1;const H=B.closest('[role="row"]');H&&(j=!0),(H!==U||P===-1)&&(U=H,P+=1,w[P]=[]),w[P].push(D),_[D]=P})}let E=!1,R=0;if(j)for(const U of w){const P=U.length;P>R&&(R=P),P!==d&&(E=!0)}const N=E&&k<e.length,M=R||d,A=U=>{if(!E||h===-1)return;const P=_[h];if(P==null)return;const B=w[P].indexOf(h),D=U==="up"?-1:1;for(let H=P+D,Y=0;Y<w.length;Y+=1,H+=D){if(H<0||H>=w.length){if(!r||N)return;if(H=H<0?w.length-1:0,i){const q=Math.min(B,w[H].length-1),X=w[H][q]??w[H][0],Z=i(n,h,X);H=_[Z]??H}}const Q=w[H];for(let q=Math.min(B,Q.length-1);q>=0;q-=1){const X=Q[q];if(!Es(e,X,f))return X}}},O=U=>{if(!N||h===-1)return;const P=h%M,B=U==="up"?-M:M,D=m-m%M,H=qr(m/M)+1;for(let Y=h-P+B,Q=0;Q<H;Q+=1,Y+=B){if(Y<0||Y>m){if(!r)return;Y=Y<0?D:0}const q=Math.min(Y+M-1,m);for(let X=Math.min(Y+P,q);X>=Y;X-=1)if(!Es(e,X,f))return X}};x&&ua(n);const L=A(S)??O(S);if(L!==void 0)y=L;else if(h===-1)y=S==="up"?m:p;else if(y=On(e,{startingIndex:h,amount:M,decrement:S==="up",disabledIndices:f}),r){if(S==="up"&&(h-M<p||y<0)){const U=h%M,P=m%M,B=m-(P-U);P===U?y=m:y=P>U?B:B-M,i&&(y=i(n,h,y))}S==="down"&&h+M>m&&(y=On(e,{startingIndex:h%M-M,amount:M,disabledIndices:f}),i&&(y=i(n,h,y)))}Gi(e,y)&&(y=h)}if(s==="both"){const w=qr(h/d);n.key===(c?ur:dr)&&(x&&ua(n),h%d!==d-1?(y=On(e,{startingIndex:h,disabledIndices:f}),r&&wu(y,d,w)&&(y=On(e,{startingIndex:h-h%d-1,disabledIndices:f}),i&&(y=i(n,h,y)))):r&&(y=On(e,{startingIndex:h-h%d-1,disabledIndices:f}),i&&(y=i(n,h,y))),wu(y,d,w)&&(y=h)),n.key===(c?dr:ur)&&(x&&ua(n),h%d!==0?(y=On(e,{startingIndex:h,decrement:!0,disabledIndices:f}),r&&wu(y,d,w)&&(y=On(e,{startingIndex:h+(d-h%d),decrement:!0,disabledIndices:f}),i&&(y=i(n,h,y)))):r&&(y=On(e,{startingIndex:h+(d-h%d),decrement:!0,disabledIndices:f}),i&&(y=i(n,h,y))),wu(y,d,w)&&(y=h));const _=qr(m/d)===w;Gi(e,y)&&(r&&_?(y=n.key===(c?dr:ur)?m:On(e,{startingIndex:h-h%d-1,disabledIndices:f}),i&&(y=i(n,h,y))):y=h)}return y}function Wj(e,n,s){const r=[];let i=0;return e.forEach(({width:c,height:d},f)=>{let p=!1;for(s&&(i=0);!p;){const m=[];for(let h=0;h<c;h+=1)for(let x=0;x<d;x+=1)m.push(i+h+x*n);i%n+c<=n&&m.every(h=>r[h]==null)?(m.forEach(h=>{r[h]=f}),p=!0):i+=1}}),[...r]}function eS(e,n,s,r,i){if(e===-1)return-1;const c=s.indexOf(e),d=n[e];switch(i){case"tl":return c;case"tr":return d?c+d.width-1:c;case"bl":return d?c+(d.height-1)*r:c;case"br":return s.lastIndexOf(e);default:return-1}}function tS(e,n){return n.flatMap((s,r)=>e.includes(s)?[r]:[])}function Es(e,n,s){if(typeof s=="function"?s(n):s?.includes(n)??!1)return!0;const i=e[n];return i?Bd(i)?!s&&(i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"):!0:!1}function XT(e){return e.visibility==="hidden"||e.visibility==="collapse"}function Bd(e,n=e?Wn(e):null){return!e||!e.isConnected||!n||XT(n)?!1:typeof e.checkVisibility=="function"?e.checkVisibility():n.display!=="none"&&n.display!=="contents"}const KT='a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]';function QT(e){const n=e.assignedSlot;if(n)return n;if(e.parentElement)return e.parentElement;const s=e.getRootNode();return Ko(s)?s.host:null}function Hg(e){for(const n of Array.from(e.children))if(Pn(n)==="summary")return n;return null}function ZT(e,n){const s=Hg(n);return!!s&&(e===s||Ye(s,e))}function nS(e){const n=e?Pn(e):"";return e!=null&&e.matches(KT)&&(n!=="summary"||e.parentElement!=null&&Pn(e.parentElement)==="details"&&Hg(e.parentElement)===e)&&(n!=="details"||Hg(e)==null)&&(n!=="input"||e.type!=="hidden")}function aS(e){if(!nS(e)||!e.isConnected||e.matches(":disabled"))return!1;for(let n=e;n;n=QT(n)){const s=n!==e,r=Pn(n)==="slot";if(n.hasAttribute("inert")||s&&Pn(n)==="details"&&!n.open&&!ZT(e,n)||n.hasAttribute("hidden")||!r&&!JT(n,s))return!1}return!0}function JT(e,n){const s=Wn(e);return n?s.display!=="none":Bd(e,s)}function sS(e){const n=e.tabIndex;if(n<0){const s=Pn(e);if(s==="details"||s==="audio"||s==="video"||Ut(e)&&e.isContentEditable)return 0}return n}function Ep(e){if(Pn(e)!=="input")return null;const n=e;return n.type==="radio"&&n.name!==""?n:null}function WT(e,n){const s=Ep(e);if(!s)return!0;const r=n.find(i=>{const c=Ep(i);return c?.name===s.name&&c.form===s.form&&c.checked});return r?r===s:n.find(i=>{const c=Ep(i);return c?.name===s.name&&c.form===s.form})===s}function rS(e){if(Ut(e)&&Pn(e)==="slot"){const n=e.assignedElements({flatten:!0});if(n.length>0)return n}return Ut(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function oS(e,n){rS(e).forEach(s=>{nS(s)&&n.push(s),oS(s,n)})}function lS(e,n,s){rS(e).forEach(r=>{Ut(r)&&r.matches(n)&&s.push(r),lS(r,n,s)})}function Bh(e){return aS(e)&&sS(e)>=0}function iS(e){const n=[];return oS(e,n),n.filter(aS)}function Id(e){const n=iS(e);return n.filter(s=>sS(s)>=0&&WT(s,n))}function cS(e,n){const s=Id(e),r=s.length;if(r===0)return;const i=zn(xt(e)),c=s.indexOf(i),d=c===-1?n===1?0:r-1:c+n;return s[d]}function uS(e){return cS(xt(e).body,1)||e}function dS(e){return cS(xt(e).body,-1)||e}function Ti(e,n){const s=n||e.currentTarget,r=e.relatedTarget;return!r||!Ye(s,r)}function eA(e){Id(e).forEach(s=>{s.dataset.tabindex=s.getAttribute("tabindex")||"",s.setAttribute("tabindex","-1")})}function K0(e){const n=[];lS(e,"[data-tabindex]",n),n.forEach(s=>{const r=s.dataset.tabindex;delete s.dataset.tabindex,r?s.setAttribute("tabindex",r):s.removeAttribute("tabindex")})}function mr(e,n,s=!0){return e.filter(i=>i.parentId===n).flatMap(i=>[...!s||i.context?.open?[i]:[],...mr(e,i.id,s)])}function Q0(e,n){let s=[],r=e.find(i=>i.id===n)?.parentId;for(;r;){const i=e.find(c=>c.id===r);r=i?.parentId,i&&(s=s.concat(i))}return s}function Yi(e){return`data-base-ui-${e}`}let Cu=0;function Xu(e,n={}){const{preventScroll:s=!1,sync:r=!1,shouldFocus:i}=n;cancelAnimationFrame(Cu);function c(){i&&!i()||e?.focus({preventScroll:s})}if(r)return c(),Dn;const d=requestAnimationFrame(c);return Cu=d,()=>{Cu===d&&(cancelAnimationFrame(d),Cu=0)}}const kp={inert:new WeakMap,"aria-hidden":new WeakMap},Z0="data-base-ui-inert",qg={inert:new WeakSet,"aria-hidden":new WeakSet};let di=new WeakMap,Np=0;function tA(e){return qg[e]}function fS(e){return e?Ko(e)?e.host:fS(e.parentNode):null}const Rp=(e,n)=>n.map(s=>{if(e.contains(s))return s;const r=fS(s);return e.contains(r)?r:null}).filter(s=>s!=null),J0=e=>{const n=new Set;return e.forEach(s=>{let r=s;for(;r&&!n.has(r);)n.add(r),r=r.parentNode}),n},W0=(e,n,s)=>{const r=[],i=c=>{!c||s.has(c)||Array.from(c.children).forEach(d=>{Pn(d)!=="script"&&(n.has(d)?i(d):r.push(d))})};return i(e),r};function nA(e,n,s,r,{mark:i=!0,markerIgnoreElements:c=[]}){const d=r?"inert":s?"aria-hidden":null;let f=null,p=null;const m=Rp(n,e),h=i?Rp(n,c):[],x=new Set(h),y=i?W0(n,J0(m),new Set(m)).filter(_=>!x.has(_)):[],S=[],w=[];if(d){const _=kp[d],j=tA(d);p=j,f=_;const k=Rp(n,Array.from(n.querySelectorAll("[aria-live]"))),E=m.concat(k);W0(n,J0(E),new Set(E)).forEach(N=>{const M=N.getAttribute(d),A=M!==null&&M!=="false",O=(_.get(N)||0)+1;_.set(N,O),S.push(N),O===1&&A&&j.add(N),A||N.setAttribute(d,d==="inert"?"":"true")})}return i&&y.forEach(_=>{const j=(di.get(_)||0)+1;di.set(_,j),w.push(_),j===1&&_.setAttribute(Z0,"")}),Np+=1,()=>{f&&S.forEach(_=>{const k=(f.get(_)||0)-1;f.set(_,k),k||(!p?.has(_)&&d&&_.removeAttribute(d),p?.delete(_))}),i&&w.forEach(_=>{const j=(di.get(_)||0)-1;di.set(_,j),j||_.removeAttribute(Z0)}),Np-=1,Np||(kp.inert=new WeakMap,kp["aria-hidden"]=new WeakMap,qg.inert=new WeakSet,qg["aria-hidden"]=new WeakSet,di=new WeakMap)}}function e1(e,n={}){const{ariaHidden:s=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:c=[]}=n,d=xt(e[0]).body;return nA(e,d,s,r,{mark:i,markerIgnoreElements:c})}let t1=0;function aA(e,n="mui"){const[s,r]=b.useState(e),i=e||s;return b.useEffect(()=>{s==null&&(t1+=1,r(`${n}-${t1}`))},[s,n]),i}const n1=Oh.useId;function Ud(e,n){if(n1!==void 0){const s=n1();return e??(n?`${n}-${s}`:s)}return aA(e,n)}const sA=parseInt(b.version,10);function Ih(e){return sA>=e}function a1(e){if(!b.isValidElement(e))return null;const n=e,s=n.props;return(Ih(19)?s?.ref:n.ref)??null}function Vg(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function rA(e,n){const s={};for(const r in e){const i=e[r];if(n?.hasOwnProperty(r)){const c=n[r](i);c!=null&&Object.assign(s,c);continue}i===!0?s[`data-${r.toLowerCase()}`]="":i&&(s[`data-${r.toLowerCase()}`]=i.toString())}return s}function oA(e,n){return typeof e=="function"?e(n):e}function lA(e,n){return typeof e=="function"?e(n):e}const Uh={};function Na(e,n,s,r,i){if(!s&&!r&&!i&&!e)return dd(n);let c=dd(e);return n&&(c=Si(c,n)),s&&(c=Si(c,s)),r&&(c=Si(c,r)),i&&(c=Si(c,i)),c}function iA(e){if(e.length===0)return Uh;if(e.length===1)return dd(e[0]);let n=dd(e[0]);for(let s=1;s<e.length;s+=1)n=Si(n,e[s]);return n}function dd(e){return Hh(e)?{...pS(e,Uh)}:cA(e)}function Si(e,n){return Hh(n)?pS(n,e):uA(e,n)}function cA(e){const n={...e};for(const s in n){const r=n[s];mS(s,r)&&(n[s]=gS(r))}return n}function uA(e,n){if(!n)return e;for(const s in n){const r=n[s];switch(s){case"style":{e[s]=Vg(e.style,r);break}case"className":{e[s]=hS(e.className,r);break}default:mS(s,r)?e[s]=dA(e[s],r):e[s]=r}}return e}function mS(e,n){const s=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return s===111&&r===110&&i>=65&&i<=90&&(typeof n=="function"||typeof n>"u")}function Hh(e){return typeof e=="function"}function pS(e,n){return Hh(e)?e(n):e??Uh}function dA(e,n){return n?e?(...s)=>{const r=s[0];if(xS(r)){const c=r;fd(c);const d=n(...s);return c.baseUIHandlerPrevented||e?.(...s),d}const i=n(...s);return e?.(...s),i}:gS(n):e}function gS(e){return e&&((...n)=>{const s=n[0];return xS(s)&&fd(s),e(...n)})}function fd(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function hS(e,n){return n?e?n+" "+e:n:e}function xS(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Lt(e,n,s={}){const r=n.render,i=fA(n,s);if(s.enabled===!1)return null;const c=s.state??an;return gA(e,r,i,c)}function fA(e,n={}){const{className:s,style:r,render:i}=e,{state:c=an,ref:d,props:f,stateAttributesMapping:p,enabled:m=!0}=n,h=m?oA(s,c):void 0,x=m?lA(r,c):void 0,y=m?rA(c,p):an,S=m&&f?mA(f):void 0,w=m?Vg(y,S)??{}:an;return typeof document<"u"&&(m?Array.isArray(d)?w.ref=AT([w.ref,a1(i),...d]):w.ref=As(w.ref,a1(i),d):As(null,null)),m?(h!==void 0&&(w.className=hS(w.className,h)),x!==void 0&&(w.style=Vg(w.style,x)),w):an}function mA(e){return Array.isArray(e)?iA(e):Na(void 0,e)}const pA=Symbol.for("react.lazy");function gA(e,n,s,r){if(n){if(typeof n=="function")return n(s,r);const i=Na(s,n.props);i.ref=s.ref;let c=n;return c?.$$typeof===pA&&(c=b.Children.toArray(n)[0]),b.cloneElement(c,i)}if(e&&typeof e=="string")return hA(e,s);throw new Error(Rn(8))}function hA(e,n){return e==="button"?b.createElement("button",{type:"button",...n,key:n.key}):e==="img"?b.createElement("img",{alt:"",...n,key:n.key}):b.createElement(e,n)}const xA={style:{transition:"none"}},bA="data-base-ui-click-trigger",vA={fallbackAxisSide:"none"},yA={fallbackAxisSide:"end"},_A={clipPath:"inset(50%)",position:"fixed",top:0,left:0},bS=b.createContext(null),vS=()=>b.useContext(bS),jA=Yi("portal");function yS(e={}){const{ref:n,container:s,componentProps:r=an,elementProps:i}=e,c=Ud(),f=vS()?.portalNode,[p,m]=b.useState(null),[h,x]=b.useState(null),y=Me(j=>{j!==null&&x(j)}),S=b.useRef(null);Re(()=>{if(s===null){S.current&&(S.current=null,x(null),m(null));return}if(c==null)return;const j=(s&&(Nh(s)?s:s.current))??f??document.body;if(j==null){S.current&&(S.current=null,x(null),m(null));return}S.current!==j&&(S.current=j,x(null),m(j))},[s,f,c]);const w=Lt("div",r,{ref:[n,y],props:[{id:c,[jA]:""},i]});return{portalNode:h,portalSubtree:p&&w?Zr.createPortal(w,p):null}}const _S=b.forwardRef(function(n,s){const{render:r,className:i,style:c,children:d,container:f,renderGuards:p,...m}=n,{portalNode:h,portalSubtree:x}=yS({container:f,ref:s,componentProps:n,elementProps:m}),y=b.useRef(null),S=b.useRef(null),w=b.useRef(null),_=b.useRef(null),[j,k]=b.useState(null),E=b.useRef(!1),R=j?.modal,N=j?.open,M=typeof p=="boolean"?p:!!j&&!j.modal&&j.open&&!!h;b.useEffect(()=>{if(!h||R)return;function O(L){h&&L.relatedTarget&&Ti(L)&&(L.type==="focusin"?E.current&&(K0(h),E.current=!1):(eA(h),E.current=!0))}return Xa(ct(h,"focusin",O,!0),ct(h,"focusout",O,!0))},[h,R]),b.useEffect(()=>{!h||N!==!1||(K0(h),E.current=!1)},[N,h]);const A=b.useMemo(()=>({beforeOutsideRef:y,afterOutsideRef:S,beforeInsideRef:w,afterInsideRef:_,portalNode:h,setFocusManagerState:k}),[h]);return o.jsxs(b.Fragment,{children:[x,o.jsxs(bS.Provider,{value:A,children:[M&&h&&o.jsx(id,{"data-type":"outside",ref:y,onFocus:O=>{if(Ti(O,h))w.current?.focus();else{const L=j?j.domReference:null;dS(L)?.focus()}}}),M&&h&&o.jsx("span",{"aria-owns":h.id,style:_A}),h&&Zr.createPortal(d,h),M&&h&&o.jsx(id,{"data-type":"outside",ref:S,onFocus:O=>{if(Ti(O,h))_.current?.focus();else{const L=j?j.domReference:null;uS(L)?.focus(),j?.closeOnFocusOut&&j?.onOpenChange(!1,tt(Pd,O.nativeEvent))}}})]})]})});function SA(){const e=new Map;return{emit(n,s){e.get(n)?.forEach(r=>r(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 wA=b.createContext(null),CA=b.createContext(null),Hd=()=>b.useContext(wA)?.id||null,fl=e=>{const n=b.useContext(CA);return e??n};function js(e){return e==null?e:"current"in e?e.current:e}function EA(e,n){const s=Ft(En(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 s1=20;let ir=[];function qh(){ir=ir.filter(e=>e.deref()?.isConnected)}function kA(e){qh(),e&&Pn(e)!=="body"&&(ir.push(new WeakRef(e)),ir.length>s1&&(ir=ir.slice(-s1)))}function Tp(){return qh(),ir[ir.length-1]?.deref()}function NA(e){return e?Bh(e)?e:Id(e)[0]||e:null}function r1(e,n){if(e.hasAttribute("tabindex")&&!e.hasAttribute("data-tabindex")||!n.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=iS(e).filter(c=>{const d=c.getAttribute("data-tabindex")||"";return Bh(c)||c.hasAttribute("data-tabindex")&&!d.startsWith("-")}),i=e.getAttribute("tabindex");n.current.includes("floating")||r.length===0?i!=="0"&&e.setAttribute("tabindex","0"):(i!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function jS(e){const{context:n,children:s,disabled:r=!1,initialFocus:i=!0,returnFocus:c=!0,restoreFocus:d=!1,modal:f=!0,closeOnFocusOut:p=!0,openInteractionType:m="",nextFocusableElement:h,previousFocusableElement:x,beforeContentFocusGuardRef:y,externalTree:S,getInsideElements:w}=e,_="rootStore"in n?n.rootStore:n,j=_.useState("open"),k=_.useState("domReferenceElement"),E=_.useState("floatingElement"),{events:R,dataRef:N}=_.context,M=Me(()=>N.current.floatingContext?.nodeId),A=i===!1,O=Pg(k)&&A,L=b.useRef(["content"]),U=cn(i),P=cn(c),B=cn(m),D=fl(S),H=vS(),Y=b.useRef(!1),Q=b.useRef(!1),q=b.useRef(!1),X=b.useRef(null),Z=b.useRef(""),G=b.useRef(""),K=b.useRef(null),I=b.useRef(null),V=As(K,y,H?.beforeInsideRef),$=As(I,H?.afterInsideRef),W=Zn(),oe=Zn(),ce=Qo(),se=H!=null,ie=od(E),te=Me((be=ie)=>be?Id(be):[]),ke=Me(()=>w?.().filter(be=>be!=null)??[]);b.useEffect(()=>{if(r||!f)return;function be(Ee){Ee.key==="Tab"&&Ye(ie,zn(xt(ie)))&&te().length===0&&!O&&ua(Ee)}const Se=xt(ie);return ct(Se,"keydown",be)},[r,ie,f,O,te]),b.useEffect(()=>{if(r||!j)return;const be=xt(ie);function Se(){q.current=!1}function Ee(De){const xe=En(De),Ne=ke(),_e=Ye(E,xe)||Ye(k,xe)||Ye(H?.portalNode,xe)||Ne.some(Le=>Le===xe||Ye(Le,xe));q.current=!_e,G.current=De.pointerType||"keyboard",xe?.closest(`[${bA}]`)&&(Q.current=!0)}function ze(){G.current="keyboard"}return Xa(ct(be,"pointerdown",Ee,!0),ct(be,"pointerup",Se,!0),ct(be,"pointercancel",Se,!0),ct(be,"keydown",ze,!0))},[r,E,k,ie,j,H,ke]),b.useEffect(()=>{if(r||!p)return;const be=xt(ie);function Se(){Q.current=!0,oe.start(0,()=>{Q.current=!1})}function Ee(Ne){const _e=En(Ne);Bh(_e)&&(X.current=_e)}function ze(Ne){const _e=Ne.relatedTarget,Le=Ne.currentTarget,Ge=En(Ne);queueMicrotask(()=>{const qe=M(),Oe=_.context.triggerElements,ve=ke(),le=_e?.hasAttribute(Yi("focus-guard"))&&[K.current,I.current,H?.beforeInsideRef.current,H?.afterInsideRef.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,js(x),js(h)].includes(_e),ye=!(Ye(k,_e)||Ye(E,_e)||Ye(_e,E)||Ye(H?.portalNode,_e)||ve.some(je=>je===_e||Ye(je,_e))||_e!=null&&Oe.hasElement(_e)||Oe.hasMatchingElement(je=>Ye(je,_e))||le||D&&(mr(D.nodesRef.current,qe).find(je=>Ye(je.context?.elements.floating,_e)||Ye(je.context?.elements.domReference,_e))||Q0(D.nodesRef.current,qe).find(je=>[je.context?.elements.floating,od(je.context?.elements.floating)].includes(_e)||je.context?.elements.domReference===_e)));if(Le===k&&ie&&r1(ie,L),d&&Le!==k&&!Bd(Ge)&&zn(be)===be.body){if(Ut(ie)&&(ie.focus(),d==="popup")){ce.request(()=>{ie.focus()});return}const je=te(),Be=X.current,Ze=(Be&&je.includes(Be)?Be:null)||je[je.length-1]||ie;Ut(Ze)&&Ze.focus()}if(N.current.insideReactTree){N.current.insideReactTree=!1;return}(O||!f)&&_e&&ye&&!Q.current&&(O||_e!==Tp())&&(Y.current=!0,_.setOpen(!1,tt(Pd,Ne)))})}function De(){q.current||(N.current.insideReactTree=!0,W.start(0,()=>{N.current.insideReactTree=!1}))}const xe=Ut(k)?k:null;if(!(!E&&!xe))return Xa(xe&&ct(xe,"focusout",ze),xe&&ct(xe,"pointerdown",Se),E&&ct(E,"focusin",Ee),E&&ct(E,"focusout",ze),E&&H&&ct(E,"focusout",De,!0))},[r,k,E,ie,f,D,H,_,p,d,te,O,M,L,N,W,oe,ce,h,x,ke]),b.useEffect(()=>{if(r||!E||!j)return;const be=Array.from(H?.portalNode?.querySelectorAll(`[${Yi("portal")}]`)||[]),Ee=(D?Q0(D.nodesRef.current,M()):[]).find(Le=>Pg(Le.context?.elements.domReference||null))?.context?.elements.domReference,De=[...[E,...be,K.current,I.current,H?.beforeOutsideRef.current,H?.afterOutsideRef.current,...ke()],Ee,js(x),js(h),O?k:null].filter(Le=>Le!=null),xe=e1(De,{ariaHidden:f||O,mark:!1}),Ne=[E,...be].filter(Le=>Le!=null),_e=e1(Ne);return()=>{_e(),xe()}},[j,r,k,E,f,H,O,D,M,h,x,ke]),Re(()=>{if(!j||r||!Ut(ie))return;const be=xt(ie),Se=zn(be);queueMicrotask(()=>{const Ee=U.current,ze=typeof Ee=="function"?Ee(B.current||""):Ee;if(ze===void 0||ze===!1||Ye(ie,Se))return;let xe=null;const Ne=()=>(xe==null&&(xe=te(ie)),xe[0]||ie);let _e;ze===!0||ze===null?_e=Ne():_e=js(ze),_e=_e||Ne();const Le=Ye(ie,zn(be));Xu(_e,{preventScroll:_e===ie,shouldFocus(){if(Le)return!0;const Ge=zn(be);return!(Ge!==_e&&Ye(ie,Ge))}})})},[r,j,ie,te,U,B]),Re(()=>{if(r||!ie)return;const be=xt(ie),Se=zn(be);kA(Se);function Ee(De){if(De.open||(Z.current=EA(De.nativeEvent,G.current)),De.reason===In&&De.nativeEvent.type==="mouseleave"&&(Y.current=!0),De.reason===Ah)if(De.nested)Y.current=!1;else if(kh(De.nativeEvent)||Uj(De.nativeEvent))Y.current=!1;else{let xe=!1;xt(ie).createElement("div").focus({get preventScroll(){return xe=!0,!1}}),xe?Y.current=!1:Y.current=!0}}R.on("openchange",Ee);function ze(){const De=P.current;let xe=typeof De=="function"?De(Z.current):De;if(xe===void 0||xe===!1)return null;if(xe===null&&(xe=!0),typeof xe=="boolean")return k?.isConnected?k:Tp()||null;const Ne=k?.isConnected?k:Tp();return js(xe)||Ne||null}return()=>{R.off("openchange",Ee);const De=zn(be),xe=ke(),Ne=Ye(E,De)||xe.some(Ge=>Ge===De||Ye(Ge,De))||D&&mr(D.nodesRef.current,M(),!1).some(Ge=>Ye(Ge.context?.elements.floating,De)),_e=P.current,Le=ze();queueMicrotask(()=>{const Ge=NA(Le),qe=typeof _e!="boolean";_e&&!Y.current&&Ut(Ge)&&(!(!qe&&Ge!==De&&De!==be.body)||Ne)&&Ge.focus({preventScroll:!0}),Y.current=!1})}},[r,E,ie,P,R,D,k,M,ke]),Re(()=>{if(!Eh||j||!E)return;const be=zn(xt(E));!Ut(be)||!Ld(be)||Ye(E,be)&&be.blur()},[j,E]),Re(()=>{if(!(r||!H))return H.setFocusManagerState({modal:f,closeOnFocusOut:p,open:j,onOpenChange:_.setOpen,domReference:k}),()=>{H.setFocusManagerState(null)}},[r,H,f,j,_,p,k]),Re(()=>{if(!(r||!ie))return r1(ie,L),()=>{queueMicrotask(qh)}},[r,ie,L]);const $e=!r&&(f?!O:!0)&&(se||f);return o.jsxs(b.Fragment,{children:[$e&&o.jsx(id,{"data-type":"inside",ref:V,onFocus:be=>{if(f){const Se=te();Xu(Se[Se.length-1])}else H?.portalNode&&(Y.current=!1,Ti(be,H.portalNode)?uS(k)?.focus():js(x??H.beforeOutsideRef)?.focus())}}),s,$e&&o.jsx(id,{"data-type":"inside",ref:$,onFocus:be=>{f?Xu(te()[0]):H?.portalNode&&(p&&(Y.current=!0),Ti(be,H.portalNode)?dS(k)?.focus():js(h??H.afterOutsideRef)?.focus())}})]})}function RA(e,n={}){const{enabled:s=!0,event:r="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:d=!0,touchOpenDelay:f=0,reason:p=Vi}=n,m="rootStore"in e?e.rootStore:e,h=m.context.dataRef,x=b.useRef(void 0),y=Qo(),S=Zn(),w=b.useMemo(()=>{function _(k,E,R,N){const M=tt(p,E,R);k&&N==="touch"&&f>0?S.start(f,()=>{m.setOpen(!0,M)}):m.setOpen(k,M)}function j(k,E,R){const N=h.current.openEvent,M=m.select("domReferenceElement")!==E;return k&&M||!k||!i?!0:N&&d?!R(N.type):!1}return{onPointerDown(k){x.current=k.pointerType},onMouseDown(k){const E=x.current,R=k.nativeEvent,N=m.select("open");if(k.button!==0||r==="click"||Fr(E,!0)&&c)return;const M=j(N,k.currentTarget,L=>L==="click"||L==="mousedown"),A=En(R);if(Ld(A)){_(M,R,A,E);return}const O=k.currentTarget;y.request(()=>{_(M,R,O,E)})},onClick(k){if(r==="mousedown-only")return;const E=x.current;if(r==="mousedown"&&E){x.current=void 0;return}if(Fr(E,!0)&&c)return;const R=m.select("open"),N=j(R,k.currentTarget,M=>M==="click"||M==="mousedown"||M==="keydown"||M==="keyup");_(N,k.nativeEvent,k.currentTarget,E)},onKeyDown(){x.current=void 0}}},[h,r,c,p,m,d,i,y,S,f]);return b.useMemo(()=>s?{reference:w}:an,[s,w])}function TA(e,n){let s=null,r=null,i=!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",f=n.axis==="y"||n.axis==="both",p=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let m=c.width,h=c.height,x=c.x,y=c.y;return s==null&&n.x&&d&&(s=c.x-n.x),r==null&&n.y&&f&&(r=c.y-n.y),x-=s||0,y-=r||0,m=0,h=0,!i||p?(m=n.axis==="y"?c.width:0,h=n.axis==="x"?c.height:0,x=d&&n.x!=null?n.x:x,y=f&&n.y!=null?n.y:y):i&&!p&&(h=n.axis==="x"?c.height:h,m=n.axis==="y"?c.width:m),i=!0,{width:m,height:h,x,y,top:y,right:x+m,bottom:y+h,left:x}}}}function o1(e){return e!=null&&e.clientX!=null}function AA(e,n={}){const{enabled:s=!0,axis:r="both"}=n,i="rootStore"in e?e.rootStore:e,c=i.useState("open"),d=i.useState("floatingElement"),f=i.useState("domReferenceElement"),p=i.context.dataRef,m=b.useRef(!1),h=b.useRef(null),[x,y]=b.useState(),[S,w]=b.useState([]),_=Me(N=>{i.set("positionReference",N)}),j=Me((N,M,A)=>{m.current||p.current.openEvent&&!o1(p.current.openEvent)||i.set("positionReference",TA(A??f,{x:N,y:M,axis:r,dataRef:p,pointerType:x}))}),k=Me(N=>{c?h.current||(j(N.clientX,N.clientY,N.currentTarget),w([])):j(N.clientX,N.clientY,N.currentTarget)}),E=Fr(x)?d:c;b.useEffect(()=>{if(!s){_(f);return}if(!E)return;function N(){h.current?.(),h.current=null}const M=Ft(d);function A(O){const L=En(O);Ye(d,L)?N():j(O.clientX,O.clientY)}return!p.current.openEvent||o1(p.current.openEvent)?h.current=ct(M,"mousemove",A):_(f),N},[E,s,d,p,f,i,j,_,S]),b.useEffect(()=>()=>{i.set("positionReference",null)},[i]),b.useEffect(()=>{s&&!d&&(m.current=!1)},[s,d]),b.useEffect(()=>{!s&&c&&(m.current=!0)},[s,c]);const R=b.useMemo(()=>{function N(M){y(M.pointerType)}return{onPointerDown:N,onPointerEnter:N,onMouseMove:k,onMouseEnter:k}},[k]);return b.useMemo(()=>s?{reference:R,trigger:R}:{},[s,R])}const MA={intentional:"onClick",sloppy:"onPointerDown"};function OA(){return!1}function zA(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function Vh(e,n={}){const{enabled:s=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:c="sloppy",referencePress:d=OA,referencePressEvent:f="sloppy",bubbles:p,externalTree:m}=n,h="rootStore"in e?e.rootStore:e,x=h.useState("open"),y=h.useState("floatingElement"),{dataRef:S}=h.context,w=fl(m),_=Me(typeof i=="function"?i:()=>!1),j=typeof i=="function"?_:i,k=j!==!1,E=Me(()=>c),{escapeKey:R,outsidePress:N}=zA(p),M=b.useRef(!1),A=b.useRef(!1),O=b.useRef(!1),L=b.useRef(!1),U=b.useRef(""),P=b.useRef(null),B=Zn(),D=Zn(),H=Me(()=>{D.clear(),S.current.insideReactTree=!1}),Y=Me($=>{const W=S.current.floatingContext?.nodeId;return(w?mr(w.nodesRef.current,W):[]).some(ce=>ce.context?.open&&!ce.context.dataRef.current[$])}),Q=Me($=>Sp($,h.select("floatingElement"))||Sp($,h.select("domReferenceElement"))),q=Me($=>{d()&&h.setOpen(!1,tt(Vi,$.nativeEvent))}),X=Me($=>{if(!x||!s||!r||$.key!=="Escape"||L.current||!R&&Y("__escapeKeyBubbles"))return;const W=gT($)?$.nativeEvent:$,oe=tt(Mh,W);h.setOpen(!1,oe),oe.isCanceled||$.preventDefault(),!R&&!oe.isPropagationAllowed&&$.stopPropagation()}),Z=Me(()=>{S.current.insideReactTree=!0,D.start(0,H)}),G=Me($=>{if(!x||!s||$.button!==0)return;const W=En($.nativeEvent);Ye(h.select("floatingElement"),W)&&(M.current||(M.current=!0,A.current=!1))}),K=Me($=>{!x||!s||($.defaultPrevented||$.nativeEvent.defaultPrevented)&&M.current&&(A.current=!0)});b.useEffect(()=>{if(!x||!s)return;S.current.__escapeKeyBubbles=R,S.current.__outsidePressBubbles=N;const $=new Ba,W=new Ba;function oe(){$.clear(),L.current=!0}function ce(){$.start(zd()?5:0,()=>{L.current=!1})}function se(){O.current=!0,W.start(0,()=>{O.current=!1})}function ie(){M.current=!1,A.current=!1}function te(){const le=U.current,ye=le==="pen"||!le?"mouse":le,je=E(),Be=typeof je=="function"?je():je;return typeof Be=="string"?Be:Be[ye]}function ke(le){const ye=te();return ye==="intentional"&&le.type!=="click"||ye==="sloppy"&&le.type==="click"}function $e(le){const ye=S.current.floatingContext?.nodeId,je=w&&mr(w.nodesRef.current,ye).some(Be=>Sp(le,Be.context?.elements.floating));return Q(le)||je}function be(le){if(ke(le)){le.type!=="click"&&!Q(le)&&(W.clear(),O.current=!1),H();return}if(S.current.insideReactTree){H();return}const ye=En(le),je=`[${Yi("inert")}]`,Be=lt(ye)?ye.getRootNode():null,Ze=Array.from((Ko(Be)?Be:xt(h.select("floatingElement"))).querySelectorAll(je)),_t=h.context.triggerElements;if(ye&&(_t.hasElement(ye)||_t.hasMatchingElement(vt=>Ye(vt,ye))))return;let Ht=lt(ye)?ye:null;for(;Ht&&!Cs(Ht);){const vt=Rs(Ht);if(Cs(vt)||!lt(vt))break;Ht=vt}if(!(Ze.length&&lt(ye)&&!_T(ye)&&!Ye(ye,h.select("floatingElement"))&&Ze.every(vt=>!Ye(Ht,vt)))){if(Ut(ye)&&!("touches"in le)){const vt=Cs(ye),ut=Wn(ye),it=/auto|scroll/,Et=vt||it.test(ut.overflowX),Bt=vt||it.test(ut.overflowY),pa=Et&&ye.clientWidth>0&&ye.scrollWidth>ye.clientWidth,gn=Bt&&ye.clientHeight>0&&ye.scrollHeight>ye.clientHeight,dt=ut.direction==="rtl",Tt=gn&&(dt?le.offsetX<=ye.offsetWidth-ye.clientWidth:le.offsetX>ye.clientWidth),Xt=pa&&le.offsetY>ye.clientHeight;if(Tt||Xt)return}if(!$e(le)){if(te()==="intentional"&&O.current){W.clear(),O.current=!1;return}typeof j=="function"&&!j(le)||Y("__outsidePressBubbles")||(h.setOpen(!1,tt(Ah,le)),H())}}}function Se(le){te()!=="sloppy"||le.pointerType==="touch"||!h.select("open")||!s||Q(le)||be(le)}function Ee(le){if(te()!=="sloppy"||!h.select("open")||!s||Q(le))return;const ye=le.touches[0];ye&&(P.current={startTime:Date.now(),startX:ye.clientX,startY:ye.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},B.start(1e3,()=>{P.current&&(P.current.dismissOnTouchEnd=!1,P.current.dismissOnMouseDown=!1)}))}function ze(le,ye){const je=En(le);if(!je)return;const Be=ct(je,le.type,()=>{ye(le),Be()})}function De(le){U.current="touch",ze(le,Ee)}function xe(le){B.clear(),le.type==="pointerdown"&&(U.current=le.pointerType),!(le.type==="mousedown"&&P.current&&!P.current.dismissOnMouseDown)&&ze(le,ye=>{ye.type==="pointerdown"?Se(ye):be(ye)})}function Ne(le){if(!M.current)return;const ye=A.current;if(ie(),te()==="intentional"){if(le.type==="pointercancel"){ye&&se();return}if(!$e(le)){if(ye){se();return}typeof j=="function"&&!j(le)||(W.clear(),O.current=!0,H())}}}function _e(le){if(te()!=="sloppy"||!P.current||Q(le))return;const ye=le.touches[0];if(!ye)return;const je=Math.abs(ye.clientX-P.current.startX),Be=Math.abs(ye.clientY-P.current.startY),Ze=Math.sqrt(je*je+Be*Be);Ze>5&&(P.current.dismissOnTouchEnd=!0),Ze>10&&(be(le),B.clear(),P.current=null)}function Le(le){ze(le,_e)}function Ge(le){te()!=="sloppy"||!P.current||Q(le)||(P.current.dismissOnTouchEnd&&be(le),B.clear(),P.current=null)}function qe(le){ze(le,Ge)}const Oe=xt(y),ve=Xa(r&&Xa(ct(Oe,"keydown",X),ct(Oe,"compositionstart",oe),ct(Oe,"compositionend",ce)),k&&Xa(ct(Oe,"click",xe,!0),ct(Oe,"pointerdown",xe,!0),ct(Oe,"pointerup",Ne,!0),ct(Oe,"pointercancel",Ne,!0),ct(Oe,"mousedown",xe,!0),ct(Oe,"mouseup",Ne,!0),ct(Oe,"touchstart",De,!0),ct(Oe,"touchmove",Le,!0),ct(Oe,"touchend",qe,!0)));return()=>{ve(),$.clear(),W.clear(),ie(),O.current=!1}},[S,y,r,k,j,x,s,R,N,X,H,E,Y,Q,w,h,B]),b.useEffect(H,[j,H]);const I=b.useMemo(()=>({onKeyDown:X,[MA[f]]:q,...f!=="intentional"&&{onClick:q}}),[X,q,f]),V=b.useMemo(()=>({onKeyDown:X,onPointerDown:K,onMouseDown:K,onClickCapture:Z,onMouseDownCapture($){Z(),G($)},onPointerDownCapture($){Z(),G($)},onMouseUpCapture:Z,onTouchEndCapture:Z,onTouchMoveCapture:Z}),[X,Z,G,K]);return b.useMemo(()=>s?{reference:I,floating:V,trigger:I}:{},[s,I,V])}function l1(e,n,s){let{reference:r,floating:i}=e;const c=Ea(n),d=Ph(n),f=Lh(d),p=Jn(n),m=c==="y",h=r.x+r.width/2-i.width/2,x=r.y+r.height/2-i.height/2,y=r[f]/2-i[f]/2;let S;switch(p){case"top":S={x:h,y:r.y-i.height};break;case"bottom":S={x:h,y:r.y+r.height};break;case"right":S={x:r.x+r.width,y:x};break;case"left":S={x:r.x-i.width,y:x};break;default:S={x:r.x,y:r.y}}switch(xr(n)){case"start":S[d]-=y*(s&&m?-1:1);break;case"end":S[d]+=y*(s&&m?-1:1);break}return S}async function DA(e,n){var s;n===void 0&&(n={});const{x:r,y:i,platform:c,rects:d,elements:f,strategy:p}=e,{boundary:m="clippingAncestors",rootBoundary:h="viewport",elementContext:x="floating",altBoundary:y=!1,padding:S=0}=Ms(n,e),w=Zj(S),j=f[y?x==="floating"?"reference":"floating":x],k=$i(await c.getClippingRect({element:(s=await(c.isElement==null?void 0:c.isElement(j)))==null||s?j:j.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(f.floating)),boundary:m,rootBoundary:h,strategy:p})),E=x==="floating"?{x:r,y:i,width:d.floating.width,height:d.floating.height}:d.reference,R=await(c.getOffsetParent==null?void 0:c.getOffsetParent(f.floating)),N=await(c.isElement==null?void 0:c.isElement(R))?await(c.getScale==null?void 0:c.getScale(R))||{x:1,y:1}:{x:1,y:1},M=$i(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:E,offsetParent:R,strategy:p}):E);return{top:(k.top-M.top+w.top)/N.y,bottom:(M.bottom-k.bottom+w.bottom)/N.y,left:(k.left-M.left+w.left)/N.x,right:(M.right-k.right+w.right)/N.x}}const LA=50,PA=async(e,n,s)=>{const{placement:r="bottom",strategy:i="absolute",middleware:c=[],platform:d}=s,f=d.detectOverflow?d:{...d,detectOverflow:DA},p=await(d.isRTL==null?void 0:d.isRTL(n));let m=await d.getElementRects({reference:e,floating:n,strategy:i}),{x:h,y:x}=l1(m,r,p),y=r,S=0;const w={};for(let _=0;_<c.length;_++){const j=c[_];if(!j)continue;const{name:k,fn:E}=j,{x:R,y:N,data:M,reset:A}=await E({x:h,y:x,initialPlacement:r,placement:y,strategy:i,middlewareData:w,rects:m,platform:f,elements:{reference:e,floating:n}});h=R??h,x=N??x,w[k]={...w[k],...M},A&&S<LA&&(S++,typeof A=="object"&&(A.placement&&(y=A.placement),A.rects&&(m=A.rects===!0?await d.getElementRects({reference:e,floating:n,strategy:i}):A.rects),{x:h,y:x}=l1(m,y,p)),_=-1)}return{x:h,y:x,placement:y,strategy:i,middlewareData:w}},BA=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(n){var s,r;const{placement:i,middlewareData:c,rects:d,initialPlacement:f,platform:p,elements:m}=n,{mainAxis:h=!0,crossAxis:x=!0,fallbackPlacements:y,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:_=!0,...j}=Ms(e,n);if((s=c.arrow)!=null&&s.alignmentOffset)return{};const k=Jn(i),E=Ea(f),R=Jn(f)===f,N=await(p.isRTL==null?void 0:p.isRTL(m.floating)),M=y||(R||!_?[ud(f)]:qT(f)),A=w!=="none";!y&&A&&M.push(...YT(f,_,w,N));const O=[f,...M],L=await p.detectOverflow(n,j),U=[];let P=((r=c.flip)==null?void 0:r.overflows)||[];if(h&&U.push(L[k]),x){const Y=HT(i,d,N);U.push(L[Y[0]],L[Y[1]])}if(P=[...P,{placement:i,overflows:U}],!U.every(Y=>Y<=0)){var B,D;const Y=(((B=c.flip)==null?void 0:B.index)||0)+1,Q=O[Y];if(Q&&(!(x==="alignment"?E!==Ea(Q):!1)||P.every(Z=>Ea(Z.placement)===E?Z.overflows[0]>0:!0)))return{data:{index:Y,overflows:P},reset:{placement:Q}};let q=(D=P.filter(X=>X.overflows[0]<=0).sort((X,Z)=>X.overflows[1]-Z.overflows[1])[0])==null?void 0:D.placement;if(!q)switch(S){case"bestFit":{var H;const X=(H=P.filter(Z=>{if(A){const G=Ea(Z.placement);return G===E||G==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(G=>G>0).reduce((G,K)=>G+K,0)]).sort((Z,G)=>Z[1]-G[1])[0])==null?void 0:H[0];X&&(q=X);break}case"initialPlacement":q=f;break}if(i!==q)return{reset:{placement:q}}}return{}}}};function i1(e,n){return{top:e.top-n.height,right:e.right-n.width,bottom:e.bottom-n.height,left:e.left-n.width}}function c1(e){return IT.some(n=>e[n]>=0)}const IA=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(n){const{rects:s,platform:r}=n,{strategy:i="referenceHidden",...c}=Ms(e,n);switch(i){case"referenceHidden":{const d=await r.detectOverflow(n,{...c,elementContext:"reference"}),f=i1(d,s.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:c1(f)}}}case"escaped":{const d=await r.detectOverflow(n,{...c,altBoundary:!0}),f=i1(d,s.floating);return{data:{escapedOffsets:f,escaped:c1(f)}}}default:return{}}}}},SS=new Set(["left","top"]);async function UA(e,n){const{placement:s,platform:r,elements:i}=e,c=await(r.isRTL==null?void 0:r.isRTL(i.floating)),d=Jn(s),f=xr(s),p=Ea(s)==="y",m=SS.has(d)?-1:1,h=c&&p?-1:1,x=Ms(n,e);let{mainAxis:y,crossAxis:S,alignmentAxis:w}=typeof x=="number"?{mainAxis:x,crossAxis:0,alignmentAxis:null}:{mainAxis:x.mainAxis||0,crossAxis:x.crossAxis||0,alignmentAxis:x.alignmentAxis};return f&&typeof w=="number"&&(S=f==="end"?w*-1:w),p?{x:S*h,y:y*m}:{x:y*m,y:S*h}}const HA=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(n){var s,r;const{x:i,y:c,placement:d,middlewareData:f}=n,p=await UA(n,e);return d===((s=f.offset)==null?void 0:s.placement)&&(r=f.arrow)!=null&&r.alignmentOffset?{}:{x:i+p.x,y:c+p.y,data:{...p,placement:d}}}}},qA=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(n){const{x:s,y:r,placement:i,platform:c}=n,{mainAxis:d=!0,crossAxis:f=!1,limiter:p={fn:k=>{let{x:E,y:R}=k;return{x:E,y:R}}},...m}=Ms(e,n),h={x:s,y:r},x=await c.detectOverflow(n,m),y=Ea(Jn(i)),S=Dh(y);let w=h[S],_=h[y];if(d){const k=S==="y"?"top":"left",E=S==="y"?"bottom":"right",R=w+x[k],N=w-x[E];w=Bg(R,w,N)}if(f){const k=y==="y"?"top":"left",E=y==="y"?"bottom":"right",R=_+x[k],N=_-x[E];_=Bg(R,_,N)}const j=p.fn({...n,[S]:w,[y]:_});return{...j,data:{x:j.x-s,y:j.y-r,enabled:{[S]:d,[y]:f}}}}}},VA=function(e){return e===void 0&&(e={}),{options:e,fn(n){const{x:s,y:r,placement:i,rects:c,middlewareData:d}=n,{offset:f=0,mainAxis:p=!0,crossAxis:m=!0}=Ms(e,n),h={x:s,y:r},x=Ea(i),y=Dh(x);let S=h[y],w=h[x];const _=Ms(f,n),j=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(p){const R=y==="y"?"height":"width",N=c.reference[y]-c.floating[R]+j.mainAxis,M=c.reference[y]+c.reference[R]-j.mainAxis;S<N?S=N:S>M&&(S=M)}if(m){var k,E;const R=y==="y"?"width":"height",N=SS.has(Jn(i)),M=c.reference[x]-c.floating[R]+(N&&((k=d.offset)==null?void 0:k[x])||0)+(N?0:j.crossAxis),A=c.reference[x]+c.reference[R]+(N?0:((E=d.offset)==null?void 0:E[x])||0)-(N?j.crossAxis:0);w<M?w=M:w>A&&(w=A)}return{[y]:S,[x]:w}}}},$A=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(n){var s,r;const{placement:i,rects:c,platform:d,elements:f}=n,{apply:p=()=>{},...m}=Ms(e,n),h=await d.detectOverflow(n,m),x=Jn(i),y=xr(i),S=Ea(i)==="y",{width:w,height:_}=c.floating;let j,k;x==="top"||x==="bottom"?(j=x,k=y===(await(d.isRTL==null?void 0:d.isRTL(f.floating))?"start":"end")?"left":"right"):(k=x,j=y==="end"?"top":"bottom");const E=_-h.top-h.bottom,R=w-h.left-h.right,N=Zo(_-h[j],E),M=Zo(w-h[k],R),A=!n.middlewareData.shift;let O=N,L=M;if((s=n.middlewareData.shift)!=null&&s.enabled.x&&(L=R),(r=n.middlewareData.shift)!=null&&r.enabled.y&&(O=E),A&&!y){const P=da(h.left,0),B=da(h.right,0),D=da(h.top,0),H=da(h.bottom,0);S?L=w-2*(P!==0||B!==0?P+B:da(h.left,h.right)):O=_-2*(D!==0||H!==0?D+H:da(h.top,h.bottom))}await p({...n,availableWidth:L,availableHeight:O});const U=await d.getDimensions(f.floating);return w!==U.width||_!==U.height?{reset:{rects:!0}}:{}}}};function wS(e){const n=Wn(e);let s=parseFloat(n.width)||0,r=parseFloat(n.height)||0;const i=Ut(e),c=i?e.offsetWidth:s,d=i?e.offsetHeight:r,f=cd(s)!==c||cd(r)!==d;return f&&(s=c,r=d),{width:s,height:r,$:f}}function $h(e){return lt(e)?e:e.contextElement}function Yo(e){const n=$h(e);if(!Ut(n))return Ka(1);const s=n.getBoundingClientRect(),{width:r,height:i,$:c}=wS(n);let d=(c?cd(s.width):s.width)/r,f=(c?cd(s.height):s.height)/i;return(!d||!Number.isFinite(d))&&(d=1),(!f||!Number.isFinite(f))&&(f=1),{x:d,y:f}}const GA=Ka(0);function CS(e){const n=Ft(e);return!zd()||!n.visualViewport?GA:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function YA(e,n,s){return n===void 0&&(n=!1),!s||n&&s!==Ft(e)?!1:n}function Xr(e,n,s,r){n===void 0&&(n=!1),s===void 0&&(s=!1);const i=e.getBoundingClientRect(),c=$h(e);let d=Ka(1);n&&(r?lt(r)&&(d=Yo(r)):d=Yo(e));const f=YA(c,s,r)?CS(c):Ka(0);let p=(i.left+f.x)/d.x,m=(i.top+f.y)/d.y,h=i.width/d.x,x=i.height/d.y;if(c){const y=Ft(c),S=r&&lt(r)?Ft(r):r;let w=y,_=Dg(w);for(;_&&r&&S!==w;){const j=Yo(_),k=_.getBoundingClientRect(),E=Wn(_),R=k.left+(_.clientLeft+parseFloat(E.paddingLeft))*j.x,N=k.top+(_.clientTop+parseFloat(E.paddingTop))*j.y;p*=j.x,m*=j.y,h*=j.x,x*=j.y,p+=R,m+=N,w=Ft(_),_=Dg(w)}}return $i({width:h,height:x,x:p,y:m})}function qd(e,n){const s=Dd(e).scrollLeft;return n?n.left+s:Xr(Wa(e)).left+s}function ES(e,n){const s=e.getBoundingClientRect(),r=s.left+n.scrollLeft-qd(e,s),i=s.top+n.scrollTop;return{x:r,y:i}}function FA(e){let{elements:n,rect:s,offsetParent:r,strategy:i}=e;const c=i==="fixed",d=Wa(r),f=n?Od(n.floating):!1;if(r===d||f&&c)return s;let p={scrollLeft:0,scrollTop:0},m=Ka(1);const h=Ka(0),x=Ut(r);if((x||!x&&!c)&&((Pn(r)!=="body"||hr(d))&&(p=Dd(r)),x)){const S=Xr(r);m=Yo(r),h.x=S.x+r.clientLeft,h.y=S.y+r.clientTop}const y=d&&!x&&!c?ES(d,p):Ka(0);return{width:s.width*m.x,height:s.height*m.y,x:s.x*m.x-p.scrollLeft*m.x+h.x+y.x,y:s.y*m.y-p.scrollTop*m.y+h.y+y.y}}function XA(e){return Array.from(e.getClientRects())}function KA(e){const n=Wa(e),s=Dd(e),r=e.ownerDocument.body,i=da(n.scrollWidth,n.clientWidth,r.scrollWidth,r.clientWidth),c=da(n.scrollHeight,n.clientHeight,r.scrollHeight,r.clientHeight);let d=-s.scrollLeft+qd(e);const f=-s.scrollTop;return Wn(r).direction==="rtl"&&(d+=da(n.clientWidth,r.clientWidth)-i),{width:i,height:c,x:d,y:f}}const u1=25;function QA(e,n){const s=Ft(e),r=Wa(e),i=s.visualViewport;let c=r.clientWidth,d=r.clientHeight,f=0,p=0;if(i){c=i.width,d=i.height;const h=zd();(!h||h&&n==="fixed")&&(f=i.offsetLeft,p=i.offsetTop)}const m=qd(r);if(m<=0){const h=r.ownerDocument,x=h.body,y=getComputedStyle(x),S=h.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,w=Math.abs(r.clientWidth-x.clientWidth-S);w<=u1&&(c-=w)}else m<=u1&&(c+=m);return{width:c,height:d,x:f,y:p}}function ZA(e,n){const s=Xr(e,!0,n==="fixed"),r=s.top+e.clientTop,i=s.left+e.clientLeft,c=Ut(e)?Yo(e):Ka(1),d=e.clientWidth*c.x,f=e.clientHeight*c.y,p=i*c.x,m=r*c.y;return{width:d,height:f,x:p,y:m}}function d1(e,n,s){let r;if(n==="viewport")r=QA(e,s);else if(n==="document")r=KA(Wa(e));else if(lt(n))r=ZA(n,s);else{const i=CS(e);r={x:n.x-i.x,y:n.y-i.y,width:n.width,height:n.height}}return $i(r)}function kS(e,n){const s=Rs(e);return s===n||!lt(s)||Cs(s)?!1:Wn(s).position==="fixed"||kS(s,n)}function JA(e,n){const s=n.get(e);if(s)return s;let r=Hi(e,[],!1).filter(f=>lt(f)&&Pn(f)!=="body"),i=null;const c=Wn(e).position==="fixed";let d=c?Rs(e):e;for(;lt(d)&&!Cs(d);){const f=Wn(d),p=Rh(d);!p&&f.position==="fixed"&&(i=null),(c?!p&&!i:!p&&f.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||hr(d)&&!p&&kS(e,d))?r=r.filter(h=>h!==d):i=f,d=Rs(d)}return n.set(e,r),r}function WA(e){let{element:n,boundary:s,rootBoundary:r,strategy:i}=e;const d=[...s==="clippingAncestors"?Od(n)?[]:JA(n,this._c):[].concat(s),r],f=d1(n,d[0],i);let p=f.top,m=f.right,h=f.bottom,x=f.left;for(let y=1;y<d.length;y++){const S=d1(n,d[y],i);p=da(S.top,p),m=Zo(S.right,m),h=Zo(S.bottom,h),x=da(S.left,x)}return{width:m-x,height:h-p,x,y:p}}function e3(e){const{width:n,height:s}=wS(e);return{width:n,height:s}}function t3(e,n,s){const r=Ut(n),i=Wa(n),c=s==="fixed",d=Xr(e,!0,c,n);let f={scrollLeft:0,scrollTop:0};const p=Ka(0);function m(){p.x=qd(i)}if(r||!r&&!c)if((Pn(n)!=="body"||hr(i))&&(f=Dd(n)),r){const S=Xr(n,!0,c,n);p.x=S.x+n.clientLeft,p.y=S.y+n.clientTop}else i&&m();c&&!r&&i&&m();const h=i&&!r&&!c?ES(i,f):Ka(0),x=d.left+f.scrollLeft-p.x-h.x,y=d.top+f.scrollTop-p.y-h.y;return{x,y,width:d.width,height:d.height}}function Ap(e){return Wn(e).position==="static"}function f1(e,n){if(!Ut(e)||Wn(e).position==="fixed")return null;if(n)return n(e);let s=e.offsetParent;return Wa(e)===s&&(s=s.ownerDocument.body),s}function NS(e,n){const s=Ft(e);if(Od(e))return s;if(!Ut(e)){let i=Rs(e);for(;i&&!Cs(i);){if(lt(i)&&!Ap(i))return i;i=Rs(i)}return s}let r=f1(e,n);for(;r&&xT(r)&&Ap(r);)r=f1(r,n);return r&&Cs(r)&&Ap(r)&&!Rh(r)?s:r||yT(e)||s}const n3=async function(e){const n=this.getOffsetParent||NS,s=this.getDimensions,r=await s(e.floating);return{reference:t3(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function a3(e){return Wn(e).direction==="rtl"}const RS={convertOffsetParentRelativeRectToViewportRelativeRect:FA,getDocumentElement:Wa,getClippingRect:WA,getOffsetParent:NS,getElementRects:n3,getClientRects:XA,getDimensions:e3,getScale:Yo,isElement:lt,isRTL:a3};function TS(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function s3(e,n){let s=null,r;const i=Wa(e);function c(){var f;clearTimeout(r),(f=s)==null||f.disconnect(),s=null}function d(f,p){f===void 0&&(f=!1),p===void 0&&(p=1),c();const m=e.getBoundingClientRect(),{left:h,top:x,width:y,height:S}=m;if(f||n(),!y||!S)return;const w=qr(x),_=qr(i.clientWidth-(h+y)),j=qr(i.clientHeight-(x+S)),k=qr(h),R={rootMargin:-w+"px "+-_+"px "+-j+"px "+-k+"px",threshold:da(0,Zo(1,p))||1};let N=!0;function M(A){const O=A[0].intersectionRatio;if(O!==p){if(!N)return d();O?d(!1,O):r=setTimeout(()=>{d(!1,1e-7)},1e3)}O===1&&!TS(m,e.getBoundingClientRect())&&d(),N=!1}try{s=new IntersectionObserver(M,{...R,root:i.ownerDocument})}catch{s=new IntersectionObserver(M,R)}s.observe(e)}return d(!0),c}function m1(e,n,s,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:c=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:p=!1}=r,m=$h(e),h=i||c?[...m?Hi(m):[],...n?Hi(n):[]]:[];h.forEach(k=>{i&&k.addEventListener("scroll",s,{passive:!0}),c&&k.addEventListener("resize",s)});const x=m&&f?s3(m,s):null;let y=-1,S=null;d&&(S=new ResizeObserver(k=>{let[E]=k;E&&E.target===m&&S&&n&&(S.unobserve(n),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var R;(R=S)==null||R.observe(n)})),s()}),m&&!p&&S.observe(m),n&&S.observe(n));let w,_=p?Xr(e):null;p&&j();function j(){const k=Xr(e);_&&!TS(_,k)&&s(),_=k,w=requestAnimationFrame(j)}return s(),()=>{var k;h.forEach(E=>{i&&E.removeEventListener("scroll",s),c&&E.removeEventListener("resize",s)}),x?.(),(k=S)==null||k.disconnect(),S=null,p&&cancelAnimationFrame(w)}}const r3=HA,o3=qA,l3=BA,i3=$A,c3=IA,u3=VA,d3=(e,n,s)=>{const r=new Map,i={platform:RS,...s},c={...i.platform,_c:r};return PA(e,n,{...i,platform:c})};var f3=typeof document<"u",m3=function(){},Ku=f3?b.useLayoutEffect:m3;function md(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,r,i;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(s=e.length,s!==n.length)return!1;for(r=s;r--!==0;)if(!md(e[r],n[r]))return!1;return!0}if(i=Object.keys(e),s=i.length,s!==Object.keys(n).length)return!1;for(r=s;r--!==0;)if(!{}.hasOwnProperty.call(n,i[r]))return!1;for(r=s;r--!==0;){const c=i[r];if(!(c==="_owner"&&e.$$typeof)&&!md(e[c],n[c]))return!1}return!0}return e!==e&&n!==n}function AS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function p1(e,n){const s=AS(e);return Math.round(n*s)/s}function Mp(e){const n=b.useRef(e);return Ku(()=>{n.current=e}),n}function p3(e){e===void 0&&(e={});const{placement:n="bottom",strategy:s="absolute",middleware:r=[],platform:i,elements:{reference:c,floating:d}={},transform:f=!0,whileElementsMounted:p,open:m}=e,[h,x]=b.useState({x:0,y:0,strategy:s,placement:n,middlewareData:{},isPositioned:!1}),[y,S]=b.useState(r);md(y,r)||S(r);const[w,_]=b.useState(null),[j,k]=b.useState(null),E=b.useCallback(Z=>{Z!==A.current&&(A.current=Z,_(Z))},[]),R=b.useCallback(Z=>{Z!==O.current&&(O.current=Z,k(Z))},[]),N=c||w,M=d||j,A=b.useRef(null),O=b.useRef(null),L=b.useRef(h),U=p!=null,P=Mp(p),B=Mp(i),D=Mp(m),H=b.useCallback(()=>{if(!A.current||!O.current)return;const Z={placement:n,strategy:s,middleware:y};B.current&&(Z.platform=B.current),d3(A.current,O.current,Z).then(G=>{const K={...G,isPositioned:D.current!==!1};Y.current&&!md(L.current,K)&&(L.current=K,Zr.flushSync(()=>{x(K)}))})},[y,n,s,B,D]);Ku(()=>{m===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,x(Z=>({...Z,isPositioned:!1})))},[m]);const Y=b.useRef(!1);Ku(()=>(Y.current=!0,()=>{Y.current=!1}),[]),Ku(()=>{if(N&&(A.current=N),M&&(O.current=M),N&&M){if(P.current)return P.current(N,M,H);H()}},[N,M,H,P,U]);const Q=b.useMemo(()=>({reference:A,floating:O,setReference:E,setFloating:R}),[E,R]),q=b.useMemo(()=>({reference:N,floating:M}),[N,M]),X=b.useMemo(()=>{const Z={position:s,left:0,top:0};if(!q.floating)return Z;const G=p1(q.floating,h.x),K=p1(q.floating,h.y);return f?{...Z,transform:"translate("+G+"px, "+K+"px)",...AS(q.floating)>=1.5&&{willChange:"transform"}}:{position:s,left:G,top:K}},[s,f,q.floating,h.x,h.y]);return b.useMemo(()=>({...h,update:H,refs:Q,elements:q,floatingStyles:X}),[h,H,Q,q,X])}const g3=(e,n)=>{const s=r3(e);return{name:s.name,fn:s.fn,options:[e,n]}},h3=(e,n)=>{const s=o3(e);return{name:s.name,fn:s.fn,options:[e,n]}},x3=(e,n)=>({fn:u3(e).fn,options:[e,n]}),b3=(e,n)=>{const s=l3(e);return{name:s.name,fn:s.fn,options:[e,n]}},v3=(e,n)=>{const s=i3(e);return{name:s.name,fn:s.fn,options:[e,n]}},y3=(e,n)=>{const s=c3(e);return{name:s.name,fn:s.fn,options:[e,n]}},Te=(e,n,s,r,i,c,...d)=>{if(d.length>0)throw new Error(Rn(1));let f;if(e)f=e;else throw new Error("Missing arguments");return f};var Op={exports:{}},zp={};/**
521
- * @license React
522
- * use-sync-external-store-shim.production.js
523
- *
524
- * Copyright (c) Meta Platforms, Inc. and affiliates.
525
- *
526
- * This source code is licensed under the MIT license found in the
527
- * LICENSE file in the root directory of this source tree.
528
- */var g1;function _3(){if(g1)return zp;g1=1;var e=Ki();function n(x,y){return x===y&&(x!==0||1/x===1/y)||x!==x&&y!==y}var s=typeof Object.is=="function"?Object.is:n,r=e.useState,i=e.useEffect,c=e.useLayoutEffect,d=e.useDebugValue;function f(x,y){var S=y(),w=r({inst:{value:S,getSnapshot:y}}),_=w[0].inst,j=w[1];return c(function(){_.value=S,_.getSnapshot=y,p(_)&&j({inst:_})},[x,S,y]),i(function(){return p(_)&&j({inst:_}),x(function(){p(_)&&j({inst:_})})},[x]),d(S),S}function p(x){var y=x.getSnapshot;x=x.value;try{var S=y();return!s(x,S)}catch{return!0}}function m(x,y){return y()}var h=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?m:f;return zp.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:h,zp}var h1;function MS(){return h1||(h1=1,Op.exports=_3()),Op.exports}var pd=MS(),Dp={exports:{}},Lp={};/**
529
- * @license React
530
- * use-sync-external-store-shim/with-selector.production.js
531
- *
532
- * Copyright (c) Meta Platforms, Inc. and affiliates.
533
- *
534
- * This source code is licensed under the MIT license found in the
535
- * LICENSE file in the root directory of this source tree.
536
- */var x1;function j3(){if(x1)return Lp;x1=1;var e=Ki(),n=MS();function s(m,h){return m===h&&(m!==0||1/m===1/h)||m!==m&&h!==h}var r=typeof Object.is=="function"?Object.is:s,i=n.useSyncExternalStore,c=e.useRef,d=e.useEffect,f=e.useMemo,p=e.useDebugValue;return Lp.useSyncExternalStoreWithSelector=function(m,h,x,y,S){var w=c(null);if(w.current===null){var _={hasValue:!1,value:null};w.current=_}else _=w.current;w=f(function(){function k(A){if(!E){if(E=!0,R=A,A=y(A),S!==void 0&&_.hasValue){var O=_.value;if(S(O,A))return N=O}return N=A}if(O=N,r(R,A))return O;var L=y(A);return S!==void 0&&S(O,L)?(R=A,O):(R=A,N=L)}var E=!1,R,N,M=x===void 0?null:x;return[function(){return k(h())},M===null?void 0:function(){return k(M())}]},[h,x,y,S]);var j=i(m,w[0],w[1]);return d(function(){_.hasValue=!0,_.value=j},[j]),p(j),j},Lp}var b1;function S3(){return b1||(b1=1,Dp.exports=j3()),Dp.exports}var w3=S3();const C3=Ih(19),E3=C3?N3:R3;function Qe(e,n,s,r,i){return E3(e,n,s,r,i)}function k3(e,n,s,r,i){const c=b.useCallback(()=>n(e.getSnapshot(),s,r,i),[e,n,s,r,i]);return pd.useSyncExternalStore(e.subscribe,c,c)}rT({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 r=e.syncHooks[s],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(n=!0,r.value=i,r.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 i of e.syncHooks)s.add(i.store);const r=[];for(const i of s)r.push(i.subscribe(n));return()=>{for(const i of r)i()}}),pd.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function N3(e,n,s,r,i){const c=sT();if(!c)return k3(e,n,s,r,i);const d=c.syncIndex;c.syncIndex+=1;let f;return c.didInitialize?(f=c.syncHooks[d],(f.store!==e||f.selector!==n||!Object.is(f.a1,s)||!Object.is(f.a2,r)||!Object.is(f.a3,i))&&(f.store!==e&&(c.didChangeStore=!0),f.store=e,f.selector=n,f.a1=s,f.a2=r,f.a3=i,f.didChange=!0)):(f={store:e,selector:n,a1:s,a2:r,a3:i,value:n(e.getSnapshot(),s,r,i),didChange:!1},c.syncHooks.push(f)),f.value}function R3(e,n,s,r,i){return w3.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,c=>n(c,s,r,i))}class OS{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 r of this.listeners){if(s!==this.updateTick)return;r(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,r,i){return Qe(this,n,s,r,i)}}class Gh extends OS{constructor(n,s={},r){super(n),this.context=s,this.selectors=r}useSyncedValue(n,s){b.useDebugValue(n);const r=this;Re(()=>{r.state[n]!==s&&r.set(n,s)},[r,n,s])}useSyncedValueWithCleanup(n,s){const r=this;Re(()=>(r.state[n]!==s&&r.set(n,s),()=>{r.set(n,void 0)}),[r,n,s])}useSyncedValues(n){const s=this,r=Object.values(n);Re(()=>{s.update(n)},[s,...r])}useControlledProp(n,s){b.useDebugValue(n);const r=this,i=s!==void 0;Re(()=>{i&&!Object.is(r.state[n],s)&&r.setState({...r.state,[n]:s})},[r,n,s,i])}select(n,s,r,i){const c=this.selectors[n];return c(this.state,s,r,i)}useState(n,s,r,i){return b.useDebugValue(n),Qe(this,this.selectors[n],s,r,i)}useContextCallback(n,s){b.useDebugValue(n);const r=Me(s??Dn);this.context[n]=r}useStateSetter(n){const s=b.useRef(void 0);return s.current===void 0&&(s.current=r=>{this.set(n,r)}),s.current}observe(n,s){let r;typeof n=="function"?r=n:r=this.selectors[n];let i=r(this.state);return s(i,i,this),this.subscribe(c=>{const d=r(c);if(!Object.is(i,d)){const f=i;i=d,s(d,f,this)}})}}const T3={open:Te(e=>e.open),transitionStatus:Te(e=>e.transitionStatus),domReferenceElement:Te(e=>e.domReferenceElement),referenceElement:Te(e=>e.positionReference??e.referenceElement),floatingElement:Te(e=>e.floatingElement),floatingId:Te(e=>e.floatingId)};class Vd extends Gh{constructor(n){const{syncOnly:s,nested:r,onOpenChange:i,triggerElements:c,...d}=n;super({...d,positionReference:d.referenceElement,domReferenceElement:d.referenceElement},{onOpenChange:i,dataRef:{current:{}},events:SA(),nested:r,triggerElements:c},T3),this.syncOnly=s}syncOpenEvent=(n,s)=>{(!n||!this.state.open||s!=null&&hT(s))&&(this.context.dataRef.current.openEvent=n?s:void 0)};dispatchOpenChange=(n,s)=>{this.syncOpenEvent(n,s.event);const r={open:n,reason:s.reason,nativeEvent:s.event,nested:this.context.nested,triggerElement:s.trigger};this.context.events.emit("openchange",r)};setOpen=(n,s)=>{if(this.syncOnly){this.context.onOpenChange?.(n,s);return}this.dispatchOpenChange(n,s),this.context.onOpenChange?.(n,s)}}function A3(e){const{popupStore:n,treatPopupAsFloatingElement:s=!1,floatingRootContext:r,floatingId:i,nested:c,onOpenChange:d}=e,f=n.useState("open"),p=n.useState("activeTriggerElement"),m=n.useState(s?"popupElement":"positionerElement"),h=n.context.triggerElements,x=d,y=b.useRef(null);r===void 0&&y.current===null&&(y.current=new Vd({open:f,transitionStatus:void 0,referenceElement:p,floatingElement:m,triggerElements:h,onOpenChange:x,floatingId:i,syncOnly:!0,nested:c}));const S=r??y.current;return n.useSyncedValue("floatingId",i),Re(()=>{const w={open:f,floatingId:i,referenceElement:p,floatingElement:m};lt(p)&&(w.domReferenceElement=p),S.state.positionReference===S.state.referenceElement&&(w.positionReference=p),S.update(w)},[f,i,p,m,S]),S.context.onOpenChange=x,S.context.nested=c,S}function ac(e,n=!1,s=!1){const[r,i]=b.useState(e&&n?"idle":void 0),[c,d]=b.useState(e);return e&&!c&&(d(!0),i("starting")),!e&&c&&r!=="ending"&&!s&&i("ending"),!e&&!c&&r==="ending"&&i(void 0),Re(()=>{if(!e&&c&&r!=="ending"&&s){const f=Ga.request(()=>{i("ending")});return()=>{Ga.cancel(f)}}},[e,c,r,s]),Re(()=>{if(!e||n)return;const f=Ga.request(()=>{i(void 0)});return()=>{Ga.cancel(f)}},[n,e]),Re(()=>{if(!e||!n)return;e&&c&&r!=="idle"&&i("starting");const f=Ga.request(()=>{i("idle")});return()=>{Ga.cancel(f)}},[n,e,c,r]),{mounted:c,setMounted:d,transitionStatus:r}}let Kr=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const M3={[Kr.startingStyle]:""},O3={[Kr.endingStyle]:""},ml={transitionStatus(e){return e==="starting"?M3:e==="ending"?O3:null}};function z3(e,n=!1,s=!0){const r=Qo();return Me((i,c=null)=>{r.cancel();const d=js(e);if(d==null)return;const f=d,p=()=>{Zr.flushSync(i)};if(typeof f.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function m(){Promise.all(f.getAnimations().map(h=>h.finished)).then(()=>{c?.aborted||p()}).catch(()=>{if(s){c?.aborted||p();return}const h=f.getAnimations();!c?.aborted&&h.length>0&&h.some(x=>x.pending||x.playState!=="finished")&&m()})}if(n){const h=Kr.startingStyle;if(!f.hasAttribute(h)){r.request(m);return}const x=new MutationObserver(()=>{f.hasAttribute(h)||(x.disconnect(),m())});x.observe(f,{attributes:!0,attributeFilter:[h]}),c?.addEventListener("abort",()=>x.disconnect(),{once:!0});return}r.request(m)})}function br(e){const{enabled:n=!0,open:s,ref:r,onComplete:i}=e,c=Me(i),d=z3(r,s,!1);b.useEffect(()=>{if(!n)return;const f=new AbortController;return d(c,f.signal),()=>{f.abort()}},[n,s,c,d])}const $d={tabIndex:-1,[Lg]:""};function zS(e,n,s=!1){const r=Ud(),i=Hd()!=null,c=b.useRef(null);e===void 0&&c.current===null&&(c.current=n(r,i));const d=e??c.current;return A3({popupStore:d,treatPopupAsFloatingElement:s,floatingRootContext:d.state.floatingRootContext,floatingId:r,nested:i,onOpenChange:d.setOpen}),{store:d,internalStore:c.current}}function D3(e,n){const s=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(e===void 0)return;let c=!1;if(s.current!==null){const d=s.current,f=r.current,p=n.context.triggerElements.getById(d);f&&p===f&&(n.context.triggerElements.delete(d),c=!0),s.current=null,r.current=null}if(i!==null&&(s.current=e,r.current=i,n.context.triggerElements.add(e,i),c=!0),c){const d=n.context.triggerElements.size;n.select("open")&&n.state.triggerCount!==d&&n.set("triggerCount",d)}},[n,e])}function DS(e,n,s){const r=s?.id??null;(r||n)&&(e.activeTriggerId=r,e.activeTriggerElement=s??null)}function L3(e,n,s,r){const i=s.useState("isMountedByTrigger",e),c=D3(e,s),d=Me(f=>{if(c(f),!f)return;const p=s.select("open"),m=s.select("activeTriggerId");if(m===e){s.update({activeTriggerElement:f,...p?r:null});return}m==null&&p&&s.update({activeTriggerId:e,activeTriggerElement:f,...r})});return Re(()=>{i&&s.update({activeTriggerElement:n.current,...r})},[i,s,n,...Object.values(r)]),{registerTrigger:d,isMountedByThisTrigger:i}}function LS(e){const n=e.useState("open"),s=e.useState("triggerCount");Re(()=>{if(!n){e.state.triggerCount!==0&&e.set("triggerCount",0);return}const r=e.context.triggerElements.size,i={};if(e.state.triggerCount!==r&&(i.triggerCount=r),!e.select("activeTriggerId")&&r===1){const c=e.context.triggerElements.entries().next();if(!c.done){const[d,f]=c.value;i.activeTriggerId=d,i.activeTriggerElement=f}}(i.triggerCount!==void 0||i.activeTriggerId!==void 0)&&e.update(i)},[n,e,s])}function PS(e,n,s){const{mounted:r,setMounted:i,transitionStatus:c}=ac(e);n.useSyncedValues({mounted:r,transitionStatus:c});const d=Me(()=>{i(!1),n.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1,preventUnmountingOnClose:!1}),n.context.onOpenChangeComplete?.(!1)}),f=n.useState("preventUnmountingOnClose");return br({enabled:r&&!e&&!f,open:e,ref:n.context.popupRef,onComplete(){e||d()}}),{forceUnmount:d,transitionStatus:c}}function BS(e,n){e.useSyncedValues(n),Re(()=>()=>{e.update({activeTriggerProps:an,inactiveTriggerProps:an,popupProps:an})},[e])}function P3(e,n){Re(()=>{!n&&e.state.openMethod!==null&&e.set("openMethod",null)},[n,e]),Re(()=>()=>{e.state.openMethod!==null&&e.set("openMethod",null)},[e])}class Gd{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(n,s){const r=this.idMap.get(n);r!==s&&(r!==void 0&&this.elementsSet.delete(r),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 B3(){return new Vd({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new Gd,floatingId:void 0,syncOnly:!1,nested:!1,onOpenChange:void 0})}function IS(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:B3(),floatingId:void 0,triggerCount:0,preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:an,inactiveTriggerProps:an,popupProps:an}}function US(e,n,s=!1){return new Vd({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:e,floatingId:n,syncOnly:!0,nested:s,onOpenChange:void 0})}const Ai=Te(e=>e.triggerIdProp??e.activeTriggerId),Yh=Te(e=>e.openProp??e.open),v1=Te(e=>(e.popupElement?.id??e.floatingId)||void 0);function HS(e,n){return n!==void 0&&Yh(e)&&Ai(e)===n}function I3(e,n){return HS(e,n)?!0:n!==void 0&&Yh(e)&&Ai(e)==null&&e.triggerCount===1}const qS={open:Yh,mounted:Te(e=>e.mounted),transitionStatus:Te(e=>e.transitionStatus),floatingRootContext:Te(e=>e.floatingRootContext),triggerCount:Te(e=>e.triggerCount),preventUnmountingOnClose:Te(e=>e.preventUnmountingOnClose),payload:Te(e=>e.payload),activeTriggerId:Ai,activeTriggerElement:Te(e=>e.mounted?e.activeTriggerElement:null),popupId:v1,isTriggerActive:Te((e,n)=>n!==void 0&&Ai(e)===n),isOpenedByTrigger:Te((e,n)=>HS(e,n)),isMountedByTrigger:Te((e,n)=>n!==void 0&&Ai(e)===n&&e.mounted),triggerProps:Te((e,n)=>n?e.activeTriggerProps:e.inactiveTriggerProps),triggerPopupId:Te((e,n)=>I3(e,n)?v1(e):void 0),popupProps:Te(e=>e.popupProps),popupElement:Te(e=>e.popupElement),positionerElement:Te(e=>e.positionerElement)};function VS(e){const{open:n=!1,onOpenChange:s,elements:r={}}=e,i=Ud(),c=Hd()!=null,d=fa(()=>new Vd({open:n,transitionStatus:void 0,onOpenChange:s,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Gd,floatingId:i,syncOnly:!1,nested:c})).current;return Re(()=>{const f={open:n,floatingId:i};r.reference!==void 0&&(f.referenceElement=r.reference,f.domReferenceElement=lt(r.reference)?r.reference:null),r.floating!==void 0&&(f.floatingElement=r.floating),d.update(f)},[n,i,r.reference,r.floating,d]),d.context.onOpenChange=s,d.context.nested=c,d}function U3(e={}){const{nodeId:n,externalTree:s}=e,r=VS(e),i=e.rootContext||r,c=i.useState("referenceElement"),d=i.useState("floatingElement"),f=i.useState("domReferenceElement"),p=i.useState("open"),m=i.useState("floatingId"),[h,x]=b.useState(null),[y,S]=b.useState(void 0),[w,_]=b.useState(void 0),j=b.useRef(null),k=fl(s),E=b.useMemo(()=>({reference:c,floating:d,domReference:f}),[c,d,f]),R=p3({...e,elements:{...E,...h&&{reference:h}}}),N=lt(y)?y:null,M=w===void 0?i.state.floatingElement:w;i.useSyncedValue("referenceElement",y??null),i.useSyncedValue("domReferenceElement",y===void 0?f:N),i.useSyncedValue("floatingElement",M);const A=b.useCallback(D=>{const H=lt(D)?{getBoundingClientRect:()=>D.getBoundingClientRect(),getClientRects:()=>D.getClientRects(),contextElement:D}:D;x(H),R.refs.setReference(H)},[R.refs]),O=b.useCallback(D=>{(lt(D)||D===null)&&(j.current=D,S(D)),(lt(R.refs.reference.current)||R.refs.reference.current===null||D!==null&&!lt(D))&&R.refs.setReference(D)},[R.refs,S]),L=b.useCallback(D=>{_(D),R.refs.setFloating(D)},[R.refs]),U=b.useMemo(()=>({...R.refs,setReference:O,setFloating:L,setPositionReference:A,domReference:j}),[R.refs,O,L,A]),P=b.useMemo(()=>({...R.elements,domReference:f}),[R.elements,f]),B=b.useMemo(()=>({...R,dataRef:i.context.dataRef,open:p,onOpenChange:i.setOpen,events:i.context.events,floatingId:m,refs:U,elements:P,nodeId:n,rootStore:i}),[R,U,P,n,i,p,m]);return Re(()=>{f&&(j.current=f)},[f]),Re(()=>{i.context.dataRef.current.floatingContext=B;const D=k?.nodesRef.current.find(H=>H.id===n);D&&(D.context=B)}),b.useMemo(()=>({...R,context:B,refs:U,elements:P,rootStore:i}),[R,U,P,B,i])}const Pp=dT&&Bj;function H3(e,n={}){const{enabled:s=!0,delay:r}=n,i="rootStore"in e?e.rootStore:e,{events:c,dataRef:d}=i.context,f=b.useRef(!1),p=b.useRef(null),m=b.useRef(!0),h=Zn();b.useEffect(()=>{const y=i.select("domReferenceElement");if(!s)return;const S=Ft(y);function w(){const k=i.select("domReferenceElement");!i.select("open")&&Ut(k)&&k===zn(xt(k))&&(f.current=!0)}function _(){m.current=!0}function j(){m.current=!1}return Xa(ct(S,"blur",w),Pp&&ct(S,"keydown",_,!0),Pp&&ct(S,"pointerdown",j,!0))},[i,s]),b.useEffect(()=>{if(!s)return;function y(S){if(S.reason===Vi||S.reason===Mh){const w=i.select("domReferenceElement");lt(w)&&(p.current=w,f.current=!0)}}return c.on("openchange",y),()=>{c.off("openchange",y)}},[c,s,i]);const x=b.useMemo(()=>{function y(){f.current=!1,p.current=null}return{onMouseLeave(){y()},onFocus(S){const w=S.currentTarget;if(f.current){if(p.current===w)return;y()}const _=En(S.nativeEvent);if(lt(_)){if(Pp&&!S.relatedTarget){if(!m.current&&!Ld(_))return}else if(!ST(_))return}const j=rd(S.relatedTarget,i.context.triggerElements),{nativeEvent:k,currentTarget:E}=S,R=typeof r=="function"?r():r;if(i.select("open")&&j||R===0||R===void 0){i.setOpen(!0,tt(Yu,k,E));return}h.start(R,()=>{f.current||i.setOpen(!0,tt(Yu,k,E))})},onBlur(S){y();const w=S.relatedTarget,_=S.nativeEvent,j=lt(w)&&w.hasAttribute(Yi("focus-guard"))&&w.getAttribute("data-type")==="outside";h.start(0,()=>{const k=i.select("domReferenceElement"),E=zn(xt(k));!w&&E===k||Ye(d.current.floatingContext?.refs.floating.current,E)||Ye(k,E)||j||rd(w??E,i.context.triggerElements)||i.setOpen(!1,tt(Yu,_))})}}},[d,r,i,h]);return b.useMemo(()=>s?{reference:x,trigger:x}:{},[s,x])}class Fh{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 Ba,this.restTimeout=new Ba,this.handleCloseOptions=void 0}static create(){return new Fh}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}const gd=new WeakMap;function hd(e){if(!e.performedPointerEventsMutation)return;const n=e.pointerEventsScopeElement;n&&gd.get(n)===e&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),gd.delete(n)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function $S(e,n){const{scopeElement:s,referenceElement:r,floatingElement:i}=n,c=gd.get(s);c&&c!==e&&hd(c),hd(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=s,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,gd.set(s,e),s.style.pointerEvents="none",r.style.pointerEvents="auto",i.style.pointerEvents="auto"}function Xh(e){const n=e.context.dataRef.current,s=fa(()=>n.hoverInteractionState??Fh.create()).current;return n.hoverInteractionState||(n.hoverInteractionState=s),Ch(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function q3(e,n={}){const{enabled:s=!0,closeDelay:r=0,nodeId:i}=n,c="rootStore"in e?e.rootStore:e,d=c.useState("open"),f=c.useState("floatingElement"),p=c.useState("domReferenceElement"),{dataRef:m}=c.context,h=fl(),x=Hd(),y=Xh(c),S=Zn(),w=Me(()=>Vj(m.current.openEvent?.type,y.interactedInside)),_=Me(()=>CT(m.current.openEvent?.type)),j=Me(()=>{hd(y)});Re(()=>{d||(y.pointerType=void 0,y.restTimeoutPending=!1,y.interactedInside=!1,j())},[d,y,j]),b.useEffect(()=>j,[j]),Re(()=>{if(s&&d&&y.handleCloseOptions?.blockPointerEvents&&_()&&lt(p)&&f){const k=p,E=f,R=xt(f),N=h?.nodesRef.current.find(L=>L.id===x)?.context?.elements.floating;N&&(N.style.pointerEvents="");const M=y.pointerEventsScopeElement!==E?y.pointerEventsScopeElement:null,A=N!==E?N:null,O=y.handleCloseOptions?.getScope?.()??M??A??k.closest("[data-rootownerid]")??R.body;return $S(y,{scopeElement:O,referenceElement:k,floatingElement:E}),()=>{j()}}},[s,d,p,f,y,_,h,x,j]),b.useEffect(()=>{if(!s)return;function k(){return!!(h&&x&&mr(h.nodesRef.current,x).length>0)}function E(L){const U=ld(r,"close",y.pointerType),P=()=>{c.setOpen(!1,tt(In,L)),h?.events.emit("floating.closed",L)};U?y.openChangeTimeout.start(U,P):(y.openChangeTimeout.clear(),P())}function R(L){const U=En(L);if(!jT(U)){y.interactedInside=!1;return}y.interactedInside=U?.closest("[aria-haspopup]")!=null}function N(){y.openChangeTimeout.clear(),S.clear(),h?.events.off("floating.closed",A),j()}function M(L){if(k()&&h){h.events.on("floating.closed",A);return}if(rd(L.relatedTarget,c.context.triggerElements))return;const U=m.current.floatingContext?.nodeId??i,P=L.relatedTarget;if(!(h&&U&&lt(P)&&mr(h.nodesRef.current,U,!1).some(D=>Ye(D.context?.elements.floating,P)))){if(y.handler){y.handler(L);return}j(),w()||E(L)}}function A(L){!h||!x||k()||S.start(0,()=>{h.events.off("floating.closed",A),c.setOpen(!1,tt(In,L)),h.events.emit("floating.closed",L)})}const O=f;return Xa(O&&ct(O,"mouseenter",N),O&&ct(O,"mouseleave",M),O&&ct(O,"pointerdown",R,!0),()=>{h?.events.off("floating.closed",A)})},[s,f,c,m,r,i,w,j,y,h,x,S])}const V3={current:null};function $3(e,n={}){const{enabled:s=!0,delay:r=0,handleClose:i=null,mouseOnly:c=!1,restMs:d=0,move:f=!0,triggerElementRef:p=V3,externalTree:m,isActiveTrigger:h=!0,getHandleCloseContext:x,isClosing:y,shouldOpen:S}=n,w="rootStore"in e?e.rootStore:e,{dataRef:_,events:j}=w.context,k=fl(m),E=Xh(w),R=b.useRef(!1),N=cn(i),M=cn(r),A=cn(d),O=cn(s),L=cn(S),U=cn(y),P=Me(()=>Vj(_.current.openEvent?.type,E.interactedInside)),B=Me(()=>L.current?.()!==!1),D=Me((Q,q,X)=>{const Z=w.context.triggerElements;if(Z.hasElement(q))return!Q||!Ye(Q,q);if(!lt(X))return!1;const G=X;return Z.hasMatchingElement(K=>Ye(K,G))&&(!Q||!Ye(Q,G))}),H=Me(()=>{if(!E.handler)return;xt(w.select("domReferenceElement")).removeEventListener("mousemove",E.handler),E.handler=void 0}),Y=Me(()=>{hd(E)});return h&&(E.handleCloseOptions=N.current?.__options),b.useEffect(()=>H,[H]),b.useEffect(()=>{if(!s)return;function Q(q){q.open?R.current=!1:(R.current=q.reason===In,H(),E.openChangeTimeout.clear(),E.restTimeout.clear(),E.blockMouseMove=!0,E.restTimeoutPending=!1)}return j.on("openchange",Q),()=>{j.off("openchange",Q)}},[s,j,E,H]),b.useEffect(()=>{if(!s)return;function Q(G,K=!0){const I=ld(M.current,"close",E.pointerType);I?E.openChangeTimeout.start(I,()=>{w.setOpen(!1,tt(In,G)),k?.events.emit("floating.closed",G)}):K&&(E.openChangeTimeout.clear(),w.setOpen(!1,tt(In,G)),k?.events.emit("floating.closed",G))}const q=p.current??(h?w.select("domReferenceElement"):null);if(!lt(q))return;function X(G){if(E.openChangeTimeout.clear(),E.blockMouseMove=!1,c&&!Fr(E.pointerType))return;const K=V0(A.current),I=ld(M.current,"open",E.pointerType),V=En(G),$=G.currentTarget??null,W=w.select("domReferenceElement");let oe=$;if(lt(V)&&!w.context.triggerElements.hasElement(V)){for(const Ee of w.context.triggerElements.elements())if(Ye(Ee,V)){oe=Ee;break}}lt($)&&lt(W)&&!w.context.triggerElements.hasElement($)&&Ye($,W)&&(oe=W);const ce=oe==null?!1:D(W,oe,V),se=w.select("open"),ie=U.current?.()??w.select("transitionStatus")==="ending",te=!se&&ie&&R.current,ke=!ce&&lt(oe)&&lt(W)&&Ye(W,oe)&&te,$e=K>0&&!I,be=ce&&(se||te)||ke,Se=!se||ce;if(be){B()&&w.setOpen(!0,tt(In,G,oe));return}$e||(I?E.openChangeTimeout.start(I,()=>{Se&&B()&&w.setOpen(!0,tt(In,G,oe))}):Se&&B()&&w.setOpen(!0,tt(In,G,oe)))}function Z(G){if(P()){Y();return}H();const K=w.select("domReferenceElement"),I=xt(K);E.restTimeout.clear(),E.restTimeoutPending=!1;const V=_.current.floatingContext??x?.();if(rd(G.relatedTarget,w.context.triggerElements))return;if(N.current&&V){w.select("open")||E.openChangeTimeout.clear();const W=p.current;E.handler=N.current({...V,tree:k,x:G.clientX,y:G.clientY,onClose(){Y(),H(),O.current&&!P()&&W===w.select("domReferenceElement")&&Q(G,!0)}}),I.addEventListener("mousemove",E.handler),E.handler(G);return}(E.pointerType==="touch"?!Ye(w.select("floatingElement"),G.relatedTarget):!0)&&Q(G)}return f?Xa(ct(q,"mousemove",X,{once:!0}),ct(q,"mouseenter",X),ct(q,"mouseleave",Z)):Xa(ct(q,"mouseenter",X),ct(q,"mouseleave",Z))},[H,Y,_,M,w,s,N,E,h,D,P,c,f,A,p,k,O,x,U,B]),b.useMemo(()=>{if(!s)return;function Q(q){E.pointerType=q.pointerType}return{onPointerDown:Q,onPointerEnter:Q,onMouseMove(q){const{nativeEvent:X}=q,Z=q.currentTarget,G=w.select("domReferenceElement"),K=w.select("open"),I=D(G,Z,q.target);if(c&&!Fr(E.pointerType))return;if(K&&I&&E.handleCloseOptions?.blockPointerEvents){const W=w.select("floatingElement");if(W){const oe=E.handleCloseOptions?.getScope?.()??Z.ownerDocument.body;$S(E,{scopeElement:oe,referenceElement:Z,floatingElement:W})}}const V=V0(A.current);if(K&&!I||V===0||!I&&E.restTimeoutPending&&q.movementX**2+q.movementY**2<2)return;E.restTimeout.clear();function $(){if(E.restTimeoutPending=!1,P())return;const W=w.select("open");!E.blockMouseMove&&(!W||I)&&B()&&w.setOpen(!0,tt(In,X,Z))}E.pointerType==="touch"?Zr.flushSync(()=>{$()}):I&&K?$():(E.restTimeoutPending=!0,E.restTimeout.start(V,$))}}},[s,E,P,D,c,w,A,B])}const G3="Escape";function Yd(e,n,s){switch(e){case"vertical":return n;case"horizontal":return s;default:return n||s}}function Eu(e,n){return Yd(n,e===Th||e===nc,e===ur||e===dr)}function Bp(e,n,s){return Yd(n,e===nc,s?e===ur:e===dr)||e==="Enter"||e===" "||e===""}function Y3(e,n,s){return Yd(n,s?e===ur:e===dr,e===nc)}function F3(e,n,s,r){const i=s?e===dr:e===ur,c=e===Th;return n==="both"||n==="horizontal"&&r&&r>1?e===G3:Yd(n,i,c)}function X3(e,n){const{listRef:s,activeIndex:r,onNavigate:i=()=>{},enabled:c=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:x=!1,focusItemOnOpen:y="auto",focusItemOnHover:S=!0,openOnArrowKeyDown:w=!0,disabledIndices:_=void 0,orientation:j="vertical",parentOrientation:k,cols:E=1,id:R,resetOnPointerLeave:N=!0,externalTree:M}=n,A="rootStore"in e?e.rootStore:e,O=A.useState("open"),L=A.useState("floatingElement"),U=A.useState("domReferenceElement"),P=A.context.dataRef,B=od(L),D=Pg(U),H=cn(B),Y=Hd(),Q=fl(M),q=b.useRef(y),X=b.useRef(d??-1),Z=b.useRef(null),G=b.useRef(!0),K=Me(ve=>{i(X.current===-1?null:X.current,ve)}),I=b.useRef(K),V=b.useRef(!!L),$=b.useRef(O),W=b.useRef(!1),oe=b.useRef(!1),ce=b.useRef(null),se=cn(_),ie=cn(O),te=cn(d),ke=cn(N),$e=Qo(),be=Qo(),Se=Me(()=>{function ve(Be){x?Q?.events.emit("virtualfocus",Be):ce.current=Xu(Be,{sync:W.current,preventScroll:!0})}const le=s.current[X.current],ye=oe.current;le&&ve(le),(W.current?Be=>Be():Be=>$e.request(Be))(()=>{const Be=s.current[X.current]||le;if(!Be)return;le||ve(Be),_e&&(ye||!G.current)&&Be.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Re(()=>{P.current.orientation=j},[P,j]),Re(()=>{c&&(O&&L?(X.current=d??-1,q.current&&d!=null&&(oe.current=!0,K())):V.current&&(X.current=-1,I.current()))},[c,O,L,d,K]),Re(()=>{if(c){if(!O){W.current=!1;return}if(L)if(r==null){if(W.current=!1,te.current!=null)return;if(V.current&&(X.current=-1,Se()),(!$.current||!V.current)&&q.current&&(Z.current!=null||q.current===!0&&Z.current==null)){let ve=0;const le=()=>{s.current[0]==null?(ve<2&&(ve?je=>be.request(je):queueMicrotask)(le),ve+=1):(X.current=Z.current==null||Bp(Z.current,j,h)||m?Fu(s):Ug(s),Z.current=null,K())};le()}}else Gi(s.current,r)||(X.current=r,Se(),oe.current=!1)}},[c,O,L,r,te,m,s,j,h,K,Se,be]),Re(()=>{if(!c||L||!Q||x||!V.current)return;const ve=Q.nodesRef.current,le=ve.find(Be=>Be.id===Y)?.context?.elements.floating,ye=zn(xt(L)),je=ve.some(Be=>Be.context&&Ye(Be.context.elements.floating,ye));le&&!je&&G.current&&le.focus({preventScroll:!0})},[c,L,Q,Y,x]),Re(()=>{I.current=K,$.current=O,V.current=!!L}),Re(()=>{O||(Z.current=null,q.current=y)},[O,y]);const Ee=r!=null,ze=Me(ve=>{if(!ie.current)return;const le=s.current.indexOf(ve.currentTarget);le!==-1&&(X.current!==le||r!==le)&&(X.current=le,K(ve))}),De=Me(()=>k??Q?.nodesRef.current.find(ve=>ve.id===Y)?.context?.dataRef?.current.orientation),xe=Me(()=>Fu(s,se.current)),Ne=Me(ve=>{if(G.current=!1,W.current=!0,ve.which===229||!ie.current&&ve.currentTarget===H.current)return;if(m&&F3(ve.key,j,h,E)){Eu(ve.key,De())||ua(ve),A.setOpen(!1,tt($0,ve.nativeEvent)),Ut(U)&&(x?Q?.events.emit("virtualfocus",U):U.focus());return}const le=X.current,ye=Fu(s,_),je=Ug(s,_);if(D||(ve.key==="Home"&&(ua(ve),X.current=ye,K(ve)),ve.key==="End"&&(ua(ve),X.current=je,K(ve))),E>1){const Be=Array.from({length:s.current.length},()=>({width:1,height:1})),Ze=Wj(Be,E,!1),_t=Ze.findIndex(ut=>ut!=null&&!Es(s.current,ut,_)),Ht=Ze.reduce((ut,it,Et)=>it!=null&&!Es(s.current,it,_)?Et:ut,-1),vt=Ze[Jj(Ze.map(ut=>ut!=null?s.current[ut]:null),{event:ve,orientation:j,loopFocus:p,rtl:h,cols:E,disabledIndices:tS([...(typeof _!="function"?_:null)||s.current.map((ut,it)=>Es(s.current,it,_)?it:void 0),void 0],Ze),minIndex:_t,maxIndex:Ht,prevIndex:eS(X.current>je?ye:X.current,Be,Ze,E,ve.key===nc?"bl":ve.key===(h?ur:dr)?"tr":"tl"),stopEvent:!0})];if(vt!=null&&(X.current=vt,K(ve)),j==="both")return}if(Eu(ve.key,j)){if(ua(ve),O&&!x&&zn(ve.currentTarget.ownerDocument)===ve.currentTarget){X.current=Bp(ve.key,j,h)?ye:je,K(ve);return}Bp(ve.key,j,h)?p?le>=je?f&&le!==s.current.length?X.current=-1:(W.current=!1,X.current=ye):X.current=On(s.current,{startingIndex:le,disabledIndices:_}):X.current=Math.min(je,On(s.current,{startingIndex:le,disabledIndices:_})):p?le<=ye?f&&le!==-1?X.current=s.current.length:(W.current=!1,X.current=je):X.current=On(s.current,{startingIndex:le,decrement:!0,disabledIndices:_}):X.current=Math.max(ye,On(s.current,{startingIndex:le,decrement:!0,disabledIndices:_})),Gi(s.current,X.current)&&(X.current=-1),K(ve)}}),_e=b.useMemo(()=>({onFocus(le){W.current=!0,ze(le)},onClick:({currentTarget:le})=>le.focus({preventScroll:!0}),onMouseMove(le){W.current=!0,oe.current=!1,S&&ze(le)},onPointerLeave(le){if(!ie.current||!G.current||le.pointerType==="touch")return;W.current=!0;const ye=le.relatedTarget;if(!(!S||s.current.includes(ye))&&ke.current&&(ce.current?.(),ce.current=null,X.current=-1,K(le),!x)){const je=H.current,Be=zn(xt(je));je&&Ye(je,Be)&&je.focus({preventScroll:!0})}}}),[ze,ie,H,S,s,K,ke,x]),Le=b.useMemo(()=>x&&O&&Ee&&{"aria-activedescendant":`${R}-${r}`},[x,O,Ee,R,r]),Ge=b.useMemo(()=>({"aria-orientation":j==="both"?void 0:j,...D?{}:Le,onKeyDown(ve){if(ve.key==="Tab"&&ve.shiftKey&&O&&!x){const le=En(ve.nativeEvent);if(le&&!Ye(H.current,le))return;ua(ve),A.setOpen(!1,tt(Pd,ve.nativeEvent)),Ut(U)&&U.focus();return}Ne(ve)},onPointerMove(){G.current=!0}}),[Le,Ne,H,j,D,A,O,x,U]),qe=b.useMemo(()=>{function ve(je){A.setOpen(!0,tt($0,je.nativeEvent,je.currentTarget))}function le(je){y==="auto"&&kh(je.nativeEvent)&&(q.current=!x)}function ye(je){q.current=y,y==="auto"&&Uj(je.nativeEvent)&&(q.current=!0)}return{onKeyDown(je){const Be=A.select("open");G.current=!1;const Ze=je.key.startsWith("Arrow"),_t=Y3(je.key,De(),h),Ht=Eu(je.key,j),vt=(m?_t:Ht)||je.key==="Enter"||je.key.trim()==="";if(x&&Be)return Ne(je);if(!(!Be&&!w&&Ze)){if(vt){const ut=Eu(je.key,De());Z.current=m&&ut?null:je.key}if(m){_t&&(ua(je),Be?(X.current=xe(),K(je)):ve(je));return}Ht&&(te.current!=null&&(X.current=te.current),ua(je),!Be&&w?ve(je):Ne(je),Be&&K(je))}},onFocus(je){A.select("open")&&!x&&(X.current=-1,K(je))},onPointerDown:ye,onPointerEnter:ye,onMouseDown:le,onClick:le}},[Ne,y,xe,m,K,A,w,j,De,h,te,x]),Oe=b.useMemo(()=>({...Le,...qe}),[Le,qe]);return b.useMemo(()=>c?{reference:Oe,floating:Ge,item:_e,trigger:qe}:{},[c,Oe,Ge,qe,_e])}function K3(e,n){const{listRef:s,elementsRef:r,activeIndex:i,onMatch:c,onTyping:d,enabled:f=!0,resetMs:p=750,selectedIndex:m=null}=n,h="rootStore"in e?e.rootStore:e,x=h.useState("open"),y=Zn(),S=b.useRef(""),w=b.useRef(m??i??-1),_=b.useRef(null),j=Me(R=>{function N(D){const H=r?.current[D];return!H||Bd(H)}function M(D,H,Y=0){if(D.length===0)return-1;const Q=(Y%D.length+D.length)%D.length,q=H.toLocaleLowerCase();for(let X=0;X<D.length;X+=1){const Z=(Q+X)%D.length;if(!(!D[Z]?.toLocaleLowerCase().startsWith(q)||!N(Z)))return Z}return-1}const A=s.current;if(S.current.length>0&&R.key===" "&&(ua(R),d?.(!0)),S.current.length>0&&S.current[0]!==" "&&M(A,S.current)===-1&&R.key!==" "&&d?.(!1),A==null||R.key.length!==1||R.ctrlKey||R.metaKey||R.altKey)return;x&&R.key!==" "&&(ua(R),d?.(!0));const O=S.current==="";O&&(w.current=m??i??-1),A.every(D=>D?D[0]?.toLocaleLowerCase()!==D[1]?.toLocaleLowerCase():!0)&&S.current===R.key&&(S.current="",w.current=_.current),S.current+=R.key,y.start(p,()=>{S.current="",w.current=_.current,d?.(!1)});const P=((O?m??i??-1:w.current)??0)+1,B=M(A,S.current,P);B!==-1?(c?.(B),_.current=B):R.key!==" "&&(S.current="",d?.(!1))}),k=Me(R=>{const N=R.relatedTarget,M=h.select("domReferenceElement"),A=h.select("floatingElement");Ye(M,N)||Ye(A,N)||(y.clear(),S.current="",w.current=_.current,d?.(!1))});Re(()=>{!x&&m!==null||(y.clear(),_.current=null,S.current!==""&&(S.current=""))},[x,m,y]),Re(()=>{x&&S.current===""&&(w.current=m??i??-1)},[x,m,i]);const E=b.useMemo(()=>({onKeyDown:j,onBlur:k}),[j,k]);return b.useMemo(()=>f?{reference:E,floating:E}:{},[f,E])}const y1=.1,Q3=y1*y1,Dt=.5;function ku(e,n,s,r,i,c){return r>=n!=c>=n&&e<=(i-s)*(n-r)/(c-r)+s}function Nu(e,n,s,r,i,c,d,f,p,m){let h=!1;return ku(e,n,s,r,i,c)&&(h=!h),ku(e,n,i,c,d,f)&&(h=!h),ku(e,n,d,f,p,m)&&(h=!h),ku(e,n,p,m,s,r)&&(h=!h),h}function Z3(e,n,s){return e>=s.x&&e<=s.x+s.width&&n>=s.y&&n<=s.y+s.height}function Ru(e,n,s,r,i,c){const d=Math.min(s,i),f=Math.max(s,i),p=Math.min(r,c),m=Math.max(r,c);return e>=d&&e<=f&&n>=p&&n<=m}function J3(e={}){const{blockPointerEvents:n=!1}=e,s=new Ba,r=({x:i,y:c,placement:d,elements:f,onClose:p,nodeId:m,tree:h})=>{const x=d?.split("-")[0];let y=!1,S=null,w=null,_=typeof performance<"u"?performance.now():0;function j(E,R){const N=performance.now(),M=N-_;if(S===null||w===null||M===0)return S=E,w=R,_=N,!1;const A=E-S,O=R-w,L=A*A+O*O,U=M*M*Q3;return S=E,w=R,_=N,L<U}function k(){s.clear(),p()}return function(R){s.clear();const N=f.domReference,M=f.floating;if(!N||!M||x==null||i==null||c==null)return;const{clientX:A,clientY:O}=R,L=En(R),U=R.type==="mouseleave",P=Ye(M,L),B=Ye(N,L);if(P&&(y=!0,!U))return;if(B&&(y=!1,!U)){y=!0;return}if(U&&lt(R.relatedTarget)&&Ye(M,R.relatedTarget))return;function D(){return!!(h&&mr(h.nodesRef.current,m).length>0)}function H(){D()||k()}if(D())return;const Y=N.getBoundingClientRect(),Q=M.getBoundingClientRect(),q=i>Q.right-Q.width/2,X=c>Q.bottom-Q.height/2,Z=Q.width>Y.width,G=Q.height>Y.height,K=(Z?Y:Q).left,I=(Z?Y:Q).right,V=(G?Y:Q).top,$=(G?Y:Q).bottom;if(x==="top"&&c>=Y.bottom-1||x==="bottom"&&c<=Y.top+1||x==="left"&&i>=Y.right-1||x==="right"&&i<=Y.left+1){H();return}let W=!1;switch(x){case"top":W=Ru(A,O,K,Y.top+1,I,Q.bottom-1);break;case"bottom":W=Ru(A,O,K,Q.top+1,I,Y.bottom-1);break;case"left":W=Ru(A,O,Q.right-1,$,Y.left+1,V);break;case"right":W=Ru(A,O,Y.right-1,$,Q.left+1,V);break}if(W)return;if(y&&!Z3(A,O,Y)){H();return}if(!U&&j(A,O)){H();return}let oe=!1;switch(x){case"top":{const ce=Z?Dt/2:Dt*4,se=Z||q?i+ce:i-ce,ie=Z?i-ce:q?i+ce:i-ce,te=c+Dt+1,ke=q||Z?Q.bottom-Dt:Q.top,$e=q?Z?Q.bottom-Dt:Q.top:Q.bottom-Dt;oe=Nu(A,O,se,te,ie,te,Q.left,ke,Q.right,$e);break}case"bottom":{const ce=Z?Dt/2:Dt*4,se=Z||q?i+ce:i-ce,ie=Z?i-ce:q?i+ce:i-ce,te=c-Dt,ke=q||Z?Q.top+Dt:Q.bottom,$e=q?Z?Q.top+Dt:Q.bottom:Q.top+Dt;oe=Nu(A,O,se,te,ie,te,Q.left,ke,Q.right,$e);break}case"left":{const ce=G?Dt/2:Dt*4,se=G||X?c+ce:c-ce,ie=G?c-ce:X?c+ce:c-ce,te=i+Dt+1,ke=X||G?Q.right-Dt:Q.left,$e=X?G?Q.right-Dt:Q.left:Q.right-Dt;oe=Nu(A,O,ke,Q.top,$e,Q.bottom,te,se,te,ie);break}case"right":{const ce=G?Dt/2:Dt*4,se=G||X?c+ce:c-ce,ie=G?c-ce:X?c+ce:c-ce,te=i-Dt,ke=X||G?Q.left+Dt:Q.right,$e=X?G?Q.left+Dt:Q.right:Q.left+Dt;oe=Nu(A,O,te,se,te,ie,ke,Q.top,$e,Q.bottom);break}}oe?y||s.start(40,H):H()}};return r.__options={...e,blockPointerEvents:n},r}const W3={...qS,disabled:Te(e=>e.disabled),instantType:Te(e=>e.instantType),isInstantPhase:Te(e=>e.isInstantPhase),trackCursorAxis:Te(e=>e.trackCursorAxis),disableHoverablePopup:Te(e=>e.disableHoverablePopup),lastOpenChangeReason:Te(e=>e.openChangeReason),closeOnClick:Te(e=>e.closeOnClick),closeDelay:Te(e=>e.closeDelay),hasViewport:Te(e=>e.hasViewport)};class Kh extends Gh{constructor(n,s,r=!1){const i=new Gd,c={...eM(),...n};c.floatingRootContext=US(i,s,r),super(c,{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:i},W3)}setOpen=(n,s)=>{const r=s.reason,i=r===In,c=n&&r===Yu,d=!n&&(r===Vi||r===Mh);if(s.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},this.context.onOpenChange?.(n,s),s.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(n,s);const f=()=>{const p={open:n,openChangeReason:r};c?p.instantType="focus":d?p.instantType="dismiss":r===In&&(p.instantType=void 0),DS(p,n,s.trigger),this.update(p)};i?Zr.flushSync(f):f()};cancelPendingOpen(n){this.state.floatingRootContext.dispatchOpenChange(!1,tt(Vi,n))}static useStore(n,s){return zS(n,(i,c)=>new Kh(s,i,c)).store}}function eM(){return{...IS(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}const tM=Oj(function(n){const{disabled:s=!1,defaultOpen:r=!1,open:i,disableHoverablePopup:c=!1,trackCursorAxis:d="none",actionsRef:f,onOpenChange:p,onOpenChangeComplete:m,handle:h,triggerId:x,defaultTriggerId:y=null,children:S}=n,w=Kh.useStore(h?.store,{open:r,openProp:i,activeTriggerId:y,triggerIdProp:x});wh(()=>{i===void 0&&w.state.open===!1&&r===!0&&w.update({open:!0,activeTriggerId:y})}),w.useControlledProp("openProp",i),w.useControlledProp("triggerIdProp",x),w.useContextCallback("onOpenChange",p),w.useContextCallback("onOpenChangeComplete",m);const _=w.useState("open"),j=!s&&_,k=w.useState("activeTriggerId"),E=w.useState("mounted"),R=w.useState("payload");w.useSyncedValues({trackCursorAxis:d,disableHoverablePopup:c}),w.useSyncedValue("disabled",s),LS(w);const{forceUnmount:N,transitionStatus:M}=PS(j,w),A=w.useState("isInstantPhase"),O=w.useState("instantType"),L=w.useState("lastOpenChangeReason"),U=b.useRef(null);Re(()=>{_&&s&&w.setOpen(!1,tt($j))},[_,s,w]),Re(()=>{M==="ending"&&L===Ts||M!=="ending"&&A?(O!=="delay"&&(U.current=O),w.set("instantType","delay")):U.current!==null&&(w.set("instantType",U.current),U.current=null)},[M,A,L,O,w]),Re(()=>{j&&k==null&&w.set("payload",void 0)},[w,k,j]);const P=b.useCallback(()=>{w.setOpen(!1,tt(Gj))},[w]);b.useImperativeHandle(f,()=>({unmount:N,close:P}),[N,P]);const B=j||E||!s&&d!=="none";return o.jsxs(zj.Provider,{value:w,children:[B&&o.jsx(nM,{store:w,disabled:s,trackCursorAxis:d}),typeof S=="function"?S({payload:R}):S]})});function nM({store:e,disabled:n,trackCursorAxis:s}){const r=e.useState("floatingRootContext"),i=Vh(r,{enabled:!n,referencePress:()=>e.select("closeOnClick")}),c=AA(r,{enabled:!n&&s!=="none",axis:s==="none"?void 0:s}),d=b.useMemo(()=>Na(c.reference,i.reference),[c.reference,i.reference]),f=b.useMemo(()=>Na(c.trigger,i.trigger),[c.trigger,i.trigger]),p=b.useMemo(()=>Na($d,c.floating,i.floating),[c.floating,i.floating]);return BS(e,{activeTriggerProps:d,inactiveTriggerProps:f,popupProps:p}),null}let Vr=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Kr.startingStyle]="startingStyle",e[e.endingStyle=Kr.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 aM={[xd.popupOpen]:""},sM={[xd.popupOpen]:"",[xd.pressed]:""},rM={[Vr.open]:""},oM={[Vr.closed]:""},lM={[Vr.anchorHidden]:""},GS={open(e){return e?aM:null}},iM={open(e){return e?sM:null}},pl={open(e){return e?rM:oM},anchorHidden(e){return e?lM:null}};function vr(e){return Ud(e,"base-ui")}const YS=b.createContext(void 0);function cM(){return b.useContext(YS)}let uM=(function(e){return e[e.popupOpen=xd.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const dM=600,FS="data-base-ui-tooltip-trigger";function _1(e){if("composedPath"in e){const s=e.composedPath();for(let r=0;r<s.length;r+=1){const i=s[r];if(lt(i))return i}}const n=e.target;return lt(n)?n:null}function fM(e){let n=e;for(;n;){if(n.hasAttribute(FS))return n;const s=n.parentElement;if(s){n=s;continue}const r=n.getRootNode();n="host"in r&&lt(r.host)?r.host:null}return null}const mM=oT(function(n,s){const{render:r,className:i,style:c,handle:d,payload:f,disabled:p,delay:m,closeOnClick:h=!0,closeDelay:x,id:y,...S}=n,w=tc(!0),_=d?.store??w;if(!_)throw new Error(Rn(82));const j=vr(y),k=_.useState("isTriggerActive",j),E=_.useState("isOpenedByTrigger",j),R=_.useState("floatingRootContext"),N=b.useRef(null),M=m??dM,A=x??0,{registerTrigger:O,isMountedByThisTrigger:L}=L3(j,N,_,{payload:f,closeOnClick:h,closeDelay:A}),U=cM(),{delayRef:P,isInstantPhase:B,hasProvider:D}=TT(R,{open:E}),H=Xh(R);_.useSyncedValue("isInstantPhase",B);const Y=_.useState("disabled"),Q=p??Y,q=cn(Q),X=_.useState("trackCursorAxis"),Z=_.useState("disableHoverablePopup"),G=b.useRef(!1),K=Zn(),I=b.useRef(void 0);function V(){const be=U?.delay,Se=typeof P.current=="object"?P.current.open:void 0;let Ee=M;return D&&(Se!==0?Ee=m??be??M:Ee=0),Ee}function $(be){const Se=N.current;if(!Se||!be)return!1;const Ee=fM(be);return Ee!==null&&Ee!==Se&&Ye(Se,Ee)}function W(be){const Se=$(be);return G.current=Se,Se&&(H.openChangeTimeout.clear(),H.restTimeout.clear(),H.restTimeoutPending=!1,K.clear()),Se}const oe=$3(R,{enabled:!Q,mouseOnly:!0,move:!1,handleClose:!Z&&X!=="both"?J3():null,restMs:V,delay(){const be=typeof P.current=="object"?P.current.close:void 0;let Se=A;return x==null&&D&&(Se=be),{close:Se}},triggerElementRef:N,isActiveTrigger:k,isClosing:()=>_.select("transitionStatus")==="ending",shouldOpen(){return!G.current}}),ce=H3(R,{enabled:!Q}).reference,se=be=>{const Se=G.current,Ee=_1(be),ze=W(Ee),De=N.current,xe=De&&Ee&&Ye(De,Ee);if(ze&&_.select("open")&&_.select("lastOpenChangeReason")===In){_.setOpen(!1,tt(In,be));return}if(Se&&!ze&&xe&&!q.current&&!_.select("open")&&De&&Fr(I.current)){const Ne=()=>{!G.current&&!q.current&&!_.select("open")&&_.setOpen(!0,tt(In,be,De))},_e=V();_e===0?(K.clear(),Ne()):K.start(_e,Ne)}},ie=_.useState("triggerProps",L);return Lt("button",n,{state:{open:E},ref:[s,O,N],props:[oe,ce,L||X!=="none"?ie:void 0,{onMouseOver(be){se(be.nativeEvent)},onFocus(be){$(_1(be.nativeEvent))&&be.preventBaseUIHandler()},onMouseLeave(){G.current=!1,K.clear(),I.current=void 0},onPointerEnter(be){I.current=be.pointerType},onPointerDown(be){I.current=be.pointerType,_.set("closeOnClick",h),h&&!_.select("open")&&_.cancelPendingOpen(be.nativeEvent)},onClick(be){h&&!_.select("open")&&_.cancelPendingOpen(be.nativeEvent)},id:j,[uM.triggerDisabled]:Q?"":void 0,[FS]:Q?void 0:""},S],stateAttributesMapping:GS})}),XS=b.createContext(void 0);function pM(){const e=b.useContext(XS);if(e===void 0)throw new Error(Rn(70));return e}const gM=b.forwardRef(function(n,s){const{children:r,container:i,className:c,render:d,style:f,...p}=n,{portalNode:m,portalSubtree:h}=yS({container:i,ref:s,componentProps:n,elementProps:p});return!h&&!m?null:o.jsxs(b.Fragment,{children:[h,m&&Zr.createPortal(r,m)]})}),hM=b.forwardRef(function(n,s){const{keepMounted:r=!1,...i}=n;return tc().useState("mounted")||r?o.jsx(XS.Provider,{value:r,children:o.jsx(gM,{ref:s,...i})}):null}),KS=b.createContext(void 0);function QS(){const e=b.useContext(KS);if(e===void 0)throw new Error(Rn(71));return e}const xM=b.createContext(void 0);function Qh(){return b.useContext(xM)?.direction??"ltr"}const bM=e=>({name:"arrow",options:e,async fn(n){const{x:s,y:r,placement:i,rects:c,platform:d,elements:f,middlewareData:p}=n,{element:m,padding:h=0,offsetParent:x="real"}=Ms(e,n)||{};if(m==null)return{};const y=Zj(h),S={x:s,y:r},w=Ph(i),_=Lh(w),j=await d.getDimensions(m),k=w==="y",E=k?"top":"left",R=k?"bottom":"right",N=k?"clientHeight":"clientWidth",M=c.reference[_]+c.reference[w]-S[w]-c.floating[_],A=S[w]-c.reference[w],O=x==="real"?await d.getOffsetParent?.(m):f.floating;let L=f.floating[N]||c.floating[_];(!L||!await d.isElement?.(O))&&(L=f.floating[N]||c.floating[_]);const U=M/2-A/2,P=L/2-j[_]/2-1,B=Math.min(y[E],P),D=Math.min(y[R],P),H=B,Y=L-j[_]-D,Q=L/2-j[_]/2+U,q=Bg(H,Q,Y),X=!p.arrow&&xr(i)!=null&&Q!==q&&c.reference[_]/2-(Q<H?B:D)-j[_]/2<0,Z=X?Q<H?Q-H:Q-Y:0;return{[w]:S[w]+Z,data:{[w]:q,centerOffset:Q-q-Z,...X&&{alignmentOffset:Z}},reset:X}}}),vM=(e,n)=>({...bM(e),options:[e,n]}),yM={name:"hide",async fn(e){const{width:n,height:s,x:r,y:i}=e.rects.reference,c=n===0&&s===0&&r===0&&i===0;return{data:{referenceHidden:(await y3().fn(e)).data?.referenceHidden||c}}}},Qu={sideX:"left",sideY:"top"},_M={name:"adaptiveOrigin",async fn(e){const{x:n,y:s,rects:{floating:r},elements:{floating:i},platform:c,strategy:d,placement:f}=e,p=Ft(i),m=p.getComputedStyle(i);if(!(m.transitionDuration!=="0s"&&m.transitionDuration!==""))return{x:n,y:s,data:Qu};const x=await c.getOffsetParent?.(i);let y={width:0,height:0};if(d==="fixed"&&p?.visualViewport)y={width:p.visualViewport.width,height:p.visualViewport.height};else if(x===p){const E=xt(i);y={width:E.documentElement.clientWidth,height:E.documentElement.clientHeight}}else await c.isElement?.(x)&&(y=await c.getDimensions(x));const S=Jn(f);let w=n,_=s;S==="left"&&(w=y.width-(n+r.width)),S==="top"&&(_=y.height-(s+r.height));const j=S==="left"?"right":Qu.sideX,k=S==="top"?"bottom":Qu.sideY;return{x:w,y:_,data:{sideX:j,sideY:k}}}};function ZS(e,n,s){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?s?"inline-start":"inline-end":"right",bottom:"bottom",left:r?s?"inline-end":"inline-start":"left"}[n]}function j1(e,n,s){const{rects:r,placement:i}=e;return{side:ZS(n,Jn(i),s),align:xr(i)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function JS(e){const{anchor:n,positionMethod:s="absolute",side:r="bottom",sideOffset:i=0,align:c="center",alignOffset:d=0,collisionBoundary:f,collisionPadding:p=5,sticky:m=!1,arrowPadding:h=5,disableAnchorTracking:x=!1,inline:y,keepMounted:S=!1,floatingRootContext:w,mounted:_,collisionAvoidance:j,shiftCrossAxis:k=!1,nodeId:E,adaptiveOrigin:R,lazyFlip:N=!1,externalTree:M}=e,[A,O]=b.useState(null);!_&&A!==null&&O(null);const L=j.side||"flip",U=j.align||"flip",P=j.fallbackAxisSide||"end",B=typeof n=="function"?n:void 0,D=Me(B),H=B?D:n,Y=cn(n),Q=cn(_),X=Qh()==="rtl",Z=A||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":X?"left":"right","inline-start":X?"right":"left"}[r],G=c==="center"?Z:`${Z}-${c}`;let K=p;const I=1,V=r==="bottom"?I:0,$=r==="top"?I:0,W=r==="right"?I:0,oe=r==="left"?I:0;typeof K=="number"?K={top:K+V,right:K+oe,bottom:K+$,left:K+W}:K&&(K={top:(K.top||0)+V,right:(K.right||0)+oe,bottom:(K.bottom||0)+$,left:(K.left||0)+W});const ce={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:K},se=b.useRef(null),ie=cn(i),te=cn(d),ke=typeof i!="function"?i:0,$e=typeof d!="function"?d:0,be=[];y&&be.push(y),be.push(g3(dt=>{const Tt=j1(dt,r,X),Xt=typeof ie.current=="function"?ie.current(Tt):ie.current,yt=typeof te.current=="function"?te.current(Tt):te.current;return{mainAxis:Xt,crossAxis:yt,alignmentAxis:yt}},[ke,$e,X,r]));const Se=U==="none"&&L!=="shift",Ee=!Se&&(m||k||L==="shift"),ze=L==="none"?null:b3({...ce,padding:{top:K.top+I,right:K.right+I,bottom:K.bottom+I,left:K.left+I},mainAxis:!k&&L==="flip",crossAxis:U==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),De=Se?null:h3(dt=>{const Tt=xt(dt.elements.floating).documentElement;return{...ce,rootBoundary:k?{x:0,y:0,width:Tt.clientWidth,height:Tt.clientHeight}:void 0,mainAxis:U!=="none",crossAxis:Ee,limiter:m||k?void 0:x3(Xt=>{if(!se.current)return{};const{width:yt,height:Wt}=se.current.getBoundingClientRect(),Vt=Ea(Jn(Xt.placement)),rn=Vt==="y"?yt:Wt,Tn=Vt==="y"?K.left+K.right:K.top+K.bottom;return{offset:rn/2+Tn/2}})}},[ce,m,k,K,U]);L==="shift"||U==="shift"||c==="center"?be.push(De,ze):be.push(ze,De),be.push(v3({...ce,apply({elements:{floating:dt},availableWidth:Tt,availableHeight:Xt,rects:yt}){if(!Q.current)return;const Wt=dt.style;Wt.setProperty("--available-width",`${Tt}px`),Wt.setProperty("--available-height",`${Xt}px`);const Vt=Ft(dt).devicePixelRatio||1,{x:rn,y:Tn,width:qn,height:ta}=yt.reference,Vn=(Math.round((rn+qn)*Vt)-Math.round(rn*Vt))/Vt,ts=(Math.round((Tn+ta)*Vt)-Math.round(Tn*Vt))/Vt;Wt.setProperty("--anchor-width",`${Vn}px`),Wt.setProperty("--anchor-height",`${ts}px`)}}),vM(dt=>({element:se.current||xt(dt.elements.floating).createElement("div"),padding:h,offsetParent:"floating"}),[h]),{name:"transformOrigin",fn(dt){const{elements:Tt,middlewareData:Xt,placement:yt,rects:Wt,y:Vt}=dt,rn=Jn(yt),Tn=Ea(rn),qn=se.current,ta=Xt.arrow?.x||0,Vn=Xt.arrow?.y||0,ts=qn?.clientWidth||0,An=qn?.clientHeight||0,na=ta+ts/2,Ta=Vn+An/2,ns=Math.abs(Xt.shift?.y||0),at=Wt.reference.height/2,At=typeof i=="function"?i(j1(dt,r,X)):i,yn=ns>At,en={top:`${na}px calc(100% + ${At}px)`,bottom:`${na}px ${-At}px`,left:`calc(100% + ${At}px) ${Ta}px`,right:`${-At}px ${Ta}px`}[rn],kt=`${na}px ${Wt.reference.y+at-Vt}px`;return Tt.floating.style.setProperty("--transform-origin",Ee&&Tn==="y"&&yn?kt:en),{}}},yM,R),Re(()=>{!_&&w&&w.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,w]);const xe=b.useMemo(()=>({elementResize:!x&&typeof ResizeObserver<"u",layoutShift:!x&&typeof IntersectionObserver<"u"}),[x]),{refs:Ne,elements:_e,x:Le,y:Ge,middlewareData:qe,update:Oe,placement:ve,context:le,isPositioned:ye,floatingStyles:je}=U3({rootContext:w,open:S?_:void 0,placement:G,middleware:be,strategy:s,whileElementsMounted:S?void 0:(...dt)=>m1(...dt,xe),nodeId:E,externalTree:M}),{sideX:Be,sideY:Ze}=qe.adaptiveOrigin||Qu,_t=ye?s:"fixed",Ht=b.useMemo(()=>{const dt=R?{position:_t,[Be]:Le,[Ze]:Ge}:{position:_t,...je};return ye||(dt.opacity=0),dt},[R,_t,Be,Le,Ze,Ge,je,ye]),vt=b.useRef(null);Re(()=>{if(!_)return;const dt=Y.current,Tt=typeof dt=="function"?dt():dt,yt=(S1(Tt)?Tt.current:Tt)||null||null;yt!==vt.current&&(Ne.setPositionReference(yt),vt.current=yt)},[_,Ne,H,Y]),b.useEffect(()=>{if(!_)return;const dt=Y.current;typeof dt!="function"&&S1(dt)&&dt.current!==vt.current&&(Ne.setPositionReference(dt.current),vt.current=dt.current)},[_,Ne,H,Y]),b.useEffect(()=>{if(S&&_&&_e.domReference&&_e.floating)return m1(_e.domReference,_e.floating,Oe,xe)},[S,_,_e,Oe,xe]);const ut=Jn(ve),it=ZS(r,ut,X),Et=xr(ve)||"center",Bt=!!qe.hide?.referenceHidden;Re(()=>{N&&_&&ye&&O(ut)},[N,_,ye,ut]);const pa=b.useMemo(()=>({position:"absolute",top:qe.arrow?.y,left:qe.arrow?.x}),[qe.arrow]),gn=qe.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:Ht,arrowStyles:pa,arrowRef:se,arrowUncentered:gn,side:it,align:Et,physicalSide:ut,anchorHidden:Bt,refs:Ne,context:le,isPositioned:ye,update:Oe}),[Ht,pa,se,gn,it,Et,ut,Bt,Ne,le,ye,Oe])}function S1(e){return e!=null&&"current"in e}function Zh(e){return e==="starting"?xA:an}function WS(e,n,{styles:s,transitionStatus:r,props:i,refs:c,hidden:d,inert:f=!1}){const p={...s};return f&&(p.pointerEvents="none"),Lt("div",e,{state:n,ref:c,props:[{role:"presentation",hidden:d,style:p},Zh(r),i],stateAttributesMapping:pl})}const jM=b.forwardRef(function(n,s){const{render:r,className:i,anchor:c,positionMethod:d="absolute",side:f="top",align:p="center",sideOffset:m=0,alignOffset:h=0,collisionBoundary:x="clipping-ancestors",collisionPadding:y=5,arrowPadding:S=5,sticky:w=!1,disableAnchorTracking:_=!1,collisionAvoidance:j=yA,style:k,...E}=n,R=tc(),N=pM(),M=R.useState("open"),A=R.useState("mounted"),O=R.useState("trackCursorAxis"),L=R.useState("disableHoverablePopup"),U=R.useState("floatingRootContext"),P=R.useState("instantType"),B=R.useState("transitionStatus"),D=R.useState("hasViewport"),H=JS({anchor:c,positionMethod:d,floatingRootContext:U,mounted:A,side:f,sideOffset:m,align:p,alignOffset:h,collisionBoundary:x,collisionPadding:y,sticky:w,arrowPadding:S,disableAnchorTracking:_,keepMounted:N,collisionAvoidance:j,adaptiveOrigin:D?_M:void 0}),Y=b.useMemo(()=>({open:M,side:H.side,align:H.align,anchorHidden:H.anchorHidden,instant:O!=="none"?"tracking-cursor":P}),[M,H.side,H.align,H.anchorHidden,O,P]),Q=WS(n,Y,{styles:H.positionerStyles,transitionStatus:B,props:E,refs:[s,R.useStateSetter("positionerElement")],hidden:!A,inert:!M||O==="both"||L});return o.jsx(KS.Provider,{value:H,children:Q})}),SM={...pl,...ml},wM=b.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,f=tc(),{side:p,align:m}=QS(),h=f.useState("open"),x=f.useState("instantType"),y=f.useState("transitionStatus"),S=f.useState("popupProps"),w=f.useState("floatingRootContext"),_=f.useState("disabled"),j=f.useState("closeDelay");br({open:h,ref:f.context.popupRef,onComplete(){h&&f.context.onOpenChangeComplete?.(!0)}}),q3(w,{enabled:!_,closeDelay:j});const k=f.useStateSetter("popupElement");return Lt("div",n,{state:{open:h,side:p,align:m,instant:x,transitionStatus:y},ref:[s,f.context.popupRef,k],props:[S,Zh(y),d],stateAttributesMapping:SM})}),CM=b.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,f=tc(),{arrowRef:p,side:m,align:h,arrowUncentered:x,arrowStyles:y}=QS(),S=f.useState("open"),w=f.useState("instantType");return Lt("div",n,{state:{open:S,side:m,align:h,uncentered:x,instant:w},ref:[s,p],props:[{style:y,"aria-hidden":!0},d],stateAttributesMapping:pl})}),EM=function(n){const{delay:s,closeDelay:r,timeout:i=400}=n,c=b.useMemo(()=>({delay:s,closeDelay:r}),[s,r]),d=b.useMemo(()=>({open:s,close:r}),[s,r]);return o.jsx(YS.Provider,{value:c,children:o.jsx(RT,{delay:d,timeoutMs:i,children:n.children})})};function Jh(e){return Ih(19)?e:e?"true":void 0}function kM(e){const[n,s]=b.useState({current:e,previous:null});return e!==n.current&&s({current:e,previous:n.current}),n.previous}function Pt(...e){return Mj(jh(e))}function NM({delay:e=0,...n}){return o.jsx(EM,{"data-slot":"tooltip-provider",delay:e,...n})}function Wh({...e}){return o.jsx(tM,{"data-slot":"tooltip",...e})}function ex({...e}){return o.jsx(mM,{"data-slot":"tooltip-trigger",...e})}function tx({className:e,side:n="top",sideOffset:s=4,align:r="center",alignOffset:i=0,children:c,...d}){return o.jsx(hM,{children:o.jsx(jM,{align:r,alignOffset:i,side:n,sideOffset:s,className:"isolate z-50",children:o.jsxs(wM,{"data-slot":"tooltip-content",className:Pt("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,o.jsx(CM,{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 fi({label:e,active:n,onClick:s,isAdd:r,isSettings:i,isDefault:c,icon:d,title:f,testId:p}){const m=e.trim()||"·",{initials:h,subLabel:x}=RM(m),y=r||i?"indigo":AM(m),S=x&&!r&&!i&&!c;return o.jsxs(Wh,{children:[o.jsx(ex,{render:o.jsxs("button",{type:"button",onClick:s,"data-testid":p,className:"group relative flex w-full cursor-pointer flex-col items-center gap-1",children:[o.jsx("span",{className:Ae("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",r&&"border border-dashed border-muted-fg/50 bg-transparent text-muted-fg hover:bg-accent/60 hover:text-foreground",i&&"bg-muted text-muted-fg hover:bg-accent hover:text-foreground",c&&"overflow-hidden bg-muted",!r&&!i&&!c&&n&&DM(y),!r&&!i&&!c&&!n&&zM(y)),children:d??h}),S&&o.jsx("span",{className:"block max-w-[3.6rem] truncate text-[9px] leading-tight text-muted-fg group-hover:text-foreground",children:x})]})}),o.jsx(tx,{side:"right",children:f||e})]})}function RM(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:TM(n)};const r=s[0];return r.length<=4?{initials:r[0].toUpperCase(),subLabel:r}:{initials:r[0].toUpperCase(),subLabel:r.slice(0,4)+"…"}}function TM(e){return e.length>6?e.slice(0,5)+"…":e}function AM(e){let n=0;for(let s=0;s<e.length;s++)n=n*31+e.charCodeAt(s)|0;return I0[Math.abs(n)%I0.length]}const MM={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"},OM={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 zM(e){return MM[e]}function DM(e){return OM[e]}function Jo({content:e,side:n="top",children:s}){return e?o.jsxs(Wh,{children:[o.jsx(ex,{render:s}),o.jsx(tx,{side:n,children:e})]}):s}const ew=0,tw=1,nw=2,w1=3;var C1=Object.prototype.hasOwnProperty;function $g(e,n){var s,r;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((r=e.length)===n.length)for(;r--&&$g(e[r],n[r]););return r===-1}if(!s||typeof e=="object"){r=0;for(s in e)if(C1.call(e,s)&&++r&&!C1.call(n,s)||!(s in n)||!$g(e[s],n[s]))return!1;return Object.keys(n).length===r}}return e!==e&&n!==n}const Ss=new WeakMap,ws=()=>{},Ln=ws(),Gg=Object,ht=e=>e===Ln,Ya=e=>typeof e=="function",pr=(e,n)=>({...e,...n}),aw=e=>Ya(e.then),Ip={},Tu={},nx="undefined",sc=typeof window!=nx,Yg=typeof document!=nx,LM=sc&&"Deno"in window,PM=()=>sc&&typeof window.requestAnimationFrame!=nx,sw=(e,n)=>{const s=Ss.get(e);return[()=>!ht(n)&&e.get(n)||Ip,r=>{if(!ht(n)){const i=e.get(n);n in Tu||(Tu[n]=i),s[5](n,pr(i,r),i||Ip)}},s[6],()=>!ht(n)&&n in Tu?Tu[n]:!ht(n)&&e.get(n)||Ip]};let Fg=!0;const BM=()=>Fg,[Xg,Kg]=sc&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[ws,ws],IM=()=>{const e=Yg&&document.visibilityState;return ht(e)||e!=="hidden"},UM=e=>(Yg&&document.addEventListener("visibilitychange",e),Xg("focus",e),()=>{Yg&&document.removeEventListener("visibilitychange",e),Kg("focus",e)}),HM=e=>{const n=()=>{Fg=!0,e()},s=()=>{Fg=!1};return Xg("online",n),Xg("offline",s),()=>{Kg("online",n),Kg("offline",s)}},qM={isOnline:BM,isVisible:IM},VM={initFocus:UM,initReconnect:HM},E1=!Qi.useId,Fo=!sc||LM,$M=e=>PM()?window.requestAnimationFrame(e):setTimeout(e,1),Up=Fo?b.useEffect:b.useLayoutEffect,Hp=typeof navigator<"u"&&navigator.connection,k1=!Fo&&Hp&&(["slow-2g","2g"].includes(Hp.effectiveType)||Hp.saveData),Au=new WeakMap,GM=e=>Gg.prototype.toString.call(e),qp=(e,n)=>e===`[object ${n}]`;let YM=0;const Qg=e=>{const n=typeof e,s=GM(e),r=qp(s,"Date"),i=qp(s,"RegExp"),c=qp(s,"Object");let d,f;if(Gg(e)===e&&!r&&!i){if(d=Au.get(e),d)return d;if(d=++YM+"~",Au.set(e,d),Array.isArray(e)){for(d="@",f=0;f<e.length;f++)d+=Qg(e[f])+",";Au.set(e,d)}if(c){d="#";const p=Gg.keys(e).sort();for(;!ht(f=p.pop());)ht(e[f])||(d+=f+":"+Qg(e[f])+",");Au.set(e,d)}}else d=r?e.toJSON():n=="symbol"?e.toString():n=="string"?JSON.stringify(e):""+e;return d},ax=e=>{if(Ya(e))try{e=e()}catch{e=""}const n=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?Qg(e):"",[e,n]};let FM=0;const Zg=()=>++FM;async function rw(...e){const[n,s,r,i]=e,c=pr({populateCache:!0,throwOnError:!0},typeof i=="boolean"?{revalidate:i}:i||{});let d=c.populateCache;const f=c.rollbackOnError;let p=c.optimisticData;const m=y=>typeof f=="function"?f(y):f!==!1,h=c.throwOnError;if(Ya(s)){const y=s,S=[],w=n.keys();for(const _ of w)!/^\$(inf|sub)\$/.test(_)&&y(n.get(_)._k)&&S.push(_);return Promise.all(S.map(x))}return x(s);async function x(y){const[S]=ax(y);if(!S)return;const[w,_]=sw(n,S),[j,k,E,R]=Ss.get(n),N=()=>{const Y=j[S];return(Ya(c.revalidate)?c.revalidate(w().data,y):c.revalidate!==!1)&&(delete E[S],delete R[S],Y&&Y[0])?Y[0](nw).then(()=>w().data):w().data};if(e.length<3)return N();let M=r,A,O=!1;const L=Zg();k[S]=[L,0];const U=!ht(p),P=w(),B=P.data,D=P._c,H=ht(D)?B:D;if(U&&(p=Ya(p)?p(H,B):p,_({data:p,_c:H})),Ya(M))try{M=M(H)}catch(Y){A=Y,O=!0}if(M&&aw(M))if(M=await M.catch(Y=>{A=Y,O=!0}),L!==k[S][0]){if(O)throw A;return M}else O&&U&&m(A)&&(d=!0,_({data:H,_c:Ln}));if(d&&!O)if(Ya(d)){const Y=d(M,H);_({data:Y,error:Ln,_c:Ln})}else _({data:M,error:Ln,_c:Ln});if(k[S][1]=Zg(),Promise.resolve(N()).then(()=>{_({_c:Ln})}),O){if(h)throw A;return}return M}}const N1=(e,n)=>{for(const s in e)e[s][0]&&e[s][0](n)},XM=(e,n)=>{if(!Ss.has(e)){const s=pr(VM,n),r=Object.create(null),i=rw.bind(Ln,e);let c=ws;const d=Object.create(null),f=(h,x)=>{const y=d[h]||[];return d[h]=y,y.push(x),()=>y.splice(y.indexOf(x),1)},p=(h,x,y)=>{e.set(h,x);const S=d[h];if(S)for(const w of S)w(x,y)},m=()=>{if(!Ss.has(e)&&(Ss.set(e,[r,Object.create(null),Object.create(null),Object.create(null),i,p,f]),!Fo)){const h=s.initFocus(setTimeout.bind(Ln,N1.bind(Ln,r,ew))),x=s.initReconnect(setTimeout.bind(Ln,N1.bind(Ln,r,tw)));c=()=>{h&&h(),x&&x(),Ss.delete(e)}}};return m(),[e,i,m,c]}return[e,Ss.get(e)[4]]},KM=(e,n,s,r,i)=>{const c=s.errorRetryCount,d=i.retryCount,f=~~((Math.random()+.5)*(1<<(d<8?d:8)))*s.errorRetryInterval;!ht(c)&&d>c||setTimeout(r,f,i)},QM=$g,[ow,ZM]=XM(new Map),JM=pr({onLoadingSlow:ws,onSuccess:ws,onError:ws,onErrorRetry:KM,onDiscarded:ws,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:k1?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:k1?5e3:3e3,compare:QM,isPaused:()=>!1,cache:ow,mutate:ZM,fallback:{}},qM),WM=(e,n)=>{const s=pr(e,n);if(n){const{use:r,fallback:i}=e,{use:c,fallback:d}=n;r&&c&&(s.use=r.concat(c)),i&&d&&(s.fallback=pr(i,d))}return s},e5=b.createContext({}),t5="$inf$",lw=sc&&window.__SWR_DEVTOOLS_USE__,n5=lw?window.__SWR_DEVTOOLS_USE__:[],a5=()=>{lw&&(window.__SWR_DEVTOOLS_REACT__=Qi)},s5=e=>Ya(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],iw=()=>{const e=b.useContext(e5);return b.useMemo(()=>pr(JM,e),[e])},r5=e=>(n,s,r)=>e(n,s&&((...c)=>{const[d]=ax(n),[,,,f]=Ss.get(ow);if(d.startsWith(t5))return s(...c);const p=f[d];return ht(p)?s(...c):(delete f[d],p)}),r),o5=n5.concat(r5),l5=e=>function(...s){const r=iw(),[i,c,d]=s5(s),f=WM(r,d);let p=e;const{use:m}=f,h=(m||[]).concat(o5);for(let x=h.length;x--;)p=h[x](p);return p(i,c||f.fetcher||null,f)},i5=(e,n,s)=>{const r=n[e]||(n[e]=[]);return r.push(s),()=>{const i=r.indexOf(s);i>=0&&(r[i]=r[r.length-1],r.pop())}};a5();const Vp=Qi.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}}),$p={dedupe:!0},R1=Promise.resolve(Ln),c5=()=>ws,u5=(e,n,s)=>{const{cache:r,compare:i,suspense:c,fallbackData:d,revalidateOnMount:f,revalidateIfStale:p,refreshInterval:m,refreshWhenHidden:h,refreshWhenOffline:x,keepPreviousData:y,strictServerPrefetchWarning:S}=s,[w,_,j,k]=Ss.get(r),[E,R]=ax(e),N=b.useRef(!1),M=b.useRef(!1),A=b.useRef(E),O=b.useRef(n),L=b.useRef(s),U=()=>L.current,P=()=>U().isVisible()&&U().isOnline(),[B,D,H,Y]=sw(r,E),Q=b.useRef({}).current,q=ht(d)?ht(s.fallback)?Ln:s.fallback[E]:d,X=(xe,Ne)=>{for(const _e in Q){const Le=_e;if(Le==="data"){if(!i(xe[Le],Ne[Le])&&(!ht(xe[Le])||!i(ce,Ne[Le])))return!1}else if(Ne[Le]!==xe[Le])return!1}return!0},Z=!N.current,G=b.useMemo(()=>{const xe=B(),Ne=Y(),_e=Oe=>{const ve=pr(Oe);return delete ve._k,(()=>{if(!E||!n||U().isPaused())return!1;if(Z&&!ht(f))return f;const ye=ht(q)?ve.data:q;return ht(ye)||p})()?{isValidating:!0,isLoading:!0,...ve}:ve},Le=_e(xe),Ge=xe===Ne?Le:_e(Ne);let qe=Le;return[()=>{const Oe=_e(B());return X(Oe,qe)?(qe.data=Oe.data,qe.isLoading=Oe.isLoading,qe.isValidating=Oe.isValidating,qe.error=Oe.error,qe):(qe=Oe,Oe)},()=>Ge]},[r,E]),K=pd.useSyncExternalStore(b.useCallback(xe=>H(E,(Ne,_e)=>{X(_e,Ne)||xe()}),[r,E]),G[0],G[1]),I=w[E]&&w[E].length>0,V=K.data,$=ht(V)?q&&aw(q)?Vp(q):q:V,W=K.error,oe=b.useRef($),ce=y?ht(V)?ht(oe.current)?$:oe.current:V:$,se=E&&ht($),ie=b.useRef(null);!Fo&&pd.useSyncExternalStore(c5,()=>(ie.current=!1,ie),()=>(ie.current=!0,ie));const te=ie.current;S&&te&&!c&&se&&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 ke=!E||!n||U().isPaused()||I&&!ht(W)?!1:Z&&!ht(f)?f:c?ht($)?!1:p:ht($)||p,$e=Z&&ke,be=ht(K.isValidating)?$e:K.isValidating,Se=ht(K.isLoading)?$e:K.isLoading,Ee=b.useCallback(async xe=>{const Ne=O.current;if(!E||!Ne||M.current||U().isPaused())return!1;let _e,Le,Ge=!0;const qe=xe||{},Oe=!j[E]||!qe.dedupe,ve=()=>E1?!M.current&&E===A.current&&N.current:E===A.current,le={isValidating:!1,isLoading:!1},ye=()=>{D(le)},je=()=>{const Ze=j[E];Ze&&Ze[1]===Le&&delete j[E]},Be={isValidating:!0};ht(B().data)&&(Be.isLoading=!0);try{if(Oe&&(D(Be),s.loadingTimeout&&ht(B().data)&&setTimeout(()=>{Ge&&ve()&&U().onLoadingSlow(E,s)},s.loadingTimeout),j[E]=[Ne(R),Zg()]),[_e,Le]=j[E],_e=await _e,Oe&&setTimeout(je,s.dedupingInterval),!j[E]||j[E][1]!==Le)return Oe&&ve()&&U().onDiscarded(E),!1;le.error=Ln;const Ze=_[E];if(!ht(Ze)&&(Le<=Ze[0]||Le<=Ze[1]||Ze[1]===0))return ye(),Oe&&ve()&&U().onDiscarded(E),!1;const _t=B().data;le.data=i(_t,_e)?_t:_e,Oe&&ve()&&U().onSuccess(_e,E,s)}catch(Ze){je();const _t=U(),{shouldRetryOnError:Ht}=_t;_t.isPaused()||(le.error=Ze,Oe&&ve()&&(_t.onError(Ze,E,_t),(Ht===!0||Ya(Ht)&&Ht(Ze))&&(!U().revalidateOnFocus||!U().revalidateOnReconnect||P())&&_t.onErrorRetry(Ze,E,_t,vt=>{const ut=w[E];ut&&ut[0]&&ut[0](w1,vt)},{retryCount:(qe.retryCount||0)+1,dedupe:!0})))}return Ge=!1,ye(),!0},[E,r]),ze=b.useCallback((...xe)=>rw(r,A.current,...xe),[]);if(Up(()=>{O.current=n,L.current=s,ht(V)||(oe.current=V)}),Up(()=>{if(!E)return;const xe=Ee.bind(Ln,$p);let Ne=0;U().revalidateOnFocus&&(Ne=Date.now()+U().focusThrottleInterval);const Le=i5(E,w,(Ge,qe={})=>{if(Ge==ew){const Oe=Date.now();U().revalidateOnFocus&&Oe>Ne&&P()&&(Ne=Oe+U().focusThrottleInterval,xe())}else if(Ge==tw)U().revalidateOnReconnect&&P()&&xe();else{if(Ge==nw)return Ee();if(Ge==w1)return Ee(qe)}});return M.current=!1,A.current=E,N.current=!0,D({_k:R}),ke&&(j[E]||(ht($)||Fo?xe():$M(xe))),()=>{M.current=!0,Le()}},[E]),Up(()=>{let xe;function Ne(){const Le=Ya(m)?m(B().data):m;Le&&xe!==-1&&(xe=setTimeout(_e,Le))}function _e(){!B().error&&(h||U().isVisible())&&(x||U().isOnline())?Ee($p).then(Ne):Ne()}return Ne(),()=>{xe&&(clearTimeout(xe),xe=-1)}},[m,h,x,E]),b.useDebugValue(ce),c){if(!E1&&Fo&&se)throw new Error("Fallback data is required when using Suspense in SSR.");se&&(O.current=n,L.current=s,M.current=!1);const xe=k[E],Ne=!ht(xe)&&se?ze(xe):R1;if(Vp(Ne),!ht(W)&&se)throw W;const _e=se?Ee($p):R1;!ht(ce)&&se&&(_e.status="fulfilled",_e.value=!0),Vp(_e)}return{mutate:ze,get data(){return Q.data=!0,ce},get error(){return Q.error=!0,W},get isValidating(){return Q.isValidating=!0,be},get isLoading(){return Q.isLoading=!0,Se}}},Xe=l5(u5);let Wo=null;function Hr(e){Wo=e}function sx(){return Wo}class rc extends Error{status;body;constructor(n,s,r){super(s),this.status=n,this.body=r}}async function mi(e,n,s,r={}){const i={"content-type":"application/json",...Wo?{authorization:`Bearer ${Wo}`}:{},...r.headers||{}},c=await fetch(n,{...r,method:e,headers:i,body:s!==void 0?JSON.stringify(s):void 0});if(!c.ok){let d="",f=null;try{f=await c.json(),d=f?.error||JSON.stringify(f)}catch{d=await c.text()}throw new rc(c.status,`${e} ${n} → ${c.status}: ${d}`,f)}if(c.status!==204)return await c.json()}const ge={get:e=>mi("GET",e),post:(e,n)=>mi("POST",e,n),put:(e,n)=>mi("PUT",e,n),patch:(e,n)=>mi("PATCH",e,n),del:e=>mi("DELETE",e)};async function cw(e,n,s,r){const i=await fetch(e,{method:"POST",signal:r,headers:{"content-type":"application/json",...Wo?{authorization:`Bearer ${Wo}`}:{}},body:JSON.stringify(n)});if(!i.ok||!i.body){const p=await i.text().catch(()=>"");throw new rc(i.status,`POST ${e} → ${i.status}: ${p||"stream failed"}`)}const c=i.body.getReader(),d=new TextDecoder("utf-8");let f="";for(;;){const{value:p,done:m}=await c.read();if(m)break;f+=d.decode(p,{stream:!0});let h=f.indexOf(`
537
- `);for(;h>=0;){const x=f.slice(0,h).trim();if(f=f.slice(h+1),x)try{s(JSON.parse(x))}catch{}h=f.indexOf(`
538
- `)}}if(f.trim())try{s(JSON.parse(f.trim()))}catch{}}const d5={get:()=>ge.get("/health")},Qn={list:()=>ge.get("/projects"),register:e=>ge.post("/projects",{path:e}),remove:e=>ge.del(`/projects/${encodeURIComponent(e)}`),rebuild:e=>ge.post(`/projects/${encodeURIComponent(e)}/rebuild`),config:{show:e=>ge.get(`/projects/${e}/config`),set:(e,n)=>ge.patch(`/projects/${e}/config`,{set:n}),unset:(e,n)=>ge.patch(`/projects/${e}/config`,{unset:n}),put:(e,n)=>ge.put(`/projects/${e}/config`,n)},apcProject:{set:(e,n,s)=>ge.patch(`/projects/${e}/apc-project`,{set:n,unset:s}),put:(e,n)=>ge.put(`/projects/${e}/apc-project`,n)},memory:{get:e=>ge.get(`/projects/${e}/memory`),put:(e,n)=>ge.put(`/projects/${e}/memory`,{body:n})}},Jt={list:e=>ge.get(`/projects/${e}/agents`),get:(e,n)=>ge.get(`/projects/${e}/agents/${n}`),create:(e,n)=>ge.post(`/projects/${e}/agents`,n),update:(e,n,s)=>ge.patch(`/projects/${e}/agents/${encodeURIComponent(n)}`,s),remove:(e,n)=>ge.del(`/projects/${e}/agents/${encodeURIComponent(n)}`),chat:(e,n,s)=>ge.post(`/projects/${e}/agents/${encodeURIComponent(n)}/chat`,s),memory:{get:(e,n)=>ge.get(`/projects/${e}/agents/${n}/memory`),put:(e,n,s)=>ge.put(`/projects/${e}/agents/${n}/memory`,{body:s})},vault:e=>ge.get(e?.includeRemoved?"/agents/vault?include_removed=1":"/agents/vault"),vaultCreate:(e,n={},s="")=>ge.post("/agents/vault",{slug:e,fields:n,body:s}),vaultPatch:(e,n)=>ge.patch(`/agents/vault/${encodeURIComponent(e)}`,n),vaultRemove:e=>ge.del(`/agents/vault/${encodeURIComponent(e)}`),vaultRestore:e=>ge.post(`/agents/vault/${encodeURIComponent(e)}/restore`),import:(e,n)=>ge.post(`/projects/${e}/agents/import`,{slug:n})},rx={list:(e,n)=>ge.get(`/projects/${e}/agents/${n}/conversations`),get:(e,n,s)=>ge.get(`/projects/${e}/agents/${n}/conversations/${s}`),compact:(e,n,s)=>ge.post(s?`/projects/${e}/agents/${n}/conversations/${s}/compact`:`/projects/${e}/agents/${n}/compact`,{})},or={list:e=>ge.get(`/projects/${e}/routines`),get:(e,n)=>ge.get(`/projects/${e}/routines/${n}`),run:(e,n)=>ge.post(`/projects/${e}/routines/${n}/run`),enable:(e,n)=>ge.post(`/projects/${e}/routines/${n}/enable`),disable:(e,n)=>ge.post(`/projects/${e}/routines/${n}/disable`),upsert:(e,n)=>ge.post(`/projects/${e}/routines`,n),remove:(e,n)=>ge.del(`/projects/${e}/routines/${encodeURIComponent(n)}`)},lr={list:(e,n="open")=>ge.get(`/projects/${e}/tasks?state=${n}`),global:(e="open")=>ge.get(`/tasks?state=${e}`),add:(e,n)=>ge.post(`/projects/${e}/tasks`,n),done:(e,n)=>ge.post(`/projects/${e}/tasks/${n}/done`),drop:(e,n)=>ge.post(`/projects/${e}/tasks/${n}/drop`),reopen:(e,n)=>ge.post(`/projects/${e}/tasks/${n}/reopen`)},Mi={list:e=>ge.get(`/projects/${e}/mcps`),check:e=>ge.get(`/projects/${e}/mcps/check`),add:(e,n,s)=>ge.post(`/projects/${e}/mcps?scope=${n}`,s),remove:(e,n,s="shared")=>ge.del(`/projects/${e}/mcps/${encodeURIComponent(n)}?scope=${s}`)},Gp=e=>{const n=new URLSearchParams;for(const[r,i]of Object.entries(e))i!==void 0&&i!==""&&n.set(r,String(i));const s=n.toString();return s?`?${s}`:""},Jg={global:(e={})=>ge.get(`/messages/global${Gp(e)}`),project:(e,n={})=>ge.get(`/projects/${e}/messages${Gp(n)}`),search:(e,n,s=50)=>ge.get(`/projects/${e}/messages/search${Gp({q:n,limit:s})}`)},f5={global:e=>ge.get(`/sessions${e?`?engine=${encodeURIComponent(e)}`:""}`)},m5={list:()=>ge.get("/tools")},kn={channels:{list:()=>ge.get("/telegram/channels"),upsert:e=>ge.post("/telegram/channels",e),patch:(e,n)=>ge.patch(`/telegram/channels/${e}`,n),remove:e=>ge.del(`/telegram/channels/${encodeURIComponent(e)}`)},contacts:{list:()=>ge.get("/telegram/contacts"),patch:(e,n)=>ge.patch(`/telegram/contacts/${encodeURIComponent(String(e))}`,n),remove:e=>ge.del(`/telegram/contacts/${encodeURIComponent(String(e))}`)},roles:{list:()=>ge.get("/telegram/roles"),set:(e,n)=>ge.put(`/telegram/roles/${encodeURIComponent(e)}`,{tools:n}),remove:e=>ge.del(`/telegram/roles/${encodeURIComponent(e)}`)},status:()=>ge.get("/telegram/status"),start:()=>ge.post("/telegram/start"),stop:()=>ge.post("/telegram/stop"),send:e=>ge.post("/telegram/send",e)},bd={list:()=>ge.get("/engines"),models:e=>ge.post("/engines/models",e)},el={reload:()=>ge.post("/admin/reload"),shutdown:()=>ge.post("/admin/shutdown"),config:{get:()=>ge.get("/admin/config"),patch:e=>ge.patch("/admin/config",e)},superAgent:()=>ge.get("/admin/super-agent"),logs:(e="errors",n=200)=>ge.get(`/admin/logs?file=${e}&limit=${n}`)},tl={list:()=>ge.get("/pair/list"),revoke:e=>ge.del(`/pair/revoke/${encodeURIComponent(e)}`),init:()=>ge.post("/pair/init",{}),status:e=>ge.get(`/pair/status/${encodeURIComponent(e)}`),confirm:e=>ge.post("/pair/confirm",e)},T1={get:()=>ge.get("/identity"),patch:e=>ge.patch("/identity",e)},uw={send:(e,n)=>ge.post(`/projects/${e}/super-agent/chat`,n),stream:(e,n,s,r)=>cw(`/projects/${e}/super-agent/chat/stream`,n,s,r),summarize:e=>ge.post("/super-agent/summarize",e)},p5={dirs:e=>ge.get(`/admin/fs/dirs?path=${encodeURIComponent(e)}`)},g5=["alloy","echo","fable","onyx","nova","shimmer"],h5=["Kore","Puck","Charon","Fenrir","Aoede"],x5=["eleven_multilingual_v2","eleven_turbo_v2_5","eleven_flash_v2_5"],b5=["tts-1","tts-1-hd"],v5=["tiny","base","small","medium","large-v2","large-v3"],vd={piper:{name:"Piper",note:"Local, offline (CLI + modelo .onnx). Sin API key.",local:!0},elevenlabs:{name:"ElevenLabs",note:"Cloud, multilingüe. Requiere API key."},openai:{name:"OpenAI",note:"Cloud (tts-1 / tts-1-hd). Usa la key de OpenAI."},gemini:{name:"Gemini",note:"Cloud (preview). Usa la key de Gemini."},mock:{name:"Mock",note:"Silencio de prueba. Fallback siempre disponible.",local:!0}};async function y5(e){const n=sx(),s=await fetch(`/voice/tts?path=${encodeURIComponent(e)}`,{headers:n?{authorization:`Bearer ${n}`}:{}});if(!s.ok){const i=await s.text().catch(()=>"");throw new Error(`No se pudo leer el audio (${s.status}): ${i.slice(0,160)}`)}const r=await s.blob();return URL.createObjectURL(r)}const dw={providers:()=>ge.get("/tts/providers"),say:e=>ge.post("/tts/say",e),turn:e=>ge.post("/voice/turn",e)},A1={manifest:()=>ge.get("/deck/manifest"),setWidget:(e,n)=>ge.patch(`/deck/widgets/${encodeURIComponent(e)}`,n),exec:e=>ge.post("/deck/exec",e)},Ur=e=>`/projects/${e}/code/sessions`,sr={sessions:{list:e=>ge.get(Ur(e)).then(n=>n.sessions),get:(e,n)=>ge.get(`${Ur(e)}/${n}`),create:(e,n={})=>ge.post(Ur(e),n),update:(e,n,s)=>ge.patch(`${Ur(e)}/${n}`,s),remove:(e,n)=>ge.del(`${Ur(e)}/${n}`)},changes:(e,n)=>ge.get(`${Ur(e)}/${n}/changes`),stream:(e,n,s,r,i)=>cw(`${Ur(e)}/${n}/chat/stream`,s,r,i)},Zu={list:e=>ge.get(`/projects/${encodeURIComponent(e)}/artifacts`),read:(e,n)=>ge.get(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`),run:(e,n,s=[])=>ge.post(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}/run`,{args:s}),remove:(e,n)=>ge.del(`/projects/${encodeURIComponent(e)}/artifacts/${encodeURIComponent(n)}`)},_5={list:e=>ge.get(e?`/skills?project_path=${encodeURIComponent(e)}`:"/skills")};function oc(){const{data:e,error:n,isLoading:s,mutate:r}=Xe("/projects",()=>Qn.list(),{refreshInterval:Ad.projects});return{projects:(e||[]).slice().sort((c,d)=>{const f=Number(c.id),p=Number(d.id);return f===0&&p!==0?-1:p===0&&f!==0?1:f-p}),error:n,isLoading:s,mutate:r}}function fw(e){const{projects:n,isLoading:s,mutate:r}=oc();return{project:n.find(c=>String(c.id)===e)??null,isLoading:s,mutate:r}}const j5={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.",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:"Proyecto {pid} no encontrado.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"¿Desregistrar {label}? La carpeta no se borra.",unregistered:"Desregistrado.",base_subtitle:"Espacio general · super-agente",nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Rutinas",tasks:"Tasks",mcps:"MCPs",threads:"Chats",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:"Conversaciones directas con agentes del proyecto. El super-agent no interviene.",superagent_title:"Chat con {persona}",superagent_subtitle:"Chat con {persona} — el super-agente APX. Puede usar tools (proyectos, tasks, mcps, agentes).",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"},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",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, opcional)",url_label:"url",url_ph:"https://example.com/mcp",enabled_label:"Habilitado",add_btn:"Agregar",name_required:"name requerido",env_invalid:"env debe ser JSON válido",removed:"eliminado",added:"MCP agregado."},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
539
-
540
- 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:"Esa ruta no existe."},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]"}},S5={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.",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:"Project {pid} not found.",rebuild:"Rebuild context",rebuild_done:"Rebuild OK.",unregister_confirm:"Unregister {label}? The folder is not deleted.",unregistered:"Unregistered.",base_subtitle:"General workspace · super-agent",nav:{overview:"Overview",chat:"Chat",config:"Config",telegram:"Telegram",agents:"Agents",routines:"Routines",tasks:"Tasks",mcps:"MCPs",threads:"Chats",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).",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"},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."},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
541
-
542
- 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:"That route does not exist."},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]"}},ox={es:j5,en:S5};function w5(){try{const e=localStorage.getItem(Cn.language);if(e&&e in ox)return e}catch{}return"es"}let Fd=w5();function C5(e){Fd=e;try{localStorage.setItem(Cn.language,e)}catch{}}const E5=[{value:"es",label:"Español"},{value:"en",label:"English"}];function k5(){return Fd}function N5(e){const n=ox[Fd],s=e.split(".");let r=n;for(const i of s)if(r&&typeof r=="object"&&i in r)r=r[i];else return;return typeof r=="string"?r:void 0}function R5(e,n){return n?e.replace(/\{(\w+)\}/g,(s,r)=>r in n?String(n[r]):`{${r}}`):e}function T5(e){const n=N5(e);if(n!==void 0)return n;if(Fd!=="es"){const s=ox.es,r=e.split(".");let i=s;for(const c of r)if(i&&typeof i=="object"&&c in i)i=i[c];else return;return typeof i=="string"?i:void 0}}function C(e,n){const s=T5(e);return s===void 0?e:R5(s,n)}function lx(){const{data:e,error:n,isLoading:s,mutate:r}=Xe("/identity",()=>T1.get());return{identity:e||{},error:n,isLoading:s,mutate:r,save:async c=>{const d=await T1.patch(c);return await r(d,{revalidate:!1}),d}}}function ix(){const{identity:e}=lx();return e?.agent_name?.trim()||"APX"}function A5(){return[{id:"voice",label:C("nav.modules.voice"),href:"/m/voice",icon:iR},{id:"desktop",label:C("nav.modules.desktop"),href:"/m/desktop",icon:cR},{id:"deck",label:C("nav.modules.deck"),href:"/m/deck",icon:aR},{id:"code",label:C("nav.modules.code"),href:"/m/code",icon:Ii}]}function M5({onSelect:e,onOpenRoby:n}){const{projects:s,isLoading:r}=oc(),i=ea(),c=A5(),d=ix(),f=h=>i.pathname===h||i.pathname.startsWith(`${h}/`),p=s.find(h=>String(h.id)==="0"),m=s.filter(h=>String(h.id)!=="0");return o.jsxs("aside",{className:"flex h-full w-20 flex-col items-center gap-3 overflow-y-auto bg-transparent py-3",children:[o.jsx(Jo,{content:C("nav.apx_admin"),side:"right",children:o.jsx("button",{type:"button",onClick:()=>e("/"),"data-testid":"nav-home",className:"mb-2 cursor-pointer",children:o.jsx(ER,{size:36})})}),r&&o.jsx("div",{className:"size-10 animate-pulse rounded-xl bg-muted"}),p&&o.jsx(fi,{label:C("base.title"),testId:"project-avatar-0",title:C("base.subtitle"),active:f("/p/0"),isDefault:!0,icon:o.jsx("img",{src:"/modules/superagent.png",alt:C("base.title"),className:"size-7 object-contain",draggable:!1}),onClick:()=>e("/p/0")}),o.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),c.map(h=>o.jsx(fi,{label:h.label,testId:`module-avatar-${h.id}`,title:h.label,active:f(h.href),icon:o.jsx(h.icon,{size:18}),onClick:()=>e(h.href)},h.id)),m.length>0&&o.jsx("div",{className:"my-0.5 h-px w-8 rounded-full bg-border"}),m.map(h=>{const x=h.name||h.path.split("/").pop()||String(h.id),y=`/p/${h.id}`;return o.jsx(fi,{label:x,testId:`project-avatar-${h.id}`,title:`${x} — ${h.path}`,active:f(y),onClick:()=>e(y)},h.id)}),o.jsx(fi,{label:"Add",isAdd:!0,testId:"nav-add-project",icon:o.jsx(Nn,{size:18}),active:!1,onClick:()=>e("/?action=add-project"),title:C("nav.add_project")}),o.jsx("div",{className:"flex-1"}),o.jsx(fi,{label:"Settings",isSettings:!0,testId:"nav-settings",icon:o.jsx(sd,{size:16}),active:i.pathname==="/settings"||i.pathname.startsWith("/settings/"),onClick:()=>e("/settings"),title:C("nav.settings")}),o.jsx(Jo,{content:C("superagent.talk",{persona:d}),side:"right",children:o.jsx("button",{type:"button",onClick:n,"data-testid":"nav-roby","aria-label":C("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:o.jsx(vn,{size:18})})})]})}function mw(e){switch(e){case"personal":return"Personal";case"company":return"Company";case"app":return"App";case"software":return"Software";case"default":return"Default";case"other":return"Other";default:return C("nav.project")}}function He({title:e,description:n,action:s,className:r,children:i}){return o.jsxs("section",{className:Ae("rounded-xl border border-border bg-card p-5",r),children:[o.jsxs("header",{className:"mb-4 flex items-start justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e}),n&&o.jsx("p",{className:"mt-0.5 text-sm text-muted-fg",children:n})]}),s]}),o.jsx("div",{children:i})]})}function M1({children:e}){return o.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 Xd({ok:e}){return o.jsx("span",{className:Ae("inline-block size-2 rounded-full",e===null?"bg-muted-fg":e?"bg-emerald-500":"bg-red-500")})}const pw=b.createContext(void 0);function gw(e=!1){const n=b.useContext(pw);if(n===void 0&&!e)throw new Error(Rn(16));return n}function O5(e){const{focusableWhenDisabled:n,disabled:s,composite:r=!1,tabIndex:i=0,isNativeButton:c}=e,d=r&&n!==!1,f=r&&n===!1;return{props:b.useMemo(()=>{const m={onKeyDown(h){s&&n&&h.key!=="Tab"&&h.preventDefault()}};return r||(m.tabIndex=i,!c&&s&&(m.tabIndex=n?i:-1)),(c&&(n||d)||!c&&s)&&(m["aria-disabled"]=s),c&&(!n||f)&&(m.disabled=s),m},[r,s,n,d,f,c,i])}}function gl(e={}){const{disabled:n=!1,focusableWhenDisabled:s,tabIndex:r=0,native:i=!0,composite:c}=e,d=b.useRef(null),f=gw(!0),p=c??f!==void 0,{props:m}=O5({focusableWhenDisabled:s,disabled:n,composite:p,tabIndex:r,isNativeButton:i}),h=b.useCallback(()=>{const S=d.current;Yp(S)&&p&&n&&m.disabled===void 0&&S.disabled&&(S.disabled=!1)},[n,m.disabled,p]);Re(h,[h]);const x=b.useCallback((S={})=>{const{onClick:w,onMouseDown:_,onKeyUp:j,onKeyDown:k,onPointerDown:E,...R}=S;return Na({onClick(N){if(n){N.preventDefault();return}w?.(N)},onMouseDown(N){n||_?.(N)},onKeyDown(N){if(n||(fd(N),k?.(N),N.baseUIHandlerPrevented))return;const M=N.target===N.currentTarget,A=N.currentTarget,O=Yp(A),L=!i&&z5(A),U=M&&(i?O:!L),P=N.key==="Enter",B=N.key===" ",D=A.getAttribute("role"),H=D?.startsWith("menuitem")||D==="option"||D==="gridcell";if(M&&p&&B){if(N.defaultPrevented&&H)return;N.preventDefault(),L||i&&O?(A.click(),N.preventBaseUIHandler()):U&&(w?.(N),N.preventBaseUIHandler());return}U&&(!i&&(B||P)&&N.preventDefault(),!i&&P&&w?.(N))},onKeyUp(N){if(!n){if(fd(N),j?.(N),N.target===N.currentTarget&&i&&p&&Yp(N.currentTarget)&&N.key===" "){N.preventDefault();return}N.baseUIHandlerPrevented||N.target===N.currentTarget&&!i&&!p&&N.key===" "&&w?.(N)}},onPointerDown(N){if(n){N.preventDefault();return}E?.(N)}},i?{type:"button"}:{role:"button"},m,R)},[n,m,p,i]),y=Me(S=>{d.current=S,h()});return{getButtonProps:x,buttonRef:y}}function Yp(e){return Ut(e)&&e.tagName==="BUTTON"}function z5(e){return!!(e?.tagName==="A"&&e?.href)}const D5=b.forwardRef(function(n,s){const{render:r,className:i,disabled:c=!1,focusableWhenDisabled:d=!1,nativeButton:f=!0,style:p,...m}=n,{getButtonProps:h,buttonRef:x}=gl({disabled:c,focusableWhenDisabled:d,native:f});return Lt("button",n,{state:{disabled:c},ref:[s,x],props:[m,h]})}),O1=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,z1=jh,cx=(e,n)=>s=>{var r;if(n?.variants==null)return z1(e,s?.class,s?.className);const{variants:i,defaultVariants:c}=n,d=Object.keys(i).map(m=>{const h=s?.[m],x=c?.[m];if(h===null)return null;const y=O1(h)||O1(x);return i[m][y]}),f=s&&Object.entries(s).reduce((m,h)=>{let[x,y]=h;return y===void 0||(m[x]=y),m},{}),p=n==null||(r=n.compoundVariants)===null||r===void 0?void 0:r.reduce((m,h)=>{let{class:x,className:y,...S}=h;return Object.entries(S).every(w=>{let[_,j]=w;return Array.isArray(j)?j.includes({...c,...f}[_]):{...c,...f}[_]===j})?[...m,x,y]:m},[]);return z1(e,d,p,s?.class,s?.className)},L5=cx("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 nl({className:e,variant:n="default",size:s="default",...r}){return o.jsx(D5,{"data-slot":"button",className:Pt(L5({variant:n,size:s,className:e})),...r})}let D1=(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 P5={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},wi={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},B5={disabled:!1,...wi},ux={valid(e){return e===null?null:e?{[D1.valid]:""}:{[D1.invalid]:""}}},I5={invalid:void 0,name:void 0,validityData:{state:P5,errors:[],error:"",value:"",initialValue:null},setValidityData:Dn,disabled:void 0,touched:wi.touched,setTouched:Dn,dirty:wi.dirty,setDirty:Dn,filled:wi.filled,setFilled:Dn,focused:wi.focused,setFocused:Dn,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:B5,markedDirtyRef:{current:!1},registerFieldControl:Dn,validation:{getValidationProps:(e=an)=>e,getInputValidationProps:(e=an)=>e,inputRef:{current:null},commit:async()=>{}}},U5=b.createContext(I5);function lc(e=!0){const n=b.useContext(U5);if(n.setValidityData===Dn&&!e)throw new Error(Rn(28));return n}const H5=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:Dn,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function hw(){return b.useContext(H5)}const q5=b.createContext({controlId:void 0,registerControlId:Dn,labelId:void 0,setLabelId:Dn,messageIds:[],setMessageIds:Dn,getDescriptionProps:e=>e});function Kd(){return b.useContext(q5)}function V5(e,n,s,r=!0,i){const[c,d]=b.useState(),f=vr(i?`${i}-label`:void 0),p=e??n??c;return Re(()=>{const m=e||n||!r?void 0:$5(s.current,f);c!==m&&d(m)}),p}function $5(e,n){const s=G5(e);if(s)return!s.id&&n&&(s.id=n),s.id||void 0}function G5(e){if(!e)return;const n=e.parentElement;if(n&&n.tagName==="LABEL")return n;const s=e.id;if(s){const i=e.nextElementSibling;if(i&&i.htmlFor===s)return i}const r=e.labels;return r&&r[0]}function Qd(e={}){const{id:n,implicit:s=!1,controlRef:r}=e,{controlId:i,registerControlId:c}=Kd(),d=vr(n),f=s?i:void 0,p=fa(()=>Symbol("labelable-control")),m=b.useRef(!1),h=b.useRef(n!=null),x=Me(()=>{!m.current||c===Dn||(m.current=!1,c(p.current,void 0))});return Re(()=>{if(c===Dn)return;let y;if(s){const S=r?.current;lt(S)&&S.closest("label")!=null?y=n??null:y=f??d}else if(n!=null)h.current=!0,y=n;else if(h.current)y=d;else{x();return}if(y===void 0){x();return}m.current=!0,c(p.current,y)},[n,r,f,c,s,d,p,x]),b.useEffect(()=>x,[x]),i??d}function Fi({controlled:e,default:n,name:s,state:r="value"}){const{current:i}=b.useRef(e!==void 0),[c,d]=b.useState(n),f=i?e:c,p=b.useCallback(m=>{i||d(m)},[]);return[f,p]}function dx(e,n,s,r,i=!0){const{registerFieldControl:c}=lc(),d=b.useRef(null);d.current||(d.current=Symbol()),Re(()=>{const f=d.current;return!f||!i?void 0:(c(f,{controlRef:e,getValue:r,id:n,value:s}),()=>{c(f,void 0)})},[e,i,r,n,c,s])}const Y5=b.forwardRef(function(n,s){const{render:r,className:i,id:c,name:d,value:f,disabled:p=!1,onValueChange:m,defaultValue:h,autoFocus:x=!1,style:y,...S}=n,{state:w,name:_,disabled:j,setTouched:k,setDirty:E,validityData:R,setFocused:N,setFilled:M,validationMode:A,validation:O}=lc(),L=j||p,U=_??d,P={...w,disabled:L},{labelId:B}=Kd(),D=Qd({id:c});Re(()=>{const G=f!=null;O.inputRef.current?.value||G&&f!==""?M(!0):G&&f===""&&M(!1)},[O.inputRef,M,f]);const H=b.useRef(null);Re(()=>{x&&H.current===zn(xt(H.current))&&N(!0)},[x,N]);const[Y]=Fi({controlled:f,default:h,name:"FieldControl",state:"value"}),Q=f!==void 0,q=Q?Y:void 0,X=Me(()=>O.inputRef.current?.value);return dx(O.inputRef,D,q,X),Lt("input",n,{ref:[s,H],state:P,props:[{id:D,disabled:L,name:U,ref:O.inputRef,"aria-labelledby":B,autoFocus:x,...Q?{value:q}:{defaultValue:h},onChange(G){const K=G.currentTarget.value;m?.(K,tt(Ts,G.nativeEvent)),E(K!==R.initialValue),M(K!=="")},onFocus(){N(!0)},onBlur(G){k(!0),N(!1),A==="onBlur"&&O.commit(G.currentTarget.value)},onKeyDown(G){G.currentTarget.tagName==="INPUT"&&G.key==="Enter"&&(k(!0),O.commit(G.currentTarget.value))}},O.getInputValidationProps(),S],stateAttributesMapping:ux})}),F5=b.forwardRef(function(n,s){return o.jsx(Y5,{ref:s,...n})});function X5({className:e,type:n,...s}){return o.jsx(F5,{type:n,"data-slot":"input",className:Pt("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 K5({className:e,...n}){return o.jsx("textarea",{"data-slot":"textarea",className:Pt("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 Q5(e){return Lt(e.defaultTagName??"div",e,e)}const Z5=cx("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 J5({className:e,variant:n="default",render:s,...r}){return Q5({defaultTagName:"span",props:Na({className:Pt(Z5({variant:n}),e)},r),render:s,state:{slot:"badge",variant:n}})}const xw=b.createContext(void 0);function W5(){const e=b.useContext(xw);if(e===void 0)throw new Error(Rn(63));return e}let L1=(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 bw={...ux,checked(e){return e?{[L1.checked]:""}:{[L1.unchecked]:""}}};function fx(e,n){const s=b.useRef(e),r=Me(n);Re(()=>{s.current!==e&&r(s.current)},[e,r]),Re(()=>{s.current=e},[e])}const e4=b.forwardRef(function(n,s){const{checked:r,className:i,defaultChecked:c,"aria-labelledby":d,form:f,id:p,inputRef:m,name:h,nativeButton:x=!1,onCheckedChange:y,readOnly:S=!1,required:w=!1,disabled:_=!1,render:j,uncheckedValue:k,value:E,style:R,...N}=n,{clearErrors:M}=hw(),{state:A,setTouched:O,setDirty:L,validityData:U,setFilled:P,setFocused:B,shouldValidateOnChange:D,validationMode:H,disabled:Y,name:Q,validation:q}=lc(),{labelId:X}=Kd(),Z=Y||_,G=Q??h,K=b.useRef(null),I=As(K,m,q.inputRef),V=b.useRef(null),$=vr(),W=Qd({id:p,implicit:!1,controlRef:V}),oe=x?void 0:W,[ce,se]=Fi({controlled:r,default:!!c,name:"Switch",state:"checked"});dx(V,$,ce),Re(()=>{K.current&&P(K.current.checked)},[K,P]),fx(ce,()=>{M(G),L(ce!==U.initialValue),P(ce),D()?q.commit(ce):q.commit(ce,!0)});const{getButtonProps:ie,buttonRef:te}=gl({disabled:Z,native:x}),ke=V5(d,X,K,!x,oe),$e={id:x?W:$,role:"switch","aria-checked":ce,"aria-readonly":S||void 0,"aria-required":w||void 0,"aria-labelledby":ke,onFocus(){Z||B(!0)},onBlur(){const ze=K.current;!ze||Z||(O(!0),B(!1),H==="onBlur"&&q.commit(ze.checked))},onClick(ze){if(S||Z)return;ze.preventDefault();const De=K.current;De&&De.dispatchEvent(new(Ft(De)).PointerEvent("click",{bubbles:!0,shiftKey:ze.shiftKey,ctrlKey:ze.ctrlKey,altKey:ze.altKey,metaKey:ze.metaKey}))}},be=Na({checked:ce,disabled:Z,form:f,id:oe,name:G,required:w,style:G?Qj:zh,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:I,onChange(ze){if(ze.nativeEvent.defaultPrevented)return;if(S){ze.preventDefault();return}const De=ze.currentTarget.checked,xe=tt(Ts,ze.nativeEvent);y?.(De,xe),!xe.isCanceled&&se(De)},onFocus(){V.current?.focus()}},q.getInputValidationProps,E!==void 0?{value:E}:an),Se=b.useMemo(()=>({...A,checked:ce,disabled:Z,readOnly:S,required:w}),[A,ce,Z,S,w]),Ee=Lt("span",n,{state:Se,ref:[s,V,te],props:[$e,q.getValidationProps,N,ie],stateAttributesMapping:bw});return o.jsxs(xw.Provider,{value:Se,children:[Ee,!ce&&G&&k!==void 0&&o.jsx("input",{type:"hidden",form:f,name:G,value:k}),o.jsx("input",{...be,suppressHydrationWarning:!0})]})}),t4=b.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,f=W5();return Lt("span",n,{state:f,ref:s,stateAttributesMapping:bw,props:d})});function n4({className:e,size:n="default",...s}){return o.jsx(e4,{"data-slot":"switch","data-size":n,className:Pt("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:o.jsx(t4,{"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 a4({className:e,...n}){return o.jsx(Td,{role:"status","aria-label":"Loading",className:Pt("size-4 animate-spin",e),...n})}const vw=b.createContext(!1),yw=b.createContext(void 0);function eo(e){const n=b.useContext(yw);if(e===!1&&n===void 0)throw new Error(Rn(27));return n}const s4={...pl,...ml},_w=b.forwardRef(function(n,s){const{render:r,className:i,style:c,forceRender:d=!1,...f}=n,{store:p}=eo(),m=p.useState("open"),h=p.useState("nested"),x=p.useState("mounted"),y=p.useState("transitionStatus");return Lt("div",n,{state:{open:m,transitionStatus:y},ref:[p.context.backdropRef,s],stateAttributesMapping:s4,props:[{role:"presentation",hidden:!x,style:{userSelect:"none",WebkitUserSelect:"none"}},f],enabled:d||!h})}),jw=b.forwardRef(function(n,s){const{render:r,className:i,style:c,disabled:d=!1,nativeButton:f=!0,...p}=n,{store:m}=eo(),h=m.useState("open"),{getButtonProps:x,buttonRef:y}=gl({disabled:d,native:f}),S={disabled:d};function w(_){h&&m.setOpen(!1,tt(ET,_.nativeEvent))}return Lt("button",n,{state:S,ref:[s,y],props:[{onClick:w},p,x]})}),Sw=b.forwardRef(function(n,s){const{render:r,className:i,style:c,id:d,...f}=n,{store:p}=eo(),m=vr(d);return p.useSyncedValueWithCleanup("descriptionElementId",m),Lt("p",n,{ref:s,props:[{id:m},f]})});let r4=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),o4=(function(e){return e[e.open=Vr.open]="open",e[e.closed=Vr.closed]="closed",e[e.startingStyle=Vr.startingStyle]="startingStyle",e[e.endingStyle=Vr.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const ww=b.createContext(void 0);function l4(){const e=b.useContext(ww);if(e===void 0)throw new Error(Rn(26));return e}const Oi="ArrowUp",$o="ArrowDown",yd="ArrowLeft",zi="ArrowRight",Zd="Home",Jd="End",Cw=new Set([yd,zi]),i4=new Set([yd,zi,Zd,Jd]),Ew=new Set([Oi,$o]),c4=new Set([Oi,$o,Zd,Jd]),kw=new Set([...Cw,...Ew]),mx=new Set([...kw,Zd,Jd]),u4="Shift",d4="Control",f4="Alt",m4="Meta",p4=new Set([u4,d4,f4,m4]);function g4(e){return Ut(e)&&e.tagName==="INPUT"}function P1(e){return!!(g4(e)&&e.selectionStart!=null||Ut(e)&&e.tagName==="TEXTAREA")}function B1(e,n,s,r){if(!e||!n||!n.scrollTo)return;let i=e.scrollLeft,c=e.scrollTop;const d=e.clientWidth<e.scrollWidth,f=e.clientHeight<e.scrollHeight;if(d&&r!=="vertical"){const p=I1(e,n,"left"),m=Mu(e),h=Mu(n);s==="ltr"&&(p+n.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight?i=p+n.offsetWidth+h.scrollMarginRight-e.clientWidth+m.scrollPaddingRight:p-h.scrollMarginLeft<e.scrollLeft+m.scrollPaddingLeft&&(i=p-h.scrollMarginLeft-m.scrollPaddingLeft)),s==="rtl"&&(p-h.scrollMarginRight<e.scrollLeft+m.scrollPaddingLeft?i=p-h.scrollMarginLeft-m.scrollPaddingLeft:p+n.offsetWidth+h.scrollMarginRight>e.scrollLeft+e.clientWidth-m.scrollPaddingRight&&(i=p+n.offsetWidth+h.scrollMarginRight-e.clientWidth+m.scrollPaddingRight))}if(f&&r!=="horizontal"){const p=I1(e,n,"top"),m=Mu(e),h=Mu(n);p-h.scrollMarginTop<e.scrollTop+m.scrollPaddingTop?c=p-h.scrollMarginTop-m.scrollPaddingTop:p+n.offsetHeight+h.scrollMarginBottom>e.scrollTop+e.clientHeight-m.scrollPaddingBottom&&(c=p+n.offsetHeight+h.scrollMarginBottom-e.clientHeight+m.scrollPaddingBottom)}e.scrollTo({left:i,top:c,behavior:"auto"})}function I1(e,n,s){const r=s==="left"?"offsetLeft":"offsetTop";let i=0;for(;n.offsetParent&&(i+=n[r],n.offsetParent!==e);)n=n.offsetParent;return i}function Mu(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 h4={...pl,...ml,nestedDialogOpen(e){return e?{[o4.nestedDialogOpen]:""}:null}},Nw=b.forwardRef(function(n,s){const{render:r,className:i,style:c,finalFocus:d,initialFocus:f,...p}=n,{store:m}=eo(),h=m.useState("descriptionElementId"),x=m.useState("disablePointerDismissal"),y=m.useState("floatingRootContext"),S=m.useState("popupProps"),w=m.useState("modal"),_=m.useState("mounted"),j=m.useState("nested"),k=m.useState("nestedOpenDialogCount"),E=m.useState("open"),R=m.useState("openMethod"),N=m.useState("titleElementId"),M=m.useState("transitionStatus"),A=m.useState("role"),O=y.useState("floatingId"),L=p.id??O;l4(),br({open:E,ref:m.context.popupRef,onComplete(){E&&m.context.onOpenChangeComplete?.(!0)}});function U(Q){return Q==="touch"?m.context.popupRef.current:!0}const P=f===void 0?U:f,B=k>0,D=m.useStateSetter("popupElement"),Y=Lt("div",n,{state:{open:E,nested:j,transitionStatus:M,nestedDialogOpen:B},props:[S,{id:L,"aria-labelledby":N??void 0,"aria-describedby":h??void 0,role:A,...$d,hidden:!_,onKeyDown(Q){mx.has(Q.key)&&Q.stopPropagation()},style:{[r4.nestedDialogs]:k}},p],ref:[s,m.context.popupRef,D],stateAttributesMapping:h4});return o.jsx(jS,{context:y,openInteractionType:R,disabled:!_,closeOnFocusOut:!x,initialFocus:P,returnFocus:d,modal:w!==!1,restoreFocus:"popup",children:Y})}),Rw=b.forwardRef(function(n,s){const{cutout:r,...i}=n;let c;if(r){const d=r.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 o.jsx("div",{ref:s,role:"presentation","data-base-ui-inert":"",...i,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:c}})}),Tw=b.forwardRef(function(n,s){const{keepMounted:r=!1,...i}=n,{store:c}=eo(),d=c.useState("mounted"),f=c.useState("modal"),p=c.useState("open");return d||r?o.jsx(ww.Provider,{value:r,children:o.jsxs(_S,{ref:s,...i,children:[d&&f===!0&&o.jsx(Rw,{ref:c.context.internalBackdropRef,inert:Jh(!p)}),n.children]})}):null});let U1={},H1={},q1="";function x4(e){if(typeof document>"u")return!1;const n=xt(e);return Ft(n).innerWidth-n.documentElement.clientWidth>0}function b4(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const s=xt(e),r=s.documentElement,i=s.body,c=hr(r)?r:i,d=c.style.overflowY,f=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",c.style.overflowY="scroll";const p=c.offsetWidth;c.style.overflowY="hidden";const m=c.offsetWidth;return c.style.overflowY=d,r.style.scrollbarGutter=f,p===m}function v4(e){const n=xt(e),s=n.documentElement,r=n.body,i=hr(s)?s:r,c={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(i.style,c)}}function y4(e){const n=xt(e),s=n.documentElement,r=n.body,i=Ft(s);let c=0,d=0,f=!1;const p=Ga.create();if(Eh&&(i.visualViewport?.scale??1)!==1)return()=>{};function m(){const S=i.getComputedStyle(s),w=i.getComputedStyle(r),k=(S.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";c=s.scrollTop,d=s.scrollLeft,U1={scrollbarGutter:s.style.scrollbarGutter,overflowY:s.style.overflowY,overflowX:s.style.overflowX},q1=s.style.scrollBehavior,H1={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};const E=s.scrollHeight>s.clientHeight,R=s.scrollWidth>s.clientWidth,N=S.overflowY==="scroll"||w.overflowY==="scroll",M=S.overflowX==="scroll"||w.overflowX==="scroll",A=Math.max(0,i.innerWidth-r.clientWidth),O=Math.max(0,i.innerHeight-r.clientHeight),L=parseFloat(w.marginTop)+parseFloat(w.marginBottom),U=parseFloat(w.marginLeft)+parseFloat(w.marginRight),P=hr(s)?s:r;if(f=b4(e),f){s.style.scrollbarGutter=k,P.style.overflowY="hidden",P.style.overflowX="hidden";return}Object.assign(s.style,{scrollbarGutter:k,overflowY:"hidden",overflowX:"hidden"}),(E||N)&&(s.style.overflowY="scroll"),(R||M)&&(s.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:L||O?`calc(100dvh - ${L+O}px)`:"100dvh",width:U||A?`calc(100vw - ${U+A}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=c,r.scrollLeft=d,s.setAttribute("data-base-ui-scroll-locked",""),s.style.scrollBehavior="unset"}function h(){Object.assign(s.style,U1),Object.assign(r.style,H1),f||(s.scrollTop=c,s.scrollLeft=d,s.removeAttribute("data-base-ui-scroll-locked"),s.style.scrollBehavior=q1)}function x(){h(),p.request(m)}m();const y=ct(i,"resize",x);return()=>{p.cancel(),h(),typeof i.removeEventListener=="function"&&y()}}class _4{lockCount=0;restore=null;timeoutLock=Ba.create();timeoutUnlock=Ba.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 r=xt(n).documentElement,i=Ft(r).getComputedStyle(r).overflowY;if(i==="hidden"||i==="clip"){this.restore=Dn;return}const c=Pj||!x4(n);this.restore=c?v4(n):y4(n)}}const j4=new _4;function Aw(e=!0,n=null){Re(()=>{if(e)return j4.acquire(n)},[e,n])}function S4(e){const{store:n,parentContext:s,actionsRef:r,isDrawer:i}=e,c=n.useState("open");P3(n,c),LS(n);const{forceUnmount:d}=PS(c,n),f=b.useCallback(()=>{n.setOpen(!1,tt(Gj))},[n]);return b.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]),{parentContext:s,isDrawer:i}}function w4({store:e,dialogRoot:n}){const{parentContext:s,isDrawer:r}=n,i=e.useState("open"),c=e.useState("disablePointerDismissal"),d=e.useState("modal"),f=e.useState("popupElement"),p=e.useState("floatingRootContext"),[m,h]=b.useState(0),[x,y]=b.useState(0),S=m===0,w=Vh(p,{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 R=En(E);if(S&&!c){const N=R;return d&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===N||e.context.backdropRef.current===N||Ye(N,f)&&!N?.hasAttribute("data-base-ui-portal"):!0}return!1},escapeKey:S});Aw(i&&d===!0,f),e.useContextCallback("onNestedDialogOpen",(E,R)=>{h(E),y(R)}),e.useContextCallback("onNestedDialogClose",()=>{h(0),y(0)}),b.useEffect(()=>(s?.onNestedDialogOpen&&i&&s.onNestedDialogOpen(m+1,x+(r?1:0)),s?.onNestedDialogClose&&!i&&s.onNestedDialogClose(),()=>{s?.onNestedDialogClose&&i&&s.onNestedDialogClose()}),[r,i,m,x,s]);const _=w.reference??an,j=w.trigger??an,k=b.useMemo(()=>Na($d,w.floating),[w.floating]);return BS(e,{activeTriggerProps:_,inactiveTriggerProps:j,popupProps:k,nestedOpenDialogCount:m,nestedOpenDrawerCount:x}),null}const C4={...qS,modal:Te(e=>e.modal),nested:Te(e=>e.nested),nestedOpenDialogCount:Te(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:Te(e=>e.nestedOpenDrawerCount),disablePointerDismissal:Te(e=>e.disablePointerDismissal),openMethod:Te(e=>e.openMethod),descriptionElementId:Te(e=>e.descriptionElementId),titleElementId:Te(e=>e.titleElementId),viewportElement:Te(e=>e.viewportElement),role:Te(e=>e.role)};class px extends Gh{constructor(n,s,r=!1){const i=new Gd,c=E4(n);c.floatingRootContext=US(i,s,r),super(c,{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:i,onOpenChange:void 0,onOpenChangeComplete:void 0},C4)}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 r={open:n};DS(r,n,s.trigger),this.update(r)};static useStore(n,s){return zS(n,(i,c)=>new px(s,i,c),!0).store}}function E4(e={}){return{...IS(),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 k4(e,n="dialog"){const{children:s,open:r,defaultOpen:i=!1,onOpenChange:c,onOpenChangeComplete:d,disablePointerDismissal:f=!1,modal:p=!0,actionsRef:m,handle:h,triggerId:x,defaultTriggerId:y=null}=e,S=n==="drawer",w=n==="alert-dialog",_=w?!0:p,j=w||f,k=w?"alertdialog":"dialog",E=eo(!0),N={modal:_,disablePointerDismissal:j,nested:!!E,role:k},M=px.useStore(h?.store,{open:i,openProp:r,activeTriggerId:y,triggerIdProp:x,...N});wh(()=>{const D=r===void 0&&M.state.open===!1&&i===!0?{open:!0,activeTriggerId:y}:null;w?M.update(D?{...N,...D}:N):D&&M.update(D)}),M.useControlledProp("openProp",r),M.useControlledProp("triggerIdProp",x),M.useSyncedValues(N),M.useContextCallback("onOpenChange",c),M.useContextCallback("onOpenChangeComplete",d);const A=M.useState("open"),O=M.useState("mounted"),L=M.useState("payload"),U=S4({store:M,actionsRef:m,parentContext:E?.store.context,isDrawer:S}),P=A||O,B=b.useMemo(()=>({store:M}),[M]);return o.jsx(vw.Provider,{value:!1,children:o.jsxs(yw.Provider,{value:B,children:[P&&o.jsx(w4,{store:M,dialogRoot:U}),typeof s=="function"?s({payload:L}):s]})})}function Mw(e){const n=b.useContext(vw)?"drawer":"dialog";return k4(e,n)}const Ow=b.forwardRef(function(n,s){const{render:r,className:i,style:c,id:d,...f}=n,{store:p}=eo(),m=vr(d);return p.useSyncedValueWithCleanup("titleElementId",m),Lt("h2",n,{ref:s,props:[{id:m},f]})});function N4(e){const n=b.useRef(""),s=b.useCallback(i=>{i.defaultPrevented||(n.current=i.pointerType,e(i,i.pointerType))},[e]);return{onClick:b.useCallback(i=>{if(i.detail===0){e(i,"keyboard");return}"pointerType"in i?e(i,i.pointerType):e(i,n.current),n.current=""},[e]),onPointerDown:s}}function R4(e,n){const s=Me((c,d)=>{(typeof e=="function"?e():e)||n(d||(Pj?"touch":""))}),{onClick:r,onPointerDown:i}=N4(s);return b.useMemo(()=>({onClick:r,onPointerDown:i}),[r,i])}function T4(e){const[n,s]=b.useState(null),r=R4(e,s);return fx(e,i=>{i&&!e&&s(null)}),b.useMemo(()=>({openMethod:n,triggerProps:r}),[n,r])}function A4({...e}){return o.jsx(Mw,{"data-slot":"dialog",...e})}function M4({...e}){return o.jsx(Tw,{"data-slot":"dialog-portal",...e})}function O4({className:e,...n}){return o.jsx(_w,{"data-slot":"dialog-overlay",className:Pt("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 z4({className:e,children:n,showCloseButton:s=!0,...r}){return o.jsxs(M4,{children:[o.jsx(O4,{}),o.jsxs(Nw,{"data-slot":"dialog-content",className:Pt("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),...r,children:[n,s&&o.jsxs(jw,{"data-slot":"dialog-close",render:o.jsx(nl,{variant:"ghost",className:"absolute top-2 right-2",size:"icon-sm"}),children:[o.jsx(ec,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function D4({className:e,...n}){return o.jsx("div",{"data-slot":"dialog-header",className:Pt("flex flex-col gap-2",e),...n})}function L4({className:e,...n}){return o.jsx(Ow,{"data-slot":"dialog-title",className:Pt("font-heading text-base leading-none font-medium",e),...n})}function P4({className:e,...n}){return o.jsx(Sw,{"data-slot":"dialog-description",className:Pt("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...n})}const B4={primary:"default",secondary:"outline",ghost:"ghost",destructive:"destructive"},I4={sm:"sm",md:"default"};function he({variant:e="secondary",size:n="md",loading:s,className:r,children:i,disabled:c,type:d="button",...f}){return o.jsxs(nl,{type:d,variant:B4[e],size:I4[n],disabled:c||s,className:r,...f,children:[s?o.jsx(gr,{size:14}):null,i]})}function Ce(e){return o.jsx(X5,{...e})}function Qt(e){return o.jsx(K5,{...e})}function U4(e){return o.jsx("select",{...e,className:Ae("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 fe({label:e,hint:n,badge:s,children:r}){return o.jsxs("label",{className:"block space-y-1",children:[o.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[e,s&&o.jsx("span",{className:"rounded bg-muted px-1 py-0.5 text-[9px] font-semibold uppercase tracking-wide text-muted-foreground",children:s})]}),r,n&&o.jsx("span",{className:"block text-[11px] text-muted-foreground/70",children:n})]})}function sn({checked:e,onChange:n,label:s,disabled:r}){return o.jsxs("label",{className:Ae("inline-flex items-center gap-2",r&&"opacity-50"),children:[o.jsx(n4,{checked:e,onCheckedChange:n,disabled:r}),s&&o.jsx("span",{className:"text-sm",children:s})]})}function Ue({children:e,tone:n="muted",className:s}){const r=n==="danger"?"destructive":n==="muted"?"secondary":"outline",i={muted:"",danger:"",success:"text-emerald-400 border-emerald-500/30",warning:"text-amber-400 border-amber-500/30",info:"text-sky-400 border-sky-500/30"};return o.jsx(J5,{variant:r,className:Ae("rounded-md",i[n],s),children:e})}function ma({open:e,onClose:n,title:s,description:r,children:i,footer:c,size:d="md"}){const f={sm:"sm:max-w-md",md:"sm:max-w-lg",lg:"sm:max-w-2xl",xl:"sm:max-w-4xl"};return o.jsx(A4,{open:e,onOpenChange:p=>{p||n()},children:o.jsxs(z4,{className:Ae("flex max-h-[88vh] w-full flex-col gap-0 p-0",f[d]),children:[(s||r)&&o.jsxs(D4,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[s&&o.jsx(L4,{children:s}),r&&o.jsx(P4,{children:r})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-auto px-5 py-4",children:i}),c&&o.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-5 py-4",children:c})]})})}function gr({size:e=14}){return o.jsx(a4,{style:{width:e,height:e}})}function ot({children:e}){return o.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 Je({label:e="Cargando…"}){return o.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[o.jsx(gr,{})," ",e]})}const zw=b.createContext(null);let H4=1;function q4({children:e}){const[n,s]=b.useState([]),r=b.useCallback((c,d)=>{const f=H4++;s(p=>[...p,{id:f,kind:c,message:d}]),setTimeout(()=>{s(p=>p.filter(m=>m.id!==f))},4500)},[]),i=b.useMemo(()=>({show:r,success:c=>r("success",c),error:c=>r("error",c),info:c=>r("info",c)}),[r]);return b.useEffect(()=>(window.__apxToast=i,()=>{delete window.__apxToast}),[i]),o.jsxs(zw.Provider,{value:i,children:[e,o.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=>o.jsx("div",{className:Ae("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:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx("span",{className:Ae("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")}),o.jsx("span",{className:"flex-1 break-words",children:c.message})]})},c.id))})]})}function nt(){const e=b.useContext(zw);if(!e)throw new Error("useToast must be used inside <ToastProvider>");return e}function Dw(){const{data:e,error:n,isLoading:s}=Xe("/health",()=>d5.get(),{refreshInterval:Ad.health});return{health:e,error:n,isLoading:s,isUp:!n&&!!e}}function V4(){const{data:e,error:n,isLoading:s,mutate:r}=Xe("/engines",()=>bd.list());return{engines:e?.engines||[],error:n,isLoading:s,mutate:r}}function $4(){const{data:e,error:n,isLoading:s,mutate:r}=Xe("/telegram/status",()=>kn.status(),{refreshInterval:Ad.telegramStatus});return{status:e,error:n,isLoading:s,mutate:r}}function gx(){const{data:e,error:n,isLoading:s,mutate:r}=Xe("/telegram/channels",()=>kn.channels.list());return{channels:e?.channels||[],error:n,isLoading:s,mutate:r}}function hx(){const{data:e,error:n,isLoading:s,mutate:r}=Xe("/telegram/contacts",()=>kn.contacts.list());return{contacts:e?.contacts||[],roles:e?.roles||{},channelOwners:e?.channel_owners||[],error:n,isLoading:s,mutate:r}}function Da(e){return typeof e=="string"&&e.startsWith("*** set ***")}function fr(e,n="(no seteada)"){return Da(e)?e:n}function al(e){if(typeof e!="string")return null;const n=e.match(/\(\.\.\.([^)]+)\)/);return n?n[1]:null}function Lw({channel:e,onClose:n,onSaved:s}){const r=nt(),[i,c]=b.useState(!1),[d,f]=b.useState({name:""});b.useEffect(()=>{f(e?{...e,bot_token:""}:{name:""})},[e?.name]);const p=async()=>{if(!d.name?.trim()){r.error("name requerido");return}c(!0);try{e&&e.name!==""&&e?.name===d.name?await kn.channels.patch(e.name,d):await kn.channels.upsert(d),r.success("Canal guardado."),s()}catch(m){r.error(m.message)}finally{c(!1)}};return o.jsx(ma,{open:!!e,onClose:n,title:e?.name?`Editar canal: ${e.name}`:"Nuevo canal de Telegram",description:"POST /telegram/channels (upsert) — PATCH /telegram/channels/:name (parcial).",footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:n,disabled:i,children:C("common.cancel")}),o.jsx(he,{variant:"primary",onClick:p,loading:i,children:C("common.save")})]}),children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(fe,{label:"name (slug interno)",children:o.jsx(Ce,{value:d.name,onChange:m=>f({...d,name:m.target.value}),disabled:!!e?.name})}),o.jsx(fe,{label:"bot_token",hint:e?.bot_token?fr(e.bot_token):"Token del BotFather. Se guarda en ~/.apx/config.json.",children:o.jsx(Ce,{type:"password",value:d.bot_token||"",onChange:m=>f({...d,bot_token:m.target.value}),placeholder:e?.bot_token?fr(e.bot_token):""})}),o.jsx(fe,{label:"chat_id",children:o.jsx(Ce,{value:d.chat_id||"",onChange:m=>f({...d,chat_id:m.target.value})})}),o.jsx(fe,{label:"project",hint:"Slug o id del proyecto al que pinear este canal (opcional).",children:o.jsx(Ce,{value:d.project||"",onChange:m=>f({...d,project:m.target.value})})}),o.jsx(fe,{label:"route_to_agent",hint:"Agente que contesta; vacío = super-agent APX.",children:o.jsx(Ce,{value:d.route_to_agent||"",onChange:m=>f({...d,route_to_agent:m.target.value})})}),o.jsx(fe,{label:"owner_user_id",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.",children:o.jsx(Ce,{value:d.owner_user_id!=null?String(d.owner_user_id):"",onChange:m=>{const h=m.target.value.trim();f({...d,owner_user_id:h===""?void 0:/^\d+$/.test(h)?Number(h):h})},placeholder:"889721252"})}),o.jsx(sn,{checked:!!d.respond_with_engine,onChange:m=>f({...d,respond_with_engine:m}),label:"Responder con engine (no echo)"})]})})}function Pw({channel:e,onClose:n}){const s=nt(),[r,i]=b.useState(C("admin.telegram_default_message")),[c,d]=b.useState(!1),f=async()=>{if(!(!r.trim()||!e)){d(!0);try{await kn.send({text:r,channel:e.name}),s.success("Mensaje enviado."),n()}catch(p){s.error(p.message)}finally{d(!1)}}};return o.jsx(ma,{open:!!e,onClose:n,title:e?`${C("admin.telegram_send_test_title")} ${e.name}`:"",description:e?`chat_id: ${e.chat_id||"—"}`:"",footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:n,disabled:c,children:C("common.cancel")}),o.jsx(he,{variant:"primary",onClick:f,loading:c,children:"Enviar"})]}),children:o.jsx(fe,{label:"Texto",children:o.jsx(Qt,{rows:4,value:r,onChange:p=>i(p.target.value)})})})}function Bw({bare:e=!1}){const n=nt(),{contacts:s,roles:r,channelOwners:i,isLoading:c,mutate:d}=hx(),f=new Set(i.filter(y=>y.owner_user_id!=null).map(y=>String(y.owner_user_id))),p=Array.from(new Set(["owner","guest",...Object.keys(r)])),m=async(y,S)=>{try{await kn.contacts.patch(y.user_id,{role:S}),n.success(`${y.name||y.user_id} → ${S}`),d()}catch(w){n.error(w.message)}},h=async y=>{if(confirm(C("telegram_contacts.delete_confirm",{name:y.name||String(y.user_id)})))try{await kn.contacts.remove(y.user_id),n.success(C("telegram_contacts.removed")),d()}catch(S){n.error(S.message)}},x=o.jsxs(o.Fragment,{children:[c&&o.jsx(Je,{}),!c&&s.length===0&&o.jsx(ot,{children:C("telegram_contacts.empty")}),s.length>0&&o.jsx("ul",{className:"space-y-2 text-sm",children:s.map(y=>{const S=f.has(String(y.user_id)),w=S?"owner":y.role||"guest";return o.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("span",{className:"font-medium",children:y.name||"—"}),y.username&&o.jsxs("span",{className:"ml-2 text-xs text-muted-fg",children:["@",y.username]}),S&&o.jsx(Ue,{tone:"success",children:C("telegram_contacts.owner_badge")})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(U4,{value:w,disabled:S,onChange:_=>m(y,_.target.value),title:C(S?"telegram_contacts.owner_hint":"telegram_contacts.assign_role"),children:p.map(_=>o.jsx("option",{value:_,children:_},_))}),o.jsx(he,{size:"sm",variant:"destructive",onClick:()=>h(y),children:C("common.delete")})]})]}),o.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[o.jsxs("span",{children:["user_id: ",String(y.user_id)]}),o.jsxs("span",{children:[C("telegram_contacts.last_seen")," ",y.last_seen?y.last_seen.slice(0,10):"—"]}),o.jsx("span",{children:G4(r[w])})]})]},String(y.user_id))})})]});return e?x:o.jsx(He,{title:C("telegram_contacts.title"),description:C("telegram_contacts.desc"),children:x})}function G4(e){return!e||e.tools===void 0?"":e.tools==="*"?C("telegram_contacts.tools_all"):Array.isArray(e.tools)?e.tools.length?`${C("telegram_contacts.tools_label")} ${e.tools.join(", ")}`:C("telegram_contacts.tools_none"):""}function Y4(){const e=Ia(),n=nt(),{health:s,isUp:r}=Dw(),{projects:i,isLoading:c,mutate:d}=oc(),{engines:f,isLoading:p}=V4(),{status:m,mutate:h}=$4(),{channels:x,isLoading:y,mutate:S}=gx(),[w,_]=b.useState(null),[j,k]=b.useState(null),E=async()=>{try{await el.reload(),n.success(C("admin.reload_success"))}catch(A){n.error(A.message)}},R=async()=>{try{m?.enabled?(await kn.stop(),n.info(C("admin.telegram_polling_stopped"))):(await kn.start(),n.success(C("admin.telegram_polling_started"))),h()}catch(A){n.error(A.message)}},N=async A=>{if(confirm(C("telegram_channels.delete_confirm",{name:A})))try{await kn.channels.remove(A),n.success(C("admin.telegram_channel_removed")),S()}catch(O){n.error(O.message)}},M=async(A,O)=>{if(confirm(C("admin.unregister_confirm",{label:O})))try{await Qn.remove(A),n.success(C("project.unregistered")),d()}catch(L){n.error(L.message)}};return o.jsxs("div",{className:"mx-auto max-w-5xl space-y-6 p-6","data-testid":"screen-admin",children:[o.jsxs("header",{className:"flex items-end justify-between",children:[o.jsxs("div",{children:[o.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:C("admin.title")}),o.jsx("p",{className:"text-sm text-muted-fg",children:C("admin.subtitle")})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsxs(he,{size:"sm",onClick:E,title:C("daemon.reload_hint"),children:[C("common.reload")," config"]}),o.jsxs(he,{size:"sm",variant:"primary",onClick:()=>e("/?action=add-project"),children:[o.jsx(Nn,{size:14})," ",C("nav.project")]})]})]}),o.jsx(He,{title:C("daemon.version"),children:o.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[o.jsx(Fp,{label:C("daemon.version"),value:s?.version||"—"}),o.jsx(Fp,{label:C("daemon.uptime"),value:s?`${s.uptime_s}s`:"—"}),o.jsx(Fp,{label:C("daemon.status"),value:C(r?"daemon.running":"daemon.down"),ok:r})]})}),o.jsxs(He,{title:C("admin.engines_title"),description:C("admin.engines_subtitle"),children:[p&&o.jsx(Je,{}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(A=>o.jsx(Ue,{tone:"info",children:A},A))})]}),o.jsxs(He,{title:C("admin.telegram_title"),description:C("admin.telegram_subtitle"),action:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(sn,{checked:!!m?.enabled,onChange:R,label:m?.enabled?C("admin.telegram_polling_on"):C("admin.telegram_polling_off")}),o.jsxs(he,{size:"sm",onClick:()=>_({name:""}),children:[o.jsx(Nn,{size:14})," ",C("admin.telegram_add_channel")]})]}),children:[y&&o.jsx(Je,{}),x.length===0&&o.jsx(ot,{children:C("common.none_yet")}),o.jsx("ul",{className:"space-y-2 text-sm",children:x.map(A=>o.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-medium",children:A.name}),o.jsxs("div",{className:"flex items-center gap-2",children:[A.project&&o.jsxs(Ue,{tone:"success",children:["project = ",A.project]}),o.jsxs(he,{size:"sm",variant:"ghost",onClick:()=>k(A),children:[o.jsx(Za,{size:13})," ",C("admin.telegram_send_test")]}),o.jsx(he,{size:"sm",variant:"secondary",onClick:()=>_(A),children:C("common.edit")}),o.jsx(he,{size:"sm",variant:"destructive",onClick:()=>N(A.name),children:C("common.delete")})]})]}),o.jsxs("div",{className:"mt-1 grid grid-cols-3 gap-2 text-xs text-muted-fg",children:[o.jsxs("span",{children:["chat_id: ",A.chat_id||"—"]}),o.jsxs("span",{children:["route_to_agent: ",A.route_to_agent||"default APX"]}),o.jsxs("span",{children:["engine: ",A.respond_with_engine?C("admin.engine_badge"):C("admin.engine_badge_no")]})]})]},A.name))})]}),o.jsx(Bw,{}),o.jsxs(He,{title:C("admin.projects_title"),description:C("admin.projects_subtitle"),children:[c&&o.jsx(Je,{}),o.jsx("ul",{className:"divide-y divide-border",children:i.map(A=>o.jsxs("li",{className:"flex items-center gap-3 py-2",children:[o.jsxs("span",{className:"w-10 font-mono text-xs text-muted-fg",children:["#",A.id]}),o.jsxs("button",{type:"button",className:"flex-1 text-left hover:underline",onClick:()=>e(`/p/${A.id}`),children:[o.jsx("span",{className:"font-medium",children:A.name||A.path.split("/").pop()}),o.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:A.path})]}),o.jsxs(Ue,{children:[A.agents??0," ",C("admin.agents_badge")]}),Number(A.id)!==0&&o.jsx(he,{size:"sm",variant:"destructive",onClick:()=>M(String(A.id),A.name||A.path),children:C("admin.unregister")})]},A.id))})]}),o.jsx(Lw,{channel:w,onClose:()=>_(null),onSaved:()=>{_(null),S()}}),o.jsx(Pw,{channel:j,onClose:()=>k(null)})]})}function Fp({label:e,value:n,ok:s}){return o.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[o.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),o.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&o.jsx(Xd,{ok:s}),o.jsx("span",{children:n})]})]})}function Iw(e){const[n,s]=b.useState(!1);b.useEffect(()=>{try{s(localStorage.getItem(e)==="true")}catch{}},[e]);const r=b.useCallback(()=>s(i=>{const c=!i;try{localStorage.setItem(e,String(c))}catch{}return c}),[e]);return{collapsed:n,toggle:r}}function F4({collapsed:e,onToggle:n}){return o.jsx(Jo,{content:e?"Expandir menú":"Colapsar menú",side:"bottom",children:o.jsx("button",{type:"button",onClick:n,"aria-label":e?"Expandir menú":"Colapsar menú",className:"flex size-7 shrink-0 items-center justify-center rounded-md text-muted-fg transition-colors hover:bg-accent hover:text-foreground",children:o.jsx(mR,{className:Ae("size-4 transition-transform",e&&"rotate-180")})})})}function X4({sections:e,active:n,onChange:s,collapsed:r=!1}){return o.jsx("nav",{className:Ae("hidden md:flex shrink-0 flex-col gap-1 py-3 transition-all",r?"w-12 items-center px-1":"w-52 px-2"),children:e.map((i,c)=>o.jsxs("div",{className:Ae("w-full",c>0&&"mt-2"),children:[!r&&i.title&&o.jsx("p",{className:"mb-1 px-2 text-[9px] font-semibold uppercase tracking-wider text-muted-fg/70",children:i.title}),o.jsx("div",{className:"space-y-0.5",children:i.items.map(({key:d,label:f,icon:p,badge:m})=>{const h=n===d,x=o.jsxs("button",{type:"button",onClick:()=>s(d),"data-testid":`tabnav-${d||"index"}`,className:Ae("flex cursor-pointer items-center rounded-lg transition-colors",r?"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:[o.jsx(p,{className:"size-4 shrink-0"}),!r&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"flex-1 truncate text-left text-xs",children:f}),m!==void 0&&o.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[9px] text-muted-fg",children:m})]})]});return r?o.jsx(Jo,{content:f,side:"right",children:x},d):o.jsx(b.Fragment,{children:x},d)})})]},c))})}const Uw=b.createContext(null),Hw=b.createContext(null),qw=b.createContext(""),Vw=b.createContext(null);function K4({children:e}){const[n,s]=b.useState(null),[r,i]=b.useState("");return o.jsx(Hw.Provider,{value:s,children:o.jsx(Uw.Provider,{value:n,children:o.jsx(Vw.Provider,{value:i,children:o.jsx(qw.Provider,{value:r,children:e})})})})}function Q4(){return b.useContext(Uw)}function Z4(e,n){const s=b.useContext(Hw);b.useEffect(()=>(s?.({collapsed:e,toggle:n}),()=>s?.(null)),[e,n,s])}function J4(){return b.useContext(qw)}function W4(e){const n=b.useContext(Vw);b.useEffect(()=>(n?.(e),()=>n?.("")),[e,n])}function $w({sections:e,active:n,onChange:s,collapsed:r,onToggleCollapse:i,actions:c,contentClassName:d,testId:f,children:p}){return Z4(r,i),o.jsxs("div",{className:"flex h-full",children:[o.jsx(X4,{sections:e,active:n,onChange:s,collapsed:r}),o.jsxs("div",{className:"flex min-w-0 flex-1 flex-col overflow-y-auto",children:[c?o.jsx("div",{className:"flex items-center justify-end gap-2 px-6 pt-3",children:c}):null,o.jsx("div",{className:Ae(d),"data-testid":f,children:p})]})]})}function V1({pid:e}){const n=Xe(`/projects/${e}/tasks?state=open`,()=>lr.list(e)),s=Xe(`/projects/${e}/routines`,()=>or.list(e)),r=Xe(`/projects/${e}/agents`,()=>Jt.list(e)),i=Xe(`/projects/${e}/mcps`,()=>Mi.list(e));return o.jsxs("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-3",children:[o.jsx(pi,{title:C("project.overview.tasks_open"),value:n.data?.length??"…",href:`/p/${e}/tasks`,icon:Ui}),o.jsx(pi,{title:C("project.overview.routines"),value:s.data?.length??"…",href:`/p/${e}/routines`,icon:Xo}),o.jsx(pi,{title:C("project.overview.agents"),value:r.data?.length??"…",href:`/p/${e}/agents`,icon:vn}),o.jsx(pi,{title:C("project.overview.mcps"),value:i.data?.length??"…",href:`/p/${e}/mcps`,icon:Rg}),o.jsx(pi,{title:C("project.overview.chat"),value:C("project.overview.chat_value"),href:`/p/${e}/chat`,icon:Ri})]})}function pi({title:e,value:n,href:s,icon:r}){return o.jsxs(lj,{to:s,className:"flex items-center gap-3 rounded-xl border border-border bg-card p-4 hover:bg-accent/40",children:[o.jsx("span",{className:"grid size-10 place-items-center rounded-lg bg-muted text-muted-fg",children:o.jsx(r,{size:20})}),o.jsxs("div",{children:[o.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),o.jsx("div",{className:"text-2xl font-semibold",children:n})]})]})}function eO(){const e=Ia(),{projects:n,isLoading:s}=oc();return o.jsxs(He,{title:C("base.workspaces_title"),description:C("base.workspaces_desc"),action:o.jsxs(he,{size:"sm",variant:"primary",onClick:()=>e("/p/0/workspaces?action=add-project"),children:[o.jsx(Nn,{size:14})," ",C("base.workspaces_new")]}),children:[s&&o.jsx(Je,{}),!s&&n.length===0&&o.jsx(ot,{children:C("base.workspaces_empty")}),o.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:n.map(r=>{const i=String(r.id)==="0",c=i?C("base.title"):r.name||r.path.split("/").pop()||String(r.id);return o.jsxs("button",{type:"button",onClick:()=>e(`/p/${r.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:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(vj,{className:"size-4 text-muted-fg"}),o.jsx("span",{className:"truncate text-sm font-semibold",children:c}),o.jsx(Ue,{tone:i?"success":"info",children:i?C("base.title"):mw(r.kind)})]}),o.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:r.path})]},r.id)})})]})}const Gw=b.createContext(null),Yw=b.createContext(null);function es(){const e=b.useContext(Gw);if(e===null)throw new Error(Rn(60));return e}function Fw(){const e=b.useContext(Yw);if(e===null)throw new Error(Rn(61));return e}const tO=(e,n)=>Object.is(e,n);function sl(e,n,s){return e==null||n==null?Object.is(e,n):s(e,n)}function nO(e,n,s){return!e||e.length===0?!1:e.some(r=>r===void 0?!1:sl(n,r,s))}function Di(e,n,s){return!e||e.length===0?-1:e.findIndex(r=>r===void 0?!1:sl(r,n,s))}function aO(e,n,s){return e.filter(r=>!sl(n,r,s))}function Wg(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return String(e)}}function Xw(e){return e!=null&&e.length>0&&typeof e[0]=="object"&&e[0]!=null&&"items"in e[0]}function sO(e){if(!Array.isArray(e))return e!=null&&"null"in e;const n=e;if(Xw(n)){for(const s of n)for(const r of s.items)if(r&&r.value==null&&r.label!=null)return!0;return!1}for(const s of n)if(s&&s.value==null&&s.label!=null)return!0;return!1}function Kw(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 Wg(e)}function qo(e,n){return n&&e!=null?n(e)??"":e&&typeof e=="object"&&"value"in e&&"label"in e?Wg(e.value):Wg(e)}function Qw(e,n,s){function r(){return Kw(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]??r();if(Array.isArray(n)){const i=n,c=Xw(i)?i.flatMap(d=>d.items):i;if(e==null||typeof e!="object"){const d=c.find(f=>f.value===e);return d&&d.label!=null?d.label:r()}if("value"in e){const d=c.find(f=>f&&f.value===e.value);if(d&&d.label!=null)return d.label}}return r()}function rO(e,n,s){return e.reduce((r,i,c)=>(c>0&&r.push(", "),r.push(o.jsx(b.Fragment,{children:Qw(i,n,s)},c)),r),[])}const Fe={id:Te(e=>e.id),labelId:Te(e=>e.labelId),modal:Te(e=>e.modal),multiple:Te(e=>e.multiple),items:Te(e=>e.items),itemToStringLabel:Te(e=>e.itemToStringLabel),itemToStringValue:Te(e=>e.itemToStringValue),isItemEqualToValue:Te(e=>e.isItemEqualToValue),value:Te(e=>e.value),hasSelectedValue:Te(e=>{const{value:n,multiple:s,itemToStringValue:r}=e;return n==null?!1:s&&Array.isArray(n)?n.length>0:qo(n,r)!==""}),hasNullItemLabel:Te((e,n)=>n?sO(e.items):!1),open:Te(e=>e.open),mounted:Te(e=>e.mounted),forceMount:Te(e=>e.forceMount),transitionStatus:Te(e=>e.transitionStatus),openMethod:Te(e=>e.openMethod),activeIndex:Te(e=>e.activeIndex),selectedIndex:Te(e=>e.selectedIndex),isActive:Te((e,n)=>e.activeIndex===n),isSelected:Te((e,n,s)=>{const r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(c=>sl(s,c,r)):e.selectedIndex===n&&e.selectedIndex!==null?!0:sl(s,i,r)}),isSelectedByFocus:Te((e,n)=>e.selectedIndex===n),popupProps:Te(e=>e.popupProps),triggerProps:Te(e=>e.triggerProps),triggerElement:Te(e=>e.triggerElement),positionerElement:Te(e=>e.positionerElement),listElement:Te(e=>e.listElement),popupSide:Te(e=>e.popupSide),scrollUpArrowVisible:Te(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Te(e=>e.scrollDownArrowVisible),hasScrollArrows:Te(e=>e.hasScrollArrows)};function Ci(e,n=Number.MIN_SAFE_INTEGER,s=Number.MAX_SAFE_INTEGER){return Math.max(n,Math.min(e,s))}const za=1;function xx(e,n){return Math.max(0,e-n)}function _d(e,n){if(n<=0)return 0;const s=Ci(e,0,n),r=s,i=n-s,c=r<=za,d=i<=za;return c&&d?r<=i?0:n:c?0:d?n:s}function oO(e){const{id:n,value:s,defaultValue:r=null,onValueChange:i,open:c,defaultOpen:d=!1,onOpenChange:f,name:p,form:m,autoComplete:h,disabled:x=!1,readOnly:y=!1,required:S=!1,modal:w=!0,actionsRef:_,inputRef:j,onOpenChangeComplete:k,items:E,multiple:R=!1,itemToStringLabel:N,itemToStringValue:M,isItemEqualToValue:A=tO,highlightItemOnHover:O=!0,children:L}=e,{clearErrors:U}=hw(),{setDirty:P,setTouched:B,setFocused:D,shouldValidateOnChange:H,validityData:Y,setFilled:Q,name:q,disabled:X,validation:Z,validationMode:G}=lc(),K=Qd({id:n}),I=X||x,V=q??p,[$,W]=Fi({controlled:s,default:R?r??qi:r,name:"Select",state:"value"}),[oe,ce]=Fi({controlled:c,default:d,name:"Select",state:"open"}),se=b.useRef([]),ie=b.useRef([]),te=b.useRef(null),ke=b.useRef(null),$e=b.useRef(0),be=b.useRef(null),Se=b.useRef([]),Ee=b.useRef(!1),ze=b.useRef(!1),De=b.useRef(null),xe=b.useRef(null),Ne=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),_e=b.useRef(!1),{mounted:Le,setMounted:Ge,transitionStatus:qe}=ac(oe),{openMethod:Oe,triggerProps:ve}=T4(oe),le=fa(()=>new OS({id:K,labelId:void 0,modal:w,multiple:R,itemToStringLabel:N,itemToStringValue:M,isItemEqualToValue:A,value:$,open:oe,mounted:Le,transitionStatus:qe,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,ye=Qe(le,Fe.activeIndex),je=Qe(le,Fe.selectedIndex),Be=Qe(le,Fe.triggerElement),Ze=Qe(le,Fe.positionerElement),_t=kM(Oe),Ht=Oe??_t,vt=b.useMemo(()=>R&&Array.isArray($)&&$.length===0?"":qo($,M),[R,$,M]),ut=b.useMemo(()=>R&&Array.isArray($)?$.map(at=>qo(at,M)):qo($,M),[R,$,M]),it=cn(le.state.triggerElement),Et=Me(()=>ut);dx(it,K,$,Et);const Bt=b.useRef($),pa=R?Array.isArray($)&&$.length>0:$!=null;Re(()=>{$!==Bt.current&&le.set("forceMount",!0)},[le,$]),Re(()=>{Q(pa)},[pa,Q]),Re(function(){const At=Se.current;let yn;if(R){const en=Array.isArray($)?$:[];if(en.length===0)yn=null;else{const kt=en[en.length-1],un=Di(At,kt,A);yn=un===-1?null:un}}else{const en=Di(At,$,A);yn=en===-1?null:en}yn===null&&(xe.current=null),!oe&&le.set("selectedIndex",yn)},[pa,R,oe,$,Se,A,le,xe]),fx($,()=>{U(V),P($!==Y.initialValue),H()?Z.commit($):Z.commit($,!0)});const gn=Me((at,At)=>{if(f?.(at,At),!At.isCanceled&&(ce(at),!at&&(At.reason===Pd||At.reason===Ah)&&(B(!0),D(!1),G==="onBlur"&&Z.commit($)),!at&&le.state.activeIndex!==null)){const yn=se.current[le.state.activeIndex];queueMicrotask(()=>{yn?.setAttribute("tabindex","-1")})}}),dt=Me(()=>{Ge(!1),le.update({activeIndex:null,openMethod:null}),k?.(!1)});br({enabled:!_,open:oe,ref:te,onComplete(){oe||dt()}}),b.useImperativeHandle(_,()=>({unmount:dt}),[dt]);const Tt=Me((at,At)=>{i?.(at,At),!At.isCanceled&&W(at)}),Xt=Me(()=>{const at=le.state.listElement||te.current;if(!at)return;const At=xx(at.scrollHeight,at.clientHeight),yn=_d(at.scrollTop,At),en=yn>0,kt=yn<At;le.state.scrollUpArrowVisible!==en&&le.set("scrollUpArrowVisible",en),le.state.scrollDownArrowVisible!==kt&&le.set("scrollDownArrowVisible",kt)}),yt=VS({open:oe,onOpenChange:gn,elements:{reference:Be,floating:Ze}}),Wt=RA(yt,{enabled:!y&&!I,event:"mousedown"}),Vt=Vh(yt),rn=X3(yt,{enabled:!y&&!I,listRef:se,activeIndex:ye,selectedIndex:je,disabledIndices:qi,onNavigate(at){at===null&&!oe||le.set("activeIndex",at)},focusItemOnHover:O}),Tn=K3(yt,{enabled:!y&&!I&&(oe||!R),listRef:ie,activeIndex:ye,selectedIndex:je,onMatch(at){oe?le.set("activeIndex",at):Tt(Se.current[at],tt("none"))},onTyping(at){Ee.current=at}}),qn=b.useMemo(()=>{const at=Na(Tn.reference,rn.reference,Vt.reference,Wt.reference,ve);return K&&(at.id=K),at},[Wt.reference,Tn.reference,rn.reference,Vt.reference,ve,K]),ta=b.useMemo(()=>Na($d,Tn.floating,rn.floating,Vt.floating),[Tn.floating,rn.floating,Vt.floating]),Vn=rn.item??an;wh(()=>{le.update({popupProps:ta,triggerProps:qn})}),Re(()=>{le.update({id:K,modal:w,multiple:R,value:$,open:oe,mounted:Le,transitionStatus:qe,popupProps:ta,triggerProps:qn,items:E,itemToStringLabel:N,itemToStringValue:M,isItemEqualToValue:A,openMethod:Ht})},[le,K,w,R,$,oe,Le,qe,ta,qn,E,N,M,A,Ht]);const ts=b.useMemo(()=>({store:le,name:V,required:S,disabled:I,readOnly:y,multiple:R,highlightItemOnHover:O,setValue:Tt,setOpen:gn,listRef:se,popupRef:te,scrollHandlerRef:ke,handleScrollArrowVisibility:Xt,scrollArrowsMountedCountRef:$e,itemProps:Vn,events:yt.context.events,valueRef:be,valuesRef:Se,labelsRef:ie,typingRef:Ee,selectionRef:Ne,firstItemTextRef:De,selectedItemTextRef:xe,validation:Z,onOpenChangeComplete:k,keyboardActiveRef:ze,alignItemWithTriggerActiveRef:_e,initialValueRef:Bt}),[le,V,S,I,y,R,O,Tt,gn,Vn,yt.context.events,Z,k,Xt]),An=As(j,Z.inputRef),na=R&&Array.isArray($)&&$.length>0,Ta=R?void 0:V,ns=b.useMemo(()=>!R||!Array.isArray($)||!V?null:$.map(at=>{const At=qo(at,M);return o.jsx("input",{type:"hidden",form:m,name:V,value:At},At)}),[R,$,m,V,M]);return o.jsx(Gw.Provider,{value:ts,children:o.jsxs(Yw.Provider,{value:yt,children:[L,o.jsx("input",{...Z.getInputValidationProps({onFocus(){le.state.triggerElement?.focus({focusVisible:!0})},onChange(at){if(at.nativeEvent.defaultPrevented||I||y){at.preventBaseUIHandler?.();return}const At=at.currentTarget.value,yn=tt(Ts,at.nativeEvent);function en(){if(R)return;const kt=Se.current.find(un=>qo(un,M).toLowerCase()===At.toLowerCase()||Kw(un,N).toLowerCase()===At.toLowerCase());kt!=null&&(P(kt!==Y.initialValue),Tt(kt,yn),H()&&Z.commit(kt))}le.set("forceMount",!0),queueMicrotask(en)}}),id:K&&Ta==null?`${K}-hidden-input`:void 0,form:m,name:Ta,autoComplete:h,value:vt,disabled:I,required:S&&!na,readOnly:y,ref:An,style:V?Qj:zh,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),ns]})})}function lO(e,n){return e??n}function iO(e){const n=e.getBoundingClientRect(),s=Ft(e),r=s.getComputedStyle(e,"::before"),i=s.getComputedStyle(e,"::after");if(!(r.content!=="none"||i.content!=="none"))return n;const d=parseFloat(r.width)||0,f=parseFloat(r.height)||0,p=parseFloat(i.width)||0,m=parseFloat(i.height)||0,h=Math.max(n.width,d,p),x=Math.max(n.height,f,m),y=h-n.width,S=x-n.height;return{left:n.left-y/2,right:n.right+y/2,top:n.top-S/2,bottom:n.bottom+S/2}}const Ou=2,cO=400,uO={...iM,...ux,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},dO=b.forwardRef(function(n,s){const{render:r,className:i,id:c,disabled:d=!1,nativeButton:f=!0,style:p,...m}=n,{setTouched:h,setFocused:x,validationMode:y,state:S,disabled:w}=lc(),{labelId:_}=Kd(),{store:j,setOpen:k,selectionRef:E,validation:R,readOnly:N,required:M,alignItemWithTriggerActiveRef:A,disabled:O,keyboardActiveRef:L}=es(),U=w||O||d,P=Qe(j,Fe.open),B=Qe(j,Fe.mounted),D=Qe(j,Fe.value),H=Qe(j,Fe.triggerProps),Y=Qe(j,Fe.positionerElement),Q=Qe(j,Fe.listElement),q=Qe(j,Fe.popupSide),X=Qe(j,Fe.id),Z=Qe(j,Fe.labelId),G=Qe(j,Fe.hasSelectedValue),K=B&&Y?q:null,I=c??X,V=lO(_,Z);Qd({id:I});const $=cn(Y),W=b.useRef(null),{getButtonProps:oe,buttonRef:ce}=gl({disabled:U,native:f}),se=Me(Ee=>{j.set("triggerElement",Ee)}),ie=As(s,W,ce,se),te=Zn(),ke=Zn(),$e=Zn();b.useEffect(()=>{if(P)return $e.start(cO,()=>{E.current.allowUnselectedMouseUp=!0,E.current.allowSelectedMouseUp=!0}),()=>{$e.clear()};E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},ke.clear()},[P,E,ke,$e]);const be=Na(H,{id:I,role:"combobox","aria-expanded":P?"true":"false","aria-haspopup":"listbox","aria-controls":P?Q?.id??od(Y)?.id:void 0,"aria-labelledby":V,"aria-readonly":N||void 0,"aria-required":M||void 0,tabIndex:U?-1:0,ref:ie,onFocus(Ee){x(!0),P&&A.current&&k(!1,tt(Ts,Ee.nativeEvent)),te.start(0,()=>{j.set("forceMount",!0)})},onBlur(Ee){Ye(Y,Ee.relatedTarget)||(h(!0),x(!1),y==="onBlur"&&R.commit(D))},onPointerMove(){L.current=!1},onKeyDown(){L.current=!0},onMouseDown(Ee){if(P)return;const ze=xt(Ee.currentTarget);function De(xe){if(!W.current)return;const Ne=xe.target;if(Ye(W.current,Ne)||Ye($.current,Ne)||Ne===W.current)return;const _e=iO(W.current);xe.clientX>=_e.left-Ou&&xe.clientX<=_e.right+Ou&&xe.clientY>=_e.top-Ou&&xe.clientY<=_e.bottom+Ou||k(!1,tt(kT,xe))}ke.start(0,()=>{ze.addEventListener("mouseup",De,{once:!0})})}},R.getValidationProps,m,oe);be.role="combobox";const Se={...S,open:P,disabled:U,value:D,readOnly:N,popupSide:K,placeholder:!G};return Lt("button",n,{ref:[s,W],state:Se,stateAttributesMapping:uO,props:be})}),fO={value:()=>null},mO=b.forwardRef(function(n,s){const{className:r,render:i,children:c,placeholder:d,style:f,...p}=n,{store:m,valueRef:h}=es(),x=Qe(m,Fe.value),y=Qe(m,Fe.items),S=Qe(m,Fe.itemToStringLabel),w=Qe(m,Fe.hasSelectedValue),_=!w&&d!=null&&c==null,j=Qe(m,Fe.hasNullItemLabel,_),k={value:x,placeholder:!w};let E=null;return typeof c=="function"?E=c(x):c!=null?E=c:!w&&d!=null&&!j?E=d:Array.isArray(x)?E=rO(x,y,S):E=Qw(x,y,S),Lt("span",n,{state:k,ref:[s,h],props:[{children:E},p],stateAttributesMapping:fO})}),pO=b.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,{store:f}=es(),m={open:Qe(f,Fe.open)};return Lt("span",n,{state:m,ref:s,props:[{"aria-hidden":!0,children:"▼"},d],stateAttributesMapping:GS})}),gO=b.createContext(void 0),hO=b.forwardRef(function(n,s){const{store:r}=es(),i=Qe(r,Fe.mounted),c=Qe(r,Fe.forceMount);return i||c?o.jsx(gO.Provider,{value:!0,children:o.jsx(_S,{ref:s,...n})}):null}),Zw=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function xO(){return b.useContext(Zw)}function bx(e){const{children:n,elementsRef:s,labelsRef:r,onMapChange:i}=e,c=Me(i),d=b.useRef(0),f=fa(vO).current,p=fa(bO).current,[m,h]=b.useState(0),x=b.useRef(m),y=Me((k,E)=>{p.set(k,E??null),x.current+=1,h(x.current)}),S=Me(k=>{p.delete(k),x.current+=1,h(x.current)}),w=b.useMemo(()=>{const k=new Map;return Array.from(p.keys()).filter(R=>R.isConnected).sort(yO).forEach((R,N)=>{const M=p.get(R)??{};k.set(R,{...M,index:N})}),k},[p,m]);Re(()=>{if(typeof MutationObserver!="function"||w.size===0)return;const k=new MutationObserver(E=>{const R=new Set,N=M=>R.has(M)?R.delete(M):R.add(M);E.forEach(M=>{M.removedNodes.forEach(N),M.addedNodes.forEach(N)}),R.size===0&&(x.current+=1,h(x.current))});return w.forEach((E,R)=>{R.parentElement&&k.observe(R.parentElement,{childList:!0})}),()=>{k.disconnect()}},[w]),Re(()=>{x.current===m&&(s.current.length!==w.size&&(s.current.length=w.size),r&&r.current.length!==w.size&&(r.current.length=w.size),d.current=w.size),c(w)},[c,w,s,r,m]),Re(()=>()=>{s.current=[]},[s]),Re(()=>()=>{r&&(r.current=[])},[r]);const _=Me(k=>(f.add(k),()=>{f.delete(k)}));Re(()=>{f.forEach(k=>k(w))},[f,w]);const j=b.useMemo(()=>({register:y,unregister:S,subscribeMapChange:_,elementsRef:s,labelsRef:r,nextIndexRef:d}),[y,S,_,s,r,d]);return o.jsx(Zw.Provider,{value:j,children:n})}function bO(){return new Map}function vO(){return new Set}function yO(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 Jw=b.createContext(void 0);function vx(){const e=b.useContext(Jw);if(!e)throw new Error(Rn(59));return e}function jd(e,n){e&&Object.assign(e.style,n)}const Ww={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},_O=20;function jO(e,n,s,r){const[i,c]=b.useState(!1);Re(()=>{if(!e||!n||s==null){c(!1);return}const d=xt(s).documentElement.clientWidth,f=s.offsetWidth;c(d>0&&f>0&&f>=d-_O)},[e,n,s]),Aw(e&&(!n||i),r)}const SO={position:"fixed"},wO=b.forwardRef(function(n,s){const{anchor:r,positionMethod:i="absolute",className:c,render:d,side:f="bottom",align:p="center",sideOffset:m=0,alignOffset:h=0,collisionBoundary:x="clipping-ancestors",collisionPadding:y,arrowPadding:S=5,sticky:w=!1,disableAnchorTracking:_,alignItemWithTrigger:j=!0,collisionAvoidance:k=vA,style:E,...R}=n,{store:N,listRef:M,labelsRef:A,alignItemWithTriggerActiveRef:O,selectedItemTextRef:L,valuesRef:U,initialValueRef:P,popupRef:B,setValue:D}=es(),H=Fw(),Y=Qe(N,Fe.open),Q=Qe(N,Fe.mounted),q=Qe(N,Fe.modal),X=Qe(N,Fe.value),Z=Qe(N,Fe.openMethod),G=Qe(N,Fe.positionerElement),K=Qe(N,Fe.triggerElement),I=Qe(N,Fe.isItemEqualToValue),V=Qe(N,Fe.transitionStatus),$=b.useRef(null),W=b.useRef(null),[oe,ce]=b.useState(j),se=Q&&oe&&Z!=="touch";!Q&&oe!==j&&ce(j),Re(()=>{Q||(Fe.scrollUpArrowVisible(N.state)&&N.set("scrollUpArrowVisible",!1),Fe.scrollDownArrowVisible(N.state)&&N.set("scrollDownArrowVisible",!1))},[N,Q]),b.useImperativeHandle(O,()=>se),jO((se||q)&&Y,Z==="touch",G,K);const ie=JS({anchor:r,floatingRootContext:H,positionMethod:i,mounted:Q,side:f,sideOffset:m,align:p,alignOffset:h,arrowPadding:S,collisionBoundary:x,collisionPadding:y,sticky:w,disableAnchorTracking:_??se,collisionAvoidance:k,keepMounted:!0}),te=se?"none":ie.side,ke=se?SO:ie.positionerStyles,$e={open:Y,side:te,align:ie.align,anchorHidden:ie.anchorHidden};Re(()=>{N.set("popupSide",ie.side)},[N,ie.side]);const be=Me(xe=>{N.set("positionerElement",xe)}),Se=WS(n,$e,{styles:ke,transitionStatus:V,props:R,refs:[s,be],hidden:!Q,inert:!Y}),Ee=b.useRef(0),ze=Me(xe=>{if(xe.size===0&&Ee.current===0||U.current.length===0)return;const Ne=Ee.current;if(Ee.current=xe.size,xe.size===Ne)return;const _e=tt(Ts);if(Ne!==0&&!N.state.multiple&&X!==null&&Di(U.current,X,I)===-1){const Ge=P.current,Oe=Ge!=null&&Di(U.current,Ge,I)!==-1?Ge:null;D(Oe,_e),Oe===null&&(N.set("selectedIndex",null),L.current=null)}if(Ne!==0&&N.state.multiple&&Array.isArray(X)){const Le=qe=>Di(U.current,qe,I)!==-1,Ge=X.filter(qe=>Le(qe));(Ge.length!==X.length||Ge.some(qe=>!nO(X,qe,I)))&&(D(Ge,_e),Ge.length===0&&(N.set("selectedIndex",null),L.current=null))}if(Y&&se){N.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const Le={height:""};jd(G,Le),jd(B.current,Le)}}),De=b.useMemo(()=>({...ie,side:te,alignItemWithTriggerActive:se,setControlledAlignItemWithTrigger:ce,scrollUpArrowRef:$,scrollDownArrowRef:W}),[ie,te,se,ce]);return o.jsx(bx,{elementsRef:M,labelsRef:A,onMapChange:ze,children:o.jsxs(Jw.Provider,{value:De,children:[Q&&q&&o.jsx(Rw,{inert:Jh(!Y),cutout:K}),Se]})})}),zu="base-ui-disable-scrollbar",eh={className:zu,getElement(e){return o.jsx("style",{nonce:e,href:zu,precedence:"base-ui:low",children:`.${zu}{scrollbar-width:none}.${zu}::-webkit-scrollbar{display:none}`})}},CO=b.createContext(void 0);function EO(e){return b.useContext(CO)}const kO=b.createContext(void 0),NO={disableStyleElements:!1};function RO(){return b.useContext(kO)??NO}const TO={...pl,...ml},AO=b.forwardRef(function(n,s){const{render:r,className:i,style:c,finalFocus:d,...f}=n,{store:p,popupRef:m,onOpenChangeComplete:h,setOpen:x,valueRef:y,firstItemTextRef:S,selectedItemTextRef:w,keyboardActiveRef:_,multiple:j,handleScrollArrowVisibility:k,scrollHandlerRef:E,listRef:R,highlightItemOnHover:N}=es(),{side:M,align:A,alignItemWithTriggerActive:O,isPositioned:L,setControlledAlignItemWithTrigger:U,scrollDownArrowRef:P,scrollUpArrowRef:B}=vx(),D=EO()!=null,H=Fw(),Y=Qh(),{nonce:Q,disableStyleElements:q}=RO(),X=Qe(p,Fe.id),Z=Qe(p,Fe.open),G=Qe(p,Fe.mounted),K=Qe(p,Fe.popupProps),I=Qe(p,Fe.transitionStatus),V=Qe(p,Fe.triggerElement),$=Qe(p,Fe.positionerElement),W=Qe(p,Fe.listElement),oe=b.useRef(!1),ce=b.useRef(!1),se=b.useRef({}),ie=Qo(),te=Me(Se=>{if(!$||!m.current||!ce.current)return;if(oe.current||!O){k();return}const Ee=$.style.top==="0px",ze=$.style.bottom==="0px";if(!Ee&&!ze){k();return}const De=G1($),xe=Ei($.getBoundingClientRect().height,"y",De),Ne=xt($),_e=getComputedStyle($),Le=parseFloat(_e.marginTop),Ge=parseFloat(_e.marginBottom),qe=$1(getComputedStyle(m.current)),Oe=Math.min(Ne.documentElement.clientHeight-Le-Ge,qe),ve=Se.scrollTop,le=Du(Se);let ye=0,je=null,Be=!1,Ze=!1;const _t=it=>{$.style.height=`${it}px`},Ht=(it,Et)=>{const Bt=Ci(it,0,Oe-xe);Bt>0&&_t(xe+Bt),Se.scrollTop=Et,Oe-(xe+Bt)<=za&&(oe.current=!0),k()},vt=Ee?le-ve:ve,ut=Math.min(xe+vt,Oe);if(ye=ut,vt<=za){Ht(vt,Ee?le:0);return}if(Oe-ut>za)Ee?Ze=!0:je=0;else if(Be=!0,ze&&ve<le){const it=xe+vt-Oe;je=ve-(vt-it)}if(ye=Math.ceil(ye),ye!==0&&_t(ye),Ze||je!=null){const it=Du(Se),Et=Ze?it:Ci(je,0,it);Math.abs(Se.scrollTop-Et)>za&&(Se.scrollTop=Et)}(Be||ye>=Oe-za)&&(oe.current=!0),k()});b.useImperativeHandle(E,()=>te,[te]),br({open:Z,ref:m,onComplete(){Z&&h?.(!0)}});const ke={open:Z,transitionStatus:I,side:M,align:A};Re(()=>{!$||!m.current||Object.keys(se.current).length||(se.current={top:$.style.top||"0",left:$.style.left||"0",right:$.style.right,height:$.style.height,bottom:$.style.bottom,minHeight:$.style.minHeight,maxHeight:$.style.maxHeight,marginTop:$.style.marginTop,marginBottom:$.style.marginBottom})},[m,$]),Re(()=>{Z||O||(ce.current=!1,oe.current=!1,jd($,se.current))},[Z,O,$,m]),Re(()=>{const Se=m.current;if(!Z||!V||!$||!Se||O&&!L||p.state.transitionStatus==="ending")return;if(!O){ce.current=!0,ie.request(k),Se.style.removeProperty("--transform-origin");return}const Ee=MO(Se);Se.style.removeProperty("--transform-origin");try{let ze=w.current;ze?.isConnected||(ze=!Fe.hasSelectedValue(p.state)&&S.current?.isConnected?S.current:null);const De=y.current,xe=getComputedStyle($),Ne=getComputedStyle(Se),_e=xt(V),Le=Ft($),Ge=G1(V),qe=Lu(V.getBoundingClientRect(),Ge),Oe=Lu($.getBoundingClientRect(),Ge),ve=qe.height,le=W||Se,ye=le.scrollHeight,je=parseFloat(Ne.borderBottomWidth),Be=parseFloat(xe.marginTop)||10,Ze=parseFloat(xe.marginBottom)||10,_t=parseFloat(xe.minHeight)||100,Ht=$1(Ne),vt=5,ut=5,it=20,Et=_e.documentElement.clientHeight-Be-Ze,Bt=_e.documentElement.clientWidth,pa=Et-qe.bottom+ve;let gn,dt=Y==="rtl"?qe.right-Oe.width:qe.left,Tt=0;if(ze&&De){const An=Lu(De.getBoundingClientRect(),Ge);gn=Lu(ze.getBoundingClientRect(),Ge),dt=Oe.left+(Y==="rtl"?An.right-gn.right:An.left-gn.left);const na=An.top-qe.top+An.height/2;Tt=gn.top-Oe.top+gn.height/2-na}const Xt=pa+Tt+Ze+je;let yt=Math.min(Et,Xt);const Wt=Et-Be-Ze,Vt=Xt-yt,rn=Bt-ut;$.style.left=`${Ci(dt,vt,rn-Oe.width)}px`,$.style.height=`${yt}px`,$.style.maxHeight="auto",$.style.marginTop=`${Be}px`,$.style.marginBottom=`${Ze}px`,Se.style.height="100%";const Tn=Du(le),qn=Vt>=Tn-za;qn&&(yt=Math.min(Et,Oe.height)-(Vt-Tn));const ta=qe.top<it||qe.bottom>Et-it||Math.ceil(yt)+za<Math.min(ye,_t),Vn=(Le.visualViewport?.scale??1)!==1&&Eh;if(ta||Vn){ce.current=!0,jd($,se.current),U(!1);return}const ts=Math.max(_t,yt);if(qn){const An=Math.max(0,Et-Xt);$.style.top=Oe.height>=Wt?"0":`${An}px`,$.style.height=`${yt}px`,le.scrollTop=Du(le)}else $.style.bottom="0",le.scrollTop=Vt;if(gn){const An=Oe.top,na=Oe.height,Ta=gn.top+gn.height/2,ns=na>0?(Ta-An)/na*100:50,at=Ci(ns,0,100);Se.style.setProperty("--transform-origin",`50% ${at}%`)}(ts===Et||yt>=Ht)&&(oe.current=!0),k(),N&&p.state.selectedIndex===null&&p.state.activeIndex===null&&R.current[0]!=null&&p.set("activeIndex",0),ce.current=!0}finally{Ee()}},[p,Z,$,V,y,S,w,m,k,O,U,ie,P,B,W,R,N,Y,L]),b.useEffect(()=>{if(!O||!$||!Z)return;const Se=Ft($);function Ee(ze){x(!1,tt(NT,ze))}return ct(Se,"resize",Ee)},[x,O,$,Z]);const $e={...W?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":j||void 0,id:`${X}-list`},onKeyDown(Se){_.current=!0,D&&mx.has(Se.key)&&Se.stopPropagation()},onMouseMove(){_.current=!1},onScroll(Se){W||te(Se.currentTarget)},...O&&{style:W?{height:"100%"}:Ww}},be=Lt("div",n,{ref:[s,m],state:ke,stateAttributesMapping:TO,props:[K,$e,Zh(I),{className:!W&&O?eh.className:void 0},f]});return o.jsxs(b.Fragment,{children:[!q&&eh.getElement(Q),o.jsx(jS,{context:H,modal:!1,disabled:!G,returnFocus:d,restoreFocus:!0,children:be})]})});function $1(e){const n=e.maxHeight||"";return n.endsWith("px")&&parseFloat(n)||1/0}function Du(e){return xx(e.scrollHeight,e.clientHeight)}function G1(e){return RS.getScale(e)}function Ei(e,n,s){return e/s[n]}function Lu(e,n){return $i({x:Ei(e.x,"x",n),y:Ei(e.y,"y",n),width:Ei(e.width,"x",n),height:Ei(e.height,"y",n)})}const Y1=[["transform","none"],["scale","1"],["translate","0 0"]];function MO(e){const{style:n}=e,s={};for(const[r,i]of Y1)s[r]=n.getPropertyValue(r),n.setProperty(r,i,"important");return()=>{for(const[r]of Y1){const i=s[r];i?n.setProperty(r,i):n.removeProperty(r)}}}const OO=b.forwardRef(function(n,s){const{render:r,className:i,style:c,...d}=n,{store:f,scrollHandlerRef:p}=es(),{alignItemWithTriggerActive:m}=vx(),h=Qe(f,Fe.hasScrollArrows),x=Qe(f,Fe.openMethod),y=Qe(f,Fe.multiple),w={id:`${Qe(f,Fe.id)}-list`,role:"listbox","aria-multiselectable":y||void 0,onScroll(j){p.current?.(j.currentTarget)},...m&&{style:Ww},className:h&&x!=="touch"?eh.className:void 0},_=Me(j=>{f.set("listElement",j)});return Lt("div",n,{ref:[s,_],props:[w,d]})});let e2=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function yx(e={}){const{label:n,metadata:s,textRef:r,indexGuessBehavior:i,index:c}=e,{register:d,unregister:f,subscribeMapChange:p,elementsRef:m,labelsRef:h,nextIndexRef:x}=xO(),y=b.useRef(-1),[S,w]=b.useState(c??(i===e2.GuessFromOrder?()=>{if(y.current===-1){const k=x.current;x.current+=1,y.current=k}return y.current}:-1)),_=b.useRef(null),j=b.useCallback(k=>{if(_.current=k,S!==-1&&k!==null&&(m.current[S]=k,h)){const E=n!==void 0;h.current[S]=E?n:r?.current?.textContent??k.textContent}},[S,m,h,n,r]);return Re(()=>{if(c!=null)return;const k=_.current;if(k)return d(k,s),()=>{f(k)}},[c,d,f,s]),Re(()=>{if(c==null)return p(k=>{const E=_.current?k.get(_.current)?.index:null;E!=null&&w(E)})},[c,p,w]),b.useMemo(()=>({ref:j,index:S}),[S,j])}const t2=b.createContext(void 0);function _x(){const e=b.useContext(t2);if(!e)throw new Error(Rn(57));return e}const zO=b.memo(b.forwardRef(function(n,s){const{render:r,className:i,style:c,value:d=null,label:f,disabled:p=!1,nativeButton:m=!1,...h}=n,x=b.useRef(null),y=yx({label:f,textRef:x,indexGuessBehavior:e2.GuessFromOrder}),{store:S,itemProps:w,setOpen:_,setValue:j,selectionRef:k,typingRef:E,valuesRef:R,multiple:N,selectedItemTextRef:M}=es(),A=Qe(S,Fe.isActive,y.index),O=Qe(S,Fe.isSelected,y.index,d),L=Qe(S,Fe.isSelectedByFocus,y.index),U=Qe(S,Fe.isItemEqualToValue),P=y.index,B=P!==-1,D=b.useRef(null);Re(()=>{if(!B)return;const W=R.current;return W[P]=d,()=>{delete W[P]}},[B,P,d,R]),Re(()=>{if(!B)return;const W=S.state.value;let oe=W;N&&Array.isArray(W)&&W.length>0&&(oe=W[W.length-1]),oe!==void 0&&sl(d,oe,U)&&(S.set("selectedIndex",P),x.current&&(M.current=x.current))},[B,P,N,U,S,d,M]);const H=b.useRef(null),Y=b.useRef("mouse"),Q=b.useRef(!1),{getButtonProps:q,buttonRef:X}=gl({disabled:p,focusableWhenDisabled:!0,native:m,composite:!0}),Z={disabled:p,selected:O,highlighted:A};function G(W){const oe=S.state.value;if(N){const ce=Array.isArray(oe)?oe:[],se=O?aO(ce,d,U):[...ce,d];j(se,tt(wp,W))}else j(d,tt(wp,W)),_(!1,tt(wp,W))}function K(){k.current.dragY=0}const I={role:"option","aria-selected":O,tabIndex:A?0:-1,onKeyDown(W){H.current=W.key,S.set("activeIndex",P),W.key===" "&&E.current&&W.preventDefault()},onClick(W){const oe=W.type==="click"&&Y.current!=="touch",ce=W.nativeEvent.pointerType,se=oe&&kh(W.nativeEvent)&&(ce!==void 0||A),ie=oe&&!se&&!Q.current;Q.current=!1,!(W.type==="keydown"&&H.current===null)&&(p||W.type==="keydown"&&H.current===" "&&E.current||ie||(H.current=null,G(W.nativeEvent)))},onPointerEnter(W){Y.current=W.pointerType},onPointerMove(W){if(W.pointerType==="mouse"&&W.buttons===1){const oe=k.current;oe.dragY+=W.movementY,oe.dragY**2>=64&&(oe.allowUnselectedMouseUp=!0)}},onPointerDown(W){Y.current=W.pointerType,Q.current=!0,K()},onMouseUp(){if(K(),p||Y.current==="touch"||Q.current)return;const W=!k.current.allowSelectedMouseUp&&O,oe=!k.current.allowUnselectedMouseUp&&!O;W||oe||(Q.current=!0,D.current?.click(),Q.current=!1)}},V=Lt("div",n,{ref:[X,s,y.ref,D],state:Z,props:[w,I,h,q]}),$=b.useMemo(()=>({selected:O,index:P,textRef:x,selectedByFocus:L,hasRegistered:B}),[O,P,x,L,B]);return o.jsx(t2.Provider,{value:$,children:V})})),DO=b.forwardRef(function(n,s){const r=n.keepMounted??!1,{selected:i}=_x();return r||i?o.jsx(LO,{...n,ref:s}):null}),LO=b.memo(b.forwardRef((e,n)=>{const{render:s,className:r,style:i,keepMounted:c,...d}=e,{selected:f}=_x(),p=b.useRef(null),{transitionStatus:m,setMounted:h}=ac(f),y=Lt("span",e,{ref:[n,p],state:{selected:f,transitionStatus:m},props:[{"aria-hidden":!0,children:"✔️"},d],stateAttributesMapping:ml});return br({open:f,ref:p,onComplete(){f||h(!1)}}),y})),PO=b.memo(b.forwardRef(function(n,s){const{index:r,textRef:i,selectedByFocus:c,hasRegistered:d}=_x(),{firstItemTextRef:f,selectedItemTextRef:p}=es(),{render:m,className:h,style:x,...y}=n,S=b.useCallback(_=>{_&&(d&&r===0&&(f.current=_),d&&c&&(p.current=_))},[f,p,r,c,d]);return Lt("div",n,{ref:[S,s,i],props:y})})),n2=b.forwardRef(function(n,s){const{render:r,className:i,style:c,direction:d,keepMounted:f=!1,...p}=n,m=d==="up",{store:h,popupRef:x,listRef:y,handleScrollArrowVisibility:S,scrollArrowsMountedCountRef:w}=es(),{side:_,scrollDownArrowRef:j,scrollUpArrowRef:k}=vx(),E=m?Fe.scrollUpArrowVisible:Fe.scrollDownArrowVisible,R=Qe(h,E),N=Qe(h,Fe.openMethod),M=R&&N!=="touch",A=Zn(),O=m?k:j,{transitionStatus:L,setMounted:U}=ac(M);Re(()=>(w.current+=1,h.state.hasScrollArrows||h.set("hasScrollArrows",!0),()=>{w.current=Math.max(0,w.current-1),w.current===0&&h.state.hasScrollArrows&&h.set("hasScrollArrows",!1)}),[h,w]),br({open:M,ref:O,onComplete(){M||U(!1)}});const D=Lt("div",n,{ref:[s,O],state:{direction:d,visible:M,side:_,transitionStatus:L},props:[{"aria-hidden":!0,children:m?"▲":"▼",style:{position:"absolute"},onMouseMove(Y){if(Y.movementX===0&&Y.movementY===0||A.isStarted())return;h.set("activeIndex",null);function Q(){const q=h.state.listElement??x.current;if(!q)return;h.set("activeIndex",null),S();const X=xx(q.scrollHeight,q.clientHeight),Z=_d(q.scrollTop,X),G=Z===(m?0:X),K=y.current;if(Z!==q.scrollTop&&(q.scrollTop=Z),K.length===0&&h.set(m?"scrollUpArrowVisible":"scrollDownArrowVisible",!G),G){A.clear();return}if(K.length>0){const I=O.current?.offsetHeight||0;q.scrollTop=BO(K,m,Z,q.clientHeight,I,X)}A.start(40,Q)}A.start(40,Q)},onMouseLeave(){A.clear()}},p]});return M||f?D:null});function BO(e,n,s,r,i,c){if(n){let h=0;const x=s+i-za;for(let w=0;w<e.length;w+=1){const _=e[w];if(_&&_.offsetTop>=x){h=w;break}}const y=Math.max(0,h-1),S=e[y];return y<h&&S?_d(S.offsetTop-i,c):0}let d=e.length-1;const f=s+r-i+za;for(let h=0;h<e.length;h+=1){const x=e[h];if(x&&x.offsetTop+x.offsetHeight>f){d=Math.max(0,h-1);break}}const p=Math.min(e.length-1,d+1),m=e[p];return p>d&&m?_d(m.offsetTop+m.offsetHeight-r+i,c):c}const IO=b.forwardRef(function(n,s){return o.jsx(n2,{...n,ref:s,direction:"down"})}),UO=b.forwardRef(function(n,s){return o.jsx(n2,{...n,ref:s,direction:"up"})}),HO=oO;function qO({className:e,...n}){return o.jsx(mO,{"data-slot":"select-value",className:Pt("flex flex-1 text-left",e),...n})}function VO({className:e,size:n="default",children:s,...r}){return o.jsxs(dO,{"data-slot":"select-trigger","data-size":n,className:Pt("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),...r,children:[s,o.jsx(pO,{render:o.jsx(Jr,{className:"pointer-events-none size-4 text-muted-foreground"})})]})}function $O({className:e,children:n,side:s="bottom",sideOffset:r=4,align:i="center",alignOffset:c=0,alignItemWithTrigger:d=!0,...f}){return o.jsx(hO,{children:o.jsx(wO,{side:s,sideOffset:r,align:i,alignOffset:c,alignItemWithTrigger:d,className:"isolate z-50",children:o.jsxs(AO,{"data-slot":"select-content","data-align-trigger":d,className:Pt("relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...f,children:[o.jsx(YO,{}),o.jsx(OO,{children:n}),o.jsx(FO,{})]})})})}function GO({className:e,children:n,...s}){return o.jsxs(zO,{"data-slot":"select-item",className:Pt("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:[o.jsx(PO,{className:"flex min-w-0 flex-1 gap-2 overflow-hidden whitespace-nowrap",children:n}),o.jsx(DO,{render:o.jsx("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center"}),children:o.jsx(Bi,{className:"pointer-events-none"})})]})}function YO({className:e,...n}){return o.jsx(UO,{"data-slot":"select-scroll-up-button",className:Pt("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:o.jsx(gj,{})})}function FO({className:e,...n}){return o.jsx(IO,{"data-slot":"select-scroll-down-button",className:Pt("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:o.jsx(Jr,{})})}function Ct({value:e,onChange:n,options:s,placeholder:r="— elegir —",disabled:i,className:c}){return o.jsxs(HO,{value:e,onValueChange:d=>n(d??""),disabled:i,children:[o.jsx(VO,{className:Ae("h-9 w-full",c),children:o.jsx(qO,{placeholder:r,children:d=>s.find(f=>f.value===d)?.label??d})}),o.jsx($O,{side:"bottom",sideOffset:6,align:"start",alignItemWithTrigger:!1,className:"w-[var(--anchor-width)] p-1.5",children:s.map(d=>{const f=d.icon;return o.jsx(GO,{value:d.value,children:o.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[f?o.jsx(f,{className:"size-4 shrink-0 text-muted-fg"}):null,d.description?o.jsxs("span",{className:"flex min-w-0 flex-col leading-tight",children:[o.jsx("span",{className:"truncate font-medium",children:d.label}),o.jsx("span",{className:"truncate text-[11px] text-muted-fg",children:d.description})]}):o.jsx("span",{className:"truncate",children:d.label})]})},d.value)})})]})}const F1=320;function XO(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 KO(e){return e.agent_slug||e.actor_id||e.author||e.actor_kind||"—"}function QO({m:e}){const[n,s]=b.useState(!1),r=(e.body?.length||0)>F1,i=!r||n?e.body:`${e.body.slice(0,F1)}…`;return o.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsx("span",{className:"mt-0.5 shrink-0",children:e.direction==="in"?o.jsx(fj,{size:14,className:"text-blue-400"}):o.jsx(pj,{size:14,className:"text-emerald-400"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[o.jsx("span",{className:"font-mono",children:XO(e.ts)}),o.jsx(Ue,{tone:"info",children:e.channel}),e.type&&o.jsx(Ue,{children:e.type}),o.jsx("span",{className:"font-medium text-foreground",children:KO(e)})]}),e.body&&o.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:i}),r&&o.jsx("button",{type:"button",onClick:()=>s(c=>!c),className:"mt-1 text-[11px] font-medium text-sky-400 hover:underline",children:C(n?"logs.show_less":"logs.show_more")})]})]})}function ZO(){const[e,n]=b.useState(!1),s=Xe(e?"/admin/logs?errors":null,()=>el.logs("errors",200)),r=s.data?.entries||[];return o.jsxs("details",{className:"mb-3 rounded-lg border border-border bg-muted/20",onToggle:i=>n(i.target.open),children:[o.jsxs("summary",{className:"cursor-pointer px-3 py-2 text-xs font-medium text-muted-fg",children:[C("logs.daemon_errors"),r.length?` · ${r.length}`:""]}),o.jsxs("div",{className:"border-t border-border p-3",children:[s.isLoading&&o.jsx(Je,{}),e&&!s.isLoading&&r.length===0&&o.jsx("p",{className:"text-xs text-muted-fg",children:C("logs.no_errors")}),o.jsx("ul",{className:"space-y-1",children:r.map((i,c)=>o.jsxs("li",{className:"rounded-md bg-card px-2 py-1 text-[11px]",children:[o.jsxs("div",{className:"flex items-center gap-2 text-muted-fg",children:[typeof i.ts=="string"&&o.jsx("span",{className:"font-mono",children:new Date(i.ts).toLocaleString()}),typeof i.level=="string"&&o.jsx("span",{className:"text-destructive",children:i.level})]}),o.jsx("p",{className:"whitespace-pre-wrap break-words font-mono",children:String(i.msg??i.message??i.error??i.raw??JSON.stringify(i)).slice(0,500)})]},c))})]})]})}function JO({pid:e}){const n=!e||String(e)==="0",[s,r]=b.useState(""),[i,c]=b.useState(""),[d,f]=b.useState(""),[p,m]=b.useState(""),h=s.trim()||void 0,x=n?`/messages/global?channel=${h??""}`:`/projects/${e}/messages?channel=${h??""}`,y=Xe(x,()=>n?Jg.global({channel:h,limit:300}):Jg.project(e,{channel:h,limit:300})),S=b.useMemo(()=>[...y.data||[]].sort((j,k)=>(k.ts||"").localeCompare(j.ts||"")),[y.data]),w=b.useMemo(()=>Array.from(new Set(S.map(j=>j.type).filter(Boolean))),[S]),_=b.useMemo(()=>S.filter(j=>!(i&&j.direction!==i||d&&j.type!==d||p&&!(j.body||"").toLowerCase().includes(p.toLowerCase()))),[S,i,d,p]);return o.jsxs(He,{title:C("logs.title"),description:C(n?"logs.desc_global":"logs.desc_project"),action:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Ce,{placeholder:C("logs.filter_channel"),value:s,onChange:j=>r(j.target.value),className:"w-44"}),o.jsx(he,{size:"sm",variant:"secondary",onClick:()=>y.mutate(),children:o.jsx(Wr,{size:13})})]}),children:[n&&o.jsx(ZO,{}),o.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[o.jsx("div",{className:"w-36",children:o.jsx(Ct,{value:i,onChange:c,placeholder:C("logs.filter_dir"),options:[{value:"",label:C("logs.all_directions")},{value:"in",label:C("logs.in")},{value:"out",label:C("logs.out")}]})}),o.jsx("div",{className:"w-40",children:o.jsx(Ct,{value:d,onChange:f,placeholder:C("logs.filter_type"),options:[{value:"",label:C("logs.all_types")},...w.map(j=>({value:j,label:j}))]})}),o.jsx(Ce,{placeholder:C("logs.search_text"),value:p,onChange:j=>m(j.target.value),className:"w-56"}),o.jsxs("span",{className:"text-[11px] text-muted-fg",children:[_.length," ",C("logs.count_of")," ",S.length]})]}),y.isLoading&&o.jsx(Je,{}),y.error&&o.jsx(ot,{children:C("logs.error",{msg:y.error.message})}),!y.isLoading&&!y.error&&_.length===0&&o.jsx(ot,{children:h?C("logs.no_activity_ch",{ch:h}):C("logs.no_activity")}),o.jsx("ul",{className:"space-y-1 text-sm",children:_.map((j,k)=>o.jsx(QO,{m:j},`${j.ts}-${k}`))})]})}function a2({value:e,onChange:n,options:s,placeholder:r="elegí o escribí un modelo…",invalid:i,invalidHint:c,className:d}){const[f,p]=b.useState(!1),[m,h]=b.useState(e),x=b.useRef(null);b.useEffect(()=>{h(e)},[e]),b.useEffect(()=>{if(!f)return;const _=j=>{x.current&&!x.current.contains(j.target)&&p(!1)};return document.addEventListener("mousedown",_),()=>document.removeEventListener("mousedown",_)},[f]);const y=m.trim().toLowerCase(),S=y?s.filter(_=>_.toLowerCase().includes(y)):s,w=_=>{n(_),h(_),p(!1)};return o.jsxs("div",{ref:x,className:Ae("relative",d),children:[o.jsxs("div",{className:Ae("flex items-center gap-1 rounded-lg border bg-background px-2.5 transition-colors focus-within:border-ring focus-within:ring-1 focus-within:ring-ring",i?"border-amber-500/60":"border-border"),children:[i&&o.jsx("span",{title:c||"Modelo/proveedor no disponible",children:o.jsx(Sj,{className:"size-3.5 shrink-0 text-amber-400"})}),o.jsx("input",{value:m,placeholder:r,onChange:_=>{h(_.target.value),n(_.target.value),p(!0)},onFocus:()=>p(!0),className:"w-full bg-transparent py-1.5 text-sm outline-none placeholder:text-muted-fg/60"}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>p(_=>!_),className:"shrink-0 text-muted-fg hover:text-foreground",children:o.jsx(Jr,{className:"size-4"})})]}),f&&S.length>0&&o.jsx("ul",{className:"absolute z-50 mt-1 max-h-56 w-full overflow-y-auto rounded-lg border border-border bg-popover p-1 shadow-md ring-1 ring-foreground/10",children:S.map(_=>o.jsx("li",{children:o.jsx("button",{type:"button",onMouseDown:j=>{j.preventDefault(),w(_)},className:Ae("flex w-full items-center rounded-md px-2 py-1 text-left text-sm hover:bg-accent hover:text-accent-fg",_===e&&"bg-accent/50"),children:o.jsx("span",{className:"truncate font-mono text-xs",children:_})})},_))})]})}function yr(){const{data:e,error:n,isLoading:s,mutate:r}=Xe("/admin/config",()=>el.config.get()),i=async(c,d)=>{const f=await el.config.patch({set:c,unset:d});return await r({config:f.config},{revalidate:!1}),f.config};return{config:e?.config||{},error:n,isLoading:s,mutate:r,patch:i}}function s2(){const{data:e,error:n,isLoading:s,mutate:r}=Xe("/admin/super-agent",()=>el.superAgent());return{superAgent:e,error:n,isLoading:s,mutate:r}}const WO={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"},ez={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"},Li=[{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 Xp(e,n){return n&&n in e?e[n]:e.custom}const Sd={anthropic:il,openai:vn,gemini:KN,groq:Ui,openrouter:hh,ollama:_j,azure:PN,mock:GN,custom:cl},$r={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 r2(e){const n=e.indexOf(":");return n<0?{provider:e,model:""}:{provider:e.slice(0,n),model:e.slice(n+1)}}function Kp({value:e,onChange:n,providers:s}){const{provider:r,model:i}=r2(e),c=s.find(h=>h.slug===r),d=!!r&&!c,f=b.useMemo(()=>{const h=c?$r[c.engine]?.known_models||[]:[];return Array.from(new Set([...c?.default_model?[c.default_model]:[],...h]))},[c]),p=h=>{const x=s.find(S=>S.slug===h),y=x?.default_model||$r[x?.engine]?.default_model||"";n(y?`${h}:${y}`:`${h}:`)},m=h=>n(`${r}:${h}`);return o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx(Ct,{value:r,onChange:p,placeholder:d?`⚠ ${r} (no existe)`:"— proveedor —",options:s.map(h=>({value:h.slug,label:h.slug,icon:Sd[h.engine]}))}),o.jsx(a2,{value:i,onChange:m,options:f,invalid:d,invalidHint:`El proveedor "${r}" no está configurado.`})]})}function tz(){const e=nt(),{superAgent:n,isLoading:s,mutate:r}=s2(),{config:i,patch:c}=yr(),[d,f]=b.useState(""),[p,m]=b.useState([]),[h,x]=b.useState(""),[y,S]=b.useState(null),[w,_]=b.useState(!1),[j,k]=b.useState({model:"",fallback:[]});b.useEffect(()=>{if(!n)return;const P=n.model_fallback?.models||[],B=Array.isArray(P)?P:[];f(n.model||""),m(B),k({model:n.model||"",fallback:B})},[n]);const E=b.useMemo(()=>{const P=i.engines||{};return Object.entries(P).map(([B,D])=>({slug:B,engine:D?.engine||B,default_model:D?.default_model||$r[D?.engine||B]?.default_model}))},[i.engines]),R=P=>{const{provider:B}=r2(P);return E.some(D=>D.slug===B)};if(s||!n)return o.jsx(Je,{});const N=d!==j.model||JSON.stringify(p)!==JSON.stringify(j.fallback),M=async()=>{_(!0);try{await c({"super_agent.model":d,"super_agent.model_fallback.enabled":p.length>0,"super_agent.model_fallback.models":p}),e.success("Router guardado."),k({model:d,fallback:p}),r()}catch(P){e.error(P.message)}finally{_(!1)}},A=()=>{const P=h.trim().replace(/:$/,"");!P||!P.includes(":")||p.includes(P)||(m([...p,P]),x(""))},O=(P,B)=>{const D=[...p];D[P]=B,m(D)},L=P=>{m(p.filter((B,D)=>D!==P)),y===P&&S(null)},U=(P,B)=>{const D=P+B;if(D<0||D>=p.length)return;const H=[...p];[H[P],H[D]]=[H[D],H[P]],m(H)};return o.jsx(He,{title:"Router de modelos",description:"Un solo router general (sin casos por tarea). Elegí proveedor y modelo; si el activo falla, prueba la cadena de fallback en orden.",children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2 rounded-lg border border-border bg-muted/20 p-3",children:[o.jsxs(Ue,{tone:"success",children:[o.jsx(hh,{size:11})," default"]}),o.jsx("span",{className:`font-mono text-xs ${!R(d)&&d?"text-amber-400":""}`,children:d||"—"}),p.map(P=>o.jsxs("span",{className:"flex items-center gap-2 text-muted-fg",children:[o.jsx(mj,{size:12}),o.jsx("span",{className:`font-mono text-xs ${R(P)?"":"text-amber-400"}`,children:P})]},P))]}),E.length===0?o.jsx("p",{className:"text-xs text-muted-fg",children:"Agregá un proveedor abajo para poder elegir modelos."}):o.jsx(fe,{label:"Modelo activo (default)",hint:"Proveedor + modelo. Se guarda como provider:model.",children:o.jsx(Kp,{value:d,onChange:f,providers:E})}),o.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[o.jsxs("div",{className:"mb-2",children:[o.jsx("div",{className:"text-sm font-medium",children:"Cadena de fallback"}),o.jsx("div",{className:"text-xs text-muted-fg",children:"Si el modelo activo falla, prueba estos en orden. Click en uno para editarlo."})]}),o.jsxs("ul",{className:"mb-3 space-y-1",children:[p.map((P,B)=>{const D=!R(P),H=y===B;return o.jsx("li",{className:"rounded-md bg-card px-2 py-1.5 text-xs",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("span",{className:"w-6 text-muted-fg",children:["#",B+1]}),H?o.jsx("div",{className:"flex-1",children:o.jsx(Kp,{value:P,onChange:Y=>O(B,Y),providers:E})}):o.jsxs("button",{type:"button",onClick:()=>S(B),className:"flex flex-1 items-center gap-1.5 text-left",children:[D&&o.jsx(Sj,{size:12,className:"text-amber-400"}),o.jsx("span",{className:`font-mono ${D?"text-amber-400":""}`,children:P})]}),H?o.jsx(he,{size:"sm",variant:"secondary",onClick:()=>S(null),children:"listo"}):o.jsx(he,{size:"sm",variant:"ghost",onClick:()=>S(B),children:o.jsx(xh,{size:12})}),o.jsx(he,{size:"sm",variant:"ghost",onClick:()=>U(B,-1),disabled:B===0,children:"↑"}),o.jsx(he,{size:"sm",variant:"ghost",onClick:()=>U(B,1),disabled:B===p.length-1,children:"↓"}),o.jsx(he,{size:"sm",variant:"destructive",onClick:()=>L(B),children:o.jsx(Ja,{size:12})})]})},`${B}-${P}`)}),p.length===0&&o.jsx("li",{className:"text-xs text-muted-fg",children:"Sin fallback configurado."})]}),E.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsx("div",{className:"text-xs text-muted-fg",children:"Agregar a la cadena"}),o.jsx(Kp,{value:h,onChange:x,providers:E}),o.jsxs(he,{size:"sm",variant:"secondary",onClick:A,disabled:!h.includes(":")||h.endsWith(":"),children:[o.jsx(Nn,{size:13})," Agregar a la cadena"]})]})]}),o.jsx(he,{variant:"primary",loading:w,disabled:!N,onClick:M,children:N?"Guardar router":"Guardado"})]})})}function nz({provider:e,onEdit:n,onDelete:s,onToggle:r}){const i=Xp(WO,e.engine),c=Xp(ez,e.engine),d=Xp(Sd,e.engine),f=Li.find(x=>x.value===e.engine)?.label||e.engine,p=typeof e.api_key=="string"&&e.api_key.length>0,m=al(e.api_key),h=e.is_active!==!1;return o.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:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("div",{className:Ae("flex size-10 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",i),children:o.jsx(d,{className:"size-5 text-white"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h3",{className:"truncate text-sm font-semibold",children:e.name||e.slug}),o.jsx("p",{className:"truncate font-mono text-[10px] text-muted-fg",children:e.slug}),o.jsxs("span",{className:Ae("mt-1 inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] font-medium",c),children:[o.jsx(d,{className:"size-3"})," ",f]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[o.jsx(Jo,{content:h?"Activo · click para desactivar":"Inactivo · click para activar",children:o.jsxs("button",{type:"button",onClick:x=>{x.stopPropagation(),r()},className:Ae("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:[o.jsx("span",{className:Ae("size-1.5 rounded-full",h?"bg-emerald-400":"bg-muted-fg/40")}),h?"Active":"Off"]})}),o.jsx(Jo,{content:"Borrar",children:o.jsx("button",{type:"button",onClick:x=>{x.stopPropagation(),s()},className:"rounded-md p-1 text-muted-fg hover:bg-destructive/10 hover:text-destructive",children:o.jsx(Ja,{className:"size-3.5"})})})]})]}),o.jsxs("div",{className:"mt-auto space-y-1 text-xs",children:[o.jsx(gi,{label:"Modelo",value:e.default_model||"—",mono:!0}),e.base_url&&o.jsx(gi,{label:"Base URL",value:e.base_url,mono:!0,truncate:!0}),o.jsx(gi,{label:"API key",value:p?m?`…${m}`:"✓ seteada":"—",mono:!!m}),e.default_temperature!==void 0&&o.jsx(gi,{label:"Temp",value:e.default_temperature.toFixed(1)}),e.pricing?.input_per_million!==void 0&&o.jsx(gi,{label:"$ in/out (1M)",value:`${e.pricing.input_per_million??0} / ${e.pricing.output_per_million??0}`})]})]})}function gi({label:e,value:n,mono:s,truncate:r}){return o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"text-muted-fg",children:e}),o.jsx("span",{className:Ae("text-foreground",s&&"font-mono",r&&"max-w-[180px] truncate"),children:n})]})}const X1={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:""},az=["anthropic","openai","gemini","groq","openrouter","ollama","custom"];function hi(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Pu(e){if(e==null)return"";const n=Number(e);return Number.isFinite(n)?String(n):""}function sz(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:Pu(e.pricing?.input_per_million),p_output:Pu(e.pricing?.output_per_million),p_cache_read:Pu(e.pricing?.cache_read_per_million),p_cache_write:Pu(e.pricing?.cache_write_per_million)}}function rz({open:e,initial:n,existingSlugs:s,onClose:r,onSave:i}){const c=!!n,[d,f]=b.useState(X1),[p,m]=b.useState(!1),[h,x]=b.useState(null),[y,S]=b.useState([]),[w,_]=b.useState(!1),[j,k]=b.useState(null),[E,R]=b.useState(!1),[N,M]=b.useState("");b.useEffect(()=>{if(!e)return;const G=n?sz(n):X1;f(G),x(null),k(null),R(!1);const K=$r[G.engine];S(K?.known_models||[])},[e,n]);const A=G=>f(K=>({...K,...G})),O=G=>{const K=$r[G];A({engine:G,name:G==="custom"?d.name:Li.find(I=>I.value===G)?.label||G,slug:G==="custom"?d.slug:G,base_url:K.base_url,default_model:K.default_model}),S(K.known_models),k(null)},L=G=>{const K=$r[G];A({engine:G,base_url:d.base_url||K.base_url,default_model:d.default_model||K.default_model}),S(K.known_models)},U=async()=>{_(!0),k(null);try{const G=await bd.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){k(G.error);return}S(G.models),G.models.length===0&&k("Sin modelos. ¿Key/URL correctas?")}catch(G){k(G.message||"No se pudo listar modelos.")}finally{_(!1)}},P=b.useMemo(()=>d.default_model&&!y.includes(d.default_model)?[d.default_model,...y]:y,[y,d.default_model]),B=()=>{const G=(d.slug||hi(d.name)).trim();if(!G)return x("Slug requerido."),null;if(!c&&s.includes(G))return x(`Ya existe un provider "${G}".`),null;let K;if(d.model_context_limits_json.trim())try{const $=JSON.parse(d.model_context_limits_json);if(!$||typeof $!="object"||Array.isArray($))throw new Error;K=$}catch{return x("Límites de contexto por modelo: JSON inválido."),null}const V=[d.p_input,d.p_output,d.p_cache_read,d.p_cache_write].map($=>$.trim()).some(Boolean)?{input_per_million:Number(d.p_input||0),output_per_million:Number(d.p_output||0),cache_read_per_million:Number(d.p_cache_read||0),cache_write_per_million:Number(d.p_cache_write||0)}:void 0;return{provider:{slug:G,name:d.name.trim()||G,engine:d.engine,base_url:d.base_url.trim()||void 0,default_model:d.default_model.trim()||void 0,default_temperature:d.default_temperature,default_max_tokens:d.default_max_tokens,is_active:d.is_active,context_limit_tokens:d.context_limit_tokens||void 0,model_context_limits:K,pricing:V},modelLimits:K}},D=()=>{const G=B();if(!G)return;const{provider:K}=G,I={name:K.name,engine:K.engine,is_active:K.is_active!==!1,default_temperature:K.default_temperature,default_max_tokens:K.default_max_tokens};K.base_url&&(I.base_url=K.base_url),K.default_model&&(I.default_model=K.default_model),K.context_limit_tokens&&(I.context_limit_tokens=K.context_limit_tokens),K.model_context_limits&&(I.model_context_limits=K.model_context_limits),K.pricing&&(I.pricing=K.pricing),d.api_key_value.trim()&&(I.api_key=d.api_key_value.trim()),M(JSON.stringify(I,null,2)),x(null),R(!0)},H=async()=>{m(!0),x(null);try{if(E){const K=(d.slug||hi(d.name)).trim();if(!K){x("Slug requerido (en el formulario).");return}let I;try{I=JSON.parse(N)}catch{x("JSON inválido: revisá la sintaxis.");return}if(!I||typeof I!="object"||Array.isArray(I)){x("El JSON debe ser un objeto con la config del provider.");return}const V=I;if(!V.engine||typeof V.engine!="string"){x('Falta "engine" (ej. "anthropic", "ollama").');return}const $={slug:K,name:typeof V.name=="string"?V.name:K,engine:String(V.engine),base_url:typeof V.base_url=="string"?V.base_url:void 0,default_model:typeof V.default_model=="string"?V.default_model:void 0,is_active:V.is_active!==!1};await i({provider:$,raw:V,originalSlug:n?.slug}),r();return}const G=B();if(!G)return;await i({provider:G.provider,apiKeyValue:d.api_key_value.trim()||void 0,originalSlug:n?.slug}),r()}catch(G){x(G.message||"Error al guardar.")}finally{m(!1)}},Y=c&&Da(n?.api_key),Q=al(n?.api_key),q=Y?`…${Q??""} (ya seteada)`:"sk-…",X=d.engine==="ollama",Z=$r[d.engine]?.api_key_env;return o.jsx(ma,{open:e,onClose:r,title:c?`Editar ${n?.name||n?.slug}`:"Nuevo provider",description:"Proveedor LLM. El motor (engine) define qué adapter usa (openai, ollama, …).",size:"lg",footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:r,disabled:p,children:"Cancelar"}),o.jsx(he,{variant:"primary",onClick:H,loading:p,children:c?"Guardar":"Crear"})]}),children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[c?o.jsx("span",{}):o.jsx("div",{className:"flex flex-wrap gap-1.5",children:az.map(G=>{const K=Sd[G],I=G==="custom"?"Custom":Li.find($=>$.value===G)?.label||G,V=d.engine===G;return o.jsxs("button",{type:"button",onClick:()=>O(G),className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs transition-colors ${V?"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:[o.jsx(K,{className:"size-3.5"})," ",I]},G)})}),o.jsxs("button",{type:"button",onClick:()=>E?R(!1):D(),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:[o.jsx(zN,{className:"size-3.5"})," ",E?"Volver al formulario":"JSON"]})]}),E?o.jsxs("div",{className:"space-y-2",children:[o.jsx(fe,{label:"Config del provider (JSON)",hint:`Se guarda como engines.${d.slug||hi(d.name)||"<slug>"} en config.json`,children:o.jsx(Qt,{rows:14,className:"font-mono text-xs",value:N,onChange:G=>M(G.target.value),spellCheck:!1})}),o.jsxs("p",{className:"text-[11px] text-muted-fg",children:["Debe ser un objeto JSON válido con al menos ",o.jsx("code",{children:"engine"}),". El slug se toma del formulario."]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:"Nombre",children:o.jsx(Ce,{value:d.name,onChange:G=>A({name:G.target.value,slug:c?d.slug:hi(G.target.value)}),placeholder:"Mi provider"})}),o.jsx(fe,{label:"Motor (engine)",children:o.jsx(Ct,{value:d.engine,onChange:G=>L(G),options:Li.map(G=>({value:G.value,label:G.label,icon:Sd[G.value]}))})})]}),o.jsx(fe,{label:"URL base (base_url)",hint:"Se completa sola al elegir un proveedor.",children:o.jsx(Ce,{value:d.base_url,onChange:G=>A({base_url:G.target.value}),placeholder:"https://api.openai.com/v1"})}),!X&&o.jsx(fe,{label:"API key",hint:Y?"Dejá en blanco para mantener la actual.":Z?`Se guarda como secreto. Env sugerida: ${Z}`:"Se guarda como secreto.",children:o.jsx(Ce,{type:"password",autoComplete:"new-password",value:d.api_key_value,onChange:G=>A({api_key_value:G.target.value}),placeholder:q})}),o.jsx(fe,{label:"Modelo por defecto",children:o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(a2,{value:d.default_model,onChange:G=>A({default_model:G}),options:P,className:"flex-1"}),o.jsxs(he,{size:"sm",variant:"secondary",onClick:U,disabled:w,title:"Lista los modelos reales del proveedor",children:[w?o.jsx(Td,{className:"size-3.5 animate-spin"}):o.jsx(Wr,{className:"size-3.5"}),"Cargar modelos"]})]}),j&&o.jsx("p",{className:"text-[11px] text-amber-400",children:j})]})}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:"Máx. tokens (max_tokens)",children:o.jsx(Ce,{type:"number",min:256,step:256,value:d.default_max_tokens,onChange:G=>A({default_max_tokens:parseInt(G.target.value)||4096})})}),o.jsx(fe,{label:`Temperatura: ${d.default_temperature.toFixed(1)}`,children:o.jsx("input",{type:"range",min:0,max:2,step:.1,value:d.default_temperature,onChange:G=>A({default_temperature:parseFloat(G.target.value)}),className:"mt-2 w-full accent-foreground"})})]}),o.jsxs("details",{className:"rounded-md border border-border bg-muted/20 p-3",children:[o.jsx("summary",{className:"cursor-pointer text-xs font-medium text-muted-fg",children:"Análisis de tokens / pricing (opcional)"}),o.jsxs("div",{className:"mt-3 space-y-3",children:[o.jsx(fe,{label:"Límite de contexto (tokens)",children:o.jsx(Ce,{type:"number",min:0,step:1024,value:d.context_limit_tokens,onChange:G=>A({context_limit_tokens:parseInt(G.target.value)||0})})}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:"$ entrada / 1M",children:o.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_input,onChange:G=>A({p_input:G.target.value}),placeholder:"0.15"})}),o.jsx(fe,{label:"$ salida / 1M",children:o.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_output,onChange:G=>A({p_output:G.target.value}),placeholder:"0.60"})}),o.jsx(fe,{label:"$ cache read / 1M",children:o.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_cache_read,onChange:G=>A({p_cache_read:G.target.value}),placeholder:"0.03"})}),o.jsx(fe,{label:"$ cache write / 1M",children:o.jsx(Ce,{type:"number",min:0,step:1e-4,value:d.p_cache_write,onChange:G=>A({p_cache_write:G.target.value}),placeholder:"0.00"})})]}),o.jsx(fe,{label:"Límites de contexto por modelo (JSON)",hint:'{"gpt-4o-mini":128000}',children:o.jsx(Qt,{rows:3,className:"font-mono text-xs",value:d.model_context_limits_json,onChange:G=>A({model_context_limits_json:G.target.value})})})]})]}),o.jsx(sn,{checked:d.is_active,onChange:G=>A({is_active:G}),label:"Activo (los agentes pueden usarlo)"})]}),h&&o.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:h})]})})}const oz=new Set(Li.map(e=>e.value));function lz(e,n){const s=typeof n.engine=="string"&&n.engine||(oz.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 iz(){const e=nt(),{config:n,isLoading:s,patch:r,mutate:i}=yr(),[c,d]=b.useState(!1),[f,p]=b.useState(null);if(s)return o.jsx(Je,{});const m=n.engines||{},h=Object.entries(m).map(([k,E])=>lz(k,E||{})),x=h.map(k=>k.slug),y=()=>{p(null),d(!0)},S=k=>{p(k),d(!0)},w=async({provider:k,apiKeyValue:E,raw:R})=>{if(R){await r({[`engines.${k.slug}`]:R}),e.success("Provider guardado (JSON)."),i();return}const N=`engines.${k.slug}`,M={[`${N}.name`]:k.name,[`${N}.engine`]:k.engine,[`${N}.is_active`]:k.is_active!==!1,[`${N}.default_temperature`]:k.default_temperature,[`${N}.default_max_tokens`]:k.default_max_tokens},A=[],O=(L,U)=>{U===void 0||U===""?A.push(`${N}.${L}`):M[`${N}.${L}`]=U};O("base_url",k.base_url),O("default_model",k.default_model),O("context_limit_tokens",k.context_limit_tokens),O("pricing",k.pricing),O("model_context_limits",k.model_context_limits),E&&(M[`${N}.api_key`]=E),await r(M,A),e.success("Provider guardado."),i()},_=async k=>{try{await r({[`engines.${k.slug}.is_active`]:k.is_active===!1}),i()}catch(E){e.error(E.message)}},j=async k=>{if(confirm(`Borrar provider ${k.name||k.slug}?`))try{await r(void 0,[`engines.${k.slug}`]),e.success("Provider borrado."),i()}catch(E){e.error(E.message)}};return o.jsxs(He,{title:"Proveedores",description:"Proveedores LLM (API). Cada provider usa un engine/adapter (openai, ollama, …) con su key y URL.",action:o.jsxs(he,{size:"sm",variant:"primary",onClick:y,children:[o.jsx(Nn,{size:14})," Nuevo provider"]}),children:[h.length===0?o.jsx(ot,{children:"Sin providers. Agregá uno con el botón de arriba."}):o.jsxs("div",{className:"grid grid-cols-1 items-stretch gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[h.map(k=>o.jsx(nz,{provider:k,onEdit:()=>S(k),onDelete:()=>j(k),onToggle:()=>_(k)},k.slug)),o.jsxs("button",{type:"button",onClick:y,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:[o.jsx(Nn,{size:20}),o.jsx("span",{className:"text-sm font-medium",children:"Agregar provider"})]})]}),o.jsx(rz,{open:c,initial:f,existingSlugs:x,onClose:()=>{d(!1),p(null)},onSave:w})]})}function o2(){return o.jsxs("div",{className:"space-y-6",children:[o.jsx(tz,{}),o.jsx(iz,{})]})}function cz(){const e=nt(),[n,s]=b.useState(!1),i=Xe(n?"/agents/vault?include_removed=1":"/agents/vault",()=>Jt.vault({includeRemoved:n})),c=i.data||[],[d,f]=b.useState(null),p=async h=>{const x=h.source!=="user",y=x?C("base.defaults_tombstone_msg",{slug:h.slug}):C("base.defaults_delete_msg",{slug:h.slug});if(confirm(y))try{await Jt.vaultRemove(h.slug),e.success(C(x?"base.defaults_hidden":"base.defaults_deleted")),i.mutate()}catch(S){e.error(S.message)}},m=async h=>{try{await Jt.vaultRestore(h),e.success(C("base.defaults_restored")),i.mutate()}catch(x){e.error(x.message)}};return o.jsxs(He,{title:C("base.defaults_title"),description:C("base.defaults_desc"),action:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(sn,{checked:n,onChange:s,label:C("base.defaults_show_removed")}),o.jsxs(he,{size:"sm",onClick:()=>f("new"),children:[o.jsx(Nn,{size:14})," ",C("base.defaults_new")]})]}),children:[i.isLoading&&o.jsx(Je,{}),!i.isLoading&&c.length===0&&o.jsx(ot,{children:C("base.defaults_empty")}),o.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:c.map(h=>{const x=n&&h.tombstoned;return o.jsxs("div",{className:`flex flex-col gap-2 rounded-xl border bg-card p-4 ${x?"border-dashed border-border opacity-60":"border-border"}`,children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.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?o.jsx(Ns,{className:"size-4 text-white"}):o.jsx(vn,{className:"size-4 text-white"})}),o.jsx("span",{className:"truncate text-sm font-semibold",children:h.slug}),o.jsx(uz,{source:h.source})]}),o.jsx("div",{className:"flex shrink-0 items-center gap-0.5",children:x?o.jsx(Qp,{label:C("base.defaults_restore"),onClick:()=>m(h.slug),variant:"secondary",children:o.jsx(yj,{size:13})}):o.jsxs(o.Fragment,{children:[o.jsx(Qp,{label:C("base.defaults_edit"),onClick:()=>f(h),variant:"ghost",children:o.jsx(xh,{size:13})}),o.jsx(Qp,{label:h.source==="user"?C("base.defaults_delete"):C("base.defaults_hide"),onClick:()=>p(h),variant:"ghost-destructive",children:o.jsx(Ja,{size:13})})]})})]}),h.model?o.jsx(Ue,{tone:"info",children:h.model}):o.jsx("span",{className:"text-[10px] text-muted-fg",children:"modelo: default del router"}),h.description&&o.jsx("p",{className:"line-clamp-3 text-xs text-muted-fg",children:h.description}),o.jsxs("div",{className:"flex flex-wrap gap-1",children:[h.role&&o.jsx(Ue,{children:h.role}),h.skills?.map(y=>o.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[o.jsx(il,{size:9})," ",y]},y)),h.tools?.map(y=>o.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[o.jsx(cl,{size:9})," ",y]},y))]})]},h.slug)})}),d!==null&&o.jsx(dz,{agent:d==="new"?null:d,onClose:()=>f(null),onSaved:()=>{f(null),i.mutate()}})]})}function uz({source:e}){return e==="user"?o.jsx(Ue,{tone:"success",children:"user"}):e==="user-override"?o.jsx(Ue,{tone:"warning",children:"override"}):o.jsx(Ue,{tone:"muted",children:"bundled"})}function Qp({label:e,onClick:n,variant:s="ghost",children:r}){const i="inline-flex size-7 items-center justify-center rounded-md transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",c={ghost:"text-muted-fg hover:bg-accent hover:text-accent-fg","ghost-destructive":"text-muted-fg hover:bg-destructive/15 hover:text-destructive",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80"};return o.jsxs(Wh,{children:[o.jsx(ex,{render:o.jsx("button",{type:"button",onClick:n,"aria-label":e,className:`${i} ${c[s]}`,children:r})}),o.jsx(tx,{children:e})]})}function dz({agent:e,onClose:n,onSaved:s}){const r=nt(),[i,c]=b.useState(!1),d=!e,[f,p]=b.useState(e?.slug??""),[m,h]=b.useState(e?.role??""),[x,y]=b.useState(e?.model??""),[S,w]=b.useState(e?.description??""),[_,j]=b.useState(e?.language??"es"),[k,E]=b.useState((e?.skills??[]).join(", ")),[R,N]=b.useState((e?.tools??[]).join(", ")),[M,A]=b.useState(!!e?.is_master),[O,L]=b.useState(e?.body??""),U=async()=>{const P={role:m||void 0,model:x||void 0,description:S||void 0,language:_||void 0,skills:k,tools:R,is_master:M};c(!0);try{if(d){if(!/^[a-z][a-z0-9_-]*$/.test(f))throw new Error(C("base.defaults_slug_invalid"));await Jt.vaultCreate(f,P,O),r.success(C("base.defaults_created",{slug:f}))}else await Jt.vaultPatch(e.slug,{fields:P,body:O}),r.success(C("base.defaults_saved",{slug:e.slug}));s()}catch(B){r.error(B.message)}finally{c(!1)}};return o.jsx(ma,{open:!0,onClose:n,title:d?C("base.defaults_new_title"):C("base.defaults_edit_title",{slug:e.slug}),description:d?C("base.defaults_new_desc"):e.source==="bundled"?C("base.defaults_bundled_desc"):C("base.defaults_user_desc"),size:"lg",footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:n,disabled:i,children:C("common.cancel")}),o.jsx(he,{variant:"primary",onClick:U,loading:i,children:C("common.save")})]}),children:o.jsxs("div",{className:"space-y-3",children:[d&&o.jsx(fe,{label:"slug",hint:"kebab-case, ej. reviewer, my-agent, content-writer",children:o.jsx(Ce,{autoFocus:!0,value:f,onChange:P=>p(P.target.value),placeholder:"reviewer"})}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:"role",children:o.jsx(Ce,{value:m,onChange:P=>h(P.target.value),placeholder:"Code reviewer"})}),o.jsx(fe,{label:"model",children:o.jsx(Ce,{value:x,onChange:P=>y(P.target.value),placeholder:"openrouter:..."})}),o.jsx(fe,{label:"language",children:o.jsx(Ce,{value:_,onChange:P=>j(P.target.value),placeholder:"es"})}),o.jsx(fe,{label:"is_master",children:o.jsx("div",{className:"flex h-9 items-center",children:o.jsx(sn,{checked:M,onChange:A,label:C("base.defaults_master_label")})})})]}),o.jsx(fe,{label:"description",children:o.jsx(Ce,{value:S,onChange:P=>w(P.target.value)})}),o.jsx(fe,{label:"skills",hint:"separadas por coma",children:o.jsx(Ce,{value:k,onChange:P=>E(P.target.value),placeholder:"code-review, git"})}),o.jsx(fe,{label:"tools",hint:"separadas por coma",children:o.jsx(Ce,{value:R,onChange:P=>N(P.target.value),placeholder:"read, write, run"})}),o.jsx(fe,{label:"body",hint:"markdown — extiende el system prompt del agente",children:o.jsx(Qt,{value:O,onChange:P=>L(P.target.value),rows:10,placeholder:"# Mission\\n..."})})]})})}const fz={apx:"success",claude:"info",codex:"warning"};function mz(){const[e,n]=b.useState(""),s=Xe(`/sessions?engine=${e}`,()=>f5.global(e||void 0)),r=s.data?.sessions||[];return o.jsxs(He,{title:C("base.sessions_title"),description:C("base.sessions_desc"),action:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-40",children:o.jsx(Ct,{value:e,onChange:n,options:[{value:"",label:C("base.sessions_all")},{value:"apx",label:"apx"},{value:"claude",label:"claude"},{value:"codex",label:"codex"}]})}),o.jsx(he,{size:"sm",variant:"secondary",onClick:()=>s.mutate(),children:o.jsx(Wr,{size:13})})]}),children:[s.isLoading&&o.jsx(Je,{}),s.error&&o.jsx(ot,{children:C("base.sessions_error",{msg:s.error.message})}),!s.isLoading&&!s.error&&r.length===0&&o.jsx(ot,{children:C("base.sessions_empty")}),o.jsx("ul",{className:"space-y-1 text-sm",children:r.map((i,c)=>o.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsx(Ue,{tone:fz[i.engine]||"muted",children:i.engine}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"truncate",children:i.title||i.id}),o.jsx("div",{className:"truncate font-mono text-[10px] text-muted-fg",children:i.cwd})]}),i.mtime>0&&o.jsx("span",{className:"shrink-0 text-[11px] text-muted-fg",children:new Date(i.mtime).toLocaleString()})]},`${i.engine}-${i.id}-${c}`))})]})}function pz(){const e=Ia(),[n,s]=b.useState("open"),r=Xe(`/tasks?state=${n}`,()=>lr.global(n));return o.jsxs(He,{title:C("project.global_tasks.title"),description:C("project.global_tasks.subtitle"),action:o.jsx("div",{className:"flex gap-1",children:["open","done","dropped","all"].map(i=>o.jsx(he,{size:"sm",variant:n===i?"primary":"ghost",onClick:()=>s(i),children:i},i))}),children:[r.isLoading&&o.jsx(Je,{}),!r.isLoading&&(r.data?.length??0)===0&&o.jsx(ot,{children:C("project.global_tasks.empty")}),o.jsx("ul",{className:"space-y-2 text-sm",children:(r.data||[]).map(i=>o.jsxs("li",{className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsx("button",{type:"button",onClick:()=>e(`/p/${i.project_id}/tasks`),title:C("project.global_tasks.go_project"),children:o.jsx(Ue,{tone:"info",children:(i.project_name||"").split("/").pop()||i.project_id})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"font-medium",children:i.title}),o.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[o.jsx("span",{children:i.state}),i.agent&&o.jsxs(Ue,{tone:"muted",children:["@",i.agent]}),i.tags?.map(c=>o.jsxs("span",{children:["#",c]},c)),i.due&&o.jsxs("span",{children:[C("project.global_tasks.due")," ",i.due]})]})]})]},`${i.project_id}-${i.id}`))})]})}const l2=b.createContext(void 0);function jx(){const e=b.useContext(l2);if(e===void 0)throw new Error(Rn(64));return e}let gz=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const Sx={tabActivationDirection:e=>({[gz.activationDirection]:e})},hz=b.forwardRef(function(n,s){const{className:r,defaultValue:i=0,onValueChange:c,orientation:d="horizontal",render:f,value:p,style:m,...h}=n,x=n.defaultValue!==void 0,y=b.useRef([]),[S,w]=b.useState(()=>new Map),[_,j]=Fi({controlled:p,default:i,name:"Tabs",state:"value"}),k=p!==void 0,[E,R]=b.useState(()=>new Map),N=b.useCallback(se=>{if(se===void 0)return null;for(const[ie,te]of E.entries())if(te!=null&&se===(te.value??te.index))return ie;return null},[E]),[M,A]=b.useState(()=>({previousValue:_,tabActivationDirection:"none"})),{previousValue:O,tabActivationDirection:L}=M;let U=L,P=!1;O!==_&&(U=K1(O,_,d,E),P=O!=null&&_!=null&&N(_)==null);const B=P?O:_,D=O!==B||L!==U;Re(()=>{D&&A({previousValue:B,tabActivationDirection:U})},[B,D,U]);const H=Me((se,ie)=>{const te=K1(_,se,d,E);ie.activationDirection=te,c?.(se,ie),!ie.isCanceled&&j(se)}),Y=Me((se,ie)=>{c?.(se,tt(ie,void 0,void 0,{activationDirection:"none"}))}),Q=Me((se,ie)=>{w(te=>{if(te.get(se)===ie)return te;const ke=new Map(te);return ke.set(se,ie),ke})}),q=Me((se,ie)=>{w(te=>{if(!te.has(se)||te.get(se)!==ie)return te;const ke=new Map(te);return ke.delete(se),ke})}),X=b.useCallback(se=>S.get(se),[S]),Z=b.useCallback(se=>{for(const ie of E.values())if(se===ie?.value)return ie?.id},[E]),G=b.useMemo(()=>({getTabElementBySelectedValue:N,getTabIdByPanelValue:Z,getTabPanelIdByValue:X,onValueChange:H,orientation:d,registerMountedTabPanel:Q,setTabMap:R,unregisterMountedTabPanel:q,tabActivationDirection:U,value:_}),[N,Z,X,H,d,Q,R,q,U,_]),K=b.useMemo(()=>{for(const se of E.values())if(se!=null&&se.value===_)return se},[E,_]),I=b.useMemo(()=>{for(const se of E.values())if(se!=null&&!se.disabled)return se.value},[E]),V=b.useRef(!x),$=b.useRef(x),W=b.useRef(!1);Re(()=>{if(k)return;function se($e,be){j($e),A(Se=>Se.previousValue===$e&&Se.tabActivationDirection==="none"?Se:{previousValue:$e,tabActivationDirection:"none"}),Y($e,be),V.current=!1}if(E.size===0){if(!W.current||_===null)return;se(null,G0);return}W.current=!0;const ie=K?.disabled,te=K==null&&_!==null;if(!ie&&_===i&&($.current=!1),$.current&&ie&&_===i)return;const ke=V.current;if(ie||te){const $e=I??null;if(_===$e){V.current=!1;return}let be=G0;ke?be=Y0:ie&&(be=$j),se($e,be);return}ke&&K!=null&&(Y(_,Y0),V.current=!1)},[i,I,k,Y,K,j,E,_]);const ce=Lt("div",n,{state:{orientation:d,tabActivationDirection:U},ref:s,props:h,stateAttributesMapping:Sx});return o.jsx(l2.Provider,{value:G,children:o.jsx(bx,{elementsRef:y,children:ce})})});function K1(e,n,s,r){if(e==null||n==null)return"none";let i=null,c=null;for(const[p,m]of r.entries()){if(m==null)continue;const h=m.value??m.index;if(e===h&&(i=p),n===h&&(c=p),i!=null&&c!=null)break}if(i==null||c==null)return i!==c&&(typeof e=="number"||typeof e=="string")&&typeof e==typeof n?s==="horizontal"?n>e?"right":"left":n>e?"down":"up":"none";const d=i.getBoundingClientRect(),f=c.getBoundingClientRect();if(s==="horizontal"){if(f.left<d.left)return"left";if(f.left>d.left)return"right"}else{if(f.top<d.top)return"up";if(f.top>d.top)return"down"}return"none"}const i2="data-composite-item-active";function xz(e={}){const{highlightItemOnHover:n,highlightedIndex:s,onHighlightedIndexChange:r}=gw(),{ref:i,index:c}=yx(e),d=s===c,f=b.useRef(null),p=As(i,f);return{compositeProps:b.useMemo(()=>({tabIndex:d?0:-1,onFocus(){r(c)},onMouseMove(){const h=f.current;if(!n||!h)return;const x=h.hasAttribute("disabled")||h.ariaDisabled==="true";!d&&!x&&h.focus()}}),[d,r,c,n]),compositeRef:p,index:c}}const c2=b.createContext(void 0);function bz(){const e=b.useContext(c2);if(e===void 0)throw new Error(Rn(65));return e}const vz=b.forwardRef(function(n,s){const{className:r,disabled:i=!1,render:c,value:d,id:f,nativeButton:p=!0,style:m,...h}=n,{value:x,getTabPanelIdByValue:y,orientation:S}=jx(),{activateOnFocus:w,highlightedTabIndex:_,onTabActivation:j,registerTabResizeObserverElement:k,setHighlightedTabIndex:E,tabsListElement:R}=bz(),N=vr(f),M=b.useMemo(()=>({disabled:i,id:N,value:d}),[i,N,d]),{compositeProps:A,compositeRef:O,index:L}=xz({metadata:M}),U=d===x,P=b.useRef(!1),B=b.useRef(null);b.useEffect(()=>{const V=B.current;if(V)return k(V)},[k]),Re(()=>{if(P.current){P.current=!1;return}if(!(U&&L>-1&&_!==L))return;const V=R;if(V!=null){const $=zn(xt(V));if($&&Ye(V,$))return}i||E(L)},[U,L,_,E,i,R]);const{getButtonProps:D,buttonRef:H}=gl({disabled:i,native:p,focusableWhenDisabled:!0}),Y=y(d),Q=b.useRef(!1),q=b.useRef(!1);function X(V){U||i||j(d,tt(Ts,V.nativeEvent,void 0,{activationDirection:"none"}))}function Z(V){U||(L>-1&&!i&&E(L),!i&&w&&(!Q.current||Q.current&&q.current)&&j(d,tt(Ts,V.nativeEvent,void 0,{activationDirection:"none"})))}function G(V){if(U||i)return;Q.current=!0;function $(){Q.current=!1,q.current=!1}(!V.button||V.button===0)&&(q.current=!0,xt(V.currentTarget).addEventListener("pointerup",$,{once:!0}))}return Lt("button",n,{state:{disabled:i,active:U,orientation:S},ref:[s,H,O,B],props:[A,{role:"tab","aria-controls":Y,"aria-selected":U,id:N,onClick:X,onFocus:Z,onPointerDown:G,[i2]:U?"":void 0,onKeyDownCapture(){P.current=!0}},h,D]})});let yz=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e[e.startingStyle=Kr.startingStyle]="startingStyle",e[e.endingStyle=Kr.endingStyle]="endingStyle",e})({});const _z={...Sx,...ml},jz=b.forwardRef(function(n,s){const{className:r,value:i,render:c,keepMounted:d=!1,style:f,...p}=n,{value:m,getTabIdByPanelValue:h,orientation:x,tabActivationDirection:y,registerMountedTabPanel:S,unregisterMountedTabPanel:w}=jx(),_=vr(),j=b.useMemo(()=>({id:_,value:i}),[_,i]),{ref:k,index:E}=yx({metadata:j}),R=i===m,{mounted:N,transitionStatus:M,setMounted:A}=ac(R),O=!N,L=h(i),U={hidden:O,orientation:x,tabActivationDirection:y,transitionStatus:M},P=b.useRef(null),B=Lt("div",n,{state:U,ref:[s,k,P],props:[{"aria-labelledby":L,hidden:O,id:_,role:"tabpanel",tabIndex:R?0:-1,inert:Jh(!R),[yz.index]:E},p],stateAttributesMapping:_z});return br({open:R,ref:P,onComplete(){R||A(!1)}}),Re(()=>{if(!(O&&!d)&&_!=null)return S(i,_),()=>{w(i,_)}},[O,d,i,_,S,w]),d||N?B:null});function Sz(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const wz=[];function Cz(e){const{itemSizes:n,cols:s=1,loopFocus:r=!0,onLoop:i,dense:c=!1,orientation:d="both",direction:f,highlightedIndex:p,onHighlightedIndexChange:m,rootRef:h,enableHomeAndEndKeys:x=!1,stopEventPropagation:y=!1,disabledIndices:S,modifierKeys:w=wz}=e,[_,j]=b.useState(0),k=s>1,E=b.useRef(null),R=As(E,h),N=b.useRef([]),M=b.useRef(!1),A=p??_,O=Me((B,D=!1)=>{if((m??j)(B),D){const H=N.current[B];B1(E.current,H,f,d)}}),L=Me(B=>{if(B.size===0||M.current)return;M.current=!0;const D=Array.from(B.keys()),H=D.find(Q=>Q?.hasAttribute(i2))??null,Y=H?D.indexOf(H):-1;Y!==-1&&O(Y),B1(E.current,H,f,d)}),U=Me((B,D,H)=>i?i?.(B,D,H,N):H),P=b.useMemo(()=>({"aria-orientation":d==="both"?void 0:d,ref:R,onFocus(B){const D=E.current,H=En(B.nativeEvent);!D||H==null||!P1(H)||H.setSelectionRange(0,H.value.length??0)},onKeyDown(B){const D=x?mx:kw;if(!D.has(B.key)||Ez(B,w)||!E.current)return;const Y=f==="rtl",Q=Y?yd:zi,q={horizontal:Q,vertical:$o,both:Q}[d],X=Y?zi:yd,Z={horizontal:X,vertical:Oi,both:X}[d],G=En(B.nativeEvent);if(G!=null&&P1(G)&&!Sz(G)){const ce=G.selectionStart,se=G.selectionEnd,ie=G.value??"";if(ce==null||B.shiftKey||ce!==se||B.key!==Z&&ce<ie.length||B.key!==q&&ce>0)return}let K=A;const I=Fu(N,S),V=Ug(N,S);if(k){const ce=n||Array.from({length:N.current.length},()=>({width:1,height:1})),se=Wj(ce,s,c),ie=se.findIndex(ke=>ke!=null&&!Es(N.current,ke,S)),te=se.reduce((ke,$e,be)=>$e!=null&&!Es(N.current,$e,S)?be:ke,-1);K=se[Jj(se.map(ke=>ke!=null?N.current[ke]:null),{event:B,orientation:d,loopFocus:r,onLoop:U,cols:s,disabledIndices:tS([...S||N.current.map((ke,$e)=>Es(N.current,$e)?$e:void 0),void 0],se),minIndex:ie,maxIndex:te,prevIndex:eS(A>V?I:A,ce,se,s,B.key===$o?"bl":B.key===zi?"tr":"tl"),rtl:Y})]}const $={horizontal:[Q],vertical:[$o],both:[Q,$o]}[d],W={horizontal:[X],vertical:[Oi],both:[X,Oi]}[d],oe=k?D:{horizontal:x?i4:Cw,vertical:x?c4:Ew,both:D}[d];x&&(B.key===Zd?K=I:B.key===Jd&&(K=V)),K===A&&($.includes(B.key)||W.includes(B.key))&&(r&&K===V&&$.includes(B.key)?(K=I,i&&(K=i(B,A,K,N))):r&&K===I&&W.includes(B.key)?(K=V,i&&(K=i(B,A,K,N))):K=On(N.current,{startingIndex:K,decrement:W.includes(B.key),disabledIndices:S})),K!==A&&!Gi(N.current,K)&&(y&&B.stopPropagation(),oe.has(B.key)&&B.preventDefault(),O(K,!0),queueMicrotask(()=>{N.current[K]?.focus()}))}}),[s,c,f,S,N,x,A,k,n,r,i,U,R,w,O,d,y]);return b.useMemo(()=>({props:P,highlightedIndex:A,onHighlightedIndexChange:O,elementsRef:N,disabledIndices:S,onMapChange:L,relayKeyboardEvent:P.onKeyDown}),[P,A,O,N,S,L])}function Ez(e,n){for(const s of p4.values())if(!n.includes(s)&&e.getModifierState(s))return!0;return!1}function kz(e){const{render:n,className:s,style:r,refs:i=qi,props:c=qi,state:d=an,stateAttributesMapping:f,highlightedIndex:p,onHighlightedIndexChange:m,orientation:h,dense:x,itemSizes:y,loopFocus:S,onLoop:w,cols:_,enableHomeAndEndKeys:j,onMapChange:k,stopEventPropagation:E=!0,rootRef:R,disabledIndices:N,modifierKeys:M,highlightItemOnHover:A=!1,tag:O="div",...L}=e,U=Qh(),{props:P,highlightedIndex:B,onHighlightedIndexChange:D,elementsRef:H,onMapChange:Y,relayKeyboardEvent:Q}=Cz({itemSizes:y,cols:_,loopFocus:S,onLoop:w,dense:x,orientation:h,highlightedIndex:p,onHighlightedIndexChange:m,rootRef:R,stopEventPropagation:E,enableHomeAndEndKeys:j,direction:U,disabledIndices:N,modifierKeys:M}),q=Lt(O,e,{state:d,ref:i,props:[P,...c,L],stateAttributesMapping:f}),X=b.useMemo(()=>({highlightedIndex:B,onHighlightedIndexChange:D,highlightItemOnHover:A,relayKeyboardEvent:Q}),[B,D,A,Q]);return o.jsx(pw.Provider,{value:X,children:o.jsx(bx,{elementsRef:H,onMapChange:Z=>{k?.(Z),Y(Z)},children:q})})}const Nz=b.forwardRef(function(n,s){const{activateOnFocus:r=!1,className:i,loopFocus:c=!0,render:d,style:f,...p}=n,{onValueChange:m,orientation:h,value:x,setTabMap:y,tabActivationDirection:S}=jx(),[w,_]=b.useState(0),[j,k]=b.useState(null),E=b.useRef(new Set),R=b.useRef(new Set),N=b.useRef(null);b.useEffect(()=>{if(typeof ResizeObserver>"u")return;const B=new ResizeObserver(()=>{E.current.forEach(D=>{D()})});return N.current=B,j&&B.observe(j),R.current.forEach(D=>{B.observe(D)}),()=>{B.disconnect(),N.current=null}},[j]);const M=Me(B=>(E.current.add(B),()=>{E.current.delete(B)})),A=Me(B=>(R.current.add(B),N.current?.observe(B),()=>{R.current.delete(B),N.current?.unobserve(B)})),O=Me((B,D)=>{B!==x&&m(B,D)}),L={orientation:h,tabActivationDirection:S},U={"aria-orientation":h==="vertical"?"vertical":void 0,role:"tablist"},P=b.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:w,registerIndicatorUpdateListener:M,registerTabResizeObserverElement:A,onTabActivation:O,setHighlightedTabIndex:_,tabsListElement:j}),[r,w,M,A,O,_,j]);return o.jsx(c2.Provider,{value:P,children:o.jsx(kz,{render:d,className:i,style:f,state:L,refs:[s,k],props:[U,p],stateAttributesMapping:Sx,highlightedIndex:w,enableHomeAndEndKeys:!0,loopFocus:c,orientation:h,onHighlightedIndexChange:_,onMapChange:y,disabledIndices:qi})})});function Wd({className:e,...n}){return o.jsx(hz,{"data-slot":"tabs",className:Pt("flex flex-col gap-4",e),...n})}const Rz=cx("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 ef({className:e,variant:n="default",...s}){return o.jsx(Nz,{"data-slot":"tabs-list","data-variant":n,className:Pt(Rz({variant:n}),e),...s})}function Fa({className:e,...n}){return o.jsx(vz,{"data-slot":"tabs-trigger",className:Pt("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 ka({className:e,...n}){return o.jsx(jz,{"data-slot":"tabs-content",className:Pt("text-sm outline-none",e),...n})}function Q1(e,n){let s=e;for(const r of n.split(".")){if(!s||typeof s!="object"||Array.isArray(s))return;s=s[r]}return s}function wx(e,n=""){const s={};for(const[r,i]of Object.entries(e)){const c=n?`${n}.${r}`:r;i&&typeof i=="object"&&!Array.isArray(i)?Object.assign(s,wx(i,c)):s[c]=i}return s}function Tz(e){const n=JSON.parse(e);if(!n||typeof n!="object"||Array.isArray(n))throw new Error("JSON debe ser objeto.");return n}function th({sections:e,source:n,placeholderSource:s,jsonTitle:r,jsonDescription:i,saveLabel:c="Guardar",onSaveFields:d,onSaveJson:f,busy:p}){const m=e[0]?.key||"json",[h,x]=b.useState({}),[y,S]=b.useState(""),[w,_]=b.useState("");b.useEffect(()=>{const R={};for(const N of e.flatMap(M=>M.fields))R[N.path]=Q1(n,N.path)??"";x(R),S(JSON.stringify(n||{},null,2)),_("")},[n,e]);const j=b.useMemo(()=>new Set(e.flatMap(R=>R.fields.map(N=>N.path))),[e]),k=async()=>{const R={},N=[];for(const M of e.flatMap(A=>A.fields)){const A=h[M.path];if(!Da(A)){if(A===""||A===void 0||A===null){N.push(M.path);continue}if(M.kind==="number"){const O=Number(A);Number.isFinite(O)&&(R[M.path]=O)}else R[M.path]=A}}await d(R,N.filter(M=>j.has(M)))},E=async()=>{_("");try{await f(Tz(y))}catch(R){_(R.message)}};return o.jsxs(Wd,{defaultValue:m,className:"space-y-4",children:[o.jsxs(ef,{className:"flex flex-wrap",children:[e.map(R=>o.jsx(Fa,{value:R.key,children:R.label},R.key)),o.jsx(Fa,{value:"json",children:"JSON"})]}),e.map(R=>o.jsx(ka,{value:R.key,children:o.jsxs("div",{className:"space-y-4",children:[R.description&&o.jsx("p",{className:"text-sm text-muted-fg",children:R.description}),o.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:R.fields.map(N=>o.jsx(Az,{field:N,value:h[N.path],inherited:Q1(s,N.path),onChange:M=>x(A=>({...A,[N.path]:M}))},N.path))}),o.jsx(he,{variant:"primary",loading:p,onClick:k,children:c})]})},R.key)),o.jsx(ka,{value:"json",children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-medium",children:r}),i&&o.jsx("p",{className:"text-xs text-muted-fg",children:i})]}),o.jsx(Qt,{rows:18,className:"font-mono text-xs",value:y,onChange:R=>S(R.target.value)}),w&&o.jsx("p",{className:"text-xs text-destructive",children:w}),o.jsx(he,{variant:"primary",loading:p,onClick:E,children:"Guardar JSON"})]})})]})}function Az({field:e,value:n,inherited:s,onChange:r}){const i=e.placeholder||Z1(s)||(Da(n)?fr(n):""),c=e.hint||(s!==void 0?`Heredado: ${Z1(s)}`:void 0);return e.kind==="boolean"?o.jsx("div",{className:"flex items-end pb-1",children:o.jsx(sn,{checked:n===!0,onChange:r,label:e.label})}):o.jsx(fe,{label:e.label,hint:c,children:e.kind==="select"?o.jsx(Ct,{value:String(n||""),onChange:r,placeholder:i||"(sin override)",options:[{value:"",label:i||"(sin override)"},...(e.options||[]).map(d=>({value:String(d.value),label:d.label}))]}):e.kind==="textarea"?o.jsx(Qt,{rows:4,value:String(n||""),placeholder:i,onChange:d=>r(d.target.value)}):o.jsx(Ce,{type:e.kind==="password"?"password":e.kind==="number"?"number":"text",value:String(Da(n)?"":n||""),placeholder:e.kind==="password"&&Da(n)?fr(n):e.kind==="password"&&Da(s)?fr(s):i,onChange:d=>r(d.target.value)})})}function Z1(e){return e==null||e===""?"":Da(e)?fr(e):Array.isArray(e)?e.join(", "):typeof e=="object"?JSON.stringify(e):String(e)}const Mz=[{key:"routing",label:"Overrides",description:".apc/config.json. Sólo valores propios del proyecto; vacío hereda global/effective.",fields:[{path:"route_to_agent",label:"Route to agent",placeholder:"master"},{path:"super_agent.model",label:"Super-agent model"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:yh.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Prompt extra",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.route_to_agent",label:"Route to agent"},{path:"telegram.chat_id",label:"Chat ID"},{path:"telegram.bot_token",label:"Bot token",kind:"password"},{path:"telegram.respond_with_engine",label:"Responder con engine",kind:"boolean"}]},{key:"engines",label:"Engines",fields:[{path:"engines.ollama.base_url",label:"Ollama URL"},{path:"engines.anthropic.api_key",label:"Anthropic API key",kind:"password"},{path:"engines.openai.api_key",label:"OpenAI API key",kind:"password"},{path:"engines.groq.api_key",label:"Groq API key",kind:"password"},{path:"engines.openrouter.api_key",label:"OpenRouter API key",kind:"password"},{path:"engines.gemini.api_key",label:"Gemini API key",kind:"password"}]}],Oz=[{key:"identity",label:"Proyecto",description:".apc/project.json. Metadata APC portable; no secrets, no runtime.",fields:[{path:"name",label:"Name"},{path:"version",label:"Version"},{path:"apf",label:"APC spec"},{path:"apx",label:"APX install state"},{path:"apx_id",label:"APX storage id"}]}];function zz({pid:e}){const n=nt(),s=Xe(`/projects/${e}/config`,()=>Qn.config.show(e));if(s.isLoading)return o.jsx(Je,{});if(!s.data)return o.jsx(ot,{children:C("project.config.no_data")});const r=async c=>{await Qn.apcProject.put(e,c),n.success(C("project.config.save_project")),s.mutate()},i=async c=>{await Qn.config.put(e,c),n.success(C("project.config.save_override")),s.mutate()};return o.jsx("div",{className:"space-y-6",children:o.jsx(He,{title:C("project.config.section_title"),description:C("project.config.section_desc"),children:o.jsxs(Wd,{defaultValue:"override",className:"space-y-4",children:[o.jsxs(ef,{children:[o.jsx(Fa,{value:"override",children:"Override"}),o.jsx(Fa,{value:"project",children:"APC project"}),o.jsx(Fa,{value:"effective",children:"Effective"})]}),o.jsx(ka,{value:"override",children:o.jsx(th,{sections:Mz,source:s.data.project_only,placeholderSource:s.data.effective,jsonTitle:s.data.project_config_path,jsonDescription:".apc/config.json. Overrides del proyecto.",onSaveFields:async(c,d)=>{await Qn.config.set(e,c),d.length&&await Qn.config.unset(e,d),n.success(C("project.config.save_fields_success")),s.mutate()},onSaveJson:i})}),o.jsx(ka,{value:"project",children:o.jsx(th,{sections:Oz,source:s.data.apc_project||{},jsonTitle:s.data.project_json_path,jsonDescription:".apc/project.json. Metadata APC portable.",onSaveFields:async(c,d)=>{await Qn.apcProject.set(e,Dz(c),d),n.success(C("project.config.save_meta_success")),s.mutate()},onSaveJson:r})}),o.jsx(ka,{value:"effective",children:o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-xs text-muted-fg",children:C("project.config.effective_read")}),o.jsx("pre",{className:"max-h-96 overflow-auto rounded-lg border border-border bg-muted/40 p-3 text-xs",children:JSON.stringify(s.data.effective,null,2)})]})})]})})})}function Dz(e){const n={};for(const[s,r]of Object.entries(wx(e)))Da(r)||(n[s]=r);return n}const Lz=["","es","en","pt","fr","it","de"],J1=e=>e.split(",").map(n=>n.trim()).filter(Boolean);function u2(e){return e.is_master?{gradient:"from-violet-600 to-indigo-600",Icon:Ns}:{gradient:"from-slate-600 to-gray-600",Icon:vn}}function Pz(e){const n=e.filter(d=>d.is_master),s=n.length===1?n[0]:null,r=d=>d.parent?d.parent:s&&!d.is_master&&d.slug!==s.slug?s.slug:null,i=new Map,c=[];for(const d of e){const f=r(d);f&&e.some(p=>p.slug===f)?(i.has(f)||i.set(f,[]),i.get(f).push(d)):c.push(d)}return{roots:c,childrenByParent:i}}function Bz({pid:e}){const n=Ia();nt();const s=Xe(`/projects/${e}/agents`,()=>Jt.list(e)),[r,i]=b.useState("hierarchy"),[c,d]=b.useState(!1),[f,p]=b.useState(!1),m=s.data||[],h=w=>n(`/p/${e}/agents/${w}`),x=w=>n(w?`/p/${e}/chat?agent=${w}`:`/p/${e}/chat`),{roots:y,childrenByParent:S}=b.useMemo(()=>Pz(m),[m]);return o.jsxs(He,{title:C("project.agents.title"),description:C("project.agents.subtitle_full"),action:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs("div",{className:"flex rounded-lg border border-border p-0.5",children:[o.jsxs("button",{onClick:()=>i("hierarchy"),className:Ae("flex items-center gap-1 rounded-md px-2 py-1 text-xs",r==="hierarchy"?"bg-accent text-accent-fg":"text-muted-fg"),children:[o.jsx(hh,{size:13})," ",C("project.agents.hierarchy")]}),o.jsxs("button",{onClick:()=>i("list"),className:Ae("flex items-center gap-1 rounded-md px-2 py-1 text-xs",r==="list"?"bg-accent text-accent-fg":"text-muted-fg"),children:[o.jsx(rR,{size:13})," ",C("project.agents.list_view")]})]}),o.jsxs(he,{size:"sm",variant:"ghost",onClick:()=>p(!0),children:[o.jsx(vR,{size:13})," ",C("project.agents.import")]}),o.jsxs(he,{size:"sm",variant:"secondary",onClick:()=>x(),children:[o.jsx(Za,{size:13})," ",C("project.agents.chat")]}),o.jsxs(he,{size:"sm",variant:"primary","data-testid":"agent-new",onClick:()=>d(!0),children:[o.jsx(Nn,{size:14})," ",C("project.agents.new")]})]}),children:[s.isLoading&&o.jsx(Je,{}),!s.isLoading&&m.length===0&&o.jsx(ot,{children:C("project.agents.empty_text")}),!s.isLoading&&m.length>0&&(r==="hierarchy"?o.jsx(Uz,{roots:y,childrenByParent:S,onOpen:h,onChat:x}):o.jsx(Hz,{agents:m,onOpen:h,onChat:x})),o.jsx(qz,{open:c,pid:e,agents:m,onClose:()=>d(!1),onCreated:()=>{d(!1),s.mutate()}}),o.jsx(Iz,{open:f,pid:e,existing:m.map(w=>w.slug),onClose:()=>p(!1),onImported:()=>s.mutate()})]})}function Iz({open:e,onClose:n,onImported:s,pid:r,existing:i}){const c=nt(),d=Xe(e?"/agents/vault":null,()=>Jt.vault()),[f,p]=b.useState(""),m=d.data||[],h=async x=>{p(x);try{await Jt.import(r,x),c.success(C("project.agents.import_success",{slug:x})),s()}catch(y){c.error(y.message)}finally{p("")}};return o.jsxs(ma,{open:e,onClose:n,title:C("project.agents.import_title"),description:C("project.agents.import_desc"),size:"lg",footer:o.jsx(he,{variant:"ghost",onClick:n,children:C("common.close")}),children:[d.isLoading&&o.jsx(Je,{}),!d.isLoading&&m.length===0&&o.jsx(ot,{children:C("project.agents.import_empty")}),o.jsx("ul",{className:"space-y-2",children:m.map(x=>{const y=i.includes(x.slug);return o.jsxs("li",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/30 p-3",children:[o.jsx(vn,{size:16,className:"shrink-0 text-muted-fg"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"text-sm font-medium",children:x.slug}),x.is_master&&o.jsxs(Ue,{tone:"success",children:[o.jsx(Ns,{size:9})," ",C("project.agents.orchestrator")]}),x.model&&o.jsx(Ue,{tone:"info",children:x.model})]}),x.description&&o.jsx("p",{className:"truncate text-xs text-muted-fg",children:x.description})]}),o.jsx(he,{size:"sm",variant:"primary",disabled:y||f===x.slug,loading:f===x.slug,onClick:()=>h(x.slug),children:C(y?"project.agents.import_already":"project.agents.import_btn")})]},x.slug)})})]})}function Uz({roots:e,childrenByParent:n,onOpen:s,onChat:r}){return o.jsx("div",{className:"space-y-8",children:e.map(i=>{const c=n.get(i.slug)||[];return o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx(Zp,{agent:i,onOpen:s,onChat:r,wide:!0}),c.length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-5 w-px bg-border"}),o.jsx("div",{className:"flex flex-wrap items-start justify-center gap-4 border-t border-border pt-5",children:c.map(d=>o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx(Zp,{agent:d,onOpen:s,onChat:r}),(n.get(d.slug)||[]).length>0&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"h-4 w-px bg-border"}),o.jsx("div",{className:"flex flex-wrap justify-center gap-3 border-t border-border pt-4",children:(n.get(d.slug)||[]).map(f=>o.jsx(Zp,{agent:f,onOpen:s,onChat:r,compact:!0},f.slug))})]})]},d.slug))})]})]},i.slug)})})}function Zp({agent:e,onOpen:n,onChat:s,wide:r,compact:i}){const{gradient:c,Icon:d}=u2(e);return o.jsxs("div",{"data-testid":`agent-card-${e.slug}`,className:Ae("cursor-pointer rounded-xl border border-border bg-card p-3 transition-colors hover:border-muted-fg/50",r?"w-64":i?"w-44":"w-52"),onClick:()=>n(e.slug),children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:Ae("flex size-8 shrink-0 items-center justify-center rounded-lg bg-gradient-to-br",c),children:o.jsx(d,{className:"size-4 text-white"})}),o.jsx("span",{className:"truncate text-sm font-semibold",children:e.slug})]}),o.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-1",children:[e.is_master&&o.jsxs(Ue,{tone:"success",children:[o.jsx(Ns,{size:9})," ",C("project.agents.orchestrator")]}),e.role&&o.jsx(Ue,{children:e.role}),e.model&&!i&&o.jsx(Ue,{tone:"info",children:e.model})]}),o.jsxs("div",{className:"mt-2 flex items-center gap-3 border-t border-border pt-2 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[o.jsxs("button",{onClick:()=>n(e.slug),className:"flex items-center gap-1 hover:text-foreground",children:[o.jsx(bj,{size:12})," ",C("project.agents.view")]}),o.jsxs("button",{onClick:()=>s(e.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[o.jsx(Za,{size:12})," ",C("project.agents.chat")]})]})]})}function Hz({agents:e,onOpen:n,onChat:s}){const r=[...e].sort((i,c)=>+!!c.is_master-+!!i.is_master||i.slug.localeCompare(c.slug));return o.jsx("div",{className:"space-y-2",children:r.map(i=>{const{gradient:c,Icon:d}=u2(i);return o.jsxs("div",{"data-testid":`agent-card-${i.slug}`,className:"flex cursor-pointer items-center gap-4 rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>n(i.slug),children:[o.jsx("div",{className:Ae("flex size-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br",c),children:o.jsx(d,{className:"size-4 text-white"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"text-sm font-semibold",children:i.slug}),i.is_master&&o.jsxs(Ue,{tone:"success",children:[o.jsx(Ns,{size:10})," ",C("project.agents.orchestrator")]}),i.role&&o.jsx(Ue,{children:i.role}),i.model&&o.jsx(Ue,{tone:"info",children:i.model}),i.parent&&o.jsxs("span",{className:"text-[10px] text-violet-400",children:["↳ ",i.parent]})]}),i.description&&o.jsx("p",{className:"mt-1 truncate text-xs text-muted-fg",children:i.description}),o.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[i.skills?.map(f=>o.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[o.jsx(il,{size:9})," ",f]},f)),i.tools?.map(f=>o.jsxs("span",{className:"inline-flex items-center gap-0.5 rounded bg-muted px-1 py-0.5 text-[9px] text-muted-fg",children:[o.jsx(cl,{size:9})," ",f]},f))]})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-xs text-muted-fg",onClick:f=>f.stopPropagation(),children:[o.jsxs("button",{onClick:()=>n(i.slug),className:"flex items-center gap-1 hover:text-foreground",children:[o.jsx(bj,{size:12})," ",C("project.agents.view")]}),o.jsxs("button",{onClick:()=>s(i.slug),className:"flex items-center gap-1 text-emerald-500 hover:text-emerald-400",children:[o.jsx(Za,{size:12})," ",C("project.agents.chat")]})]})]},i.slug)})})}function qz({open:e,onClose:n,onCreated:s,pid:r,agents:i}){const c=nt(),[d,f]=b.useState(""),[p,m]=b.useState(""),[h,x]=b.useState(""),[y,S]=b.useState(""),[w,_]=b.useState(""),[j,k]=b.useState(""),[E,R]=b.useState(""),[N,M]=b.useState(!1),[A,O]=b.useState(""),[L,U]=b.useState(!1),P=()=>{f(""),m(""),x(""),S(""),_(""),k(""),R(""),M(!1),O("")},B=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(d)){c.error(C("project.agents.slug_invalid"));return}U(!0);try{await Jt.create(r,{slug:d,role:p||void 0,model:h||void 0,language:y||void 0,description:w||void 0,skills:J1(j),tools:J1(E),is_master:N,parent:A||void 0}),c.success(C("project.agents.create_success",{slug:d})),s(),P()}catch(D){c.error(D?.message||C("project.agents.create_error"))}finally{U(!1)}};return o.jsx(ma,{open:e,onClose:n,title:C("project.agents.new_title"),description:C("project.agents.new_desc"),size:"lg",footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:n,disabled:L,children:C("common.cancel")}),o.jsx(he,{variant:"primary","data-testid":"agent-create-submit",onClick:B,loading:L,children:C("common.create")})]}),children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("project.agents.slug_label"),children:o.jsx(Ce,{autoFocus:!0,"data-testid":"agent-slug",value:d,onChange:D=>f(D.target.value),placeholder:C("project.agents.slug_ph")})}),o.jsx(fe,{label:C("project.agents.role_label"),children:o.jsx(Ce,{value:p,onChange:D=>m(D.target.value),placeholder:C("project.agents.role_ph")})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("project.agents.model_label"),hint:C("project.agents.model_hint"),children:o.jsx(Ce,{value:h,onChange:D=>x(D.target.value)})}),o.jsx(fe,{label:C("project.agents.lang_label"),children:o.jsx(Ct,{value:y,onChange:S,options:Lz.map(D=>({value:D,label:D||"—"}))})})]}),o.jsx(fe,{label:C("project.agents.desc_label"),children:o.jsx(Qt,{rows:2,value:w,onChange:D=>_(D.target.value),placeholder:C("project.agents.desc_ph")})}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("project.agents.skills_label"),children:o.jsx(Ce,{value:j,onChange:D=>k(D.target.value),placeholder:C("project.agents.skills_ph")})}),o.jsx(fe,{label:C("project.agents.tools_label"),children:o.jsx(Ce,{value:E,onChange:D=>R(D.target.value),placeholder:C("project.agents.tools_ph")})})]}),o.jsxs("div",{className:"grid grid-cols-2 items-end gap-3",children:[o.jsx(fe,{label:C("project.agents.parent_label"),hint:C("project.agents.parent_hint"),children:o.jsx(Ct,{value:A,onChange:O,placeholder:C("project.agents.none_parent"),options:[{value:"",label:C("project.agents.none_parent")},...i.filter(D=>D.slug!==d).map(D=>({value:D.slug,label:D.slug}))]})}),o.jsx(sn,{checked:N,onChange:M,label:C("project.agents.master_label")})]})]})})}function Bu(e){return e.split(`
543
- `).map(n=>n.trim()).filter(Boolean)}const Gr={exec_agent:{label:"Agente del proyecto",desc:"Ejecuta un agente del proyecto con un prompt. Elegís cuál.",icon:vn},super_agent:{label:"Super-agente",desc:"Llama al super-agente de APX con un prompt.",icon:Ns},telegram:{label:"Telegram",desc:"Manda un mensaje fijo a un canal de Telegram. No usa modelo ni agente.",icon:Za},shell:{label:"Shell",desc:"Corre un comando de shell. Sin prompt ni pre/post — el comando es la acción.",icon:Ii},heartbeat:{label:"Latido (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.",icon:Xo}},Vz=Object.keys(Gr).map(e=>({value:e,label:Gr[e].label,description:Gr[e].desc,icon:Gr[e].icon}));function d2(e){if(!e)return"—";if(e.startsWith("every:")){const n=e.slice(6),s=n.match(/^(\d+)(s|m|h|d)$/);if(s){const r=s[1],i={s:"segundos",m:"minutos",h:"horas",d:"días"}[s[2]]||s[2];return`cada ${r} ${i}`}return`cada ${n}`}return e.startsWith("once:")?`una vez · ${new Date(e.slice(5)).toLocaleString()}`:e.startsWith("cron ")?`cron · ${e.slice(5)}`:e}const $z=[{label:"cada 10 min",value:"every:10m"},{label:"cada hora",value:"every:1h"},{label:"diario 9am",value:"cron 0 9 * * *"},{label:"días hábiles 9am",value:"cron 0 9 * * 1-5"}],Gz=[{v:"{{pre_output}}",where:"prompt",desc:"Salida de los pre-commands, inyectada en el prompt."},{v:"$APX_LLM_OUTPUT",where:"post",desc:"Respuesta del agente / super-agente."},{v:"$APX_STATUS",where:"post",desc:"ok | error."},{v:"$APX_SKIPPED",where:"post",desc:"1 si la acción se salteó."},{v:"$APX_PRE_OUTPUT",where:"post",desc:"Salida de los pre-commands."},{v:"$APX_PRE_OUTPUT_FILE",where:"post",desc:"Archivo con la salida de pre (para outputs grandes)."},{v:"$APX_PRE_EXIT",where:"post",desc:"Exit code de los pre-commands."},{v:"$APX_ROUTINE",where:"pre/post",desc:"Nombre de la rutina."}];function Yz(e,n){switch(e){case"exec_agent":return n.agent?`Ejecuta el agente "${n.agent}"`:"Ejecuta un agente (falta elegir)";case"super_agent":return"Llama al super-agente";case"telegram":return`Envía Telegram a "${n.channel||"default"}"`;case"shell":return n.command?`Corre: ${String(n.command).slice(0,40)}`:"Corre un comando shell";case"heartbeat":return"Deja un latido en logs"}}function Fz({pid:e}){const n=nt(),s=Xe(`/projects/${e}/routines`,()=>or.list(e)),[r,i]=b.useState(null),c=async p=>{try{await(p.enabled?or.disable:or.enable)(e,p.name),s.mutate()}catch(m){n.error(m?.message||C("project.routines.toggle_error"))}},d=async p=>{try{await or.run(e,p.name),n.success(C("project.routines.run_success",{name:p.name}))}catch(m){n.error(m?.message||C("project.routines.run_error"))}},f=async p=>{if(confirm(C("project.routines.delete_confirm",{name:p.name})))try{await or.remove(e,p.name),n.success(C("project.routines.delete_success")),s.mutate()}catch(m){n.error(m?.message||C("project.routines.delete_error"))}};return o.jsxs(He,{title:C("project.routines.title"),description:C("project.routines.subtitle"),action:o.jsxs(he,{size:"sm",variant:"primary",onClick:()=>i({kind:"super_agent",schedule:"every:10m",enabled:!0}),children:[o.jsx(Nn,{size:14})," ",C("project.routines.new_btn")]}),children:[s.isLoading&&o.jsx(Je,{}),!s.isLoading&&(s.data?.length??0)===0&&o.jsx(ot,{children:C("project.routines.empty")}),o.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(p=>{const m=Gr[p.kind],h=m?.icon||Ui,x=p.last_status==="error";return o.jsxs("li",{className:"cursor-pointer rounded-xl border border-border bg-muted/30 p-3 hover:border-muted-fg/50",onClick:()=>i({...p}),children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Ae("flex size-7 items-center justify-center rounded-lg",p.enabled?"bg-emerald-500/15 text-emerald-400":"bg-muted text-muted-fg"),children:o.jsx(h,{size:14})}),o.jsx("span",{className:"font-medium",children:p.name}),o.jsx(Ue,{tone:p.kind==="shell"?"warning":"info",children:m?.label||p.kind}),!p.enabled&&o.jsx(Ue,{tone:"muted",children:C("project.routines.paused")})]}),o.jsxs("div",{className:"flex items-center gap-2",onClick:y=>y.stopPropagation(),children:[o.jsx(sn,{checked:p.enabled,onChange:()=>c(p)}),o.jsxs(he,{size:"sm",variant:"secondary",onClick:()=>d(p),children:[o.jsx(bh,{size:13})," Run"]}),o.jsx(he,{size:"sm",variant:"destructive",onClick:()=>f(p),children:o.jsx(Ja,{size:13})})]})]}),o.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-fg",children:[o.jsxs("span",{children:["⏱ ",d2(p.schedule)]}),o.jsx("span",{children:Yz(p.kind,p.spec||{})}),p.next_run_at&&o.jsxs("span",{children:[C("project.routines.next_run")," ",new Date(p.next_run_at).toLocaleString()]}),o.jsxs("span",{className:Ae(p.last_status==="ok"&&"text-emerald-500",x&&"text-destructive"),children:["última: ",p.last_status||"—"]})]}),p.last_error&&o.jsx("div",{className:"mt-2 rounded-md bg-destructive/10 px-2 py-1 text-xs text-destructive",children:p.last_error})]},p.name)})}),o.jsx(Xz,{draft:r,onClose:()=>i(null),onSaved:()=>{i(null),s.mutate()},pid:e})]})}function Xz({draft:e,onClose:n,onSaved:s,pid:r}){const i=nt(),c=Xe(e?`/projects/${r}/agents`:null,()=>Jt.list(r)),[d,f]=b.useState(!1),[p,m]=b.useState(""),[h,x]=b.useState("super_agent"),[y,S]=b.useState("every:10m"),[w,_]=b.useState(!0),[j,k]=b.useState(""),[E,R]=b.useState(""),[N,M]=b.useState("default"),[A,O]=b.useState(""),[L,U]=b.useState(""),[P,B]=b.useState(""),[D,H]=b.useState("heartbeat"),[Y,Q]=b.useState(""),[q,X]=b.useState(""),[Z,G]=b.useState("");b.useEffect(()=>{if(!e)return;const te=e.spec&&typeof e.spec=="object"?e.spec:{};m(e.name||""),x(e.kind||"super_agent"),S(e.schedule||"every:10m"),_(e.enabled??!0),k(te.agent||""),R(te.prompt||""),M(te.channel||"default"),O(te.chat_id?String(te.chat_id):""),U(te.text||""),B(te.command||""),H(te.channel||"heartbeat"),Q(te.message||""),X((e.pre_commands||[]).join(`
544
- `)),G((e.post_commands||[]).join(`
545
- `))},[e]);const K=()=>{switch(h){case"exec_agent":return{agent:j,prompt:E};case"super_agent":return{prompt:E};case"telegram":return{channel:N,...A?{chat_id:A}:{},text:L};case"shell":return{command:P};case"heartbeat":return{channel:D,message:Y}}},I=async()=>{if(!p){i.error(C("project.routines.name_required"));return}f(!0);try{const te=h==="exec_agent"||h==="super_agent";await or.upsert(r,{name:p,kind:h,schedule:y,enabled:w,spec:K(),pre_commands:te?Bu(q):[],post_commands:te?Bu(Z):[]}),i.success(C("project.routines.saved")),s()}catch(te){i.error(te?.message||C("project.routines.save_error"))}finally{f(!1)}},V=h==="exec_agent"||h==="super_agent",$=V?Bu(q):[],W=V?Bu(Z):[],oe=(()=>{switch(h){case"exec_agent":return j?`Agente "${j}" responde el prompt`:"Agente (elegí cuál) responde el prompt";case"super_agent":return"El super-agente responde el prompt";case"telegram":return`Manda Telegram al canal "${N}"`;case"shell":return P?`Corre: ${P.slice(0,48)}`:"Corre el comando shell";case"heartbeat":return"Deja un latido en logs"}})(),ce=V,se=Gr[h].icon,ie=[...$.map((te,ke)=>({id:`pre-${ke}`,icon:Ii,label:"Pre",detail:te,action:!1})),{id:"action",icon:se,label:oe,detail:ce&&E?E.slice(0,90):void 0,action:!0},...W.map((te,ke)=>({id:`post-${ke}`,icon:Ii,label:"Post",detail:te,action:!1}))];return o.jsx(ma,{open:!!e,onClose:n,title:e?.name?C("project.routines.edit_title",{name:e.name}):C("project.routines.new_title"),description:C("project.routines.dialog_desc"),size:"xl",footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:n,disabled:d,children:C("common.cancel")}),o.jsx(he,{variant:"primary",onClick:I,loading:d,children:C("common.save")})]}),children:o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 px-3 py-2",children:[o.jsx(sn,{checked:w,onChange:_,label:C("project.routines.enabled_label")}),o.jsx("span",{className:"text-[11px] text-muted-fg",children:C(w?"project.routines.enabled_hint":"project.routines.disabled_hint")})]}),o.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[o.jsxs("div",{className:"space-y-3",children:[o.jsx(fe,{label:C("project.routines.name_field"),hint:e?.name?C("project.routines.name_no_edit"):void 0,children:o.jsx(Ce,{value:p,disabled:!!e?.name,onChange:te=>m(te.target.value),placeholder:"resumen-diario"})}),o.jsx(fe,{label:C("project.routines.kind_field"),children:o.jsx(Ct,{value:h,onChange:te=>x(te),options:Vz})}),o.jsx("p",{className:"-mt-1 text-[11px] text-muted-fg",children:Gr[h].desc}),h==="exec_agent"&&o.jsx(fe,{label:C("project.routines.agent_field"),hint:C("project.routines.agent_hint"),children:o.jsx(Ct,{value:j,onChange:k,placeholder:c.isLoading?C("project.routines.agent_loading"):C("project.routines.agent_pick"),options:(c.data||[]).map(te=>({value:te.slug,label:te.slug,description:[te.role,te.model].filter(Boolean).join(" · ")||void 0}))})}),o.jsx(fe,{label:C("project.routines.schedule_field"),hint:C("project.routines.schedule_hint"),children:o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex flex-wrap gap-1",children:[$z.map(te=>o.jsx("button",{type:"button",onClick:()=>S(te.value),className:Ae("rounded-md border px-2 py-0.5 text-[11px]",y===te.value?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:te.label},te.value)),o.jsx("button",{type:"button",onClick:()=>S("manual"),className:Ae("rounded-md border px-2 py-0.5 text-[11px]",y==="manual"?"border-emerald-500/50 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:"Manual"})]}),o.jsx(Ce,{value:y,onChange:te=>S(te.target.value),placeholder:"every:10m · cron 0 9 * * 1-5 · once:ISO · manual"})]})})]}),o.jsxs("div",{className:"space-y-3",children:[V&&o.jsx(fe,{label:C("project.routines.pre_field"),hint:C("project.routines.pre_hint"),children:o.jsx(Qt,{rows:2,className:"font-mono text-xs",value:q,onChange:te=>X(te.target.value),placeholder:"curl -s https://wttr.in/Bariloche"})}),h==="exec_agent"&&o.jsx(fe,{label:C("project.routines.prompt_exec"),children:o.jsx(Qt,{rows:4,value:E,onChange:te=>R(te.target.value),placeholder:C("project.routines.prompt_exec_ph")})}),h==="super_agent"&&o.jsx(fe,{label:C("project.routines.prompt_super"),children:o.jsx(Qt,{rows:4,value:E,onChange:te=>R(te.target.value),placeholder:C("project.routines.prompt_super_ph")})}),h==="telegram"&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("project.routines.tg_channel"),children:o.jsx(Ce,{value:N,onChange:te=>M(te.target.value),placeholder:"default"})}),o.jsx(fe,{label:C("project.routines.tg_chat_id"),children:o.jsx(Ce,{value:A,onChange:te=>O(te.target.value),placeholder:"(usa el del canal)"})})]}),o.jsx(fe,{label:C("project.routines.tg_text"),hint:C("project.routines.tg_text_hint"),children:o.jsx(Qt,{rows:8,value:L,onChange:te=>U(te.target.value),placeholder:"mensaje a enviar"})})]}),h==="shell"&&o.jsx(fe,{label:C("project.routines.shell_field"),hint:C("project.routines.shell_hint"),children:o.jsx(Qt,{rows:11,className:"font-mono text-xs",value:P,onChange:te=>B(te.target.value),placeholder:"cd /repo && git pull && npm test"})}),h==="heartbeat"&&o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("project.routines.hb_channel"),children:o.jsx(Ce,{value:D,onChange:te=>H(te.target.value),placeholder:"heartbeat"})}),o.jsx(fe,{label:C("project.routines.hb_message"),children:o.jsx(Ce,{value:Y,onChange:te=>Q(te.target.value),placeholder:"sigo vivo"})})]}),V&&o.jsx(fe,{label:C("project.routines.post_field"),hint:C("project.routines.post_hint"),children:o.jsx(Qt,{rows:2,className:"font-mono text-xs",value:Z,onChange:te=>G(te.target.value),placeholder:'apx telegram send "$APX_LLM_OUTPUT"'})})]})]}),o.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[o.jsx("div",{className:"mb-1.5 text-[11px] font-semibold uppercase tracking-wide text-muted-fg",children:C("project.routines.vars_title")}),o.jsx("div",{className:"flex flex-wrap gap-1.5",children:Gz.map(te=>o.jsxs("span",{title:te.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:[te.v,o.jsxs("span",{className:"not-italic text-muted-fg",children:["· ",te.where]})]},te.v))})]}),o.jsxs("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[o.jsxs("div",{className:"mb-2 text-xs font-semibold text-muted-fg",children:[C("project.routines.what_happens")," ",o.jsxs("span",{className:"font-normal text-muted-fg",children:["· ⏱ ",d2(y)]})]}),o.jsx("div",{className:"flex flex-wrap items-stretch gap-2",children:ie.map((te,ke)=>o.jsxs("div",{className:"flex items-stretch gap-2",children:[o.jsxs("div",{className:Ae("flex max-w-[240px] flex-col gap-1 rounded-lg border px-2.5 py-2",te.action?"border-emerald-500/40 bg-emerald-500/5":"border-border bg-card"),children:[o.jsxs("div",{className:Ae("flex items-center gap-1.5 text-[11px] font-medium",te.action?"text-emerald-400":"text-muted-fg"),children:[o.jsx(te.icon,{size:12})," ",te.label]}),te.detail&&o.jsx("div",{className:"line-clamp-2 font-mono text-[10px] text-muted-fg",children:te.detail})]}),ke<ie.length-1&&o.jsx(mj,{size:14,className:"shrink-0 self-center text-muted-fg"})]},te.id))})]})]})})}function Kz({pid:e}){const[n,s]=b.useState("open"),r=nt(),i=Xe(`/projects/${e}/tasks?state=${n}`,()=>lr.list(e,n),{dedupingInterval:0,revalidateOnFocus:!0}),[c,d]=b.useState(""),[f,p]=b.useState(!1),m=async()=>{if(c.trim()){p(!0);try{await lr.add(e,{title:c.trim()}),d(""),r.success(C("project.tasks.created")),i.mutate()}catch(x){r.error(x?.message||C("project.tasks.create_error"))}finally{p(!1)}}},h=async(x,y)=>{try{await x(),r.success(y),i.mutate()}catch(S){r.error(S?.message||C("common.error_generic"))}};return o.jsxs(He,{title:C("project.tasks.title"),description:C("project.tasks.subtitle"),action:o.jsx("div",{className:"flex gap-1",children:["open","done","dropped"].map(x=>o.jsx(he,{size:"sm","data-testid":`task-filter-${x}`,variant:n===x?"primary":"ghost",onClick:()=>s(x),children:x},x))}),children:[o.jsxs("div",{className:"mb-4 flex items-end gap-2",children:[o.jsx(fe,{label:C("project.tasks.add_label"),children:o.jsx(Ce,{"data-testid":"task-input",placeholder:C("project.tasks.add_placeholder"),value:c,onChange:x=>d(x.target.value),onKeyDown:x=>{x.key==="Enter"&&m()}})}),o.jsxs(he,{variant:"primary","data-testid":"task-add",onClick:m,loading:f,children:[o.jsx(Nn,{size:14})," ",C("project.tasks.add")]})]}),i.isLoading&&o.jsx(Je,{}),!i.isLoading&&(i.data?.length??0)===0&&o.jsxs(ot,{children:[n==="open"?C("project.tasks.empty_open"):C("project.tasks.empty",{state:n})," ",o.jsx("code",{children:'apx task add "…"'})]}),o.jsx("ul",{className:"space-y-2 text-sm","data-testid":"task-list",children:(i.data||[]).map(x=>o.jsxs("li",{"data-testid":`task-${x.id}`,className:"flex items-start gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsx("span",{className:"mt-0.5 font-mono text-[10px] text-muted-fg",children:x.id}),o.jsxs("div",{className:"flex-1",children:[o.jsx("div",{className:"font-medium",children:x.title}),o.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-2 text-xs text-muted-fg",children:[x.tags?.map(y=>o.jsxs(Ue,{children:["#",y]},y)),x.agent&&o.jsxs(Ue,{tone:"info",children:["@",x.agent]}),x.source&&o.jsxs("span",{children:[C("project.tasks.via")," ",x.source]}),x.due&&o.jsxs("span",{children:[C("project.tasks.due")," ",x.due]})]})]}),o.jsxs("div",{className:"flex gap-1",children:[n==="open"&&o.jsxs(o.Fragment,{children:[o.jsx(he,{size:"sm",variant:"secondary","aria-label":C("project.tasks.aria_done"),"data-testid":`task-done-${x.id}`,onClick:()=>h(()=>lr.done(e,x.id),C("project.tasks.done")),children:o.jsx(Bi,{size:13})}),o.jsx(he,{size:"sm",variant:"destructive","aria-label":C("project.tasks.aria_drop"),"data-testid":`task-drop-${x.id}`,onClick:()=>h(()=>lr.drop(e,x.id),C("project.tasks.drop")),children:o.jsx(Ja,{size:13})})]}),n!=="open"&&o.jsx(he,{size:"sm",variant:"ghost","aria-label":C("project.tasks.aria_reopen"),"data-testid":`task-reopen-${x.id}`,onClick:()=>h(()=>lr.reopen(e,x.id),C("project.tasks.reopen")),children:o.jsx(yj,{size:13})})]})]},x.id))})]})}function Qz({pid:e}){const n=nt(),s=Xe(`/projects/${e}/mcps`,()=>Mi.list(e)),r=Xe(`/projects/${e}/mcps/check`,()=>Mi.check(e)),[i,c]=b.useState(!1),d=async(f,p)=>{if(confirm(C("project.mcps.delete_confirm",{name:f,scope:p})))try{await Mi.remove(e,f,p),n.success(C("project.mcps.removed")),s.mutate()}catch(m){n.error(m?.message||C("common.error_generic"))}};return o.jsxs(He,{title:C("project.mcps.title"),description:C("project.mcps.subtitle"),action:o.jsxs(he,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[o.jsx(Nn,{size:14})," ",C("project.mcps.new")]}),children:[r.data?.conflicts?.length?o.jsx("div",{className:"mb-3 rounded-md border border-amber-500/40 bg-amber-500/10 p-2 text-xs",children:C("project.mcps.conflicts",{names:r.data.conflicts.map(f=>f.name).join(", ")})}):null,s.isLoading&&o.jsx(Je,{}),!s.isLoading&&(s.data?.length??0)===0&&o.jsx(ot,{children:C("project.mcps.empty")}),o.jsx("ul",{className:"space-y-2 text-sm",children:(s.data||[]).map(f=>o.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsx("span",{className:"font-medium",children:f.name}),o.jsx(Ue,{tone:"info",children:f.source}),o.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:[f.transport," · ",f.enabled===!1?"disabled":"enabled"]}),o.jsx(he,{size:"sm",variant:"destructive",onClick:()=>d(f.name,f.source),children:o.jsx(Ja,{size:13})})]},`${f.source}-${f.name}`))}),o.jsx(Zz,{open:i,onClose:()=>c(!1),pid:e,onCreated:()=>{c(!1),s.mutate()}})]})}function Zz({open:e,onClose:n,pid:s,onCreated:r}){const i=nt(),[c,d]=b.useState(!1),[f,p]=b.useState("shared"),[m,h]=b.useState(""),[x,y]=b.useState("stdio"),[S,w]=b.useState(""),[_,j]=b.useState(""),[k,E]=b.useState(""),[R,N]=b.useState(""),[M,A]=b.useState(!0),O=async()=>{if(!m){i.error(C("project.mcps.name_required"));return}d(!0);try{let L;if(R.trim())try{L=JSON.parse(R)}catch{i.error(C("project.mcps.env_invalid")),d(!1);return}const U=x==="stdio"?{name:m,command:S,args:_?_.split(/\s+/):void 0,env:L,enabled:M}:{name:m,url:k,enabled:M};await Mi.add(s,f,U),i.success(C("project.mcps.added")),h(""),w(""),j(""),E(""),N(""),r()}catch(L){i.error(L?.message||C("common.error_generic"))}finally{d(!1)}};return o.jsx(ma,{open:e,onClose:n,title:C("project.mcps.new_title"),description:C("project.mcps.new_desc"),footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:n,disabled:c,children:C("common.cancel")}),o.jsx(he,{variant:"primary",onClick:O,loading:c,children:C("project.mcps.add_btn")})]}),children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("project.mcps.scope_label"),children:o.jsx(Ct,{value:f,onChange:L=>p(L),options:[{value:"shared",label:"shared",description:".apc/mcps.json"},{value:"runtime",label:"runtime",description:"~/.apx, con secrets"},{value:"global",label:"global",description:"estilo ~/.claude/mcp.json"}]})}),o.jsx(fe,{label:C("project.mcps.transport_label"),children:o.jsx(Ct,{value:x,onChange:L=>y(L),options:[{value:"stdio",label:"stdio",description:"command"},{value:"http",label:"http",description:"url"}]})})]}),o.jsx(fe,{label:C("project.mcps.name_label"),children:o.jsx(Ce,{value:m,onChange:L=>h(L.target.value),placeholder:C("project.mcps.name_ph")})}),x==="stdio"?o.jsxs(o.Fragment,{children:[o.jsx(fe,{label:C("project.mcps.cmd_label"),children:o.jsx(Ce,{value:S,onChange:L=>w(L.target.value),placeholder:C("project.mcps.cmd_ph")})}),o.jsx(fe,{label:C("project.mcps.args_label"),hint:C("project.mcps.args_hint"),children:o.jsx(Ce,{value:_,onChange:L=>j(L.target.value),placeholder:C("project.mcps.args_ph")})}),o.jsx(fe,{label:C("project.mcps.env_label"),hint:'{"FOO":"bar"}',children:o.jsx(Qt,{rows:3,className:"font-mono text-xs",value:R,onChange:L=>N(L.target.value)})})]}):o.jsx(fe,{label:C("project.mcps.url_label"),children:o.jsx(Ce,{value:k,onChange:L=>E(L.target.value),placeholder:C("project.mcps.url_ph")})}),o.jsx(sn,{checked:M,onChange:A,label:C("project.mcps.enabled_label")})]})})}function Jz({pid:e}){const n=Xe(`/projects/${e}/agents`,()=>Jt.list(e)),[s,r]=b.useState(null),[i,c]=b.useState(null);return o.jsxs(He,{title:C("project.threads.title"),description:C("project.threads.subtitle"),children:[n.isLoading&&o.jsx(Je,{}),!n.isLoading&&(n.data?.length??0)===0&&o.jsx(ot,{children:C("project.threads.no_agents")}),o.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:[o.jsx("ul",{className:"space-y-1 md:col-span-1",children:(n.data||[]).map(d=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>r(d.slug),className:Ae("flex w-full items-center justify-between rounded-md px-2.5 py-1.5 text-sm",s===d.slug?"bg-accent text-accent-fg":"text-foreground hover:bg-accent/60"),children:[o.jsx("span",{children:d.slug}),d.model&&o.jsx(Ue,{tone:"info",children:d.model})]})},d.slug))}),o.jsx("div",{className:"md:col-span-2",children:s?o.jsx(Wz,{pid:e,slug:s,onOpen:c}):o.jsx(ot,{children:C("project.threads.pick")})})]}),s&&i&&o.jsx(eD,{pid:e,slug:s,id:i,onClose:()=>c(null)})]})}function Wz({pid:e,slug:n,onOpen:s}){const r=Xe(`/projects/${e}/agents/${n}/conversations`,()=>rx.list(e,n));return r.isLoading?o.jsx(Je,{}):r.data?.length?o.jsx("ul",{className:"space-y-1 text-sm",children:r.data.map(i=>o.jsxs("li",{className:"cursor-pointer rounded-md border border-border bg-muted/30 px-3 py-2 hover:bg-accent/40",onClick:()=>s(i.id),children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("span",{className:"font-medium",children:i.title||i.filename}),o.jsx("span",{className:"text-xs text-muted-fg",children:new Date(i.started_at).toLocaleString()})]}),o.jsxs("div",{className:"mt-0.5 text-xs text-muted-fg",children:[i.channel&&o.jsxs(o.Fragment,{children:[C("project.threads.via")," ",i.channel," · "]}),i.messages??0," ",C("project.threads.messages")]})]},i.id))}):o.jsx(ot,{children:C("project.threads.empty",{slug:n})})}function eD({pid:e,slug:n,id:s,onClose:r}){const i=Xe(`/projects/${e}/agents/${n}/conversations/${s}`,()=>rx.get(e,n,s));return o.jsxs(ma,{open:!0,onClose:r,title:C("project.threads.conversation_title",{id:s}),size:"lg",children:[i.isLoading&&o.jsx(Je,{}),i.data&&o.jsx("div",{className:"max-h-[60vh] space-y-3 overflow-y-auto pr-2",children:i.data.messages.map((c,d)=>o.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3 text-sm",children:[o.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs text-muted-fg",children:[o.jsxs("span",{className:"uppercase tracking-wide",children:[c.role,c.name?` (${c.name})`:""]}),c.ts&&o.jsx("span",{children:new Date(c.ts).toLocaleString()})]}),o.jsx("div",{className:"whitespace-pre-wrap",children:c.content})]},d))})]})}function Cx({value:e,onValueChange:n,onSubmit:s,onStop:r,busy:i=!1,disabled:c=!1,placeholder:d,autoFocus:f,minRows:p=2,maxRows:m=8,footer:h,className:x}){const y=b.useRef(null);b.useLayoutEffect(()=>{const w=y.current;if(!w)return;w.style.height="auto";const _=parseFloat(getComputedStyle(w).lineHeight)||20,j=_*p,k=_*m;w.style.height=`${Math.min(Math.max(w.scrollHeight,j),k)}px`,w.style.overflowY=w.scrollHeight>k?"auto":"hidden"},[e,p,m]);const S=e.trim().length>0&&!c;return o.jsxs("div",{className:Pt("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",x),children:[o.jsx("textarea",{ref:y,rows:p,value:e,autoFocus:f,disabled:c,placeholder:d,onChange:w=>n(w.target.value),onKeyDown:w=>{if(w.key==="Enter"&&!w.shiftKey){if(w.preventDefault(),i||!S)return;s()}},className:"w-full resize-none bg-transparent px-2 pt-1 text-sm leading-relaxed outline-none placeholder:text-muted-foreground"}),o.jsxs("div",{className:"flex items-center justify-between gap-2 pl-1",children:[o.jsx("div",{className:"flex min-w-0 items-center gap-2 text-[11px] text-muted-foreground",children:h}),i&&r?o.jsx(nl,{type:"button",size:"icon-sm",variant:"destructive",onClick:r,"aria-label":"Detener",title:"Detener",children:o.jsx(jj,{className:"size-3.5",fill:"currentColor"})}):o.jsx(nl,{type:"button",size:"icon-sm",variant:"default",onClick:s,disabled:!S,"aria-label":"Enviar",title:"Enviar",children:o.jsx(MN,{className:"size-4"})})]})]})}function Ex({value:e,onChange:n,disabled:s}){const[r,i]=b.useState(!1),[c,d]=b.useState(""),[f,p]=b.useState([]),[m,h]=b.useState(!1),x=b.useRef(null);b.useEffect(()=>{if(!r)return;const j=k=>{x.current&&!x.current.contains(k.target)&&i(!1)};return document.addEventListener("mousedown",j),()=>document.removeEventListener("mousedown",j)},[r]),b.useEffect(()=>{if(!r||m)return;let j=!1;return(async()=>{try{const{engines:k}=await bd.list(),E=await Promise.all(k.map(R=>bd.models({engine:R}).then(N=>(N.models||[]).map(M=>M.includes(":")?M:`${R}:${M}`)).catch(()=>[])));if(!j){const R=Array.from(new Set(E.flat())).sort();p(R),h(!0)}}catch{j||h(!0)}})(),()=>{j=!0}},[r,m]);const y=c.trim().toLowerCase(),S=y?f.filter(j=>j.toLowerCase().includes(y)):f,w=e||"Auto",_=j=>{n(j),i(!1),d("")};return o.jsxs("div",{ref:x,className:"relative",children:[o.jsxs("button",{type:"button",disabled:s,onClick:()=>i(j=>!j),"data-testid":"chat-model-picker",className:Ae("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:"Elegir modelo (o Auto)",children:[o.jsx(_j,{className:"size-3 shrink-0"}),o.jsx("span",{className:"truncate font-mono",children:w}),o.jsx(Jr,{className:"size-3 shrink-0 opacity-60"})]}),r&&o.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:[o.jsx("input",{autoFocus:!0,value:c,placeholder:"filtrar o escribir modelo…",onChange:j=>d(j.target.value),onKeyDown:j=>{j.key==="Enter"&&c.trim()&&_(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"}),o.jsxs("ul",{className:"max-h-56 overflow-y-auto",children:[o.jsx("li",{children:o.jsxs("button",{type:"button",onMouseDown:j=>{j.preventDefault(),_("")},className:Ae("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:[o.jsxs("span",{className:"flex items-center gap-1.5",children:[o.jsx(ec,{className:"size-3"})," Auto (router decide)"]}),!e&&o.jsx(Bi,{className:"size-3"})]})}),!m&&o.jsx("li",{className:"px-2 py-1 text-[11px] text-muted-fg",children:"cargando modelos…"}),m&&S.length===0&&c.trim()&&o.jsx("li",{children:o.jsxs("button",{type:"button",onMouseDown:j=>{j.preventDefault(),_(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:["usar “",c.trim(),"”"]})}),S.map(j=>o.jsx("li",{children:o.jsxs("button",{type:"button",onMouseDown:k=>{k.preventDefault(),_(j)},className:Ae("flex w-full items-center justify-between rounded-md px-2 py-1 text-left font-mono text-xs hover:bg-accent hover:text-accent-fg",j===e&&"bg-accent/50"),children:[o.jsx("span",{className:"truncate",children:j}),j===e&&o.jsx(Bi,{className:"size-3 shrink-0"})]})},j))]})]})]})}function tD({onSend:e,onStop:n,streaming:s,model:r,onModelChange:i}){const[c,d]=b.useState(""),f=()=>{const p=c.trim();p&&(d(""),e(p))};return o.jsx("div",{className:"border-t border-border bg-card/60 p-3",children:o.jsx(Cx,{value:c,onValueChange:d,onSubmit:f,onStop:n,busy:s,placeholder:C("project.chat.placeholder"),maxRows:12,footer:i?o.jsx(Ex,{value:r||"",onChange:i,disabled:s}):void 0})})}const nD={read_file:{icon:VN,label:"Leer archivo"},write_file:{icon:qN,label:"Escribir archivo"},edit_file:{icon:ad,label:"Editar archivo"},list_files:{icon:XN,label:"Listar archivos"},search_files:{icon:Gu,label:"Buscar en archivos"},search_messages:{icon:Gu,label:"Buscar mensajes"},tail_messages:{icon:Gu,label:"Últimos mensajes"},run_shell:{icon:Ii,label:"Ejecutar shell"},send_telegram:{icon:Za,label:"Enviar Telegram"},call_agent:{icon:vn,label:"Llamar agente"},call_mcp:{icon:pR,label:"Llamar MCP"},call_runtime:{icon:vn,label:"Llamar runtime"},create_task:{icon:sR,label:"Crear tarea"}},f2=new Set(["write_file","edit_file"]);function aD(e){return nD[e]||{icon:cl,label:e}}function sD(e,n){if(!n)return"";const s=i=>typeof n[i]=="string"?n[i]:void 0,r=s("path")||s("file")||s("pattern")||s("query")||s("command")||s("slug")||s("name")||s("agent");return r?String(r):""}function W1(e){if(e==null)return"";if(typeof e=="string")return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}}function rD({status:e}){return e==="running"?o.jsx(Td,{className:"size-3 shrink-0 animate-spin text-sky-400"}):e==="error"?o.jsx(ec,{className:"size-3 shrink-0 text-rose-400"}):e==="deduped"?o.jsx(IN,{className:"size-3 shrink-0 text-amber-400"}):o.jsx(Bi,{className:"size-3 shrink-0 text-emerald-400"})}function oD({part:e}){const[n,s]=b.useState(!1),{icon:r,label:i}=aD(e.tool),c=sD(e.tool,e.args),d=f2.has(e.tool),f=!!e.args||e.result!==void 0;return o.jsxs("div",{className:Ae("rounded-lg border bg-muted/30 text-[12px]",e.status==="error"?"border-rose-500/30":"border-border"),children:[o.jsxs("button",{type:"button",onClick:()=>f&&s(p=>!p),className:"flex w-full items-center gap-2 px-2.5 py-1.5 text-left",children:[f?o.jsx(Nd,{className:Ae("size-3 shrink-0 text-muted-foreground transition-transform",n&&"rotate-90")}):o.jsx("span",{className:"size-3 shrink-0"}),o.jsx(r,{className:Ae("size-3.5 shrink-0",d?"text-violet-400":"text-muted-foreground")}),o.jsx("span",{className:"shrink-0 font-medium",children:i}),c&&o.jsx("span",{className:"truncate font-mono text-muted-foreground",children:c}),o.jsxs("span",{className:"ml-auto flex items-center gap-1",children:[e.status==="deduped"&&o.jsx("span",{className:"text-[10px] text-amber-400",children:"dedup"}),o.jsx(rD,{status:e.status})]})]}),n&&f&&o.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&&o.jsxs("div",{children:[o.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:"args"}),o.jsx("pre",{className:"max-h-48 overflow-auto rounded-md bg-background/60 p-2 font-mono text-[11px] leading-relaxed text-foreground",children:W1(e.args)})]}),e.result!==void 0&&o.jsxs("div",{children:[o.jsx("div",{className:"mb-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground/70",children:"result"}),o.jsx("pre",{className:Ae("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:W1(e.result)})]})]})]})}function lD(e){const n=e.args;return(n&&Array.isArray(n.questions)?n.questions:[]).map(r=>typeof r=="string"?r:r&&typeof r=="object"&&typeof r.question=="string"?r.question:null).filter(r=>!!r)}function iD({part:e,pending:n}){const s=lD(e),r=C(n?"ask_panel.status_waiting":"ask_panel.status_received");return o.jsxs("div",{className:Ae("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:[o.jsxs("div",{className:"flex items-center gap-2",children:[n?o.jsx(Td,{className:"size-3.5 shrink-0 animate-spin text-amber-600 dark:text-amber-400"}):o.jsx(hj,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),o.jsx(oR,{className:"size-3.5 shrink-0 text-muted-foreground"}),o.jsx("span",{className:"text-[12px] font-medium",children:r}),s.length>1&&o.jsxs("span",{className:"ml-auto text-[10px] text-muted-foreground",children:[s.length," preguntas"]})]}),s.length>0&&o.jsx("ul",{className:"mt-1.5 space-y-0.5 pl-5 text-[12px] text-muted-foreground",children:s.map((i,c)=>o.jsx("li",{className:"list-disc",children:i},c))})]})}function m2(e){return e.parts.filter(n=>n.kind==="text").map(n=>n.text).join(`
546
-
547
- `).trim()}function cD(e){const n=e.args?.questions;if(!Array.isArray(n)||n.length===0)return null;const s=n.map(r=>{if(typeof r=="string")return`- ${r}`;if(!r||typeof r!="object")return null;const i=r;if(typeof i.question!="string")return null;const d=(Array.isArray(i.options)?i.options:[]).map(f=>typeof f=="string"?f:f&&typeof f=="object"&&typeof f.label=="string"?f.label:"").filter(f=>f).join(", ");return d?`- ${i.question} (opciones: ${d})`:`- ${i.question}`}).filter(r=>!!r);return s.length===0?null:`[ask_questions]
548
- ${s.join(`
549
- `)}`}function uD(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 r=cD(s);r&&n.push(r)}return n.join(`
550
-
551
- `).trim()}const dD=e=>[{kind:"text",text:e}];function fD(e){if(!e||typeof e!="object")return!1;const n=e;return"error"in n&&!!n.error}function kx(e,n){const s=r=>({...e,notes:[...e.notes||[],r]});switch(n.type){case"model_start":return n.model?{...e,model:n.model}:e;case"model_routed":{const r=n.model?{...e,model:n.model}:e;return n.from_fallback?{...r,notes:[...r.notes||[],`routing fell back → ${n.model}`]}:r}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"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(r=>r.kind==="tool"&&r.id===n.trace.id?{...r,status:"deduped"}:r)}:e;case"tool_result":if(!n.trace)return e;{const r=fD(n.trace.result);return{...e,parts:e.parts.map(i=>i.kind==="tool"&&i.id===n.trace.id?{...i,result:n.trace.result,status:r?"error":i.status==="deduped"?"deduped":"done"}:i)}}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(r=>r.kind==="text")?[...e.parts,{kind:"text",text:n.result.text}]:e.parts};default:{const r=n.delta||n.content||"";if(!r)return e;const i=[...e.parts],c=i[i.length-1];return c&&c.kind==="text"?i[i.length-1]={...c,text:c.text+r}:i.push({kind:"text",text:r}),{...e,parts:i}}}}function mD(e,n){const[s,r]=b.useState([]),[i,c]=b.useState(!1),d=b.useRef(null),f=b.useRef(void 0),p=b.useCallback(S=>{r(w=>{const _=[...w],j=_[_.length-1];return j&&j.role==="assistant"&&(_[_.length-1]=S(j)),_})},[]),m=b.useCallback(S=>{if(S.type==="error"){n?.(S.error||"stream error");return}p(w=>kx(w,S))},[p,n]),h=b.useCallback(async(S,w={})=>{const _=S.trim();if(!_||i)return;const j=()=>new Date().toISOString(),k=s.map(R=>({role:R.role,content:uD(R)}));if(r(R=>[...R,{role:"user",parts:dD(_),ts:j()},{role:"assistant",parts:[],ts:j(),pending:!0}]),c(!0),w.agentSlug){try{const R=await Jt.chat(e,w.agentSlug,{prompt:_,conversation_id:f.current});f.current=R.conversation_id,p(N=>({...N,pending:!1,model:R.engine,parts:[{kind:"text",text:R.text}]}))}catch(R){n?.(R?.message||"fallo"),r(N=>N.filter((M,A)=>A!==N.length-1))}finally{c(!1)}return}const E=new AbortController;d.current=E;try{await uw.stream(e,{prompt:_,previousMessages:k,model:w.model||void 0,channel:"web"},m,E.signal),p(R=>({...R,pending:!1}))}catch(R){E.signal.aborted?p(N=>({...N,pending:!1,parts:[...N.parts,{kind:"text",text:"[detenido]"}]})):(n?.(R?.message||"stream falló"),r(N=>N.filter((M,A)=>A!==N.length-1)))}finally{c(!1),d.current=null}},[e,s,i,m,p,n]),x=b.useCallback(()=>d.current?.abort(),[]),y=b.useCallback(()=>{i||(f.current=void 0,r([]))},[i]);return{msgs:s,send:h,stop:x,clear:y,streaming:i}}function pD({msg:e,isLast:n,onCopy:s}){const r=e.role==="user",i=m2(e),c=e.parts.some(d=>d.kind==="tool");return o.jsxs("div",{className:Ae("group flex items-start gap-2",r?"justify-end":"justify-start"),children:[!r&&o.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:o.jsx(vn,{size:14})}),o.jsxs("div",{className:Ae("flex min-w-0 flex-col gap-1.5",r?"items-end":"w-full max-w-[85%]"),children:[!r&&e.notes&&e.notes.length>0&&o.jsx("div",{className:"flex flex-col gap-0.5",children:e.notes.map((d,f)=>o.jsxs("span",{className:"flex items-center gap-1 text-[10px] text-amber-400/80",children:[o.jsx(eR,{size:10})," ",d]},f))}),e.parts.map((d,f)=>d.kind==="tool"?d.tool==="ask_questions"&&!r?o.jsx(iD,{part:d,pending:!!n},`${d.id}-${f}`):o.jsx(oD,{part:d},`${d.id}-${f}`):d.text?o.jsx("div",{className:Ae("whitespace-pre-wrap rounded-2xl px-3 py-2 text-sm leading-relaxed shadow-sm",r?"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:d.text},f):null),!r&&e.pending&&e.parts.length===0&&o.jsx("div",{className:"rounded-2xl rounded-bl-sm border border-border bg-card px-3 py-2 text-sm text-muted-foreground",children:"…"}),o.jsxs("div",{className:"flex items-center gap-2 text-[10px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100",children:[o.jsx("span",{children:gD(e.ts)}),!r&&e.model&&o.jsxs("span",{className:"font-mono",children:["· ",e.model]}),!r&&c&&o.jsxs("span",{children:["· ",e.parts.filter(d=>d.kind==="tool").length," tools"]}),s&&i&&o.jsxs("button",{type:"button",onClick:()=>s(i),className:"inline-flex items-center gap-1 hover:text-foreground",title:"Copiar",children:[o.jsx(nd,{size:10})," copiar"]})]})]}),r&&o.jsx("span",{className:"mt-0.5 grid size-7 shrink-0 place-items-center rounded-full bg-muted text-muted-foreground",children:o.jsx(wj,{size:14})})]})}function gD(e){try{return new Date(e).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch{return e}}function Nx({msgs:e,onCopy:n}){const s=b.useRef(null);if(b.useEffect(()=>{s.current?.scrollIntoView({behavior:"smooth",block:"end"})},[e]),e.length===0)return o.jsx("div",{className:"grid h-full place-items-center p-6",children:o.jsx(ot,{children:C("project.chat.empty")})});const r=e.length-1;return o.jsxs("div",{className:"space-y-4 px-3 py-4",children:[e.map((i,c)=>o.jsx(pD,{msg:i,isLast:c===r,onCopy:n},c)),o.jsx("div",{ref:s})]})}function hD(e){if(!e)return;const n=e.path??e.file??e.filename;return typeof n=="string"?n:void 0}function p2({msgs:e}){const[n,s]=b.useState(!1),{inTok:r,outTok:i,toolCount:c,changed:d,model:f}=b.useMemo(()=>{let m=0,h=0,x=0,y;const S=new Set,w=[];for(const _ of e)if(_.role==="assistant"){_.usage&&(m+=_.usage.input_tokens||0,h+=_.usage.output_tokens||0),_.model&&(y=_.model);for(const j of _.parts)if(j.kind==="tool"&&(x+=1,f2.has(j.tool)&&j.status!=="error")){const k=hD(j.args);k&&!S.has(k)&&(S.add(k),w.push({path:k,tool:j.tool}))}}return{inTok:m,outTok:h,toolCount:x,changed:w,model:y}},[e]),p=r+i;return p===0&&c===0?null:o.jsxs("div",{className:"shrink-0 border-t border-border bg-card/40 text-[11px]",children:[o.jsxs("button",{type:"button",onClick:()=>d.length>0&&s(m=>!m),className:Ae("flex w-full items-center gap-3 px-4 py-1.5 text-muted-foreground",d.length>0&&"hover:text-foreground"),children:[o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(Rd,{size:12})," ",Jp(p)," tok",o.jsxs("span",{className:"text-muted-foreground/60",children:["(",Jp(r),"↑ / ",Jp(i),"↓)"]})]}),c>0&&o.jsxs("span",{className:"flex items-center gap-1",children:[o.jsx(cl,{size:12})," ",c," tools"]}),d.length>0&&o.jsxs("span",{className:"flex items-center gap-1 text-violet-400",children:[o.jsx(ad,{size:12})," ",d.length," archivos"]}),f&&o.jsx("span",{className:"ml-auto font-mono text-muted-foreground/70",children:f}),d.length>0&&o.jsx(Jr,{className:Ae("size-3 shrink-0 transition-transform",n&&"rotate-180")})]}),n&&d.length>0&&o.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(m=>o.jsxs("li",{className:"flex items-center gap-2 font-mono text-[11px]",children:[o.jsx(ad,{size:11,className:"shrink-0 text-violet-400"}),o.jsx("span",{className:"truncate",children:m.path}),o.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground/60",children:m.tool==="write_file"?"write":"edit"})]},m.path))})]})}function Jp(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function Vo(){return{picked:new Set,text:"",skipped:!1}}function e_(e,n){const s=[];return e.forEach((r,i)=>{const c=n[i]||Vo();if(c.skipped){s.push(`- ${r.question}
552
- → (omitido)`);return}const d=[];if(r.options&&r.options.length>0){const m=[...c.picked].sort((h,x)=>h-x).map(h=>r.options[h]?.label).filter(Boolean);m.length>0&&d.push(m.join(", "))}const f=c.text.trim();f&&d.push(r.options&&r.options.length>0?`(Otro: ${f})`:f);const p=d.length>0?d.join(" "):"(sin respuesta)";s.push(`- ${r.question}
553
- → ${p}`)}),s.join(`
554
- `)}function g2({turnKey:e,questions:n,onSubmit:s,onDismiss:r,disabled:i}){const c=n.length,[d,f]=b.useState(0),[p,m]=b.useState(()=>n.map(()=>Vo()));b.useEffect(()=>{f(0),m(n.map(()=>Vo()))},[e,n]);const h=n[d],x=p[d]||Vo(),y=!!h?.options&&h.options.length>0,S=!!h?.multiSelect,w=h?.allowText!==!1,_=A=>{m(O=>{const L=[...O],U=L[d]||Vo();return L[d]={...U,...A,skipped:!1},L})},j=A=>{m(O=>{const L=[...O],U=L[d]||Vo(),P=new Set(U.picked);return S?P.has(A)?P.delete(A):P.add(A):(P.clear(),P.add(A)),L[d]={...U,picked:P,skipped:!1},L})},k=b.useMemo(()=>!0,[]),E=d===c-1,R=()=>f(A=>Math.max(0,A-1)),N=()=>{if(E){s(e_(n,p));return}f(A=>Math.min(c-1,A+1))},M=()=>{if(m(A=>{const O=[...A];return O[d]={picked:new Set,text:"",skipped:!0},O}),E){const A=p.map((O,L)=>L===d?{picked:new Set,text:"",skipped:!0}:O);s(e_(n,A))}else f(A=>Math.min(c-1,A+1))};return b.useEffect(()=>{const A=O=>{if(i)return;const L=O.target?.tagName?.toLowerCase(),U=L==="input"||L==="textarea";if(O.key==="Enter"&&(O.metaKey||O.ctrlKey)){O.preventDefault(),N();return}if(!U&&y&&/^[1-9]$/.test(O.key)){const P=parseInt(O.key,10)-1;P<(h?.options?.length||0)&&(O.preventDefault(),j(P))}};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)}),!h||c===0?null:o.jsxs("div",{className:Ae("mx-3 mb-2 rounded-xl border border-border bg-card/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-card/80",i&&"pointer-events-none opacity-60"),"data-testid":"inline-ask-panel",children:[o.jsxs("header",{className:"flex items-start gap-2 border-b border-border px-3 py-2",children:[o.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&&o.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}),o.jsx("p",{className:"min-w-0 flex-1 text-sm font-semibold leading-snug",children:h.question}),r&&o.jsx("button",{type:"button",onClick:r,className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":C("common.close"),children:o.jsx(ec,{className:"size-3.5"})})]}),o.jsxs("div",{className:"space-y-1 px-2 py-2",children:[y&&h.options.map((A,O)=>{const L=x.picked.has(O);return o.jsxs("button",{type:"button",onClick:()=>j(O),className:Ae("flex w-full items-start gap-2 rounded-md border border-transparent px-2 py-1.5 text-left transition",L?"border-emerald-500/40 bg-emerald-500/10":"hover:border-border hover:bg-accent/40"),children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("div",{className:"text-xs font-medium",children:A.label}),A.description&&o.jsx("div",{className:"text-[11px] text-muted-foreground",children:A.description})]}),S?o.jsx("span",{className:Ae("mt-0.5 grid size-4 shrink-0 place-items-center rounded border",L?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-background"),children:L&&o.jsx("span",{className:"text-[10px] leading-none",children:"✓"})}):o.jsx("span",{className:Ae("mt-0.5 grid size-4 shrink-0 place-items-center rounded border font-mono text-[10px]",L?"border-emerald-500 bg-emerald-500 text-white":"border-border bg-muted text-muted-foreground"),children:O+1})]},`${O}:${A.label}`)}),(w||!y)&&o.jsxs("div",{className:"rounded-md border border-transparent px-2 py-1.5 hover:border-border",children:[y&&o.jsx("div",{className:"mb-1 text-xs font-medium",children:C("ask_panel.other")}),o.jsx("input",{type:"text",value:x.text,onChange:A=>_({text:A.target.value}),placeholder:C(y?"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"})]})]}),o.jsxs("footer",{className:"flex items-center justify-between gap-2 border-t border-border px-3 py-2",children:[o.jsx("button",{type:"button",onClick:R,disabled:d===0,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent disabled:opacity-30",children:C("ask_panel.back")}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx("button",{type:"button",onClick:M,className:"rounded px-2 py-1 text-[11px] text-muted-foreground hover:bg-accent",children:C("ask_panel.skip")}),o.jsxs("button",{type:"button",onClick:N,disabled:!k,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:[C(E?"ask_panel.submit":"ask_panel.next"),o.jsx(BN,{className:"size-3 opacity-60"})]})]})]})]})}function xD(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 i=(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:i,multiSelect:n.multiSelect===!0,allowText:n.allowText!==!1}}function h2(e){if(!e.length)return null;const n=e[e.length-1];if(n.role!=="assistant")return null;let s=null,r=-1;for(let m=n.parts.length-1;m>=0;m--){const h=n.parts[m];if(h.kind==="tool"&&h.tool==="ask_questions"){s=h,r=m;break}}if(!s||r<0)return null;let i=null;if(typeof s.result=="string")try{i=JSON.parse(s.result)}catch{i=null}else s.result&&typeof s.result=="object"&&(i=s.result);const c=[];Array.isArray(s.args?.questions)&&c.push(s.args.questions),i&&Array.isArray(i.questions)&&c.push(i.questions);let d=[];for(const m of c)if(d=m.map(xD).filter(h=>!!h),d.length>0)break;return d.length?{turnKey:`${n.ts||""}#${r}`,questions:d}:null}const xi="__super_agent__";function bD({pid:e}){const n=nt(),[s]=cj(),r=Xe(`/projects/${e}/agents`,()=>Jt.list(e)),[i,c]=b.useState(s.get("agent")||""),[d,f]=b.useState(!1),[p,m]=b.useState(""),[h,x]=b.useState(null),{msgs:y,send:S,stop:w,clear:_,streaming:j}=mD(e,D=>n.error(D)),k=ix(),E=r.data||[],R=D=>D===xi,N=b.useMemo(()=>[{value:xi,label:`${k} (super-agent)`},...E.map(D=>({value:D.slug,label:D.slug}))],[E,k]),M=b.useMemo(()=>E.find(D=>D.slug===i)||E[0],[E,i]),A=R(i)?xi:M?.slug||xi,O=A===xi;b.useEffect(()=>{!i&&M?.slug&&c(M.slug)},[M?.slug,i]);const L=()=>_(),U=async D=>{!O&&!M||await S(D,{model:O?p:void 0,agentSlug:O?void 0:M.slug})},P=async D=>{try{await navigator.clipboard.writeText(D),n.info(C("project.chat.copied"))}catch{}};if(r.isLoading)return o.jsx(Je,{});const B=O?C("project.chat.superagent_subtitle",{persona:k}):C("project.chat.subtitle");return o.jsxs("div",{className:"flex h-[calc(100vh-11rem)] flex-col overflow-hidden rounded-xl border border-border bg-card/40",children:[o.jsxs("header",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("h2",{className:"text-sm font-semibold",children:O?C("project.chat.superagent_title",{persona:k}):C("project.chat.title")}),o.jsx("p",{className:"truncate text-[11px] text-muted-fg",children:B})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-52",children:o.jsx(Ct,{value:A,onChange:D=>{c(D),L()},options:N})}),O?o.jsx(Ue,{tone:"success",children:"super-agent"}):M?.model&&o.jsx(Ue,{tone:"info",children:M.model}),!E.length&&!O&&o.jsxs(he,{variant:"primary",size:"sm",onClick:()=>f(!0),children:[o.jsx(Nn,{size:14})," ",C("project.chat.create_agent")]}),o.jsxs(he,{variant:"ghost",size:"sm",disabled:j||y.length===0,onClick:L,children:[o.jsx(Ja,{size:13})," ",C("project.chat.clear")]})]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:y.length?o.jsx(Nx,{msgs:y,onCopy:P}):o.jsx(ot,{children:C("project.chat.empty")})}),o.jsx(p2,{msgs:y}),(()=>{const D=j?null:h2(y);return!D||D.turnKey===h?null:o.jsx(g2,{turnKey:D.turnKey,questions:D.questions,onSubmit:H=>void U(H),onDismiss:()=>x(D.turnKey),disabled:j})})(),o.jsx(tD,{onSend:U,onStop:w,streaming:j,model:O?p:void 0,onModelChange:O?m:void 0}),o.jsx(vD,{open:d,pid:e,onClose:()=>f(!1),onCreated:()=>{f(!1),r.mutate()}})]})}function vD({open:e,onClose:n,onCreated:s,pid:r}){const i=nt(),[c,d]=b.useState(""),[f,p]=b.useState("master"),[m,h]=b.useState(""),[x,y]=b.useState(!0),[S,w]=b.useState(!1),_=async()=>{if(!/^[a-z][a-z0-9_-]*$/.test(c)){i.error(C("project.agents.slug_invalid"));return}w(!0);try{await Jt.create(r,{slug:c,role:f,model:m||void 0,is_master:x}),i.success(C("project.agents.created",{slug:c})),d(""),p("master"),h(""),y(!0),s()}catch(j){i.error(j.message)}finally{w(!1)}};return o.jsx(ma,{open:e,onClose:n,title:C("project.chat.create_agent_title"),description:C("project.chat.create_agent_desc"),footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:n,disabled:S,children:C("common.cancel")}),o.jsx(he,{variant:"primary",onClick:_,loading:S,children:C("common.create")})]}),children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(fe,{label:"slug",children:o.jsx(Ce,{autoFocus:!0,value:c,onChange:j=>d(j.target.value),placeholder:"master"})}),o.jsx(fe,{label:C("project.chat.role_label"),children:o.jsx(Ce,{value:f,onChange:j=>p(j.target.value),placeholder:"master"})}),o.jsx(fe,{label:C("project.chat.model_label"),hint:C("project.chat.model_hint"),children:o.jsx(Ce,{value:m,onChange:j=>h(j.target.value)})}),o.jsx(sn,{checked:x,onChange:y,label:C("project.chat.master_label")})]})})}function yD({pid:e}){const n=nt(),{project:s}=fw(e),{channels:r,isLoading:i,mutate:c}=gx(),d=String(e),f=s?.name||s?.path?.split("/").pop()||d,p=`proj-${d}`,m=r.find(O=>O.project===d||O.project===f||O.name===p),[h,x]=b.useState(!!m),[y,S]=b.useState(""),[w,_]=b.useState(""),[j,k]=b.useState(""),[E,R]=b.useState(!0),[N,M]=b.useState(!1);if(b.useEffect(()=>{m?(x(!0),S(""),_(m.chat_id||""),k(m.route_to_agent||""),R(m.respond_with_engine??!0)):(x(!1),S(""),_(""),k(""),R(!0))},[m?.name,m?.chat_id,m?.route_to_agent]),i)return o.jsx(Je,{});const A=async()=>{M(!0);try{if(!h){m&&(await kn.channels.remove(m.name),n.success(C("project.telegram.cleared"))),await c();return}const O={name:m?.name||p,project:d,chat_id:w,route_to_agent:j,respond_with_engine:E,...y?{bot_token:y}:{}};m?await kn.channels.patch(m.name,O):await kn.channels.upsert(O),n.success(C("project.telegram.saved")),await c(),S("")}catch(O){n.error(O.message)}finally{M(!1)}};return o.jsx(He,{title:C("project.telegram.title"),description:C("project.telegram.subtitle"),children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(sn,{checked:h,onChange:x,label:C(h?"project.telegram.override_active":"project.telegram.use_default")}),m&&o.jsx(Ue,{tone:"success",children:C("project.telegram.channel_badge",{name:m.name})})]}),h&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("project.telegram.bot_token"),hint:m?.bot_token?`${fr(m.bot_token)} — vacío = mantener`:C("project.telegram.bot_hint_none"),children:o.jsx(Ce,{type:"password",value:y,onChange:O=>S(O.target.value),placeholder:m?.bot_token?fr(m.bot_token):""})}),o.jsx(fe,{label:C("project.telegram.chat_id"),children:o.jsx(Ce,{value:w,onChange:O=>_(O.target.value)})}),o.jsx(fe,{label:C("project.telegram.route_agent"),hint:C("project.telegram.route_hint"),children:o.jsx(Ce,{value:j,onChange:O=>k(O.target.value)})})]}),o.jsx(sn,{checked:E,onChange:R,label:C("project.telegram.respond_engine")})]}),o.jsx("div",{className:"pt-2",children:o.jsx(he,{variant:"primary",loading:N,onClick:A,children:C("common.save")})}),!h&&!m&&o.jsx(ot,{children:C("project.telegram.no_override")})]})})}function x2({load:e,save:n,rows:s=10,placeholder:r}){const i=nt(),[c,d]=b.useState(null),[f,p]=b.useState(""),[m,h]=b.useState(!1);if(b.useEffect(()=>{let S=!0;return e().then(w=>{S&&(d(w),p(w))}).catch(()=>{S&&(d(""),p(""))}),()=>{S=!1}},[e]),c===null)return o.jsx(Je,{});const x=f!==c,y=async()=>{h(!0);try{await n(f),d(f),i.success(C("project.memories.saved"))}catch(S){i.error(S.message)}finally{h(!1)}};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(Qt,{rows:s,className:"font-mono text-xs",value:f,onChange:S=>p(S.target.value),placeholder:r}),o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-[11px] text-muted-fg",children:[f.length," ",C("project.memories.chars")]}),o.jsxs(he,{size:"sm",variant:"primary",loading:m,disabled:!x,onClick:y,children:[o.jsx(vh,{size:12})," ",C("project.memories.save_btn")]})]})]})}function _D({pid:e,agent:n}){const[s,r]=b.useState(!1),i=n.is_master?Ns:vn;return o.jsxs("li",{className:"rounded-xl border border-border bg-muted/30",children:[o.jsxs("button",{type:"button",onClick:()=>r(c=>!c),className:"flex w-full items-center gap-3 px-3 py-2 text-left",children:[s?o.jsx(Jr,{size:14,className:"text-muted-fg"}):o.jsx(Nd,{size:14,className:"text-muted-fg"}),o.jsx(i,{size:14,className:n.is_master?"text-violet-400":"text-muted-fg"}),o.jsx("span",{className:"text-sm font-medium",children:n.slug}),n.role&&o.jsxs("span",{className:"text-xs text-muted-fg",children:["· ",n.role]})]}),s&&o.jsx("div",{className:"border-t border-border p-3",children:o.jsx(x2,{rows:8,load:()=>Jt.memory.get(e,n.slug).then(c=>c.body),save:c=>Jt.memory.put(e,n.slug,c).then(()=>{})})})]})}function jD({pid:e}){const n=Xe(`/projects/${e}/agents`,()=>Jt.list(e));return o.jsxs("div",{className:"space-y-6",children:[o.jsx(He,{title:C("project.memories.project_title"),description:C("project.memories.project_desc"),children:o.jsxs("div",{className:"flex items-start gap-3",children:[o.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:o.jsx(td,{className:"size-4 text-white"})}),o.jsx("div",{className:"min-w-0 flex-1",children:o.jsx(x2,{rows:12,load:()=>Qn.memory.get(e).then(s=>s.body),save:s=>Qn.memory.put(e,s).then(()=>{}),placeholder:C("project.memories.project_ph")})})]})}),o.jsxs(He,{title:C("project.memories.agents_title"),description:C("project.memories.agents_desc"),children:[n.isLoading&&o.jsx(Je,{}),!n.isLoading&&(n.data?.length??0)===0&&o.jsx(ot,{children:C("project.memories.no_agents")}),o.jsx("ul",{className:"space-y-2",children:(n.data||[]).map(s=>o.jsx(_D,{pid:e,agent:s},s.slug))})]})]})}function SD(e,n){var s,r=1;e==null&&(e=0),n==null&&(n=0);function i(){var c,d=s.length,f,p=0,m=0;for(c=0;c<d;++c)f=s[c],p+=f.x,m+=f.y;for(p=(p/d-e)*r,m=(m/d-n)*r,c=0;c<d;++c)f=s[c],f.x-=p,f.y-=m}return i.initialize=function(c){s=c},i.x=function(c){return arguments.length?(e=+c,i):e},i.y=function(c){return arguments.length?(n=+c,i):n},i.strength=function(c){return arguments.length?(r=+c,i):r},i}function wD(e){const n=+this._x.call(null,e),s=+this._y.call(null,e);return b2(this.cover(n,s),n,s,e)}function b2(e,n,s,r){if(isNaN(n)||isNaN(s))return e;var i,c=e._root,d={data:r},f=e._x0,p=e._y0,m=e._x1,h=e._y1,x,y,S,w,_,j,k,E;if(!c)return e._root=d,e;for(;c.length;)if((_=n>=(x=(f+m)/2))?f=x:m=x,(j=s>=(y=(p+h)/2))?p=y:h=y,i=c,!(c=c[k=j<<1|_]))return i[k]=d,e;if(S=+e._x.call(null,c.data),w=+e._y.call(null,c.data),n===S&&s===w)return d.next=c,i?i[k]=d:e._root=d,e;do i=i?i[k]=new Array(4):e._root=new Array(4),(_=n>=(x=(f+m)/2))?f=x:m=x,(j=s>=(y=(p+h)/2))?p=y:h=y;while((k=j<<1|_)===(E=(w>=y)<<1|S>=x));return i[E]=c,i[k]=d,e}function CD(e){var n,s,r=e.length,i,c,d=new Array(r),f=new Array(r),p=1/0,m=1/0,h=-1/0,x=-1/0;for(s=0;s<r;++s)isNaN(i=+this._x.call(null,n=e[s]))||isNaN(c=+this._y.call(null,n))||(d[s]=i,f[s]=c,i<p&&(p=i),i>h&&(h=i),c<m&&(m=c),c>x&&(x=c));if(p>h||m>x)return this;for(this.cover(p,m).cover(h,x),s=0;s<r;++s)b2(this,d[s],f[s],e[s]);return this}function ED(e,n){if(isNaN(e=+e)||isNaN(n=+n))return this;var s=this._x0,r=this._y0,i=this._x1,c=this._y1;if(isNaN(s))i=(s=Math.floor(e))+1,c=(r=Math.floor(n))+1;else{for(var d=i-s||1,f=this._root,p,m;s>e||e>=i||r>n||n>=c;)switch(m=(n<r)<<1|e<s,p=new Array(4),p[m]=f,f=p,d*=2,m){case 0:i=s+d,c=r+d;break;case 1:s=i-d,c=r+d;break;case 2:i=s+d,r=c-d;break;case 3:s=i-d,r=c-d;break}this._root&&this._root.length&&(this._root=f)}return this._x0=s,this._y0=r,this._x1=i,this._y1=c,this}function kD(){var e=[];return this.visit(function(n){if(!n.length)do e.push(n.data);while(n=n.next)}),e}function ND(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 Un(e,n,s,r,i){this.node=e,this.x0=n,this.y0=s,this.x1=r,this.y1=i}function RD(e,n,s){var r,i=this._x0,c=this._y0,d,f,p,m,h=this._x1,x=this._y1,y=[],S=this._root,w,_;for(S&&y.push(new Un(S,i,c,h,x)),s==null?s=1/0:(i=e-s,c=n-s,h=e+s,x=n+s,s*=s);w=y.pop();)if(!(!(S=w.node)||(d=w.x0)>h||(f=w.y0)>x||(p=w.x1)<i||(m=w.y1)<c))if(S.length){var j=(d+p)/2,k=(f+m)/2;y.push(new Un(S[3],j,k,p,m),new Un(S[2],d,k,j,m),new Un(S[1],j,f,p,k),new Un(S[0],d,f,j,k)),(_=(n>=k)<<1|e>=j)&&(w=y[y.length-1],y[y.length-1]=y[y.length-1-_],y[y.length-1-_]=w)}else{var E=e-+this._x.call(null,S.data),R=n-+this._y.call(null,S.data),N=E*E+R*R;if(N<s){var M=Math.sqrt(s=N);i=e-M,c=n-M,h=e+M,x=n+M,r=S.data}}return r}function TD(e){if(isNaN(h=+this._x.call(null,e))||isNaN(x=+this._y.call(null,e)))return this;var n,s=this._root,r,i,c,d=this._x0,f=this._y0,p=this._x1,m=this._y1,h,x,y,S,w,_,j,k;if(!s)return this;if(s.length)for(;;){if((w=h>=(y=(d+p)/2))?d=y:p=y,(_=x>=(S=(f+m)/2))?f=S:m=S,n=s,!(s=s[j=_<<1|w]))return this;if(!s.length)break;(n[j+1&3]||n[j+2&3]||n[j+3&3])&&(r=n,k=j)}for(;s.data!==e;)if(i=s,!(s=s.next))return this;return(c=s.next)&&delete s.next,i?(c?i.next=c:delete i.next,this):n?(c?n[j]=c:delete n[j],(s=n[0]||n[1]||n[2]||n[3])&&s===(n[3]||n[2]||n[1]||n[0])&&!s.length&&(r?r[k]=s:this._root=s),this):(this._root=c,this)}function AD(e){for(var n=0,s=e.length;n<s;++n)this.remove(e[n]);return this}function MD(){return this._root}function OD(){var e=0;return this.visit(function(n){if(!n.length)do++e;while(n=n.next)}),e}function zD(e){var n=[],s,r=this._root,i,c,d,f,p;for(r&&n.push(new Un(r,this._x0,this._y0,this._x1,this._y1));s=n.pop();)if(!e(r=s.node,c=s.x0,d=s.y0,f=s.x1,p=s.y1)&&r.length){var m=(c+f)/2,h=(d+p)/2;(i=r[3])&&n.push(new Un(i,m,h,f,p)),(i=r[2])&&n.push(new Un(i,c,h,m,p)),(i=r[1])&&n.push(new Un(i,m,d,f,h)),(i=r[0])&&n.push(new Un(i,c,d,m,h))}return this}function DD(e){var n=[],s=[],r;for(this._root&&n.push(new Un(this._root,this._x0,this._y0,this._x1,this._y1));r=n.pop();){var i=r.node;if(i.length){var c,d=r.x0,f=r.y0,p=r.x1,m=r.y1,h=(d+p)/2,x=(f+m)/2;(c=i[0])&&n.push(new Un(c,d,f,h,x)),(c=i[1])&&n.push(new Un(c,h,f,p,x)),(c=i[2])&&n.push(new Un(c,d,x,h,m)),(c=i[3])&&n.push(new Un(c,h,x,p,m))}s.push(r)}for(;r=s.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function LD(e){return e[0]}function PD(e){return arguments.length?(this._x=e,this):this._x}function BD(e){return e[1]}function ID(e){return arguments.length?(this._y=e,this):this._y}function Rx(e,n,s){var r=new Tx(n??LD,s??BD,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function Tx(e,n,s,r,i,c){this._x=e,this._y=n,this._x0=s,this._y0=r,this._x1=i,this._y1=c,this._root=void 0}function t_(e){for(var n={data:e.data},s=n;e=e.next;)s=s.next={data:e.data};return n}var Hn=Rx.prototype=Tx.prototype;Hn.copy=function(){var e=new Tx(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root,s,r;if(!n)return e;if(!n.length)return e._root=t_(n),e;for(s=[{source:n,target:e._root=new Array(4)}];n=s.pop();)for(var i=0;i<4;++i)(r=n.source[i])&&(r.length?s.push({source:r,target:n.target[i]=new Array(4)}):n.target[i]=t_(r));return e};Hn.add=wD;Hn.addAll=CD;Hn.cover=ED;Hn.data=kD;Hn.extent=ND;Hn.find=RD;Hn.remove=TD;Hn.removeAll=AD;Hn.root=MD;Hn.size=OD;Hn.visit=zD;Hn.visitAfter=DD;Hn.x=PD;Hn.y=ID;function Yr(e){return function(){return e}}function cr(e){return(e()-.5)*1e-6}function UD(e){return e.x+e.vx}function HD(e){return e.y+e.vy}function qD(e){var n,s,r,i=1,c=1;typeof e!="function"&&(e=Yr(e==null?1:+e));function d(){for(var m,h=n.length,x,y,S,w,_,j,k=0;k<c;++k)for(x=Rx(n,UD,HD).visitAfter(f),m=0;m<h;++m)y=n[m],_=s[y.index],j=_*_,S=y.x+y.vx,w=y.y+y.vy,x.visit(E);function E(R,N,M,A,O){var L=R.data,U=R.r,P=_+U;if(L){if(L.index>y.index){var B=S-L.x-L.vx,D=w-L.y-L.vy,H=B*B+D*D;H<P*P&&(B===0&&(B=cr(r),H+=B*B),D===0&&(D=cr(r),H+=D*D),H=(P-(H=Math.sqrt(H)))/H*i,y.vx+=(B*=H)*(P=(U*=U)/(j+U)),y.vy+=(D*=H)*P,L.vx-=B*(P=1-P),L.vy-=D*P)}return}return N>S+P||A<S-P||M>w+P||O<w-P}}function f(m){if(m.data)return m.r=s[m.data.index];for(var h=m.r=0;h<4;++h)m[h]&&m[h].r>m.r&&(m.r=m[h].r)}function p(){if(n){var m,h=n.length,x;for(s=new Array(h),m=0;m<h;++m)x=n[m],s[x.index]=+e(x,m,n)}}return d.initialize=function(m,h){n=m,r=h,p()},d.iterations=function(m){return arguments.length?(c=+m,d):c},d.strength=function(m){return arguments.length?(i=+m,d):i},d.radius=function(m){return arguments.length?(e=typeof m=="function"?m:Yr(+m),p(),d):e},d}function VD(e){return e.index}function n_(e,n){var s=e.get(n);if(!s)throw new Error("node not found: "+n);return s}function $D(e){var n=VD,s=x,r,i=Yr(30),c,d,f,p,m,h=1;e==null&&(e=[]);function x(j){return 1/Math.min(f[j.source.index],f[j.target.index])}function y(j){for(var k=0,E=e.length;k<h;++k)for(var R=0,N,M,A,O,L,U,P;R<E;++R)N=e[R],M=N.source,A=N.target,O=A.x+A.vx-M.x-M.vx||cr(m),L=A.y+A.vy-M.y-M.vy||cr(m),U=Math.sqrt(O*O+L*L),U=(U-c[R])/U*j*r[R],O*=U,L*=U,A.vx-=O*(P=p[R]),A.vy-=L*P,M.vx+=O*(P=1-P),M.vy+=L*P}function S(){if(d){var j,k=d.length,E=e.length,R=new Map(d.map((M,A)=>[n(M,A,d),M])),N;for(j=0,f=new Array(k);j<E;++j)N=e[j],N.index=j,typeof N.source!="object"&&(N.source=n_(R,N.source)),typeof N.target!="object"&&(N.target=n_(R,N.target)),f[N.source.index]=(f[N.source.index]||0)+1,f[N.target.index]=(f[N.target.index]||0)+1;for(j=0,p=new Array(E);j<E;++j)N=e[j],p[j]=f[N.source.index]/(f[N.source.index]+f[N.target.index]);r=new Array(E),w(),c=new Array(E),_()}}function w(){if(d)for(var j=0,k=e.length;j<k;++j)r[j]=+s(e[j],j,e)}function _(){if(d)for(var j=0,k=e.length;j<k;++j)c[j]=+i(e[j],j,e)}return y.initialize=function(j,k){d=j,m=k,S()},y.links=function(j){return arguments.length?(e=j,S(),y):e},y.id=function(j){return arguments.length?(n=j,y):n},y.iterations=function(j){return arguments.length?(h=+j,y):h},y.strength=function(j){return arguments.length?(s=typeof j=="function"?j:Yr(+j),w(),y):s},y.distance=function(j){return arguments.length?(i=typeof j=="function"?j:Yr(+j),_(),y):i},y}var GD={value:()=>{}};function v2(){for(var e=0,n=arguments.length,s={},r;e<n;++e){if(!(r=arguments[e]+"")||r in s||/[\s.]/.test(r))throw new Error("illegal type: "+r);s[r]=[]}return new Ju(s)}function Ju(e){this._=e}function YD(e,n){return e.trim().split(/^|\s+/).map(function(s){var r="",i=s.indexOf(".");if(i>=0&&(r=s.slice(i+1),s=s.slice(0,i)),s&&!n.hasOwnProperty(s))throw new Error("unknown type: "+s);return{type:s,name:r}})}Ju.prototype=v2.prototype={constructor:Ju,on:function(e,n){var s=this._,r=YD(e+"",s),i,c=-1,d=r.length;if(arguments.length<2){for(;++c<d;)if((i=(e=r[c]).type)&&(i=FD(s[i],e.name)))return i;return}if(n!=null&&typeof n!="function")throw new Error("invalid callback: "+n);for(;++c<d;)if(i=(e=r[c]).type)s[i]=a_(s[i],e.name,n);else if(n==null)for(i in s)s[i]=a_(s[i],e.name,null);return this},copy:function(){var e={},n=this._;for(var s in n)e[s]=n[s].slice();return new Ju(e)},call:function(e,n){if((i=arguments.length-2)>0)for(var s=new Array(i),r=0,i,c;r<i;++r)s[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(c=this._[e],r=0,i=c.length;r<i;++r)c[r].value.apply(n,s)},apply:function(e,n,s){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,c=r.length;i<c;++i)r[i].value.apply(n,s)}};function FD(e,n){for(var s=0,r=e.length,i;s<r;++s)if((i=e[s]).name===n)return i.value}function a_(e,n,s){for(var r=0,i=e.length;r<i;++r)if(e[r].name===n){e[r]=GD,e=e.slice(0,r).concat(e.slice(r+1));break}return s!=null&&e.push({name:n,value:s}),e}var rl=0,ki=0,bi=0,y2=1e3,wd,Ni,Cd=0,Qr=0,tf=0,Xi=typeof performance=="object"&&performance.now?performance:Date,_2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function j2(){return Qr||(_2(XD),Qr=Xi.now()+tf)}function XD(){Qr=0}function nh(){this._call=this._time=this._next=null}nh.prototype=S2.prototype={constructor:nh,restart:function(e,n,s){if(typeof e!="function")throw new TypeError("callback is not a function");s=(s==null?j2():+s)+(n==null?0:+n),!this._next&&Ni!==this&&(Ni?Ni._next=this:wd=this,Ni=this),this._call=e,this._time=s,ah()},stop:function(){this._call&&(this._call=null,this._time=1/0,ah())}};function S2(e,n,s){var r=new nh;return r.restart(e,n,s),r}function KD(){j2(),++rl;for(var e=wd,n;e;)(n=Qr-e._time)>=0&&e._call.call(void 0,n),e=e._next;--rl}function s_(){Qr=(Cd=Xi.now())+tf,rl=ki=0;try{KD()}finally{rl=0,ZD(),Qr=0}}function QD(){var e=Xi.now(),n=e-Cd;n>y2&&(tf-=n,Cd=e)}function ZD(){for(var e,n=wd,s,r=1/0;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(s=n._next,n._next=null,n=e?e._next=s:wd=s);Ni=e,ah(r)}function ah(e){if(!rl){ki&&(ki=clearTimeout(ki));var n=e-Qr;n>24?(e<1/0&&(ki=setTimeout(s_,e-Xi.now()-tf)),bi&&(bi=clearInterval(bi))):(bi||(Cd=Xi.now(),bi=setInterval(QD,y2)),rl=1,_2(s_))}}const JD=1664525,WD=1013904223,r_=4294967296;function e6(){let e=1;return()=>(e=(JD*e+WD)%r_)/r_}function t6(e){return e.x}function n6(e){return e.y}var a6=10,s6=Math.PI*(3-Math.sqrt(5));function r6(e){var n,s=1,r=.001,i=1-Math.pow(r,1/300),c=0,d=.6,f=new Map,p=S2(x),m=v2("tick","end"),h=e6();e==null&&(e=[]);function x(){y(),m.call("tick",n),s<r&&(p.stop(),m.call("end",n))}function y(_){var j,k=e.length,E;_===void 0&&(_=1);for(var R=0;R<_;++R)for(s+=(c-s)*i,f.forEach(function(N){N(s)}),j=0;j<k;++j)E=e[j],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 S(){for(var _=0,j=e.length,k;_<j;++_){if(k=e[_],k.index=_,k.fx!=null&&(k.x=k.fx),k.fy!=null&&(k.y=k.fy),isNaN(k.x)||isNaN(k.y)){var E=a6*Math.sqrt(.5+_),R=_*s6;k.x=E*Math.cos(R),k.y=E*Math.sin(R)}(isNaN(k.vx)||isNaN(k.vy))&&(k.vx=k.vy=0)}}function w(_){return _.initialize&&_.initialize(e,h),_}return S(),n={tick:y,restart:function(){return p.restart(x),n},stop:function(){return p.stop(),n},nodes:function(_){return arguments.length?(e=_,S(),f.forEach(w),n):e},alpha:function(_){return arguments.length?(s=+_,n):s},alphaMin:function(_){return arguments.length?(r=+_,n):r},alphaDecay:function(_){return arguments.length?(i=+_,n):+i},alphaTarget:function(_){return arguments.length?(c=+_,n):c},velocityDecay:function(_){return arguments.length?(d=1-_,n):1-d},randomSource:function(_){return arguments.length?(h=_,f.forEach(w),n):h},force:function(_,j){return arguments.length>1?(j==null?f.delete(_):f.set(_,w(j)),n):f.get(_)},find:function(_,j,k){var E=0,R=e.length,N,M,A,O,L;for(k==null?k=1/0:k*=k,E=0;E<R;++E)O=e[E],N=_-O.x,M=j-O.y,A=N*N+M*M,A<k&&(L=O,k=A);return L},on:function(_,j){return arguments.length>1?(m.on(_,j),n):m.on(_)}}}function o6(){var e,n,s,r,i=Yr(-30),c,d=1,f=1/0,p=.81;function m(S){var w,_=e.length,j=Rx(e,t6,n6).visitAfter(x);for(r=S,w=0;w<_;++w)n=e[w],j.visit(y)}function h(){if(e){var S,w=e.length,_;for(c=new Array(w),S=0;S<w;++S)_=e[S],c[_.index]=+i(_,S,e)}}function x(S){var w=0,_,j,k=0,E,R,N;if(S.length){for(E=R=N=0;N<4;++N)(_=S[N])&&(j=Math.abs(_.value))&&(w+=_.value,k+=j,E+=j*_.x,R+=j*_.y);S.x=E/k,S.y=R/k}else{_=S,_.x=_.data.x,_.y=_.data.y;do w+=c[_.data.index];while(_=_.next)}S.value=w}function y(S,w,_,j){if(!S.value)return!0;var k=S.x-n.x,E=S.y-n.y,R=j-w,N=k*k+E*E;if(R*R/p<N)return N<f&&(k===0&&(k=cr(s),N+=k*k),E===0&&(E=cr(s),N+=E*E),N<d&&(N=Math.sqrt(d*N)),n.vx+=k*S.value*r/N,n.vy+=E*S.value*r/N),!0;if(S.length||N>=f)return;(S.data!==n||S.next)&&(k===0&&(k=cr(s),N+=k*k),E===0&&(E=cr(s),N+=E*E),N<d&&(N=Math.sqrt(d*N)));do S.data!==n&&(R=c[S.data.index]*r/N,n.vx+=k*R,n.vy+=E*R);while(S=S.next)}return m.initialize=function(S,w){e=S,s=w,h()},m.strength=function(S){return arguments.length?(i=typeof S=="function"?S:Yr(+S),h(),m):i},m.distanceMin=function(S){return arguments.length?(d=S*S,m):Math.sqrt(d)},m.distanceMax=function(S){return arguments.length?(f=S*S,m):Math.sqrt(f)},m.theta=function(S){return arguments.length?(p=S*S,m):Math.sqrt(p)},m}const vi={agent:"#a78bfa",memory:"#38bdf8",thread:"#34d399",task:"#fbbf24",routine:"#f472b6",agentlink:"#c084fc"},o_={agent:"agente",memory:"memoria",thread:"thread",task:"task",routine:"rutina",agentlink:"jerarquía"},yi=760,_i=460;function l6({center:e,nodes:n}){const s=b.useRef(null),r=b.useRef(null),i=b.useRef([]),c=b.useRef([]),d=b.useRef(null),[,f]=b.useState(0),[p,m]=b.useState(null);b.useEffect(()=>{const j={id:"__center",label:e,kind:"agent",relation:"self",x:yi/2,y:_i/2,fx:yi/2,fy:_i/2},k=[j,...n.map(N=>({...N}))],E=k.slice(1).map(N=>({source:j,target:N}));i.current=k,c.current=E;const R=r6(k).force("link",$D(E).distance(120).strength(.5)).force("charge",o6().strength(-220)).force("center",SD(yi/2,_i/2).strength(.05)).force("collide",qD(26)).on("tick",()=>f(N=>N+1));return r.current=R,()=>{R.stop()}},[e,n]);const h=j=>{const k=s.current.getBoundingClientRect();return{x:(j.clientX-k.left)/k.width*yi,y:(j.clientY-k.top)/k.height*_i}},x=j=>k=>{j.id!=="__center"&&(d.current=j,k.target.setPointerCapture?.(k.pointerId),r.current?.alphaTarget(.3).restart())},y=j=>{const k=d.current;if(!k)return;const{x:E,y:R}=h(j);k.fx=E,k.fy=R},S=()=>{const j=d.current;j&&(j.fx=null,j.fy=null),d.current=null,r.current?.alphaTarget(0)},w=i.current,_=c.current;return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-muted/10",children:o.jsxs("svg",{ref:s,viewBox:`0 0 ${yi} ${_i}`,className:"h-[460px] w-full touch-none select-none",onPointerMove:y,onPointerUp:S,onPointerLeave:S,children:[_.map((j,k)=>o.jsx("line",{x1:j.source.x,y1:j.source.y,x2:j.target.x,y2:j.target.y,stroke:vi[j.target.kind],strokeOpacity:.22,strokeWidth:1.5},k)),w.map(j=>{if(j.id==="__center")return o.jsxs("g",{transform:`translate(${j.x},${j.y})`,children:[o.jsx("circle",{r:22,fill:vi.agent}),o.jsx("text",{textAnchor:"middle",y:4,fontSize:11,fontWeight:700,fill:"#1a1a1a",children:e.length>8?e.slice(0,8):e})]},j.id);const k=p?.id===j.id;return o.jsxs("g",{transform:`translate(${j.x},${j.y})`,className:"cursor-grab active:cursor-grabbing",onPointerDown:x(j),onClick:()=>m(j),children:[o.jsx("circle",{r:k?9:6,fill:vi[j.kind],fillOpacity:k?1:.9,stroke:k?"#fff":"none",strokeWidth:k?2:0}),o.jsx("text",{x:10,y:4,fontSize:10,className:"fill-foreground/80",children:j.label.length>22?`${j.label.slice(0,22)}…`:j.label})]},j.id)})]})}),o.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-[11px] text-muted-fg",children:[Object.keys(o_).filter(j=>j!=="agent").map(j=>o.jsxs("span",{className:"inline-flex items-center gap-1",children:[o.jsx("span",{className:"size-2 rounded-full",style:{background:vi[j]}})," ",o_[j]]},j)),o.jsxs("span",{className:"ml-auto",children:[n.length," nodos · arrastrá para reacomodar"]})]}),p&&o.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-xs",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"size-2 rounded-full",style:{background:vi[p.kind]}}),o.jsx("span",{className:"font-medium",children:p.label}),o.jsxs("span",{className:"text-muted-fg",children:["· ",p.relation]})]}),p.detail&&o.jsx("p",{className:"mt-1 whitespace-pre-wrap text-muted-fg",children:p.detail})]})]})}function i6(){return[{key:"overview",label:"Explorer",icon:Rd},{key:"memories",label:C("project.nav.memories"),icon:td},{key:"records",label:C("project.agent_detail.records_title"),icon:dj},{key:"sleep",label:C("project.agent_detail.sleep_title"),icon:Xo},{key:"brain",label:C("project.agent_detail.brain_title"),icon:il},{key:"config",label:C("settings.tabs.advanced"),icon:sd}]}const c6=[{value:"",label:"— sin tipo —"},{value:"orchestrator",label:"Orchestrator",description:"Coordina al equipo y delega."},{value:"specialist",label:"Specialist",description:"Experto en un dominio; ejecuta tareas."},{value:"assistant",label:"Assistant",description:"Ayudante conversacional."},{value:"worker",label:"Worker",description:"Corre tareas autónomas."},{value:"monitor",label:"Monitor",description:"Observa estado y reporta."}],sh=e=>e.split(",").map(n=>n.trim()).filter(Boolean),u6=(e,n)=>e.filter(s=>s.spec?.agent===n||n==="super-agent"&&s.kind==="super_agent");function d6(e){return e.split(`
555
- `).map(n=>n.replace(/^[-*#>\s]+/,"").trim()).filter(n=>n.length>2&&!n.startsWith("```")).slice(0,12)}function f6({pid:e}){const{slug:n=""}=ej(),s=Ia(),[r,i]=b.useState("overview"),c=i6(),d=Xe(`/projects/${e}/agents/${n}`,()=>Jt.get(e,n)),f=Xe(`/projects/${e}/agents`,()=>Jt.list(e)),p=Xe(`/projects/${e}/routines`,()=>or.list(e)),m=Xe(`/projects/${e}/messages?agent=${n}`,()=>Jg.project(e,{agent:n,limit:200})),h=Xe(`/projects/${e}/agents/${n}/conversations`,()=>rx.list(e,n)),x=Xe(`/projects/${e}/tasks?all`,()=>lr.list(e,"all")),y=d.data,S=u6(p.data||[],n),w=(x.data||[]).filter(k=>k.agent===n),_=(f.data||[]).filter(k=>k.parent===n);if(d.isLoading)return o.jsx(Je,{});if(!y)return o.jsx("div",{className:"text-sm text-muted-fg",children:C("project.agent_detail.not_found")});const j=y.is_master?Ns:vn;return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsx("button",{onClick:()=>s(`/p/${e}/agents`),className:"mt-1 text-muted-fg hover:text-foreground",children:o.jsx(AN,{size:16})}),o.jsx("div",{className:Ae("flex size-11 items-center justify-center rounded-xl bg-gradient-to-br",y.is_master?"from-violet-600 to-indigo-600":"from-slate-600 to-gray-600"),children:o.jsx(j,{className:"size-5 text-white"})}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("h1",{className:"text-lg font-semibold",children:y.slug}),y.is_master&&o.jsxs(Ue,{tone:"success",children:[o.jsx(Ns,{size:10})," ",C("project.agents.orchestrator")]}),y.role&&o.jsx(Ue,{children:y.role}),y.model&&o.jsx(Ue,{tone:"info",children:y.model}),y.parent&&o.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${y.parent}`),className:"text-[11px] text-violet-400 hover:underline",children:[C("project.agent_detail.reports_to")," ",y.parent]})]}),y.description&&o.jsx("p",{className:"mt-0.5 max-w-2xl text-xs text-muted-fg",children:y.description})]})]}),o.jsxs(he,{size:"sm",variant:"primary",onClick:()=>s(`/p/${e}/chat?agent=${n}`),children:[o.jsx(Za,{size:13})," ",C("project.agent_detail.chat_btn",{slug:y.slug})]})]}),o.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border",children:c.map(({key:k,label:E,icon:R})=>o.jsxs("button",{onClick:()=>i(k),className:Ae("flex items-center gap-1.5 border-b-2 px-3 py-2 text-sm transition-colors -mb-px",r===k?"border-foreground text-foreground":"border-transparent text-muted-fg hover:text-foreground"),children:[o.jsx(R,{size:14})," ",E]},k))}),r==="overview"&&o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[o.jsx(Iu,{label:"Threads",value:h.data?.length??0,icon:Ri}),o.jsx(Iu,{label:"Records",value:m.data?.length??0,icon:dj}),o.jsx(Iu,{label:"Tasks",value:w.length,icon:Rd}),o.jsx(Iu,{label:"Heartbeats",value:S.length,icon:Xo})]}),o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsx(He,{title:"Skills & tools",description:"",children:o.jsxs("div",{className:"flex flex-wrap gap-1",children:[y.skills?.map(k=>o.jsxs(Ue,{tone:"info",children:[o.jsx(il,{size:10})," ",k]},k)),y.tools?.map(k=>o.jsxs(Ue,{children:[o.jsx(cl,{size:10})," ",k]},k)),!y.skills?.length&&!y.tools?.length&&o.jsx("span",{className:"text-xs text-muted-fg",children:"—"})]})}),o.jsx(He,{title:C("project.agent_detail.threads_recent"),description:"",children:o.jsxs("ul",{className:"space-y-1 text-xs",children:[(h.data||[]).slice(0,6).map(k=>o.jsxs("li",{className:"flex items-center justify-between rounded-md bg-muted/30 px-2 py-1",children:[o.jsx("span",{className:"truncate",children:k.title||k.filename}),o.jsxs("span",{className:"shrink-0 text-muted-fg",children:[k.messages??0," ",C("project.agent_detail.msgs_count")]})]},k.id)),!h.data?.length&&o.jsx("li",{className:"text-muted-fg",children:C("project.agent_detail.no_threads")})]})})]}),_.length>0&&o.jsx(He,{title:C("project.agent_detail.subagents"),description:C("project.agent_detail.subagents_desc"),children:o.jsx("div",{className:"flex flex-wrap gap-2",children:_.map(k=>o.jsxs("button",{onClick:()=>s(`/p/${e}/agents/${k.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:[o.jsx(vn,{size:14,className:"text-muted-fg"})," ",k.slug]},k.slug))})})]}),r==="memories"&&o.jsx(p6,{pid:e,slug:n,initial:y.memory||"",onSaved:()=>d.mutate()}),r==="records"&&o.jsx(g6,{records:m.data||[],loading:m.isLoading}),r==="sleep"&&o.jsx(h6,{routines:S}),r==="brain"&&o.jsx(b6,{slug:n,memory:y.memory||"",threads:(h.data||[]).map(k=>({id:k.id,label:k.title||k.filename})),tasks:w.map(k=>({id:k.id,label:k.title,detail:k.body||void 0})),routines:S,parent:y.parent||null,children:_.map(k=>k.slug)}),r==="config"&&o.jsx(m6,{pid:e,agent:y,agents:f.data||[],onSaved:()=>{d.mutate(),f.mutate()},onDeleted:()=>{f.mutate(),s(`/p/${e}/agents`)}})]})}function m6({pid:e,agent:n,agents:s,onSaved:r,onDeleted:i}){const c=nt(),[d,f]=b.useState(n.type||""),[p,m]=b.useState(n.area||""),[h,x]=b.useState(n.role||""),[y,S]=b.useState(n.model||""),[w,_]=b.useState(n.parent||""),[j,k]=b.useState(!!n.is_master),[E,R]=b.useState((n.skills||[]).join(", ")),[N,M]=b.useState((n.tools||[]).join(", ")),[A,O]=b.useState(n.description||""),[L,U]=b.useState(n.system||""),[P,B]=b.useState(!1),D=async()=>{B(!0);try{await Jt.update(e,n.slug,{type:d||null,area:p||null,role:h||null,model:y||null,parent:w||null,is_master:j||d==="orchestrator",skills:sh(E),tools:sh(N),description:A||null,system:L}),c.success(C("project.agent_detail.update_success")),r()}catch(Y){c.error(Y.message)}finally{B(!1)}},H=async()=>{if(confirm(C("project.agent_detail.delete_confirm",{slug:n.slug})))try{await Jt.remove(e,n.slug),c.success(C("project.agent_detail.delete_success")),i()}catch(Y){c.error(Y.message)}};return o.jsx(He,{title:C("project.agent_detail.config_title"),description:`.apc/agents/${n.slug}.md — definición (frontmatter + system prompt).`,children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("project.agent_detail.type_label"),children:o.jsx(Ct,{value:d,onChange:f,options:c6})}),o.jsx(fe,{label:C("project.agent_detail.area_label"),hint:C("project.agent_detail.area_hint"),children:o.jsx(Ce,{value:p,onChange:Y=>m(Y.target.value),placeholder:C("project.agent_detail.area_ph")})})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("project.agent_detail.role_label"),children:o.jsx(Ce,{value:h,onChange:Y=>x(Y.target.value),placeholder:"Operations Lead"})}),o.jsx(fe,{label:C("project.agent_detail.parent_label"),children:o.jsx(Ct,{value:w,onChange:_,placeholder:C("project.agent_detail.none_parent"),options:[{value:"",label:C("project.agent_detail.none_parent")},...s.filter(Y=>Y.slug!==n.slug).map(Y=>({value:Y.slug,label:Y.slug}))]})})]}),o.jsx(fe,{label:C("project.agent_detail.model_label"),hint:C("project.agent_detail.model_hint"),children:o.jsx(Ce,{value:y,onChange:Y=>S(Y.target.value),placeholder:C("project.agent_detail.model_ph")})}),o.jsx(fe,{label:C("project.agent_detail.skills_label"),children:o.jsx(Ce,{value:E,onChange:Y=>R(Y.target.value),placeholder:"skill-a, skill-b"})}),o.jsx(x6,{value:N,onChange:M}),o.jsx(fe,{label:C("project.agent_detail.bio_label"),children:o.jsx(Qt,{rows:2,value:A,onChange:Y=>O(Y.target.value)})}),o.jsx(fe,{label:C("project.agent_detail.system_label"),hint:C("project.agent_detail.system_hint"),children:o.jsx(Qt,{rows:10,className:"font-mono text-xs",value:L,onChange:Y=>U(Y.target.value),placeholder:"You are…"})}),o.jsx(sn,{checked:j,onChange:k,label:C("project.agent_detail.master_label")}),o.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3",children:[o.jsxs(he,{variant:"destructive",onClick:H,children:[o.jsx(Ja,{size:13})," ",C("project.agent_detail.delete_btn")]}),o.jsxs(he,{variant:"primary",loading:P,onClick:D,children:[o.jsx(vh,{size:13})," ",C("project.agent_detail.save_btn")]})]})]})})}function Iu({label:e,value:n,icon:s}){return o.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[o.jsx(s,{size:13})," ",e]}),o.jsx("div",{className:"mt-1 text-2xl font-semibold",children:n})]})}function p6({pid:e,slug:n,initial:s,onSaved:r}){const i=nt(),[c,d]=b.useState(s),[f,p]=b.useState(!1);b.useEffect(()=>{d(s)},[s]);const m=c!==s,h=async()=>{p(!0);try{await Jt.memory.put(e,n,c),i.success(C("project.agent_detail.memory_saved")),r()}catch(x){i.error(x.message)}finally{p(!1)}};return o.jsxs(He,{title:C("project.agent_detail.memory_title"),description:`~/.apx/projects/<id>/agents/${n}/memory.md — hechos durables que el agente recuerda.`,children:[o.jsx(Qt,{rows:16,className:"font-mono text-xs",value:c,onChange:x=>d(x.target.value),placeholder:C("project.agent_detail.memory_empty")}),o.jsxs("div",{className:"mt-2 flex items-center justify-between",children:[o.jsxs("span",{className:"text-[11px] text-muted-fg",children:[c.length," ",C("project.memories.chars")]}),o.jsxs(he,{size:"sm",variant:"primary",loading:f,disabled:!m,onClick:h,children:[o.jsx(vh,{size:12})," ",C("project.memories.save_btn")]})]})]})}function g6({records:e,loading:n}){const s=b.useMemo(()=>[...e].sort((r,i)=>(i.ts||"").localeCompare(r.ts||"")),[e]);return o.jsxs(He,{title:C("project.agent_detail.records_title"),description:C("project.agent_detail.records_desc"),children:[n&&o.jsx(Je,{}),!n&&s.length===0&&o.jsx("p",{className:"text-xs text-muted-fg",children:C("project.agent_detail.no_activity")}),o.jsx("ul",{className:"space-y-1 text-sm",children:s.map((r,i)=>o.jsxs("li",{className:"flex items-start gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsx("span",{className:"mt-0.5 shrink-0",children:r.direction==="in"?o.jsx(fj,{size:13,className:"text-blue-400"}):o.jsx(pj,{size:13,className:"text-emerald-400"})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-[11px] text-muted-fg",children:[o.jsx("span",{className:"font-mono",children:new Date(r.ts).toLocaleString()}),o.jsx(Ue,{tone:"info",children:r.channel}),r.type&&o.jsx(Ue,{children:r.type})]}),r.body&&o.jsx("p",{className:"mt-1 whitespace-pre-wrap break-words text-xs",children:r.body.length>400?`${r.body.slice(0,400)}…`:r.body})]})]},`${r.ts}-${i}`))})]})}function h6({routines:e}){return e.length===0?o.jsx(He,{title:C("project.agent_detail.sleep_title"),description:C("project.agent_detail.sleep_desc"),children:o.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4 text-sm",children:[o.jsx("div",{className:"font-medium text-amber-400",children:C("project.agent_detail.sleep_deep")}),o.jsx("p",{className:"mt-1 text-xs text-muted-fg",children:C("project.agent_detail.sleep_deep_desc")})]})}):o.jsx(He,{title:C("project.agent_detail.sleep_title"),description:C("project.agent_detail.sleep_desc"),children:o.jsx("div",{className:"space-y-3",children:e.map(n=>{const s=n.enabled,r=n.last_status==="error";return o.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:Ae("size-2 rounded-full",r?"bg-destructive":s?"bg-emerald-400":"bg-muted-fg/40")}),o.jsx("span",{className:"text-sm font-medium",children:n.name}),o.jsx(Ue,{tone:s?"success":"muted",children:s?"running":"paused"}),r&&o.jsx(Ue,{tone:"danger",children:"last: error"})]}),o.jsxs("div",{className:"mt-2 grid grid-cols-2 gap-2 text-xs sm:grid-cols-4",children:[o.jsx(Uu,{label:"Tick",value:n.schedule}),o.jsx(Uu,{label:"Next tick",value:n.next_run_at?new Date(n.next_run_at).toLocaleString():"—"}),o.jsx(Uu,{label:"Last tick",value:n.last_run_at?new Date(n.last_run_at).toLocaleString():"—"}),o.jsx(Uu,{label:"Last run",value:n.last_status||"—"})]}),n.last_error&&o.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 Uu({label:e,value:n}){return o.jsxs("div",{className:"rounded-md border border-border bg-card p-2",children:[o.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-fg",children:e}),o.jsx("div",{className:"mt-0.5 truncate font-mono text-[11px]",children:n})]})}function x6({value:e,onChange:n}){const s=Xe("/tools",()=>m5.list()),r=sh(e),i=s.data||[],c=f=>{const p=new Set(r);p.has(f)?p.delete(f):p.add(f),n([...p].join(", "))},d=r.filter(f=>!i.some(p=>p.name===f));return o.jsxs(fe,{label:"Tools",hint:C("project.agent_detail.tools_hint"),children:[o.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[i.map(f=>{const p=r.includes(f.name);return o.jsx("button",{type:"button",title:f.description||f.name,onClick:()=>c(f.name),className:Ae("rounded-md border px-2 py-0.5 font-mono text-[11px] transition-colors",p?"border-emerald-500/50 bg-emerald-500/10 text-emerald-400":"border-border text-muted-fg hover:text-foreground"),children:f.name},f.name)}),d.map(f=>o.jsxs("button",{type:"button",onClick:()=>c(f),className:"rounded-md border border-sky-500/50 bg-sky-500/10 px-2 py-0.5 font-mono text-[11px] text-sky-400",children:[f," ✕"]},f))]}),o.jsx(Ce,{className:"mt-2",value:e,onChange:f=>n(f.target.value),placeholder:C("project.agent_detail.tools_custom_ph")})]})}function b6({slug:e,memory:n,threads:s,tasks:r,routines:i,parent:c,children:d}){const f=b.useMemo(()=>{const p=[];return d6(n).forEach((m,h)=>p.push({id:`m${h}`,label:m,kind:"memory",relation:"knows",detail:m})),s.slice(0,8).forEach(m=>p.push({id:`th-${m.id}`,label:m.label,kind:"thread",relation:"in_thread"})),r.slice(0,8).forEach(m=>p.push({id:`ts-${m.id}`,label:m.label,kind:"task",relation:"handles_task",detail:m.detail})),i.forEach(m=>p.push({id:`rt-${m.name}`,label:m.name,kind:"routine",relation:"ticks",detail:`schedule: ${m.schedule}`})),c&&p.push({id:`p-${c}`,label:c,kind:"agentlink",relation:"reports_to"}),d.forEach(m=>p.push({id:`c-${m}`,label:m,kind:"agentlink",relation:"orchestrates"})),p},[n,s,r,i,c,d]);return o.jsx(He,{title:C("project.agent_detail.brain_title"),description:C("project.agent_detail.brain_desc"),children:f.length===0?o.jsx("p",{className:"text-xs text-muted-fg",children:C("project.agent_detail.brain_empty")}):o.jsx(l6,{center:e,nodes:f})})}function v6(){const e=Ia(),n=ea(),s=nt(),{pid:r=""}=ej(),{project:i,mutate:c}=fw(r),{collapsed:d,toggle:f}=Iw(Cn.sidebarCollapsed+".project"),p=String(r)==="0",m=b.useMemo(()=>p?[{title:C("base.nav_general"),items:[{key:"",label:"Dashboard",icon:nR},{key:"workspaces",label:C("base.workspaces_title"),icon:ON},{key:"models",label:C("settings.tabs.engines"),icon:gh},{key:"agent-defaults",label:C("base.defaults_title"),icon:vn}]},{title:C("base.nav_activity"),items:[{key:"chat",label:C("project.nav.chat"),icon:Ri},{key:"sessions",label:C("base.sessions_title"),icon:JN},{key:"tasks",label:C("project.nav.tasks"),icon:Ui},{key:"logs",label:C("project.nav.logs"),icon:Tg}]},{title:C("base.nav_system"),items:[{key:"agents",label:C("project.nav.agents"),icon:vn},{key:"memories",label:C("project.nav.memories"),icon:td},{key:"routines",label:C("project.nav.routines"),icon:Xo},{key:"mcps",label:C("project.nav.mcps"),icon:Rg},{key:"config",label:C("project.nav.config"),icon:sd}]}]:[{title:C("project.sections.workspace"),items:[{key:"",label:C("project.nav.overview"),icon:vj},{key:"telegram",label:C("project.nav.telegram"),icon:Za},{key:"chat",label:C("project.nav.chat"),icon:Ri},{key:"threads",label:C("project.nav.threads"),icon:Ri},{key:"agents",label:C("project.nav.agents"),icon:vn},{key:"memories",label:C("project.nav.memories"),icon:td}]},{title:C("project.sections.automation"),items:[{key:"routines",label:C("project.nav.routines"),icon:Xo},{key:"tasks",label:C("project.nav.tasks"),icon:Ui},{key:"mcps",label:C("project.nav.mcps"),icon:Rg},{key:"logs",label:C("project.nav.logs"),icon:Tg}]},{title:C("project.sections.config"),items:[{key:"config",label:C("project.nav.config"),icon:sd}]}],[p]),h=n.pathname.replace(`/p/${r}`,"").replace(/^\//,"").split("/")[0];if(!i)return o.jsx("div",{className:"p-8 text-muted-fg",children:C("project.not_found",{pid:r})});const x=async()=>{try{await Qn.rebuild(r),s.success(C("project.rebuild_done"))}catch(_){s.error(_.message)}},y=async()=>{const _=i.name||i.path;if(confirm(C("project.unregister_confirm",{label:_})))try{await Qn.remove(r),s.success(C("project.unregistered")),c(),e("/")}catch(j){s.error(j.message)}},S=_=>{const j=_?`/p/${r}/${_}`:`/p/${r}`;e(j)},w=Number(r)!==0?o.jsxs(o.Fragment,{children:[o.jsxs(he,{size:"sm",variant:"secondary",onClick:x,children:[o.jsx(Wr,{size:13})," ",C("project.rebuild")]}),o.jsx(he,{size:"sm",variant:"destructive",onClick:y,children:C("admin.unregister")})]}):void 0;return o.jsx($w,{sections:m,active:h,onChange:S,collapsed:d,onToggleCollapse:f,actions:w,contentClassName:"w-full space-y-6 p-6 pt-3",testId:`project-tab-${h||"overview"}`,children:o.jsxs(sj,{children:[o.jsx(qt,{index:!0,element:o.jsx(V1,{pid:r})}),o.jsx(qt,{path:"workspaces",element:o.jsx(eO,{})}),o.jsx(qt,{path:"models",element:o.jsx(o2,{})}),o.jsx(qt,{path:"agent-defaults",element:o.jsx(cz,{})}),o.jsx(qt,{path:"sessions",element:o.jsx(mz,{})}),o.jsx(qt,{path:"logs",element:o.jsx(JO,{pid:r})}),o.jsx(qt,{path:"config",element:o.jsx(zz,{pid:r})}),o.jsx(qt,{path:"telegram",element:o.jsx(yD,{pid:r})}),o.jsx(qt,{path:"agents",element:o.jsx(Bz,{pid:r})}),o.jsx(qt,{path:"agents/:slug",element:o.jsx(f6,{pid:r})}),o.jsx(qt,{path:"memories",element:o.jsx(jD,{pid:r})}),o.jsx(qt,{path:"routines",element:o.jsx(Fz,{pid:r})}),o.jsx(qt,{path:"tasks",element:p?o.jsx(pz,{}):o.jsx(Kz,{pid:r})}),o.jsx(qt,{path:"mcps",element:o.jsx(Qz,{pid:r})}),o.jsx(qt,{path:"threads",element:o.jsx(Jz,{pid:r})}),o.jsx(qt,{path:"chat",element:o.jsx(bD,{pid:r})}),o.jsx(qt,{path:"*",element:o.jsx(V1,{pid:r})})]})})}const y6=["es","en","pt","fr","it","de"];function _6(){const e=nt(),{identity:n,isLoading:s,save:r}=lx(),[i,c]=b.useState({}),[d,f]=b.useState(!1);if(b.useEffect(()=>{c(n)},[n]),s)return o.jsx(Je,{});const p=async()=>{f(!0);try{await r({owner_name:i.owner_name,owner_context:i.owner_context,language:i.language,timezone:i.timezone}),e.success(C("settings.identity.saved"))}catch(m){e.error(m.message)}finally{f(!1)}};return o.jsxs(He,{title:C("settings.identity.title"),description:C("settings.identity.subtitle"),children:[n?null:o.jsx(ot,{children:C("common.none_yet")}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("settings.identity.owner_name"),children:o.jsx(Ce,{value:i.owner_name||"",onChange:m=>c({...i,owner_name:m.target.value})})}),o.jsx(fe,{label:C("settings.identity.language"),children:o.jsx(Ct,{value:i.language||"es",onChange:m=>c({...i,language:m}),options:y6.map(m=>({value:m,label:m}))})}),o.jsx(fe,{label:C("settings.identity.timezone"),hint:"ej. America/Argentina/Buenos_Aires",children:o.jsx(Ce,{value:i.timezone||"",onChange:m=>c({...i,timezone:m.target.value})})})]}),o.jsx("div",{className:"mt-3",children:o.jsx(fe,{label:C("settings.identity.owner_context"),hint:"Quién sos, en qué trabajás, qué le interesa al agente saber de vos.",children:o.jsx(Qt,{rows:3,value:i.owner_context||"",onChange:m=>c({...i,owner_context:m.target.value})})})}),o.jsx("div",{className:"mt-4",children:o.jsx(he,{variant:"primary",loading:d,onClick:p,children:C("common.save")})})]})}function j6(){const e=nt(),n=Ia(),{superAgent:s,isLoading:r,mutate:i}=s2(),{patch:c}=yr(),{identity:d,save:f}=lx(),[p,m]=b.useState(!0),[h,x]=b.useState(""),[y,S]=b.useState(""),[w,_]=b.useState("permiso"),[j,k]=b.useState(!1);if(b.useEffect(()=>{s&&(m(!!s.enabled),x(s.system||""),_(s.permission_mode||"permiso"))},[s]),b.useEffect(()=>{S(d.personality||"")},[d.personality]),r||!s)return o.jsx(Je,{});const E=async()=>{k(!0);try{await c({"super_agent.enabled":p,"super_agent.system":h,"super_agent.permission_mode":w},["super_agent.name"]),await f({personality:y}),e.success(C("settings.super_agent.saved")),i()}catch(R){e.error(R.message)}finally{k(!1)}};return o.jsx(He,{title:C("settings.super_agent.title"),description:"Comportamiento del super-agente. El modelo y la cadena de fallback se configuran en el Router de modelos.",children:o.jsxs("div",{className:"space-y-4",children:[o.jsx("div",{className:"flex items-center gap-3",children:o.jsx(sn,{checked:p,onChange:m,label:"Super-agente habilitado"})}),o.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/20 p-3",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-sm font-medium",children:"Modelo activo (router)"}),o.jsx("div",{className:"truncate font-mono text-xs text-muted-fg",children:s.model||"—"})]}),o.jsxs(he,{size:"sm",variant:"secondary",onClick:()=>n("/p/0/models"),children:[o.jsx(gh,{size:13})," Configurar en Modelos"]})]}),o.jsx(fe,{label:C("settings.super_agent.permission_mode"),children:o.jsx(Ct,{value:w,onChange:_,options:yh.map(R=>({value:R,label:R}))})}),o.jsx(fe,{label:C("settings.super_agent.personality"),children:o.jsx(Qt,{rows:2,value:y,onChange:R=>S(R.target.value)})}),o.jsx(fe,{label:C("settings.super_agent.system"),hint:C("settings.super_agent.system_hint"),children:o.jsx(Qt,{rows:6,className:"font-mono text-xs",value:h,onChange:R=>x(R.target.value),placeholder:"(Vacío = se usa el prompt base de core/agent/prompts/super-agent-base.md)"})}),o.jsx(he,{variant:"primary",loading:j,onClick:E,children:C("common.save")})]})})}const Wp={providers:()=>ge.get("/embeddings/providers"),test:(e={})=>ge.post("/embeddings/test",e),reindex:()=>ge.post("/embeddings/reindex",{})},S6=[{value:"auto",label:"Automático (cadena: Ollama → Gemini → OpenAI → offline)"},{value:"ollama",label:"Ollama — local, sin API key (nomic-embed-text)"},{value:"gemini",label:"Gemini — free tier con key (text-embedding-004)"},{value:"openai",label:"OpenAI — text-embedding-3-small (cloud)"},{value:"tf",label:"Offline (term-frequency, sin modelo — degradado)"}],w6=[{value:"chain",label:"Cadena (fallback automático)"},{value:"single",label:"Único (usa solo el elegido)"}],l_=e=>e.startsWith("***");function C6(){const e=nt(),{config:n,isLoading:s,patch:r}=yr(),{data:i,mutate:c}=Xe("/embeddings/providers",()=>Wp.providers()),[d,f]=b.useState(!1),[p,m]=b.useState(null);if(s)return o.jsx(Je,{});const x=(n.memory||{}).embeddings||{},y=i?.configured_provider||x.provider||"auto",S=i?.mode||x.mode||"chain",w=i?.engines||[],_=async E=>{f(!0);try{await r(E),await c()}catch(R){e.error(`No se pudo guardar: ${R.message}`)}finally{f(!1)}},j=async()=>{f(!0),m(null);try{const E=await Wp.test({});m(`${E.embedder} · dim ${E.dim} · ${E.ms}ms`),e.success(`Embedding OK con ${E.embedder}`)}catch(E){e.error(`Falló el test: ${E.message}`)}finally{f(!1)}},k=async()=>{f(!0);try{const E=await Wp.reindex();e.success(`Reindexado: ${E.indexed} chunks (limpiados ${E.cleared}).`)}catch(E){e.error(`Falló el reindex: ${E.message}`)}finally{f(!1)}};return o.jsxs("div",{className:"space-y-6",children:[o.jsx(He,{title:"Embeddings (RAG)",description:"Modelo que vectoriza el historial de todos los canales para la memoria relevante. Igual que TTS/STT: elegí proveedor y modelo. 'Automático' prueba local primero y cae al offline si no hay nada.",children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(fe,{label:"Proveedor",hint:"Ollama es local y gratis. Gemini/OpenAI usan la API key de su sección en Modelos (o la de acá abajo).",children:o.jsx(Ct,{value:y,onChange:E=>_({"memory.embeddings.provider":E}),options:S6,disabled:d,className:"max-w-xl"})}),o.jsx(fe,{label:"Modo de selección",hint:"Cadena cae al siguiente si uno falla; Único usa exactamente el proveedor elegido.",children:o.jsx(Ct,{value:S,onChange:E=>_({"memory.embeddings.mode":E}),options:w6,disabled:d,className:"max-w-md"})}),o.jsx("div",{className:"flex flex-wrap items-center gap-2 pt-1",children:w.map(E=>o.jsxs(Ue,{tone:E.available?"success":"muted",children:[E.id,": ",E.available?"disponible":"no disp."]},E.id))}),o.jsxs("div",{className:"flex flex-wrap items-center gap-3 pt-1",children:[o.jsxs(he,{variant:"secondary",onClick:j,loading:d,children:[o.jsx(il,{size:14})," Probar embedding"]}),o.jsxs(he,{variant:"secondary",onClick:k,loading:d,children:[o.jsx(xj,{size:14})," Reindexar memoria"]}),p&&o.jsx("span",{className:"text-sm text-muted-foreground",children:p})]})]})}),o.jsxs(He,{title:"Ollama (local)",description:"Sin API key. Corre nomic-embed-text en tu Ollama local o cloud.",children:[o.jsx(fe,{label:"Modelo",children:o.jsx(Ce,{defaultValue:x.ollama?.model||"nomic-embed-text",placeholder:"nomic-embed-text",disabled:d,onBlur:E=>{const R=E.target.value.trim();R&&R!==x.ollama?.model&&_({"memory.embeddings.ollama.model":R})},className:"max-w-md"})}),o.jsx(fe,{label:"Base URL",hint:"Vacío usa engines.ollama.base_url (por defecto http://localhost:11434).",children:o.jsx(Ce,{defaultValue:x.ollama?.base_url||"",placeholder:"http://localhost:11434",disabled:d,onBlur:E=>_({"memory.embeddings.ollama.base_url":E.target.value.trim()}),className:"max-w-md"})})]}),o.jsxs(He,{title:"OpenAI",description:"text-embedding-3-small (1536 dims) u otro modelo compatible.",children:[o.jsx(fe,{label:"Modelo",children:o.jsx(Ce,{defaultValue:x.openai?.model||"text-embedding-3-small",placeholder:"text-embedding-3-small",disabled:d,onBlur:E=>{const R=E.target.value.trim();R&&R!==x.openai?.model&&_({"memory.embeddings.openai.model":R})},className:"max-w-md"})}),o.jsx(fe,{label:"API key",hint:"Vacío reusa engines.openai.api_key. Dejalo en blanco para no tocar la guardada.",children:o.jsx(Ce,{type:"password",defaultValue:x.openai?.api_key||"",placeholder:"sk-…",disabled:d,onBlur:E=>{const R=E.target.value;R&&!l_(R)&&_({"memory.embeddings.openai.api_key":R})},className:"max-w-md"})})]}),o.jsxs(He,{title:"Gemini",description:"text-embedding-004 (768 dims). Free tier con API key de Google.",children:[o.jsx(fe,{label:"Modelo",children:o.jsx(Ce,{defaultValue:x.gemini?.model||"text-embedding-004",placeholder:"text-embedding-004",disabled:d,onBlur:E=>{const R=E.target.value.trim();R&&R!==x.gemini?.model&&_({"memory.embeddings.gemini.model":R})},className:"max-w-md"})}),o.jsx(fe,{label:"API key",hint:"Vacío reusa engines.gemini.api_key.",children:o.jsx(Ce,{type:"password",defaultValue:x.gemini?.api_key||"",placeholder:"AIza…",disabled:d,onBlur:E=>{const R=E.target.value;R&&!l_(R)&&_({"memory.embeddings.gemini.api_key":R})},className:"max-w-md"})})]})]})}function E6(){const e=nt(),{config:n,isLoading:s,patch:r,mutate:i}=yr(),c=n.telegram?.channels||[],d=Math.max(0,c.findIndex(M=>M.name==="default")),f=c[d],[p,m]=b.useState(!0),[h,x]=b.useState(1500),[y,S]=b.useState(!0),[w,_]=b.useState(""),[j,k]=b.useState(""),[E,R]=b.useState(!1);if(b.useEffect(()=>{m(!!n.telegram?.enabled),x(Number(n.telegram?.poll_interval_ms||1500)),S(!!n.telegram?.respond_with_engine),_(""),k(f?.chat_id||"")},[n,f?.chat_id]),s)return o.jsx(Je,{});const N=async()=>{R(!0);try{const M=c.slice(),A={name:"default",chat_id:j,respond_with_engine:y,...w?{bot_token:w}:{}};c.length===0?M.push(A):M[d]={...f,...A},await r({"telegram.enabled":p,"telegram.poll_interval_ms":h,"telegram.respond_with_engine":y,"telegram.channels":M}),e.success(C("settings.telegram_global.saved")),i(),_("")}catch(M){e.error(M.message)}finally{R(!1)}};return o.jsx(He,{title:C("settings.telegram_global.title"),description:C("settings.telegram_global.subtitle"),children:o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx(sn,{checked:p,onChange:m,label:C("settings.telegram_global.enabled")}),o.jsx(sn,{checked:y,onChange:S,label:C("settings.telegram_global.respond_with_engine")})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("settings.telegram_global.bot_token"),hint:f?.bot_token?`…${al(f.bot_token)??""} (seteado — escribí para reemplazar)`:"Token del BotFather.",children:o.jsx(Ce,{type:"password",value:w,onChange:M=>_(M.target.value),placeholder:f?.bot_token?`…${al(f.bot_token)??""} (ya seteado)`:""})}),o.jsx(fe,{label:C("settings.telegram_global.chat_id"),children:o.jsx(Ce,{value:j,onChange:M=>k(M.target.value),placeholder:"889721252"})}),o.jsx(fe,{label:C("settings.telegram_global.poll_interval"),children:o.jsx(Ce,{type:"number",value:String(h),onChange:M=>x(Number(M.target.value)||1500)})})]}),o.jsx(he,{variant:"primary",loading:E,onClick:N,children:C("common.save")})]})})}function k6(){const e=nt(),{channels:n,isLoading:s,mutate:r}=gx(),{contacts:i}=hx(),[c,d]=b.useState(null),[f,p]=b.useState(null),m=new Map;for(const x of i)m.set(String(x.user_id),x.name||`@${x.username||x.user_id}`);const h=async x=>{if(confirm(C("telegram_channels.delete_confirm",{name:x})))try{await kn.channels.remove(x),e.success(C("telegram_channels.removed")),r()}catch(y){e.error(y.message)}};return o.jsxs(He,{title:C("telegram_channels.title"),description:C("telegram_channels.desc"),action:o.jsxs(he,{size:"sm",onClick:()=>d({name:""}),children:[o.jsx(Nn,{size:14})," ",C("telegram_channels.new_btn")]}),children:[s&&o.jsx(Je,{}),!s&&n.length===0&&o.jsx(ot,{children:C("telegram_channels.empty")}),o.jsx("ul",{className:"space-y-2 text-sm",children:n.map(x=>{const y=x.owner_user_id!=null?m.get(String(x.owner_user_id))||`user_id ${x.owner_user_id}`:C("telegram_channels.no_owner");return o.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx("span",{className:"font-medium",children:x.name}),o.jsxs("div",{className:"flex items-center gap-2",children:[x.project&&o.jsxs(Ue,{tone:"success",children:["project = ",x.project]}),o.jsxs(he,{size:"sm",variant:"ghost",onClick:()=>p(x),children:[o.jsx(Za,{size:13})," ",C("admin.telegram_send_test")]}),o.jsx(he,{size:"sm",variant:"secondary",onClick:()=>d(x),children:C("common.edit")}),o.jsx(he,{size:"sm",variant:"destructive",onClick:()=>h(x.name),children:C("common.delete")})]})]}),o.jsxs("div",{className:"mt-1 grid grid-cols-2 gap-2 text-xs text-muted-fg",children:[o.jsxs("span",{children:["chat_id: ",x.chat_id||"—"]}),o.jsxs("span",{children:["bot_token: ",x.bot_token?`…${al(x.bot_token)??""}`:"—"]}),o.jsxs("span",{children:["route_to_agent: ",x.route_to_agent||"default APX"]}),o.jsxs("span",{children:["engine: ",x.respond_with_engine?"sí":"no"]}),o.jsxs("span",{className:"col-span-2",children:[C("telegram_channels.owner_label")," ",y]})]})]},x.name)})}),o.jsx(Lw,{channel:c,onClose:()=>d(null),onSaved:()=>{d(null),r()}}),o.jsx(Pw,{channel:f,onClose:()=>p(null)})]})}const i_=new Set(["owner","guest"]);function N6(){const e=nt(),{roles:n,mutate:s,isLoading:r}=hx(),[i,c]=b.useState(""),[d,f]=b.useState(""),[p,m]=b.useState(!1),[h,x]=b.useState(!1),y=async()=>{const _=i.trim();if(!_){e.error(C("telegram_roles.name_required"));return}if(i_.has(_)){e.error(C("telegram_roles.builtin_error",{name:_}));return}x(!0);try{const j=p?"*":d.split(",").map(k=>k.trim()).filter(Boolean);await kn.roles.set(_,j),e.success(C("telegram_roles.saved",{name:_})),c(""),f(""),m(!1),s()}catch(j){e.error(j.message)}finally{x(!1)}},S=async _=>{if(confirm(C("telegram_roles.delete_confirm",{name:_})))try{await kn.roles.remove(_),e.success(C("telegram_roles.removed")),s()}catch(j){e.error(j.message)}},w=Object.entries(n);return o.jsxs(He,{title:C("telegram_roles.title"),description:C("telegram_roles.desc"),children:[r&&o.jsx(Je,{}),w.length===0&&!r&&o.jsx(ot,{children:C("telegram_roles.empty")}),w.length>0&&o.jsx("ul",{className:"space-y-2 text-sm",children:w.map(([_,j])=>{const k=i_.has(_),E=j?.tools==="*"?C("telegram_roles.tools_all"):Array.isArray(j?.tools)&&j.tools.length>0?j.tools.join(", "):C("telegram_roles.tools_none");return o.jsxs("li",{className:"rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("span",{className:"font-medium",children:_}),k&&o.jsx(Ue,{tone:"info",children:C("telegram_roles.builtin")})]}),!k&&o.jsx(he,{size:"sm",variant:"destructive",onClick:()=>S(_),children:C("telegram_roles.delete_btn")})]}),o.jsxs("div",{className:"mt-1 text-xs text-muted-fg",children:["tools: ",E]})]},_)})}),o.jsxs("div",{className:"mt-4 space-y-3 rounded-md border border-dashed border-border p-3",children:[o.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[o.jsx(Nn,{size:14})," ",C("telegram_roles.new_title")]}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsx(fe,{label:C("telegram_roles.name_label"),children:o.jsx(Ce,{value:i,onChange:_=>c(_.target.value),placeholder:C("telegram_roles.name_ph")})}),o.jsx(fe,{label:C("telegram_roles.tools_label"),hint:C("telegram_roles.tools_hint"),children:o.jsx(Ce,{value:d,onChange:_=>f(_.target.value),disabled:p,placeholder:C("telegram_roles.tools_ph")})})]}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(sn,{checked:p,onChange:m,label:C("telegram_roles.full_access")}),o.jsx(he,{variant:"primary",loading:h,onClick:y,children:C("telegram_roles.save_btn")})]})]})]})}const w2="apx.settings.telegramTab";function R6(){if(typeof window>"u")return"default";const e=window.localStorage.getItem(w2);return e==="channels"||e==="contacts"||e==="roles"||e==="default"?e:"default"}function T6(){const[e,n]=b.useState("default");b.useEffect(()=>{n(R6())},[]);const s=r=>{const i=r==="channels"||r==="contacts"||r==="roles"||r==="default"?r:"default";n(i);try{window.localStorage.setItem(w2,i)}catch{}};return o.jsxs(Wd,{value:e,onValueChange:s,className:"w-full",children:[o.jsxs(ef,{children:[o.jsx(Fa,{value:"default",children:C("settings.telegram_global.title")}),o.jsx(Fa,{value:"channels",children:C("telegram_channels.title")}),o.jsx(Fa,{value:"contacts",children:C("telegram_contacts.title")}),o.jsx(Fa,{value:"roles",children:C("telegram_roles.title")})]}),o.jsx(ka,{value:"default",className:"mt-4",children:o.jsx(E6,{})}),o.jsx(ka,{value:"channels",className:"mt-4",children:o.jsx(k6,{})}),o.jsx(ka,{value:"contacts",className:"mt-4",children:o.jsx(Bw,{})}),o.jsx(ka,{value:"roles",className:"mt-4",children:o.jsx(N6,{})})]})}function A6(){const{data:e,error:n,isLoading:s,mutate:r}=Xe("/pair/list",()=>tl.list(),{refreshInterval:Ad.pairList});return{clients:e?.clients||[],error:n,isLoading:s,mutate:r}}var Ho={},eg,c_;function M6(){return c_||(c_=1,eg=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),eg}var tg={},rr={},u_;function to(){if(u_)return rr;u_=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 rr.getSymbolSize=function(r){if(!r)throw new Error('"version" cannot be null or undefined');if(r<1||r>40)throw new Error('"version" should be in range from 1 to 40');return r*4+17},rr.getSymbolTotalCodewords=function(r){return n[r]},rr.getBCHDigit=function(s){let r=0;for(;s!==0;)r++,s>>>=1;return r},rr.setToSJISFunction=function(r){if(typeof r!="function")throw new Error('"toSJISFunc" is not a valid function.');e=r},rr.isKanjiModeEnabled=function(){return typeof e<"u"},rr.toSJIS=function(r){return e(r)},rr}var ng={},d_;function Ax(){return d_||(d_=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(r){return r&&typeof r.bit<"u"&&r.bit>=0&&r.bit<4},e.from=function(r,i){if(e.isValid(r))return r;try{return n(r)}catch{return i}}})(ng)),ng}var ag,f_;function O6(){if(f_)return ag;f_=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 r=0;r<s;r++)this.putBit((n>>>s-r-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++}},ag=e,ag}var sg,m_;function z6(){if(m_)return sg;m_=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,r,i){const c=n*this.size+s;this.data[c]=r,i&&(this.reservedBit[c]=!0)},e.prototype.get=function(n,s){return this.data[n*this.size+s]},e.prototype.xor=function(n,s,r){this.data[n*this.size+s]^=r},e.prototype.isReserved=function(n,s){return this.reservedBit[n*this.size+s]},sg=e,sg}var rg={},p_;function D6(){return p_||(p_=1,(function(e){const n=to().getSymbolSize;e.getRowColCoords=function(r){if(r===1)return[];const i=Math.floor(r/7)+2,c=n(r),d=c===145?26:Math.ceil((c-13)/(2*i-2))*2,f=[c-7];for(let p=1;p<i-1;p++)f[p]=f[p-1]-d;return f.push(6),f.reverse()},e.getPositions=function(r){const i=[],c=e.getRowColCoords(r),d=c.length;for(let f=0;f<d;f++)for(let p=0;p<d;p++)f===0&&p===0||f===0&&p===d-1||f===d-1&&p===0||i.push([c[f],c[p]]);return i}})(rg)),rg}var og={},g_;function L6(){if(g_)return og;g_=1;const e=to().getSymbolSize,n=7;return og.getPositions=function(r){const i=e(r);return[[0,0],[i-n,0],[0,i-n]]},og}var lg={},h_;function P6(){return h_||(h_=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(i){return i!=null&&i!==""&&!isNaN(i)&&i>=0&&i<=7},e.from=function(i){return e.isValid(i)?parseInt(i,10):void 0},e.getPenaltyN1=function(i){const c=i.size;let d=0,f=0,p=0,m=null,h=null;for(let x=0;x<c;x++){f=p=0,m=h=null;for(let y=0;y<c;y++){let S=i.get(x,y);S===m?f++:(f>=5&&(d+=n.N1+(f-5)),m=S,f=1),S=i.get(y,x),S===h?p++:(p>=5&&(d+=n.N1+(p-5)),h=S,p=1)}f>=5&&(d+=n.N1+(f-5)),p>=5&&(d+=n.N1+(p-5))}return d},e.getPenaltyN2=function(i){const c=i.size;let d=0;for(let f=0;f<c-1;f++)for(let p=0;p<c-1;p++){const m=i.get(f,p)+i.get(f,p+1)+i.get(f+1,p)+i.get(f+1,p+1);(m===4||m===0)&&d++}return d*n.N2},e.getPenaltyN3=function(i){const c=i.size;let d=0,f=0,p=0;for(let m=0;m<c;m++){f=p=0;for(let h=0;h<c;h++)f=f<<1&2047|i.get(m,h),h>=10&&(f===1488||f===93)&&d++,p=p<<1&2047|i.get(h,m),h>=10&&(p===1488||p===93)&&d++}return d*n.N3},e.getPenaltyN4=function(i){let c=0;const d=i.data.length;for(let p=0;p<d;p++)c+=i.data[p];return Math.abs(Math.ceil(c*100/d/5)-10)*n.N4};function s(r,i,c){switch(r){case e.Patterns.PATTERN000:return(i+c)%2===0;case e.Patterns.PATTERN001:return i%2===0;case e.Patterns.PATTERN010:return c%3===0;case e.Patterns.PATTERN011:return(i+c)%3===0;case e.Patterns.PATTERN100:return(Math.floor(i/2)+Math.floor(c/3))%2===0;case e.Patterns.PATTERN101:return i*c%2+i*c%3===0;case e.Patterns.PATTERN110:return(i*c%2+i*c%3)%2===0;case e.Patterns.PATTERN111:return(i*c%3+(i+c)%2)%2===0;default:throw new Error("bad maskPattern:"+r)}}e.applyMask=function(i,c){const d=c.size;for(let f=0;f<d;f++)for(let p=0;p<d;p++)c.isReserved(p,f)||c.xor(p,f,s(i,p,f))},e.getBestMask=function(i,c){const d=Object.keys(e.Patterns).length;let f=0,p=1/0;for(let m=0;m<d;m++){c(m),e.applyMask(m,i);const h=e.getPenaltyN1(i)+e.getPenaltyN2(i)+e.getPenaltyN3(i)+e.getPenaltyN4(i);e.applyMask(m,i),h<p&&(p=h,f=m)}return f}})(lg)),lg}var Hu={},x_;function C2(){if(x_)return Hu;x_=1;const e=Ax(),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 Hu.getBlocksCount=function(i,c){switch(c){case e.L:return n[(i-1)*4+0];case e.M:return n[(i-1)*4+1];case e.Q:return n[(i-1)*4+2];case e.H:return n[(i-1)*4+3];default:return}},Hu.getTotalCodewordsCount=function(i,c){switch(c){case e.L:return s[(i-1)*4+0];case e.M:return s[(i-1)*4+1];case e.Q:return s[(i-1)*4+2];case e.H:return s[(i-1)*4+3];default:return}},Hu}var ig={},ji={},b_;function B6(){if(b_)return ji;b_=1;const e=new Uint8Array(512),n=new Uint8Array(256);return(function(){let r=1;for(let i=0;i<255;i++)e[i]=r,n[r]=i,r<<=1,r&256&&(r^=285);for(let i=255;i<512;i++)e[i]=e[i-255]})(),ji.log=function(r){if(r<1)throw new Error("log("+r+")");return n[r]},ji.exp=function(r){return e[r]},ji.mul=function(r,i){return r===0||i===0?0:e[n[r]+n[i]]},ji}var v_;function I6(){return v_||(v_=1,(function(e){const n=B6();e.mul=function(r,i){const c=new Uint8Array(r.length+i.length-1);for(let d=0;d<r.length;d++)for(let f=0;f<i.length;f++)c[d+f]^=n.mul(r[d],i[f]);return c},e.mod=function(r,i){let c=new Uint8Array(r);for(;c.length-i.length>=0;){const d=c[0];for(let p=0;p<i.length;p++)c[p]^=n.mul(i[p],d);let f=0;for(;f<c.length&&c[f]===0;)f++;c=c.slice(f)}return c},e.generateECPolynomial=function(r){let i=new Uint8Array([1]);for(let c=0;c<r;c++)i=e.mul(i,new Uint8Array([1,n.exp(c)]));return i}})(ig)),ig}var cg,y_;function U6(){if(y_)return cg;y_=1;const e=I6();function n(s){this.genPoly=void 0,this.degree=s,this.degree&&this.initialize(this.degree)}return n.prototype.initialize=function(r){this.degree=r,this.genPoly=e.generateECPolynomial(this.degree)},n.prototype.encode=function(r){if(!this.genPoly)throw new Error("Encoder not initialized");const i=new Uint8Array(r.length+this.degree);i.set(r);const c=e.mod(i,this.genPoly),d=this.degree-c.length;if(d>0){const f=new Uint8Array(this.degree);return f.set(c,d),f}return c},cg=n,cg}var ug={},dg={},fg={},__;function E2(){return __||(__=1,fg.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40}),fg}var $a={},j_;function k2(){if(j_)return $a;j_=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 r="(?:(?![A-Z0-9 $%*+\\-./:]|"+s+`)(?:.|[\r
556
- ]))+`;$a.KANJI=new RegExp(s,"g"),$a.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),$a.BYTE=new RegExp(r,"g"),$a.NUMERIC=new RegExp(e,"g"),$a.ALPHANUMERIC=new RegExp(n,"g");const i=new RegExp("^"+s+"$"),c=new RegExp("^"+e+"$"),d=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return $a.testKanji=function(p){return i.test(p)},$a.testNumeric=function(p){return c.test(p)},$a.testAlphanumeric=function(p){return d.test(p)},$a}var S_;function no(){return S_||(S_=1,(function(e){const n=E2(),s=k2();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 r(i){if(typeof i!="string")throw new Error("Param is not a string");switch(i.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+i)}}e.from=function(c,d){if(e.isValid(c))return c;try{return r(c)}catch{return d}}})(dg)),dg}var w_;function H6(){return w_||(w_=1,(function(e){const n=to(),s=C2(),r=Ax(),i=no(),c=E2(),d=7973,f=n.getBCHDigit(d);function p(y,S,w){for(let _=1;_<=40;_++)if(S<=e.getCapacity(_,w,y))return _}function m(y,S){return i.getCharCountIndicator(y,S)+4}function h(y,S){let w=0;return y.forEach(function(_){const j=m(_.mode,S);w+=j+_.getBitsLength()}),w}function x(y,S){for(let w=1;w<=40;w++)if(h(y,w)<=e.getCapacity(w,S,i.MIXED))return w}e.from=function(S,w){return c.isValid(S)?parseInt(S,10):w},e.getCapacity=function(S,w,_){if(!c.isValid(S))throw new Error("Invalid QR Code version");typeof _>"u"&&(_=i.BYTE);const j=n.getSymbolTotalCodewords(S),k=s.getTotalCodewordsCount(S,w),E=(j-k)*8;if(_===i.MIXED)return E;const R=E-m(_,S);switch(_){case i.NUMERIC:return Math.floor(R/10*3);case i.ALPHANUMERIC:return Math.floor(R/11*2);case i.KANJI:return Math.floor(R/13);case i.BYTE:default:return Math.floor(R/8)}},e.getBestVersionForData=function(S,w){let _;const j=r.from(w,r.M);if(Array.isArray(S)){if(S.length>1)return x(S,j);if(S.length===0)return 1;_=S[0]}else _=S;return p(_.mode,_.getLength(),j)},e.getEncodedBits=function(S){if(!c.isValid(S)||S<7)throw new Error("Invalid QR Code version");let w=S<<12;for(;n.getBCHDigit(w)-f>=0;)w^=d<<n.getBCHDigit(w)-f;return S<<12|w}})(ug)),ug}var mg={},C_;function q6(){if(C_)return mg;C_=1;const e=to(),n=1335,s=21522,r=e.getBCHDigit(n);return mg.getEncodedBits=function(c,d){const f=c.bit<<3|d;let p=f<<10;for(;e.getBCHDigit(p)-r>=0;)p^=n<<e.getBCHDigit(p)-r;return(f<<10|p)^s},mg}var pg={},gg,E_;function V6(){if(E_)return gg;E_=1;const e=no();function n(s){this.mode=e.NUMERIC,this.data=s.toString()}return n.getBitsLength=function(r){return 10*Math.floor(r/3)+(r%3?r%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(r){let i,c,d;for(i=0;i+3<=this.data.length;i+=3)c=this.data.substr(i,3),d=parseInt(c,10),r.put(d,10);const f=this.data.length-i;f>0&&(c=this.data.substr(i),d=parseInt(c,10),r.put(d,f*3+1))},gg=n,gg}var hg,k_;function $6(){if(k_)return hg;k_=1;const e=no(),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(r){this.mode=e.ALPHANUMERIC,this.data=r}return s.getBitsLength=function(i){return 11*Math.floor(i/2)+6*(i%2)},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(i){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]),i.put(d,11)}this.data.length%2&&i.put(n.indexOf(this.data[c]),6)},hg=s,hg}var xg,N_;function G6(){if(N_)return xg;N_=1;const e=no();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(r){return r*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 r=0,i=this.data.length;r<i;r++)s.put(this.data[r],8)},xg=n,xg}var bg,R_;function Y6(){if(R_)return bg;R_=1;const e=no(),n=to();function s(r){this.mode=e.KANJI,this.data=r}return s.getBitsLength=function(i){return i*13},s.prototype.getLength=function(){return this.data.length},s.prototype.getBitsLength=function(){return s.getBitsLength(this.data.length)},s.prototype.write=function(r){let i;for(i=0;i<this.data.length;i++){let c=n.toSJIS(this.data[i]);if(c>=33088&&c<=40956)c-=33088;else if(c>=57408&&c<=60351)c-=49472;else throw new Error("Invalid SJIS character: "+this.data[i]+`
557
- Make sure your charset is UTF-8`);c=(c>>>8&255)*192+(c&255),r.put(c,13)}},bg=s,bg}var vg={exports:{}},T_;function F6(){return T_||(T_=1,(function(e){var n={single_source_shortest_paths:function(s,r,i){var c={},d={};d[r]=0;var f=n.PriorityQueue.make();f.push(r,0);for(var p,m,h,x,y,S,w,_,j;!f.empty();){p=f.pop(),m=p.value,x=p.cost,y=s[m]||{};for(h in y)y.hasOwnProperty(h)&&(S=y[h],w=x+S,_=d[h],j=typeof d[h]>"u",(j||_>w)&&(d[h]=w,f.push(h,w),c[h]=m))}if(typeof i<"u"&&typeof d[i]>"u"){var k=["Could not find a path from ",r," to ",i,"."].join("");throw new Error(k)}return c},extract_shortest_path_from_predecessor_list:function(s,r){for(var i=[],c=r;c;)i.push(c),s[c],c=s[c];return i.reverse(),i},find_path:function(s,r,i){var c=n.single_source_shortest_paths(s,r,i);return n.extract_shortest_path_from_predecessor_list(c,i)},PriorityQueue:{make:function(s){var r=n.PriorityQueue,i={},c;s=s||{};for(c in r)r.hasOwnProperty(c)&&(i[c]=r[c]);return i.queue=[],i.sorter=s.sorter||r.default_sorter,i},default_sorter:function(s,r){return s.cost-r.cost},push:function(s,r){var i={value:s,cost:r};this.queue.push(i),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=n})(vg)),vg.exports}var A_;function X6(){return A_||(A_=1,(function(e){const n=no(),s=V6(),r=$6(),i=G6(),c=Y6(),d=k2(),f=to(),p=F6();function m(k){return unescape(encodeURIComponent(k)).length}function h(k,E,R){const N=[];let M;for(;(M=k.exec(R))!==null;)N.push({data:M[0],index:M.index,mode:E,length:M[0].length});return N}function x(k){const E=h(d.NUMERIC,n.NUMERIC,k),R=h(d.ALPHANUMERIC,n.ALPHANUMERIC,k);let N,M;return f.isKanjiModeEnabled()?(N=h(d.BYTE,n.BYTE,k),M=h(d.KANJI,n.KANJI,k)):(N=h(d.BYTE_KANJI,n.BYTE,k),M=[]),E.concat(R,N,M).sort(function(O,L){return O.index-L.index}).map(function(O){return{data:O.data,mode:O.mode,length:O.length}})}function y(k,E){switch(E){case n.NUMERIC:return s.getBitsLength(k);case n.ALPHANUMERIC:return r.getBitsLength(k);case n.KANJI:return c.getBitsLength(k);case n.BYTE:return i.getBitsLength(k)}}function S(k){return k.reduce(function(E,R){const N=E.length-1>=0?E[E.length-1]:null;return N&&N.mode===R.mode?(E[E.length-1].data+=R.data,E):(E.push(R),E)},[])}function w(k){const E=[];for(let R=0;R<k.length;R++){const N=k[R];switch(N.mode){case n.NUMERIC:E.push([N,{data:N.data,mode:n.ALPHANUMERIC,length:N.length},{data:N.data,mode:n.BYTE,length:N.length}]);break;case n.ALPHANUMERIC:E.push([N,{data:N.data,mode:n.BYTE,length:N.length}]);break;case n.KANJI:E.push([N,{data:N.data,mode:n.BYTE,length:m(N.data)}]);break;case n.BYTE:E.push([{data:N.data,mode:n.BYTE,length:m(N.data)}])}}return E}function _(k,E){const R={},N={start:{}};let M=["start"];for(let A=0;A<k.length;A++){const O=k[A],L=[];for(let U=0;U<O.length;U++){const P=O[U],B=""+A+U;L.push(B),R[B]={node:P,lastCount:0},N[B]={};for(let D=0;D<M.length;D++){const H=M[D];R[H]&&R[H].node.mode===P.mode?(N[H][B]=y(R[H].lastCount+P.length,P.mode)-y(R[H].lastCount,P.mode),R[H].lastCount+=P.length):(R[H]&&(R[H].lastCount=P.length),N[H][B]=y(P.length,P.mode)+4+n.getCharCountIndicator(P.mode,E))}}M=L}for(let A=0;A<M.length;A++)N[M[A]].end=0;return{map:N,table:R}}function j(k,E){let R;const N=n.getBestModeForData(k);if(R=n.from(E,N),R!==n.BYTE&&R.bit<N.bit)throw new Error('"'+k+'" cannot be encoded with mode '+n.toString(R)+`.
558
- Suggested mode is: `+n.toString(N));switch(R===n.KANJI&&!f.isKanjiModeEnabled()&&(R=n.BYTE),R){case n.NUMERIC:return new s(k);case n.ALPHANUMERIC:return new r(k);case n.KANJI:return new c(k);case n.BYTE:return new i(k)}}e.fromArray=function(E){return E.reduce(function(R,N){return typeof N=="string"?R.push(j(N,null)):N.data&&R.push(j(N.data,N.mode)),R},[])},e.fromString=function(E,R){const N=x(E,f.isKanjiModeEnabled()),M=w(N),A=_(M,R),O=p.find_path(A.map,"start","end"),L=[];for(let U=1;U<O.length-1;U++)L.push(A.table[O[U]].node);return e.fromArray(S(L))},e.rawSplit=function(E){return e.fromArray(x(E,f.isKanjiModeEnabled()))}})(pg)),pg}var M_;function K6(){if(M_)return tg;M_=1;const e=to(),n=Ax(),s=O6(),r=z6(),i=D6(),c=L6(),d=P6(),f=C2(),p=U6(),m=H6(),h=q6(),x=no(),y=X6();function S(A,O){const L=A.size,U=c.getPositions(O);for(let P=0;P<U.length;P++){const B=U[P][0],D=U[P][1];for(let H=-1;H<=7;H++)if(!(B+H<=-1||L<=B+H))for(let Y=-1;Y<=7;Y++)D+Y<=-1||L<=D+Y||(H>=0&&H<=6&&(Y===0||Y===6)||Y>=0&&Y<=6&&(H===0||H===6)||H>=2&&H<=4&&Y>=2&&Y<=4?A.set(B+H,D+Y,!0,!0):A.set(B+H,D+Y,!1,!0))}}function w(A){const O=A.size;for(let L=8;L<O-8;L++){const U=L%2===0;A.set(L,6,U,!0),A.set(6,L,U,!0)}}function _(A,O){const L=i.getPositions(O);for(let U=0;U<L.length;U++){const P=L[U][0],B=L[U][1];for(let D=-2;D<=2;D++)for(let H=-2;H<=2;H++)D===-2||D===2||H===-2||H===2||D===0&&H===0?A.set(P+D,B+H,!0,!0):A.set(P+D,B+H,!1,!0)}}function j(A,O){const L=A.size,U=m.getEncodedBits(O);let P,B,D;for(let H=0;H<18;H++)P=Math.floor(H/3),B=H%3+L-8-3,D=(U>>H&1)===1,A.set(P,B,D,!0),A.set(B,P,D,!0)}function k(A,O,L){const U=A.size,P=h.getEncodedBits(O,L);let B,D;for(B=0;B<15;B++)D=(P>>B&1)===1,B<6?A.set(B,8,D,!0):B<8?A.set(B+1,8,D,!0):A.set(U-15+B,8,D,!0),B<8?A.set(8,U-B-1,D,!0):B<9?A.set(8,15-B-1+1,D,!0):A.set(8,15-B-1,D,!0);A.set(U-8,8,1,!0)}function E(A,O){const L=A.size;let U=-1,P=L-1,B=7,D=0;for(let H=L-1;H>0;H-=2)for(H===6&&H--;;){for(let Y=0;Y<2;Y++)if(!A.isReserved(P,H-Y)){let Q=!1;D<O.length&&(Q=(O[D]>>>B&1)===1),A.set(P,H-Y,Q),B--,B===-1&&(D++,B=7)}if(P+=U,P<0||L<=P){P-=U,U=-U;break}}}function R(A,O,L){const U=new s;L.forEach(function(Y){U.put(Y.mode.bit,4),U.put(Y.getLength(),x.getCharCountIndicator(Y.mode,A)),Y.write(U)});const P=e.getSymbolTotalCodewords(A),B=f.getTotalCodewordsCount(A,O),D=(P-B)*8;for(U.getLengthInBits()+4<=D&&U.put(0,4);U.getLengthInBits()%8!==0;)U.putBit(0);const H=(D-U.getLengthInBits())/8;for(let Y=0;Y<H;Y++)U.put(Y%2?17:236,8);return N(U,A,O)}function N(A,O,L){const U=e.getSymbolTotalCodewords(O),P=f.getTotalCodewordsCount(O,L),B=U-P,D=f.getBlocksCount(O,L),H=U%D,Y=D-H,Q=Math.floor(U/D),q=Math.floor(B/D),X=q+1,Z=Q-q,G=new p(Z);let K=0;const I=new Array(D),V=new Array(D);let $=0;const W=new Uint8Array(A.buffer);for(let te=0;te<D;te++){const ke=te<Y?q:X;I[te]=W.slice(K,K+ke),V[te]=G.encode(I[te]),K+=ke,$=Math.max($,ke)}const oe=new Uint8Array(U);let ce=0,se,ie;for(se=0;se<$;se++)for(ie=0;ie<D;ie++)se<I[ie].length&&(oe[ce++]=I[ie][se]);for(se=0;se<Z;se++)for(ie=0;ie<D;ie++)oe[ce++]=V[ie][se];return oe}function M(A,O,L,U){let P;if(Array.isArray(A))P=y.fromArray(A);else if(typeof A=="string"){let Q=O;if(!Q){const q=y.rawSplit(A);Q=m.getBestVersionForData(q,L)}P=y.fromString(A,Q||40)}else throw new Error("Invalid data");const B=m.getBestVersionForData(P,L);if(!B)throw new Error("The amount of data is too big to be stored in a QR Code");if(!O)O=B;else if(O<B)throw new Error(`
559
- The chosen QR Code version cannot contain this amount of data.
560
- Minimum version required to store current data is: `+B+`.
561
- `);const D=R(O,L,P),H=e.getSymbolSize(O),Y=new r(H);return S(Y,O),w(Y),_(Y,O),k(Y,L,0),O>=7&&j(Y,O),E(Y,D),isNaN(U)&&(U=d.getBestMask(Y,k.bind(null,Y,L))),d.applyMask(U,Y),k(Y,L,U),{modules:Y,version:O,errorCorrectionLevel:L,maskPattern:U,segments:P}}return tg.create=function(O,L){if(typeof O>"u"||O==="")throw new Error("No input text");let U=n.M,P,B;return typeof L<"u"&&(U=n.from(L.errorCorrectionLevel,n.M),P=m.from(L.version),B=d.from(L.maskPattern),L.toSJISFunc&&e.setToSJISFunction(L.toSJISFunc)),M(O,P,U,B)},tg}var yg={},_g={},O_;function N2(){return O_||(O_=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 r=s.slice().replace("#","").split("");if(r.length<3||r.length===5||r.length>8)throw new Error("Invalid hex color: "+s);(r.length===3||r.length===4)&&(r=Array.prototype.concat.apply([],r.map(function(c){return[c,c]}))),r.length===6&&r.push("F","F");const i=parseInt(r.join(""),16);return{r:i>>24&255,g:i>>16&255,b:i>>8&255,a:i&255,hex:"#"+r.slice(0,6).join("")}}e.getOptions=function(r){r||(r={}),r.color||(r.color={});const i=typeof r.margin>"u"||r.margin===null||r.margin<0?4:r.margin,c=r.width&&r.width>=21?r.width:void 0,d=r.scale||4;return{width:c,scale:c?4:d,margin:i,color:{dark:n(r.color.dark||"#000000ff"),light:n(r.color.light||"#ffffffff")},type:r.type,rendererOpts:r.rendererOpts||{}}},e.getScale=function(r,i){return i.width&&i.width>=r+i.margin*2?i.width/(r+i.margin*2):i.scale},e.getImageWidth=function(r,i){const c=e.getScale(r,i);return Math.floor((r+i.margin*2)*c)},e.qrToImageData=function(r,i,c){const d=i.modules.size,f=i.modules.data,p=e.getScale(d,c),m=Math.floor((d+c.margin*2)*p),h=c.margin*p,x=[c.color.light,c.color.dark];for(let y=0;y<m;y++)for(let S=0;S<m;S++){let w=(y*m+S)*4,_=c.color.light;if(y>=h&&S>=h&&y<m-h&&S<m-h){const j=Math.floor((y-h)/p),k=Math.floor((S-h)/p);_=x[f[j*d+k]?1:0]}r[w++]=_.r,r[w++]=_.g,r[w++]=_.b,r[w]=_.a}}})(_g)),_g}var z_;function Q6(){return z_||(z_=1,(function(e){const n=N2();function s(i,c,d){i.clearRect(0,0,c.width,c.height),c.style||(c.style={}),c.height=d,c.width=d,c.style.height=d+"px",c.style.width=d+"px"}function r(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(c,d,f){let p=f,m=d;typeof p>"u"&&(!d||!d.getContext)&&(p=d,d=void 0),d||(m=r()),p=n.getOptions(p);const h=n.getImageWidth(c.modules.size,p),x=m.getContext("2d"),y=x.createImageData(h,h);return n.qrToImageData(y.data,c,p),s(x,m,h),x.putImageData(y,0,0),m},e.renderToDataURL=function(c,d,f){let p=f;typeof p>"u"&&(!d||!d.getContext)&&(p=d,d=void 0),p||(p={});const m=e.render(c,d,p),h=p.type||"image/png",x=p.rendererOpts||{};return m.toDataURL(h,x.quality)}})(yg)),yg}var jg={},D_;function Z6(){if(D_)return jg;D_=1;const e=N2();function n(i,c){const d=i.a/255,f=c+'="'+i.hex+'"';return d<1?f+" "+c+'-opacity="'+d.toFixed(2).slice(1)+'"':f}function s(i,c,d){let f=i+c;return typeof d<"u"&&(f+=" "+d),f}function r(i,c,d){let f="",p=0,m=!1,h=0;for(let x=0;x<i.length;x++){const y=Math.floor(x%c),S=Math.floor(x/c);!y&&!m&&(m=!0),i[x]?(h++,x>0&&y>0&&i[x-1]||(f+=m?s("M",y+d,.5+S+d):s("m",p,0),p=0,m=!1),y+1<c&&i[x+1]||(f+=s("h",h),h=0)):p++}return f}return jg.render=function(c,d,f){const p=e.getOptions(d),m=c.modules.size,h=c.modules.data,x=m+p.margin*2,y=p.color.light.a?"<path "+n(p.color.light,"fill")+' d="M0 0h'+x+"v"+x+'H0z"/>':"",S="<path "+n(p.color.dark,"stroke")+' d="'+r(h,m,p.margin)+'"/>',w='viewBox="0 0 '+x+" "+x+'"',j='<svg xmlns="http://www.w3.org/2000/svg" '+(p.width?'width="'+p.width+'" height="'+p.width+'" ':"")+w+' shape-rendering="crispEdges">'+y+S+`</svg>
562
- `;return typeof f=="function"&&f(null,j),j},jg}var L_;function J6(){if(L_)return Ho;L_=1;const e=M6(),n=K6(),s=Q6(),r=Z6();function i(c,d,f,p,m){const h=[].slice.call(arguments,1),x=h.length,y=typeof h[x-1]=="function";if(!y&&!e())throw new Error("Callback required as last argument");if(y){if(x<2)throw new Error("Too few arguments provided");x===2?(m=f,f=d,d=p=void 0):x===3&&(d.getContext&&typeof m>"u"?(m=p,p=void 0):(m=p,p=f,f=d,d=void 0))}else{if(x<1)throw new Error("Too few arguments provided");return x===1?(f=d,d=p=void 0):x===2&&!d.getContext&&(p=f,f=d,d=void 0),new Promise(function(S,w){try{const _=n.create(f,p);S(c(_,d,p))}catch(_){w(_)}})}try{const S=n.create(f,p);m(null,c(S,d,p))}catch(S){m(S)}}return Ho.create=n.create,Ho.toCanvas=i.bind(null,s.render),Ho.toDataURL=i.bind(null,s.renderToDataURL),Ho.toString=i.bind(null,function(c,d,f){return r.render(c,f)}),Ho}var W6=J6();const eL=rh(W6);function tL({value:e,size:n=200}){const[s,r]=b.useState(null);return b.useEffect(()=>{let i=!0;return eL.toDataURL(e,{margin:2,width:n*2,errorCorrectionLevel:"M"}).then(c=>{i&&r(c)}).catch(()=>{i&&r(null)}),()=>{i=!1}},[e,n]),o.jsx("div",{className:"grid place-items-center rounded-lg bg-white p-3",style:{width:n+24,height:n+24},children:s?o.jsx("img",{src:s,width:n,height:n,alt:"QR"}):o.jsx("div",{className:"size-full animate-pulse rounded bg-muted"})})}function nL(e){return e.find(n=>!n.includes("127.0.0.1")&&!n.includes("localhost"))||e[0]||window.location.origin}function aL({open:e,onClose:n,onPaired:s}){const r=nt(),[i,c]=b.useState(null),[d,f]=b.useState(null),[p,m]=b.useState(0),[h,x]=b.useState(!1),y=b.useRef(null),S=b.useCallback(async()=>{c(null),f(null),x(!1);try{const E=await tl.init();c(E),m(Math.round((E.ttl_ms||9e4)/1e3))}catch(E){E instanceof rc&&E.status===403?f(C("settings.devices_pair_localhost_only")):f(E.message)}},[]);b.useEffect(()=>{e?S():(c(null),f(null),x(!1))},[e,S]),b.useEffect(()=>{if(!i||h||p<=0)return;const E=window.setTimeout(()=>m(R=>R-1),1e3);return()=>window.clearTimeout(E)},[i,p,h]),b.useEffect(()=>{if(!e||!i||h)return;let E=!0;const R=async()=>{try{const N=await tl.status(i.pairing_id);if(!E)return;if(N.status==="confirmed"){x(!0),r.success(C("settings.devices_pair_done")),s(),window.setTimeout(()=>{E&&n()},900);return}if(N.status==="expired"||N.status==="unknown"){m(0);return}}catch{}y.current=window.setTimeout(R,1500)};return y.current=window.setTimeout(R,1500),()=>{E=!1,y.current&&window.clearTimeout(y.current)}},[e,i,h,n,s,r]);const w=!!i&&!h&&p<=0,_=i?nL(i.lan_urls):"",j=i?`${_}/#pair=${i.pairing_id}`:"",k=async(E,R)=>{try{await navigator.clipboard.writeText(E),r.success(R)}catch{r.error(E)}};return o.jsxs(ma,{open:e,onClose:n,title:C("settings.devices_pair_title"),description:C("settings.devices_pair_desc"),footer:o.jsx(he,{variant:"secondary",onClick:n,children:C("common.close")}),children:[d&&o.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:d}),!d&&!i&&o.jsxs("div",{className:"flex items-center gap-2 py-8 text-sm text-muted-fg",children:[o.jsx(gr,{})," ",C("common.loading")]}),!d&&i&&o.jsxs("div",{className:"flex flex-col items-center gap-4",children:[o.jsx("div",{className:w?"opacity-40":"",children:o.jsx(tL,{value:j,size:196})}),h?o.jsx("p",{className:"text-sm font-medium text-emerald-500",children:C("settings.devices_pair_done")}):w?o.jsxs("div",{className:"flex flex-col items-center gap-2",children:[o.jsx("p",{className:"text-sm text-muted-fg",children:C("settings.devices_pair_expired")}),o.jsx(he,{variant:"primary",onClick:()=>void S(),children:C("settings.devices_pair_regen")})]}):o.jsxs(o.Fragment,{children:[o.jsx("p",{className:"text-center text-xs text-muted-fg",children:C("settings.devices_pair_scan")}),o.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-fg",children:[o.jsx(gr,{size:12}),o.jsx("span",{children:C("settings.devices_pair_waiting")}),o.jsxs("span",{className:"tabular-nums",children:["· ",C("settings.devices_pair_expires",{s:p})]})]}),o.jsxs("div",{className:"w-full space-y-3 border-t border-border pt-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-xs text-muted-fg",children:C("settings.devices_pair_link")}),o.jsxs("div",{className:"flex items-stretch gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-xs",children:j}),o.jsx(he,{size:"sm",variant:"secondary",onClick:()=>k(j,C("settings.devices_pair_copied")),title:C("settings.devices_pair_copy"),children:o.jsx(nd,{size:14})})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("p",{className:"text-xs text-muted-fg",children:C("settings.devices_pair_code")}),o.jsxs("div",{className:"flex items-stretch gap-2",children:[o.jsx("code",{className:"min-w-0 flex-1 break-all rounded-md bg-muted px-3 py-2 text-center text-sm",children:i.pairing_id}),o.jsx(he,{size:"sm",variant:"secondary",onClick:()=>k(i.pairing_id,C("settings.devices_pair_copied_code")),title:C("settings.devices_pair_copy"),children:o.jsx(nd,{size:14})})]})]})]})]})]})]})}function sL(){const e=nt(),{clients:n,isLoading:s,mutate:r}=A6(),[i,c]=b.useState(!1),d=async f=>{if(confirm(C("settings.devices_revoke_confirm",{id:f})))try{await tl.revoke(f),e.success("Cliente revocado."),r()}catch(p){e.error(p.message)}};return o.jsxs(He,{title:C("settings.devices"),description:C("settings.devices_sub"),action:o.jsxs(he,{size:"sm",variant:"primary",onClick:()=>c(!0),children:[o.jsx(gR,{size:14})," ",C("settings.devices_pair_btn")]}),children:[s&&o.jsx(Je,{}),!s&&n.length===0&&o.jsx(ot,{children:C("settings.devices_empty")}),n.length>0&&o.jsx("ul",{className:"space-y-2 text-sm",children:n.map(f=>o.jsxs("li",{className:"flex items-center gap-3 rounded-md border border-border bg-muted/30 px-3 py-2",children:[o.jsx("span",{className:"font-medium",children:f.label||f.id}),o.jsx(Ue,{tone:f.kind==="web"?"info":f.kind==="deck"?"success":"muted",children:f.kind}),o.jsxs("span",{className:"font-mono text-xs text-muted-fg",children:["…",f.token_suffix]}),o.jsxs("span",{className:"ml-auto text-xs text-muted-fg",children:["visto: ",f.last_seen?new Date(f.last_seen).toLocaleString():"nunca"]}),o.jsx(he,{size:"sm",variant:"destructive",onClick:()=>d(f.id),children:"Revocar"})]},f.id))}),o.jsx(aL,{open:i,onClose:()=>c(!1),onPaired:()=>r()})]})}const rL=[{key:"daemon",label:"Daemon",description:"~/.apx/config.json. Config general APX.",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:"Idioma",placeholder:"es"},{path:"user.locale",label:"Locale",placeholder:"es-AR"},{path:"user.timezone",label:"Timezone",placeholder:"America/Argentina/Salta"}]},{key:"super-agent",label:"Super-agente",fields:[{path:"super_agent.enabled",label:"Super-agente habilitado",kind:"boolean"},{path:"super_agent.model",label:"Modelo",placeholder:"gemini:gemini-2.5-flash"},{path:"super_agent.permission_mode",label:"Permission mode",kind:"select",options:yh.map(e=>({value:e,label:e}))},{path:"super_agent.system",label:"Prompt extra",kind:"textarea"}]},{key:"telegram",label:"Telegram",fields:[{path:"telegram.enabled",label:"Polling habilitado",kind:"boolean"},{path:"telegram.poll_interval_ms",label:"Poll interval ms",kind:"number",placeholder:"1500"},{path:"telegram.respond_with_engine",label:"Responder con 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 oL(){const{config:e,isLoading:n,patch:s,mutate:r}=yr();if(n)return o.jsx(Je,{});const i=async c=>{const d={};for(const[f,p]of Object.entries(wx(c)))Da(p)||(d[f]=p);await s(d),r()};return o.jsx(He,{title:"Config APX",description:"Config general en ~/.apx/config.json. Editable por tabs; JSON queda separado.",children:o.jsx(th,{sections:rL,source:e,jsonTitle:"~/.apx/config.json",jsonDescription:"Secretos redacted no se sobrescriben.",onSaveFields:async(c,d)=>{await s(c,d),r()},onSaveJson:i})})}function lL(){const e=nt(),{health:n,isUp:s}=Dw(),r=async()=>{try{await el.reload(),e.success("Config recargada.")}catch(i){e.error(i.message)}};return o.jsxs("div",{className:"space-y-6",children:[o.jsx(He,{title:C("daemon.version"),action:o.jsx(he,{size:"sm",onClick:r,children:C("common.reload")}),children:o.jsxs("div",{className:"grid grid-cols-3 gap-3 text-sm",children:[o.jsx(Sg,{label:C("daemon.version"),value:n?.version||"—"}),o.jsx(Sg,{label:C("daemon.uptime"),value:n?`${n.uptime_s}s`:"—"}),o.jsx(Sg,{label:C("daemon.status"),value:C(s?"daemon.running":"daemon.down"),ok:s})]})}),o.jsx(oL,{})]})}function Sg({label:e,value:n,ok:s}){return o.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[o.jsx("div",{className:"text-xs uppercase tracking-wide text-muted-fg",children:e}),o.jsxs("div",{className:"mt-1 flex items-center gap-2 text-base font-medium",children:[s!==void 0&&o.jsx(Xd,{ok:s}),o.jsx("span",{children:n})]})]})}function iL(){const e=nt(),{theme:n,set:s}=_h(),[r,i]=b.useState(""),[c,d]=b.useState(k5()),f=()=>{const m=r.trim();if(m){Hr(m);try{localStorage.setItem(Cn.token,m)}catch{}i(""),e.success(C("settings.token_saved"))}},p=m=>{C5(m),d(m),window.location.reload()};return o.jsxs("div",{className:"space-y-6",children:[o.jsx(He,{title:C("settings.appearance"),children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(he,{variant:n==="light"?"primary":"secondary",onClick:()=>s("light"),children:C("settings.light_mode")}),o.jsx(he,{variant:n==="dark"?"primary":"secondary",onClick:()=>s("dark"),children:C("settings.dark_mode")})]})}),o.jsx(He,{title:C("settings.language"),children:o.jsx("div",{className:"flex items-center gap-2",children:E5.map(m=>o.jsx(he,{variant:c===m.value?"primary":"secondary",onClick:()=>p(m.value),children:m.label},m.value))})}),o.jsxs(He,{title:C("settings.token"),description:C("settings.token_sub"),children:[o.jsx(fe,{label:"Bearer",children:o.jsx(Ce,{type:"password",placeholder:sx()?C("settings.token_active"):C("settings.token_paste"),value:r,onChange:m=>i(m.target.value),className:"font-mono",onKeyDown:m=>{m.key==="Enter"&&f()}})}),o.jsx("div",{className:"mt-2",children:o.jsx(he,{variant:"primary",onClick:f,children:C("common.save")})})]})]})}const cL=[{title:C("settings.account_section"),items:[{key:"identity",label:C("settings.tabs.identity"),icon:wj},{key:"appearance",label:C("settings.appearance"),icon:fR}]},{title:C("settings.agents_section"),items:[{key:"super_agent",label:C("settings.tabs.super_agent"),icon:vn},{key:"engines",label:C("settings.tabs.engines"),icon:gh},{key:"memory",label:"Memoria (RAG)",icon:xj}]},{title:C("settings.channels_section"),items:[{key:"telegram",label:C("settings.tabs.telegram"),icon:Za},{key:"devices",label:C("settings.tabs.devices"),icon:xR}]},{title:C("settings.advanced_section"),items:[{key:"advanced",label:C("settings.tabs.advanced"),icon:Tg}]}],uL=new Set(["engines","telegram"]),dL={identity:()=>o.jsx(_6,{}),super_agent:()=>o.jsx(j6,{}),engines:()=>o.jsx(o2,{}),memory:()=>o.jsx(C6,{}),telegram:()=>o.jsx(T6,{}),devices:()=>o.jsx(sL,{}),appearance:()=>o.jsx(iL,{}),advanced:()=>o.jsx(lL,{})};function fL(){const e=Ia(),n=ea(),s=mL(n.pathname),r=dL[s],{collapsed:i,toggle:c}=Iw(Cn.sidebarCollapsed+".settings");return o.jsx($w,{sections:cL,active:s,onChange:d=>e(d==="identity"?"/settings":`/settings/${pL(d)}`),collapsed:i,onToggleCollapse:c,contentClassName:`mx-auto w-full ${uL.has(s)?"max-w-6xl":"max-w-3xl"} space-y-6 p-6 pt-3`,testId:`settings-tab-${s}`,children:o.jsx(r,{})})}function mL(e){switch(e.split("/").filter(Boolean)[1]||"identity"){case"super-agent":return"super_agent";case"engines":return"engines";case"memory":return"memory";case"telegram":return"telegram";case"devices":return"devices";case"appearance":return"appearance";case"config":case"advanced":return"advanced";default:return"identity"}}function pL(e){return e==="super_agent"?"super-agent":e==="advanced"?"config":e}function gL({engines:e,order:n,mode:s,configuredProvider:r,onSetMode:i,onSetDefault:c,onToggleEnabled:d,onReorder:f,onConfigure:p,busy:m}){const h=new Map(e.map(w=>[w.id,w])),x=[...n.filter(w=>h.has(w)),...e.map(w=>w.id).filter(w=>!n.includes(w))],y=s==="chain",S=(w,_)=>{const j=x.indexOf(w),k=j+_;if(j<0||k<0||k>=x.length)return;const E=[...x];[E[j],E[k]]=[E[k],E[j]],f(E)};return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"rounded-lg border border-border p-3",children:o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-sm font-medium",children:"Modo de selección"}),o.jsx("div",{className:"text-xs text-muted-fg",children:y?"Cadena con fallback: usa el primer motor disponible según el orden de abajo.":"Solo el motor por defecto: usa siempre el elegido; los demás quedan configurados para otras cosas."})]}),o.jsxs("div",{className:"flex shrink-0 overflow-hidden rounded-md border border-border",role:"group",children:[o.jsx("button",{type:"button",onClick:()=>i("chain"),disabled:m,"data-testid":"voice-mode-chain",className:Ae("px-3 py-1.5 text-xs font-medium transition-colors",y?"bg-emerald-500/15 text-emerald-300":"text-muted-fg hover:text-fg"),children:"Cadena (router)"}),o.jsx("button",{type:"button",onClick:()=>i("single"),disabled:m,"data-testid":"voice-mode-single",className:Ae("border-l border-border px-3 py-1.5 text-xs font-medium transition-colors",y?"text-muted-fg hover:text-fg":"bg-emerald-500/15 text-emerald-300"),children:"Solo el motor por defecto"})]})]})}),o.jsx("div",{className:"space-y-2",children:x.map((w,_)=>{const j=h.get(w),k=vd[w]||{name:w,note:""},E=!y&&r===w,R=w==="mock";return o.jsxs("div",{"data-testid":`voice-provider-${w}`,className:Ae("flex items-center gap-3 rounded-lg border px-3 py-2.5",E?"border-emerald-500/50 bg-emerald-500/10":"border-border",y&&!R&&!j.enabled&&"opacity-60"),children:[y&&o.jsxs("div",{className:"flex flex-col",children:[o.jsx("button",{type:"button",onClick:()=>S(w,-1),disabled:m||_===0,"aria-label":"Subir","data-testid":`voice-provider-${w}-up`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:o.jsx(gj,{className:"size-3.5"})}),o.jsx("button",{type:"button",onClick:()=>S(w,1),disabled:m||_===x.length-1,"aria-label":"Bajar","data-testid":`voice-provider-${w}-down`,className:"text-muted-fg hover:text-fg disabled:opacity-30",children:o.jsx(Jr,{className:"size-3.5"})})]}),o.jsx(Xd,{ok:j.available?!0:j.configured?!1:null}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-medium",children:k.name}),k.local&&o.jsx(Ue,{tone:"info",children:"local"}),j.available?o.jsx(Ue,{tone:"success",children:"disponible"}):j.configured?o.jsx(Ue,{tone:"warning",children:"configurado, no disponible"}):o.jsx(Ue,{tone:"muted",children:"sin configurar"}),E&&o.jsx(Ue,{tone:"success",children:"por defecto"})]}),o.jsx("div",{className:"truncate text-xs text-muted-fg",children:k.note})]}),o.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y?o.jsx(sn,{checked:R?!0:j.enabled,onChange:N=>d(w,N),disabled:m||R}):!E&&o.jsxs(he,{size:"sm",variant:"ghost",onClick:()=>c(w),disabled:m,"data-testid":`voice-provider-${w}-default`,children:[o.jsx(DN,{className:"size-3.5"})," Usar por defecto"]}),E&&o.jsx(hj,{className:"size-4 text-emerald-400"}),o.jsxs(he,{size:"sm",variant:"secondary",onClick:()=>p(w),"data-testid":`voice-provider-${w}-config`,children:[o.jsx(hR,{className:"size-3.5"})," Configurar"]})]})]},w)})})]})}function Ca(e){return typeof e=="string"?e:e==null?"":String(e)}function hL({open:e,providerId:n,config:s,onClose:r,onSave:i}){const[c,d]=b.useState(!1),[f,p]=b.useState(null),[m,h]=b.useState(""),[x,y]=b.useState({});if(b.useEffect(()=>{if(!e||!n)return;p(null),h("");const N=s||{};if(n==="piper"){const M=N;y({bin:Ca(M.bin),model:Ca(M.model),speaker:Ca(M.speaker)})}else if(n==="elevenlabs"){const M=N;y({model:Ca(M.model),voice_id:Ca(M.voice_id),output_format:Ca(M.output_format)})}else if(n==="openai"){const M=N;y({model:Ca(M.model)||"tts-1",voice:Ca(M.voice)||"alloy",format:Ca(M.format)||"mp3"})}else if(n==="gemini"){const M=N;y({model:Ca(M.model),voice:Ca(M.voice)||"Kore",style:Ca(M.style)})}else y({})},[e,n,s]),!n)return null;const S=vd[n],w=`voice.tts.${n}`,_=N=>y(M=>({...M,...N})),j=n!=="piper"&&n!=="mock",k=j&&Da(s?.api_key),E=k?`…${al(s?.api_key)??""} (ya seteada)`:"API key",R=async()=>{d(!0),p(null);try{const N={},M=[],A=(O,L)=>{L.trim()?N[`${w}.${O}`]=L.trim():M.push(`${w}.${O}`)};n==="piper"?(A("bin",x.bin),A("model",x.model),x.speaker.trim()?N[`${w}.speaker`]=x.speaker.trim():M.push(`${w}.speaker`)):n==="elevenlabs"?(A("model",x.model),A("voice_id",x.voice_id),A("output_format",x.output_format)):n==="openai"?(A("model",x.model),A("voice",x.voice),A("format",x.format)):n==="gemini"&&(A("model",x.model),A("voice",x.voice),A("style",x.style)),j&&m.trim()&&(N[`${w}.api_key`]=m.trim()),await i({set:N,unset:M}),r()}catch(N){p(N.message||"Error al guardar.")}finally{d(!1)}};return o.jsx(ma,{open:e,onClose:r,title:`Configurar ${S?.name||n}`,description:S?.note,size:"md",footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:r,disabled:c,children:"Cancelar"}),o.jsx(he,{variant:"primary",onClick:R,loading:c,"data-testid":"voice-provider-save",children:"Guardar"})]}),children:o.jsxs("div",{className:"space-y-3",children:[n==="piper"&&o.jsxs(o.Fragment,{children:[o.jsx(fe,{label:"Binario (bin)",hint:"Ruta o nombre del CLI piper (PATH).",children:o.jsx(Ce,{value:x.bin,onChange:N=>_({bin:N.target.value}),placeholder:"piper"})}),o.jsx(fe,{label:"Modelo (.onnx)",hint:"Ruta absoluta al modelo de voz piper.",children:o.jsx(Ce,{value:x.model,onChange:N=>_({model:N.target.value}),placeholder:"/abs/path/voz.onnx"})}),o.jsx(fe,{label:"Speaker (opcional)",hint:"Id de hablante para modelos multi-voz.",children:o.jsx(Ce,{value:x.speaker,onChange:N=>_({speaker:N.target.value}),placeholder:"0"})})]}),n==="elevenlabs"&&o.jsxs(o.Fragment,{children:[o.jsx(fe,{label:"API key",hint:k?"Dejá en blanco para mantener la actual.":"Se guarda como secreto. Env: ELEVENLABS_API_KEY",children:o.jsx(Ce,{type:"password",autoComplete:"new-password",value:m,onChange:N=>h(N.target.value),placeholder:E})}),o.jsx(fe,{label:"Modelo",children:o.jsx(Ct,{value:x.model||"",onChange:N=>_({model:N}),options:x5.map(N=>({value:N,label:N})),placeholder:"eleven_multilingual_v2"})}),o.jsx(fe,{label:"Voice ID",hint:"Id de la voz de ElevenLabs (vacío = default).",children:o.jsx(Ce,{value:x.voice_id,onChange:N=>_({voice_id:N.target.value}),placeholder:"EXAVITQu4vr4xnSDxMaL"})}),o.jsx(fe,{label:"Formato de salida",children:o.jsx(Ce,{value:x.output_format,onChange:N=>_({output_format:N.target.value}),placeholder:"mp3_44100_128"})})]}),n==="openai"&&o.jsxs(o.Fragment,{children:[o.jsx(fe,{label:"API key",hint:k?"Dejá en blanco para mantener la actual.":"Se reusa engines.openai.api_key si la dejás en blanco. Env: OPENAI_API_KEY",children:o.jsx(Ce,{type:"password",autoComplete:"new-password",value:m,onChange:N=>h(N.target.value),placeholder:E})}),o.jsx(fe,{label:"Modelo",children:o.jsx(Ct,{value:x.model||"tts-1",onChange:N=>_({model:N}),options:b5.map(N=>({value:N,label:N}))})}),o.jsx(fe,{label:"Voz",children:o.jsx(Ct,{value:x.voice||"alloy",onChange:N=>_({voice:N}),options:g5.map(N=>({value:N,label:N}))})}),o.jsx(fe,{label:"Formato",children:o.jsx(Ct,{value:x.format||"mp3",onChange:N=>_({format:N}),options:["mp3","opus","aac","flac","wav"].map(N=>({value:N,label:N}))})})]}),n==="gemini"&&o.jsxs(o.Fragment,{children:[o.jsx(fe,{label:"API key",hint:k?"Dejá en blanco para mantener la actual.":"Se reusa engines.gemini.api_key si la dejás en blanco. Env: GEMINI_API_KEY",children:o.jsx(Ce,{type:"password",autoComplete:"new-password",value:m,onChange:N=>h(N.target.value),placeholder:E})}),o.jsx(fe,{label:"Modelo",hint:"TTS de Gemini sigue en preview.",children:o.jsx(Ce,{value:x.model,onChange:N=>_({model:N.target.value}),placeholder:"gemini-2.5-flash-preview-tts"})}),o.jsx(fe,{label:"Voz",children:o.jsx(Ct,{value:x.voice||"Kore",onChange:N=>_({voice:N}),options:h5.map(N=>({value:N,label:N}))})}),o.jsx(fe,{label:"Estilo (cómo querés que hable)",hint:"Instrucción en lenguaje natural. Vacío = sin estilo. Ej: 'hablá en tono alegre y pausado'.",children:o.jsx(Qt,{rows:2,value:x.style||"",onChange:N=>_({style:N.target.value}),placeholder:"hablá en tono alegre y enérgico"})})]}),n==="mock"&&o.jsxs("p",{className:"text-sm text-muted-fg",children:["El motor ",o.jsx("strong",{children:"mock"})," genera un WAV silencioso de prueba. No tiene parámetros: sirve como fallback garantizado cuando no hay otro motor configurado."]}),f&&o.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f})]})})}function xL(){const e=b.useRef(null),n=b.useRef(null),[s,r]=b.useState(!1),[i,c]=b.useState(!1),d=b.useCallback(()=>{n.current&&(URL.revokeObjectURL(n.current),n.current=null)},[]);b.useEffect(()=>()=>{e.current&&(e.current.pause(),e.current=null),d()},[d]);const f=b.useCallback(async m=>{c(!0);try{d();const h=await y5(m);n.current=h,e.current||(e.current=new Audio);const x=e.current;x.src=h,x.onended=()=>r(!1),x.onerror=()=>r(!1),await x.play(),r(!0)}finally{c(!1)}},[d]),p=b.useCallback(()=>{e.current&&(e.current.pause(),e.current.currentTime=0),r(!1)},[]);return{play:f,stop:p,playing:s,loading:i}}function bL({engines:e,defaultProvider:n,mode:s}){const r=nt(),{play:i,stop:c,playing:d,loading:f}=xL(),[p,m]=b.useState("Hola, soy APX. Esto es una prueba de voz."),[h,x]=b.useState(""),[y,S]=b.useState(""),[w,_]=b.useState(!1),[j,k]=b.useState(null),R=[{value:"",label:s==="single"&&n&&n!=="auto"?`Por defecto (${vd[n]?.name||n})`:"Por defecto (cadena)"},...e.map(M=>({value:M.id,label:`${vd[M.id]?.name||M.id}${M.available?"":" · no disponible"}`}))],N=async()=>{const M=p.trim();if(!M){r.error("Escribí algo para decir.");return}_(!0);try{const A=await dw.say({text:M,provider:h||void 0,style:y.trim()||void 0});k(A),await i(A.audio_path)}catch(A){r.error(A.message||"No se pudo sintetizar.")}finally{_(!1)}};return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[o.jsx(fe,{label:"Motor",hint:"Override del por defecto para probar.",children:o.jsx(Ct,{value:h,onChange:x,options:R})}),o.jsx(fe,{label:"Estilo (solo Gemini)",hint:"Cómo querés que hable. Vacío = sin estilo.",children:o.jsx(Ce,{value:y,onChange:M=>S(M.target.value),placeholder:"hablá en tono alegre y enérgico","data-testid":"voice-test-style"})})]}),o.jsx(fe,{label:"Texto a decir",children:o.jsx(Qt,{rows:2,value:p,onChange:M=>m(M.target.value),placeholder:"Escribí lo que querés que diga…","data-testid":"voice-test-input"})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(he,{variant:"primary",onClick:N,loading:w,disabled:f,"data-testid":"voice-test-say",children:[o.jsx(yR,{className:"size-4"})," Decir esto"]}),d?o.jsxs(he,{variant:"secondary",onClick:c,"data-testid":"voice-test-stop",children:[o.jsx(jj,{className:"size-4"})," Parar"]}):j?o.jsxs(he,{variant:"secondary",onClick:()=>i(j.audio_path),loading:f,"data-testid":"voice-test-replay",children:[o.jsx(bh,{className:"size-4"})," Repetir"]}):null,j&&o.jsxs("span",{className:"text-xs text-muted-fg",children:["Motor: ",o.jsx("strong",{children:j.provider}),j.duration_s?` · ${j.duration_s.toFixed(1)}s`:""]})]})]})}const vL=[{value:"auto",label:"Automático (local, luego OpenAI)"},{value:"local",label:"Local — faster-whisper (offline)"},{value:"openai",label:"OpenAI — Whisper-1 (cloud)"}],yL=[{value:"auto",label:"Auto-detectar"},{value:"es",label:"Español"},{value:"en",label:"Inglés"},{value:"pt",label:"Portugués"},{value:"fr",label:"Francés"},{value:"it",label:"Italiano"},{value:"de",label:"Alemán"}];function _L({config:e,onPatch:n,busy:s}){const r=e.provider||"auto",i=e.local||{},c=i.model||"small",d=i.language||"auto",f=r!=="openai";return o.jsxs("div",{className:"space-y-3",children:[o.jsx(fe,{label:"Motor de transcripción",hint:"Local usa faster-whisper (requiere python3 + faster-whisper). OpenAI usa la key de engines.openai.",children:o.jsx(Ct,{value:r,onChange:p=>n({"transcription.provider":p}),options:vL,disabled:s,className:"max-w-md"})}),f&&o.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[o.jsx(fe,{label:"Modelo local (whisper)",hint:"Más grande = más preciso y más lento.",children:o.jsx(Ct,{value:c,onChange:p=>n({"transcription.local.model":p}),options:v5.map(p=>({value:p,label:p})),disabled:s})}),o.jsx(fe,{label:"Idioma",hint:'Para español, fijá "Español" mejora la precisión.',children:o.jsx(Ct,{value:d,onChange:p=>n({"transcription.local.language":p}),options:yL,disabled:s})})]})]})}function jL(){const e=nt(),{config:n,isLoading:s,patch:r,mutate:i}=yr(),{data:c,isLoading:d,error:f,mutate:p}=Xe("/tts/providers",()=>dw.providers()),[m,h]=b.useState(null),[x,y]=b.useState(!1),S=n,w=S.voice?.tts||{},_=S.transcription||{},j=c?.configured_provider||w.provider||"auto",k=c?.mode||w.mode||"chain",E=c?.engines||[],R=c?.order||[],N=b.useMemo(()=>m?w[m]||{}:{},[m,w]),M=async B=>{y(!0);try{await r({"voice.tts.provider":B,"voice.tts.mode":"single"}),await p(),e.success(`Motor por defecto: ${B}.`)}catch(D){e.error(D.message)}finally{y(!1)}},A=async B=>{y(!0);try{const D={"voice.tts.mode":B};if(B==="single"&&(j==="auto"||!j)){const H=E.find(Y=>Y.available)?.id||R[0]||"mock";D["voice.tts.provider"]=H}await r(D),await p(),e.success(B==="chain"?"Modo: cadena con fallback.":"Modo: solo el motor por defecto.")}catch(D){e.error(D.message)}finally{y(!1)}},O=async(B,D)=>{y(!0);try{await r({[`voice.tts.${B}.enabled`]:D}),await p()}catch(H){e.error(H.message)}finally{y(!1)}},L=async B=>{y(!0);try{await r({"voice.tts.order":B}),await p()}catch(D){e.error(D.message)}finally{y(!1)}},U=async({set:B,unset:D})=>{await r(B,D.length?D:void 0),await p(),await i(),e.success("Configuración de voz guardada.")},P=async(B,D)=>{try{await r(B,D),e.success("Transcripción actualizada.")}catch(H){e.error(H.message)}};return o.jsxs("div",{className:"mx-auto max-w-6xl p-6","data-testid":"screen-voice",children:[o.jsxs("div",{className:"grid gap-6 xl:grid-cols-2",children:[o.jsx(He,{title:"Proveedores de voz (TTS)",description:"Motores de síntesis. El estado lo reporta el daemon en vivo. Elegí cuál usar por defecto.",children:d||s?o.jsx(Je,{}):f?o.jsxs(ot,{children:["No se pudieron cargar los proveedores: ",f.message]}):o.jsx(gL,{engines:E,order:R,mode:k,configuredProvider:j,onSetMode:A,onSetDefault:M,onToggleEnabled:O,onReorder:L,onConfigure:B=>h(B),busy:x})}),o.jsxs("div",{className:"space-y-6",children:[o.jsx(He,{title:"Probar voz",description:"Elegí con qué motor sintetizar y, si aplica, cómo querés que hable.",children:o.jsx(bL,{engines:E,defaultProvider:j,mode:k})}),o.jsx(He,{title:"Transcripción (STT)",description:"Motor de voz a texto que usan el deck, Telegram y la CLI al escuchar.",children:s?o.jsx(Je,{}):o.jsx(_L,{config:_,onPatch:P})})]})]}),o.jsx(hL,{open:!!m,providerId:m,config:N,onClose:()=>h(null),onSave:U})]})}const wg={status:()=>ge.get("/desktop/status"),autostartGet:()=>ge.get("/desktop/autostart"),autostartSet:e=>ge.post("/desktop/autostart",{enable:e})};function SL(e=30){return ge.get(`/messages/global?channel=desktop&limit=${e}`)}const P_="CommandOrControl+G",wL=[{value:"left",label:"Izquierda"},{value:"center",label:"Centro"},{value:"right",label:"Derecha"}],CL=[{value:"light",label:"Claro"},{value:"dark",label:"Oscuro"}];function EL(){const e=nt(),{config:n,isLoading:s,patch:r}=yr(),i=n,c=i.desktop?.shortcut||i.overlay?.shortcut||P_,d=i.desktop?.enabled!==!1,f=i.desktop?.theme||"light",p=i.desktop?.position||"right",{data:m,isLoading:h,mutate:x}=Xe("/desktop/status",()=>wg.status(),{refreshInterval:5e3}),y=!!m?.running,{data:S,mutate:w}=Xe("/desktop/autostart",()=>wg.autostartGet()),{data:_,isLoading:j,mutate:k}=Xe("/messages/global?channel=desktop",()=>SL(40),{refreshInterval:8e3}),[E,R]=b.useState(c),[N,M]=b.useState(!1),[A,O]=b.useState(!1);b.useEffect(()=>R(c),[c]);const L=async()=>{const B=E.trim();if(!(!B||B===c)){M(!0);try{await r({"desktop.shortcut":B}),e.success("Atajo guardado. Reiniciá la ventana (apx desktop stop && start) para aplicarlo.")}catch(D){e.error(D.message)}finally{M(!1)}}},U=async(B,D,H)=>{M(!0);try{await r({[B]:D}),e.success(H)}catch(Y){e.error(Y.message)}finally{M(!1)}},P=async B=>{O(!0);try{await wg.autostartSet(B),await w(),e.success(B?"Autostart activado para el próximo login.":"Autostart desactivado.")}catch(D){e.error(D.message)}finally{O(!1)}};return o.jsx("div",{className:"mx-auto max-w-6xl space-y-6 p-6","data-testid":"screen-desktop",children:o.jsxs("div",{className:"grid gap-6 xl:grid-cols-[1fr_1fr]",children:[o.jsxs("div",{className:"space-y-6",children:[o.jsxs(He,{title:"Estado",description:"La ventana se lanza desde la terminal o por autostart.",children:[h?o.jsx(Je,{}):o.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[o.jsx(Xd,{ok:y}),o.jsx("span",{className:"font-medium",children:y?"En ejecución":"Detenida"}),o.jsx("button",{type:"button",onClick:()=>x(),className:"ml-2 text-xs text-muted-fg underline-offset-2 hover:underline",children:"refrescar"})]}),o.jsxs("p",{className:"mt-3 text-xs text-muted-fg",children:["Desde terminal: ",o.jsx(M1,{children:"apx desktop start"})," · ",o.jsx(M1,{children:"apx desktop --debug"})]})]}),o.jsx(He,{title:"Arranque automático",description:"Lanza la ventana al iniciar sesión del usuario. Equivalente a `apx desktop install` (no requiere sudo).",children:S?o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx(sn,{checked:S.enabled,onChange:P,disabled:A,label:S.enabled?"Activado":"Desactivado"}),o.jsxs("span",{className:"text-xs text-muted-fg",children:["platform: ",S.platform]})]}):o.jsx(Je,{})}),o.jsx(He,{title:"Atajo de teclado",description:"Botón de acceso rápido global que muestra/oculta la ventana y arranca a escuchar.",children:s?o.jsx(Je,{}):o.jsxs("div",{className:"flex items-end gap-3",children:[o.jsx("div",{className:"flex-1",children:o.jsx(fe,{label:"Acelerador",hint:'Formato Electron, p. ej. "CommandOrControl+G" o "CommandOrControl+Shift+Space". Reiniciá la ventana para aplicar.',children:o.jsx(Ce,{value:E,onChange:B=>R(B.target.value),onKeyDown:B=>{B.key==="Enter"&&L()},placeholder:P_,className:"max-w-md font-mono",disabled:N})})}),o.jsx(he,{variant:"primary",onClick:L,loading:N,disabled:!E.trim()||E.trim()===c,children:"Guardar"})]})}),o.jsx(He,{title:"Apariencia",description:"Tema y posición de la ventana en la pantalla.",children:s?o.jsx(Je,{}):o.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[o.jsx(fe,{label:"Tema",hint:"Reiniciá la ventana para aplicar.",children:o.jsx(Ct,{value:f,onChange:B=>U("desktop.theme",B,`Tema: ${B}.`),options:CL,disabled:N})}),o.jsx(fe,{label:"Posición",hint:'"izquierda" / "centro" / "derecha" del borde superior.',children:o.jsx(Ct,{value:p,onChange:B=>U("desktop.position",B,`Posición: ${B}.`),options:wL,disabled:N})})]})}),o.jsx(He,{title:"Activación + transcripción",description:"El plugin del daemon procesa los mensajes. STT se configura en Voces.",children:s?o.jsx(Je,{}):o.jsxs("div",{className:"space-y-3",children:[o.jsx(sn,{checked:d,onChange:B=>U("desktop.enabled",B,B?"Desktop activado.":"Desktop desactivado."),disabled:N,label:d?"Plugin activado (responde mensajes)":"Plugin desactivado"}),o.jsxs("p",{className:"text-xs text-muted-fg",children:["Motor de voz a texto: ",o.jsx(ph,{to:"/m/voice",className:"font-medium text-fg underline underline-offset-2",children:"Voces"})," ","(whisper local, idioma, modelo)."]})]})})]}),o.jsx("div",{children:o.jsx(He,{title:"Última conversación",description:"Lo último charlado con el agente desde la ventana flotante.",action:o.jsx("button",{type:"button",onClick:()=>k(),className:"text-xs text-muted-fg underline-offset-2 hover:underline",children:"refrescar"}),children:o.jsx(kL,{messages:_||[],loading:j})})})]})})}function kL({messages:e,loading:n}){const s=b.useMemo(()=>RL(e),[e]);return n?o.jsx(Je,{}):e.length?o.jsx("div",{className:"space-y-3 max-h-[560px] overflow-y-auto pr-1",children:s.slice().reverse().map((r,i)=>o.jsx("div",{className:"rounded-lg border border-border bg-card/40 p-3",children:r.map((c,d)=>o.jsx(NL,{m:c},d))},i))}):o.jsx(ot,{children:"Sin mensajes todavía. Mandale algo a la ventana de escritorio para que aparezca aquí."})}function NL({m:e}){const n=e.direction==="in",s=TL(e.ts);return o.jsxs("div",{className:"py-1",children:[o.jsxs("div",{className:"flex items-baseline gap-2 text-[11px] text-muted-fg",children:[o.jsx("span",{className:"font-semibold",children:n?"Vos":"Roby"}),o.jsx("span",{children:s})]}),o.jsx("div",{className:"mt-0.5 text-sm leading-snug whitespace-pre-wrap "+(n?"text-muted-fg":"text-fg"),children:(e.body||"").trim()||o.jsx("span",{className:"italic opacity-50",children:"(vacío)"})})]})}function RL(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 TL(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 AL(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 ML({manifest:e}){const n=e.daemon,s=e.safety;return o.jsxs("div",{"data-testid":"deck-daemon-card",className:"rounded-xl border border-border bg-muted/10 px-4 py-3 text-xs",children:[o.jsxs("div",{className:"mb-2 flex flex-wrap items-center justify-between gap-2",children:[o.jsxs("span",{className:"font-semibold text-foreground",children:[n.name," ",o.jsxs("span",{className:"font-normal text-muted-fg",children:["v",n.version]})]}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("span",{className:"size-2 rounded-full bg-emerald-500"}),o.jsxs("span",{className:"text-muted-fg",children:["activo · ",AL(n.uptime_s)]})]})]}),o.jsxs("div",{className:"flex flex-wrap gap-2",children:[o.jsxs("span",{className:"text-muted-fg",children:[n.host,":",n.port]}),o.jsx("span",{className:"text-muted-fg",children:"·"}),o.jsxs("span",{className:"text-muted-fg",children:["iniciado"," ",new Date(n.started_at).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),o.jsxs("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:[s.direct_shell===!1&&o.jsx(Ue,{tone:"success",children:"sin shell directo"}),s.arbitrary_commands===!1&&o.jsx(Ue,{tone:"success",children:"comandos arbitrarios bloqueados"}),s.dangerous_actions_require_confirmation&&o.jsx(Ue,{tone:"info",children:"acciones peligrosas requieren confirmación"})]})]})}function OL(e){return e==="available"?"success":e==="configured"?"info":"muted"}function zL(e){return e==="available"?"activo":e==="configured"?"configurado":e==="disabled"?"deshabilitado":"sin configurar"}function DL(e){return e==="voice"?"warning":e==="plugin"?"info":"muted"}function LL({widget:e,onToggle:n}){const s=e.source==="external",[r,i]=b.useState(!1),c=e.user_enabled===!0,d=async f=>{if(!(!n||r)){i(!0);try{await n(f)}finally{i(!1)}}};return o.jsxs("li",{"data-testid":`deck-widget-${e.id}`,className:Ae("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:[o.jsx("span",{title:e.source==="apx"?"Widget nativo APX":"Widget externo",className:Ae("size-2 shrink-0 rounded-full",e.source==="apx"?"bg-emerald-500":"bg-sky-400")}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"font-medium",children:e.title}),o.jsx("span",{className:"ml-2 text-xs text-muted-fg",children:e.desktop})]}),o.jsx(Ue,{tone:DL(e.kind),children:e.kind}),o.jsx(Ue,{tone:OL(e.status),children:zL(e.status)}),s?o.jsx("span",{"data-testid":`deck-widget-toggle-${e.id}`,children:o.jsx(sn,{checked:c,onChange:d,disabled:r||!n})}):o.jsx("span",{className:"w-9 shrink-0","aria-hidden":!0})]})}function PL({desktop:e,widgets:n,onToggle:s}){return n.length===0?null:o.jsxs("div",{"data-testid":`deck-desktop-${e.id}`,className:"space-y-1.5",children:[o.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-fg",children:e.title}),o.jsx("ul",{className:"space-y-1.5",children:n.map(r=>o.jsx(LL,{widget:r,onToggle:r.source==="external"?i=>s(r.id,i):void 0},r.id))})]})}function BL(){const e=nt(),{data:n,error:s,isLoading:r,mutate:i}=Xe("/deck/manifest",()=>A1.manifest(),{refreshInterval:3e4}),c=async(x,y)=>{try{await A1.setWidget(x,{enabled:y}),await i(S=>S&&{...S,deck:{...S.deck,widgets:S.deck.widgets.map(w=>w.id===x?{...w,user_enabled:y,status:y?w.daemon_status?"available":"configured":"disabled"}:w)}},{revalidate:!1}),e.success(y?`Widget ${x} habilitado.`:`Widget ${x} deshabilitado.`),setTimeout(()=>i(),800)}catch(S){const w=S instanceof Error?S.message:"Error al guardar";e.error(w)}},d=n?.deck.desktops??[],f=n?.deck.widgets??[],p=d.map(x=>({desktop:x,widgets:f.filter(y=>y.desktop===x.id)})),h=f.filter(x=>x.source==="external").filter(x=>x.user_enabled===!0).length;return o.jsxs("div",{className:"mx-auto max-w-4xl space-y-6 p-6","data-testid":"screen-deck",children:[n&&o.jsx(ML,{manifest:n}),o.jsxs(He,{title:"Widgets",description:r?"Cargando manifest…":s?"Error al cargar el manifest.":`${f.length} widgets · ${h} externos habilitados`,action:o.jsx(he,{size:"sm",variant:"ghost",onClick:()=>i(),disabled:r,title:"Recargar manifest",children:o.jsx(Wr,{size:14,className:r?"animate-spin":""})}),children:[r&&o.jsx(Je,{label:"Cargando manifest del Deck…"}),!r&&s&&o.jsxs(ot,{children:["No se pudo cargar el manifest del Deck."," ",o.jsx("button",{type:"button",className:"ml-1 underline",onClick:()=>i(),children:"Reintentar"})]}),!r&&!s&&f.length===0&&o.jsx(ot,{children:"No hay widgets en el manifest."}),!r&&!s&&f.length>0&&o.jsx("div",{className:"space-y-5","data-testid":"deck-desktop-list",children:p.filter(x=>x.widgets.length>0).map(x=>o.jsx(PL,{desktop:x.desktop,widgets:x.widgets,onToggle:c},x.desktop.id))})]}),n?.apx&&o.jsx(He,{title:"Contexto APX",description:"Información que el Deck ve del daemon.",children:o.jsxs("div",{className:"space-y-2 text-sm","data-testid":"deck-apx-context",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-muted-fg",children:"Proyecto activo:"}),o.jsx("span",{className:"font-medium",children:n.apx.active_project?n.apx.active_project.name:"ninguno"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-muted-fg",children:"Proyectos registrados:"}),o.jsx("span",{className:"font-medium",children:n.apx.projects.length})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-muted-fg",children:"Plugins activos:"}),o.jsx("span",{className:"font-medium",children:Object.keys(n.apx.plugins).join(", ")||"—"})]})]})})]})}function IL({projects:e,value:n,onChange:s,disabled:r}){const i=e.map(c=>{const d=c.path?.split("/").filter(Boolean).pop()||`proyecto ${c.id}`;return{value:String(c.id),label:c.name||d,icon:YN,description:c.path}});return o.jsx("div",{className:"w-full","data-testid":"code-project-select",children:o.jsx(Ct,{value:n,onChange:s,options:i,placeholder:"Elegí un proyecto…",disabled:r})})}function UL({sessions:e,activeId:n,busy:s,onSelect:r,onCreate:i,onRename:c,onDelete:d}){return o.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-session-list",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:C("code_module.sessions")}),o.jsxs("button",{type:"button",onClick:i,disabled:s,title:C("code_module.new_session"),"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:[o.jsx(Nn,{className:"size-3"})," ",C("code_module.new_session")]})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 pb-2",children:e.length===0?o.jsx("div",{className:"p-2",children:o.jsx(ot,{children:C("code_module.no_sessions")})}):o.jsx("ul",{className:"space-y-0.5",children:e.map(f=>o.jsxs("li",{className:"group/item relative",children:[o.jsxs("button",{type:"button",onClick:()=>r(f.id),className:Ae("flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left text-xs transition-colors",f.id===n?"bg-accent text-accent-fg":"text-foreground/80 hover:bg-accent/50"),children:[o.jsx(lR,{className:"mt-0.5 size-3.5 shrink-0 opacity-60"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate font-medium",children:f.title}),o.jsxs("span",{className:"block truncate text-[10px] text-muted-foreground",children:[f.mode," · ",f.messageCount," msg",f.model?` · ${f.model}`:""]})]})]}),o.jsxs("div",{className:"absolute right-1 top-1 hidden items-center gap-0.5 group-hover/item:flex",children:[o.jsx("button",{type:"button",onClick:()=>c(f.id,f.title),title:C("code_module.rename"),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-foreground",children:o.jsx(xh,{className:"size-3"})}),o.jsx("button",{type:"button",onClick:()=>d(f.id),title:C("code_module.delete"),className:"rounded p-1 text-muted-foreground hover:bg-background hover:text-rose-500",children:o.jsx(Ja,{className:"size-3"})})]})]},f.id))})})]})}function HL({mode:e,onChange:n,disabled:s}){const r=(i,c,d,f)=>o.jsxs("button",{type:"button",disabled:s,title:d,"data-testid":`code-mode-${i}`,"aria-pressed":e===i,onClick:()=>n(i),className:Ae("flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors disabled:opacity-50",e===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[o.jsx(f,{className:"size-3"})," ",c]});return o.jsxs("div",{className:"flex items-center gap-0.5 rounded-lg border border-border bg-muted/60 p-0.5",children:[r("build",C("code_module.mode_build"),C("code_module.mode_build_hint"),ZN),r("plan",C("code_module.mode_plan"),C("code_module.mode_plan_hint"),LN)]})}function qL({value:e,onValueChange:n,onSubmit:s,onStop:r,busy:i,disabled:c,mode:d,onModeChange:f,model:p,onModelChange:m}){return o.jsx(Cx,{value:e,onValueChange:n,onSubmit:s,onStop:r,busy:i,disabled:c,placeholder:C("code_module.placeholder"),maxRows:12,footer:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(HL,{mode:d,onChange:f,disabled:i}),o.jsx(Ex,{value:p,onChange:m,disabled:i})]})})}function Cg(e,n){let s=0;for(const r of e.parts||[])r.kind==="text"&&n.text&&(s+=r.text.length),r.kind==="tool"&&n.tool&&(r.args&&(s+=JSON.stringify(r.args).length),r.result!==void 0&&(s+=JSON.stringify(r.result).length));return Math.ceil(s/4)}function VL(e){let n=null,s=0,r=0;for(const d of e)d.role==="user"?s++:r++,d.role==="assistant"&&d.usage&&(n={input:d.usage.input_tokens,output:d.usage.output_tokens,model:d.model});const i=n?.input??0,c=n?.output??0;return{model:n?.model??null,input:i,output:c,total:i+c,hasUsage:!!n,messages:e.length,userMsgs:s,assistantMsgs:r}}function $L(e){let n=0,s=0,r=0;for(const d of e)d.role==="user"?n+=Cg(d,{text:!0}):s+=Cg(d,{text:!0}),r+=Cg(d,{tool:!0});const i=n+s+r||1,c=(d,f)=>({key:d,tokens:f,percent:Math.round(f/i*100)});return[c("user",n),c("assistant",s),c("tool",r)].filter(d=>d.tokens>0)}const B_={user:"bg-emerald-500",assistant:"bg-sky-500",tool:"bg-amber-500"};function qu({label:e,value:n}){return o.jsxs("div",{className:"rounded-md border border-border bg-background/50 px-2.5 py-2",children:[o.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:e}),o.jsx("div",{className:"mt-0.5 truncate font-mono text-sm",children:n})]})}function GL({turns:e}){const n=b.useMemo(()=>VL(e),[e]),s=b.useMemo(()=>$L(e),[e]);return e.length===0?o.jsx("div",{className:"p-3",children:o.jsx(ot,{children:C("code_module.ctx_none")})}):o.jsxs("div",{className:"space-y-3 p-3","data-testid":"code-context-tab",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx(qu,{label:C("code_module.ctx_model"),value:n.model||"auto"}),o.jsx(qu,{label:C("code_module.ctx_messages"),value:`${n.userMsgs}/${n.assistantMsgs}`}),o.jsx(qu,{label:C("code_module.ctx_input"),value:n.input.toLocaleString()}),o.jsx(qu,{label:C("code_module.ctx_output"),value:n.output.toLocaleString()})]}),o.jsxs("div",{children:[o.jsx("div",{className:"mb-1 text-[11px] font-semibold text-muted-foreground",children:C("code_module.ctx_breakdown")}),s.length>0?o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:s.map(r=>o.jsx("div",{className:B_[r.key],style:{width:`${r.percent}%`},title:`${r.key}: ${r.tokens} (${r.percent}%)`},r.key))}),o.jsx("ul",{className:"mt-2 space-y-1",children:s.map(r=>o.jsxs("li",{className:"flex items-center gap-2 text-[11px]",children:[o.jsx("span",{className:`size-2 rounded-full ${B_[r.key]}`}),o.jsx("span",{className:"flex-1 text-foreground/80",children:C(`code_module.seg_${r.key}`)}),o.jsxs("span",{className:"font-mono text-muted-foreground",children:[r.tokens," · ",r.percent,"%"]})]},r.key))})]}):o.jsx("p",{className:"text-[11px] text-muted-foreground",children:C("code_module.ctx_none")})]})]})}function YL(e){const n=[];for(const s of(e||"").split(`
563
- `))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 FL({patch:e}){const n=b.useMemo(()=>YL(e),[e]);return n.length?o.jsx("pre",{className:"overflow-x-auto rounded-md border border-border bg-background/60 font-mono text-[11px] leading-relaxed",children:o.jsx("code",{className:"block",children:n.map((s,r)=>o.jsxs("div",{className:Ae("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:[o.jsx("span",{className:"select-none opacity-50",children:s.kind==="add"?"+":s.kind==="del"?"-":" "}),s.text]},r))})}):null}const XL={added:HN,modified:ad,deleted:$N},KL={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 QL({file:e}){const[n,s]=b.useState(!1),r=XL[e.status];return o.jsxs("li",{className:"rounded-md border border-border",children:[o.jsxs("button",{type:"button",onClick:()=>s(i=>!i),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[o.jsx(Nd,{className:Ae("size-3 shrink-0 transition-transform",n&&"rotate-90")}),o.jsx(r,{className:Ae("size-3.5 shrink-0",KL[e.status])}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:e.path}),o.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[e.additions!=null&&o.jsxs("span",{className:"text-emerald-600 dark:text-emerald-400",children:["+",e.additions]}),e.deletions!=null&&o.jsxs("span",{className:"ml-1 text-rose-600 dark:text-rose-400",children:["-",e.deletions]})]})]}),n&&o.jsx("div",{className:"border-t border-border p-1.5",children:o.jsx(FL,{patch:e.patch})})]})}function ZL({changes:e,loading:n,onRefresh:s}){const r=e?.files||[];return o.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-changes-tab",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-[11px] text-muted-foreground",children:r.length>0?C("code_module.changes_files",{n:r.length}):""}),o.jsx("button",{type:"button",onClick:s,title:"↻",className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:n?o.jsx(gr,{size:12}):o.jsx(Wr,{className:"size-3"})})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:e&&!e.git?o.jsx(ot,{children:C("code_module.changes_no_git")}):r.length===0?o.jsx(ot,{children:C("code_module.changes_none")}):o.jsx("ul",{className:"space-y-1.5",children:r.map(i=>o.jsx(QL,{file:i},i.path))})})]})}function JL({pid:e,entry:n,onDeleted:s}){const[r,i]=b.useState(!1),[c,d]=b.useState(!1),[f,p]=b.useState(null),m=nt(),h=Xe(r?["artifact",e,n.name]:null,()=>Zu.read(e,n.name)),x=!h.data?.content||h.data.content.startsWith("#!"),y=async _=>{try{await navigator.clipboard.writeText(_),m.info("Copiado.")}catch{}},S=async()=>{d(!0),p(null);try{const _=await Zu.run(e,n.name);p(_),_.ok?m.info(`exit 0 — ${_.durationMs}ms`):m.error(`exit ${_.exitCode??_.signal??"?"}${_.timedOut?" (timeout)":""}`)}catch(_){m.error(_.message)}finally{d(!1)}},w=async()=>{if(window.confirm(C("code_module.artifacts_delete_confirm")))try{await Zu.remove(e,n.name),s()}catch(_){m.error(_.message)}};return o.jsxs("li",{className:"rounded-md border border-border",children:[o.jsxs("button",{type:"button",onClick:()=>i(_=>!_),className:"flex w-full items-center gap-2 px-2 py-1.5 text-left text-xs hover:bg-accent/40",children:[o.jsx(Nd,{className:Ae("size-3 shrink-0 transition-transform",r&&"rotate-90")}),o.jsx(UN,{className:"size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400"}),o.jsx("span",{className:"min-w-0 flex-1 truncate font-mono",children:n.name}),o.jsxs("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground",children:[n.size,"b"]})]}),r&&o.jsxs("div",{className:"space-y-2 border-t border-border p-2",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[o.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-muted px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground",children:n.path}),x&&o.jsxs("button",{type:"button",onClick:()=>void S(),disabled:c,title:C("code_module.artifacts_run"),className:Ae("inline-flex items-center gap-1 rounded px-1.5 py-1 text-[10px] font-medium",c?"bg-muted text-muted-foreground":"bg-emerald-500/15 text-emerald-700 hover:bg-emerald-500/25 dark:text-emerald-300"),children:[c?o.jsx(gr,{size:10}):o.jsx(bh,{className:"size-3"}),C("code_module.artifacts_run")]}),o.jsx("button",{type:"button",onClick:()=>void y(n.path),title:C("code_module.artifacts_copy_path"),className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o.jsx(nd,{className:"size-3"})}),o.jsx("button",{type:"button",onClick:()=>void w(),title:C("code_module.artifacts_delete"),className:"rounded p-1 text-rose-600 hover:bg-rose-50 dark:text-rose-400 dark:hover:bg-rose-950",children:o.jsx(Ja,{className:"size-3"})})]}),o.jsxs("div",{className:"text-[10px] text-muted-foreground",children:[C("code_module.artifacts_run_hint")," ",o.jsxs("code",{className:"rounded bg-muted px-1 font-mono",children:["apx artifact run ",n.name]})]}),f&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[o.jsxs("span",{className:Ae("rounded px-1.5 py-0.5 font-mono",f.ok?"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300":"bg-rose-500/15 text-rose-700 dark:text-rose-300"),children:["exit ",f.exitCode??f.signal??"?"]}),f.timedOut&&o.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:"timeout"}),f.truncated&&o.jsx("span",{className:"rounded bg-amber-500/15 px-1.5 py-0.5 font-mono text-amber-700 dark:text-amber-300",children:"truncated"}),o.jsxs("span",{className:"font-mono text-muted-foreground",children:[f.durationMs,"ms"]})]}),f.stdout&&o.jsx("pre",{className:"max-h-32 overflow-auto rounded bg-background/60 p-2 text-[10px] leading-tight",children:f.stdout}),f.stderr&&o.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:f.stderr})]}),h.isLoading?o.jsx("div",{className:"flex justify-center py-2",children:o.jsx(gr,{size:12})}):h.data?.content?o.jsx("pre",{className:"max-h-64 overflow-auto rounded bg-muted/50 p-2 text-[10px] leading-tight",children:h.data.content}):null]})]})}function WL({pid:e}){const n=Xe(e?["artifacts",e]:null,()=>Zu.list(e)),s=n.data||[];return o.jsxs("div",{className:"flex h-full flex-col","data-testid":"code-artifacts-tab",children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-[11px] text-muted-foreground",children:s.length>0?C("code_module.artifacts_count",{n:s.length}):""}),o.jsx("button",{type:"button",onClick:()=>void n.mutate(),title:"↻",className:"rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:n.isLoading?o.jsx(gr,{size:12}):o.jsx(Wr,{className:"size-3"})})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-3 pb-3",children:s.length===0?o.jsx(ot,{children:C("code_module.artifacts_none")}):o.jsx("ul",{className:"space-y-1.5",children:s.map(r=>o.jsx(JL,{pid:e,entry:r,onDeleted:()=>void n.mutate()},r.name))})})]})}const e8=[{value:"context",icon:Rd,label:"tab_context"},{value:"changes",icon:QN,label:"tab_changes"},{value:"artifacts",icon:dR,label:"tab_artifacts"}];function t8({pid:e,turns:n,changes:s,changesLoading:r,onRefreshChanges:i}){const[c,d]=b.useState("context"),f=s?.files.length||0;return o.jsxs(Wd,{value:c,onValueChange:d,className:"flex h-full flex-col gap-0","data-testid":"code-side-panel",children:[o.jsx("div",{className:"shrink-0 border-b border-border px-2 py-2",children:o.jsx(ef,{variant:"line",className:"w-full",children:e8.map(({value:p,icon:m,label:h})=>{const x=c===p,y=C(`code_module.${h}`);return o.jsxs(Fa,{value:p,title:y,className:x?"flex-1 min-w-0":"w-8 shrink-0",children:[o.jsx(m,{className:"size-3.5 shrink-0"}),x&&o.jsx("span",{className:"truncate text-xs",children:y}),p==="changes"&&f>0&&o.jsx("span",{className:"ml-0.5 rounded-full bg-muted px-1 text-[10px] text-muted-foreground leading-none py-0.5",children:f})]},p)})})}),o.jsx(ka,{value:"context",className:"min-h-0 flex-1 overflow-y-auto",children:o.jsx(GL,{turns:n})}),o.jsx(ka,{value:"changes",className:"min-h-0 flex-1 overflow-hidden",children:o.jsx(ZL,{changes:s,loading:r,onRefresh:i})}),o.jsx(ka,{value:"artifacts",className:"min-h-0 flex-1 overflow-hidden",children:o.jsx(WL,{pid:e})})]})}function n8(){const e=nt(),n=Xe("/projects",()=>Qn.list()),s=b.useMemo(()=>n.data||[],[n.data]),[r,i]=b.useState(""),[c,d]=b.useState(null),[f,p]=b.useState([]),[m,h]=b.useState(""),[x,y]=b.useState(!1),S=b.useRef(null);b.useEffect(()=>{!r&&s.length&&i(String(s[0].id))},[r,s]);const w=Xe(r?["code-sessions",r]:null,()=>sr.sessions.list(r)),_=Xe(r&&c?["code-session",r,c]:null,()=>sr.sessions.get(r,c)),j=Xe(r&&c?["code-changes",r,c]:null,()=>sr.changes(r,c));b.useEffect(()=>{const V=w.data||[];!c&&V.length&&d(V[0].id),c&&V.length&&!V.some($=>$.id===c)&&d(V[0]?.id??null)},[w.data,c]),b.useEffect(()=>{x||(_.data?p(_.data.messages||[]):c||p([]))},[_.data,c,x]),b.useEffect(()=>()=>S.current?.abort(),[]);const k=_.data,E=k?.mode==="plan"?"plan":"build",R=k?.model||"",N=V=>{V===r||x||(i(V),d(null),p([]))},M=V=>{x||V===c||(d(V),p([]))},A=async()=>{if(!(!r||x))try{const V=await sr.sessions.create(r,{title:C("code_module.untitled")});await w.mutate(),d(V.id),p([])}catch(V){e.error(V.message)}},O=async(V,$)=>{const W=window.prompt(C("code_module.rename"),$);if(!(!W||W===$))try{await sr.sessions.update(r,V,{title:W}),await w.mutate(),V===c&&await _.mutate()}catch(oe){e.error(oe.message)}},L=async V=>{if(!x&&window.confirm(C("code_module.delete_confirm")))try{await sr.sessions.remove(r,V),V===c&&(d(null),p([])),await w.mutate()}catch($){e.error($.message)}},U=b.useCallback(async V=>{if(c)try{await sr.sessions.update(r,c,V),await Promise.all([_.mutate(),w.mutate()])}catch($){e.error($.message)}},[r,c,_,w,e]),P=()=>{S.current?.abort(),y(!1)},B=V=>p($=>{const W=[...$],oe=W[W.length-1];return oe&&oe.role==="assistant"&&(W[W.length-1]=V(oe)),W}),D=async V=>{const $=(V??m).trim();if(!$||x||!r||!c)return;const W=new Date().toISOString();p(se=>[...se,{role:"user",parts:[{kind:"text",text:$}],ts:W},{role:"assistant",parts:[],ts:W,pending:!0}]),h(""),y(!0);const oe=new AbortController;S.current=oe;const ce=se=>{if(se.type==="error"){e.error(se.error||"error");return}B(ie=>kx(ie,se))};try{await sr.stream(r,c,{prompt:$},ce,oe.signal),B(se=>({...se,pending:!1}))}catch(se){oe.signal.aborted?B(ie=>({...ie,pending:!1,parts:[...ie.parts,{kind:"text",text:C("code_module.stopped")}]})):(e.error(se.message),p(ie=>ie.filter((te,ke)=>ke!==ie.length-1)))}finally{S.current===oe&&(S.current=null),y(!1),_.mutate(),w.mutate(),j.mutate()}},H=async V=>{try{await navigator.clipboard.writeText(V),e.info("Copiado.")}catch{}},Y=!n.isLoading&&s.length>0,Q=b.useMemo(()=>f,[f]),q=b.useMemo(()=>w.data?.find(V=>V.id===c)?.title||"",[w.data,c]);W4(q);const[X,Z]=b.useState(null),G=x?null:h2(f),K=G&&G.turnKey!==X,I=V=>{D(V)};return o.jsx("div",{className:"flex h-full min-h-0","data-testid":"screen-code",children:n.isLoading?o.jsx(Je,{}):Y?o.jsxs(o.Fragment,{children:[o.jsxs("aside",{className:"flex w-52 shrink-0 flex-col border-r border-border",children:[o.jsx("div",{className:"shrink-0 border-b border-border p-2",children:o.jsx(IL,{projects:s,value:r,onChange:N,disabled:x})}),o.jsx(UL,{sessions:w.data||[],activeId:c,busy:x,onSelect:M,onCreate:A,onRename:O,onDelete:L}),o.jsx("div",{className:"shrink-0 border-t border-border px-3 py-2",children:o.jsx(Ue,{tone:"success",children:C("code_module.badge")})})]}),o.jsxs("main",{className:"flex min-w-0 flex-1 flex-col",children:[o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto","data-testid":"code-transcript",children:c?f.length?o.jsx(Nx,{msgs:f,onCopy:H}):o.jsx("div",{className:"grid h-full place-items-center p-6",children:o.jsx(ot,{children:C("code_module.empty_chat")})}):o.jsx("div",{className:"grid h-full place-items-center p-6",children:o.jsx(ot,{children:C("code_module.pick_project")})})}),K&&G&&o.jsx(g2,{turnKey:G.turnKey,questions:G.questions,onSubmit:I,onDismiss:()=>Z(G.turnKey),disabled:x}),o.jsx("div",{className:"border-t border-border bg-card/60 p-3","data-testid":"code-input",children:o.jsx(qL,{value:m,onValueChange:h,onSubmit:()=>void D(),onStop:P,busy:x,disabled:!c,mode:E,onModeChange:V=>void U({mode:V}),model:R,onModelChange:V=>void U({model:V||null})})})]}),o.jsx("aside",{className:"hidden w-72 shrink-0 flex-col border-l border-border lg:flex",children:o.jsx(t8,{pid:r,turns:Q,changes:j.data,changesLoading:j.isLoading,onRefreshChanges:()=>void j.mutate()})})]}):o.jsx("div",{className:"grid flex-1 place-items-center",children:o.jsx(ot,{children:C("code_module.no_projects")})})})}function a8({open:e,onClose:n}){const{mutate:s}=iw(),r=nt(),[i,c]=b.useState(""),[d,f]=b.useState(""),[p,m]=b.useState([]),[h,x]=b.useState(null),[y,S]=b.useState(""),[w,_]=b.useState(!1),[j,k]=b.useState(!1),E=async(N,M=!1)=>{_(!0),S("");try{const A=await p5.dirs(N||"~");f(A.path),c(A.path),x(A.parent),m(A.entries)}catch(A){const O=A.message;S(O),M||r.error(O)}finally{_(!1)}};b.useEffect(()=>{e&&!d&&E(i||"~",!0)},[e]);const R=async()=>{const N=i.trim();if(!N){r.error(C("add_project.path_required"));return}k(!0);try{const M=await Qn.register(N);r.success(C("add_project.registered",{id:M.id})),await s("/projects"),c(""),n()}catch(M){r.error(M.message)}finally{k(!1)}};return o.jsx(ma,{open:e,onClose:n,title:C("add_project.title"),description:C("add_project.subtitle"),footer:o.jsxs(o.Fragment,{children:[o.jsx(he,{variant:"ghost",onClick:n,disabled:j,children:C("common.cancel")}),o.jsx(he,{variant:"primary",onClick:R,loading:j,children:C("add_project.register")})]}),children:o.jsxs("div",{className:"space-y-3",children:[o.jsx(fe,{label:C("add_project.path_label"),hint:C("add_project.path_hint"),children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Ce,{autoFocus:!0,placeholder:C("add_project.path_placeholder"),value:i,onChange:N=>c(N.target.value),onKeyDown:N=>{N.key==="Enter"&&R()}}),o.jsxs(he,{onClick:()=>E(i||"~"),disabled:w,children:[o.jsx(Gu,{size:14})," ",C("add_project.search_btn")]})]})}),o.jsxs("div",{className:"rounded-md border border-border bg-muted/20",children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-border px-3 py-2",children:[o.jsx("span",{className:"truncate font-mono text-xs text-muted-fg",children:d||i||"~"}),o.jsxs("div",{className:"flex gap-1",children:[o.jsx(he,{size:"sm",variant:"ghost",onClick:()=>E("~"),disabled:w,children:o.jsx(WN,{size:13})}),o.jsx(he,{size:"sm",variant:"ghost",onClick:()=>h&&E(h),disabled:!h||w,children:".."})]})]}),o.jsxs("div",{className:"max-h-64 overflow-y-auto p-2",children:[w&&o.jsx(Je,{}),!w&&y&&o.jsx(ot,{children:C("add_project.browser_unavailable")}),!w&&!y&&p.length===0&&o.jsx(ot,{children:C("add_project.no_folders")}),!w&&!y&&p.map(N=>o.jsxs("button",{type:"button",onClick:()=>E(N),className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-accent",children:[o.jsx(FN,{size:14,className:"text-muted-fg"}),o.jsx("span",{className:"truncate",children:N.split("/").pop()}),o.jsx("span",{className:"ml-auto truncate font-mono text-[10px] text-muted-fg",children:N})]},N))]})]})]})})}function s8({onPaired:e}){const[n,s]=b.useState(""),[r,i]=b.useState(r8()),[c,d]=b.useState(!1),[f,p]=b.useState(null);async function m(){const h=n.trim();if(!h){p(C("pairing.err_required"));return}d(!0),p(null);try{const x=await tl.confirm({pairing_id:h,label:r.trim()||void 0});Hr(x.token);try{localStorage.setItem(Cn.token,x.token)}catch{}e()}catch(x){p(o8(x)),d(!1)}}return o.jsx("div",{className:"flex min-h-[100dvh] w-full items-center justify-center overflow-y-auto bg-background p-4 text-foreground",children:o.jsxs("div",{className:"my-auto w-full max-w-md rounded-xl border border-border bg-card p-6 shadow-sm",children:[o.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[o.jsx("div",{className:"grid size-10 place-items-center rounded-lg bg-primary/10 text-primary",children:o.jsx(tR,{size:20})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-base font-semibold",children:C("pairing.title")}),o.jsx("p",{className:"text-xs text-muted-fg",children:C("pairing.subtitle")})]})]}),o.jsxs("ol",{className:"mb-5 space-y-1.5 rounded-lg bg-muted/50 p-3 text-xs text-muted-fg",children:[o.jsx("li",{className:"font-medium text-foreground",children:C("pairing.steps_title")}),o.jsxs("li",{children:["1. ",C("pairing.step_1")]}),o.jsxs("li",{children:["2. ",C("pairing.step_2")]}),o.jsxs("li",{children:["3. ",C("pairing.step_3")]})]}),o.jsxs("form",{className:"space-y-3",onSubmit:h=>{h.preventDefault(),m()},children:[o.jsx(fe,{label:C("pairing.code_label"),children:o.jsx(Ce,{value:n,onChange:h=>s(h.target.value),placeholder:C("pairing.code_ph"),spellCheck:!1,autoComplete:"off"})}),o.jsx(fe,{label:C("pairing.label_label"),hint:C("pairing.revoke_hint"),children:o.jsx(Ce,{value:r,onChange:h=>i(h.target.value),placeholder:C("pairing.label_ph")})}),f&&o.jsx("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:f}),o.jsx(he,{type:"submit",variant:"primary",size:"md",loading:c,className:"w-full justify-center",children:C(c?"pairing.linking":"pairing.submit")})]})]})})}function r8(){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 o8(e){if(e instanceof rc){if(e.status===410)return C("pairing.err_expired");if(e.status===404||e.status===409)return C("pairing.err_unknown")}return C("pairing.err_generic")}function l8({...e}){return o.jsx(Mw,{"data-slot":"sheet",...e})}function i8({...e}){return o.jsx(Tw,{"data-slot":"sheet-portal",...e})}function c8({className:e,...n}){return o.jsx(_w,{"data-slot":"sheet-overlay",className:Pt("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 u8({className:e,children:n,side:s="right",showCloseButton:r=!0,...i}){return o.jsxs(i8,{children:[o.jsx(c8,{}),o.jsxs(Nw,{"data-slot":"sheet-content","data-side":s,className:Pt("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm",e),...i,children:[n,r&&o.jsxs(jw,{"data-slot":"sheet-close",render:o.jsx(nl,{variant:"ghost",className:"absolute top-3 right-3",size:"icon-sm"}),children:[o.jsx(ec,{}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function d8({className:e,...n}){return o.jsx("div",{"data-slot":"sheet-header",className:Pt("flex flex-col gap-0.5 p-4",e),...n})}function f8({className:e,...n}){return o.jsx(Ow,{"data-slot":"sheet-title",className:Pt("font-heading text-base font-medium text-foreground",e),...n})}function m8({className:e,...n}){return o.jsx(Sw,{"data-slot":"sheet-description",className:Pt("text-sm text-muted-foreground",e),...n})}function p8({value:e,projectPath:n,onPick:s}){const r=g8(e),i=r?h8(e):"",{data:c}=Xe(r?["/skills",n||""]:null,()=>_5.list(n)),d=c?.skills||[],f=b.useMemo(()=>{const p=i.toLowerCase();return p?d.filter(m=>m.slug.toLowerCase().includes(p)).slice(0,8):d.slice(0,8)},[d,i]);return!r||f.length===0?null:o.jsxs("div",{className:"rounded-xl border border-border bg-popover/95 text-sm shadow-md backdrop-blur",children:[o.jsx("ul",{role:"listbox",className:"max-h-64 overflow-y-auto py-1",children:f.map(p=>o.jsx("li",{children:o.jsxs("button",{type:"button",onClick:()=>s(p.slug),className:"flex w-full items-start gap-2 px-3 py-1.5 text-left hover:bg-accent hover:text-accent-foreground",children:[o.jsxs("code",{className:"rounded bg-muted px-1.5 py-0.5 text-[11px]",children:["/",p.slug]}),o.jsx("span",{className:"truncate text-xs text-muted-foreground",children:p.description})]})},p.slug))}),o.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 g8(e){return!!e.match(/^\s*\/([A-Za-z0-9_-]*)$/)}function h8(e){const n=e.match(/^\s*\/([A-Za-z0-9_-]*)$/);return n?n[1]:""}function x8(){try{const e=localStorage.getItem(Cn.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 b8({open:e,onOpenChange:n}){const s=ix(),r=nt(),[i,c]=b.useState(x8),[d,f]=b.useState(""),[p,m]=b.useState(!1),[h,x]=b.useState(""),y=b.useRef(null);b.useEffect(()=>{const E=i.filter(R=>!R.pending);try{E.length?localStorage.setItem(Cn.robyChat,JSON.stringify(E)):localStorage.removeItem(Cn.robyChat)}catch{}},[i]);const S=()=>{if(!p){c([]),f("");try{localStorage.removeItem(Cn.robyChat)}catch{}}};b.useEffect(()=>()=>y.current?.abort(),[]);const w=()=>{y.current?.abort(),m(!1)},_=E=>c(R=>{const N=[...R],M=N[N.length-1];return M?.role==="assistant"&&(N[N.length-1]=E(M)),N}),j=async()=>{const E=d.trim();if(!E||p)return;const R=new Date().toISOString(),N=i.filter(L=>!L.pending).map(L=>({role:L.role,content:m2(L)}));c(L=>[...L,{role:"user",parts:[{kind:"text",text:E}],ts:R},{role:"assistant",parts:[],ts:R,pending:!0}]),f(""),m(!0);const M=new AbortController;y.current=M;let A=!1;const O=L=>{if(L?.type==="error"){A=!0,r.error(L.error||"error"),c(U=>{const P=[...U],B=P[P.length-1];return B?.role==="assistant"&&B.pending&&P.pop(),P});return}_(U=>kx(U,L))};try{await uw.stream(0,{prompt:E,previousMessages:N,model:h||void 0,channel:"web_sidebar"},O,M.signal),_(L=>({...L,pending:!1}))}catch(L){M.signal.aborted?_(U=>({...U,pending:!1,parts:[...U.parts,{kind:"text",text:C("project.chat.stopped_marker")}]})):A||(r.error(L.message),c(U=>{const P=[...U],B=P[P.length-1];return B?.role==="assistant"&&B.pending&&P.pop(),P}))}finally{y.current===M&&(y.current=null),m(!1)}},k=async E=>{try{await navigator.clipboard.writeText(E),r.info(C("project.chat.copied"))}catch{}};return o.jsx(l8,{open:e,onOpenChange:n,children:o.jsxs(u8,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-xl data-[side=right]:sm:max-w-xl",children:[o.jsxs(d8,{className:"pr-12",children:[o.jsxs(f8,{className:"flex items-center gap-2",children:[o.jsx(vn,{size:18})," ",C("superagent.title",{persona:s}),o.jsx("span",{className:"text-xs font-normal text-muted-fg",children:C("superagent.badge")})]}),o.jsx(m8,{children:C("superagent.desc")})]}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:i.length===0?o.jsx("p",{className:"mt-6 text-center text-sm text-muted-fg",children:C("superagent.empty",{persona:s})}):o.jsx(Nx,{msgs:i,onCopy:k})}),o.jsx(p2,{msgs:i}),o.jsxs("div",{className:"border-t border-border p-3",children:[o.jsx("div",{className:"mb-1.5",children:o.jsx(p8,{value:d,onPick:E=>f(`/${E} `)})}),o.jsx(Cx,{value:d,onValueChange:f,onSubmit:()=>void j(),onStop:w,busy:p,placeholder:C("superagent.placeholder"),footer:o.jsx(Ex,{value:h,onChange:x,disabled:p})}),o.jsx("div",{className:"mt-1.5 flex justify-end",children:o.jsxs(nl,{size:"xs",variant:"ghost",onClick:S,disabled:p||i.length===0,children:[o.jsx(Nn,{className:"size-3"})," ",C("superagent.new_chat")]})})]})]})})}function v8(){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 y8(){const[e,n]=b.useState({status:"loading"}),[s,r]=b.useState(0),i=b.useCallback(()=>{n({status:"loading"}),r(c=>c+1)},[]);return b.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(/^#/,""),f=new URLSearchParams(d),p=f.get("pair");if(p){history.replaceState(null,"",window.location.pathname+window.location.search);try{const h=await tl.confirm({pairing_id:p,label:v8(),kind:"web"});Hr(h.token);try{localStorage.setItem(Cn.token,h.token)}catch{}c||n({status:"ok"});return}catch{}}const m=f.get("token");if(m){Hr(m);try{localStorage.setItem(Cn.token,m)}catch{}history.replaceState(null,"",window.location.pathname+window.location.search)}else try{const h=localStorage.getItem(Cn.token);h&&Hr(h)}catch{}try{const h=await fetch("/admin/web-token");if(h.ok){const x=await h.json();if(x?.token){Hr(x.token);try{localStorage.setItem(Cn.token,x.token)}catch{}}}}catch{}if(!sx()){c||n({status:"unpaired"});return}try{await ge.get("/projects"),c||n({status:"ok"})}catch(h){if(h instanceof rc&&(h.status===401||h.status===403)){Hr(null);try{localStorage.removeItem(Cn.token)}catch{}c||n({status:"unpaired"})}else c||n({status:"error",reason:String(h)})}})(),()=>{c=!0}},[s]),{...e,reload:i}}function _8(){const e=y8();return e.status==="loading"?o.jsx(I_,{text:C("daemon.connecting")}):e.status==="error"?o.jsx(I_,{text:C("daemon.unreachable"),sub:`${C("daemon.unreachable_hint")}
564
-
565
- ${e.reason}`}):e.status==="unpaired"?o.jsx(s8,{onPaired:e.reload}):o.jsx(q4,{children:o.jsx(NM,{delay:300,children:o.jsx(j8,{})})})}function j8(){const e=Ia(),n=ea(),[s,r]=cj(),{theme:i,toggle:c}=_h(),d=s.get("action")==="add-project",[f,p]=b.useState(!1),m=()=>{const h=new URLSearchParams(s);h.delete("action"),r(h,{replace:!0})};return o.jsx(K4,{children:o.jsxs("div",{className:"flex h-screen w-screen overflow-hidden bg-background text-foreground","data-testid":"app-shell",children:[o.jsx(M5,{onSelect:h=>e(h),onOpenRoby:()=>p(!0)}),o.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:[o.jsx(S8,{onToggleTheme:c,isDark:i==="dark",pathname:n.pathname}),o.jsx("div",{className:"flex-1 overflow-y-auto",children:o.jsxs(sj,{children:[o.jsx(qt,{path:"/",element:o.jsx(Y4,{})}),o.jsx(qt,{path:"/settings/*",element:o.jsx(fL,{})}),o.jsx(qt,{path:"/m/voice/*",element:o.jsx(jL,{})}),o.jsx(qt,{path:"/m/desktop/*",element:o.jsx(EL,{})}),o.jsx(qt,{path:"/m/deck/*",element:o.jsx(BL,{})}),o.jsx(qt,{path:"/m/code/*",element:o.jsx(n8,{})}),o.jsx(qt,{path:"/p/:pid/*",element:o.jsx(v6,{})}),o.jsx(qt,{path:"*",element:o.jsx(k8,{})})]})})]}),o.jsx(a8,{open:d,onClose:m}),o.jsx(b8,{open:f,onOpenChange:p})]})})}function S8({onToggleTheme:e,isDark:n,pathname:s}){const{projects:r}=oc(),i=J4(),c=s.split("/").filter(Boolean),d=c[0]==="p"?r.find(S=>String(S.id)===c[1]):void 0,f=c[0]==="settings"?C8(c[1]):c[0]==="p"?E8(c[2]):"",p=c[0]==="p"&&c[1]==="0",m=d?.name||d?.path?.split("/").pop()||C("nav.project"),h=s==="/"?C("topbar.breadcrumb_root"):c[0]==="settings"?[C("topbar.breadcrumb_root"),C("nav.settings"),f].filter(Boolean).join(" › "):c[0]==="m"?[C("topbar.breadcrumb_root"),w8(c[1]),i].filter(Boolean).join(" › "):c[0]==="p"?p?[C("topbar.breadcrumb_root"),C("topbar.breadcrumb_base"),f].filter(Boolean).join(" › "):[C("topbar.breadcrumb_root"),C("topbar.breadcrumb_projects"),m,f].filter(Boolean).join(" › "):C("topbar.breadcrumb_root"),x=s==="/"?"":c[0]==="settings"?C("settings.subtitle"):c[0]==="p"?p?C("base.subtitle"):d?`${mw(d.kind)} · ${d.path}`:"":"",y=Q4();return o.jsxs("header",{className:"flex h-10 shrink-0 items-center gap-2 border-b border-border/50 px-3",children:[y&&o.jsx(F4,{collapsed:y.collapsed,onToggle:y.toggle}),o.jsxs("span",{className:"min-w-0 flex-1 truncate text-[11px] tracking-wide text-muted-fg",children:[h,x&&o.jsxs("span",{className:"text-muted-fg/50",children:[" · ",x]})]}),o.jsx("button",{type:"button",onClick:e,title:C(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?o.jsx(bR,{size:14}):o.jsx(uR,{size:14})})]})}function w8(e){switch(e){case"voice":return C("nav.modules.voice");case"desktop":return C("nav.modules.desktop");case"deck":return C("nav.modules.deck");case"code":return C("nav.modules.code");default:return e||""}}function C8(e){switch(e){case"super-agent":return C("settings.tabs.super_agent");case"engines":return C("settings.tabs.engines");case"telegram":return C("settings.tabs.telegram");case"devices":return C("settings.tabs.devices");case"appearance":return C("settings.appearance");case"config":case"advanced":return C("settings.tabs.advanced");case"identity":default:return e||""}}function E8(e){switch(e){case"chat":return C("project.nav.chat");case"threads":return C("project.nav.threads");case"telegram":return C("project.nav.telegram");case"agents":return C("project.nav.agents");case"routines":return C("project.nav.routines");case"tasks":return C("project.nav.tasks");case"mcps":return C("project.nav.mcps");case"config":return C("project.nav.config");case"workspaces":return C("base.workspaces_title");case"models":return C("settings.tabs.engines");case"agent-defaults":return C("base.defaults_title");case"sessions":return C("base.sessions_title");case"logs":return C("project.nav.logs");case"memories":return C("project.nav.memories");default:return""}}function I_({text:e,sub:n}){return o.jsx("div",{className:"grid h-screen w-screen place-items-center bg-background text-foreground",children:o.jsxs("div",{className:"text-center",children:[o.jsx("div",{className:"font-mono text-xs text-muted-fg whitespace-pre leading-none mb-4",children:` ▄███████▄
566
- █ ██ ██ █
567
- █ ◔ ◔ █
568
- █ ╰~╯ █
569
- ▀███████▀`}),o.jsx("div",{className:"text-foreground",children:e}),n&&o.jsx("pre",{className:"mt-2 max-w-xl whitespace-pre-wrap text-sm text-muted-fg",children:n})]})})}function k8(){return o.jsxs("div",{className:"p-8",children:[o.jsx("h1",{className:"text-2xl",children:C("not_found.title")}),o.jsx("p",{className:"text-muted-fg",children:C("not_found.message")})]})}ZE.createRoot(document.getElementById("root")).render(o.jsx(Qi.StrictMode,{children:o.jsx(vN,{children:o.jsx(SR,{children:o.jsx(_8,{})})})}));
570
- //# sourceMappingURL=index-BkybwwRn.js.map