teleton 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -11
- package/dist/{chunk-H36RFKRI.js → chunk-2IZU3REP.js} +572 -174
- package/dist/chunk-3UFPFWYP.js +12 -0
- package/dist/{chunk-NUGDTPE4.js → chunk-4L66JHQE.js} +2 -1
- package/dist/{chunk-TVRZJIZX.js → chunk-55SKE6YH.js} +4 -4
- package/dist/{setup-server-QXED3D2L.js → chunk-57URFK6M.js} +161 -210
- package/dist/chunk-5SEMA47R.js +75 -0
- package/dist/{chunk-JHYZYFZJ.js → chunk-7YKSXOQQ.js} +17 -2
- package/dist/{chunk-IJBWWQE4.js → chunk-C4NKJT2Z.js} +12 -0
- package/dist/{chunk-RQBAMUCV.js → chunk-GGXJLMOH.js} +1451 -743
- package/dist/{chunk-WIKM24GZ.js → chunk-H7MFXJZK.js} +7 -2
- package/dist/{chunk-U56QTM46.js → chunk-HEDJCLA6.js} +85 -44
- package/dist/{chunk-QVBSUYVX.js → chunk-J73TA3UM.js} +17 -9
- package/dist/{chunk-P36I6OIV.js → chunk-LC4TV3KL.js} +13 -2
- package/dist/{chunk-RCMD3U65.js → chunk-NQ6FZKCE.js} +13 -0
- package/dist/{chunk-SD4NLLYG.js → chunk-VYKW7FMV.js} +224 -93
- package/dist/chunk-W25Z7CM6.js +487 -0
- package/dist/{chunk-OJCLKU5Z.js → chunk-WFTC3JJW.js} +16 -0
- package/dist/{server-H3QA252W.js → chunk-XBSCYMKM.js} +369 -374
- package/dist/{chunk-PHSAHTK4.js → chunk-YOSUPUAJ.js} +75 -7
- package/dist/cli/index.js +67 -22
- package/dist/{client-LNZTDQSA.js → client-YOOHI776.js} +4 -4
- package/dist/{get-my-gifts-OMGKOEPM.js → get-my-gifts-Y7EN7RK4.js} +3 -3
- package/dist/index.js +15 -14
- package/dist/{memory-AS7WKGTW.js → memory-Q6EWGK2S.js} +7 -5
- package/dist/memory-hook-WUXJNVT5.js +18 -0
- package/dist/{migrate-POHWYEIW.js → migrate-WFU6COBN.js} +5 -5
- package/dist/server-GYZXKIKU.js +787 -0
- package/dist/server-YODFBZKG.js +392 -0
- package/dist/setup-server-IZBUOJRU.js +215 -0
- package/dist/{store-GAFULOOX.js → store-7M4XV6M5.js} +6 -6
- package/dist/{task-dependency-resolver-3FIKQ7Z6.js → task-dependency-resolver-L6UUMTHK.js} +3 -3
- package/dist/{task-executor-RUTFG6VG.js → task-executor-XBNJLUCS.js} +3 -3
- package/dist/{tasks-BEZ4QRI2.js → tasks-WQIKXDX5.js} +1 -1
- package/dist/{tool-adapter-IH5VGBOO.js → tool-adapter-IVX2XQJE.js} +1 -1
- package/dist/{tool-index-H3SHOJC3.js → tool-index-NYH57UWP.js} +9 -6
- package/dist/{transcript-IMNE6KU3.js → transcript-IM7G25OS.js} +2 -2
- package/dist/web/assets/index-BfYCdwLI.js +80 -0
- package/dist/web/assets/{index-BrVqauzj.css → index-DmlyQVhR.css} +1 -1
- package/dist/web/assets/{index.es-DkU1GvWU.js → index.es-DitvF-9H.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +14 -5
- package/dist/chunk-XBE4JB7C.js +0 -8
- package/dist/web/assets/index-DYeEkvJ6.js +0 -72
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var zf=Object.defineProperty;var Af=(s,a,c)=>a in s?zf(s,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[a]=c;var $t=(s,a,c)=>Af(s,typeof a!="symbol"?a+"":a,c);function Mf(s,a){for(var c=0;c<a.length;c++){const u=a[c];if(typeof u!="string"&&!Array.isArray(u)){for(const x in u)if(x!=="default"&&!(x in s)){const y=Object.getOwnPropertyDescriptor(u,x);y&&Object.defineProperty(s,x,y.get?y:{enumerable:!0,get:()=>u[x]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const x of document.querySelectorAll('link[rel="modulepreload"]'))u(x);new MutationObserver(x=>{for(const y of x)if(y.type==="childList")for(const C of y.addedNodes)C.tagName==="LINK"&&C.rel==="modulepreload"&&u(C)}).observe(document,{childList:!0,subtree:!0});function c(x){const y={};return x.integrity&&(y.integrity=x.integrity),x.referrerPolicy&&(y.referrerPolicy=x.referrerPolicy),x.crossOrigin==="use-credentials"?y.credentials="include":x.crossOrigin==="anonymous"?y.credentials="omit":y.credentials="same-origin",y}function u(x){if(x.ep)return;x.ep=!0;const y=c(x);fetch(x.href,y)}})();function Of(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ji={exports:{}},fl={},Si={exports:{}},Ce={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* react.production.min.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Facebook, Inc. and its 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 _u;function Df(){if(_u)return Ce;_u=1;var s=Symbol.for("react.element"),a=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),x=Symbol.for("react.profiler"),y=Symbol.for("react.provider"),C=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),p=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),d=Symbol.for("react.lazy"),h=Symbol.iterator;function k(_){return _===null||typeof _!="object"?null:(_=h&&_[h]||_["@@iterator"],typeof _=="function"?_:null)}var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},b=Object.assign,v={};function S(_,Q,Y){this.props=_,this.context=Q,this.refs=v,this.updater=Y||L}S.prototype.isReactComponent={},S.prototype.setState=function(_,Q){if(typeof _!="object"&&typeof _!="function"&&_!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,_,Q,"setState")},S.prototype.forceUpdate=function(_){this.updater.enqueueForceUpdate(this,_,"forceUpdate")};function T(){}T.prototype=S.prototype;function U(_,Q,Y){this.props=_,this.context=Q,this.refs=v,this.updater=Y||L}var O=U.prototype=new T;O.constructor=U,b(O,S.prototype),O.isPureReactComponent=!0;var W=Array.isArray,$=Object.prototype.hasOwnProperty,K={current:null},Z={key:!0,ref:!0,__self:!0,__source:!0};function ne(_,Q,Y){var V,le={},me=null,je=null;if(Q!=null)for(V in Q.ref!==void 0&&(je=Q.ref),Q.key!==void 0&&(me=""+Q.key),Q)$.call(Q,V)&&!Z.hasOwnProperty(V)&&(le[V]=Q[V]);var ke=arguments.length-2;if(ke===1)le.children=Y;else if(1<ke){for(var be=Array(ke),it=0;it<ke;it++)be[it]=arguments[it+2];le.children=be}if(_&&_.defaultProps)for(V in ke=_.defaultProps,ke)le[V]===void 0&&(le[V]=ke[V]);return{$$typeof:s,type:_,key:me,ref:je,props:le,_owner:K.current}}function D(_,Q){return{$$typeof:s,type:_.type,key:Q,ref:_.ref,props:_.props,_owner:_._owner}}function A(_){return typeof _=="object"&&_!==null&&_.$$typeof===s}function H(_){var Q={"=":"=0",":":"=2"};return"$"+_.replace(/[=:]/g,function(Y){return Q[Y]})}var ue=/\/+/g;function I(_,Q){return typeof _=="object"&&_!==null&&_.key!=null?H(""+_.key):Q.toString(36)}function oe(_,Q,Y,V,le){var me=typeof _;(me==="undefined"||me==="boolean")&&(_=null);var je=!1;if(_===null)je=!0;else switch(me){case"string":case"number":je=!0;break;case"object":switch(_.$$typeof){case s:case a:je=!0}}if(je)return je=_,le=le(je),_=V===""?"."+I(je,0):V,W(le)?(Y="",_!=null&&(Y=_.replace(ue,"$&/")+"/"),oe(le,Q,Y,"",function(it){return it})):le!=null&&(A(le)&&(le=D(le,Y+(!le.key||je&&je.key===le.key?"":(""+le.key).replace(ue,"$&/")+"/")+_)),Q.push(le)),1;if(je=0,V=V===""?".":V+":",W(_))for(var ke=0;ke<_.length;ke++){me=_[ke];var be=V+I(me,ke);je+=oe(me,Q,Y,be,le)}else if(be=k(_),typeof be=="function")for(_=be.call(_),ke=0;!(me=_.next()).done;)me=me.value,be=V+I(me,ke++),je+=oe(me,Q,Y,be,le);else if(me==="object")throw Q=String(_),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(_).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.");return je}function ie(_,Q,Y){if(_==null)return _;var V=[],le=0;return oe(_,V,"","",function(me){return Q.call(Y,me,le++)}),V}function ve(_){if(_._status===-1){var Q=_._result;Q=Q(),Q.then(function(Y){(_._status===0||_._status===-1)&&(_._status=1,_._result=Y)},function(Y){(_._status===0||_._status===-1)&&(_._status=2,_._result=Y)}),_._status===-1&&(_._status=0,_._result=Q)}if(_._status===1)return _._result.default;throw _._result}var re={current:null},P={transition:null},te={ReactCurrentDispatcher:re,ReactCurrentBatchConfig:P,ReactCurrentOwner:K};function B(){throw Error("act(...) is not supported in production builds of React.")}return Ce.Children={map:ie,forEach:function(_,Q,Y){ie(_,function(){Q.apply(this,arguments)},Y)},count:function(_){var Q=0;return ie(_,function(){Q++}),Q},toArray:function(_){return ie(_,function(Q){return Q})||[]},only:function(_){if(!A(_))throw Error("React.Children.only expected to receive a single React element child.");return _}},Ce.Component=S,Ce.Fragment=c,Ce.Profiler=x,Ce.PureComponent=U,Ce.StrictMode=u,Ce.Suspense=p,Ce.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=te,Ce.act=B,Ce.cloneElement=function(_,Q,Y){if(_==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+_+".");var V=b({},_.props),le=_.key,me=_.ref,je=_._owner;if(Q!=null){if(Q.ref!==void 0&&(me=Q.ref,je=K.current),Q.key!==void 0&&(le=""+Q.key),_.type&&_.type.defaultProps)var ke=_.type.defaultProps;for(be in Q)$.call(Q,be)&&!Z.hasOwnProperty(be)&&(V[be]=Q[be]===void 0&&ke!==void 0?ke[be]:Q[be])}var be=arguments.length-2;if(be===1)V.children=Y;else if(1<be){ke=Array(be);for(var it=0;it<be;it++)ke[it]=arguments[it+2];V.children=ke}return{$$typeof:s,type:_.type,key:le,ref:me,props:V,_owner:je}},Ce.createContext=function(_){return _={$$typeof:C,_currentValue:_,_currentValue2:_,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},_.Provider={$$typeof:y,_context:_},_.Consumer=_},Ce.createElement=ne,Ce.createFactory=function(_){var Q=ne.bind(null,_);return Q.type=_,Q},Ce.createRef=function(){return{current:null}},Ce.forwardRef=function(_){return{$$typeof:j,render:_}},Ce.isValidElement=A,Ce.lazy=function(_){return{$$typeof:d,_payload:{_status:-1,_result:_},_init:ve}},Ce.memo=function(_,Q){return{$$typeof:m,type:_,compare:Q===void 0?null:Q}},Ce.startTransition=function(_){var Q=P.transition;P.transition={};try{_()}finally{P.transition=Q}},Ce.unstable_act=B,Ce.useCallback=function(_,Q){return re.current.useCallback(_,Q)},Ce.useContext=function(_){return re.current.useContext(_)},Ce.useDebugValue=function(){},Ce.useDeferredValue=function(_){return re.current.useDeferredValue(_)},Ce.useEffect=function(_,Q){return re.current.useEffect(_,Q)},Ce.useId=function(){return re.current.useId()},Ce.useImperativeHandle=function(_,Q,Y){return re.current.useImperativeHandle(_,Q,Y)},Ce.useInsertionEffect=function(_,Q){return re.current.useInsertionEffect(_,Q)},Ce.useLayoutEffect=function(_,Q){return re.current.useLayoutEffect(_,Q)},Ce.useMemo=function(_,Q){return re.current.useMemo(_,Q)},Ce.useReducer=function(_,Q,Y){return re.current.useReducer(_,Q,Y)},Ce.useRef=function(_){return re.current.useRef(_)},Ce.useState=function(_){return re.current.useState(_)},Ce.useSyncExternalStore=function(_,Q,Y){return re.current.useSyncExternalStore(_,Q,Y)},Ce.useTransition=function(){return re.current.useTransition()},Ce.version="18.3.1",Ce}var Tu;function Oi(){return Tu||(Tu=1,Si.exports=Df()),Si.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* react-jsx-runtime.production.min.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Facebook, Inc. and its 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 Ru;function Bf(){if(Ru)return fl;Ru=1;var s=Oi(),a=Symbol.for("react.element"),c=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,x=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,y={key:!0,ref:!0,__self:!0,__source:!0};function C(j,p,m){var d,h={},k=null,L=null;m!==void 0&&(k=""+m),p.key!==void 0&&(k=""+p.key),p.ref!==void 0&&(L=p.ref);for(d in p)u.call(p,d)&&!y.hasOwnProperty(d)&&(h[d]=p[d]);if(j&&j.defaultProps)for(d in p=j.defaultProps,p)h[d]===void 0&&(h[d]=p[d]);return{$$typeof:a,type:j,key:k,ref:L,props:h,_owner:x.current}}return fl.Fragment=c,fl.jsx=C,fl.jsxs=C,fl}var Lu;function Ff(){return Lu||(Lu=1,ji.exports=Bf()),ji.exports}var r=Ff(),g=Oi();const ze=Of(g),Uf=Mf({__proto__:null,default:ze},[g]);var Rs={},wi={exports:{}},xt={},ki={exports:{}},Ci={};/**
|
|
18
|
+
* @license React
|
|
19
|
+
* scheduler.production.min.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Facebook, Inc. and its 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 Iu;function Wf(){return Iu||(Iu=1,(function(s){function a(P,te){var B=P.length;P.push(te);e:for(;0<B;){var _=B-1>>>1,Q=P[_];if(0<x(Q,te))P[_]=te,P[B]=Q,B=_;else break e}}function c(P){return P.length===0?null:P[0]}function u(P){if(P.length===0)return null;var te=P[0],B=P.pop();if(B!==te){P[0]=B;e:for(var _=0,Q=P.length,Y=Q>>>1;_<Y;){var V=2*(_+1)-1,le=P[V],me=V+1,je=P[me];if(0>x(le,B))me<Q&&0>x(je,le)?(P[_]=je,P[me]=B,_=me):(P[_]=le,P[V]=B,_=V);else if(me<Q&&0>x(je,B))P[_]=je,P[me]=B,_=me;else break e}}return te}function x(P,te){var B=P.sortIndex-te.sortIndex;return B!==0?B:P.id-te.id}if(typeof performance=="object"&&typeof performance.now=="function"){var y=performance;s.unstable_now=function(){return y.now()}}else{var C=Date,j=C.now();s.unstable_now=function(){return C.now()-j}}var p=[],m=[],d=1,h=null,k=3,L=!1,b=!1,v=!1,S=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,U=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function O(P){for(var te=c(m);te!==null;){if(te.callback===null)u(m);else if(te.startTime<=P)u(m),te.sortIndex=te.expirationTime,a(p,te);else break;te=c(m)}}function W(P){if(v=!1,O(P),!b)if(c(p)!==null)b=!0,ve($);else{var te=c(m);te!==null&&re(W,te.startTime-P)}}function $(P,te){b=!1,v&&(v=!1,T(ne),ne=-1),L=!0;var B=k;try{for(O(te),h=c(p);h!==null&&(!(h.expirationTime>te)||P&&!H());){var _=h.callback;if(typeof _=="function"){h.callback=null,k=h.priorityLevel;var Q=_(h.expirationTime<=te);te=s.unstable_now(),typeof Q=="function"?h.callback=Q:h===c(p)&&u(p),O(te)}else u(p);h=c(p)}if(h!==null)var Y=!0;else{var V=c(m);V!==null&&re(W,V.startTime-te),Y=!1}return Y}finally{h=null,k=B,L=!1}}var K=!1,Z=null,ne=-1,D=5,A=-1;function H(){return!(s.unstable_now()-A<D)}function ue(){if(Z!==null){var P=s.unstable_now();A=P;var te=!0;try{te=Z(!0,P)}finally{te?I():(K=!1,Z=null)}}else K=!1}var I;if(typeof U=="function")I=function(){U(ue)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,ie=oe.port2;oe.port1.onmessage=ue,I=function(){ie.postMessage(null)}}else I=function(){S(ue,0)};function ve(P){Z=P,K||(K=!0,I())}function re(P,te){ne=S(function(){P(s.unstable_now())},te)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(P){P.callback=null},s.unstable_continueExecution=function(){b||L||(b=!0,ve($))},s.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<P?Math.floor(1e3/P):5},s.unstable_getCurrentPriorityLevel=function(){return k},s.unstable_getFirstCallbackNode=function(){return c(p)},s.unstable_next=function(P){switch(k){case 1:case 2:case 3:var te=3;break;default:te=k}var B=k;k=te;try{return P()}finally{k=B}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(P,te){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var B=k;k=P;try{return te()}finally{k=B}},s.unstable_scheduleCallback=function(P,te,B){var _=s.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?_+B:_):B=_,P){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=B+Q,P={id:d++,callback:te,priorityLevel:P,startTime:B,expirationTime:Q,sortIndex:-1},B>_?(P.sortIndex=B,a(m,P),c(p)===null&&P===c(m)&&(v?(T(ne),ne=-1):v=!0,re(W,B-_))):(P.sortIndex=Q,a(p,P),b||L||(b=!0,ve($))),P},s.unstable_shouldYield=H,s.unstable_wrapCallback=function(P){var te=k;return function(){var B=k;k=te;try{return P.apply(this,arguments)}finally{k=B}}}})(Ci)),Ci}var zu;function $f(){return zu||(zu=1,ki.exports=Wf()),ki.exports}/**
|
|
26
|
+
* @license React
|
|
27
|
+
* react-dom.production.min.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Facebook, Inc. and its 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 Au;function Kf(){if(Au)return xt;Au=1;var s=Oi(),a=$f();function c(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var u=new Set,x={};function y(e,t){C(e,t),C(e+"Capture",t)}function C(e,t){for(x[e]=t,e=0;e<t.length;e++)u.add(t[e])}var j=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),p=Object.prototype.hasOwnProperty,m=/^[: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]*$/,d={},h={};function k(e){return p.call(h,e)?!0:p.call(d,e)?!1:m.test(e)?h[e]=!0:(d[e]=!0,!1)}function L(e,t,n,l){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return l?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function b(e,t,n,l){if(t===null||typeof t>"u"||L(e,t,n,l))return!0;if(l)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,l,o,i,f){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=l,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=f}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){S[e]=new v(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];S[t]=new v(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){S[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){S[e]=new v(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){S[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){S[e]=new v(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){S[e]=new v(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){S[e]=new v(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){S[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var T=/[\-:]([a-z])/g;function U(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(T,U);S[t]=new v(t,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(T,U);S[t]=new v(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(T,U);S[t]=new v(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){S[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),S.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){S[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function O(e,t,n,l){var o=S.hasOwnProperty(t)?S[t]:null;(o!==null?o.type!==0:l||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(b(t,n,o,l)&&(n=null),l||o===null?k(t)&&(n===null?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=n===null?o.type===3?!1:"":n:(t=o.attributeName,l=o.attributeNamespace,n===null?e.removeAttribute(t):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,l?e.setAttributeNS(l,t,n):e.setAttribute(t,n))))}var W=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,$=Symbol.for("react.element"),K=Symbol.for("react.portal"),Z=Symbol.for("react.fragment"),ne=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),A=Symbol.for("react.provider"),H=Symbol.for("react.context"),ue=Symbol.for("react.forward_ref"),I=Symbol.for("react.suspense"),oe=Symbol.for("react.suspense_list"),ie=Symbol.for("react.memo"),ve=Symbol.for("react.lazy"),re=Symbol.for("react.offscreen"),P=Symbol.iterator;function te(e){return e===null||typeof e!="object"?null:(e=P&&e[P]||e["@@iterator"],typeof e=="function"?e:null)}var B=Object.assign,_;function Q(e){if(_===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);_=t&&t[1]||""}return`
|
|
34
|
+
`+_+e}var Y=!1;function V(e,t){if(!e||Y)return"";Y=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(M){var l=M}Reflect.construct(e,[],t)}else{try{t.call()}catch(M){l=M}e.call(t.prototype)}else{try{throw Error()}catch(M){l=M}e()}}catch(M){if(M&&l&&typeof M.stack=="string"){for(var o=M.stack.split(`
|
|
35
|
+
`),i=l.stack.split(`
|
|
36
|
+
`),f=o.length-1,w=i.length-1;1<=f&&0<=w&&o[f]!==i[w];)w--;for(;1<=f&&0<=w;f--,w--)if(o[f]!==i[w]){if(f!==1||w!==1)do if(f--,w--,0>w||o[f]!==i[w]){var E=`
|
|
37
|
+
`+o[f].replace(" at new "," at ");return e.displayName&&E.includes("<anonymous>")&&(E=E.replace("<anonymous>",e.displayName)),E}while(1<=f&&0<=w);break}}}finally{Y=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Q(e):""}function le(e){switch(e.tag){case 5:return Q(e.type);case 16:return Q("Lazy");case 13:return Q("Suspense");case 19:return Q("SuspenseList");case 0:case 2:case 15:return e=V(e.type,!1),e;case 11:return e=V(e.type.render,!1),e;case 1:return e=V(e.type,!0),e;default:return""}}function me(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case Z:return"Fragment";case K:return"Portal";case D:return"Profiler";case ne:return"StrictMode";case I:return"Suspense";case oe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case H:return(e.displayName||"Context")+".Consumer";case A:return(e._context.displayName||"Context")+".Provider";case ue:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ie:return t=e.displayName||null,t!==null?t:me(e.type)||"Memo";case ve:t=e._payload,e=e._init;try{return me(e(t))}catch{}}return null}function je(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(t);case 8:return t===ne?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ke(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function be(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function it(e){var t=be(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(f){l=""+f,i.call(this,f)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(f){l=""+f},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Yn(e){e._valueTracker||(e._valueTracker=it(e))}function vl(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=be(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function Pn(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Er(e,t){var n=t.checked;return B({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function bn(e,t){var n=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;n=ke(t.value!=null?t.value:n),e._wrapperState={initialChecked:l,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Gn(e,t){t=t.checked,t!=null&&O(e,"checked",t,!1)}function qn(e,t){Gn(e,t);var n=ke(t.value),l=t.type;if(n!=null)l==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(l==="submit"||l==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Nr(e,t.type,n):t.hasOwnProperty("defaultValue")&&Nr(e,t.type,ke(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function jl(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var l=t.type;if(!(l!=="submit"&&l!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Nr(e,t,n){(t!=="number"||Pn(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var _n=Array.isArray;function Vt(e,t,n,l){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&l&&(e[n].defaultSelected=!0)}else{for(n=""+ke(n),t=null,o=0;o<e.length;o++){if(e[o].value===n){e[o].selected=!0,l&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Tn(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(c(91));return B({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Ht(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(c(92));if(_n(n)){if(1<n.length)throw Error(c(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:ke(n)}}function Pr(e,t){var n=ke(t.value),l=ke(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),l!=null&&(e.defaultValue=""+l)}function Sl(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function wl(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function G(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?wl(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var F,ee=(function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,l,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n,l,o)})}:e})(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(F=F||document.createElement("div"),F.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=F.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function _e(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var at={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Xe=["Webkit","ms","Moz","O"];Object.keys(at).forEach(function(e){Xe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),at[t]=at[e]})});function Ze(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||at.hasOwnProperty(e)&&at[e]?(""+t).trim():t+"px"}function br(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var l=n.indexOf("--")===0,o=Ze(n,t[n],l);n==="float"&&(n="cssFloat"),l?e.setProperty(n,o):e[n]=o}}var kl=B({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function _r(e,t){if(t){if(kl[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(c(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(c(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(c(61))}if(t.style!=null&&typeof t.style!="object")throw Error(c(62))}}function Tr(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Jn=null;function Se(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ot=null,yt=null,nn=null;function Hi(e){if(e=Xr(e)){if(typeof Ot!="function")throw Error(c(280));var t=e.stateNode;t&&(t=Hl(t),Ot(e.stateNode,e.type,t))}}function Qi(e){yt?nn?nn.push(e):nn=[e]:yt=e}function Yi(){if(yt){var e=yt,t=nn;if(nn=yt=null,Hi(e),t)for(e=0;e<t.length;e++)Hi(t[e])}}function Gi(e,t){return e(t)}function qi(){}var Ms=!1;function Ji(e,t,n){if(Ms)return e(t,n);Ms=!0;try{return Gi(e,t,n)}finally{Ms=!1,(yt!==null||nn!==null)&&(qi(),Yi())}}function Rr(e,t){var n=e.stateNode;if(n===null)return null;var l=Hl(n);if(l===null)return null;n=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(c(231,t,typeof n));return n}var Os=!1;if(j)try{var Lr={};Object.defineProperty(Lr,"passive",{get:function(){Os=!0}}),window.addEventListener("test",Lr,Lr),window.removeEventListener("test",Lr,Lr)}catch{Os=!1}function Bd(e,t,n,l,o,i,f,w,E){var M=Array.prototype.slice.call(arguments,3);try{t.apply(n,M)}catch(J){this.onError(J)}}var Ir=!1,Cl=null,El=!1,Ds=null,Fd={onError:function(e){Ir=!0,Cl=e}};function Ud(e,t,n,l,o,i,f,w,E){Ir=!1,Cl=null,Bd.apply(Fd,arguments)}function Wd(e,t,n,l,o,i,f,w,E){if(Ud.apply(this,arguments),Ir){if(Ir){var M=Cl;Ir=!1,Cl=null}else throw Error(c(198));El||(El=!0,Ds=M)}}function Rn(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function Xi(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function Zi(e){if(Rn(e)!==e)throw Error(c(188))}function $d(e){var t=e.alternate;if(!t){if(t=Rn(e),t===null)throw Error(c(188));return t!==e?null:e}for(var n=e,l=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(l=o.return,l!==null){n=l;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Zi(o),e;if(i===l)return Zi(o),t;i=i.sibling}throw Error(c(188))}if(n.return!==l.return)n=o,l=i;else{for(var f=!1,w=o.child;w;){if(w===n){f=!0,n=o,l=i;break}if(w===l){f=!0,l=o,n=i;break}w=w.sibling}if(!f){for(w=i.child;w;){if(w===n){f=!0,n=i,l=o;break}if(w===l){f=!0,l=i,n=o;break}w=w.sibling}if(!f)throw Error(c(189))}}if(n.alternate!==l)throw Error(c(190))}if(n.tag!==3)throw Error(c(188));return n.stateNode.current===n?e:t}function ea(e){return e=$d(e),e!==null?ta(e):null}function ta(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=ta(e);if(t!==null)return t;e=e.sibling}return null}var na=a.unstable_scheduleCallback,ra=a.unstable_cancelCallback,Kd=a.unstable_shouldYield,Vd=a.unstable_requestPaint,Fe=a.unstable_now,Hd=a.unstable_getCurrentPriorityLevel,Bs=a.unstable_ImmediatePriority,la=a.unstable_UserBlockingPriority,Nl=a.unstable_NormalPriority,Qd=a.unstable_LowPriority,sa=a.unstable_IdlePriority,Pl=null,Dt=null;function Yd(e){if(Dt&&typeof Dt.onCommitFiberRoot=="function")try{Dt.onCommitFiberRoot(Pl,e,void 0,(e.current.flags&128)===128)}catch{}}var Tt=Math.clz32?Math.clz32:Jd,Gd=Math.log,qd=Math.LN2;function Jd(e){return e>>>=0,e===0?32:31-(Gd(e)/qd|0)|0}var bl=64,_l=4194304;function zr(e){switch(e&-e){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: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Tl(e,t){var n=e.pendingLanes;if(n===0)return 0;var l=0,o=e.suspendedLanes,i=e.pingedLanes,f=n&268435455;if(f!==0){var w=f&~o;w!==0?l=zr(w):(i&=f,i!==0&&(l=zr(i)))}else f=n&~o,f!==0?l=zr(f):i!==0&&(l=zr(i));if(l===0)return 0;if(t!==0&&t!==l&&(t&o)===0&&(o=l&-l,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if((l&4)!==0&&(l|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=l;0<t;)n=31-Tt(t),o=1<<n,l|=e[n],t&=~o;return l}function Xd(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64: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 t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Zd(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var f=31-Tt(i),w=1<<f,E=o[f];E===-1?((w&n)===0||(w&l)!==0)&&(o[f]=Xd(w,t)):E<=t&&(e.expiredLanes|=w),i&=~w}}function Fs(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function oa(){var e=bl;return bl<<=1,(bl&4194240)===0&&(bl=64),e}function Us(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Ar(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Tt(t),e[t]=n}function ep(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var l=e.eventTimes;for(e=e.expirationTimes;0<n;){var o=31-Tt(n),i=1<<o;t[o]=0,l[o]=-1,e[o]=-1,n&=~i}}function Ws(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-Tt(n),o=1<<l;o&t|e[l]&t&&(e[l]|=t),n&=~o}}var Te=0;function ia(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var aa,$s,ca,ua,da,Ks=!1,Rl=[],rn=null,ln=null,sn=null,Mr=new Map,Or=new Map,on=[],tp="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 submit".split(" ");function pa(e,t){switch(e){case"focusin":case"focusout":rn=null;break;case"dragenter":case"dragleave":ln=null;break;case"mouseover":case"mouseout":sn=null;break;case"pointerover":case"pointerout":Mr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Or.delete(t.pointerId)}}function Dr(e,t,n,l,o,i){return e===null||e.nativeEvent!==i?(e={blockedOn:t,domEventName:n,eventSystemFlags:l,nativeEvent:i,targetContainers:[o]},t!==null&&(t=Xr(t),t!==null&&$s(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function np(e,t,n,l,o){switch(t){case"focusin":return rn=Dr(rn,e,t,n,l,o),!0;case"dragenter":return ln=Dr(ln,e,t,n,l,o),!0;case"mouseover":return sn=Dr(sn,e,t,n,l,o),!0;case"pointerover":var i=o.pointerId;return Mr.set(i,Dr(Mr.get(i)||null,e,t,n,l,o)),!0;case"gotpointercapture":return i=o.pointerId,Or.set(i,Dr(Or.get(i)||null,e,t,n,l,o)),!0}return!1}function fa(e){var t=Ln(e.target);if(t!==null){var n=Rn(t);if(n!==null){if(t=n.tag,t===13){if(t=Xi(n),t!==null){e.blockedOn=t,da(e.priority,function(){ca(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Ll(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Hs(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);Jn=l,n.target.dispatchEvent(l),Jn=null}else return t=Xr(n),t!==null&&$s(t),e.blockedOn=n,!1;t.shift()}return!0}function ha(e,t,n){Ll(e)&&n.delete(t)}function rp(){Ks=!1,rn!==null&&Ll(rn)&&(rn=null),ln!==null&&Ll(ln)&&(ln=null),sn!==null&&Ll(sn)&&(sn=null),Mr.forEach(ha),Or.forEach(ha)}function Br(e,t){e.blockedOn===t&&(e.blockedOn=null,Ks||(Ks=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,rp)))}function Fr(e){function t(o){return Br(o,e)}if(0<Rl.length){Br(Rl[0],e);for(var n=1;n<Rl.length;n++){var l=Rl[n];l.blockedOn===e&&(l.blockedOn=null)}}for(rn!==null&&Br(rn,e),ln!==null&&Br(ln,e),sn!==null&&Br(sn,e),Mr.forEach(t),Or.forEach(t),n=0;n<on.length;n++)l=on[n],l.blockedOn===e&&(l.blockedOn=null);for(;0<on.length&&(n=on[0],n.blockedOn===null);)fa(n),n.blockedOn===null&&on.shift()}var Xn=W.ReactCurrentBatchConfig,Il=!0;function lp(e,t,n,l){var o=Te,i=Xn.transition;Xn.transition=null;try{Te=1,Vs(e,t,n,l)}finally{Te=o,Xn.transition=i}}function sp(e,t,n,l){var o=Te,i=Xn.transition;Xn.transition=null;try{Te=4,Vs(e,t,n,l)}finally{Te=o,Xn.transition=i}}function Vs(e,t,n,l){if(Il){var o=Hs(e,t,n,l);if(o===null)co(e,t,l,zl,n),pa(e,l);else if(np(o,e,t,n,l))l.stopPropagation();else if(pa(e,l),t&4&&-1<tp.indexOf(e)){for(;o!==null;){var i=Xr(o);if(i!==null&&aa(i),i=Hs(e,t,n,l),i===null&&co(e,t,l,zl,n),i===o)break;o=i}o!==null&&l.stopPropagation()}else co(e,t,l,null,n)}}var zl=null;function Hs(e,t,n,l){if(zl=null,e=Se(l),e=Ln(e),e!==null)if(t=Rn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Xi(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return zl=e,null}function ma(e){switch(e){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"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 1;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"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(Hd()){case Bs:return 1;case la:return 4;case Nl:case Qd:return 16;case sa:return 536870912;default:return 16}default:return 16}}var an=null,Qs=null,Al=null;function ga(){if(Al)return Al;var e,t=Qs,n=t.length,l,o="value"in an?an.value:an.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var f=n-e;for(l=1;l<=f&&t[n-l]===o[i-l];l++);return Al=o.slice(e,1<l?1-l:void 0)}function Ml(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Ol(){return!0}function xa(){return!1}function vt(e){function t(n,l,o,i,f){this._reactName=n,this._targetInst=o,this.type=l,this.nativeEvent=i,this.target=f,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(n=e[w],this[w]=n?n(i):i[w]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Ol:xa,this.isPropagationStopped=xa,this}return B(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Ol)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Ol)},persist:function(){},isPersistent:Ol}),t}var Zn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ys=vt(Zn),Ur=B({},Zn,{view:0,detail:0}),op=vt(Ur),Gs,qs,Wr,Dl=B({},Ur,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Xs,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Wr&&(Wr&&e.type==="mousemove"?(Gs=e.screenX-Wr.screenX,qs=e.screenY-Wr.screenY):qs=Gs=0,Wr=e),Gs)},movementY:function(e){return"movementY"in e?e.movementY:qs}}),ya=vt(Dl),ip=B({},Dl,{dataTransfer:0}),ap=vt(ip),cp=B({},Ur,{relatedTarget:0}),Js=vt(cp),up=B({},Zn,{animationName:0,elapsedTime:0,pseudoElement:0}),dp=vt(up),pp=B({},Zn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),fp=vt(pp),hp=B({},Zn,{data:0}),va=vt(hp),mp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gp={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"},xp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yp(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=xp[e])?!!t[e]:!1}function Xs(){return yp}var vp=B({},Ur,{key:function(e){if(e.key){var t=mp[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Ml(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?gp[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Xs,charCode:function(e){return e.type==="keypress"?Ml(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Ml(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),jp=vt(vp),Sp=B({},Dl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ja=vt(Sp),wp=B({},Ur,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Xs}),kp=vt(wp),Cp=B({},Zn,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ep=vt(Cp),Np=B({},Dl,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Pp=vt(Np),bp=[9,13,27,32],Zs=j&&"CompositionEvent"in window,$r=null;j&&"documentMode"in document&&($r=document.documentMode);var _p=j&&"TextEvent"in window&&!$r,Sa=j&&(!Zs||$r&&8<$r&&11>=$r),wa=" ",ka=!1;function Ca(e,t){switch(e){case"keyup":return bp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ea(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var er=!1;function Tp(e,t){switch(e){case"compositionend":return Ea(t);case"keypress":return t.which!==32?null:(ka=!0,wa);case"textInput":return e=t.data,e===wa&&ka?null:e;default:return null}}function Rp(e,t){if(er)return e==="compositionend"||!Zs&&Ca(e,t)?(e=ga(),Al=Qs=an=null,er=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Sa&&t.locale!=="ko"?null:t.data;default:return null}}var Lp={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 Na(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!Lp[e.type]:t==="textarea"}function Pa(e,t,n,l){Qi(l),t=$l(t,"onChange"),0<t.length&&(n=new Ys("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Kr=null,Vr=null;function Ip(e){Va(e,0)}function Bl(e){var t=sr(e);if(vl(t))return e}function zp(e,t){if(e==="change")return t}var ba=!1;if(j){var eo;if(j){var to="oninput"in document;if(!to){var _a=document.createElement("div");_a.setAttribute("oninput","return;"),to=typeof _a.oninput=="function"}eo=to}else eo=!1;ba=eo&&(!document.documentMode||9<document.documentMode)}function Ta(){Kr&&(Kr.detachEvent("onpropertychange",Ra),Vr=Kr=null)}function Ra(e){if(e.propertyName==="value"&&Bl(Vr)){var t=[];Pa(t,Vr,e,Se(e)),Ji(Ip,t)}}function Ap(e,t,n){e==="focusin"?(Ta(),Kr=t,Vr=n,Kr.attachEvent("onpropertychange",Ra)):e==="focusout"&&Ta()}function Mp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Bl(Vr)}function Op(e,t){if(e==="click")return Bl(t)}function Dp(e,t){if(e==="input"||e==="change")return Bl(t)}function Bp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Rt=typeof Object.is=="function"?Object.is:Bp;function Hr(e,t){if(Rt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),l=Object.keys(t);if(n.length!==l.length)return!1;for(l=0;l<n.length;l++){var o=n[l];if(!p.call(t,o)||!Rt(e[o],t[o]))return!1}return!0}function La(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ia(e,t){var n=La(e);e=0;for(var l;n;){if(n.nodeType===3){if(l=e+n.textContent.length,e<=t&&l>=t)return{node:n,offset:t-e};e=l}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=La(n)}}function za(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?za(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Aa(){for(var e=window,t=Pn();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Pn(e.document)}return t}function no(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Fp(e){var t=Aa(),n=e.focusedElem,l=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&za(n.ownerDocument.documentElement,n)){if(l!==null&&no(n)){if(t=l.start,e=l.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(l.start,o);l=l.end===void 0?i:Math.min(l.end,o),!e.extend&&i>l&&(o=l,l=i,i=o),o=Ia(n,i);var f=Ia(n,l);o&&f&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==f.node||e.focusOffset!==f.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>l?(e.addRange(t),e.extend(f.node,f.offset)):(t.setEnd(f.node,f.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Up=j&&"documentMode"in document&&11>=document.documentMode,tr=null,ro=null,Qr=null,lo=!1;function Ma(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;lo||tr==null||tr!==Pn(l)||(l=tr,"selectionStart"in l&&no(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Qr&&Hr(Qr,l)||(Qr=l,l=$l(ro,"onSelect"),0<l.length&&(t=new Ys("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=tr)))}function Fl(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var nr={animationend:Fl("Animation","AnimationEnd"),animationiteration:Fl("Animation","AnimationIteration"),animationstart:Fl("Animation","AnimationStart"),transitionend:Fl("Transition","TransitionEnd")},so={},Oa={};j&&(Oa=document.createElement("div").style,"AnimationEvent"in window||(delete nr.animationend.animation,delete nr.animationiteration.animation,delete nr.animationstart.animation),"TransitionEvent"in window||delete nr.transitionend.transition);function Ul(e){if(so[e])return so[e];if(!nr[e])return e;var t=nr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Oa)return so[e]=t[n];return e}var Da=Ul("animationend"),Ba=Ul("animationiteration"),Fa=Ul("animationstart"),Ua=Ul("transitionend"),Wa=new Map,$a="abort auxClick 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(" ");function cn(e,t){Wa.set(e,t),y(t,[e])}for(var oo=0;oo<$a.length;oo++){var io=$a[oo],Wp=io.toLowerCase(),$p=io[0].toUpperCase()+io.slice(1);cn(Wp,"on"+$p)}cn(Da,"onAnimationEnd"),cn(Ba,"onAnimationIteration"),cn(Fa,"onAnimationStart"),cn("dblclick","onDoubleClick"),cn("focusin","onFocus"),cn("focusout","onBlur"),cn(Ua,"onTransitionEnd"),C("onMouseEnter",["mouseout","mouseover"]),C("onMouseLeave",["mouseout","mouseover"]),C("onPointerEnter",["pointerout","pointerover"]),C("onPointerLeave",["pointerout","pointerover"]),y("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),y("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),y("onBeforeInput",["compositionend","keypress","textInput","paste"]),y("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),y("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),y("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Yr="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(" "),Kp=new Set("cancel close invalid load scroll toggle".split(" ").concat(Yr));function Ka(e,t,n){var l=e.type||"unknown-event";e.currentTarget=n,Wd(l,t,void 0,e),e.currentTarget=null}function Va(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var l=e[n],o=l.event;l=l.listeners;e:{var i=void 0;if(t)for(var f=l.length-1;0<=f;f--){var w=l[f],E=w.instance,M=w.currentTarget;if(w=w.listener,E!==i&&o.isPropagationStopped())break e;Ka(o,w,M),i=E}else for(f=0;f<l.length;f++){if(w=l[f],E=w.instance,M=w.currentTarget,w=w.listener,E!==i&&o.isPropagationStopped())break e;Ka(o,w,M),i=E}}}if(El)throw e=Ds,El=!1,Ds=null,e}function Le(e,t){var n=t[go];n===void 0&&(n=t[go]=new Set);var l=e+"__bubble";n.has(l)||(Ha(t,e,2,!1),n.add(l))}function ao(e,t,n){var l=0;t&&(l|=4),Ha(n,e,l,t)}var Wl="_reactListening"+Math.random().toString(36).slice(2);function Gr(e){if(!e[Wl]){e[Wl]=!0,u.forEach(function(n){n!=="selectionchange"&&(Kp.has(n)||ao(n,!1,e),ao(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Wl]||(t[Wl]=!0,ao("selectionchange",!1,t))}}function Ha(e,t,n,l){switch(ma(t)){case 1:var o=lp;break;case 4:o=sp;break;default:o=Vs}n=o.bind(null,t,n,e),o=void 0,!Os||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),l?o!==void 0?e.addEventListener(t,n,{capture:!0,passive:o}):e.addEventListener(t,n,!0):o!==void 0?e.addEventListener(t,n,{passive:o}):e.addEventListener(t,n,!1)}function co(e,t,n,l,o){var i=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var f=l.tag;if(f===3||f===4){var w=l.stateNode.containerInfo;if(w===o||w.nodeType===8&&w.parentNode===o)break;if(f===4)for(f=l.return;f!==null;){var E=f.tag;if((E===3||E===4)&&(E=f.stateNode.containerInfo,E===o||E.nodeType===8&&E.parentNode===o))return;f=f.return}for(;w!==null;){if(f=Ln(w),f===null)return;if(E=f.tag,E===5||E===6){l=i=f;continue e}w=w.parentNode}}l=l.return}Ji(function(){var M=i,J=Se(n),X=[];e:{var q=Wa.get(e);if(q!==void 0){var ce=Ys,pe=e;switch(e){case"keypress":if(Ml(n)===0)break e;case"keydown":case"keyup":ce=jp;break;case"focusin":pe="focus",ce=Js;break;case"focusout":pe="blur",ce=Js;break;case"beforeblur":case"afterblur":ce=Js;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=ya;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=ap;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=kp;break;case Da:case Ba:case Fa:ce=dp;break;case Ua:ce=Ep;break;case"scroll":ce=op;break;case"wheel":ce=Pp;break;case"copy":case"cut":case"paste":ce=fp;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=ja}var fe=(t&4)!==0,Ue=!fe&&e==="scroll",R=fe?q!==null?q+"Capture":null:q;fe=[];for(var N=M,z;N!==null;){z=N;var se=z.stateNode;if(z.tag===5&&se!==null&&(z=se,R!==null&&(se=Rr(N,R),se!=null&&fe.push(qr(N,se,z)))),Ue)break;N=N.return}0<fe.length&&(q=new ce(q,pe,null,n,J),X.push({event:q,listeners:fe}))}}if((t&7)===0){e:{if(q=e==="mouseover"||e==="pointerover",ce=e==="mouseout"||e==="pointerout",q&&n!==Jn&&(pe=n.relatedTarget||n.fromElement)&&(Ln(pe)||pe[Qt]))break e;if((ce||q)&&(q=J.window===J?J:(q=J.ownerDocument)?q.defaultView||q.parentWindow:window,ce?(pe=n.relatedTarget||n.toElement,ce=M,pe=pe?Ln(pe):null,pe!==null&&(Ue=Rn(pe),pe!==Ue||pe.tag!==5&&pe.tag!==6)&&(pe=null)):(ce=null,pe=M),ce!==pe)){if(fe=ya,se="onMouseLeave",R="onMouseEnter",N="mouse",(e==="pointerout"||e==="pointerover")&&(fe=ja,se="onPointerLeave",R="onPointerEnter",N="pointer"),Ue=ce==null?q:sr(ce),z=pe==null?q:sr(pe),q=new fe(se,N+"leave",ce,n,J),q.target=Ue,q.relatedTarget=z,se=null,Ln(J)===M&&(fe=new fe(R,N+"enter",pe,n,J),fe.target=z,fe.relatedTarget=Ue,se=fe),Ue=se,ce&&pe)t:{for(fe=ce,R=pe,N=0,z=fe;z;z=rr(z))N++;for(z=0,se=R;se;se=rr(se))z++;for(;0<N-z;)fe=rr(fe),N--;for(;0<z-N;)R=rr(R),z--;for(;N--;){if(fe===R||R!==null&&fe===R.alternate)break t;fe=rr(fe),R=rr(R)}fe=null}else fe=null;ce!==null&&Qa(X,q,ce,fe,!1),pe!==null&&Ue!==null&&Qa(X,Ue,pe,fe,!0)}}e:{if(q=M?sr(M):window,ce=q.nodeName&&q.nodeName.toLowerCase(),ce==="select"||ce==="input"&&q.type==="file")var he=zp;else if(Na(q))if(ba)he=Dp;else{he=Mp;var xe=Ap}else(ce=q.nodeName)&&ce.toLowerCase()==="input"&&(q.type==="checkbox"||q.type==="radio")&&(he=Op);if(he&&(he=he(e,M))){Pa(X,he,n,J);break e}xe&&xe(e,q,M),e==="focusout"&&(xe=q._wrapperState)&&xe.controlled&&q.type==="number"&&Nr(q,"number",q.value)}switch(xe=M?sr(M):window,e){case"focusin":(Na(xe)||xe.contentEditable==="true")&&(tr=xe,ro=M,Qr=null);break;case"focusout":Qr=ro=tr=null;break;case"mousedown":lo=!0;break;case"contextmenu":case"mouseup":case"dragend":lo=!1,Ma(X,n,J);break;case"selectionchange":if(Up)break;case"keydown":case"keyup":Ma(X,n,J)}var ye;if(Zs)e:{switch(e){case"compositionstart":var we="onCompositionStart";break e;case"compositionend":we="onCompositionEnd";break e;case"compositionupdate":we="onCompositionUpdate";break e}we=void 0}else er?Ca(e,n)&&(we="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(we="onCompositionStart");we&&(Sa&&n.locale!=="ko"&&(er||we!=="onCompositionStart"?we==="onCompositionEnd"&&er&&(ye=ga()):(an=J,Qs="value"in an?an.value:an.textContent,er=!0)),xe=$l(M,we),0<xe.length&&(we=new va(we,e,null,n,J),X.push({event:we,listeners:xe}),ye?we.data=ye:(ye=Ea(n),ye!==null&&(we.data=ye)))),(ye=_p?Tp(e,n):Rp(e,n))&&(M=$l(M,"onBeforeInput"),0<M.length&&(J=new va("onBeforeInput","beforeinput",null,n,J),X.push({event:J,listeners:M}),J.data=ye))}Va(X,t)})}function qr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function $l(e,t){for(var n=t+"Capture",l=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Rr(e,n),i!=null&&l.unshift(qr(e,i,o)),i=Rr(e,t),i!=null&&l.push(qr(e,i,o))),e=e.return}return l}function rr(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Qa(e,t,n,l,o){for(var i=t._reactName,f=[];n!==null&&n!==l;){var w=n,E=w.alternate,M=w.stateNode;if(E!==null&&E===l)break;w.tag===5&&M!==null&&(w=M,o?(E=Rr(n,i),E!=null&&f.unshift(qr(n,E,w))):o||(E=Rr(n,i),E!=null&&f.push(qr(n,E,w)))),n=n.return}f.length!==0&&e.push({event:t,listeners:f})}var Vp=/\r\n?/g,Hp=/\u0000|\uFFFD/g;function Ya(e){return(typeof e=="string"?e:""+e).replace(Vp,`
|
|
38
|
+
`).replace(Hp,"")}function Kl(e,t,n){if(t=Ya(t),Ya(e)!==t&&n)throw Error(c(425))}function Vl(){}var uo=null,po=null;function fo(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var ho=typeof setTimeout=="function"?setTimeout:void 0,Qp=typeof clearTimeout=="function"?clearTimeout:void 0,Ga=typeof Promise=="function"?Promise:void 0,Yp=typeof queueMicrotask=="function"?queueMicrotask:typeof Ga<"u"?function(e){return Ga.resolve(null).then(e).catch(Gp)}:ho;function Gp(e){setTimeout(function(){throw e})}function mo(e,t){var n=t,l=0;do{var o=n.nextSibling;if(e.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"){if(l===0){e.removeChild(o),Fr(t);return}l--}else n!=="$"&&n!=="$?"&&n!=="$!"||l++;n=o}while(n);Fr(t)}function un(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function qa(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var lr=Math.random().toString(36).slice(2),Bt="__reactFiber$"+lr,Jr="__reactProps$"+lr,Qt="__reactContainer$"+lr,go="__reactEvents$"+lr,qp="__reactListeners$"+lr,Jp="__reactHandles$"+lr;function Ln(e){var t=e[Bt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Qt]||n[Bt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=qa(e);e!==null;){if(n=e[Bt])return n;e=qa(e)}return t}e=n,n=e.parentNode}return null}function Xr(e){return e=e[Bt]||e[Qt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function sr(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(c(33))}function Hl(e){return e[Jr]||null}var xo=[],or=-1;function dn(e){return{current:e}}function Ie(e){0>or||(e.current=xo[or],xo[or]=null,or--)}function Re(e,t){or++,xo[or]=e.current,e.current=t}var pn={},nt=dn(pn),pt=dn(!1),In=pn;function ir(e,t){var n=e.type.contextTypes;if(!n)return pn;var l=e.stateNode;if(l&&l.__reactInternalMemoizedUnmaskedChildContext===t)return l.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function ft(e){return e=e.childContextTypes,e!=null}function Ql(){Ie(pt),Ie(nt)}function Ja(e,t,n){if(nt.current!==pn)throw Error(c(168));Re(nt,t),Re(pt,n)}function Xa(e,t,n){var l=e.stateNode;if(t=t.childContextTypes,typeof l.getChildContext!="function")return n;l=l.getChildContext();for(var o in l)if(!(o in t))throw Error(c(108,je(e)||"Unknown",o));return B({},n,l)}function Yl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||pn,In=nt.current,Re(nt,e),Re(pt,pt.current),!0}function Za(e,t,n){var l=e.stateNode;if(!l)throw Error(c(169));n?(e=Xa(e,t,In),l.__reactInternalMemoizedMergedChildContext=e,Ie(pt),Ie(nt),Re(nt,e)):Ie(pt),Re(pt,n)}var Yt=null,Gl=!1,yo=!1;function ec(e){Yt===null?Yt=[e]:Yt.push(e)}function Xp(e){Gl=!0,ec(e)}function fn(){if(!yo&&Yt!==null){yo=!0;var e=0,t=Te;try{var n=Yt;for(Te=1;e<n.length;e++){var l=n[e];do l=l(!0);while(l!==null)}Yt=null,Gl=!1}catch(o){throw Yt!==null&&(Yt=Yt.slice(e+1)),na(Bs,fn),o}finally{Te=t,yo=!1}}return null}var ar=[],cr=0,ql=null,Jl=0,Ct=[],Et=0,zn=null,Gt=1,qt="";function An(e,t){ar[cr++]=Jl,ar[cr++]=ql,ql=e,Jl=t}function tc(e,t,n){Ct[Et++]=Gt,Ct[Et++]=qt,Ct[Et++]=zn,zn=e;var l=Gt;e=qt;var o=32-Tt(l)-1;l&=~(1<<o),n+=1;var i=32-Tt(t)+o;if(30<i){var f=o-o%5;i=(l&(1<<f)-1).toString(32),l>>=f,o-=f,Gt=1<<32-Tt(t)+o|n<<o|l,qt=i+e}else Gt=1<<i|n<<o|l,qt=e}function vo(e){e.return!==null&&(An(e,1),tc(e,1,0))}function jo(e){for(;e===ql;)ql=ar[--cr],ar[cr]=null,Jl=ar[--cr],ar[cr]=null;for(;e===zn;)zn=Ct[--Et],Ct[Et]=null,qt=Ct[--Et],Ct[Et]=null,Gt=Ct[--Et],Ct[Et]=null}var jt=null,St=null,Ae=!1,Lt=null;function nc(e,t){var n=_t(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function rc(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,jt=e,St=un(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,jt=e,St=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=zn!==null?{id:Gt,overflow:qt}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=_t(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,jt=e,St=null,!0):!1;default:return!1}}function So(e){return(e.mode&1)!==0&&(e.flags&128)===0}function wo(e){if(Ae){var t=St;if(t){var n=t;if(!rc(e,t)){if(So(e))throw Error(c(418));t=un(n.nextSibling);var l=jt;t&&rc(e,t)?nc(l,n):(e.flags=e.flags&-4097|2,Ae=!1,jt=e)}}else{if(So(e))throw Error(c(418));e.flags=e.flags&-4097|2,Ae=!1,jt=e}}}function lc(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;jt=e}function Xl(e){if(e!==jt)return!1;if(!Ae)return lc(e),Ae=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!fo(e.type,e.memoizedProps)),t&&(t=St)){if(So(e))throw sc(),Error(c(418));for(;t;)nc(e,t),t=un(t.nextSibling)}if(lc(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(c(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){St=un(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}St=null}}else St=jt?un(e.stateNode.nextSibling):null;return!0}function sc(){for(var e=St;e;)e=un(e.nextSibling)}function ur(){St=jt=null,Ae=!1}function ko(e){Lt===null?Lt=[e]:Lt.push(e)}var Zp=W.ReactCurrentBatchConfig;function Zr(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(c(309));var l=n.stateNode}if(!l)throw Error(c(147,e));var o=l,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(f){var w=o.refs;f===null?delete w[i]:w[i]=f},t._stringRef=i,t)}if(typeof e!="string")throw Error(c(284));if(!n._owner)throw Error(c(290,e))}return e}function Zl(e,t){throw e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function oc(e){var t=e._init;return t(e._payload)}function ic(e){function t(R,N){if(e){var z=R.deletions;z===null?(R.deletions=[N],R.flags|=16):z.push(N)}}function n(R,N){if(!e)return null;for(;N!==null;)t(R,N),N=N.sibling;return null}function l(R,N){for(R=new Map;N!==null;)N.key!==null?R.set(N.key,N):R.set(N.index,N),N=N.sibling;return R}function o(R,N){return R=Sn(R,N),R.index=0,R.sibling=null,R}function i(R,N,z){return R.index=z,e?(z=R.alternate,z!==null?(z=z.index,z<N?(R.flags|=2,N):z):(R.flags|=2,N)):(R.flags|=1048576,N)}function f(R){return e&&R.alternate===null&&(R.flags|=2),R}function w(R,N,z,se){return N===null||N.tag!==6?(N=hi(z,R.mode,se),N.return=R,N):(N=o(N,z),N.return=R,N)}function E(R,N,z,se){var he=z.type;return he===Z?J(R,N,z.props.children,se,z.key):N!==null&&(N.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===ve&&oc(he)===N.type)?(se=o(N,z.props),se.ref=Zr(R,N,z),se.return=R,se):(se=ks(z.type,z.key,z.props,null,R.mode,se),se.ref=Zr(R,N,z),se.return=R,se)}function M(R,N,z,se){return N===null||N.tag!==4||N.stateNode.containerInfo!==z.containerInfo||N.stateNode.implementation!==z.implementation?(N=mi(z,R.mode,se),N.return=R,N):(N=o(N,z.children||[]),N.return=R,N)}function J(R,N,z,se,he){return N===null||N.tag!==7?(N=$n(z,R.mode,se,he),N.return=R,N):(N=o(N,z),N.return=R,N)}function X(R,N,z){if(typeof N=="string"&&N!==""||typeof N=="number")return N=hi(""+N,R.mode,z),N.return=R,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case $:return z=ks(N.type,N.key,N.props,null,R.mode,z),z.ref=Zr(R,null,N),z.return=R,z;case K:return N=mi(N,R.mode,z),N.return=R,N;case ve:var se=N._init;return X(R,se(N._payload),z)}if(_n(N)||te(N))return N=$n(N,R.mode,z,null),N.return=R,N;Zl(R,N)}return null}function q(R,N,z,se){var he=N!==null?N.key:null;if(typeof z=="string"&&z!==""||typeof z=="number")return he!==null?null:w(R,N,""+z,se);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case $:return z.key===he?E(R,N,z,se):null;case K:return z.key===he?M(R,N,z,se):null;case ve:return he=z._init,q(R,N,he(z._payload),se)}if(_n(z)||te(z))return he!==null?null:J(R,N,z,se,null);Zl(R,z)}return null}function ce(R,N,z,se,he){if(typeof se=="string"&&se!==""||typeof se=="number")return R=R.get(z)||null,w(N,R,""+se,he);if(typeof se=="object"&&se!==null){switch(se.$$typeof){case $:return R=R.get(se.key===null?z:se.key)||null,E(N,R,se,he);case K:return R=R.get(se.key===null?z:se.key)||null,M(N,R,se,he);case ve:var xe=se._init;return ce(R,N,z,xe(se._payload),he)}if(_n(se)||te(se))return R=R.get(z)||null,J(N,R,se,he,null);Zl(N,se)}return null}function pe(R,N,z,se){for(var he=null,xe=null,ye=N,we=N=0,Je=null;ye!==null&&we<z.length;we++){ye.index>we?(Je=ye,ye=null):Je=ye.sibling;var Pe=q(R,ye,z[we],se);if(Pe===null){ye===null&&(ye=Je);break}e&&ye&&Pe.alternate===null&&t(R,ye),N=i(Pe,N,we),xe===null?he=Pe:xe.sibling=Pe,xe=Pe,ye=Je}if(we===z.length)return n(R,ye),Ae&&An(R,we),he;if(ye===null){for(;we<z.length;we++)ye=X(R,z[we],se),ye!==null&&(N=i(ye,N,we),xe===null?he=ye:xe.sibling=ye,xe=ye);return Ae&&An(R,we),he}for(ye=l(R,ye);we<z.length;we++)Je=ce(ye,R,we,z[we],se),Je!==null&&(e&&Je.alternate!==null&&ye.delete(Je.key===null?we:Je.key),N=i(Je,N,we),xe===null?he=Je:xe.sibling=Je,xe=Je);return e&&ye.forEach(function(wn){return t(R,wn)}),Ae&&An(R,we),he}function fe(R,N,z,se){var he=te(z);if(typeof he!="function")throw Error(c(150));if(z=he.call(z),z==null)throw Error(c(151));for(var xe=he=null,ye=N,we=N=0,Je=null,Pe=z.next();ye!==null&&!Pe.done;we++,Pe=z.next()){ye.index>we?(Je=ye,ye=null):Je=ye.sibling;var wn=q(R,ye,Pe.value,se);if(wn===null){ye===null&&(ye=Je);break}e&&ye&&wn.alternate===null&&t(R,ye),N=i(wn,N,we),xe===null?he=wn:xe.sibling=wn,xe=wn,ye=Je}if(Pe.done)return n(R,ye),Ae&&An(R,we),he;if(ye===null){for(;!Pe.done;we++,Pe=z.next())Pe=X(R,Pe.value,se),Pe!==null&&(N=i(Pe,N,we),xe===null?he=Pe:xe.sibling=Pe,xe=Pe);return Ae&&An(R,we),he}for(ye=l(R,ye);!Pe.done;we++,Pe=z.next())Pe=ce(ye,R,we,Pe.value,se),Pe!==null&&(e&&Pe.alternate!==null&&ye.delete(Pe.key===null?we:Pe.key),N=i(Pe,N,we),xe===null?he=Pe:xe.sibling=Pe,xe=Pe);return e&&ye.forEach(function(If){return t(R,If)}),Ae&&An(R,we),he}function Ue(R,N,z,se){if(typeof z=="object"&&z!==null&&z.type===Z&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case $:e:{for(var he=z.key,xe=N;xe!==null;){if(xe.key===he){if(he=z.type,he===Z){if(xe.tag===7){n(R,xe.sibling),N=o(xe,z.props.children),N.return=R,R=N;break e}}else if(xe.elementType===he||typeof he=="object"&&he!==null&&he.$$typeof===ve&&oc(he)===xe.type){n(R,xe.sibling),N=o(xe,z.props),N.ref=Zr(R,xe,z),N.return=R,R=N;break e}n(R,xe);break}else t(R,xe);xe=xe.sibling}z.type===Z?(N=$n(z.props.children,R.mode,se,z.key),N.return=R,R=N):(se=ks(z.type,z.key,z.props,null,R.mode,se),se.ref=Zr(R,N,z),se.return=R,R=se)}return f(R);case K:e:{for(xe=z.key;N!==null;){if(N.key===xe)if(N.tag===4&&N.stateNode.containerInfo===z.containerInfo&&N.stateNode.implementation===z.implementation){n(R,N.sibling),N=o(N,z.children||[]),N.return=R,R=N;break e}else{n(R,N);break}else t(R,N);N=N.sibling}N=mi(z,R.mode,se),N.return=R,R=N}return f(R);case ve:return xe=z._init,Ue(R,N,xe(z._payload),se)}if(_n(z))return pe(R,N,z,se);if(te(z))return fe(R,N,z,se);Zl(R,z)}return typeof z=="string"&&z!==""||typeof z=="number"?(z=""+z,N!==null&&N.tag===6?(n(R,N.sibling),N=o(N,z),N.return=R,R=N):(n(R,N),N=hi(z,R.mode,se),N.return=R,R=N),f(R)):n(R,N)}return Ue}var dr=ic(!0),ac=ic(!1),es=dn(null),ts=null,pr=null,Co=null;function Eo(){Co=pr=ts=null}function No(e){var t=es.current;Ie(es),e._currentValue=t}function Po(e,t,n){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===n)break;e=e.return}}function fr(e,t){ts=e,Co=pr=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(ht=!0),e.firstContext=null)}function Nt(e){var t=e._currentValue;if(Co!==e)if(e={context:e,memoizedValue:t,next:null},pr===null){if(ts===null)throw Error(c(308));pr=e,ts.dependencies={lanes:0,firstContext:e}}else pr=pr.next=e;return t}var Mn=null;function bo(e){Mn===null?Mn=[e]:Mn.push(e)}function cc(e,t,n,l){var o=t.interleaved;return o===null?(n.next=n,bo(t)):(n.next=o.next,o.next=n),t.interleaved=n,Jt(e,l)}function Jt(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var hn=!1;function _o(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function uc(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function Xt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function mn(e,t,n){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Ne&2)!==0){var o=l.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),l.pending=t,Jt(e,n)}return o=l.interleaved,o===null?(t.next=t,bo(l)):(t.next=o.next,o.next=t),l.interleaved=t,Jt(e,n)}function ns(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Ws(e,n)}}function dc(e,t){var n=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,n===l)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var f={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=f:i=i.next=f,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:l.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:l.shared,effects:l.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function rs(e,t,n,l){var o=e.updateQueue;hn=!1;var i=o.firstBaseUpdate,f=o.lastBaseUpdate,w=o.shared.pending;if(w!==null){o.shared.pending=null;var E=w,M=E.next;E.next=null,f===null?i=M:f.next=M,f=E;var J=e.alternate;J!==null&&(J=J.updateQueue,w=J.lastBaseUpdate,w!==f&&(w===null?J.firstBaseUpdate=M:w.next=M,J.lastBaseUpdate=E))}if(i!==null){var X=o.baseState;f=0,J=M=E=null,w=i;do{var q=w.lane,ce=w.eventTime;if((l&q)===q){J!==null&&(J=J.next={eventTime:ce,lane:0,tag:w.tag,payload:w.payload,callback:w.callback,next:null});e:{var pe=e,fe=w;switch(q=t,ce=n,fe.tag){case 1:if(pe=fe.payload,typeof pe=="function"){X=pe.call(ce,X,q);break e}X=pe;break e;case 3:pe.flags=pe.flags&-65537|128;case 0:if(pe=fe.payload,q=typeof pe=="function"?pe.call(ce,X,q):pe,q==null)break e;X=B({},X,q);break e;case 2:hn=!0}}w.callback!==null&&w.lane!==0&&(e.flags|=64,q=o.effects,q===null?o.effects=[w]:q.push(w))}else ce={eventTime:ce,lane:q,tag:w.tag,payload:w.payload,callback:w.callback,next:null},J===null?(M=J=ce,E=X):J=J.next=ce,f|=q;if(w=w.next,w===null){if(w=o.shared.pending,w===null)break;q=w,w=q.next,q.next=null,o.lastBaseUpdate=q,o.shared.pending=null}}while(!0);if(J===null&&(E=X),o.baseState=E,o.firstBaseUpdate=M,o.lastBaseUpdate=J,t=o.shared.interleaved,t!==null){o=t;do f|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);Bn|=f,e.lanes=f,e.memoizedState=X}}function pc(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var l=e[t],o=l.callback;if(o!==null){if(l.callback=null,l=n,typeof o!="function")throw Error(c(191,o));o.call(l)}}}var el={},Ft=dn(el),tl=dn(el),nl=dn(el);function On(e){if(e===el)throw Error(c(174));return e}function To(e,t){switch(Re(nl,t),Re(tl,e),Re(Ft,el),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:G(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=G(t,e)}Ie(Ft),Re(Ft,t)}function hr(){Ie(Ft),Ie(tl),Ie(nl)}function fc(e){On(nl.current);var t=On(Ft.current),n=G(t,e.type);t!==n&&(Re(tl,e),Re(Ft,n))}function Ro(e){tl.current===e&&(Ie(Ft),Ie(tl))}var Me=dn(0);function ls(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Lo=[];function Io(){for(var e=0;e<Lo.length;e++)Lo[e]._workInProgressVersionPrimary=null;Lo.length=0}var ss=W.ReactCurrentDispatcher,zo=W.ReactCurrentBatchConfig,Dn=0,Oe=null,Ke=null,Ge=null,os=!1,rl=!1,ll=0,ef=0;function rt(){throw Error(c(321))}function Ao(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Rt(e[n],t[n]))return!1;return!0}function Mo(e,t,n,l,o,i){if(Dn=i,Oe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ss.current=e===null||e.memoizedState===null?lf:sf,e=n(l,o),rl){i=0;do{if(rl=!1,ll=0,25<=i)throw Error(c(301));i+=1,Ge=Ke=null,t.updateQueue=null,ss.current=of,e=n(l,o)}while(rl)}if(ss.current=cs,t=Ke!==null&&Ke.next!==null,Dn=0,Ge=Ke=Oe=null,os=!1,t)throw Error(c(300));return e}function Oo(){var e=ll!==0;return ll=0,e}function Ut(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ge===null?Oe.memoizedState=Ge=e:Ge=Ge.next=e,Ge}function Pt(){if(Ke===null){var e=Oe.alternate;e=e!==null?e.memoizedState:null}else e=Ke.next;var t=Ge===null?Oe.memoizedState:Ge.next;if(t!==null)Ge=t,Ke=e;else{if(e===null)throw Error(c(310));Ke=e,e={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},Ge===null?Oe.memoizedState=Ge=e:Ge=Ge.next=e}return Ge}function sl(e,t){return typeof t=="function"?t(e):t}function Do(e){var t=Pt(),n=t.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=e;var l=Ke,o=l.baseQueue,i=n.pending;if(i!==null){if(o!==null){var f=o.next;o.next=i.next,i.next=f}l.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,l=l.baseState;var w=f=null,E=null,M=i;do{var J=M.lane;if((Dn&J)===J)E!==null&&(E=E.next={lane:0,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null}),l=M.hasEagerState?M.eagerState:e(l,M.action);else{var X={lane:J,action:M.action,hasEagerState:M.hasEagerState,eagerState:M.eagerState,next:null};E===null?(w=E=X,f=l):E=E.next=X,Oe.lanes|=J,Bn|=J}M=M.next}while(M!==null&&M!==i);E===null?f=l:E.next=w,Rt(l,t.memoizedState)||(ht=!0),t.memoizedState=l,t.baseState=f,t.baseQueue=E,n.lastRenderedState=l}if(e=n.interleaved,e!==null){o=e;do i=o.lane,Oe.lanes|=i,Bn|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Bo(e){var t=Pt(),n=t.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=e;var l=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var f=o=o.next;do i=e(i,f.action),f=f.next;while(f!==o);Rt(i,t.memoizedState)||(ht=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,l]}function hc(){}function mc(e,t){var n=Oe,l=Pt(),o=t(),i=!Rt(l.memoizedState,o);if(i&&(l.memoizedState=o,ht=!0),l=l.queue,Fo(yc.bind(null,n,l,e),[e]),l.getSnapshot!==t||i||Ge!==null&&Ge.memoizedState.tag&1){if(n.flags|=2048,ol(9,xc.bind(null,n,l,o,t),void 0,null),qe===null)throw Error(c(349));(Dn&30)!==0||gc(n,t,o)}return o}function gc(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Oe.updateQueue,t===null?(t={lastEffect:null,stores:null},Oe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function xc(e,t,n,l){t.value=n,t.getSnapshot=l,vc(t)&&jc(e)}function yc(e,t,n){return n(function(){vc(t)&&jc(e)})}function vc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Rt(e,n)}catch{return!0}}function jc(e){var t=Jt(e,1);t!==null&&Mt(t,e,1,-1)}function Sc(e){var t=Ut();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:sl,lastRenderedState:e},t.queue=e,e=e.dispatch=rf.bind(null,Oe,e),[t.memoizedState,e]}function ol(e,t,n,l){return e={tag:e,create:t,destroy:n,deps:l,next:null},t=Oe.updateQueue,t===null?(t={lastEffect:null,stores:null},Oe.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(l=n.next,n.next=e,e.next=l,t.lastEffect=e)),e}function wc(){return Pt().memoizedState}function is(e,t,n,l){var o=Ut();Oe.flags|=e,o.memoizedState=ol(1|t,n,void 0,l===void 0?null:l)}function as(e,t,n,l){var o=Pt();l=l===void 0?null:l;var i=void 0;if(Ke!==null){var f=Ke.memoizedState;if(i=f.destroy,l!==null&&Ao(l,f.deps)){o.memoizedState=ol(t,n,i,l);return}}Oe.flags|=e,o.memoizedState=ol(1|t,n,i,l)}function kc(e,t){return is(8390656,8,e,t)}function Fo(e,t){return as(2048,8,e,t)}function Cc(e,t){return as(4,2,e,t)}function Ec(e,t){return as(4,4,e,t)}function Nc(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Pc(e,t,n){return n=n!=null?n.concat([e]):null,as(4,4,Nc.bind(null,t,e),n)}function Uo(){}function bc(e,t){var n=Pt();t=t===void 0?null:t;var l=n.memoizedState;return l!==null&&t!==null&&Ao(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function _c(e,t){var n=Pt();t=t===void 0?null:t;var l=n.memoizedState;return l!==null&&t!==null&&Ao(t,l[1])?l[0]:(e=e(),n.memoizedState=[e,t],e)}function Tc(e,t,n){return(Dn&21)===0?(e.baseState&&(e.baseState=!1,ht=!0),e.memoizedState=n):(Rt(n,t)||(n=oa(),Oe.lanes|=n,Bn|=n,e.baseState=!0),t)}function tf(e,t){var n=Te;Te=n!==0&&4>n?n:4,e(!0);var l=zo.transition;zo.transition={};try{e(!1),t()}finally{Te=n,zo.transition=l}}function Rc(){return Pt().memoizedState}function nf(e,t,n){var l=vn(e);if(n={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null},Lc(e))Ic(t,n);else if(n=cc(e,t,n,l),n!==null){var o=ut();Mt(n,e,l,o),zc(n,t,l)}}function rf(e,t,n){var l=vn(e),o={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null};if(Lc(e))Ic(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var f=t.lastRenderedState,w=i(f,n);if(o.hasEagerState=!0,o.eagerState=w,Rt(w,f)){var E=t.interleaved;E===null?(o.next=o,bo(t)):(o.next=E.next,E.next=o),t.interleaved=o;return}}catch{}finally{}n=cc(e,t,o,l),n!==null&&(o=ut(),Mt(n,e,l,o),zc(n,t,l))}}function Lc(e){var t=e.alternate;return e===Oe||t!==null&&t===Oe}function Ic(e,t){rl=os=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function zc(e,t,n){if((n&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Ws(e,n)}}var cs={readContext:Nt,useCallback:rt,useContext:rt,useEffect:rt,useImperativeHandle:rt,useInsertionEffect:rt,useLayoutEffect:rt,useMemo:rt,useReducer:rt,useRef:rt,useState:rt,useDebugValue:rt,useDeferredValue:rt,useTransition:rt,useMutableSource:rt,useSyncExternalStore:rt,useId:rt,unstable_isNewReconciler:!1},lf={readContext:Nt,useCallback:function(e,t){return Ut().memoizedState=[e,t===void 0?null:t],e},useContext:Nt,useEffect:kc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,is(4194308,4,Nc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return is(4194308,4,e,t)},useInsertionEffect:function(e,t){return is(4,2,e,t)},useMemo:function(e,t){var n=Ut();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var l=Ut();return t=n!==void 0?n(t):t,l.memoizedState=l.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},l.queue=e,e=e.dispatch=nf.bind(null,Oe,e),[l.memoizedState,e]},useRef:function(e){var t=Ut();return e={current:e},t.memoizedState=e},useState:Sc,useDebugValue:Uo,useDeferredValue:function(e){return Ut().memoizedState=e},useTransition:function(){var e=Sc(!1),t=e[0];return e=tf.bind(null,e[1]),Ut().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var l=Oe,o=Ut();if(Ae){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),qe===null)throw Error(c(349));(Dn&30)!==0||gc(l,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,kc(yc.bind(null,l,i,e),[e]),l.flags|=2048,ol(9,xc.bind(null,l,i,n,t),void 0,null),n},useId:function(){var e=Ut(),t=qe.identifierPrefix;if(Ae){var n=qt,l=Gt;n=(l&~(1<<32-Tt(l)-1)).toString(32)+n,t=":"+t+"R"+n,n=ll++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=ef++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},sf={readContext:Nt,useCallback:bc,useContext:Nt,useEffect:Fo,useImperativeHandle:Pc,useInsertionEffect:Cc,useLayoutEffect:Ec,useMemo:_c,useReducer:Do,useRef:wc,useState:function(){return Do(sl)},useDebugValue:Uo,useDeferredValue:function(e){var t=Pt();return Tc(t,Ke.memoizedState,e)},useTransition:function(){var e=Do(sl)[0],t=Pt().memoizedState;return[e,t]},useMutableSource:hc,useSyncExternalStore:mc,useId:Rc,unstable_isNewReconciler:!1},of={readContext:Nt,useCallback:bc,useContext:Nt,useEffect:Fo,useImperativeHandle:Pc,useInsertionEffect:Cc,useLayoutEffect:Ec,useMemo:_c,useReducer:Bo,useRef:wc,useState:function(){return Bo(sl)},useDebugValue:Uo,useDeferredValue:function(e){var t=Pt();return Ke===null?t.memoizedState=e:Tc(t,Ke.memoizedState,e)},useTransition:function(){var e=Bo(sl)[0],t=Pt().memoizedState;return[e,t]},useMutableSource:hc,useSyncExternalStore:mc,useId:Rc,unstable_isNewReconciler:!1};function It(e,t){if(e&&e.defaultProps){t=B({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Wo(e,t,n,l){t=e.memoizedState,n=n(l,t),n=n==null?t:B({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var us={isMounted:function(e){return(e=e._reactInternals)?Rn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var l=ut(),o=vn(e),i=Xt(l,o);i.payload=t,n!=null&&(i.callback=n),t=mn(e,i,o),t!==null&&(Mt(t,e,o,l),ns(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=ut(),o=vn(e),i=Xt(l,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=mn(e,i,o),t!==null&&(Mt(t,e,o,l),ns(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=ut(),l=vn(e),o=Xt(n,l);o.tag=2,t!=null&&(o.callback=t),t=mn(e,o,l),t!==null&&(Mt(t,e,l,n),ns(t,e,l))}};function Ac(e,t,n,l,o,i,f){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,i,f):t.prototype&&t.prototype.isPureReactComponent?!Hr(n,l)||!Hr(o,i):!0}function Mc(e,t,n){var l=!1,o=pn,i=t.contextType;return typeof i=="object"&&i!==null?i=Nt(i):(o=ft(t)?In:nt.current,l=t.contextTypes,i=(l=l!=null)?ir(e,o):pn),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=us,e.stateNode=t,t._reactInternals=e,l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function Oc(e,t,n,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,l),t.state!==e&&us.enqueueReplaceState(t,t.state,null)}function $o(e,t,n,l){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},_o(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=Nt(i):(i=ft(t)?In:nt.current,o.context=ir(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Wo(e,t,i,n),o.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(t=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),t!==o.state&&us.enqueueReplaceState(o,o.state,null),rs(e,n,o,l),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function mr(e,t){try{var n="",l=t;do n+=le(l),l=l.return;while(l);var o=n}catch(i){o=`
|
|
39
|
+
Error generating stack: `+i.message+`
|
|
40
|
+
`+i.stack}return{value:e,source:t,stack:o,digest:null}}function Ko(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Vo(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var af=typeof WeakMap=="function"?WeakMap:Map;function Dc(e,t,n){n=Xt(-1,n),n.tag=3,n.payload={element:null};var l=t.value;return n.callback=function(){xs||(xs=!0,oi=l),Vo(e,t)},n}function Bc(e,t,n){n=Xt(-1,n),n.tag=3;var l=e.type.getDerivedStateFromError;if(typeof l=="function"){var o=t.value;n.payload=function(){return l(o)},n.callback=function(){Vo(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Vo(e,t),typeof l!="function"&&(xn===null?xn=new Set([this]):xn.add(this));var f=t.stack;this.componentDidCatch(t.value,{componentStack:f!==null?f:""})}),n}function Fc(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new af;var o=new Set;l.set(t,o)}else o=l.get(t),o===void 0&&(o=new Set,l.set(t,o));o.has(n)||(o.add(n),e=wf.bind(null,e,t,n),t.then(e,e))}function Uc(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function Wc(e,t,n,l,o){return(e.mode&1)===0?(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=Xt(-1,1),t.tag=2,mn(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=o,e)}var cf=W.ReactCurrentOwner,ht=!1;function ct(e,t,n,l){t.child=e===null?ac(t,null,n,l):dr(t,e.child,n,l)}function $c(e,t,n,l,o){n=n.render;var i=t.ref;return fr(t,o),l=Mo(e,t,n,l,i,o),n=Oo(),e!==null&&!ht?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Zt(e,t,o)):(Ae&&n&&vo(t),t.flags|=1,ct(e,t,l,o),t.child)}function Kc(e,t,n,l,o){if(e===null){var i=n.type;return typeof i=="function"&&!fi(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Vc(e,t,i,l,o)):(e=ks(n.type,null,l,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,(e.lanes&o)===0){var f=i.memoizedProps;if(n=n.compare,n=n!==null?n:Hr,n(f,l)&&e.ref===t.ref)return Zt(e,t,o)}return t.flags|=1,e=Sn(i,l),e.ref=t.ref,e.return=t,t.child=e}function Vc(e,t,n,l,o){if(e!==null){var i=e.memoizedProps;if(Hr(i,l)&&e.ref===t.ref)if(ht=!1,t.pendingProps=l=i,(e.lanes&o)!==0)(e.flags&131072)!==0&&(ht=!0);else return t.lanes=e.lanes,Zt(e,t,o)}return Ho(e,t,n,l,o)}function Hc(e,t,n){var l=t.pendingProps,o=l.children,i=e!==null?e.memoizedState:null;if(l.mode==="hidden")if((t.mode&1)===0)t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Re(xr,wt),wt|=n;else{if((n&1073741824)===0)return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Re(xr,wt),wt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=i!==null?i.baseLanes:n,Re(xr,wt),wt|=l}else i!==null?(l=i.baseLanes|n,t.memoizedState=null):l=n,Re(xr,wt),wt|=l;return ct(e,t,o,n),t.child}function Qc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Ho(e,t,n,l,o){var i=ft(n)?In:nt.current;return i=ir(t,i),fr(t,o),n=Mo(e,t,n,l,i,o),l=Oo(),e!==null&&!ht?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Zt(e,t,o)):(Ae&&l&&vo(t),t.flags|=1,ct(e,t,n,o),t.child)}function Yc(e,t,n,l,o){if(ft(n)){var i=!0;Yl(t)}else i=!1;if(fr(t,o),t.stateNode===null)ps(e,t),Mc(t,n,l),$o(t,n,l,o),l=!0;else if(e===null){var f=t.stateNode,w=t.memoizedProps;f.props=w;var E=f.context,M=n.contextType;typeof M=="object"&&M!==null?M=Nt(M):(M=ft(n)?In:nt.current,M=ir(t,M));var J=n.getDerivedStateFromProps,X=typeof J=="function"||typeof f.getSnapshotBeforeUpdate=="function";X||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(w!==l||E!==M)&&Oc(t,f,l,M),hn=!1;var q=t.memoizedState;f.state=q,rs(t,l,f,o),E=t.memoizedState,w!==l||q!==E||pt.current||hn?(typeof J=="function"&&(Wo(t,n,J,l),E=t.memoizedState),(w=hn||Ac(t,n,w,l,q,E,M))?(X||typeof f.UNSAFE_componentWillMount!="function"&&typeof f.componentWillMount!="function"||(typeof f.componentWillMount=="function"&&f.componentWillMount(),typeof f.UNSAFE_componentWillMount=="function"&&f.UNSAFE_componentWillMount()),typeof f.componentDidMount=="function"&&(t.flags|=4194308)):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=E),f.props=l,f.state=E,f.context=M,l=w):(typeof f.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{f=t.stateNode,uc(e,t),w=t.memoizedProps,M=t.type===t.elementType?w:It(t.type,w),f.props=M,X=t.pendingProps,q=f.context,E=n.contextType,typeof E=="object"&&E!==null?E=Nt(E):(E=ft(n)?In:nt.current,E=ir(t,E));var ce=n.getDerivedStateFromProps;(J=typeof ce=="function"||typeof f.getSnapshotBeforeUpdate=="function")||typeof f.UNSAFE_componentWillReceiveProps!="function"&&typeof f.componentWillReceiveProps!="function"||(w!==X||q!==E)&&Oc(t,f,l,E),hn=!1,q=t.memoizedState,f.state=q,rs(t,l,f,o);var pe=t.memoizedState;w!==X||q!==pe||pt.current||hn?(typeof ce=="function"&&(Wo(t,n,ce,l),pe=t.memoizedState),(M=hn||Ac(t,n,M,l,q,pe,E)||!1)?(J||typeof f.UNSAFE_componentWillUpdate!="function"&&typeof f.componentWillUpdate!="function"||(typeof f.componentWillUpdate=="function"&&f.componentWillUpdate(l,pe,E),typeof f.UNSAFE_componentWillUpdate=="function"&&f.UNSAFE_componentWillUpdate(l,pe,E)),typeof f.componentDidUpdate=="function"&&(t.flags|=4),typeof f.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof f.componentDidUpdate!="function"||w===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=pe),f.props=l,f.state=pe,f.context=E,l=M):(typeof f.componentDidUpdate!="function"||w===e.memoizedProps&&q===e.memoizedState||(t.flags|=4),typeof f.getSnapshotBeforeUpdate!="function"||w===e.memoizedProps&&q===e.memoizedState||(t.flags|=1024),l=!1)}return Qo(e,t,n,l,i,o)}function Qo(e,t,n,l,o,i){Qc(e,t);var f=(t.flags&128)!==0;if(!l&&!f)return o&&Za(t,n,!1),Zt(e,t,i);l=t.stateNode,cf.current=t;var w=f&&typeof n.getDerivedStateFromError!="function"?null:l.render();return t.flags|=1,e!==null&&f?(t.child=dr(t,e.child,null,i),t.child=dr(t,null,w,i)):ct(e,t,w,i),t.memoizedState=l.state,o&&Za(t,n,!0),t.child}function Gc(e){var t=e.stateNode;t.pendingContext?Ja(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Ja(e,t.context,!1),To(e,t.containerInfo)}function qc(e,t,n,l,o){return ur(),ko(o),t.flags|=256,ct(e,t,n,l),t.child}var Yo={dehydrated:null,treeContext:null,retryLane:0};function Go(e){return{baseLanes:e,cachePool:null,transitions:null}}function Jc(e,t,n){var l=t.pendingProps,o=Me.current,i=!1,f=(t.flags&128)!==0,w;if((w=f)||(w=e!==null&&e.memoizedState===null?!1:(o&2)!==0),w?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),Re(Me,o&1),e===null)return wo(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?((t.mode&1)===0?t.lanes=1:e.data==="$!"?t.lanes=8:t.lanes=1073741824,null):(f=l.children,e=l.fallback,i?(l=t.mode,i=t.child,f={mode:"hidden",children:f},(l&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=f):i=Cs(f,l,0,null),e=$n(e,l,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Go(n),t.memoizedState=Yo,e):qo(t,f));if(o=e.memoizedState,o!==null&&(w=o.dehydrated,w!==null))return uf(e,t,f,l,w,o,n);if(i){i=l.fallback,f=t.mode,o=e.child,w=o.sibling;var E={mode:"hidden",children:l.children};return(f&1)===0&&t.child!==o?(l=t.child,l.childLanes=0,l.pendingProps=E,t.deletions=null):(l=Sn(o,E),l.subtreeFlags=o.subtreeFlags&14680064),w!==null?i=Sn(w,i):(i=$n(i,f,n,null),i.flags|=2),i.return=t,l.return=t,l.sibling=i,t.child=l,l=i,i=t.child,f=e.child.memoizedState,f=f===null?Go(n):{baseLanes:f.baseLanes|n,cachePool:null,transitions:f.transitions},i.memoizedState=f,i.childLanes=e.childLanes&~n,t.memoizedState=Yo,l}return i=e.child,e=i.sibling,l=Sn(i,{mode:"visible",children:l.children}),(t.mode&1)===0&&(l.lanes=n),l.return=t,l.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=l,t.memoizedState=null,l}function qo(e,t){return t=Cs({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ds(e,t,n,l){return l!==null&&ko(l),dr(t,e.child,null,n),e=qo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function uf(e,t,n,l,o,i,f){if(n)return t.flags&256?(t.flags&=-257,l=Ko(Error(c(422))),ds(e,t,f,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=l.fallback,o=t.mode,l=Cs({mode:"visible",children:l.children},o,0,null),i=$n(i,o,f,null),i.flags|=2,l.return=t,i.return=t,l.sibling=i,t.child=l,(t.mode&1)!==0&&dr(t,e.child,null,f),t.child.memoizedState=Go(f),t.memoizedState=Yo,i);if((t.mode&1)===0)return ds(e,t,f,null);if(o.data==="$!"){if(l=o.nextSibling&&o.nextSibling.dataset,l)var w=l.dgst;return l=w,i=Error(c(419)),l=Ko(i,l,void 0),ds(e,t,f,l)}if(w=(f&e.childLanes)!==0,ht||w){if(l=qe,l!==null){switch(f&-f){case 4:o=2;break;case 16:o=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=(o&(l.suspendedLanes|f))!==0?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Jt(e,o),Mt(l,e,o,-1))}return pi(),l=Ko(Error(c(421))),ds(e,t,f,l)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=kf.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,St=un(o.nextSibling),jt=t,Ae=!0,Lt=null,e!==null&&(Ct[Et++]=Gt,Ct[Et++]=qt,Ct[Et++]=zn,Gt=e.id,qt=e.overflow,zn=t),t=qo(t,l.children),t.flags|=4096,t)}function Xc(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Po(e.return,t,n)}function Jo(e,t,n,l,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=l,i.tail=n,i.tailMode=o)}function Zc(e,t,n){var l=t.pendingProps,o=l.revealOrder,i=l.tail;if(ct(e,t,l.children,n),l=Me.current,(l&2)!==0)l=l&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Xc(e,n,t);else if(e.tag===19)Xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}l&=1}if(Re(Me,l),(t.mode&1)===0)t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&ls(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Jo(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&ls(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Jo(t,!0,n,null,i);break;case"together":Jo(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ps(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Zt(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Bn|=t.lanes,(n&t.childLanes)===0)return null;if(e!==null&&t.child!==e.child)throw Error(c(153));if(t.child!==null){for(e=t.child,n=Sn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Sn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function df(e,t,n){switch(t.tag){case 3:Gc(t),ur();break;case 5:fc(t);break;case 1:ft(t.type)&&Yl(t);break;case 4:To(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,o=t.memoizedProps.value;Re(es,l._currentValue),l._currentValue=o;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?(Re(Me,Me.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?Jc(e,t,n):(Re(Me,Me.current&1),e=Zt(e,t,n),e!==null?e.sibling:null);Re(Me,Me.current&1);break;case 19:if(l=(n&t.childLanes)!==0,(e.flags&128)!==0){if(l)return Zc(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Re(Me,Me.current),l)break;return null;case 22:case 23:return t.lanes=0,Hc(e,t,n)}return Zt(e,t,n)}var eu,Xo,tu,nu;eu=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}},Xo=function(){},tu=function(e,t,n,l){var o=e.memoizedProps;if(o!==l){e=t.stateNode,On(Ft.current);var i=null;switch(n){case"input":o=Er(e,o),l=Er(e,l),i=[];break;case"select":o=B({},o,{value:void 0}),l=B({},l,{value:void 0}),i=[];break;case"textarea":o=Tn(e,o),l=Tn(e,l),i=[];break;default:typeof o.onClick!="function"&&typeof l.onClick=="function"&&(e.onclick=Vl)}_r(n,l);var f;n=null;for(M in o)if(!l.hasOwnProperty(M)&&o.hasOwnProperty(M)&&o[M]!=null)if(M==="style"){var w=o[M];for(f in w)w.hasOwnProperty(f)&&(n||(n={}),n[f]="")}else M!=="dangerouslySetInnerHTML"&&M!=="children"&&M!=="suppressContentEditableWarning"&&M!=="suppressHydrationWarning"&&M!=="autoFocus"&&(x.hasOwnProperty(M)?i||(i=[]):(i=i||[]).push(M,null));for(M in l){var E=l[M];if(w=o!=null?o[M]:void 0,l.hasOwnProperty(M)&&E!==w&&(E!=null||w!=null))if(M==="style")if(w){for(f in w)!w.hasOwnProperty(f)||E&&E.hasOwnProperty(f)||(n||(n={}),n[f]="");for(f in E)E.hasOwnProperty(f)&&w[f]!==E[f]&&(n||(n={}),n[f]=E[f])}else n||(i||(i=[]),i.push(M,n)),n=E;else M==="dangerouslySetInnerHTML"?(E=E?E.__html:void 0,w=w?w.__html:void 0,E!=null&&w!==E&&(i=i||[]).push(M,E)):M==="children"?typeof E!="string"&&typeof E!="number"||(i=i||[]).push(M,""+E):M!=="suppressContentEditableWarning"&&M!=="suppressHydrationWarning"&&(x.hasOwnProperty(M)?(E!=null&&M==="onScroll"&&Le("scroll",e),i||w===E||(i=[])):(i=i||[]).push(M,E))}n&&(i=i||[]).push("style",n);var M=i;(t.updateQueue=M)&&(t.flags|=4)}},nu=function(e,t,n,l){n!==l&&(t.flags|=4)};function il(e,t){if(!Ae)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var l=null;n!==null;)n.alternate!==null&&(l=n),n=n.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function lt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,l=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags&14680064,l|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,l|=o.subtreeFlags,l|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=l,e.childLanes=n,t}function pf(e,t,n){var l=t.pendingProps;switch(jo(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return lt(t),null;case 1:return ft(t.type)&&Ql(),lt(t),null;case 3:return l=t.stateNode,hr(),Ie(pt),Ie(nt),Io(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Xl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Lt!==null&&(ci(Lt),Lt=null))),Xo(e,t),lt(t),null;case 5:Ro(t);var o=On(nl.current);if(n=t.type,e!==null&&t.stateNode!=null)tu(e,t,n,l,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!l){if(t.stateNode===null)throw Error(c(166));return lt(t),null}if(e=On(Ft.current),Xl(t)){l=t.stateNode,n=t.type;var i=t.memoizedProps;switch(l[Bt]=t,l[Jr]=i,e=(t.mode&1)!==0,n){case"dialog":Le("cancel",l),Le("close",l);break;case"iframe":case"object":case"embed":Le("load",l);break;case"video":case"audio":for(o=0;o<Yr.length;o++)Le(Yr[o],l);break;case"source":Le("error",l);break;case"img":case"image":case"link":Le("error",l),Le("load",l);break;case"details":Le("toggle",l);break;case"input":bn(l,i),Le("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!i.multiple},Le("invalid",l);break;case"textarea":Ht(l,i),Le("invalid",l)}_r(n,i),o=null;for(var f in i)if(i.hasOwnProperty(f)){var w=i[f];f==="children"?typeof w=="string"?l.textContent!==w&&(i.suppressHydrationWarning!==!0&&Kl(l.textContent,w,e),o=["children",w]):typeof w=="number"&&l.textContent!==""+w&&(i.suppressHydrationWarning!==!0&&Kl(l.textContent,w,e),o=["children",""+w]):x.hasOwnProperty(f)&&w!=null&&f==="onScroll"&&Le("scroll",l)}switch(n){case"input":Yn(l),jl(l,i,!0);break;case"textarea":Yn(l),Sl(l);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(l.onclick=Vl)}l=o,t.updateQueue=l,l!==null&&(t.flags|=4)}else{f=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=wl(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=f.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=f.createElement(n,{is:l.is}):(e=f.createElement(n),n==="select"&&(f=e,l.multiple?f.multiple=!0:l.size&&(f.size=l.size))):e=f.createElementNS(e,n),e[Bt]=t,e[Jr]=l,eu(e,t,!1,!1),t.stateNode=e;e:{switch(f=Tr(n,l),n){case"dialog":Le("cancel",e),Le("close",e),o=l;break;case"iframe":case"object":case"embed":Le("load",e),o=l;break;case"video":case"audio":for(o=0;o<Yr.length;o++)Le(Yr[o],e);o=l;break;case"source":Le("error",e),o=l;break;case"img":case"image":case"link":Le("error",e),Le("load",e),o=l;break;case"details":Le("toggle",e),o=l;break;case"input":bn(e,l),o=Er(e,l),Le("invalid",e);break;case"option":o=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},o=B({},l,{value:void 0}),Le("invalid",e);break;case"textarea":Ht(e,l),o=Tn(e,l),Le("invalid",e);break;default:o=l}_r(n,o),w=o;for(i in w)if(w.hasOwnProperty(i)){var E=w[i];i==="style"?br(e,E):i==="dangerouslySetInnerHTML"?(E=E?E.__html:void 0,E!=null&&ee(e,E)):i==="children"?typeof E=="string"?(n!=="textarea"||E!=="")&&_e(e,E):typeof E=="number"&&_e(e,""+E):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(x.hasOwnProperty(i)?E!=null&&i==="onScroll"&&Le("scroll",e):E!=null&&O(e,i,E,f))}switch(n){case"input":Yn(e),jl(e,l,!1);break;case"textarea":Yn(e),Sl(e);break;case"option":l.value!=null&&e.setAttribute("value",""+ke(l.value));break;case"select":e.multiple=!!l.multiple,i=l.value,i!=null?Vt(e,!!l.multiple,i,!1):l.defaultValue!=null&&Vt(e,!!l.multiple,l.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Vl)}switch(n){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}}l&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return lt(t),null;case 6:if(e&&t.stateNode!=null)nu(e,t,e.memoizedProps,l);else{if(typeof l!="string"&&t.stateNode===null)throw Error(c(166));if(n=On(nl.current),On(Ft.current),Xl(t)){if(l=t.stateNode,n=t.memoizedProps,l[Bt]=t,(i=l.nodeValue!==n)&&(e=jt,e!==null))switch(e.tag){case 3:Kl(l.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Kl(l.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else l=(n.nodeType===9?n:n.ownerDocument).createTextNode(l),l[Bt]=t,t.stateNode=l}return lt(t),null;case 13:if(Ie(Me),l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Ae&&St!==null&&(t.mode&1)!==0&&(t.flags&128)===0)sc(),ur(),t.flags|=98560,i=!1;else if(i=Xl(t),l!==null&&l.dehydrated!==null){if(e===null){if(!i)throw Error(c(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(c(317));i[Bt]=t}else ur(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;lt(t),i=!1}else Lt!==null&&(ci(Lt),Lt=null),i=!0;if(!i)return t.flags&65536?t:null}return(t.flags&128)!==0?(t.lanes=n,t):(l=l!==null,l!==(e!==null&&e.memoizedState!==null)&&l&&(t.child.flags|=8192,(t.mode&1)!==0&&(e===null||(Me.current&1)!==0?Ve===0&&(Ve=3):pi())),t.updateQueue!==null&&(t.flags|=4),lt(t),null);case 4:return hr(),Xo(e,t),e===null&&Gr(t.stateNode.containerInfo),lt(t),null;case 10:return No(t.type._context),lt(t),null;case 17:return ft(t.type)&&Ql(),lt(t),null;case 19:if(Ie(Me),i=t.memoizedState,i===null)return lt(t),null;if(l=(t.flags&128)!==0,f=i.rendering,f===null)if(l)il(i,!1);else{if(Ve!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(f=ls(e),f!==null){for(t.flags|=128,il(i,!1),l=f.updateQueue,l!==null&&(t.updateQueue=l,t.flags|=4),t.subtreeFlags=0,l=n,n=t.child;n!==null;)i=n,e=l,i.flags&=14680066,f=i.alternate,f===null?(i.childLanes=0,i.lanes=e,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=f.childLanes,i.lanes=f.lanes,i.child=f.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=f.memoizedProps,i.memoizedState=f.memoizedState,i.updateQueue=f.updateQueue,i.type=f.type,e=f.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Re(Me,Me.current&1|2),t.child}e=e.sibling}i.tail!==null&&Fe()>yr&&(t.flags|=128,l=!0,il(i,!1),t.lanes=4194304)}else{if(!l)if(e=ls(f),e!==null){if(t.flags|=128,l=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),il(i,!0),i.tail===null&&i.tailMode==="hidden"&&!f.alternate&&!Ae)return lt(t),null}else 2*Fe()-i.renderingStartTime>yr&&n!==1073741824&&(t.flags|=128,l=!0,il(i,!1),t.lanes=4194304);i.isBackwards?(f.sibling=t.child,t.child=f):(n=i.last,n!==null?n.sibling=f:t.child=f,i.last=f)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Fe(),t.sibling=null,n=Me.current,Re(Me,l?n&1|2:n&1),t):(lt(t),null);case 22:case 23:return di(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(wt&1073741824)!==0&&(lt(t),t.subtreeFlags&6&&(t.flags|=8192)):lt(t),null;case 24:return null;case 25:return null}throw Error(c(156,t.tag))}function ff(e,t){switch(jo(t),t.tag){case 1:return ft(t.type)&&Ql(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return hr(),Ie(pt),Ie(nt),Io(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return Ro(t),null;case 13:if(Ie(Me),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));ur()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ie(Me),null;case 4:return hr(),null;case 10:return No(t.type._context),null;case 22:case 23:return di(),null;case 24:return null;default:return null}}var fs=!1,st=!1,hf=typeof WeakSet=="function"?WeakSet:Set,de=null;function gr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(l){De(e,t,l)}else n.current=null}function Zo(e,t,n){try{n()}catch(l){De(e,t,l)}}var ru=!1;function mf(e,t){if(uo=Il,e=Aa(),no(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var l=n.getSelection&&n.getSelection();if(l&&l.rangeCount!==0){n=l.anchorNode;var o=l.anchorOffset,i=l.focusNode;l=l.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var f=0,w=-1,E=-1,M=0,J=0,X=e,q=null;t:for(;;){for(var ce;X!==n||o!==0&&X.nodeType!==3||(w=f+o),X!==i||l!==0&&X.nodeType!==3||(E=f+l),X.nodeType===3&&(f+=X.nodeValue.length),(ce=X.firstChild)!==null;)q=X,X=ce;for(;;){if(X===e)break t;if(q===n&&++M===o&&(w=f),q===i&&++J===l&&(E=f),(ce=X.nextSibling)!==null)break;X=q,q=X.parentNode}X=ce}n=w===-1||E===-1?null:{start:w,end:E}}else n=null}n=n||{start:0,end:0}}else n=null;for(po={focusedElem:e,selectionRange:n},Il=!1,de=t;de!==null;)if(t=de,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,de=e;else for(;de!==null;){t=de;try{var pe=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(pe!==null){var fe=pe.memoizedProps,Ue=pe.memoizedState,R=t.stateNode,N=R.getSnapshotBeforeUpdate(t.elementType===t.type?fe:It(t.type,fe),Ue);R.__reactInternalSnapshotBeforeUpdate=N}break;case 3:var z=t.stateNode.containerInfo;z.nodeType===1?z.textContent="":z.nodeType===9&&z.documentElement&&z.removeChild(z.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(se){De(t,t.return,se)}if(e=t.sibling,e!==null){e.return=t.return,de=e;break}de=t.return}return pe=ru,ru=!1,pe}function al(e,t,n){var l=t.updateQueue;if(l=l!==null?l.lastEffect:null,l!==null){var o=l=l.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Zo(t,n,i)}o=o.next}while(o!==l)}}function hs(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var l=n.create;n.destroy=l()}n=n.next}while(n!==t)}}function ei(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function lu(e){var t=e.alternate;t!==null&&(e.alternate=null,lu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Bt],delete t[Jr],delete t[go],delete t[qp],delete t[Jp])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function su(e){return e.tag===5||e.tag===3||e.tag===4}function ou(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||su(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ti(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Vl));else if(l!==4&&(e=e.child,e!==null))for(ti(e,t,n),e=e.sibling;e!==null;)ti(e,t,n),e=e.sibling}function ni(e,t,n){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(l!==4&&(e=e.child,e!==null))for(ni(e,t,n),e=e.sibling;e!==null;)ni(e,t,n),e=e.sibling}var et=null,zt=!1;function gn(e,t,n){for(n=n.child;n!==null;)iu(e,t,n),n=n.sibling}function iu(e,t,n){if(Dt&&typeof Dt.onCommitFiberUnmount=="function")try{Dt.onCommitFiberUnmount(Pl,n)}catch{}switch(n.tag){case 5:st||gr(n,t);case 6:var l=et,o=zt;et=null,gn(e,t,n),et=l,zt=o,et!==null&&(zt?(e=et,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):et.removeChild(n.stateNode));break;case 18:et!==null&&(zt?(e=et,n=n.stateNode,e.nodeType===8?mo(e.parentNode,n):e.nodeType===1&&mo(e,n),Fr(e)):mo(et,n.stateNode));break;case 4:l=et,o=zt,et=n.stateNode.containerInfo,zt=!0,gn(e,t,n),et=l,zt=o;break;case 0:case 11:case 14:case 15:if(!st&&(l=n.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){o=l=l.next;do{var i=o,f=i.destroy;i=i.tag,f!==void 0&&((i&2)!==0||(i&4)!==0)&&Zo(n,t,f),o=o.next}while(o!==l)}gn(e,t,n);break;case 1:if(!st&&(gr(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=n.memoizedProps,l.state=n.memoizedState,l.componentWillUnmount()}catch(w){De(n,t,w)}gn(e,t,n);break;case 21:gn(e,t,n);break;case 22:n.mode&1?(st=(l=st)||n.memoizedState!==null,gn(e,t,n),st=l):gn(e,t,n);break;default:gn(e,t,n)}}function au(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new hf),t.forEach(function(l){var o=Cf.bind(null,e,l);n.has(l)||(n.add(l),l.then(o,o))})}}function At(e,t){var n=t.deletions;if(n!==null)for(var l=0;l<n.length;l++){var o=n[l];try{var i=e,f=t,w=f;e:for(;w!==null;){switch(w.tag){case 5:et=w.stateNode,zt=!1;break e;case 3:et=w.stateNode.containerInfo,zt=!0;break e;case 4:et=w.stateNode.containerInfo,zt=!0;break e}w=w.return}if(et===null)throw Error(c(160));iu(i,f,o),et=null,zt=!1;var E=o.alternate;E!==null&&(E.return=null),o.return=null}catch(M){De(o,t,M)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)cu(t,e),t=t.sibling}function cu(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(At(t,e),Wt(e),l&4){try{al(3,e,e.return),hs(3,e)}catch(fe){De(e,e.return,fe)}try{al(5,e,e.return)}catch(fe){De(e,e.return,fe)}}break;case 1:At(t,e),Wt(e),l&512&&n!==null&&gr(n,n.return);break;case 5:if(At(t,e),Wt(e),l&512&&n!==null&&gr(n,n.return),e.flags&32){var o=e.stateNode;try{_e(o,"")}catch(fe){De(e,e.return,fe)}}if(l&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,f=n!==null?n.memoizedProps:i,w=e.type,E=e.updateQueue;if(e.updateQueue=null,E!==null)try{w==="input"&&i.type==="radio"&&i.name!=null&&Gn(o,i),Tr(w,f);var M=Tr(w,i);for(f=0;f<E.length;f+=2){var J=E[f],X=E[f+1];J==="style"?br(o,X):J==="dangerouslySetInnerHTML"?ee(o,X):J==="children"?_e(o,X):O(o,J,X,M)}switch(w){case"input":qn(o,i);break;case"textarea":Pr(o,i);break;case"select":var q=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var ce=i.value;ce!=null?Vt(o,!!i.multiple,ce,!1):q!==!!i.multiple&&(i.defaultValue!=null?Vt(o,!!i.multiple,i.defaultValue,!0):Vt(o,!!i.multiple,i.multiple?[]:"",!1))}o[Jr]=i}catch(fe){De(e,e.return,fe)}}break;case 6:if(At(t,e),Wt(e),l&4){if(e.stateNode===null)throw Error(c(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(fe){De(e,e.return,fe)}}break;case 3:if(At(t,e),Wt(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Fr(t.containerInfo)}catch(fe){De(e,e.return,fe)}break;case 4:At(t,e),Wt(e);break;case 13:At(t,e),Wt(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(si=Fe())),l&4&&au(e);break;case 22:if(J=n!==null&&n.memoizedState!==null,e.mode&1?(st=(M=st)||J,At(t,e),st=M):At(t,e),Wt(e),l&8192){if(M=e.memoizedState!==null,(e.stateNode.isHidden=M)&&!J&&(e.mode&1)!==0)for(de=e,J=e.child;J!==null;){for(X=de=J;de!==null;){switch(q=de,ce=q.child,q.tag){case 0:case 11:case 14:case 15:al(4,q,q.return);break;case 1:gr(q,q.return);var pe=q.stateNode;if(typeof pe.componentWillUnmount=="function"){l=q,n=q.return;try{t=l,pe.props=t.memoizedProps,pe.state=t.memoizedState,pe.componentWillUnmount()}catch(fe){De(l,n,fe)}}break;case 5:gr(q,q.return);break;case 22:if(q.memoizedState!==null){pu(X);continue}}ce!==null?(ce.return=q,de=ce):pu(X)}J=J.sibling}e:for(J=null,X=e;;){if(X.tag===5){if(J===null){J=X;try{o=X.stateNode,M?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(w=X.stateNode,E=X.memoizedProps.style,f=E!=null&&E.hasOwnProperty("display")?E.display:null,w.style.display=Ze("display",f))}catch(fe){De(e,e.return,fe)}}}else if(X.tag===6){if(J===null)try{X.stateNode.nodeValue=M?"":X.memoizedProps}catch(fe){De(e,e.return,fe)}}else if((X.tag!==22&&X.tag!==23||X.memoizedState===null||X===e)&&X.child!==null){X.child.return=X,X=X.child;continue}if(X===e)break e;for(;X.sibling===null;){if(X.return===null||X.return===e)break e;J===X&&(J=null),X=X.return}J===X&&(J=null),X.sibling.return=X.return,X=X.sibling}}break;case 19:At(t,e),Wt(e),l&4&&au(e);break;case 21:break;default:At(t,e),Wt(e)}}function Wt(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(su(n)){var l=n;break e}n=n.return}throw Error(c(160))}switch(l.tag){case 5:var o=l.stateNode;l.flags&32&&(_e(o,""),l.flags&=-33);var i=ou(e);ni(e,i,o);break;case 3:case 4:var f=l.stateNode.containerInfo,w=ou(e);ti(e,w,f);break;default:throw Error(c(161))}}catch(E){De(e,e.return,E)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gf(e,t,n){de=e,uu(e)}function uu(e,t,n){for(var l=(e.mode&1)!==0;de!==null;){var o=de,i=o.child;if(o.tag===22&&l){var f=o.memoizedState!==null||fs;if(!f){var w=o.alternate,E=w!==null&&w.memoizedState!==null||st;w=fs;var M=st;if(fs=f,(st=E)&&!M)for(de=o;de!==null;)f=de,E=f.child,f.tag===22&&f.memoizedState!==null?fu(o):E!==null?(E.return=f,de=E):fu(o);for(;i!==null;)de=i,uu(i),i=i.sibling;de=o,fs=w,st=M}du(e)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,de=i):du(e)}}function du(e){for(;de!==null;){var t=de;if((t.flags&8772)!==0){var n=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:st||hs(5,t);break;case 1:var l=t.stateNode;if(t.flags&4&&!st)if(n===null)l.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:It(t.type,n.memoizedProps);l.componentDidUpdate(o,n.memoizedState,l.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&pc(t,i,l);break;case 3:var f=t.updateQueue;if(f!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}pc(t,f,n)}break;case 5:var w=t.stateNode;if(n===null&&t.flags&4){n=w;var E=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":E.autoFocus&&n.focus();break;case"img":E.src&&(n.src=E.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var M=t.alternate;if(M!==null){var J=M.memoizedState;if(J!==null){var X=J.dehydrated;X!==null&&Fr(X)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(c(163))}st||t.flags&512&&ei(t)}catch(q){De(t,t.return,q)}}if(t===e){de=null;break}if(n=t.sibling,n!==null){n.return=t.return,de=n;break}de=t.return}}function pu(e){for(;de!==null;){var t=de;if(t===e){de=null;break}var n=t.sibling;if(n!==null){n.return=t.return,de=n;break}de=t.return}}function fu(e){for(;de!==null;){var t=de;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{hs(4,t)}catch(E){De(t,n,E)}break;case 1:var l=t.stateNode;if(typeof l.componentDidMount=="function"){var o=t.return;try{l.componentDidMount()}catch(E){De(t,o,E)}}var i=t.return;try{ei(t)}catch(E){De(t,i,E)}break;case 5:var f=t.return;try{ei(t)}catch(E){De(t,f,E)}}}catch(E){De(t,t.return,E)}if(t===e){de=null;break}var w=t.sibling;if(w!==null){w.return=t.return,de=w;break}de=t.return}}var xf=Math.ceil,ms=W.ReactCurrentDispatcher,ri=W.ReactCurrentOwner,bt=W.ReactCurrentBatchConfig,Ne=0,qe=null,$e=null,tt=0,wt=0,xr=dn(0),Ve=0,cl=null,Bn=0,gs=0,li=0,ul=null,mt=null,si=0,yr=1/0,en=null,xs=!1,oi=null,xn=null,ys=!1,yn=null,vs=0,dl=0,ii=null,js=-1,Ss=0;function ut(){return(Ne&6)!==0?Fe():js!==-1?js:js=Fe()}function vn(e){return(e.mode&1)===0?1:(Ne&2)!==0&&tt!==0?tt&-tt:Zp.transition!==null?(Ss===0&&(Ss=oa()),Ss):(e=Te,e!==0||(e=window.event,e=e===void 0?16:ma(e.type)),e)}function Mt(e,t,n,l){if(50<dl)throw dl=0,ii=null,Error(c(185));Ar(e,n,l),((Ne&2)===0||e!==qe)&&(e===qe&&((Ne&2)===0&&(gs|=n),Ve===4&&jn(e,tt)),gt(e,l),n===1&&Ne===0&&(t.mode&1)===0&&(yr=Fe()+500,Gl&&fn()))}function gt(e,t){var n=e.callbackNode;Zd(e,t);var l=Tl(e,e===qe?tt:0);if(l===0)n!==null&&ra(n),e.callbackNode=null,e.callbackPriority=0;else if(t=l&-l,e.callbackPriority!==t){if(n!=null&&ra(n),t===1)e.tag===0?Xp(mu.bind(null,e)):ec(mu.bind(null,e)),Yp(function(){(Ne&6)===0&&fn()}),n=null;else{switch(ia(l)){case 1:n=Bs;break;case 4:n=la;break;case 16:n=Nl;break;case 536870912:n=sa;break;default:n=Nl}n=ku(n,hu.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function hu(e,t){if(js=-1,Ss=0,(Ne&6)!==0)throw Error(c(327));var n=e.callbackNode;if(vr()&&e.callbackNode!==n)return null;var l=Tl(e,e===qe?tt:0);if(l===0)return null;if((l&30)!==0||(l&e.expiredLanes)!==0||t)t=ws(e,l);else{t=l;var o=Ne;Ne|=2;var i=xu();(qe!==e||tt!==t)&&(en=null,yr=Fe()+500,Un(e,t));do try{jf();break}catch(w){gu(e,w)}while(!0);Eo(),ms.current=i,Ne=o,$e!==null?t=0:(qe=null,tt=0,t=Ve)}if(t!==0){if(t===2&&(o=Fs(e),o!==0&&(l=o,t=ai(e,o))),t===1)throw n=cl,Un(e,0),jn(e,l),gt(e,Fe()),n;if(t===6)jn(e,l);else{if(o=e.current.alternate,(l&30)===0&&!yf(o)&&(t=ws(e,l),t===2&&(i=Fs(e),i!==0&&(l=i,t=ai(e,i))),t===1))throw n=cl,Un(e,0),jn(e,l),gt(e,Fe()),n;switch(e.finishedWork=o,e.finishedLanes=l,t){case 0:case 1:throw Error(c(345));case 2:Wn(e,mt,en);break;case 3:if(jn(e,l),(l&130023424)===l&&(t=si+500-Fe(),10<t)){if(Tl(e,0)!==0)break;if(o=e.suspendedLanes,(o&l)!==l){ut(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=ho(Wn.bind(null,e,mt,en),t);break}Wn(e,mt,en);break;case 4:if(jn(e,l),(l&4194240)===l)break;for(t=e.eventTimes,o=-1;0<l;){var f=31-Tt(l);i=1<<f,f=t[f],f>o&&(o=f),l&=~i}if(l=o,l=Fe()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*xf(l/1960))-l,10<l){e.timeoutHandle=ho(Wn.bind(null,e,mt,en),l);break}Wn(e,mt,en);break;case 5:Wn(e,mt,en);break;default:throw Error(c(329))}}}return gt(e,Fe()),e.callbackNode===n?hu.bind(null,e):null}function ai(e,t){var n=ul;return e.current.memoizedState.isDehydrated&&(Un(e,t).flags|=256),e=ws(e,t),e!==2&&(t=mt,mt=n,t!==null&&ci(t)),e}function ci(e){mt===null?mt=e:mt.push.apply(mt,e)}function yf(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var l=0;l<n.length;l++){var o=n[l],i=o.getSnapshot;o=o.value;try{if(!Rt(i(),o))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function jn(e,t){for(t&=~li,t&=~gs,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Tt(t),l=1<<n;e[n]=-1,t&=~l}}function mu(e){if((Ne&6)!==0)throw Error(c(327));vr();var t=Tl(e,0);if((t&1)===0)return gt(e,Fe()),null;var n=ws(e,t);if(e.tag!==0&&n===2){var l=Fs(e);l!==0&&(t=l,n=ai(e,l))}if(n===1)throw n=cl,Un(e,0),jn(e,t),gt(e,Fe()),n;if(n===6)throw Error(c(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Wn(e,mt,en),gt(e,Fe()),null}function ui(e,t){var n=Ne;Ne|=1;try{return e(t)}finally{Ne=n,Ne===0&&(yr=Fe()+500,Gl&&fn())}}function Fn(e){yn!==null&&yn.tag===0&&(Ne&6)===0&&vr();var t=Ne;Ne|=1;var n=bt.transition,l=Te;try{if(bt.transition=null,Te=1,e)return e()}finally{Te=l,bt.transition=n,Ne=t,(Ne&6)===0&&fn()}}function di(){wt=xr.current,Ie(xr)}function Un(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Qp(n)),$e!==null)for(n=$e.return;n!==null;){var l=n;switch(jo(l),l.tag){case 1:l=l.type.childContextTypes,l!=null&&Ql();break;case 3:hr(),Ie(pt),Ie(nt),Io();break;case 5:Ro(l);break;case 4:hr();break;case 13:Ie(Me);break;case 19:Ie(Me);break;case 10:No(l.type._context);break;case 22:case 23:di()}n=n.return}if(qe=e,$e=e=Sn(e.current,null),tt=wt=t,Ve=0,cl=null,li=gs=Bn=0,mt=ul=null,Mn!==null){for(t=0;t<Mn.length;t++)if(n=Mn[t],l=n.interleaved,l!==null){n.interleaved=null;var o=l.next,i=n.pending;if(i!==null){var f=i.next;i.next=o,l.next=f}n.pending=l}Mn=null}return e}function gu(e,t){do{var n=$e;try{if(Eo(),ss.current=cs,os){for(var l=Oe.memoizedState;l!==null;){var o=l.queue;o!==null&&(o.pending=null),l=l.next}os=!1}if(Dn=0,Ge=Ke=Oe=null,rl=!1,ll=0,ri.current=null,n===null||n.return===null){Ve=1,cl=t,$e=null;break}e:{var i=e,f=n.return,w=n,E=t;if(t=tt,w.flags|=32768,E!==null&&typeof E=="object"&&typeof E.then=="function"){var M=E,J=w,X=J.tag;if((J.mode&1)===0&&(X===0||X===11||X===15)){var q=J.alternate;q?(J.updateQueue=q.updateQueue,J.memoizedState=q.memoizedState,J.lanes=q.lanes):(J.updateQueue=null,J.memoizedState=null)}var ce=Uc(f);if(ce!==null){ce.flags&=-257,Wc(ce,f,w,i,t),ce.mode&1&&Fc(i,M,t),t=ce,E=M;var pe=t.updateQueue;if(pe===null){var fe=new Set;fe.add(E),t.updateQueue=fe}else pe.add(E);break e}else{if((t&1)===0){Fc(i,M,t),pi();break e}E=Error(c(426))}}else if(Ae&&w.mode&1){var Ue=Uc(f);if(Ue!==null){(Ue.flags&65536)===0&&(Ue.flags|=256),Wc(Ue,f,w,i,t),ko(mr(E,w));break e}}i=E=mr(E,w),Ve!==4&&(Ve=2),ul===null?ul=[i]:ul.push(i),i=f;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var R=Dc(i,E,t);dc(i,R);break e;case 1:w=E;var N=i.type,z=i.stateNode;if((i.flags&128)===0&&(typeof N.getDerivedStateFromError=="function"||z!==null&&typeof z.componentDidCatch=="function"&&(xn===null||!xn.has(z)))){i.flags|=65536,t&=-t,i.lanes|=t;var se=Bc(i,w,t);dc(i,se);break e}}i=i.return}while(i!==null)}vu(n)}catch(he){t=he,$e===n&&n!==null&&($e=n=n.return);continue}break}while(!0)}function xu(){var e=ms.current;return ms.current=cs,e===null?cs:e}function pi(){(Ve===0||Ve===3||Ve===2)&&(Ve=4),qe===null||(Bn&268435455)===0&&(gs&268435455)===0||jn(qe,tt)}function ws(e,t){var n=Ne;Ne|=2;var l=xu();(qe!==e||tt!==t)&&(en=null,Un(e,t));do try{vf();break}catch(o){gu(e,o)}while(!0);if(Eo(),Ne=n,ms.current=l,$e!==null)throw Error(c(261));return qe=null,tt=0,Ve}function vf(){for(;$e!==null;)yu($e)}function jf(){for(;$e!==null&&!Kd();)yu($e)}function yu(e){var t=wu(e.alternate,e,wt);e.memoizedProps=e.pendingProps,t===null?vu(e):$e=t,ri.current=null}function vu(e){var t=e;do{var n=t.alternate;if(e=t.return,(t.flags&32768)===0){if(n=pf(n,t,wt),n!==null){$e=n;return}}else{if(n=ff(n,t),n!==null){n.flags&=32767,$e=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ve=6,$e=null;return}}if(t=t.sibling,t!==null){$e=t;return}$e=t=e}while(t!==null);Ve===0&&(Ve=5)}function Wn(e,t,n){var l=Te,o=bt.transition;try{bt.transition=null,Te=1,Sf(e,t,n,l)}finally{bt.transition=o,Te=l}return null}function Sf(e,t,n,l){do vr();while(yn!==null);if((Ne&6)!==0)throw Error(c(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(c(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(ep(e,i),e===qe&&($e=qe=null,tt=0),(n.subtreeFlags&2064)===0&&(n.flags&2064)===0||ys||(ys=!0,ku(Nl,function(){return vr(),null})),i=(n.flags&15990)!==0,(n.subtreeFlags&15990)!==0||i){i=bt.transition,bt.transition=null;var f=Te;Te=1;var w=Ne;Ne|=4,ri.current=null,mf(e,n),cu(n,e),Fp(po),Il=!!uo,po=uo=null,e.current=n,gf(n),Vd(),Ne=w,Te=f,bt.transition=i}else e.current=n;if(ys&&(ys=!1,yn=e,vs=o),i=e.pendingLanes,i===0&&(xn=null),Yd(n.stateNode),gt(e,Fe()),t!==null)for(l=e.onRecoverableError,n=0;n<t.length;n++)o=t[n],l(o.value,{componentStack:o.stack,digest:o.digest});if(xs)throw xs=!1,e=oi,oi=null,e;return(vs&1)!==0&&e.tag!==0&&vr(),i=e.pendingLanes,(i&1)!==0?e===ii?dl++:(dl=0,ii=e):dl=0,fn(),null}function vr(){if(yn!==null){var e=ia(vs),t=bt.transition,n=Te;try{if(bt.transition=null,Te=16>e?16:e,yn===null)var l=!1;else{if(e=yn,yn=null,vs=0,(Ne&6)!==0)throw Error(c(331));var o=Ne;for(Ne|=4,de=e.current;de!==null;){var i=de,f=i.child;if((de.flags&16)!==0){var w=i.deletions;if(w!==null){for(var E=0;E<w.length;E++){var M=w[E];for(de=M;de!==null;){var J=de;switch(J.tag){case 0:case 11:case 15:al(8,J,i)}var X=J.child;if(X!==null)X.return=J,de=X;else for(;de!==null;){J=de;var q=J.sibling,ce=J.return;if(lu(J),J===M){de=null;break}if(q!==null){q.return=ce,de=q;break}de=ce}}}var pe=i.alternate;if(pe!==null){var fe=pe.child;if(fe!==null){pe.child=null;do{var Ue=fe.sibling;fe.sibling=null,fe=Ue}while(fe!==null)}}de=i}}if((i.subtreeFlags&2064)!==0&&f!==null)f.return=i,de=f;else e:for(;de!==null;){if(i=de,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:al(9,i,i.return)}var R=i.sibling;if(R!==null){R.return=i.return,de=R;break e}de=i.return}}var N=e.current;for(de=N;de!==null;){f=de;var z=f.child;if((f.subtreeFlags&2064)!==0&&z!==null)z.return=f,de=z;else e:for(f=N;de!==null;){if(w=de,(w.flags&2048)!==0)try{switch(w.tag){case 0:case 11:case 15:hs(9,w)}}catch(he){De(w,w.return,he)}if(w===f){de=null;break e}var se=w.sibling;if(se!==null){se.return=w.return,de=se;break e}de=w.return}}if(Ne=o,fn(),Dt&&typeof Dt.onPostCommitFiberRoot=="function")try{Dt.onPostCommitFiberRoot(Pl,e)}catch{}l=!0}return l}finally{Te=n,bt.transition=t}}return!1}function ju(e,t,n){t=mr(n,t),t=Dc(e,t,1),e=mn(e,t,1),t=ut(),e!==null&&(Ar(e,1,t),gt(e,t))}function De(e,t,n){if(e.tag===3)ju(e,e,n);else for(;t!==null;){if(t.tag===3){ju(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(xn===null||!xn.has(l))){e=mr(n,e),e=Bc(t,e,1),t=mn(t,e,1),e=ut(),t!==null&&(Ar(t,1,e),gt(t,e));break}}t=t.return}}function wf(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),t=ut(),e.pingedLanes|=e.suspendedLanes&n,qe===e&&(tt&n)===n&&(Ve===4||Ve===3&&(tt&130023424)===tt&&500>Fe()-si?Un(e,0):li|=n),gt(e,t)}function Su(e,t){t===0&&((e.mode&1)===0?t=1:(t=_l,_l<<=1,(_l&130023424)===0&&(_l=4194304)));var n=ut();e=Jt(e,t),e!==null&&(Ar(e,t,n),gt(e,n))}function kf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Su(e,n)}function Cf(e,t){var n=0;switch(e.tag){case 13:var l=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:l=e.stateNode;break;default:throw Error(c(314))}l!==null&&l.delete(t),Su(e,n)}var wu;wu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||pt.current)ht=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return ht=!1,df(e,t,n);ht=(e.flags&131072)!==0}else ht=!1,Ae&&(t.flags&1048576)!==0&&tc(t,Jl,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;ps(e,t),e=t.pendingProps;var o=ir(t,nt.current);fr(t,n),o=Mo(null,t,l,e,o,n);var i=Oo();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ft(l)?(i=!0,Yl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,_o(t),o.updater=us,t.stateNode=o,o._reactInternals=t,$o(t,l,e,n),t=Qo(null,t,l,!0,i,n)):(t.tag=0,Ae&&i&&vo(t),ct(null,t,o,n),t=t.child),t;case 16:l=t.elementType;e:{switch(ps(e,t),e=t.pendingProps,o=l._init,l=o(l._payload),t.type=l,o=t.tag=Nf(l),e=It(l,e),o){case 0:t=Ho(null,t,l,e,n);break e;case 1:t=Yc(null,t,l,e,n);break e;case 11:t=$c(null,t,l,e,n);break e;case 14:t=Kc(null,t,l,It(l.type,e),n);break e}throw Error(c(306,l,""))}return t;case 0:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:It(l,o),Ho(e,t,l,o,n);case 1:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:It(l,o),Yc(e,t,l,o,n);case 3:e:{if(Gc(t),e===null)throw Error(c(387));l=t.pendingProps,i=t.memoizedState,o=i.element,uc(e,t),rs(t,l,null,n);var f=t.memoizedState;if(l=f.element,i.isDehydrated)if(i={element:l,isDehydrated:!1,cache:f.cache,pendingSuspenseBoundaries:f.pendingSuspenseBoundaries,transitions:f.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=mr(Error(c(423)),t),t=qc(e,t,l,n,o);break e}else if(l!==o){o=mr(Error(c(424)),t),t=qc(e,t,l,n,o);break e}else for(St=un(t.stateNode.containerInfo.firstChild),jt=t,Ae=!0,Lt=null,n=ac(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(ur(),l===o){t=Zt(e,t,n);break e}ct(e,t,l,n)}t=t.child}return t;case 5:return fc(t),e===null&&wo(t),l=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,f=o.children,fo(l,o)?f=null:i!==null&&fo(l,i)&&(t.flags|=32),Qc(e,t),ct(e,t,f,n),t.child;case 6:return e===null&&wo(t),null;case 13:return Jc(e,t,n);case 4:return To(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=dr(t,null,l,n):ct(e,t,l,n),t.child;case 11:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:It(l,o),$c(e,t,l,o,n);case 7:return ct(e,t,t.pendingProps,n),t.child;case 8:return ct(e,t,t.pendingProps.children,n),t.child;case 12:return ct(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(l=t.type._context,o=t.pendingProps,i=t.memoizedProps,f=o.value,Re(es,l._currentValue),l._currentValue=f,i!==null)if(Rt(i.value,f)){if(i.children===o.children&&!pt.current){t=Zt(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var w=i.dependencies;if(w!==null){f=i.child;for(var E=w.firstContext;E!==null;){if(E.context===l){if(i.tag===1){E=Xt(-1,n&-n),E.tag=2;var M=i.updateQueue;if(M!==null){M=M.shared;var J=M.pending;J===null?E.next=E:(E.next=J.next,J.next=E),M.pending=E}}i.lanes|=n,E=i.alternate,E!==null&&(E.lanes|=n),Po(i.return,n,t),w.lanes|=n;break}E=E.next}}else if(i.tag===10)f=i.type===t.type?null:i.child;else if(i.tag===18){if(f=i.return,f===null)throw Error(c(341));f.lanes|=n,w=f.alternate,w!==null&&(w.lanes|=n),Po(f,n,t),f=i.sibling}else f=i.child;if(f!==null)f.return=i;else for(f=i;f!==null;){if(f===t){f=null;break}if(i=f.sibling,i!==null){i.return=f.return,f=i;break}f=f.return}i=f}ct(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,l=t.pendingProps.children,fr(t,n),o=Nt(o),l=l(o),t.flags|=1,ct(e,t,l,n),t.child;case 14:return l=t.type,o=It(l,t.pendingProps),o=It(l.type,o),Kc(e,t,l,o,n);case 15:return Vc(e,t,t.type,t.pendingProps,n);case 17:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:It(l,o),ps(e,t),t.tag=1,ft(l)?(e=!0,Yl(t)):e=!1,fr(t,n),Mc(t,l,o),$o(t,l,o,n),Qo(null,t,l,!0,e,n);case 19:return Zc(e,t,n);case 22:return Hc(e,t,n)}throw Error(c(156,t.tag))};function ku(e,t){return na(e,t)}function Ef(e,t,n,l){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _t(e,t,n,l){return new Ef(e,t,n,l)}function fi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Nf(e){if(typeof e=="function")return fi(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ue)return 11;if(e===ie)return 14}return 2}function Sn(e,t){var n=e.alternate;return n===null?(n=_t(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ks(e,t,n,l,o,i){var f=2;if(l=e,typeof e=="function")fi(e)&&(f=1);else if(typeof e=="string")f=5;else e:switch(e){case Z:return $n(n.children,o,i,t);case ne:f=8,o|=8;break;case D:return e=_t(12,n,t,o|2),e.elementType=D,e.lanes=i,e;case I:return e=_t(13,n,t,o),e.elementType=I,e.lanes=i,e;case oe:return e=_t(19,n,t,o),e.elementType=oe,e.lanes=i,e;case re:return Cs(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case A:f=10;break e;case H:f=9;break e;case ue:f=11;break e;case ie:f=14;break e;case ve:f=16,l=null;break e}throw Error(c(130,e==null?e:typeof e,""))}return t=_t(f,n,t,o),t.elementType=e,t.type=l,t.lanes=i,t}function $n(e,t,n,l){return e=_t(7,e,l,t),e.lanes=n,e}function Cs(e,t,n,l){return e=_t(22,e,l,t),e.elementType=re,e.lanes=n,e.stateNode={isHidden:!1},e}function hi(e,t,n){return e=_t(6,e,null,t),e.lanes=n,e}function mi(e,t,n){return t=_t(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Pf(e,t,n,l,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Us(0),this.expirationTimes=Us(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Us(0),this.identifierPrefix=l,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function gi(e,t,n,l,o,i,f,w,E){return e=new Pf(e,t,n,w,E),t===1?(t=1,i===!0&&(t|=8)):t=0,i=_t(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:l,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},_o(i),e}function bf(e,t,n){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:K,key:l==null?null:""+l,children:e,containerInfo:t,implementation:n}}function Cu(e){if(!e)return pn;e=e._reactInternals;e:{if(Rn(e)!==e||e.tag!==1)throw Error(c(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ft(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(c(171))}if(e.tag===1){var n=e.type;if(ft(n))return Xa(e,n,t)}return t}function Eu(e,t,n,l,o,i,f,w,E){return e=gi(n,l,!0,e,o,i,f,w,E),e.context=Cu(null),n=e.current,l=ut(),o=vn(n),i=Xt(l,o),i.callback=t??null,mn(n,i,o),e.current.lanes=o,Ar(e,o,l),gt(e,l),e}function Es(e,t,n,l){var o=t.current,i=ut(),f=vn(o);return n=Cu(n),t.context===null?t.context=n:t.pendingContext=n,t=Xt(i,f),t.payload={element:e},l=l===void 0?null:l,l!==null&&(t.callback=l),e=mn(o,t,f),e!==null&&(Mt(e,o,f,i),ns(e,o,f)),f}function Ns(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Nu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function xi(e,t){Nu(e,t),(e=e.alternate)&&Nu(e,t)}function _f(){return null}var Pu=typeof reportError=="function"?reportError:function(e){console.error(e)};function yi(e){this._internalRoot=e}Ps.prototype.render=yi.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));Es(e,t,null,null)},Ps.prototype.unmount=yi.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Fn(function(){Es(null,e,null,null)}),t[Qt]=null}};function Ps(e){this._internalRoot=e}Ps.prototype.unstable_scheduleHydration=function(e){if(e){var t=ua();e={blockedOn:null,target:e,priority:t};for(var n=0;n<on.length&&t!==0&&t<on[n].priority;n++);on.splice(n,0,e),n===0&&fa(e)}};function vi(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function bs(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function bu(){}function Tf(e,t,n,l,o){if(o){if(typeof l=="function"){var i=l;l=function(){var M=Ns(f);i.call(M)}}var f=Eu(t,l,e,0,null,!1,!1,"",bu);return e._reactRootContainer=f,e[Qt]=f.current,Gr(e.nodeType===8?e.parentNode:e),Fn(),f}for(;o=e.lastChild;)e.removeChild(o);if(typeof l=="function"){var w=l;l=function(){var M=Ns(E);w.call(M)}}var E=gi(e,0,!1,null,null,!1,!1,"",bu);return e._reactRootContainer=E,e[Qt]=E.current,Gr(e.nodeType===8?e.parentNode:e),Fn(function(){Es(t,E,n,l)}),E}function _s(e,t,n,l,o){var i=n._reactRootContainer;if(i){var f=i;if(typeof o=="function"){var w=o;o=function(){var E=Ns(f);w.call(E)}}Es(t,f,e,o)}else f=Tf(n,t,e,o,l);return Ns(f)}aa=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=zr(t.pendingLanes);n!==0&&(Ws(t,n|1),gt(t,Fe()),(Ne&6)===0&&(yr=Fe()+500,fn()))}break;case 13:Fn(function(){var l=Jt(e,1);if(l!==null){var o=ut();Mt(l,e,1,o)}}),xi(e,1)}},$s=function(e){if(e.tag===13){var t=Jt(e,134217728);if(t!==null){var n=ut();Mt(t,e,134217728,n)}xi(e,134217728)}},ca=function(e){if(e.tag===13){var t=vn(e),n=Jt(e,t);if(n!==null){var l=ut();Mt(n,e,t,l)}xi(e,t)}},ua=function(){return Te},da=function(e,t){var n=Te;try{return Te=e,t()}finally{Te=n}},Ot=function(e,t,n){switch(t){case"input":if(qn(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var l=n[t];if(l!==e&&l.form===e.form){var o=Hl(l);if(!o)throw Error(c(90));vl(l),qn(l,o)}}}break;case"textarea":Pr(e,n);break;case"select":t=n.value,t!=null&&Vt(e,!!n.multiple,t,!1)}},Gi=ui,qi=Fn;var Rf={usingClientEntryPoint:!1,Events:[Xr,sr,Hl,Qi,Yi,ui]},pl={findFiberByHostInstance:Ln,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},Lf={bundleType:pl.bundleType,version:pl.version,rendererPackageName:pl.rendererPackageName,rendererConfig:pl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:W.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=ea(e),e===null?null:e.stateNode},findFiberByHostInstance:pl.findFiberByHostInstance||_f,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ts=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ts.isDisabled&&Ts.supportsFiber)try{Pl=Ts.inject(Lf),Dt=Ts}catch{}}return xt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Rf,xt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!vi(t))throw Error(c(200));return bf(e,t,null,n)},xt.createRoot=function(e,t){if(!vi(e))throw Error(c(299));var n=!1,l="",o=Pu;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=gi(e,1,!1,null,null,n,!1,l,o),e[Qt]=t.current,Gr(e.nodeType===8?e.parentNode:e),new yi(t)},xt.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(c(188)):(e=Object.keys(e).join(","),Error(c(268,e)));return e=ea(t),e=e===null?null:e.stateNode,e},xt.flushSync=function(e){return Fn(e)},xt.hydrate=function(e,t,n){if(!bs(t))throw Error(c(200));return _s(null,e,t,!0,n)},xt.hydrateRoot=function(e,t,n){if(!vi(e))throw Error(c(405));var l=n!=null&&n.hydratedSources||null,o=!1,i="",f=Pu;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(f=n.onRecoverableError)),t=Eu(t,null,e,1,n??null,o,!1,i,f),e[Qt]=t.current,Gr(e),l)for(e=0;e<l.length;e++)n=l[e],o=n._getVersion,o=o(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,o]:t.mutableSourceEagerHydrationData.push(n,o);return new Ps(t)},xt.render=function(e,t,n){if(!bs(t))throw Error(c(200));return _s(null,e,t,!1,n)},xt.unmountComponentAtNode=function(e){if(!bs(e))throw Error(c(40));return e._reactRootContainer?(Fn(function(){_s(null,null,e,!1,function(){e._reactRootContainer=null,e[Qt]=null})}),!0):!1},xt.unstable_batchedUpdates=ui,xt.unstable_renderSubtreeIntoContainer=function(e,t,n,l){if(!bs(n))throw Error(c(200));if(e==null||e._reactInternals===void 0)throw Error(c(38));return _s(e,t,n,!1,l)},xt.version="18.3.1-next-f1338f8080-20240426",xt}var Mu;function sd(){if(Mu)return wi.exports;Mu=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(a){console.error(a)}}return s(),wi.exports=Kf(),wi.exports}var Ou;function Vf(){if(Ou)return Rs;Ou=1;var s=sd();return Rs.createRoot=s.createRoot,Rs.hydrateRoot=s.hydrateRoot,Rs}var Hf=Vf(),od=sd();/**
|
|
41
|
+
* @remix-run/router v1.23.2
|
|
42
|
+
*
|
|
43
|
+
* Copyright (c) Remix Software Inc.
|
|
44
|
+
*
|
|
45
|
+
* This source code is licensed under the MIT license found in the
|
|
46
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
47
|
+
*
|
|
48
|
+
* @license MIT
|
|
49
|
+
*/function gl(){return gl=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var c=arguments[a];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(s[u]=c[u])}return s},gl.apply(this,arguments)}var Cn;(function(s){s.Pop="POP",s.Push="PUSH",s.Replace="REPLACE"})(Cn||(Cn={}));const Du="popstate";function Qf(s){s===void 0&&(s={});function a(u,x){let{pathname:y,search:C,hash:j}=u.location;return Ri("",{pathname:y,search:C,hash:j},x.state&&x.state.usr||null,x.state&&x.state.key||"default")}function c(u,x){return typeof x=="string"?x:Is(x)}return Gf(a,c,null,s)}function We(s,a){if(s===!1||s===null||typeof s>"u")throw new Error(a)}function Di(s,a){if(!s){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function Yf(){return Math.random().toString(36).substr(2,8)}function Bu(s,a){return{usr:s.state,key:s.key,idx:a}}function Ri(s,a,c,u){return c===void 0&&(c=null),gl({pathname:typeof s=="string"?s:s.pathname,search:"",hash:""},typeof a=="string"?kr(a):a,{state:c,key:a&&a.key||u||Yf()})}function Is(s){let{pathname:a="/",search:c="",hash:u=""}=s;return c&&c!=="?"&&(a+=c.charAt(0)==="?"?c:"?"+c),u&&u!=="#"&&(a+=u.charAt(0)==="#"?u:"#"+u),a}function kr(s){let a={};if(s){let c=s.indexOf("#");c>=0&&(a.hash=s.substr(c),s=s.substr(0,c));let u=s.indexOf("?");u>=0&&(a.search=s.substr(u),s=s.substr(0,u)),s&&(a.pathname=s)}return a}function Gf(s,a,c,u){u===void 0&&(u={});let{window:x=document.defaultView,v5Compat:y=!1}=u,C=x.history,j=Cn.Pop,p=null,m=d();m==null&&(m=0,C.replaceState(gl({},C.state,{idx:m}),""));function d(){return(C.state||{idx:null}).idx}function h(){j=Cn.Pop;let S=d(),T=S==null?null:S-m;m=S,p&&p({action:j,location:v.location,delta:T})}function k(S,T){j=Cn.Push;let U=Ri(v.location,S,T);m=d()+1;let O=Bu(U,m),W=v.createHref(U);try{C.pushState(O,"",W)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;x.location.assign(W)}y&&p&&p({action:j,location:v.location,delta:1})}function L(S,T){j=Cn.Replace;let U=Ri(v.location,S,T);m=d();let O=Bu(U,m),W=v.createHref(U);C.replaceState(O,"",W),y&&p&&p({action:j,location:v.location,delta:0})}function b(S){let T=x.location.origin!=="null"?x.location.origin:x.location.href,U=typeof S=="string"?S:Is(S);return U=U.replace(/ $/,"%20"),We(T,"No window.location.(origin|href) available to create URL for href: "+U),new URL(U,T)}let v={get action(){return j},get location(){return s(x,C)},listen(S){if(p)throw new Error("A history only accepts one active listener");return x.addEventListener(Du,h),p=S,()=>{x.removeEventListener(Du,h),p=null}},createHref(S){return a(x,S)},createURL:b,encodeLocation(S){let T=b(S);return{pathname:T.pathname,search:T.search,hash:T.hash}},push:k,replace:L,go(S){return C.go(S)}};return v}var Fu;(function(s){s.data="data",s.deferred="deferred",s.redirect="redirect",s.error="error"})(Fu||(Fu={}));function qf(s,a,c){return c===void 0&&(c="/"),Jf(s,a,c)}function Jf(s,a,c,u){let x=typeof a=="string"?kr(a):a,y=Bi(x.pathname||"/",c);if(y==null)return null;let C=id(s);Xf(C);let j=null;for(let p=0;j==null&&p<C.length;++p){let m=uh(y);j=ih(C[p],m)}return j}function id(s,a,c,u){a===void 0&&(a=[]),c===void 0&&(c=[]),u===void 0&&(u="");let x=(y,C,j)=>{let p={relativePath:j===void 0?y.path||"":j,caseSensitive:y.caseSensitive===!0,childrenIndex:C,route:y};p.relativePath.startsWith("/")&&(We(p.relativePath.startsWith(u),'Absolute route path "'+p.relativePath+'" nested under path '+('"'+u+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),p.relativePath=p.relativePath.slice(u.length));let m=En([u,p.relativePath]),d=c.concat(p);y.children&&y.children.length>0&&(We(y.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+m+'".')),id(y.children,a,d,m)),!(y.path==null&&!y.index)&&a.push({path:m,score:sh(m,y.index),routesMeta:d})};return s.forEach((y,C)=>{var j;if(y.path===""||!((j=y.path)!=null&&j.includes("?")))x(y,C);else for(let p of ad(y.path))x(y,C,p)}),a}function ad(s){let a=s.split("/");if(a.length===0)return[];let[c,...u]=a,x=c.endsWith("?"),y=c.replace(/\?$/,"");if(u.length===0)return x?[y,""]:[y];let C=ad(u.join("/")),j=[];return j.push(...C.map(p=>p===""?y:[y,p].join("/"))),x&&j.push(...C),j.map(p=>s.startsWith("/")&&p===""?"/":p)}function Xf(s){s.sort((a,c)=>a.score!==c.score?c.score-a.score:oh(a.routesMeta.map(u=>u.childrenIndex),c.routesMeta.map(u=>u.childrenIndex)))}const Zf=/^:[\w-]+$/,eh=3,th=2,nh=1,rh=10,lh=-2,Uu=s=>s==="*";function sh(s,a){let c=s.split("/"),u=c.length;return c.some(Uu)&&(u+=lh),a&&(u+=th),c.filter(x=>!Uu(x)).reduce((x,y)=>x+(Zf.test(y)?eh:y===""?nh:rh),u)}function oh(s,a){return s.length===a.length&&s.slice(0,-1).every((u,x)=>u===a[x])?s[s.length-1]-a[a.length-1]:0}function ih(s,a,c){let{routesMeta:u}=s,x={},y="/",C=[];for(let j=0;j<u.length;++j){let p=u[j],m=j===u.length-1,d=y==="/"?a:a.slice(y.length)||"/",h=ah({path:p.relativePath,caseSensitive:p.caseSensitive,end:m},d),k=p.route;if(!h)return null;Object.assign(x,h.params),C.push({params:x,pathname:En([y,h.pathname]),pathnameBase:mh(En([y,h.pathnameBase])),route:k}),h.pathnameBase!=="/"&&(y=En([y,h.pathnameBase]))}return C}function ah(s,a){typeof s=="string"&&(s={path:s,caseSensitive:!1,end:!0});let[c,u]=ch(s.path,s.caseSensitive,s.end),x=a.match(c);if(!x)return null;let y=x[0],C=y.replace(/(.)\/+$/,"$1"),j=x.slice(1);return{params:u.reduce((m,d,h)=>{let{paramName:k,isOptional:L}=d;if(k==="*"){let v=j[h]||"";C=y.slice(0,y.length-v.length).replace(/(.)\/+$/,"$1")}const b=j[h];return L&&!b?m[k]=void 0:m[k]=(b||"").replace(/%2F/g,"/"),m},{}),pathname:y,pathnameBase:C,pattern:s}}function ch(s,a,c){a===void 0&&(a=!1),c===void 0&&(c=!0),Di(s==="*"||!s.endsWith("*")||s.endsWith("/*"),'Route path "'+s+'" will be treated as if it were '+('"'+s.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+s.replace(/\*$/,"/*")+'".'));let u=[],x="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(C,j,p)=>(u.push({paramName:j,isOptional:p!=null}),p?"/?([^\\/]+)?":"/([^\\/]+)"));return s.endsWith("*")?(u.push({paramName:"*"}),x+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):c?x+="\\/*$":s!==""&&s!=="/"&&(x+="(?:(?=\\/|$))"),[new RegExp(x,a?void 0:"i"),u]}function uh(s){try{return s.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return Di(!1,'The URL path "'+s+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+a+").")),s}}function Bi(s,a){if(a==="/")return s;if(!s.toLowerCase().startsWith(a.toLowerCase()))return null;let c=a.endsWith("/")?a.length-1:a.length,u=s.charAt(c);return u&&u!=="/"?null:s.slice(c)||"/"}const dh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,ph=s=>dh.test(s);function fh(s,a){a===void 0&&(a="/");let{pathname:c,search:u="",hash:x=""}=typeof s=="string"?kr(s):s,y;if(c)if(ph(c))y=c;else{if(c.includes("//")){let C=c;c=c.replace(/\/\/+/g,"/"),Di(!1,"Pathnames cannot have embedded double slashes - normalizing "+(C+" -> "+c))}c.startsWith("/")?y=Wu(c.substring(1),"/"):y=Wu(c,a)}else y=a;return{pathname:y,search:gh(u),hash:xh(x)}}function Wu(s,a){let c=a.replace(/\/+$/,"").split("/");return s.split("/").forEach(x=>{x===".."?c.length>1&&c.pop():x!=="."&&c.push(x)}),c.length>1?c.join("/"):"/"}function Ei(s,a,c,u){return"Cannot include a '"+s+"' character in a manually specified "+("`to."+a+"` field ["+JSON.stringify(u)+"]. Please separate it out to the ")+("`to."+c+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function hh(s){return s.filter((a,c)=>c===0||a.route.path&&a.route.path.length>0)}function Fi(s,a){let c=hh(s);return a?c.map((u,x)=>x===c.length-1?u.pathname:u.pathnameBase):c.map(u=>u.pathnameBase)}function Ui(s,a,c,u){u===void 0&&(u=!1);let x;typeof s=="string"?x=kr(s):(x=gl({},s),We(!x.pathname||!x.pathname.includes("?"),Ei("?","pathname","search",x)),We(!x.pathname||!x.pathname.includes("#"),Ei("#","pathname","hash",x)),We(!x.search||!x.search.includes("#"),Ei("#","search","hash",x)));let y=s===""||x.pathname==="",C=y?"/":x.pathname,j;if(C==null)j=c;else{let h=a.length-1;if(!u&&C.startsWith("..")){let k=C.split("/");for(;k[0]==="..";)k.shift(),h-=1;x.pathname=k.join("/")}j=h>=0?a[h]:"/"}let p=fh(x,j),m=C&&C!=="/"&&C.endsWith("/"),d=(y||C===".")&&c.endsWith("/");return!p.pathname.endsWith("/")&&(m||d)&&(p.pathname+="/"),p}const En=s=>s.join("/").replace(/\/\/+/g,"/"),mh=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),gh=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,xh=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s;function yh(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}const cd=["post","put","patch","delete"];new Set(cd);const vh=["get",...cd];new Set(vh);/**
|
|
50
|
+
* React Router v6.30.3
|
|
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
|
+
*/function xl(){return xl=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var c=arguments[a];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(s[u]=c[u])}return s},xl.apply(this,arguments)}const Wi=g.createContext(null),jh=g.createContext(null),Nn=g.createContext(null),As=g.createContext(null),tn=g.createContext({outlet:null,matches:[],isDataRoute:!1}),ud=g.createContext(null);function Sh(s,a){let{relative:c}=a===void 0?{}:a;Cr()||We(!1);let{basename:u,navigator:x}=g.useContext(Nn),{hash:y,pathname:C,search:j}=pd(s,{relative:c}),p=C;return u!=="/"&&(p=C==="/"?u:En([u,C])),x.createHref({pathname:p,search:j,hash:y})}function Cr(){return g.useContext(As)!=null}function Qn(){return Cr()||We(!1),g.useContext(As).location}function dd(s){g.useContext(Nn).static||g.useLayoutEffect(s)}function $i(){let{isDataRoute:s}=g.useContext(tn);return s?Mh():wh()}function wh(){Cr()||We(!1);let s=g.useContext(Wi),{basename:a,future:c,navigator:u}=g.useContext(Nn),{matches:x}=g.useContext(tn),{pathname:y}=Qn(),C=JSON.stringify(Fi(x,c.v7_relativeSplatPath)),j=g.useRef(!1);return dd(()=>{j.current=!0}),g.useCallback(function(m,d){if(d===void 0&&(d={}),!j.current)return;if(typeof m=="number"){u.go(m);return}let h=Ui(m,JSON.parse(C),y,d.relative==="path");s==null&&a!=="/"&&(h.pathname=h.pathname==="/"?a:En([a,h.pathname])),(d.replace?u.replace:u.push)(h,d.state,d)},[a,u,C,y,s])}const kh=g.createContext(null);function Ch(s){let a=g.useContext(tn).outlet;return a&&g.createElement(kh.Provider,{value:s},a)}function pd(s,a){let{relative:c}=a===void 0?{}:a,{future:u}=g.useContext(Nn),{matches:x}=g.useContext(tn),{pathname:y}=Qn(),C=JSON.stringify(Fi(x,u.v7_relativeSplatPath));return g.useMemo(()=>Ui(s,JSON.parse(C),y,c==="path"),[s,C,y,c])}function Eh(s,a){return Nh(s,a)}function Nh(s,a,c,u){Cr()||We(!1);let{navigator:x}=g.useContext(Nn),{matches:y}=g.useContext(tn),C=y[y.length-1],j=C?C.params:{};C&&C.pathname;let p=C?C.pathnameBase:"/";C&&C.route;let m=Qn(),d;if(a){var h;let S=typeof a=="string"?kr(a):a;p==="/"||(h=S.pathname)!=null&&h.startsWith(p)||We(!1),d=S}else d=m;let k=d.pathname||"/",L=k;if(p!=="/"){let S=p.replace(/^\//,"").split("/");L="/"+k.replace(/^\//,"").split("/").slice(S.length).join("/")}let b=qf(s,{pathname:L}),v=Rh(b&&b.map(S=>Object.assign({},S,{params:Object.assign({},j,S.params),pathname:En([p,x.encodeLocation?x.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?p:En([p,x.encodeLocation?x.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),y,c,u);return a&&v?g.createElement(As.Provider,{value:{location:xl({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Cn.Pop}},v):v}function Ph(){let s=Ah(),a=yh(s)?s.status+" "+s.statusText:s instanceof Error?s.message:JSON.stringify(s),c=s instanceof Error?s.stack:null,x={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return g.createElement(g.Fragment,null,g.createElement("h2",null,"Unexpected Application Error!"),g.createElement("h3",{style:{fontStyle:"italic"}},a),c?g.createElement("pre",{style:x},c):null,null)}const bh=g.createElement(Ph,null);class _h extends g.Component{constructor(a){super(a),this.state={location:a.location,revalidation:a.revalidation,error:a.error}}static getDerivedStateFromError(a){return{error:a}}static getDerivedStateFromProps(a,c){return c.location!==a.location||c.revalidation!=="idle"&&a.revalidation==="idle"?{error:a.error,location:a.location,revalidation:a.revalidation}:{error:a.error!==void 0?a.error:c.error,location:c.location,revalidation:a.revalidation||c.revalidation}}componentDidCatch(a,c){console.error("React Router caught the following error during render",a,c)}render(){return this.state.error!==void 0?g.createElement(tn.Provider,{value:this.props.routeContext},g.createElement(ud.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function Th(s){let{routeContext:a,match:c,children:u}=s,x=g.useContext(Wi);return x&&x.static&&x.staticContext&&(c.route.errorElement||c.route.ErrorBoundary)&&(x.staticContext._deepestRenderedBoundaryId=c.route.id),g.createElement(tn.Provider,{value:a},u)}function Rh(s,a,c,u){var x;if(a===void 0&&(a=[]),c===void 0&&(c=null),u===void 0&&(u=null),s==null){var y;if(!c)return null;if(c.errors)s=c.matches;else if((y=u)!=null&&y.v7_partialHydration&&a.length===0&&!c.initialized&&c.matches.length>0)s=c.matches;else return null}let C=s,j=(x=c)==null?void 0:x.errors;if(j!=null){let d=C.findIndex(h=>h.route.id&&(j==null?void 0:j[h.route.id])!==void 0);d>=0||We(!1),C=C.slice(0,Math.min(C.length,d+1))}let p=!1,m=-1;if(c&&u&&u.v7_partialHydration)for(let d=0;d<C.length;d++){let h=C[d];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(m=d),h.route.id){let{loaderData:k,errors:L}=c,b=h.route.loader&&k[h.route.id]===void 0&&(!L||L[h.route.id]===void 0);if(h.route.lazy||b){p=!0,m>=0?C=C.slice(0,m+1):C=[C[0]];break}}}return C.reduceRight((d,h,k)=>{let L,b=!1,v=null,S=null;c&&(L=j&&h.route.id?j[h.route.id]:void 0,v=h.route.errorElement||bh,p&&(m<0&&k===0?(Oh("route-fallback"),b=!0,S=null):m===k&&(b=!0,S=h.route.hydrateFallbackElement||null)));let T=a.concat(C.slice(0,k+1)),U=()=>{let O;return L?O=v:b?O=S:h.route.Component?O=g.createElement(h.route.Component,null):h.route.element?O=h.route.element:O=d,g.createElement(Th,{match:h,routeContext:{outlet:d,matches:T,isDataRoute:c!=null},children:O})};return c&&(h.route.ErrorBoundary||h.route.errorElement||k===0)?g.createElement(_h,{location:c.location,revalidation:c.revalidation,component:v,error:L,children:U(),routeContext:{outlet:null,matches:T,isDataRoute:!0}}):U()},null)}var fd=(function(s){return s.UseBlocker="useBlocker",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s})(fd||{}),hd=(function(s){return s.UseBlocker="useBlocker",s.UseLoaderData="useLoaderData",s.UseActionData="useActionData",s.UseRouteError="useRouteError",s.UseNavigation="useNavigation",s.UseRouteLoaderData="useRouteLoaderData",s.UseMatches="useMatches",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s.UseRouteId="useRouteId",s})(hd||{});function Lh(s){let a=g.useContext(Wi);return a||We(!1),a}function Ih(s){let a=g.useContext(jh);return a||We(!1),a}function zh(s){let a=g.useContext(tn);return a||We(!1),a}function md(s){let a=zh(),c=a.matches[a.matches.length-1];return c.route.id||We(!1),c.route.id}function Ah(){var s;let a=g.useContext(ud),c=Ih(),u=md();return a!==void 0?a:(s=c.errors)==null?void 0:s[u]}function Mh(){let{router:s}=Lh(fd.UseNavigateStable),a=md(hd.UseNavigateStable),c=g.useRef(!1);return dd(()=>{c.current=!0}),g.useCallback(function(x,y){y===void 0&&(y={}),c.current&&(typeof x=="number"?s.navigate(x):s.navigate(x,xl({fromRouteId:a},y)))},[s,a])}const $u={};function Oh(s,a,c){$u[s]||($u[s]=!0)}function Dh(s,a){s==null||s.v7_startTransition,s==null||s.v7_relativeSplatPath}function Bh(s){let{to:a,replace:c,state:u,relative:x}=s;Cr()||We(!1);let{future:y,static:C}=g.useContext(Nn),{matches:j}=g.useContext(tn),{pathname:p}=Qn(),m=$i(),d=Ui(a,Fi(j,y.v7_relativeSplatPath),p,x==="path"),h=JSON.stringify(d);return g.useEffect(()=>m(JSON.parse(h),{replace:c,state:u,relative:x}),[m,h,x,c,u]),null}function gd(s){return Ch(s.context)}function dt(s){We(!1)}function Fh(s){let{basename:a="/",children:c=null,location:u,navigationType:x=Cn.Pop,navigator:y,static:C=!1,future:j}=s;Cr()&&We(!1);let p=a.replace(/^\/*/,"/"),m=g.useMemo(()=>({basename:p,navigator:y,static:C,future:xl({v7_relativeSplatPath:!1},j)}),[p,j,y,C]);typeof u=="string"&&(u=kr(u));let{pathname:d="/",search:h="",hash:k="",state:L=null,key:b="default"}=u,v=g.useMemo(()=>{let S=Bi(d,p);return S==null?null:{location:{pathname:S,search:h,hash:k,state:L,key:b},navigationType:x}},[p,d,h,k,L,b,x]);return v==null?null:g.createElement(Nn.Provider,{value:m},g.createElement(As.Provider,{children:c,value:v}))}function xd(s){let{children:a,location:c}=s;return Eh(Li(a),c)}new Promise(()=>{});function Li(s,a){a===void 0&&(a=[]);let c=[];return g.Children.forEach(s,(u,x)=>{if(!g.isValidElement(u))return;let y=[...a,x];if(u.type===g.Fragment){c.push.apply(c,Li(u.props.children,y));return}u.type!==dt&&We(!1),!u.props.index||!u.props.children||We(!1);let C={id:u.props.id||y.join("-"),caseSensitive:u.props.caseSensitive,element:u.props.element,Component:u.props.Component,index:u.props.index,path:u.props.path,loader:u.props.loader,action:u.props.action,errorElement:u.props.errorElement,ErrorBoundary:u.props.ErrorBoundary,hasErrorBoundary:u.props.ErrorBoundary!=null||u.props.errorElement!=null,shouldRevalidate:u.props.shouldRevalidate,handle:u.props.handle,lazy:u.props.lazy};u.props.children&&(C.children=Li(u.props.children,y)),c.push(C)}),c}/**
|
|
59
|
+
* React Router DOM v6.30.3
|
|
60
|
+
*
|
|
61
|
+
* Copyright (c) Remix Software Inc.
|
|
62
|
+
*
|
|
63
|
+
* This source code is licensed under the MIT license found in the
|
|
64
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
65
|
+
*
|
|
66
|
+
* @license MIT
|
|
67
|
+
*/function Ii(){return Ii=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var c=arguments[a];for(var u in c)Object.prototype.hasOwnProperty.call(c,u)&&(s[u]=c[u])}return s},Ii.apply(this,arguments)}function Uh(s,a){if(s==null)return{};var c={},u=Object.keys(s),x,y;for(y=0;y<u.length;y++)x=u[y],!(a.indexOf(x)>=0)&&(c[x]=s[x]);return c}function Wh(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}function $h(s,a){return s.button===0&&(!a||a==="_self")&&!Wh(s)}function zi(s){return s===void 0&&(s=""),new URLSearchParams(typeof s=="string"||Array.isArray(s)||s instanceof URLSearchParams?s:Object.keys(s).reduce((a,c)=>{let u=s[c];return a.concat(Array.isArray(u)?u.map(x=>[c,x]):[[c,u]])},[]))}function Kh(s,a){let c=zi(s);return a&&a.forEach((u,x)=>{c.has(x)||a.getAll(x).forEach(y=>{c.append(x,y)})}),c}const Vh=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Hh="6";try{window.__reactRouterVersion=Hh}catch{}const Qh="startTransition",Ku=Uf[Qh];function yd(s){let{basename:a,children:c,future:u,window:x}=s,y=g.useRef();y.current==null&&(y.current=Qf({window:x,v5Compat:!0}));let C=y.current,[j,p]=g.useState({action:C.action,location:C.location}),{v7_startTransition:m}=u||{},d=g.useCallback(h=>{m&&Ku?Ku(()=>p(h)):p(h)},[p,m]);return g.useLayoutEffect(()=>C.listen(d),[C,d]),g.useEffect(()=>Dh(u),[u]),g.createElement(Fh,{basename:a,children:c,location:j.location,navigationType:j.action,navigator:C,future:u})}const Yh=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Gh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Kt=g.forwardRef(function(a,c){let{onClick:u,relative:x,reloadDocument:y,replace:C,state:j,target:p,to:m,preventScrollReset:d,viewTransition:h}=a,k=Uh(a,Vh),{basename:L}=g.useContext(Nn),b,v=!1;if(typeof m=="string"&&Gh.test(m)&&(b=m,Yh))try{let O=new URL(window.location.href),W=m.startsWith("//")?new URL(O.protocol+m):new URL(m),$=Bi(W.pathname,L);W.origin===O.origin&&$!=null?m=$+W.search+W.hash:v=!0}catch{}let S=Sh(m,{relative:x}),T=qh(m,{replace:C,state:j,target:p,preventScrollReset:d,relative:x,viewTransition:h});function U(O){u&&u(O),O.defaultPrevented||T(O)}return g.createElement("a",Ii({},k,{href:b||S,onClick:v||y?u:U,ref:c,target:p}))});var Vu;(function(s){s.UseScrollRestoration="useScrollRestoration",s.UseSubmit="useSubmit",s.UseSubmitFetcher="useSubmitFetcher",s.UseFetcher="useFetcher",s.useViewTransitionState="useViewTransitionState"})(Vu||(Vu={}));var Hu;(function(s){s.UseFetcher="useFetcher",s.UseFetchers="useFetchers",s.UseScrollRestoration="useScrollRestoration"})(Hu||(Hu={}));function qh(s,a){let{target:c,replace:u,state:x,preventScrollReset:y,relative:C,viewTransition:j}=a===void 0?{}:a,p=$i(),m=Qn(),d=pd(s,{relative:C});return g.useCallback(h=>{if($h(h,c)){h.preventDefault();let k=u!==void 0?u:Is(m)===Is(d);p(s,{replace:k,state:x,preventScrollReset:y,relative:C,viewTransition:j})}},[m,p,d,u,x,c,s,y,C,j])}function Jh(s){let a=g.useRef(zi(s)),c=g.useRef(!1),u=Qn(),x=g.useMemo(()=>Kh(u.search,c.current?null:a.current),[u.search]),y=$i(),C=g.useCallback((j,p)=>{const m=zi(typeof j=="function"?j(x):j);c.current=!0,y("?"+m,p)},[y,x]);return[x,C]}function vd({sidebar:s,children:a}){return r.jsxs("div",{className:"container",children:[r.jsxs("aside",{className:"sidebar",children:[r.jsx("div",{className:"sidebar-brand",children:r.jsx("img",{src:"/logo_dark.png",alt:"Teleton",style:{height:"64px"}})}),s]}),r.jsx("main",{className:"main",children:a??r.jsx(gd,{})})]})}const Xh="/api/agent/events",Zh="/api/agent/status",em=5,tm=3e4,nm=3e3;function rm(s){const a=Math.min(1e3*2**s,tm),c=a*.3*Math.random();return a+c}function lm(){const[s,a]=g.useState("stopped"),[c,u]=g.useState(null),x=g.useRef(!0),y=g.useRef(null),C=g.useRef(0),j=g.useRef(null),p=g.useRef(null),m=g.useRef(!1);return g.useEffect(()=>{x.current=!0;function d(S){if(x.current)try{const T=JSON.parse(S.data);a(T.state),u(T.error??null),C.current=0}catch{}}function h(){y.current&&(y.current.removeEventListener("status",d),y.current.close(),y.current=null)}function k(){p.current&&(clearInterval(p.current),p.current=null)}function L(){if(p.current)return;const S=async()=>{if(x.current)try{const T=await fetch(Zh,{credentials:"include"});if(!T.ok)return;const U=await T.json(),O=U.data??U;x.current&&(a(O.state),u(O.error??null))}catch{}};S(),p.current=setInterval(S,nm)}function b(){if(!x.current)return;h();const S=new EventSource(Xh,{withCredentials:!0});y.current=S,S.addEventListener("status",d),S.addEventListener("open",()=>{C.current=0,m.current=!1,k()}),S.onerror=()=>{if(h(),!!x.current)if(C.current+=1,C.current<=em){const T=rm(C.current-1);j.current=setTimeout(b,T)}else m.current=!0,L()}}function v(){document.hidden?(h(),k(),j.current&&(clearTimeout(j.current),j.current=null)):(C.current=0,m.current=!1,b())}return b(),document.addEventListener("visibilitychange",v),()=>{x.current=!1,h(),k(),j.current&&(clearTimeout(j.current),j.current=null),document.removeEventListener("visibilitychange",v)}},[]),{state:s,error:c}}const Qu="/api",sm=3,om=[1e3,2e3,4e3];function im(s){return s+s*.3*Math.random()}const am={stopped:{dot:"var(--text-tertiary)",label:"Stopped",pulse:!1},starting:{dot:"#FFD60A",label:"Starting...",pulse:!0},running:{dot:"var(--green)",label:"Running",pulse:!0},stopping:{dot:"#FF9F0A",label:"Stopping...",pulse:!0},error:{dot:"var(--red)",label:"Error",pulse:!1}};function cm(){const{state:s,error:a}=lm(),[c,u]=g.useState(!1),[x,y]=g.useState(!1),[C,j]=g.useState(null),[p,m]=g.useState(!1),d=g.useRef(null),h=g.useRef(null),k=a&&s==="stopped"?"error":s,L=am[k],b=g.useCallback(()=>{d.current&&(clearTimeout(d.current),d.current=null),m(!1)},[]),v=g.useCallback(async($=0)=>{u(!0),j(null),h.current=new AbortController;try{const K=await fetch(`${Qu}/agent/start`,{method:"POST",credentials:"include",signal:AbortSignal.timeout(1e4)}),Z=await K.json();if(!K.ok&&Z.error)throw new Error(Z.error)}catch(K){if(!d.current&&$<sm){m(!0);const Z=im(om[$]??4e3);d.current=setTimeout(()=>{d.current=null,v($+1)},Z),j(K instanceof Error?K.message:String(K)),u(!1);return}j(K instanceof Error?K.message:String(K)),m(!1)}finally{u(!1),h.current=null}},[]),S=g.useCallback(async()=>{y(!1),u(!0),j(null),b();try{const $=await fetch(`${Qu}/agent/stop`,{method:"POST",credentials:"include",signal:AbortSignal.timeout(1e4)}),K=await $.json();if(!$.ok&&K.error)throw new Error(K.error)}catch($){j($ instanceof Error?$.message:String($))}finally{u(!1)}},[b]),T=()=>{b(),v(0)},U=()=>{y(!0)},O=k==="stopped"||k==="error",W=k==="running";return r.jsxs("div",{style:{padding:"0 12px",marginBottom:"8px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[r.jsx("span",{style:{display:"inline-block",width:"8px",height:"8px",borderRadius:"50%",backgroundColor:L.dot,animation:L.pulse?"agent-pulse 2s ease-in-out infinite":"none",flexShrink:0}}),r.jsx("span",{style:{fontSize:"12px",fontWeight:500,color:"var(--text-secondary)"},children:L.label})]}),O&&!p&&r.jsx("button",{onClick:T,disabled:c,style:{width:"100%",background:"var(--green-dim)",color:"var(--green)",border:"1px solid rgba(48, 209, 88, 0.2)",fontSize:"12px",padding:"6px 12px"},children:c?"Starting...":"Start Agent"}),W&&r.jsx("button",{onClick:U,disabled:c,className:"btn-danger",style:{width:"100%",fontSize:"12px",padding:"6px 12px"},children:c?"Stopping...":"Stop Agent"}),p&&r.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)",marginTop:"4px"},children:"Retrying..."}),C&&!p&&r.jsx("div",{style:{fontSize:"11px",color:"var(--red)",marginTop:"4px",lineHeight:"1.4",wordBreak:"break-word"},children:C}),x&&od.createPortal(r.jsx("div",{className:"modal-overlay",onClick:()=>y(!1),children:r.jsxs("div",{className:"modal",onClick:$=>$.stopPropagation(),style:{maxWidth:"360px"},children:[r.jsx("h2",{style:{fontSize:"15px",fontWeight:600,marginBottom:"8px"},children:"Stop Agent?"}),r.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"20px",lineHeight:"1.5"},children:"Active Telegram sessions will be interrupted."}),r.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn-ghost",onClick:()=>y(!1),style:{fontSize:"13px"},children:"Cancel"}),r.jsx("button",{className:"btn-danger",onClick:S,style:{fontSize:"13px"},children:"Stop"})]})]})}),document.body),r.jsx("style",{children:`
|
|
68
|
+
@keyframes agent-pulse {
|
|
69
|
+
0%, 100% { opacity: 1; }
|
|
70
|
+
50% { opacity: 0.4; }
|
|
71
|
+
}
|
|
72
|
+
`})]})}const Ki="/api";async function He(s,a){const c={"Content-Type":"application/json",...a==null?void 0:a.headers},u=await fetch(`${Ki}${s}`,{...a,headers:c});if(!u.ok){const y=await u.json().catch(()=>({error:u.statusText}));throw new Error(y.error||`HTTP ${u.status}`)}const x=await u.json();return x.data!==void 0?x.data:x}async function ge(s,a){const c={"Content-Type":"application/json",...a==null?void 0:a.headers},u=await fetch(`${Ki}${s}`,{...a,headers:c,credentials:"include"});if(!u.ok){const x=await u.json().catch(()=>({error:u.statusText}));throw new Error(x.error||`HTTP ${u.status}`)}return u.json()}async function um(){var s;try{const c=await(await fetch("/auth/check",{credentials:"include"})).json();return c.success&&((s=c.data)==null?void 0:s.authenticated)}catch{return!1}}async function Yu(s){try{return(await fetch("/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:s}),credentials:"include"})).ok}catch{return!1}}async function dm(){await fetch("/auth/logout",{method:"POST",credentials:"include"}).catch(()=>{})}const ae={async getStatus(){return ge("/status")},async getTools(){return ge("/tools")},async getMemoryStats(){return ge("/memory/stats")},async searchKnowledge(s,a=10){return ge(`/memory/search?q=${encodeURIComponent(s)}&limit=${a}`)},async getMemorySources(){return ge("/memory/sources")},async getSourceChunks(s){return ge(`/memory/sources/${encodeURIComponent(s)}`)},async getSoulFile(s){return ge(`/soul/${s}`)},async updateSoulFile(s,a){return ge(`/soul/${s}`,{method:"PUT",body:JSON.stringify({content:a})})},async getPlugins(){return ge("/plugins")},async getPluginPriorities(){return ge("/plugins/priorities")},async setPluginPriority(s,a){return ge("/plugins/priorities",{method:"POST",body:JSON.stringify({pluginName:s,priority:a})})},async resetPluginPriority(s){return ge(`/plugins/priorities/${encodeURIComponent(s)}`,{method:"DELETE"})},async getToolRag(){return ge("/tools/rag")},async updateToolRag(s){return ge("/tools/rag",{method:"PUT",body:JSON.stringify(s)})},async getMcpServers(){return ge("/mcp")},async addMcpServer(s){return ge("/mcp",{method:"POST",body:JSON.stringify(s)})},async removeMcpServer(s){return ge(`/mcp/${encodeURIComponent(s)}`,{method:"DELETE"})},async updateToolConfig(s,a){return ge(`/tools/${s}`,{method:"PUT",body:JSON.stringify(a)})},async workspaceList(s="",a=!1){const c=new URLSearchParams;s&&c.set("path",s),a&&c.set("recursive","true");const u=c.toString();return ge(`/workspace${u?`?${u}`:""}`)},async workspaceRead(s){return ge(`/workspace/read?path=${encodeURIComponent(s)}`)},async workspaceWrite(s,a){return ge("/workspace/write",{method:"POST",body:JSON.stringify({path:s,content:a})})},async workspaceMkdir(s){return ge("/workspace/mkdir",{method:"POST",body:JSON.stringify({path:s})})},async workspaceDelete(s,a=!1){return ge("/workspace",{method:"DELETE",body:JSON.stringify({path:s,recursive:a})})},async workspaceRename(s,a){return ge("/workspace/rename",{method:"POST",body:JSON.stringify({from:s,to:a})})},async workspaceInfo(){return ge("/workspace/info")},workspaceRawUrl(s){return`/api/workspace/raw?path=${encodeURIComponent(s)}`},async tasksList(s){const a=s?`?status=${s}`:"";return ge(`/tasks${a}`)},async tasksGet(s){return ge(`/tasks/${s}`)},async tasksDelete(s){return ge(`/tasks/${s}`,{method:"DELETE"})},async tasksCancel(s){return ge(`/tasks/${s}/cancel`,{method:"POST"})},async tasksClean(s){return ge("/tasks/clean",{method:"POST",body:JSON.stringify({status:s})})},async tasksCleanDone(){return ge("/tasks/clean-done",{method:"POST"})},async getConfigKeys(){return ge("/config")},async setConfigKey(s,a){return ge(`/config/${s}`,{method:"PUT",body:JSON.stringify({value:a})})},async unsetConfigKey(s){return ge(`/config/${s}`,{method:"DELETE"})},async getModelsForProvider(s){return ge(`/config/models/${encodeURIComponent(s)}`)},async getProviderMeta(s){return ge(`/config/provider-meta/${encodeURIComponent(s)}`)},async validateApiKey(s,a){return ge("/config/validate-api-key",{method:"POST",body:JSON.stringify({provider:s,apiKey:a})})},async getMarketplace(s=!1){return ge(`/marketplace${s?"?refresh=true":""}`)},async installPlugin(s){return ge("/marketplace/install",{method:"POST",body:JSON.stringify({id:s})})},async uninstallPlugin(s){return ge("/marketplace/uninstall",{method:"POST",body:JSON.stringify({id:s})})},async updatePlugin(s){return ge("/marketplace/update",{method:"POST",body:JSON.stringify({id:s})})},async getPluginSecrets(s){return ge(`/marketplace/secrets/${encodeURIComponent(s)}`)},async setPluginSecret(s,a,c){return ge(`/marketplace/secrets/${encodeURIComponent(s)}/${encodeURIComponent(a)}`,{method:"PUT",body:JSON.stringify({value:c})})},async unsetPluginSecret(s,a){return ge(`/marketplace/secrets/${encodeURIComponent(s)}/${encodeURIComponent(a)}`,{method:"DELETE"})},async getBlocklist(){return ge("/hooks/blocklist")},async updateBlocklist(s){return ge("/hooks/blocklist",{method:"PUT",body:JSON.stringify(s)})},async getTriggers(){return ge("/hooks/triggers")},async createTrigger(s){return ge("/hooks/triggers",{method:"POST",body:JSON.stringify(s)})},async updateTrigger(s,a){return ge(`/hooks/triggers/${s}`,{method:"PUT",body:JSON.stringify(a)})},async deleteTrigger(s){return ge(`/hooks/triggers/${s}`,{method:"DELETE"})},async toggleTrigger(s,a){return ge(`/hooks/triggers/${s}/toggle`,{method:"PATCH",body:JSON.stringify({enabled:a})})},async getTonProxyStatus(){return ge("/ton-proxy")},async startTonProxy(){return ge("/ton-proxy/start",{method:"POST"})},async stopTonProxy(){return ge("/ton-proxy/stop",{method:"POST"})},async uninstallTonProxy(){return ge("/ton-proxy/uninstall",{method:"POST"})},connectLogs(s,a){const c=`${Ki}/logs/stream`,u=new EventSource(c);return u.addEventListener("log",x=>{try{const y=JSON.parse(x.data);s(y)}catch(y){console.error("Failed to parse log entry:",y)}}),u.onerror=x=>{a==null||a(x)},()=>u.close()}},Ye={getStatus:()=>He("/setup/status"),getProviders:()=>He("/setup/providers"),getModels:s=>He(`/setup/models/${encodeURIComponent(s)}`),validateApiKey:(s,a)=>He("/setup/validate/api-key",{method:"POST",body:JSON.stringify({provider:s,apiKey:a})}),detectClaudeCodeKey:()=>He("/setup/detect-claude-code-key"),validateBotToken:s=>He("/setup/validate/bot-token",{method:"POST",body:JSON.stringify({token:s})}),initWorkspace:s=>He("/setup/workspace/init",{method:"POST",body:JSON.stringify({agentName:s})}),getWalletStatus:()=>He("/setup/wallet/status"),generateWallet:()=>He("/setup/wallet/generate",{method:"POST"}),importWallet:s=>He("/setup/wallet/import",{method:"POST",body:JSON.stringify({mnemonic:s})}),sendCode:(s,a,c)=>He("/setup/telegram/send-code",{method:"POST",body:JSON.stringify({apiId:s,apiHash:a,phone:c})}),verifyCode:(s,a)=>He("/setup/telegram/verify-code",{method:"POST",body:JSON.stringify({authSessionId:s,code:a})}),verifyPassword:(s,a)=>He("/setup/telegram/verify-password",{method:"POST",body:JSON.stringify({authSessionId:s,password:a})}),resendCode:s=>He("/setup/telegram/resend-code",{method:"POST",body:JSON.stringify({authSessionId:s})}),startQr:(s,a)=>He("/setup/telegram/qr-start",{method:"POST",body:JSON.stringify({apiId:s,apiHash:a})}),refreshQr:s=>He("/setup/telegram/qr-refresh",{method:"POST",body:JSON.stringify({authSessionId:s})}),cancelSession:s=>He("/setup/telegram/session",{method:"DELETE",body:JSON.stringify({authSessionId:s})}),saveConfig:s=>He("/setup/config/save",{method:"POST",body:JSON.stringify(s)}),launch:()=>He("/setup/launch",{method:"POST"}),pollHealth:async(s=3e4)=>{const a=Date.now(),c=1e3;for(await new Promise(u=>setTimeout(u,1500));Date.now()-a<s;){try{const u=await fetch("/auth/check",{signal:AbortSignal.timeout(2e3)});if(u.ok){const x=await u.json();if(x.success&&x.data&&!x.data.setup)return}}catch{}await new Promise(u=>setTimeout(u,c))}throw new Error("Agent did not start within the expected time")}};function pm(){const s=Qn(),a=u=>s.pathname===u,c=async()=>{await dm(),window.location.href="/"};return r.jsxs(r.Fragment,{children:[r.jsxs("nav",{children:[r.jsx(Kt,{to:"/",className:a("/")?"active":"",children:"Dashboard"}),r.jsx(Kt,{to:"/tools",className:a("/tools")?"active":"",children:"Tools"}),r.jsx(Kt,{to:"/plugins",className:a("/plugins")?"active":"",children:"Plugins"}),r.jsx(Kt,{to:"/soul",className:a("/soul")?"active":"",children:"Soul"}),r.jsx(Kt,{to:"/memory",className:a("/memory")?"active":"",children:"Memory"}),r.jsx(Kt,{to:"/workspace",className:a("/workspace")?"active":"",children:"Workspace"}),r.jsx(Kt,{to:"/tasks",className:a("/tasks")?"active":"",children:"Tasks"}),r.jsx(Kt,{to:"/mcp",className:a("/mcp")?"active":"",children:"MCP"}),r.jsx(Kt,{to:"/hooks",className:a("/hooks")?"active":"",children:"Hooks"}),r.jsx(Kt,{to:"/config",className:a("/config")?"active":"",children:"Config"})]}),r.jsxs("div",{style:{marginTop:"auto"},children:[r.jsx(cm,{}),r.jsx("div",{style:{padding:"0 12px 14px"},children:r.jsx("button",{onClick:c,style:{width:"100%",opacity:.7,fontSize:"13px"},children:"Logout"})})]})]})}function fm(){return r.jsx(vd,{sidebar:r.jsx(pm,{})})}class jd extends g.Component{constructor(){super(...arguments);$t(this,"state",{hasError:!1,error:null})}static getDerivedStateFromError(c){return{hasError:!0,error:c.message}}render(){return this.state.hasError?r.jsxs("div",{className:"card",style:{textAlign:"center",padding:"40px 20px"},children:[r.jsx("h2",{style:{color:"var(--red)",marginBottom:"8px"},children:"Something went wrong"}),r.jsx("p",{style:{color:"var(--text-secondary)",marginBottom:"16px"},children:this.state.error}),r.jsx("button",{onClick:()=>this.setState({hasError:!1,error:null}),children:"Try Again"})]}):this.props.children}}function Sd(){const[s,a]=g.useState(null),[c,u]=g.useState(null),[x,y]=g.useState(null),[C,j]=g.useState(!0),[p,m]=g.useState(null),[d,h]=g.useState(null),[k,L]=g.useState([]),[b,v]=g.useState(null),[S,T]=g.useState(null),[U,O]=g.useState(""),[W,$]=g.useState(!1),[K,Z]=g.useState(null),[ne,D]=g.useState({}),[A,H]=g.useState({}),ue=g.useCallback(()=>{Promise.all([ae.getStatus(),ae.getMemoryStats(),ae.getConfigKeys(),ae.getToolRag()]).then(([V,le,me,je])=>{a(V.data),u(le.data),y(je.data);const ke={};for(const be of me.data)be.value!=null&&(ke[be.key]=be.value);D(ke),H(ke),j(!1)}).catch(V=>{m(V.message),j(!1)})},[]);g.useEffect(()=>{ue()},[ue]);const I=V=>A[V]??"",oe=V=>ne[V]??"",ie=V=>{H(le=>({...le,[V]:ne[V]??""}))},ve=V=>{h(V),setTimeout(()=>h(null),2e3)},re=async(V,le)=>{if(le.trim())try{m(null),await ae.setConfigKey(V,le.trim()),await ue(),ve(`Saved ${V.split(".").pop()}`)}catch(me){m(me instanceof Error?me.message:String(me))}},P=async V=>{try{const le=await ae.updateToolRag(V);y(le.data),ve("Tool RAG updated")}catch(le){m(le instanceof Error?le.message:String(le))}},te=(V,le)=>{H(me=>({...me,[V]:le}))},B=I("agent.provider");return g.useEffect(()=>{B&&ae.getModelsForProvider(B).then(V=>{const le=V.data.map(je=>({value:je.value,name:je.name}));L(le);const me=A["agent.model"]??"";le.length>0&&!le.some(je=>je.value===me)&&re("agent.model",le[0].value)}).catch(()=>L([]))},[B]),{loading:C,error:p,setError:m,saveSuccess:d,status:s,stats:c,toolRag:x,localInputs:A,getLocal:I,getServer:oe,setLocal:te,cancelLocal:ie,saveConfig:re,saveToolRag:P,showSuccess:ve,modelOptions:k,pendingProvider:b,pendingMeta:S,pendingApiKey:U,setPendingApiKey:O,pendingValidating:W,pendingError:K,setPendingError:Z,handleProviderChange:async V=>{if(V!==B)try{const me=(await ae.getProviderMeta(V)).data;me.needsKey?(v(V),T(me),O(""),Z(null)):(await re("agent.provider",V),v(null),T(null))}catch(le){m(le instanceof Error?le.message:String(le))}},handleProviderConfirm:async()=>{if(!(!b||!S)){if(S.needsKey&&!U.trim()){Z("API key is required");return}$(!0),Z(null);try{const V=await ae.validateApiKey(b,U);if(!V.data.valid){Z(V.data.error||"Invalid API key"),$(!1);return}await ae.setConfigKey("agent.api_key",U.trim()),await re("agent.provider",b),v(null),T(null),O(""),ve(`Switched to ${S.displayName}`)}catch(V){Z(V instanceof Error?V.message:String(V))}finally{$(!1)}}},handleProviderCancel:()=>{v(null),T(null),O(""),Z(null)},loadData:ue}}function kt({value:s,options:a,labels:c,onChange:u,style:x}){const[y,C]=g.useState(!1),[j,p]=g.useState(-1),[m,d]=g.useState(null),h=g.useRef(null),k=g.useRef(null),L=g.useRef(Math.random().toString(36).slice(2));g.useEffect(()=>{if(!y)return;const S=T=>{var W,$;const U=T.target;((W=h.current)==null?void 0:W.contains(U))||(($=k.current)==null?void 0:$.contains(U))||C(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[y]),g.useEffect(()=>{if(y&&h.current){const S=h.current.getBoundingClientRect();d({top:S.bottom+4,left:S.left,width:S.width})}else d(null)},[y]),g.useEffect(()=>{if(y){const S=a.indexOf(s);p(S>=0?S:0)}},[y,a,s]),g.useEffect(()=>{if(!y||j<0||!k.current)return;const S=k.current.children[j];S==null||S.scrollIntoView({block:"nearest"})},[y,j]);const b=g.useCallback(S=>{if(!y){(S.key==="Enter"||S.key===" "||S.key==="ArrowDown")&&(S.preventDefault(),C(!0));return}switch(S.key){case"ArrowDown":S.preventDefault(),p(T=>(T+1)%a.length);break;case"ArrowUp":S.preventDefault(),p(T=>(T-1+a.length)%a.length);break;case"Enter":case" ":S.preventDefault(),j>=0&&j<a.length&&(u(a[j]),C(!1));break;case"Escape":S.preventDefault(),C(!1);break;case"Home":S.preventDefault(),p(0);break;case"End":S.preventDefault(),p(a.length-1);break}},[y,j,a,u]),v=`select-menu-${L.current}`;return r.jsxs("div",{ref:h,className:"custom-select",style:x,children:[r.jsxs("button",{type:"button",className:"custom-select-trigger",onClick:()=>C(!y),onKeyDown:b,"aria-haspopup":"listbox","aria-expanded":y,"aria-controls":y?v:void 0,children:[r.jsx("span",{children:c?c[a.indexOf(s)]??s:s}),r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:r.jsx("path",{d:"M6 9l6 6 6-6"})})]}),y&&m&&od.createPortal(r.jsx("div",{ref:k,id:v,className:"custom-select-menu",role:"listbox","aria-activedescendant":j>=0?`${v}-opt-${j}`:void 0,style:{position:"fixed",top:m.top,left:m.left,width:m.width},children:a.map((S,T)=>r.jsx("div",{id:`${v}-opt-${T}`,role:"option","aria-selected":S===s,className:`custom-select-option${S===s?" active":""}${T===j?" focused":""}`,onClick:()=>{u(S),C(!1)},onMouseEnter:()=>p(T),children:c?c[T]??S:S},S))}),document.body)]})}const Gu="rgba(24, 24, 27, 0.95)",hm=75;function Qe({text:s}){const[a,c]=g.useState(!1),u=g.useId(),x=g.useRef(null),y=g.useCallback(()=>{x.current&&clearTimeout(x.current),c(!0)},[]),C=g.useCallback(()=>{x.current=setTimeout(()=>c(!1),hm)},[]);return g.useEffect(()=>{if(!a)return;const j=p=>{p.key==="Escape"&&c(!1)};return document.addEventListener("keydown",j),()=>document.removeEventListener("keydown",j)},[a]),g.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]),r.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",marginLeft:"6px"},onMouseEnter:y,onMouseLeave:C,onFocus:y,onBlur:C,children:[r.jsx("span",{tabIndex:0,role:"button","aria-describedby":a?u:void 0,"aria-label":"Info",style:{cursor:"help",display:"inline-flex",color:a?"var(--text)":"var(--text-secondary)",transition:"color 0.15s",outline:"none"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("circle",{cx:"7",cy:"7",r:"6",stroke:"currentColor",strokeWidth:"1.5"}),r.jsx("text",{x:"7",y:"10.5",textAnchor:"middle",fill:"currentColor",fontSize:"9",fontWeight:"600",fontFamily:"sans-serif",children:"i"})]})}),r.jsxs("span",{id:u,role:"tooltip",onMouseEnter:y,onMouseLeave:C,style:{position:"absolute",bottom:"calc(100% + 8px)",left:"50%",transform:a?"translateX(-50%) translateY(0)":"translateX(-50%) translateY(4px)",width:"max-content",maxWidth:"250px",minWidth:"64px",padding:"6px 12px",background:Gu,backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)",border:"1px solid var(--glass-border)",borderRadius:"6px",boxShadow:"0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)",color:"#ffffff",fontSize:"var(--font-sm)",fontWeight:400,lineHeight:"1.4",textAlign:"center",overflowWrap:"break-word",whiteSpace:"normal",zIndex:50,opacity:a?1:0,visibility:a?"visible":"hidden",transition:"opacity 200ms cubic-bezier(0.16,1,0.3,1), transform 200ms cubic-bezier(0.16,1,0.3,1), visibility 200ms",pointerEvents:a?"auto":"none"},children:[s,r.jsx("span",{style:{position:"absolute",bottom:"-4px",left:"50%",transform:"translateX(-50%) rotate(45deg)",width:"8px",height:"8px",background:Gu,borderRight:"1px solid var(--glass-border)",borderBottom:"1px solid var(--glass-border)"}})]})]})}function ot({label:s,description:a,type:c="text",value:u,serverValue:x,onChange:y,onSave:C,onCancel:j,min:p,max:m,step:d,placeholder:h,hotReload:k,badge:L,inline:b}){const[v,S]=g.useState(!1),T=g.useRef(null),U=u!==x,O=async()=>{if(!(!U||v)){S(!0);try{await C(u)}finally{S(!1)}}},W=()=>{v||j()},$=H=>{H.key==="Enter"?(H.preventDefault(),O()):H.key==="Escape"&&(H.preventDefault(),W())};g.useEffect(()=>{v&&T.current&&T.current.blur()},[v]);const K=L?r.jsx("span",{style:{fontSize:11,padding:"1px 6px",borderRadius:4,backgroundColor:L==="Set"?"var(--accent)":"var(--red)",color:"var(--text-on-accent)",marginLeft:6,fontWeight:500},children:L}):null,Z=k==="restart"?r.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)",marginLeft:6},children:"(requires restart)"}):null,ne=r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[r.jsx("span",{children:s}),a&&r.jsx(Qe,{text:a}),K,Z]}),D=U?r.jsxs("div",{style:{display:"flex",gap:4,flexShrink:0},children:[r.jsx("button",{onClick:O,disabled:v,style:{padding:"4px 8px",fontSize:13,border:"1px solid var(--accent)",borderRadius:4,background:"var(--accent)",color:"var(--text-on-accent)",cursor:v?"wait":"pointer",opacity:v?.6:1,lineHeight:1},children:v?"...":"✓"}),r.jsx("button",{onClick:W,disabled:v,style:{padding:"4px 8px",fontSize:13,border:"1px solid var(--separator)",borderRadius:4,background:"var(--surface)",color:"var(--text)",cursor:"pointer",lineHeight:1},children:"✗"})]}):null,A=r.jsx("input",{ref:T,type:c,value:u,onChange:H=>y(H.target.value),onKeyDown:$,disabled:v,placeholder:h,min:p,max:m,step:d,style:{flex:1,padding:"6px 10px",fontSize:14,border:"1px solid var(--separator)",borderRadius:4,background:"var(--surface)",color:"var(--text)",minWidth:0}});return b?r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minHeight:36},children:[r.jsx("div",{style:{flex:"0 0 auto",minWidth:120},children:ne}),r.jsxs("div",{style:{flex:1,display:"flex",gap:6,alignItems:"center"},children:[A,D]})]}):r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:ne}),r.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[A,D]})]})}function wd({getLocal:s,getServer:a=()=>"",setLocal:c,saveConfig:u,cancelLocal:x=()=>{},modelOptions:y,pendingProvider:C,pendingMeta:j,pendingApiKey:p,setPendingApiKey:m,pendingValidating:d,pendingError:h,setPendingError:k,handleProviderChange:L,handleProviderConfirm:b,handleProviderCancel:v,compact:S=!1}){return r.jsx(r.Fragment,{children:r.jsxs("div",{style:{display:"grid",gap:"16px"},children:[r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsxs("label",{children:["Provider ",r.jsx(Qe,{text:"LLM provider"})]}),r.jsx(kt,{value:C??s("agent.provider"),options:["claude-code","anthropic","openai","google","xai","groq","openrouter","moonshot","mistral","cerebras","zai","minimax","huggingface","cocoon","local"],labels:["Claude Code","Anthropic","OpenAI","Google","xAI","Groq","OpenRouter","Moonshot","Mistral","Cerebras","ZAI (Zhipu)","MiniMax","HuggingFace","Cocoon","Local"],onChange:L})]}),C&&j&&r.jsxs("div",{className:"provider-switch-zone",children:[r.jsxs("div",{style:{fontSize:"13px",fontWeight:500,marginBottom:"12px"},children:["Switching to ",j.displayName]}),j.needsKey&&r.jsxs("div",{className:"form-group",style:{marginBottom:"8px"},children:[r.jsx("label",{children:"API Key"}),r.jsx("input",{type:"password",placeholder:j.keyHint,value:p,onChange:T=>{m(T.target.value),k(null)},onKeyDown:T=>T.key==="Enter"&&b(),style:{width:"100%"},autoFocus:!0}),j.consoleUrl&&r.jsxs("a",{href:j.consoleUrl,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"12px",color:"var(--text-secondary)",marginTop:"4px",display:"inline-block"},children:["Get key at ",new URL(j.consoleUrl).hostname," ↗"]})]}),h&&r.jsx("div",{style:{fontSize:"12px",color:"var(--red)",marginBottom:"8px"},children:h}),r.jsxs("div",{style:{display:"flex",gap:"8px"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:v,disabled:d,children:"Cancel"}),r.jsx("button",{className:"btn-sm",onClick:b,disabled:d,children:d?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Validating..."]}):"Validate & Save"})]})]}),r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsxs("label",{children:["Model ",r.jsx(Qe,{text:"Main LLM model ID"})]}),r.jsx(kt,{value:s("agent.model"),options:y.map(T=>T.value),labels:y.map(T=>T.name),onChange:T=>u("agent.model",T)})]}),!S&&r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsx(ot,{label:"Temperature",description:"Response creativity (0.0 = deterministic, 2.0 = max)",configKey:"agent.temperature",type:"number",value:s("agent.temperature"),serverValue:a("agent.temperature"),onChange:T=>c("agent.temperature",T),onSave:T=>u("agent.temperature",T),onCancel:()=>x("agent.temperature"),min:0,max:2,step:.1,inline:!0}),r.jsx(ot,{label:"Max Tokens",description:"Maximum response length in tokens",configKey:"agent.max_tokens",type:"number",value:s("agent.max_tokens"),serverValue:a("agent.max_tokens"),onChange:T=>c("agent.max_tokens",T),onSave:T=>u("agent.max_tokens",T),onCancel:()=>x("agent.max_tokens"),min:1,inline:!0}),r.jsx(ot,{label:"Max Iterations",description:"Max tool-call loop iterations per message",configKey:"agent.max_agentic_iterations",type:"number",value:s("agent.max_agentic_iterations"),serverValue:a("agent.max_agentic_iterations"),onChange:T=>c("agent.max_agentic_iterations",T),onSave:T=>u("agent.max_agentic_iterations",T),onCancel:()=>x("agent.max_agentic_iterations"),min:1,max:20,inline:!0})]})]})})}function ml({value:s,onChange:a,validate:c,placeholder:u,disabled:x}){const[y,C]=g.useState(s),[j,p]=g.useState(""),[m,d]=g.useState(null),[h,k]=g.useState(-1),[L,b]=g.useState(-1),v=g.useRef(null),S=g.useRef([]);g.useEffect(()=>{C(s)},[s]);const T=JSON.stringify(y)!==JSON.stringify(s),U=g.useCallback(D=>{const A=D.trim();if(A){if(c){const H=c(A);if(H){d(H);return}}if(y.includes(A)){d("Duplicate item");return}d(null),C(H=>[...H,A]),p("")}},[y,c]),O=g.useCallback(D=>{var A;if(C(H=>H.filter((ue,I)=>I!==D)),y.length<=1)(A=v.current)==null||A.focus(),k(-1);else if(D>=y.length-1){const H=D-1;k(H),setTimeout(()=>{var ue;return(ue=S.current[H])==null?void 0:ue.focus()},0)}else k(D),setTimeout(()=>{var H;return(H=S.current[D])==null?void 0:H.focus()},0)},[y.length]),W=g.useCallback(D=>{var A;if(!D.nativeEvent.isComposing){if(D.key==="Enter")D.preventDefault(),U(j);else if(D.key==="Backspace"&&j===""&&y.length>0){const H=y.length-1;k(H),(A=S.current[H])==null||A.focus()}}},[j,U,y.length]),$=g.useCallback((D,A)=>{var H,ue,I,oe,ie,ve;switch(D.key){case"ArrowLeft":D.preventDefault(),A>0&&(k(A-1),(H=S.current[A-1])==null||H.focus());break;case"ArrowRight":D.preventDefault(),A<y.length-1?(k(A+1),(ue=S.current[A+1])==null||ue.focus()):(k(-1),(I=v.current)==null||I.focus());break;case"Delete":case"Backspace":D.preventDefault(),O(A);break;case"Escape":D.preventDefault(),k(-1),(oe=v.current)==null||oe.focus();break;case"Home":D.preventDefault(),k(0),(ie=S.current[0])==null||ie.focus();break;case"End":if(D.preventDefault(),y.length>0){const re=y.length-1;k(re),(ve=S.current[re])==null||ve.focus()}break}},[y.length,O]),K=g.useCallback(D=>{const H=D.clipboardData.getData("text").split(/[,;\n\t]+/).map(I=>I.trim()).filter(Boolean);if(H.length<=1)return;D.preventDefault();const ue=[];for(const I of H)y.includes(I)||ue.includes(I)||c&&c(I)||ue.push(I);ue.length>0&&(C(I=>[...I,...ue]),d(null))},[y,c]),Z=()=>{a(y)},ne=()=>{C(s),d(null)};return r.jsxs("div",{style:{opacity:x?.5:1},children:[y.length>0&&r.jsx("div",{role:"listbox","aria-orientation":"horizontal",style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"var(--space-sm)"},children:y.map((D,A)=>r.jsxs("div",{ref:H=>{S.current[A]=H},role:"option","aria-selected":"true",tabIndex:h===A?0:-1,onKeyDown:H=>$(H,A),onFocus:()=>k(A),onBlur:()=>{h===A&&k(-1)},style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"3px 8px",background:"var(--surface)",border:"1px solid var(--glass-border)",color:"var(--text-secondary)",borderRadius:"6px",fontSize:"var(--font-sm)",lineHeight:"1.4",outline:h===A?"2px solid var(--accent)":"none",outlineOffset:h===A?"1px":void 0,cursor:"default"},children:[r.jsx("span",{style:{fontFamily:"var(--font-mono)",letterSpacing:"-0.2px"},children:D}),r.jsx("button",{type:"button","aria-label":`Remove ${D}`,disabled:x,onClick:H=>{H.stopPropagation(),O(A)},onMouseEnter:()=>b(A),onMouseLeave:()=>b(-1),style:{background:"none",border:"none",color:L===A?"var(--red)":"var(--text-tertiary)",cursor:x?"not-allowed":"pointer",padding:"0 1px",fontSize:"13px",lineHeight:"1",transition:"color 0.15s"},children:"×"})]},`${D}-${A}`))}),r.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[r.jsx("input",{ref:v,type:"text",value:j,onChange:D=>{p(D.target.value),d(null)},onKeyDown:W,onPaste:K,placeholder:u??"Add pattern…",disabled:x,"aria-invalid":m?!0:void 0,style:{flex:1,background:"var(--surface)",border:"1px solid var(--glass-border)",borderRadius:"6px",color:"var(--text)",fontSize:"var(--font-sm)",padding:"5px 10px",outline:"none",fontFamily:"var(--font-mono)"},onFocus:D=>{D.target.style.borderColor="var(--glass-border-strong)"},onBlur:D=>{D.target.style.borderColor="var(--glass-border)"}}),r.jsx("button",{type:"button",disabled:x||!j.trim(),onClick:()=>U(j),style:{padding:"4px 10px",fontSize:"var(--font-sm)",borderRadius:"6px",minHeight:"auto",lineHeight:"1.4"},children:"Add"})]}),m&&r.jsx("div",{style:{fontSize:"var(--font-sm)",color:"var(--red)",marginTop:"4px"},children:m}),T&&r.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"var(--space-sm)"},children:[r.jsx("button",{type:"button",onClick:Z,disabled:x,style:{padding:"4px 12px",fontSize:"var(--font-sm)",borderRadius:"6px",minHeight:"auto"},children:"Save"}),r.jsx("button",{type:"button",className:"btn-ghost",onClick:ne,disabled:x,style:{padding:"4px 12px",fontSize:"var(--font-sm)",borderRadius:"6px",minHeight:"auto"},children:"Cancel"})]})]})}function Ni(s){if(!s)return[];try{return JSON.parse(s).map(String)}catch{return[]}}function kd({getLocal:s,getServer:a=()=>"",setLocal:c,saveConfig:u,cancelLocal:x=()=>{},onArraySave:y,extended:C}){const j=r.jsx("div",{className:"card-header",children:r.jsx("div",{className:"section-title",children:"Telegram"})}),p=r.jsx(r.Fragment,{children:r.jsxs("div",{style:{display:"grid",gap:"16px"},children:[C&&r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsx(ot,{label:"Bot Username",description:"Bot username without @",configKey:"telegram.bot_username",value:s("telegram.bot_username"),serverValue:a("telegram.bot_username"),onChange:h=>c("telegram.bot_username",h),onSave:h=>u("telegram.bot_username",h),onCancel:()=>x("telegram.bot_username")}),r.jsx(ot,{label:"Owner Name",description:"Owner's first name (used in system prompt)",configKey:"telegram.owner_name",value:s("telegram.owner_name"),serverValue:a("telegram.owner_name"),onChange:h=>c("telegram.owner_name",h),onSave:h=>u("telegram.owner_name",h),onCancel:()=>x("telegram.owner_name")}),r.jsx(ot,{label:"Owner Username",description:"Owner's Telegram username (without @)",configKey:"telegram.owner_username",value:s("telegram.owner_username"),serverValue:a("telegram.owner_username"),onChange:h=>c("telegram.owner_username",h),onSave:h=>u("telegram.owner_username",h),onCancel:()=>x("telegram.owner_username")}),r.jsx(ot,{label:"Owner ID",description:"Primary admin Telegram user ID (auto-added to Admin IDs)",configKey:"telegram.owner_id",type:"number",value:s("telegram.owner_id"),serverValue:a("telegram.owner_id"),onChange:h=>c("telegram.owner_id",h),onSave:h=>u("telegram.owner_id",h),onCancel:()=>x("telegram.owner_id"),min:1})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"16px"},children:[r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["DM Policy",r.jsx(Qe,{text:"Who can message the bot in private"})]})}),r.jsx(kt,{value:s("telegram.dm_policy"),options:["admin-only","allowlist","open","disabled"],labels:["Admin Only","Allow Users","Open","Disabled"],onChange:h=>u("telegram.dm_policy",h)})]}),r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["Group Policy",r.jsx(Qe,{text:"Which groups the bot can respond in"})]})}),r.jsx(kt,{value:s("telegram.group_policy"),options:["admin-only","allowlist","open","disabled"],labels:["Admin Only","Allow Groups","Open","Disabled"],onChange:h=>u("telegram.group_policy",h)})]})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsxs("label",{style:{fontSize:"13px",color:"var(--text)",cursor:"pointer",display:"flex",alignItems:"center",gap:4},htmlFor:"require-mention",children:["Require Mention",r.jsx(Qe,{text:"Require @mention in groups to respond"})]}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{id:"require-mention",type:"checkbox",checked:s("telegram.require_mention")==="true",onChange:h=>u("telegram.require_mention",String(h.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),C&&r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsxs("label",{style:{fontSize:"13px",color:"var(--text)",cursor:"pointer",display:"flex",alignItems:"center",gap:4},htmlFor:"typing-sim",children:["Typing Simulation",r.jsx(Qe,{text:"Simulate typing indicator before sending replies"})]}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{id:"typing-sim",type:"checkbox",checked:s("telegram.typing_simulation")==="true",onChange:h=>u("telegram.typing_simulation",String(h.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]})]})}),m=r.jsx("div",{className:"card-header",children:r.jsx("div",{className:"section-title",children:"Advanced Telegram"})}),d=r.jsx(r.Fragment,{children:r.jsxs("div",{style:{display:"grid",gap:"16px"},children:[r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsx(ot,{label:"Debounce (ms)",description:"Group message debounce delay in ms (0 = disabled)",configKey:"telegram.debounce_ms",type:"number",value:s("telegram.debounce_ms"),serverValue:a("telegram.debounce_ms"),onChange:h=>c("telegram.debounce_ms",h),onSave:h=>u("telegram.debounce_ms",h),onCancel:()=>x("telegram.debounce_ms"),min:0}),r.jsx(ot,{label:"Max Message Length",description:"Maximum message length in characters",configKey:"telegram.max_message_length",type:"number",value:s("telegram.max_message_length"),serverValue:a("telegram.max_message_length"),onChange:h=>c("telegram.max_message_length",h),onSave:h=>u("telegram.max_message_length",h),onCancel:()=>x("telegram.max_message_length"),min:1}),r.jsx(ot,{label:"Agent Channel",description:"Channel username for auto-publishing",configKey:"telegram.agent_channel",value:s("telegram.agent_channel"),serverValue:a("telegram.agent_channel"),onChange:h=>c("telegram.agent_channel",h),onSave:h=>u("telegram.agent_channel",h),onCancel:()=>x("telegram.agent_channel")})]}),y&&r.jsxs("div",{style:{display:"grid",gap:"16px"},children:[r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["Admin IDs",r.jsx(Qe,{text:"Admin user IDs with elevated access"})]})}),r.jsx(ml,{value:Ni(s("telegram.admin_ids")),onChange:h=>y("telegram.admin_ids",h),validate:h=>/^\d+$/.test(h)?null:"Must be a number",placeholder:"Enter ID..."})]}),r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["Allowed Users",r.jsx(Qe,{text:"User IDs allowed for DM access"})]})}),r.jsx(ml,{value:Ni(s("telegram.allow_from")),onChange:h=>y("telegram.allow_from",h),validate:h=>/^\d+$/.test(h)?null:"Must be a number",placeholder:"Enter ID..."})]}),r.jsxs("div",{className:"form-group",style:{marginBottom:0},children:[r.jsx("label",{children:r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:["Allowed Groups",r.jsx(Qe,{text:"Group IDs allowed for group access"})]})}),r.jsx(ml,{value:Ni(s("telegram.group_allow_from")),onChange:h=>y("telegram.group_allow_from",h),validate:h=>/^\d+$/.test(h)?null:"Must be a number",placeholder:"Enter ID..."})]})]}),r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsx(ot,{label:"Rate Limit -- Messages/sec",description:"Rate limit: messages per second (requires restart)",configKey:"telegram.rate_limit_messages_per_second",type:"number",value:s("telegram.rate_limit_messages_per_second"),serverValue:a("telegram.rate_limit_messages_per_second"),onChange:h=>c("telegram.rate_limit_messages_per_second",h),onSave:h=>u("telegram.rate_limit_messages_per_second",h),onCancel:()=>x("telegram.rate_limit_messages_per_second"),hotReload:"restart",min:0,step:.1}),r.jsx(ot,{label:"Rate Limit -- Groups/min",description:"Rate limit: groups per minute (requires restart)",configKey:"telegram.rate_limit_groups_per_minute",type:"number",value:s("telegram.rate_limit_groups_per_minute"),serverValue:a("telegram.rate_limit_groups_per_minute"),onChange:h=>c("telegram.rate_limit_groups_per_minute",h),onSave:h=>u("telegram.rate_limit_groups_per_minute",h),onCancel:()=>x("telegram.rate_limit_groups_per_minute"),hotReload:"restart",min:1})]})]})});return C?r.jsxs(r.Fragment,{children:[j,r.jsx("div",{className:"card",children:p}),m,r.jsx("div",{className:"card",children:d})]}):r.jsxs(r.Fragment,{children:[j,r.jsx("div",{className:"card",children:p})]})}function mm({getLocal:s,saveConfig:a}){const c=s("capabilities.exec.mode")==="yolo";return r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"14px",flexWrap:"wrap"},children:[r.jsx("span",{className:"section-title",style:{marginBottom:0},children:"Coding Agent"}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsxs("label",{style:{fontSize:"13px",color:"var(--text-secondary)",display:"flex",alignItems:"center",gap:4},htmlFor:"exec-yolo",children:["YOLO",r.jsx(Qe,{text:"Full system access — exec_run, exec_install, exec_service, exec_status. Requires restart."})]}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{id:"exec-yolo",type:"checkbox",checked:c,onChange:u=>a("capabilities.exec.mode",u.target.checked?"yolo":"off")}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),c&&r.jsxs(r.Fragment,{children:[r.jsx("div",{style:{width:1,height:18,background:"var(--separator)"}}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsxs("label",{style:{fontSize:"13px",color:"var(--text-secondary)",display:"flex",alignItems:"center",gap:4},children:["Scope",r.jsx(Qe,{text:"Who can trigger exec tools. Requires restart."})]}),r.jsx(kt,{value:s("capabilities.exec.scope")||"admin-only",options:["admin-only","allowlist","all"],labels:["Admin Only","Allowlist","Everyone"],onChange:u=>a("capabilities.exec.scope",u)})]}),r.jsx("div",{style:{width:1,height:18,background:"var(--separator)"}}),r.jsx("span",{style:{fontSize:"var(--font-sm)",color:"var(--text-tertiary)"},children:"Full system access enabled"})]})]})}const qu=2e3,Pi=1e3,gm=3e4;class xm{constructor(){$t(this,"logs",[]);$t(this,"snapshot",[]);$t(this,"listeners",new Set);$t(this,"disconnect",null);$t(this,"_connected",!1);$t(this,"reconnectTimer",null);$t(this,"reconnectDelay",Pi);$t(this,"shouldReconnect",!1)}connect(){this.disconnect||(this.shouldReconnect=!0,this.reconnectDelay=Pi,this.doConnect())}doConnect(){this.disconnect||(this.disconnect=ae.connectLogs(a=>{this.logs.push(a),this.logs.length>qu&&(this.logs=this.logs.slice(-qu)),this._connected=!0,this.reconnectDelay=Pi,this.snapshot=[...this.logs],this.notify()},()=>{this._connected=!1,this.disconnect&&(this.disconnect(),this.disconnect=null),this.notify(),this.scheduleReconnect()}))}scheduleReconnect(){!this.shouldReconnect||this.reconnectTimer||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.shouldReconnect&&!this.disconnect&&this.doConnect()},this.reconnectDelay),this.reconnectDelay=Math.min(this.reconnectDelay*2,gm))}stop(){this.shouldReconnect=!1,this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.disconnect&&(this.disconnect(),this.disconnect=null),this._connected=!1,this.notify()}getLogs(){return this.snapshot}isConnected(){return this._connected}clear(){this.logs=[],this.snapshot=[],this.notify()}subscribe(a){return this.listeners.add(a),()=>this.listeners.delete(a)}notify(){for(const a of this.listeners)a()}}const Kn=new xm;function kn({label:s,value:a,mono:c}){return r.jsxs("div",{className:"metric",children:[r.jsx("span",{className:"metric-label",children:s}),r.jsx("span",{className:`metric-value${c?" mono":""}`,children:a})]})}function ym(){const{loading:s,error:a,setError:c,saveSuccess:u,status:x,stats:y,getLocal:C,getServer:j,setLocal:p,cancelLocal:m,saveConfig:d,modelOptions:h,pendingProvider:k,pendingMeta:L,pendingApiKey:b,setPendingApiKey:v,pendingValidating:S,pendingError:T,setPendingError:U,handleProviderChange:O,handleProviderConfirm:W,handleProviderCancel:$}=Sd(),[K,Z]=g.useState(null);g.useEffect(()=>{let oe=!0;const ve=setInterval(()=>{ae.getStatus().then(re=>{oe&&Z(re.data)}).catch(()=>{})},1e4);return()=>{oe=!1,clearInterval(ve)}},[]);const ne=K??x,D=g.useSyncExternalStore(oe=>Kn.subscribe(oe),()=>Kn.getLogs()),A=g.useSyncExternalStore(oe=>Kn.subscribe(oe),()=>Kn.isConnected()),H=g.useRef(null);if(g.useEffect(()=>{Kn.connect()},[]),g.useEffect(()=>{var oe;(oe=H.current)==null||oe.scrollIntoView({behavior:"smooth"})},[D]),s)return r.jsx("div",{className:"loading",children:"Loading..."});if(!x||!y)return r.jsx("div",{className:"alert error",children:"Failed to load dashboard data"});const ue=ne??x,I=ue.uptime<3600?`${Math.floor(ue.uptime/60)}m`:`${Math.floor(ue.uptime/3600)}h ${Math.floor(ue.uptime%3600/60)}m`;return r.jsxs("div",{className:"dashboard-root",children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Dashboard"}),r.jsx("p",{children:"System overview"})]}),a&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[a,r.jsx("button",{onClick:()=>c(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),u&&r.jsx("div",{className:"alert success",style:{marginBottom:"16px"},children:u}),r.jsx("div",{className:"card status-bar",children:r.jsxs("div",{className:"status-row",children:[r.jsx(kn,{label:"Uptime",value:I}),r.jsx(kn,{label:"Sessions",value:ue.sessionCount}),r.jsx(kn,{label:"Tools",value:ue.toolCount}),r.jsx(kn,{label:"Knowledge",value:y.knowledge}),r.jsx(kn,{label:"Messages",value:y.messages.toLocaleString()}),r.jsx(kn,{label:"Chats",value:y.chats}),r.jsx(kn,{label:"Tokens",value:ue.tokenUsage?`${(ue.tokenUsage.totalTokens/1e3).toFixed(1)}K`:"0",mono:!0}),r.jsx(kn,{label:"Cost",value:ue.tokenUsage?`$${ue.tokenUsage.totalCost.toFixed(3)}`:"$0.000",mono:!0})]})}),r.jsxs("div",{className:"dashboard-settings",children:[r.jsx("div",{className:"card",children:r.jsx(wd,{compact:!0,getLocal:C,getServer:j,setLocal:p,saveConfig:d,cancelLocal:m,modelOptions:h,pendingProvider:k,pendingMeta:L,pendingApiKey:b,setPendingApiKey:v,pendingValidating:S,pendingError:T,setPendingError:U,handleProviderChange:O,handleProviderConfirm:W,handleProviderCancel:$})}),r.jsx("div",{className:"card",children:r.jsx(kd,{getLocal:C,getServer:j,setLocal:p,saveConfig:d,cancelLocal:m})}),ue.platform==="linux"&&r.jsx("div",{className:"card",style:{gridColumn:"1 / -1"},children:r.jsx(mm,{getLocal:C,saveConfig:d})})]}),r.jsxs("div",{className:"card dashboard-logs",children:[r.jsxs("div",{className:"dashboard-logs-header",children:[r.jsxs("div",{className:"section-title",style:{marginBottom:0},children:[r.jsx("span",{className:`status-dot ${A?"connected":"disconnected"}`}),"Live Logs"]}),r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>Kn.clear(),children:"Clear"})]}),r.jsxs("div",{className:"dashboard-logs-scroll",children:[D.length===0?r.jsx("div",{className:"empty",children:"Waiting for logs..."}):D.map((oe,ie)=>r.jsxs("div",{className:"log-entry",children:[r.jsx("span",{className:`badge ${oe.level==="warn"?"warn":oe.level==="error"?"error":"info"}`,children:oe.level.toUpperCase()})," ",r.jsx("span",{style:{color:"var(--text-tertiary)"},children:new Date(oe.timestamp).toLocaleTimeString()})," ",oe.message]},ie)),r.jsx("div",{ref:H})]})]})]})}function Cd({tool:s,updating:a,onToggle:c,onScope:u}){return r.jsxs("div",{className:"tool-row",style:{opacity:s.enabled?1:.5,display:"grid",gridTemplateColumns:"1fr auto auto",gap:"10px",alignItems:"center"},children:[r.jsxs("div",{style:{minWidth:0},children:[r.jsx("div",{className:"tool-name",children:s.name}),r.jsx("div",{className:"tool-desc",children:s.description})]}),r.jsx("div",{className:`scope-seg${!s.enabled||a===s.name?" disabled":""}`,children:["always","dm-only","group-only","admin-only"].map(x=>r.jsx("button",{className:s.scope===x?"active":"",disabled:!s.enabled||a===s.name,onClick:()=>u(s.name,x),children:x==="always"?"All":x==="dm-only"?"DM":x==="group-only"?"Group":"Admin"},x))}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:s.enabled,onChange:()=>c(s.name,s.enabled),disabled:a===s.name}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]})}function vm(){const[s,a]=g.useState([]),[c,u]=g.useState(!0),[x,y]=g.useState(null),[C,j]=g.useState(null),[p,m]=g.useState(null),[d,h]=g.useState(""),k=()=>(u(!0),ae.getTools().then(K=>{a(K.data),u(!1)}).catch(K=>{y(K instanceof Error?K.message:String(K)),u(!1)}));g.useEffect(()=>{k()},[]);const L=async(K,Z)=>{j(K);try{await ae.updateToolConfig(K,{enabled:!Z}),await k()}catch(ne){y(ne instanceof Error?ne.message:String(ne))}finally{j(null)}},b=async(K,Z)=>{j(K);try{await ae.updateToolConfig(K,{scope:Z}),await k()}catch(ne){y(ne instanceof Error?ne.message:String(ne))}finally{j(null)}},v=async(K,Z)=>{j(K.name);try{for(const ne of K.tools)ne.enabled!==Z&&await ae.updateToolConfig(ne.name,{enabled:Z});await k()}catch(ne){y(ne instanceof Error?ne.message:String(ne))}finally{j(null)}},S=async(K,Z)=>{j(K.name);try{for(const ne of K.tools)ne.scope!==Z&&await ae.updateToolConfig(ne.name,{scope:Z});await k()}catch(ne){y(ne instanceof Error?ne.message:String(ne))}finally{j(null)}};if(c)return r.jsx("div",{className:"loading",children:"Loading..."});const T=s.filter(K=>!K.isPlugin),U=T.reduce((K,Z)=>K+Z.toolCount,0),O=T.reduce((K,Z)=>K+Z.tools.filter(ne=>ne.enabled).length,0),W=d.trim().toLowerCase(),$=W?T.filter(K=>K.name.toLowerCase().includes(W)||K.tools.some(Z=>Z.name.toLowerCase().includes(W)||Z.description.toLowerCase().includes(W))):T;return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Tools"}),r.jsxs("p",{children:[U," built-in tools across ",T.length," modules"]})]}),x&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("span",{children:x}),r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>y(null),children:"Dismiss"}),r.jsx("button",{className:"btn-sm",onClick:()=>{y(null),k()},children:"Retry"})]})]}),r.jsxs("div",{className:"card",style:{padding:"10px 14px",marginBottom:"14px",display:"flex",gap:"16px",alignItems:"center",flexWrap:"wrap",overflow:"visible",position:"relative",zIndex:2},children:[r.jsxs("span",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--green)",fontWeight:600},children:O})," enabled"]}),r.jsxs("span",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--text)",fontWeight:600},children:U-O})," disabled"]}),r.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"8px"},children:[r.jsxs("div",{style:{position:"relative"},children:[r.jsx("input",{type:"text",placeholder:"Search tools...",value:d,onChange:K=>h(K.target.value),onKeyDown:K=>{K.key==="Escape"&&h("")},style:{padding:"4px 24px 4px 12px",fontSize:"13px",border:"1px solid var(--separator)",borderRadius:"14px",backgroundColor:"transparent",color:"var(--text)",width:"180px",outline:"none"}}),d&&r.jsx("button",{onClick:()=>h(""),style:{position:"absolute",right:"4px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px",fontSize:"14px",lineHeight:1},children:"✕"})]}),W&&r.jsxs("span",{style:{fontSize:"11px",color:"var(--text-secondary)",whiteSpace:"nowrap"},children:[$.length," of ",T.length," modules"]}),r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px",opacity:.7},onClick:k,children:"Refresh"})]})]}),r.jsx("div",{className:"card",style:{padding:0},children:$.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:W?"No modules match your search":"No modules found"}):r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--separator)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[r.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Module"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Tools"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:70},children:"Enabled"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:200},children:"Controls"})]})}),r.jsx("tbody",{children:$.map(K=>{const Z=p===K.name,ne=K.tools.some(ie=>ie.enabled),D=K.tools.every(ie=>!ie.enabled),A=K.tools.filter(ie=>ie.enabled).length,H=new Set(K.tools.map(ie=>ie.scope)),ue=H.size>1,I=ue?"":H.values().next().value??"always",oe=C===K.name;return r.jsxs(r.Fragment,{children:[r.jsxs("tr",{onClick:()=>m(Z?null:K.name),onKeyDown:ie=>{(ie.key==="Enter"||ie.key===" ")&&(ie.preventDefault(),m(Z?null:K.name))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:Z?"none":"1px solid var(--separator)",backgroundColor:Z?"rgba(255,255,255,0.03)":void 0},className:"file-row",children:[r.jsx("td",{style:{padding:"10px 14px"},children:r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)"},children:Z?"▼":"▶"}),r.jsx("span",{style:{fontWeight:600},children:K.name}),D&&r.jsx("span",{className:"badge warn",children:"Disabled"})]})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsx("span",{className:"badge count",children:K.toolCount})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsxs("span",{style:{fontSize:"12px",color:A===K.toolCount?"var(--green)":A===0?"var(--text-secondary)":"var(--text)"},children:[A,"/",K.toolCount]})}),r.jsx("td",{style:{textAlign:"right",padding:"8px 14px"},onClick:ie=>ie.stopPropagation(),children:r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[r.jsx(kt,{value:I,options:["","always","dm-only","group-only","admin-only"],labels:[ue?"Mixed":"Scope","All","DM only","Group only","Admin only"],onChange:ie=>ie&&S(K,ie),style:{minWidth:"100px"}}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:ne,onChange:()=>v(K,!ne),disabled:oe}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]})})]},K.name),Z&&r.jsx("tr",{style:{backgroundColor:"rgba(255,255,255,0.03)",borderBottom:"1px solid var(--separator)"},children:r.jsx("td",{colSpan:4,style:{padding:"0 14px 14px 14px"},children:r.jsx("div",{style:{display:"grid",gap:"6px",paddingTop:"6px"},children:K.tools.map(ie=>r.jsx(Cd,{tool:ie,updating:C,onToggle:L,onScope:b},ie.name))})})},`${K.name}-detail`)]})})})]})})]})}function jm(){const[s,a]=g.useState("installed"),[c,u]=g.useState([]),[x,y]=g.useState([]),[C,j]=g.useState(!0),[p,m]=g.useState(null),[d,h]=g.useState(null),[k,L]=g.useState({}),[b,v]=g.useState(!1),S=g.useRef({}),[T,U]=g.useState([]),[O,W]=g.useState(!1),[$,K]=g.useState(null),[Z,ne]=g.useState(""),[D,A]=g.useState(""),[H,ue]=g.useState(null),[I,oe]=g.useState({}),[ie,ve]=g.useState(!1),[re,P]=g.useState(null),[te,B]=g.useState(null),[_,Q]=g.useState(null),[Y,V]=g.useState(null),[le,me]=g.useState(""),je=()=>(j(!0),Promise.all([ae.getPlugins(),ae.getTools(),ae.getPluginPriorities()]).then(([G,F,ee])=>{u(G.data),y(F.data.filter(_e=>_e.isPlugin)),L(ee.data??{}),j(!1)}).catch(G=>{m(G.message),j(!1)})),ke=(G=!1)=>(W(!0),ae.getMarketplace(G).then(F=>{U(F.data),W(!1)}).catch(F=>{m(F.message),W(!1)}));g.useEffect(()=>(je(),ke(),()=>{Object.values(S.current).forEach(clearTimeout)}),[]);const be=async(G,F)=>{h(G);try{await ae.updateToolConfig(G,{enabled:!F}),await je()}catch(ee){m(ee instanceof Error?ee.message:String(ee))}finally{h(null)}},it=async(G,F)=>{h(G);try{await ae.updateToolConfig(G,{scope:F}),await je()}catch(ee){m(ee instanceof Error?ee.message:String(ee))}finally{h(null)}},Yn=async(G,F)=>{h(G.name);try{for(const ee of G.tools)ee.enabled!==F&&await ae.updateToolConfig(ee.name,{enabled:F});await je()}catch(ee){m(ee instanceof Error?ee.message:String(ee))}finally{h(null)}},vl=async(G,F)=>{h(G.name);try{for(const ee of G.tools)ee.scope!==F&&await ae.updateToolConfig(ee.name,{scope:F});await je()}catch(ee){m(ee instanceof Error?ee.message:String(ee))}finally{h(null)}},Pn=g.useCallback((G,F)=>{const ee=Math.max(-1e3,Math.min(1e3,Math.round(F)));L(_e=>({..._e,[G]:ee})),S.current[G]&&clearTimeout(S.current[G]),S.current[G]=setTimeout(async()=>{try{ee===0?await ae.resetPluginPriority(G):await ae.setPluginPriority(G,ee),v(!0)}catch(_e){m(_e instanceof Error?_e.message:String(_e))}},500)},[]),Er=async G=>{const F=T.find(ee=>ee.id===G);K(G);try{if(await ae.installPlugin(G),await Promise.all([ke(),je()]),F!=null&&F.secrets&&Object.keys(F.secrets).length>0){try{const ee=await ae.getPluginSecrets(G),_e=Object.entries(F.secrets).filter(([,Xe])=>Xe.required).map(([Xe])=>Xe);if(_e.every(Xe=>ee.data.configured.includes(Xe))&&_e.length>0)return}catch{}ue({pluginId:G,pluginName:F.name,secrets:F.secrets}),oe({})}}catch(ee){m(ee instanceof Error?ee.message:String(ee))}finally{K(null)}},bn=async G=>{if(confirm(`Uninstall plugin "${G}"? This will remove its files.`)){K(G);try{await ae.uninstallPlugin(G),await Promise.all([ke(),je()])}catch(F){m(F instanceof Error?F.message:String(F))}finally{K(null)}}},Gn=async G=>{K(G);try{await ae.updatePlugin(G),await Promise.all([ke(),je()])}catch(F){m(F instanceof Error?F.message:String(F))}finally{K(null)}},qn=async()=>{const G=T.filter(F=>F.status==="updatable");for(const F of G){K(F.id);try{await ae.updatePlugin(F.id)}catch(ee){m(ee instanceof Error?ee.message:String(ee));break}}K(null),await Promise.all([ke(),je()])},jl=async G=>{if(te===G){B(null),V(null);return}try{const F=await ae.getPluginSecrets(G);Q(F.data),B(G),V(null)}catch(F){m(F instanceof Error?F.message:String(F))}},Nr=async(G,F)=>{if(le.trim())try{await ae.setPluginSecret(G,F,le.trim()),V(null),me("");const ee=await ae.getPluginSecrets(G);Q(ee.data)}catch(ee){m(ee instanceof Error?ee.message:String(ee))}},_n=async(G,F)=>{try{await ae.unsetPluginSecret(G,F);const ee=await ae.getPluginSecrets(G);Q(ee.data)}catch(ee){m(ee instanceof Error?ee.message:String(ee))}},Vt=T.filter(G=>{if(Z){const F=Z.toLowerCase();if(!G.name.toLowerCase().includes(F)&&!G.description.toLowerCase().includes(F))return!1}return!(D&&!G.tags.includes(D))}),Tn=Array.from(new Set(T.flatMap(G=>G.tags))).sort(),Ht=T.filter(G=>G.status==="updatable").length;if(C)return r.jsx("div",{className:"loading",children:"Loading..."});const Pr=c.filter(G=>{if(Z){const F=Z.toLowerCase();if(!G.name.toLowerCase().includes(F)&&!(G.description??"").toLowerCase().includes(F))return!1}if(D){const F=T.find(ee=>ee.name===G.name);if(!F||!F.tags.includes(D))return!1}return!0}),Sl=x.reduce((G,F)=>G+F.toolCount,0),wl=x.reduce((G,F)=>G+F.tools.filter(ee=>ee.enabled).length,0);return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Plugins"}),r.jsx("p",{children:"Manage installed plugins and browse the marketplace"})]}),p&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("span",{children:p}),r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>m(null),children:"Dismiss"}),r.jsx("button",{className:"btn-sm",onClick:()=>{m(null),je()},children:"Retry"})]})]}),b&&r.jsx("div",{className:"alert",style:{marginBottom:"14px",fontSize:"13px",color:"var(--text-secondary)",background:"rgba(110,168,254,0.08)",border:"1px solid rgba(110,168,254,0.2)"},children:"Priority updated — changes take effect on next agent restart"}),r.jsxs("div",{className:"card",style:{padding:"10px 14px",marginBottom:"14px",display:"flex",gap:"16px",alignItems:"center",flexWrap:"wrap",overflow:"visible",position:"relative",zIndex:2},children:[r.jsxs("div",{className:"tabs",style:{marginBottom:0,flexShrink:0},children:[r.jsxs("button",{className:`tab ${s==="installed"?"active":""}`,onClick:()=>a("installed"),children:["Installed",r.jsx("span",{className:"tab-count",children:c.length})]}),r.jsxs("button",{className:`tab ${s==="marketplace"?"active":""}`,onClick:()=>a("marketplace"),children:["Marketplace",Ht>0&&r.jsx("span",{className:"tab-count",style:{background:"rgba(255,255,255,0.08)",color:"var(--text-secondary)"},children:Ht})]})]}),s==="installed"&&c.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("span",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--green)",fontWeight:600},children:wl})," enabled"]}),r.jsxs("span",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--text)",fontWeight:600},children:Sl})," tools"]})]}),r.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"8px"},children:[r.jsxs("div",{style:{position:"relative"},children:[r.jsx("input",{type:"text",placeholder:"Search plugins...",value:Z,onChange:G=>ne(G.target.value),onKeyDown:G=>{G.key==="Escape"&&ne("")},style:{padding:"4px 24px 4px 12px",fontSize:"13px",border:"1px solid var(--separator)",borderRadius:"14px",backgroundColor:"transparent",color:"var(--text)",width:"180px",outline:"none"}}),Z&&r.jsx("button",{onClick:()=>ne(""),style:{position:"absolute",right:"4px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px",fontSize:"14px",lineHeight:1},children:"✕"})]}),Tn.length>0&&r.jsx(kt,{value:D,options:["",...Tn],labels:["All tags",...Tn],onChange:G=>A(G),style:{minWidth:"120px"}}),s==="installed"&&Ht>0&&r.jsx("button",{className:"btn-sm",onClick:qn,disabled:!!$||O,style:{whiteSpace:"nowrap"},children:$?"Updating...":`Update All (${Ht})`}),s==="marketplace"&&r.jsxs(r.Fragment,{children:[Ht>0?r.jsx("button",{className:"btn-sm",onClick:qn,disabled:!!$||O,style:{whiteSpace:"nowrap"},children:$?"Updating...":`Update All (${Ht})`}):T.length>0?r.jsx("span",{style:{fontSize:"12px",color:"var(--text-tertiary)",whiteSpace:"nowrap"},children:"All up to date"}):null,r.jsx("button",{className:"btn-ghost",onClick:()=>ke(!0),disabled:O,style:{whiteSpace:"nowrap"},children:O?"Refreshing...":"Refresh"})]})]})]}),s==="installed"&&r.jsx("div",{className:"card",style:{padding:0},children:c.length===0?r.jsxs("div",{style:{padding:"40px 20px",textAlign:"center"},children:[r.jsx("p",{style:{color:"var(--text-secondary)",marginBottom:"12px"},children:"No plugins installed yet"}),r.jsx("button",{className:"btn-sm",onClick:()=>a("marketplace"),children:"Browse Marketplace"})]}):Pr.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:"No installed plugins match your search"}):r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--separator)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[r.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Plugin"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Tools"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Version"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:90},title:"Hook execution order: lower values run first",children:"Priority"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:200},children:"Controls"})]})}),r.jsx("tbody",{children:Pr.map(G=>{const F=x.find(Se=>Se.name===G.name),ee=T.find(Se=>Se.name===G.name),_e=(ee==null?void 0:ee.secrets)&&Object.keys(ee.secrets).length>0,at=re===G.name,Xe=F?F.tools.some(Se=>Se.enabled):!1,Ze=F?F.tools.every(Se=>!Se.enabled):!0,br=F?new Set(F.tools.map(Se=>Se.scope)):new Set,kl=br.size>1,_r=kl?"":br.values().next().value??"always",Tr=d===G.name,Jn=(ee==null?void 0:ee.status)==="updatable";return r.jsxs(ze.Fragment,{children:[r.jsxs("tr",{onClick:()=>P(at?null:G.name),onKeyDown:Se=>{(Se.key==="Enter"||Se.key===" ")&&(Se.preventDefault(),P(at?null:G.name))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:at?"none":"1px solid var(--separator)",backgroundColor:at?"rgba(255,255,255,0.03)":void 0},className:"file-row",children:[r.jsxs("td",{style:{padding:"10px 14px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)"},children:at?"▼":"▶"}),r.jsx("span",{style:{fontWeight:600},children:G.name}),Ze&&F&&F.tools.length>0&&r.jsx("span",{className:"badge warn",children:"Disabled"})]}),G.description&&r.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginTop:"2px",paddingLeft:"22px"},children:G.description})]}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:F?r.jsx("span",{className:"badge count",children:F.toolCount}):r.jsx("span",{style:{color:"var(--text-tertiary)"},children:"—"})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},onClick:Se=>Se.stopPropagation(),children:Jn&&ee?r.jsx("button",{className:"btn-sm",onClick:()=>Gn(ee.id),disabled:!!$,style:{fontSize:"11px",padding:"3px 8px"},children:$===ee.id?"...":`v${ee.remoteVersion}`}):r.jsxs("span",{style:{color:"var(--text-secondary)",fontSize:"12px"},children:["v",G.version]})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},onClick:Se=>Se.stopPropagation(),children:(()=>{const Se=k[G.name]??0,Ot=Se<0?"var(--red)":Se>0?"var(--blue, #6ea8fe)":"var(--text-secondary)";return r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"4px"},children:[r.jsx("input",{type:"number",value:Se,onChange:yt=>Pn(G.name,Number(yt.target.value)),min:-1e3,max:1e3,step:10,title:"Hook execution order: lower values run first",style:{width:"56px",padding:"2px 4px",fontSize:"12px",textAlign:"center",border:"1px solid var(--separator)",borderRadius:"4px",backgroundColor:"transparent",color:Ot,fontWeight:Se!==0?600:400}}),Se!==0&&r.jsx("button",{onClick:()=>Pn(G.name,0),title:"Reset to default",style:{background:"none",border:"none",cursor:"pointer",padding:"0 2px",color:"var(--text-tertiary)",fontSize:"12px",lineHeight:1},children:"✕"})]})})()}),r.jsx("td",{style:{textAlign:"right",padding:"8px 14px",whiteSpace:"nowrap"},onClick:Se=>Se.stopPropagation(),children:r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[F&&F.tools.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(kt,{value:_r,options:["","always","dm-only","group-only","admin-only"],labels:[kl?"Mixed":"Scope","All","DM only","Group only","Admin only"],onChange:Se=>Se&&vl(F,Se),style:{minWidth:"100px"}}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:Xe,onChange:()=>Yn(F,!Xe),disabled:Tr}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),r.jsx("button",{onClick:()=>bn((ee==null?void 0:ee.id)??G.name),title:"Uninstall",disabled:!!$,style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--red)",opacity:.35,transition:"opacity 0.15s",display:"flex",alignItems:"center"},onMouseEnter:Se=>{Se.currentTarget.style.opacity="0.9"},onMouseLeave:Se=>{Se.currentTarget.style.opacity="0.35"},children:r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("polyline",{points:"3 6 5 6 21 6"}),r.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),r.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),r.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})})]})})]}),at&&r.jsx("tr",{style:{backgroundColor:"rgba(255,255,255,0.03)",borderBottom:"1px solid var(--separator)"},children:r.jsxs("td",{colSpan:5,style:{padding:"0 14px 14px 14px"},children:[F&&F.tools.length>0&&r.jsx("div",{style:{display:"grid",gap:"6px",paddingTop:"6px"},children:F.tools.map(Se=>r.jsx(Cd,{tool:Se,updating:d,onToggle:be,onScope:it},Se.name))}),r.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"10px",paddingTop:"10px",borderTop:"1px solid var(--separator)"},children:[_e&&ee&&r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>jl(ee.id),children:te===ee.id?"Hide Secrets":"Manage Secrets"}),Jn&&ee&&r.jsx("button",{className:"btn-sm",onClick:()=>Gn(ee.id),disabled:!!$,children:$===ee.id?"Updating...":`Update to v${ee.remoteVersion}`}),ee&&r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>bn(ee.id),disabled:!!$,style:{marginLeft:"auto"},children:"Uninstall"})]}),_e&&ee&&te===ee.id&&_&&r.jsx("div",{style:{marginTop:"8px",display:"grid",gap:"6px"},children:Object.entries(_.declared).map(([Se,Ot])=>{const yt=_.configured.includes(Se);return r.jsxs("div",{className:"tool-row",style:{padding:"8px 12px",flexWrap:"wrap"},children:[r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsx("span",{style:{fontWeight:600,fontSize:"13px"},children:Se}),Ot.required&&r.jsx("span",{style:{color:"var(--text-secondary)",marginLeft:"4px",fontSize:"11px"},children:"required"}),r.jsx("span",{className:`badge ${yt?"always":"warn"}`,style:{marginLeft:"8px",fontSize:"10px"},children:yt?"Set":"Not set"}),r.jsx("p",{style:{fontSize:"12px",color:"var(--text-tertiary)",margin:"2px 0 0 0"},children:Ot.description}),Ot.env&&r.jsxs("code",{style:{fontSize:"11px",color:"var(--text-tertiary)",opacity:.7},children:["Env: ",Ot.env]})]}),r.jsx("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:Y===Se?r.jsxs(r.Fragment,{children:[r.jsx("input",{type:"password",value:le,onChange:nn=>me(nn.target.value),placeholder:"Enter value...",style:{width:"200px"}}),r.jsx("button",{className:"btn-sm",onClick:()=>Nr(ee.id,Se),children:"Save"}),r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>V(null),children:"Cancel"})]}):r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>{V(Se),me("")},children:yt?"Change":"Set"}),yt&&r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>_n(ee.id,Se),children:"Remove"})]})})]},Se)})})]})})]},G.name)})})]})}),H&&r.jsx("div",{className:"modal-overlay",onClick:()=>!ie&&ue(null),children:r.jsxs("div",{className:"modal",onClick:G=>G.stopPropagation(),children:[r.jsxs("h2",{style:{marginBottom:"4px"},children:["Configure ",H.pluginName]}),r.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"16px"},children:"This plugin needs API keys to work. You can configure them now or later."}),Object.entries(H.secrets).map(([G,F])=>r.jsxs("div",{style:{marginBottom:"12px"},children:[r.jsxs("label",{style:{display:"block",fontSize:"13px",fontWeight:600,marginBottom:"4px"},children:[G," ",F.required&&r.jsx("span",{style:{color:"var(--text-secondary)"},children:"*"})]}),r.jsx("p",{style:{fontSize:"12px",color:"var(--text-tertiary)",margin:"0 0 4px 0"},children:F.description}),F.env&&r.jsxs("code",{style:{display:"block",fontSize:"11px",color:"var(--text-tertiary)",opacity:.7,marginBottom:"6px"},children:["Env: ",F.env]}),r.jsx("input",{type:"password",placeholder:`Enter ${G}...`,value:I[G]||"",onChange:ee=>oe(_e=>({..._e,[G]:ee.target.value})),style:{width:"100%"}})]},G)),r.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"16px"},children:[r.jsx("button",{className:"btn-ghost",onClick:()=>ue(null),children:"Skip"}),r.jsx("button",{className:"btn-sm",disabled:ie,onClick:async()=>{ve(!0);try{for(const[G,F]of Object.entries(I))F.trim()&&await ae.setPluginSecret(H.pluginId,G,F.trim());ue(null)}catch(G){m(G instanceof Error?G.message:String(G))}finally{ve(!1)}},children:ie?"Saving...":"Save"})]})]})}),s==="marketplace"&&r.jsx("div",{className:"card",style:{padding:0},children:O&&T.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading marketplace..."}):Vt.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:Z||D?"No plugins match your search":"Marketplace is empty"}):(()=>{const G=[...Vt].sort((F,ee)=>{const _e={updatable:0,installed:1,available:2};return _e[F.status]-_e[ee.status]});return r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--separator)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[r.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Plugin"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Tools"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Version"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:140}})]})}),r.jsx("tbody",{children:G.map(F=>{const ee=$===F.id,_e=!!$,at=F.secrets&&Object.values(F.secrets).some(Ze=>Ze.required),Xe=re===`market-${F.id}`;return r.jsxs(ze.Fragment,{children:[r.jsxs("tr",{onClick:()=>P(Xe?null:`market-${F.id}`),onKeyDown:Ze=>{(Ze.key==="Enter"||Ze.key===" ")&&(Ze.preventDefault(),P(Xe?null:`market-${F.id}`))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:Xe?"none":"1px solid var(--separator)",backgroundColor:Xe?"rgba(255,255,255,0.03)":void 0},className:"file-row",children:[r.jsx("td",{style:{padding:"10px 14px"},children:r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)"},children:Xe?"▼":"▶"}),r.jsx("span",{style:{fontWeight:600},children:F.name}),at&&F.status==="available"&&r.jsx("span",{className:"badge warn",children:"API Key"})]})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsx("span",{className:"badge count",children:F.toolCount})}),r.jsxs("td",{style:{textAlign:"center",padding:"8px 10px",color:"var(--text-secondary)",fontSize:"12px"},children:["v",F.remoteVersion]}),r.jsxs("td",{style:{textAlign:"right",padding:"8px 14px",whiteSpace:"nowrap"},onClick:Ze=>Ze.stopPropagation(),children:[F.status==="available"&&r.jsx("button",{className:"btn-sm",onClick:()=>Er(F.id),disabled:_e,children:ee?"Installing...":"Install"}),F.status==="installed"&&r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>bn(F.id),disabled:_e,children:ee?"Removing...":"Uninstall"}),F.status==="updatable"&&r.jsxs("div",{style:{display:"flex",gap:"6px",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn-sm",onClick:()=>Gn(F.id),disabled:_e,children:ee?"Updating...":"Update"}),r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>bn(F.id),disabled:_e,children:"Uninstall"})]})]})]}),Xe&&r.jsx("tr",{style:{backgroundColor:"rgba(255,255,255,0.03)",borderBottom:"1px solid var(--separator)"},children:r.jsx("td",{colSpan:5,style:{padding:"0 14px 14px 14px"},children:r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"80px 1fr",gap:"4px 12px",fontSize:"12px",padding:"8px 0"},children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Author"}),r.jsx("span",{children:F.author}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Description"}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:F.description}),F.tags.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Tags"}),r.jsx("div",{style:{display:"flex",gap:"4px",flexWrap:"wrap"},children:F.tags.map(Ze=>r.jsx("span",{style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",background:"var(--surface)",color:"var(--text-tertiary)"},children:Ze},Ze))})]}),F.tools&&F.tools.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Tools"}),r.jsx("span",{style:{color:"var(--text-tertiary)"},children:F.tools.map(Ze=>Ze.name).join(", ")})]})]})})})]},F.id)})})]})})()})]})}const Ju=["SOUL.md","SECURITY.md","STRATEGY.md","MEMORY.md"];function Sm(){const[s,a]=g.useState(Ju[0]),[c,u]=g.useState(""),[x,y]=g.useState(""),[C,j]=g.useState(!1),[p,m]=g.useState(!1),[d,h]=g.useState(null),k=c!==x,L=g.useCallback(async S=>{j(!0),h(null);try{const T=await ae.getSoulFile(S);u(T.data.content),y(T.data.content)}catch(T){h({type:"error",text:T instanceof Error?T.message:String(T)})}finally{j(!1)}},[]),b=async()=>{m(!0),h(null);try{const S=await ae.updateSoulFile(s,c);y(c),h({type:"success",text:S.data.message})}catch(S){h({type:"error",text:S instanceof Error?S.message:String(S)})}finally{m(!1)}};g.useEffect(()=>{const S=T=>{k&&T.preventDefault()};return window.addEventListener("beforeunload",S),()=>window.removeEventListener("beforeunload",S)},[k]);const v=S=>{S!==s&&(k&&!window.confirm("You have unsaved changes. Discard them?")||a(S))};return g.useEffect(()=>{L(s)},[s,L]),r.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"calc(100vh - 64px)",overflow:"hidden"},children:[r.jsxs("div",{className:"header",style:{marginBottom:"16px"},children:[r.jsx("h1",{children:"Soul Editor"}),r.jsx("p",{children:"Edit system prompt files"})]}),d&&r.jsx("div",{className:`alert ${d.type}`,style:{marginBottom:"8px"},children:d.text}),r.jsxs("div",{className:"card",style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",padding:"12px"},children:[r.jsx("div",{className:"tabs",style:{marginBottom:"8px"},children:Ju.map(S=>r.jsxs("button",{className:`tab ${s===S?"active":""}`,onClick:()=>v(S),children:[S,s===S&&k?" *":""]},S))}),C?r.jsx("div",{className:"loading",children:"Loading..."}):r.jsxs(r.Fragment,{children:[r.jsx("textarea",{value:c,onChange:S=>u(S.target.value),placeholder:`Edit ${s}...`,style:{flex:1,minHeight:"200px"}}),r.jsxs("div",{style:{marginTop:"8px",display:"flex",alignItems:"center",gap:"10px"},children:[r.jsx("button",{onClick:b,disabled:p||!k,children:p?"Saving...":"Save"}),k&&r.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"13px"},children:"Unsaved changes"})]})]})]})]})}function Xu(s){return new Date(s*1e3).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function wm(){const[s,a]=g.useState(""),[c,u]=g.useState([]),[x,y]=g.useState(!0),[C,j]=g.useState(null),[p,m]=g.useState(null),[d,h]=g.useState([]),[k,L]=g.useState(!1),b=g.useCallback(async()=>{y(!0),j(null);try{const U=await ae.getMemorySources();u(U.data??[])}catch(U){j(U instanceof Error?U.message:String(U))}finally{y(!1)}},[]);g.useEffect(()=>{b()},[b]);const v=async U=>{if(p===U){m(null),h([]);return}m(U),L(!0);try{const O=await ae.getSourceChunks(U);h(O.data??[])}catch(O){j(O instanceof Error?O.message:String(O))}finally{L(!1)}},S=s.toLowerCase(),T=S?c.filter(U=>U.source.toLowerCase().includes(S)):c;return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Memory"}),r.jsx("p",{children:"Browse indexed knowledge sources"})]}),r.jsxs("div",{className:"card",style:{padding:0},children:[r.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center",padding:"12px 14px",borderBottom:"1px solid var(--separator)"},children:[r.jsx("input",{type:"text",value:s,onChange:U=>a(U.target.value),placeholder:"Filter sources...",style:{flex:1,padding:"6px 10px",fontSize:"13px"}}),r.jsx("button",{onClick:b,disabled:x,style:{padding:"4px 12px",fontSize:"12px",opacity:.7},children:x?"Loading...":"Refresh"})]}),C&&r.jsxs("div",{className:"alert error",style:{margin:"12px 14px"},children:[C,r.jsx("button",{onClick:()=>j(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),x?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):T.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)",fontSize:"13px"},children:s?"No matching sources":"No memory files indexed"}):r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--separator)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[r.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Source"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"80px"},children:"Chunks"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"140px"},children:"Last Updated"})]})}),r.jsx("tbody",{children:T.map(U=>{const O=p===U.source;return r.jsxs(ze.Fragment,{children:[r.jsxs("tr",{onClick:()=>v(U.source),onKeyDown:W=>{(W.key==="Enter"||W.key===" ")&&(W.preventDefault(),v(U.source))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:O?"none":"1px solid var(--separator)",backgroundColor:O?"rgba(255,255,255,0.03)":void 0},className:"file-row",children:[r.jsxs("td",{style:{padding:"6px 14px"},children:[r.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)",marginRight:"8px"},children:O?"▼":"▶"}),U.source]}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:U.entryCount}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:Xu(U.lastUpdated)})]}),O&&r.jsx("tr",{style:{backgroundColor:"rgba(255,255,255,0.03)",borderBottom:"1px solid var(--separator)"},children:r.jsx("td",{colSpan:3,style:{padding:"0 14px 14px 14px"},children:k?r.jsx("div",{style:{padding:"12px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"12px"},children:"Loading chunks..."}):d.length===0?r.jsx("div",{style:{padding:"12px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"12px"},children:"No chunks"}):r.jsx("div",{style:{display:"flex",flexDirection:"column",gap:"8px",paddingTop:"8px"},children:d.map(W=>r.jsxs("div",{style:{padding:"10px 12px",border:"1px solid var(--separator)",borderRadius:"4px",backgroundColor:"var(--surface)"},children:[r.jsxs("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginBottom:"6px"},children:[W.startLine!=null&&W.endLine!=null&&r.jsxs("span",{children:["Lines ",W.startLine,"–",W.endLine," · "]}),Xu(W.updatedAt)]}),r.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontSize:"12px",fontFamily:"monospace",lineHeight:"1.5",maxHeight:"300px",minHeight:"60px",overflow:"auto",resize:"vertical",color:"var(--text)"},children:W.text})]},W.id))})})})]},U.source)})})]})]})]})}function Zu(s){return s===0?"—":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function km(s){return new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const Cm=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico"]),Em=new Set(["zip","tar","gz","bin","exe","dll","so","db","sqlite","wasm","pdf"]);function Ed(s){var a,c;return((c=(a=s.split("/").pop())==null?void 0:a.split(".").pop())==null?void 0:c.toLowerCase())??""}function Nm(s){return Cm.has(Ed(s))}function Pm(s){return Em.has(Ed(s))}function bm(){const[s,a]=g.useState(""),[c,u]=g.useState([]),[x,y]=g.useState(null),[C,j]=g.useState(!0),[p,m]=g.useState(null),[d,h]=g.useState(null),[k,L]=g.useState(""),[b,v]=g.useState(!1),[S,T]=g.useState(!1),[U,O]=g.useState("text"),[W,$]=g.useState(null),[K,Z]=g.useState(""),ne=g.useCallback(async P=>{var te;j(!0),m(null);try{const B=await ae.workspaceList(P);u(((te=B.data)==null?void 0:te.entries)??[]),a(P)}catch(B){m(B instanceof Error?B.message:String(B))}finally{j(!1)}},[]),D=g.useCallback(async()=>{try{const P=await ae.workspaceInfo();y(P.data??null)}catch{}},[]);g.useEffect(()=>{ne(""),D()},[ne,D]),g.useEffect(()=>{if(!b)return;const P=te=>{te.preventDefault()};return window.addEventListener("beforeunload",P),()=>window.removeEventListener("beforeunload",P)},[b]);const A=P=>{I()&&ne(P)},H=s?s.split("/"):[],ue=async P=>{var te;try{if(m(null),Nm(P))h(P),O("image"),L(""),v(!1);else if(Pm(P))h(P),O("binary"),L(""),v(!1);else{const B=await ae.workspaceRead(P);h(P),O("text"),L(((te=B.data)==null?void 0:te.content)??""),v(!1)}}catch(B){m(B instanceof Error?B.message:String(B))}},I=()=>U==="text"&&b&&!confirm("You have unsaved changes. Discard?")?!1:(h(null),L(""),v(!1),O("text"),!0),oe=P=>{if(d===P)I();else{if(!I())return;ue(P)}},ie=async()=>{if(d){T(!0);try{await ae.workspaceWrite(d,k),v(!1),ne(s)}catch(P){m(P instanceof Error?P.message:String(P))}finally{T(!1)}}},ve=async P=>{const te=P.isDirectory?"directory":"file";if(confirm(`Delete ${te} "${P.name}"?`))try{await ae.workspaceDelete(P.path,P.isDirectory),d===P.path&&(h(null),L(""),v(!1)),ne(s),D()}catch(B){m(B instanceof Error?B.message:String(B))}},re=async()=>{const P=K.trim();if(!P||!W)return;const te=s?`${s}/${P}`:P;try{if(W.type==="newFile")await ae.workspaceWrite(te,"");else if(W.type==="newFolder")await ae.workspaceMkdir(te);else if(W.type==="rename"&&W.target){const B=s?`${s}/${P}`:P;await ae.workspaceRename(W.target,B),d===W.target&&(h(null),L(""),v(!1))}$(null),Z(""),ne(s),D()}catch(B){m(B instanceof Error?B.message:String(B))}};return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Workspace"}),r.jsxs("p",{children:["Browse and manage agent workspace files",x&&r.jsxs("span",{style:{marginLeft:"12px",fontSize:"12px",color:"var(--text-secondary)"},children:[x.totalFiles," files · ",Zu(x.totalSize)]})]})]}),p&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[p,r.jsx("button",{onClick:()=>m(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),r.jsxs("div",{className:"card",style:{padding:"8px 14px",marginBottom:"14px",display:"flex",alignItems:"center",gap:"4px",flexWrap:"wrap"},children:[r.jsx("span",{onClick:()=>A(""),style:{cursor:"pointer",fontWeight:s?"normal":"bold",color:"var(--accent)"},children:"workspace"}),H.map((P,te)=>{const B=H.slice(0,te+1).join("/"),_=te===H.length-1;return r.jsxs("span",{children:[r.jsx("span",{style:{color:"var(--text-secondary)",margin:"0 2px"},children:"/"}),r.jsx("span",{onClick:()=>!_&&A(B),style:{cursor:_?"default":"pointer",fontWeight:_?"bold":"normal",color:_?"var(--text)":"var(--accent)"},children:P})]},B)}),r.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:"6px"},children:[r.jsx("button",{style:{padding:"3px 10px",fontSize:"12px"},onClick:()=>{$({type:"newFile"}),Z("")},children:"+ File"}),r.jsx("button",{style:{padding:"3px 10px",fontSize:"12px"},onClick:()=>{$({type:"newFolder"}),Z("")},children:"+ Folder"})]})]}),W&&r.jsxs("div",{className:"card",style:{padding:"10px 14px",marginBottom:"14px",display:"flex",gap:"8px",alignItems:"center"},children:[r.jsx("span",{style:{fontSize:"13px",whiteSpace:"nowrap"},children:W.type==="newFile"?"New file:":W.type==="newFolder"?"New folder:":"Rename to:"}),r.jsx("input",{type:"text",value:K,onChange:P=>Z(P.target.value),onKeyDown:P=>P.key==="Enter"&&re(),placeholder:"name...",autoFocus:!0,style:{flex:1,padding:"4px 8px",fontSize:"13px"}}),r.jsx("button",{style:{padding:"4px 10px",fontSize:"12px"},onClick:re,children:"OK"}),r.jsx("button",{style:{padding:"4px 10px",fontSize:"12px",opacity:.7},onClick:()=>$(null),children:"Cancel"})]}),r.jsx("div",{className:"card",style:{padding:0},children:C?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):c.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:"Empty directory"}):r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--separator)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[r.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Name"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"80px"},children:"Size"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"140px"},children:"Modified"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:"70px"}})]})}),r.jsxs("tbody",{children:[s&&r.jsxs("tr",{onClick:()=>{const P=s.split("/");P.pop(),A(P.join("/"))},onKeyDown:P=>{if(P.key==="Enter"||P.key===" "){P.preventDefault();const te=s.split("/");te.pop(),A(te.join("/"))}},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:"1px solid var(--separator)"},className:"file-row",children:[r.jsxs("td",{style:{padding:"6px 14px"},children:[r.jsx("span",{style:{marginRight:"8px"},children:"📂"}),".."]}),r.jsx("td",{}),r.jsx("td",{}),r.jsx("td",{})]}),c.map(P=>{const te=!P.isDirectory&&d===P.path;return r.jsxs(ze.Fragment,{children:[r.jsxs("tr",{onClick:()=>P.isDirectory?A(P.path):oe(P.path),onKeyDown:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),P.isDirectory?A(P.path):oe(P.path))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:te?"none":"1px solid var(--separator)",backgroundColor:te?"rgba(255,255,255,0.03)":void 0},className:"file-row",children:[r.jsxs("td",{style:{padding:"6px 14px"},children:[P.isDirectory?r.jsx("span",{style:{marginRight:"8px"},children:"📂"}):r.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)",marginRight:"8px"},children:te?"▼":"▶"}),P.name]}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:P.isDirectory?"":Zu(P.size)}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:km(P.mtime)}),r.jsxs("td",{style:{textAlign:"right",padding:"6px 14px",whiteSpace:"nowrap"},onClick:B=>B.stopPropagation(),children:[r.jsx("button",{className:"icon-button",onClick:()=>{$({type:"rename",target:P.path}),Z(P.name)},title:"Rename",children:"✎"}),r.jsx("button",{className:"icon-button",onClick:()=>ve(P),title:"Delete",children:"🗑"})]})]}),te&&r.jsx("tr",{style:{backgroundColor:"rgba(255,255,255,0.03)",borderBottom:"1px solid var(--separator)"},children:r.jsxs("td",{colSpan:4,style:{padding:"0 14px 14px 14px"},children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"10px 0"},children:[r.jsxs("span",{style:{fontSize:"13px",fontWeight:600},children:[d,U==="text"&&b&&r.jsx("span",{style:{color:"var(--accent)",marginLeft:"6px"},children:"*"})]}),r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[U==="text"&&r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px"},onClick:ie,disabled:S||!b,children:S?"Saving...":"Save"}),r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px",opacity:.7},onClick:()=>I(),children:"Close"})]})]}),U==="text"&&r.jsx("textarea",{value:k,onChange:B=>{L(B.target.value),v(!0)},onKeyDown:B=>{(B.ctrlKey||B.metaKey)&&B.key==="s"&&(B.preventDefault(),ie())},style:{width:"100%",minHeight:"300px",maxHeight:"500px",fontFamily:"monospace",fontSize:"13px",padding:"10px",border:"1px solid var(--separator)",borderRadius:"4px",backgroundColor:"var(--surface)",color:"var(--text)",resize:"vertical",tabSize:2},spellCheck:!1}),U==="image"&&d&&r.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"20px 0"},children:r.jsx("img",{src:ae.workspaceRawUrl(d),alt:d,style:{maxWidth:"100%",maxHeight:"60vh",objectFit:"contain",borderRadius:"8px"},onError:B=>{B.target.alt="Failed to load image"}})}),U==="binary"&&r.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"13px"},children:"Binary file — preview not available"})]})})]},P.path)})]})]})})]})}const Ls={pending:"#f0ad4e",in_progress:"#5bc0de",done:"#5cb85c",failed:"#d9534f",cancelled:"#777"},Sr={pending:"Pending",in_progress:"Running",done:"Done",failed:"Failed",cancelled:"Cancelled"};function ed({status:s}){return r.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,color:"#fff",backgroundColor:Ls[s]},children:Sr[s]})}function jr(s){return s?new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function _m({priority:s}){if(s===0)return r.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"11px"},children:"—"});const a=Math.min(s,10);return r.jsxs("span",{title:`Priority: ${s}/10`,style:{fontSize:"11px",letterSpacing:"1px"},children:["●".repeat(Math.min(a,5)),"○".repeat(Math.max(0,5-a))]})}function bi(s,a){return s?s.length>a?s.slice(0,a)+"...":s:""}function Tm(){const[s,a]=g.useState([]),[c,u]=g.useState(!0),[x,y]=g.useState(null),[C,j]=g.useState(""),[p,m]=g.useState(""),[d,h]=g.useState(null),[k,L]=g.useState(!1),[b,v]=g.useState(null),S=g.useRef(null),T=g.useCallback(async()=>{u(!0),y(null);try{const H=(await ae.tasksList()).data??[];a(H),h(ue=>ue?H.find(I=>I.id===ue.id)??null:null)}catch(A){y(A instanceof Error?A.message:String(A))}finally{u(!1)}},[]);g.useEffect(()=>{T()},[T]),g.useEffect(()=>{function A(H){S.current&&!S.current.contains(H.target)&&L(!1)}if(k)return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[k]);const U=async A=>{v(null),L(!1);try{await ae.tasksClean(A),y(null),T(),h(null)}catch(H){y(H instanceof Error?H.message:String(H))}},O=async A=>{if(confirm("Cancel this task?"))try{await ae.tasksCancel(A),T(),(d==null?void 0:d.id)===A&&h(null)}catch(H){y(H instanceof Error?H.message:String(H))}},W=async A=>{if(confirm("Permanently delete this task?"))try{await ae.tasksDelete(A),T(),(d==null?void 0:d.id)===A&&h(null)}catch(H){y(H instanceof Error?H.message:String(H))}},$=s.reduce((A,H)=>(A[H.status]=(A[H.status]||0)+1,A),{}),K=($.done||0)+($.failed||0)+($.cancelled||0),Z=C?s.filter(A=>A.status===C):s,ne=p.trim().toLowerCase(),D=ne?Z.filter(A=>A.description.toLowerCase().includes(ne)||(A.reason??"").toLowerCase().includes(ne)||A.id.toLowerCase().includes(ne)):Z;return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Tasks"}),r.jsx("p",{children:"Scheduled and queued agent tasks"})]}),x&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[x,r.jsx("button",{onClick:()=>y(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),r.jsxs("div",{className:"card",style:{padding:"10px 14px",marginBottom:"14px",display:"flex",gap:"16px",alignItems:"center",flexWrap:"wrap",overflow:"visible",position:"relative",zIndex:2},children:[r.jsxs("span",{onClick:()=>j(""),style:{cursor:"pointer",fontWeight:C===""?"bold":"normal",color:C===""?"var(--text)":"var(--text-secondary)",fontSize:"13px"},children:["All (",s.length,")"]}),["pending","in_progress","done","failed","cancelled"].map(A=>r.jsxs("span",{onClick:()=>j(C===A?"":A),style:{cursor:"pointer",fontWeight:C===A?"bold":"normal",color:C===A?Ls[A]:"var(--text-secondary)",fontSize:"13px"},children:[Sr[A]," (",$[A]||0,")"]},A)),r.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:"8px"},children:[r.jsxs("div",{style:{position:"relative"},children:[r.jsx("input",{type:"text",placeholder:"Search tasks...",value:p,onChange:A=>m(A.target.value),onKeyDown:A=>{A.key==="Escape"&&m("")},style:{padding:"4px 24px 4px 12px",fontSize:"13px",border:"1px solid var(--separator)",borderRadius:"14px",backgroundColor:"transparent",color:"var(--text)",width:"180px",outline:"none"}}),p&&r.jsx("button",{onClick:()=>m(""),style:{position:"absolute",right:"4px",top:"50%",transform:"translateY(-50%)",background:"none",border:"none",color:"var(--text-secondary)",cursor:"pointer",padding:"0 2px",fontSize:"14px",lineHeight:1},children:"✕"})]}),ne&&r.jsxs("span",{style:{fontSize:"11px",color:"var(--text-secondary)",whiteSpace:"nowrap"},children:[D.length," of ",Z.length," tasks"]})]}),K>0&&r.jsxs("div",{ref:S,style:{position:"relative"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>L(!k),children:"Clean"}),k&&r.jsx("div",{className:"custom-select-menu",style:{position:"absolute",top:"100%",right:0,marginTop:"4px",zIndex:10,minWidth:"170px",width:"auto"},children:["done","failed","cancelled"].filter(A=>($[A]||0)>0).map(A=>r.jsxs("div",{className:"custom-select-option",onClick:()=>{L(!1),v(A)},style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:Ls[A],flexShrink:0}}),Sr[A]," (",$[A],")"]},A))})]}),r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px",opacity:.7},onClick:T,children:"Refresh"})]}),b&&r.jsx("div",{className:"modal-overlay",onClick:()=>v(null),children:r.jsxs("div",{className:"modal",style:{maxWidth:"380px"},onClick:A=>A.stopPropagation(),children:[r.jsxs("h2",{style:{marginBottom:"4px"},children:["Clean ",Sr[b].toLowerCase()," tasks"]}),r.jsxs("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"16px"},children:["Permanently delete all ",$[b]||0," ",r.jsx("span",{style:{color:Ls[b],fontWeight:600},children:Sr[b].toLowerCase()})," ","tasks? This cannot be undone."]}),r.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[r.jsx("button",{className:"btn-ghost",onClick:()=>v(null),children:"Cancel"}),r.jsxs("button",{className:"btn-danger btn-sm",onClick:()=>U(b),children:["Delete ",$[b]||0," tasks"]})]})]})}),r.jsx("div",{className:"card",style:{padding:0},children:c?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):D.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:ne?"No tasks match your search":C?`No ${Sr[C].toLowerCase()} tasks`:"No tasks yet"}):r.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:"13px",tableLayout:"fixed"},children:[r.jsx("thead",{children:r.jsxs("tr",{style:{borderBottom:"1px solid var(--separator)",color:"var(--text-secondary)",fontSize:"11px",textTransform:"uppercase"},children:[r.jsx("th",{style:{textAlign:"left",padding:"8px 14px"},children:"Description"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:80},children:"Status"}),r.jsx("th",{style:{textAlign:"center",padding:"8px 10px",width:60},children:"Priority"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:120},children:"Scheduled"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:120},children:"Created"}),r.jsx("th",{style:{textAlign:"right",padding:"8px 14px",width:70}})]})}),r.jsx("tbody",{children:D.map(A=>{const H=(d==null?void 0:d.id)===A.id;return r.jsxs(ze.Fragment,{children:[r.jsxs("tr",{onClick:()=>h(H?null:A),onKeyDown:ue=>{(ue.key==="Enter"||ue.key===" ")&&(ue.preventDefault(),h(H?null:A))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:H?"none":"1px solid var(--separator)",backgroundColor:H?"rgba(255,255,255,0.03)":void 0},className:"file-row",children:[r.jsxs("td",{style:{padding:"8px 14px"},children:[r.jsxs("div",{children:[r.jsx("span",{style:{display:"inline-block",width:"14px",fontSize:"10px",color:"var(--text-secondary)"},children:H?"▼":"▶"}),bi(A.description,80)]}),A.reason&&r.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginTop:"2px",paddingLeft:"14px"},children:bi(A.reason,60)})]}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsx(ed,{status:A.status})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsx(_m,{priority:A.priority})}),r.jsx("td",{style:{textAlign:"right",padding:"8px 14px",color:"var(--text-secondary)"},children:jr(A.scheduledFor)}),r.jsx("td",{style:{textAlign:"right",padding:"8px 14px",color:"var(--text-secondary)"},children:jr(A.createdAt)}),r.jsxs("td",{style:{textAlign:"right",padding:"8px 14px",whiteSpace:"nowrap"},onClick:ue=>ue.stopPropagation(),children:[(A.status==="pending"||A.status==="in_progress")&&r.jsx("button",{className:"icon-button",onClick:()=>O(A.id),title:"Cancel",children:"✖"}),r.jsx("button",{className:"icon-button",onClick:()=>W(A.id),title:"Delete",children:"🗑"})]})]}),H&&d&&r.jsx("tr",{style:{backgroundColor:"rgba(255,255,255,0.03)",borderBottom:"1px solid var(--separator)"},children:r.jsxs("td",{colSpan:6,style:{padding:"0 14px 14px 14px",overflow:"hidden"},children:[r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"120px 1fr",gap:"6px 12px",fontSize:"13px",padding:"10px 0"},children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"ID"}),r.jsx("code",{style:{fontSize:"11px",wordBreak:"break-all"},children:d.id}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Status"}),r.jsx("span",{children:r.jsx(ed,{status:d.status})}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Priority"}),r.jsxs("span",{children:[d.priority,"/10"]}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Description"}),r.jsx("span",{children:d.description}),d.reason&&r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Reason"}),r.jsx("span",{children:d.reason})]}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Created by"}),r.jsx("span",{children:d.createdBy||"—"}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Created"}),r.jsx("span",{children:jr(d.createdAt)}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Scheduled for"}),r.jsx("span",{children:jr(d.scheduledFor)}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Started"}),r.jsx("span",{children:jr(d.startedAt)}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Completed"}),r.jsx("span",{children:jr(d.completedAt)}),d.dependencies.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Depends on"}),r.jsxs("span",{style:{fontSize:"11px"},children:[d.dependencies.length," task(s)"]})]}),d.dependents.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Dependents"}),r.jsxs("span",{style:{fontSize:"11px"},children:[d.dependents.length," task(s)"]})]})]}),d.payload&&r.jsxs("div",{style:{marginTop:"4px"},children:[r.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Payload"}),r.jsx("pre",{style:{padding:"8px",borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.2)",fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:(()=>{try{return JSON.stringify(JSON.parse(d.payload),null,2)}catch{return d.payload}})()})]}),d.result&&r.jsxs("div",{style:{marginTop:"12px"},children:[r.jsx("div",{style:{fontSize:"12px",color:"#5cb85c",marginBottom:"4px"},children:"Result"}),r.jsx("pre",{style:{padding:"8px",borderRadius:"4px",backgroundColor:"rgba(0,0,0,0.2)",fontSize:"11px",overflow:"auto",maxHeight:"200px",margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:bi(d.result,2e3)})]}),d.error&&r.jsxs("div",{style:{marginTop:"12px"},children:[r.jsx("div",{style:{fontSize:"12px",color:"#d9534f",marginBottom:"4px"},children:"Error"}),r.jsx("pre",{style:{padding:"8px",borderRadius:"4px",backgroundColor:"rgba(100,0,0,0.15)",fontSize:"11px",overflow:"auto",maxHeight:"150px",margin:0,color:"#f99"},children:d.error})]})]})})]},A.id)})})]})})]})}function Rm(){const[s,a]=g.useState([]),[c,u]=g.useState(!0),[x,y]=g.useState(null),[C,j]=g.useState(new Set),[p,m]=g.useState(!1),[d,h]=g.useState(""),[k,L]=g.useState(""),[b,v]=g.useState(""),[S,T]=g.useState([]),[U,O]=g.useState(!1),[W,$]=g.useState(null),[K,Z]=g.useState(null),ne=(I=!1)=>{I&&u(!0),ae.getMcpServers().then(oe=>{a(oe.data),u(!1)}).catch(oe=>{y(oe instanceof Error?oe.message:String(oe)),u(!1)})};g.useEffect(()=>{ne(!0)},[]);const D=I=>{j(oe=>{const ie=new Set(oe);return ie.has(I)?ie.delete(I):ie.add(I),ie})},A=async()=>{if(d.trim()){O(!0),y(null);try{const I=k.trim()?k.trim().split(/\s+/):void 0,oe=d.startsWith("http://")||d.startsWith("https://"),ie={};for(const re of S)re.key.trim()&&(ie[re.key.trim()]=re.value);const ve=await ae.addMcpServer({...oe?{url:d.trim()}:{package:d.trim()},name:b.trim()||void 0,args:oe?void 0:I,env:Object.keys(ie).length>0?ie:void 0});Z(ve.data.message),h(""),L(""),v(""),T([]),m(!1),ne()}catch(I){y(I instanceof Error?I.message:String(I))}finally{O(!1)}}},H=async I=>{if(confirm(`Remove MCP server "${I}"?`)){$(I),y(null);try{const oe=await ae.removeMcpServer(I);Z(oe.data.message),ne()}catch(oe){y(oe instanceof Error?oe.message:String(oe))}finally{$(null)}}};if(c)return r.jsx("div",{className:"loading",children:"Loading..."});const ue=s.filter(I=>I.connected).length;return r.jsxs("div",{children:[r.jsx("div",{className:"header",children:r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r.jsxs("div",{children:[r.jsx("h1",{children:"MCP Servers"}),r.jsx("p",{children:"External tool servers connected via Model Context Protocol"})]}),r.jsx("button",{onClick:()=>m(!p),style:{fontSize:"13px"},children:p?"Cancel":"+ Add Server"})]})}),x&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[x,r.jsx("button",{onClick:()=>y(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),K&&r.jsxs("div",{className:"alert success",style:{marginBottom:"14px"},children:[K,r.jsx("button",{onClick:()=>Z(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),p&&r.jsxs("div",{className:"card",style:{marginBottom:"14px"},children:[r.jsx("h2",{style:{margin:"0 0 10px"},children:"Add MCP Server"}),r.jsxs("div",{style:{display:"grid",gap:"8px"},children:[r.jsxs("div",{children:[r.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Package or URL *"}),r.jsx("input",{type:"text",value:d,onChange:I=>h(I.target.value),placeholder:"@modelcontextprotocol/server-filesystem or http://localhost:3001/mcp",style:{width:"100%",fontSize:"13px"}})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"8px"},children:[r.jsxs("div",{children:[r.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Arguments (space-separated)"}),r.jsx("input",{type:"text",value:k,onChange:I=>L(I.target.value),placeholder:"/tmp /home/user/docs",style:{width:"100%",fontSize:"13px"}})]}),r.jsxs("div",{children:[r.jsx("label",{style:{display:"block",fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Name (auto-derived if empty)"}),r.jsx("input",{type:"text",value:b,onChange:I=>v(I.target.value),placeholder:"filesystem",style:{width:"100%",fontSize:"13px"}})]})]}),r.jsxs("div",{children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:[r.jsx("label",{style:{fontSize:"12px",color:"var(--text-secondary)"},children:"Environment Variables"}),r.jsx("button",{type:"button",onClick:()=>T([...S,{key:"",value:"",id:crypto.randomUUID()}]),style:{fontSize:"11px",padding:"1px 6px",opacity:.7},children:"+ Add"})]}),S.map((I,oe)=>r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr auto",gap:"6px",marginBottom:"4px"},children:[r.jsx("input",{type:"text",value:I.key,onChange:ie=>{const ve=[...S];ve[oe]={...ve[oe],key:ie.target.value},T(ve)},placeholder:"BRAVE_API_KEY",style:{fontSize:"12px",fontFamily:"monospace"}}),r.jsx("input",{type:"password",value:I.value,onChange:ie=>{const ve=[...S];ve[oe]={...ve[oe],value:ie.target.value},T(ve)},placeholder:"sk-xxx...",style:{fontSize:"12px",fontFamily:"monospace"}}),r.jsx("button",{type:"button",onClick:()=>T(S.filter((ie,ve)=>ve!==oe)),style:{fontSize:"11px",padding:"2px 6px",opacity:.6},children:"×"})]},I.id))]}),r.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px",marginTop:"4px"},children:[r.jsx("button",{onClick:()=>m(!1),style:{fontSize:"13px",opacity:.7},children:"Cancel"}),r.jsx("button",{onClick:A,disabled:U||!d.trim(),style:{fontSize:"13px"},children:U?"Adding...":"Add Server"})]})]}),r.jsx("p",{style:{fontSize:"11px",color:"var(--text-secondary)",margin:"8px 0 0"},children:"Changes are saved to config.yaml. Restart teleton to connect."})]}),s.length===0&&!p&&r.jsxs("div",{className:"empty",children:[r.jsx("p",{children:"No MCP servers configured"}),r.jsxs("p",{style:{fontSize:"13px",color:"var(--text-secondary)",marginTop:"8px"},children:['Click "+ Add Server" above or use CLI: ',r.jsx("code",{children:"teleton mcp add @modelcontextprotocol/server-filesystem /tmp"})]})]}),s.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{fontSize:"13px",color:"var(--text-secondary)",marginBottom:"14px"},children:[ue,"/",s.length," connected · ",s.reduce((I,oe)=>I+oe.toolCount,0)," tools total"]}),s.map(I=>r.jsxs("div",{className:"card",style:{marginBottom:"10px"},children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"6px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx("h2",{style:{margin:0},children:I.name}),r.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)"},children:I.type}),I.scope!=="always"&&r.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)"},children:I.scope})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",fontSize:"12px",color:I.connected?"var(--green)":"var(--red)"},children:[r.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:I.connected?"var(--green)":"var(--red)"}}),I.connected?"Connected":"Disconnected"]}),!I.enabled&&r.jsx("span",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:"disabled"}),r.jsx("button",{onClick:()=>H(I.name),disabled:W===I.name,style:{fontSize:"11px",padding:"2px 8px",opacity:.6,cursor:W===I.name?"wait":"pointer"},children:W===I.name?"...":"Remove"})]})]}),r.jsx("div",{style:{fontSize:"12px",fontFamily:"monospace",color:"var(--text-secondary)",marginBottom:"8px"},children:I.target}),I.envKeys.length>0&&r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:I.envKeys.map(oe=>r.jsxs("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)",fontFamily:"monospace"},children:[oe,"=••••"]},oe))}),I.toolCount>0&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>D(I.name),style:{background:"none",border:"none",padding:0,fontSize:"12px",color:"var(--accent)",cursor:"pointer"},children:[C.has(I.name)?"▾":"▸"," ",I.toolCount," tools"]}),C.has(I.name)&&r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"8px"},children:I.tools.map(oe=>r.jsx("span",{style:{fontSize:"11px",padding:"2px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)"},children:oe},oe))})]})]},I.name))]})]})}function Lm({tabs:s,activeTab:a,onTabChange:c}){return r.jsx("div",{className:"pill-bar",children:s.map(u=>r.jsx("button",{className:u.id===a?"active":void 0,onClick:()=>c(u.id),children:u.label},u.id))})}function _i({keys:s,configKeys:a,getLocal:c,getServer:u,setLocal:x,saveConfig:y,cancelLocal:C,onArraySave:j,title:p}){const m=s.map(d=>a.find(h=>h.key===d)).filter(d=>d!=null);return m.length===0?null:r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[p&&r.jsx("div",{className:"section-title",children:p}),m.map(d=>{const h=d.hotReload==="restart";if(d.type==="boolean"){const b=c(d.key)==="true";return r.jsx("div",{className:"form-group",children:r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[r.jsxs("label",{className:"toggle",style:{margin:0},children:[r.jsx("input",{type:"checkbox",checked:b,onChange:v=>y(d.key,String(v.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]}),r.jsx("span",{children:d.label}),d.description&&r.jsx(Qe,{text:d.description}),h&&r.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)"},children:"(requires restart)"})]})},d.key)}if(d.type==="enum"&&d.options)return r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[d.label,d.description&&r.jsx(Qe,{text:d.description}),h&&r.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)"},children:"(requires restart)"})]})}),r.jsx("select",{value:c(d.key),onChange:b=>y(d.key,b.target.value),style:{padding:"6px 10px",fontSize:14,border:"1px solid var(--separator)",borderRadius:4,background:"var(--surface)",color:"var(--text)"},children:d.options.map(b=>{var v;return r.jsx("option",{value:b,children:((v=d.optionLabels)==null?void 0:v[b])??b},b)})})]},d.key);if(d.type==="array"){const b=c(d.key);let v=[];if(b)try{v=JSON.parse(b).map(String)}catch{v=[]}return r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[d.label,d.description&&r.jsx(Qe,{text:d.description}),h&&r.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)"},children:"(requires restart)"})]})}),r.jsx(ml,{value:v,onChange:S=>{j&&j(d.key,S)},placeholder:`Add ${d.label.toLowerCase()}`})]},d.key)}const k=d.type==="number"?"number":d.sensitive?"password":"text",L=d.sensitive?d.set?"Set":"Not set":void 0;return r.jsx(ot,{label:d.label,description:d.description,configKey:d.key,type:k,value:c(d.key),serverValue:u(d.key),onChange:b=>x(d.key,b),onSave:b=>y(d.key,b),onCancel:()=>C(d.key),hotReload:d.hotReload,badge:L,placeholder:d.sensitive?"********":void 0},d.key)})]})}const Im=[{id:"llm",label:"LLM"},{id:"telegram",label:"Telegram"},{id:"api-keys",label:"API Keys"},{id:"ton-proxy",label:"TON Proxy"},{id:"advanced",label:"Advanced"},{id:"sessions",label:"Sessions"},{id:"tool-rag",label:"Tool RAG"}],zm=["agent.api_key","telegram.bot_token","tavily_api_key","tonapi_key","toncenter_api_key"],Am=["embedding.provider","embedding.model","webui.port","webui.log_requests","deals.enabled","deals.expiry_seconds","deals.buy_max_floor_percent","deals.sell_min_floor_percent","agent.base_url","dev.hot_reload"],Mm=["agent.session_reset_policy.daily_reset_enabled","agent.session_reset_policy.daily_reset_hour","agent.session_reset_policy.idle_expiry_enabled","agent.session_reset_policy.idle_expiry_minutes"];function Om(){const[s,a]=Jh(),c=s.get("tab")||"llm",u=Sd(),[x,y]=g.useState([]),[C,j]=g.useState(!1),[p,m]=g.useState(null),[d,h]=g.useState(null),k=v=>{a({tab:v},{replace:!0})};g.useEffect(()=>{ae.getConfigKeys().then(v=>y(v.data)).catch(()=>{})},[]),g.useEffect(()=>{c==="ton-proxy"&&ae.getTonProxyStatus().then(v=>m(v.data)).catch(()=>{})},[c]);const L=()=>{ae.getConfigKeys().then(v=>y(v.data)).catch(()=>{})},b=async(v,S)=>{u.setError(null);try{await ae.setConfigKey(v,S),u.showSuccess(`${v} updated successfully`),L()}catch(T){u.setError(T instanceof Error?T.message:String(T))}};return u.loading?r.jsx("div",{className:"loading",children:"Loading..."}):r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Configuration"}),r.jsx("p",{children:"Manage settings and API keys"})]}),u.error&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[u.error,r.jsx("button",{onClick:()=>u.setError(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),u.saveSuccess&&r.jsx("div",{className:"alert success",style:{marginBottom:"16px"},children:u.saveSuccess}),r.jsx(Lm,{tabs:Im,activeTab:c,onTabChange:k}),c==="llm"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"card-header",children:r.jsx("div",{className:"section-title",children:"Agent"})}),r.jsx("div",{className:"card",children:r.jsx(wd,{getLocal:u.getLocal,getServer:u.getServer,setLocal:u.setLocal,saveConfig:u.saveConfig,cancelLocal:u.cancelLocal,modelOptions:u.modelOptions,pendingProvider:u.pendingProvider,pendingMeta:u.pendingMeta,pendingApiKey:u.pendingApiKey,setPendingApiKey:u.setPendingApiKey,pendingValidating:u.pendingValidating,pendingError:u.pendingError,setPendingError:u.setPendingError,handleProviderChange:u.handleProviderChange,handleProviderConfirm:u.handleProviderConfirm,handleProviderCancel:u.handleProviderCancel})}),u.getLocal("agent.provider")==="cocoon"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"card-header",children:r.jsx("div",{className:"section-title",children:"Cocoon"})}),r.jsx("div",{className:"card",children:r.jsx(ot,{label:"Proxy Port",description:"Cocoon Network proxy port",configKey:"cocoon.port",type:"number",value:u.getLocal("cocoon.port"),serverValue:u.getServer("cocoon.port"),onChange:v=>u.setLocal("cocoon.port",v),onSave:v=>u.saveConfig("cocoon.port",v),onCancel:()=>u.cancelLocal("cocoon.port"),min:1,max:65535,placeholder:"11434",hotReload:"restart"})})]})]}),c==="telegram"&&r.jsx(kd,{getLocal:u.getLocal,getServer:u.getServer,setLocal:u.setLocal,saveConfig:u.saveConfig,cancelLocal:u.cancelLocal,configKeys:x,onArraySave:b,extended:!0}),c==="api-keys"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"card-header",children:r.jsx("div",{className:"section-title",children:"API Keys"})}),r.jsx("div",{className:"card",children:r.jsx(_i,{keys:zm,configKeys:x,getLocal:u.getLocal,getServer:u.getServer,setLocal:u.setLocal,saveConfig:u.saveConfig,cancelLocal:u.cancelLocal})})]}),c==="ton-proxy"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"card-header",children:[r.jsx("div",{className:"section-title",children:"TON Proxy"}),r.jsx("p",{className:"card-description",children:"Tonutils-Proxy gateway for accessing .ton websites. The binary is auto-downloaded from GitHub on first enable."})]}),r.jsxs("div",{className:"card",children:[d&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[d,r.jsx("button",{onClick:()=>h(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[r.jsxs("label",{className:"toggle",style:{margin:0},children:[r.jsx("input",{type:"checkbox",disabled:C,checked:(p==null?void 0:p.enabled)??u.getLocal("ton_proxy.enabled")==="true",onChange:async v=>{const S=v.target.checked;j(!0),h(null);try{const T=S?await ae.startTonProxy():await ae.stopTonProxy();m(T.data),u.showSuccess(S?"TON Proxy started":"TON Proxy stopped"),L()}catch(T){h(T instanceof Error?T.message:String(T))}finally{j(!1)}}}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]}),r.jsx("span",{children:"Enabled"}),C&&r.jsxs("span",{style:{fontSize:"12px",color:"var(--text-secondary)",display:"inline-flex",alignItems:"center",gap:4},children:[r.jsx("span",{className:"spinner",style:{display:"inline-block",width:14,height:14,border:"2px solid var(--separator)",borderTopColor:"var(--accent)",borderRadius:"50%",animation:"spin 0.8s linear infinite"}}),(p==null?void 0:p.installed)===!1?"Downloading binary...":"Starting..."]}),!C&&(p==null?void 0:p.running)&&r.jsxs("span",{style:{fontSize:"12px",color:"var(--green, #22c55e)"},children:["Running (PID ",p.pid,")"]}),r.jsx(Qe,{text:"Enable TON Proxy — auto-downloads the binary if not found"})]}),!(p!=null&&p.enabled)&&r.jsx("button",{disabled:C||!(p!=null&&p.installed),onClick:async()=>{if(confirm("Remove the TON Proxy binary from disk?")){j(!0),h(null);try{const v=await ae.uninstallTonProxy();m(v.data),u.showSuccess("TON Proxy uninstalled"),L()}catch(v){h(v instanceof Error?v.message:String(v))}finally{j(!1)}}},style:{padding:"5px 12px",fontSize:12,fontWeight:500,background:p!=null&&p.installed?"var(--red, #ef4444)":"var(--text-secondary)",color:"#fff",border:"none",borderRadius:6,cursor:p!=null&&p.installed?"pointer":"default",opacity:p!=null&&p.installed?1:.5},children:"Uninstall"})]}),r.jsx(ot,{label:"Proxy Port",description:"HTTP proxy listen address port",configKey:"ton_proxy.port",type:"number",value:u.getLocal("ton_proxy.port")||"8080",serverValue:u.getServer("ton_proxy.port")||"8080",onChange:v=>u.setLocal("ton_proxy.port",v),onSave:v=>u.saveConfig("ton_proxy.port",v),onCancel:()=>u.cancelLocal("ton_proxy.port"),min:1,max:65535,placeholder:"8080",hotReload:"restart"}),r.jsx(ot,{label:"Binary Path",description:"Custom path to tonutils-proxy-cli binary",configKey:"ton_proxy.binary_path",type:"text",value:u.getLocal("ton_proxy.binary_path"),serverValue:u.getServer("ton_proxy.binary_path"),onChange:v=>u.setLocal("ton_proxy.binary_path",v),onSave:v=>u.saveConfig("ton_proxy.binary_path",v),onCancel:()=>u.cancelLocal("ton_proxy.binary_path"),placeholder:"~/.teleton/bin/tonutils-proxy-cli (auto-download)",hotReload:"restart"})]})]})]}),c==="advanced"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"card-header",children:r.jsx("div",{className:"section-title",children:"Advanced"})}),r.jsx("div",{className:"card",children:r.jsx(_i,{keys:Am,configKeys:x,getLocal:u.getLocal,getServer:u.getServer,setLocal:u.setLocal,saveConfig:u.saveConfig,cancelLocal:u.cancelLocal})})]}),c==="sessions"&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"card-header",children:[r.jsx("div",{className:"section-title",children:"Sessions"}),r.jsx("p",{className:"card-description",children:"Session reset and expiry policies"})]}),r.jsx("div",{className:"card",children:r.jsx(_i,{keys:Mm,configKeys:x,getLocal:u.getLocal,getServer:u.getServer,setLocal:u.setLocal,saveConfig:u.saveConfig,cancelLocal:u.cancelLocal})})]}),c==="tool-rag"&&u.toolRag&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"card-header",children:[r.jsx("div",{className:"section-title",children:"Tool RAG"}),r.jsx("p",{className:"card-description",children:"Semantic tool selection — sends only the most relevant tools to the LLM per message."})]}),r.jsxs("div",{className:"card",children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"},children:[r.jsx("span",{style:{fontSize:"13px",fontWeight:500},children:"Enabled"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:u.toolRag.enabled,onChange:()=>u.saveToolRag({enabled:!u.toolRag.enabled})}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsxs("label",{style:{fontSize:"13px",color:"var(--text)"},children:["Top-K ",r.jsx(Qe,{text:"Number of most relevant tools to send per message"})]}),r.jsx(kt,{value:String(u.toolRag.topK),options:["10","15","20","25","30","40","50"],onChange:v=>u.saveToolRag({topK:Number(v)}),style:{minWidth:"80px"}})]}),r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsxs("label",{style:{fontSize:"13px",color:"var(--text)",cursor:"pointer"},htmlFor:"skip-unlimited",children:["Skip Unlimited ",r.jsx(Qe,{text:"Skip RAG filtering for providers with no tool limit"})]}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{id:"skip-unlimited",type:"checkbox",checked:u.toolRag.skipUnlimitedProviders??!1,onChange:()=>u.saveToolRag({skipUnlimitedProviders:!u.toolRag.skipUnlimitedProviders})}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]})]}),r.jsxs("div",{style:{marginTop:"12px"},children:[r.jsxs("label",{style:{fontSize:"13px",color:"var(--text)",display:"block",marginBottom:"6px"},children:["Always Include (glob patterns) ",r.jsx(Qe,{text:"Tool name patterns that are always included regardless of RAG scoring"})]}),r.jsx(ml,{value:u.toolRag.alwaysInclude??[],onChange:v=>u.saveToolRag({alwaysInclude:v}),placeholder:"e.g. telegram_send_*"})]})]})]})]})}function Dm(){const[s,a]=g.useState(!1),[c,u]=g.useState([]),[x,y]=g.useState(""),[C,j]=g.useState(""),[p,m]=g.useState([]),[d,h]=g.useState(""),[k,L]=g.useState(""),[b,v]=g.useState(null),[S,T]=g.useState(""),[U,O]=g.useState(""),[W,$]=g.useState(!0),[K,Z]=g.useState(null),[ne,D]=g.useState(!1),A=g.useRef(null),H=g.useRef({enabled:!1,keywords:[],message:""}),ue=async()=>{$(!0);try{const[Y,V]=await Promise.all([ae.getBlocklist(),ae.getTriggers()]),le=Y.data;a(le.enabled),u(le.keywords),y(le.message),H.current={enabled:le.enabled,keywords:le.keywords,message:le.message},m(V.data)}catch(Y){Z(Y instanceof Error?Y.message:String(Y))}finally{$(!1)}};g.useEffect(()=>(ue(),()=>{A.current&&clearTimeout(A.current)}),[]);const I=g.useCallback(Y=>{H.current=Y,A.current&&clearTimeout(A.current),A.current=setTimeout(async()=>{try{await ae.updateBlocklist(Y)}catch(V){Z(V instanceof Error?V.message:String(V))}},400)},[]),oe=()=>{const Y=!s;a(Y),I({...H.current,enabled:Y})},ie=()=>{const Y=C.trim();if(Y.length<2)return;if(c.includes(Y)){j("");return}const V=[...c,Y];u(V),j(""),I({...H.current,keywords:V})},ve=Y=>{const V=c.filter(le=>le!==Y);u(V),I({...H.current,keywords:V})},re=Y=>{y(Y),I({...H.current,message:Y})},P=async()=>{const Y=d.trim(),V=k.trim();if(!(Y.length<2||V.length<1)){D(!0);try{const le=await ae.createTrigger({keyword:Y,context:V});m(me=>[...me,le.data]),h(""),L("")}catch(le){Z(le instanceof Error?le.message:String(le))}finally{D(!1)}}},te=async Y=>{try{await ae.deleteTrigger(Y),m(V=>V.filter(le=>le.id!==Y))}catch(V){Z(V instanceof Error?V.message:String(V))}},B=async(Y,V)=>{try{await ae.toggleTrigger(Y,!V),m(le=>le.map(me=>me.id===Y?{...me,enabled:!V}:me))}catch(le){Z(le instanceof Error?le.message:String(le))}},_=Y=>{v(Y.id),T(Y.keyword),O(Y.context)},Q=async()=>{if(!b)return;const Y=S.trim(),V=U.trim();if(!(Y.length<2||V.length<1)){D(!0);try{const le=await ae.updateTrigger(b,{keyword:Y,context:V});m(me=>me.map(je=>je.id===b?le.data:je)),v(null)}catch(le){Z(le instanceof Error?le.message:String(le))}finally{D(!1)}}};return W?r.jsx("div",{className:"loading",children:"Loading..."}):r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Hooks"}),r.jsx("p",{children:"Keyword blocklist and context injection triggers"})]}),K&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("span",{children:K}),r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>Z(null),children:"Dismiss"})]}),r.jsxs("div",{className:"card",style:{marginBottom:"16px"},children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[r.jsx("h2",{style:{margin:0,fontSize:"16px"},children:"Keyword Blocklist"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:s,onChange:oe}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),r.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"12px"},children:"Messages containing these keywords will be blocked. Word-boundary matching (no substring matches)."}),r.jsxs("div",{style:{marginBottom:"10px"},children:[r.jsx("label",{style:{fontSize:"13px",fontWeight:600,display:"block",marginBottom:"4px"},children:"Keywords"}),r.jsxs("div",{style:{display:"flex",flexWrap:"wrap",gap:"6px",padding:"8px",border:"1px solid var(--separator)",borderRadius:"8px",minHeight:"36px",alignItems:"center"},children:[c.map(Y=>r.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"4px",padding:"2px 8px",borderRadius:"12px",background:"rgba(110,168,254,0.12)",color:"var(--text)",fontSize:"13px"},children:[Y,r.jsx("button",{onClick:()=>ve(Y),style:{background:"none",border:"none",cursor:"pointer",padding:"0 2px",color:"var(--text-secondary)",fontSize:"14px",lineHeight:1},children:"✕"})]},Y)),r.jsx("input",{type:"text",placeholder:"Add keyword...",value:C,onChange:Y=>j(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&(Y.preventDefault(),ie()),Y.key==="Backspace"&&!C&&c.length>0&&ve(c[c.length-1])},style:{border:"none",outline:"none",background:"transparent",color:"var(--text)",fontSize:"13px",flex:1,minWidth:"100px",padding:"2px 0"}})]})]}),r.jsxs("div",{children:[r.jsx("label",{style:{fontSize:"13px",fontWeight:600,display:"block",marginBottom:"4px"},children:"Block reply (optional)"}),r.jsx("input",{type:"text",placeholder:"Message sent when a message is blocked...",value:x,onChange:Y=>re(Y.target.value),maxLength:500,style:{width:"100%"}})]})]}),r.jsxs("div",{className:"card",children:[r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[r.jsx("h2",{style:{margin:0,fontSize:"16px"},children:"Context Triggers"}),r.jsxs("span",{style:{fontSize:"12px",color:"var(--text-secondary)"},children:[p.length,"/50"]})]}),r.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"12px"},children:"When a keyword is detected, the associated context is injected into the LLM prompt."}),p.length>0&&r.jsx("div",{style:{display:"grid",gap:"8px",marginBottom:"14px"},children:p.map(Y=>r.jsx("div",{className:"tool-row",style:{padding:"10px 12px",opacity:Y.enabled?1:.5,transition:"opacity 0.15s"},children:b===Y.id?r.jsxs("div",{style:{width:"100%"},children:[r.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"6px"},children:[r.jsx("input",{type:"text",value:S,onChange:V=>T(V.target.value),placeholder:"Keyword",style:{flex:"0 0 200px"}}),r.jsx("button",{className:"btn-sm",onClick:Q,disabled:ne,children:ne?"Saving...":"Save"}),r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>v(null),children:"Cancel"})]}),r.jsx("textarea",{value:U,onChange:V=>O(V.target.value),placeholder:"Context to inject...",maxLength:2e3,rows:3,style:{width:"100%",resize:"vertical"}})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{style:{flex:1,minWidth:0},children:[r.jsx("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"4px"},children:r.jsxs("span",{style:{fontWeight:600,fontSize:"13px"},children:['"',Y.keyword,'"']})}),r.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",whiteSpace:"pre-wrap",wordBreak:"break-word",maxHeight:"80px",overflow:"hidden"},children:Y.context})]}),r.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center",flexShrink:0},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>_(Y),style:{fontSize:"12px"},children:"Edit"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:Y.enabled,onChange:()=>B(Y.id,Y.enabled)}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]}),r.jsx("button",{onClick:()=>te(Y.id),style:{background:"none",border:"none",cursor:"pointer",padding:"4px",color:"var(--red)",opacity:.5,transition:"opacity 0.15s"},onMouseEnter:V=>{V.currentTarget.style.opacity="0.9"},onMouseLeave:V=>{V.currentTarget.style.opacity="0.5"},children:"✕"})]})]})},Y.id))}),r.jsxs("div",{style:{padding:"12px",border:"1px solid var(--separator)",borderRadius:"8px",background:"rgba(255,255,255,0.02)"},children:[r.jsx("div",{style:{fontSize:"13px",fontWeight:600,marginBottom:"8px",color:"var(--text-secondary)"},children:"New Trigger"}),r.jsx("div",{style:{display:"flex",gap:"8px",marginBottom:"8px"},children:r.jsx("input",{type:"text",placeholder:"Keyword (min 2 chars)",value:d,onChange:Y=>h(Y.target.value),maxLength:100,style:{flex:"0 0 200px"}})}),r.jsx("textarea",{placeholder:"Context to inject when keyword is detected...",value:k,onChange:Y=>L(Y.target.value),maxLength:2e3,rows:3,style:{width:"100%",resize:"vertical",marginBottom:"8px"}}),r.jsx("button",{className:"btn-sm",onClick:P,disabled:ne||d.trim().length<2||k.trim().length<1,children:ne?"Adding...":"Add Trigger"})]})]})]})}function Bm({data:s,onChange:a}){const[c,u]=g.useState(null),[x,y]=g.useState(!0),[C,j]=g.useState(""),[p,m]=g.useState(!1);g.useEffect(()=>{Ye.getStatus().then(h=>u(h)).catch(h=>j(h instanceof Error?h.message:String(h))).finally(()=>y(!1))},[]);const d=async h=>{if(a({...s,riskAccepted:h}),h&&!p)try{await Ye.initWorkspace(s.agentName||void 0),m(!0)}catch(k){j(k instanceof Error?k.message:String(k))}};return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Welcome to Teleton Setup"}),r.jsx("p",{className:"step-description",children:"Configure your autonomous Telegram agent in a few steps."}),r.jsxs("details",{className:"guide-dropdown",children:[r.jsx("summary",{children:"Security Notice"}),r.jsxs("div",{className:"guide-content",children:["This software is an autonomous AI agent that can:",r.jsxs("ul",{style:{margin:"8px 0 8px 20px"},children:[r.jsx("li",{children:"Send and receive Telegram messages on your behalf"}),r.jsx("li",{children:"Execute cryptocurrency transactions using your wallet"}),r.jsx("li",{children:"Access and store conversation data"}),r.jsx("li",{children:"Make decisions and take actions autonomously"})]}),"You are solely responsible for all actions taken by this agent. By proceeding, you acknowledge that you understand these risks and accept full responsibility for the agent's behavior.",r.jsx("br",{}),r.jsx("br",{}),r.jsx("strong",{children:"Never share your API keys, wallet mnemonics, or session files."})]})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Agent Name"}),r.jsx("input",{type:"text",value:s.agentName,onChange:h=>a({...s,agentName:h.target.value}),placeholder:"Nova",className:"w-full"}),r.jsx("div",{className:"helper-text",children:"Your agent's display name in conversations."})]}),(c==null?void 0:c.configExists)&&r.jsx("div",{className:"info-box",children:"Existing configuration detected. It will be overwritten when setup completes."}),C&&r.jsx("div",{className:"alert error",children:C}),r.jsx("div",{className:"form-group",children:r.jsxs("label",{className:"label-inline",children:[r.jsx("input",{type:"checkbox",checked:s.riskAccepted,onChange:h=>d(h.target.checked)}),r.jsx("span",{children:"I understand the risks and accept full responsibility"})]})}),x&&r.jsx("div",{className:"loading",children:"Checking workspace..."})]})}function Fm({data:s,onChange:a}){const[c,u]=g.useState([]),[x,y]=g.useState(!0),[C,j]=g.useState(""),[p,m]=g.useState(null),[d,h]=g.useState(""),[k,L]=g.useState(!1),b=g.useRef(null),[v,S]=g.useState(null),[T,U]=g.useState(!1),[O,W]=g.useState(!1),[$,K]=g.useState([]),[Z,ne]=g.useState(!1);g.useEffect(()=>{Ye.getProviders().then(I=>u(I)).catch(I=>j(I instanceof Error?I.message:String(I))).finally(()=>y(!1))},[]);const D=c.find(I=>I.id===s.provider);g.useEffect(()=>{D!=null&&D.autoDetectsKey&&(U(!0),S(null),W(!1),Ye.detectClaudeCodeKey().then(I=>{S(I),I.found&&a({...s,apiKey:""})}).catch(()=>S({found:!1,maskedKey:null,valid:!1})).finally(()=>U(!1)))},[D==null?void 0:D.id]),g.useEffect(()=>{if(!s.provider||s.provider==="cocoon"||s.provider==="local"){K([]);return}ne(!0),Ye.getModels(s.provider).then(I=>{K(I),!s.model&&I.length>0&&a({...s,model:I[0].value})}).catch(()=>K([])).finally(()=>ne(!1))},[s.provider]);const A=I=>{a({...s,provider:I,apiKey:"",model:"",customModel:""}),m(null),h(""),S(null),W(!1),b.current&&clearTimeout(b.current)},H=async(I,oe)=>{if(!(!oe||!I)){L(!0);try{const ie=await Ye.validateApiKey(I,oe);m(ie.valid),h(ie.error||"")}catch{m(null),h("")}finally{L(!1)}}},ue=I=>{a({...s,apiKey:I}),m(null),h(""),b.current&&clearTimeout(b.current),I.length>0&&s.provider&&(b.current=setTimeout(()=>H(s.provider,I),500))};return x?r.jsx("div",{className:"loading",children:"Loading providers..."}):C?r.jsx("div",{className:"alert error",children:C}):r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Choose Your LLM Provider"}),r.jsx("p",{className:"step-description",children:"This is the AI model that powers your agent's intelligence. Pick the one you have an API key for."}),r.jsx("div",{className:"provider-grid",children:c.map(I=>r.jsxs("div",{className:`provider-card${s.provider===I.id?" selected":""}`,onClick:()=>A(I.id),children:[r.jsx("h3",{children:I.displayName}),r.jsx("div",{className:"provider-meta",children:I.defaultModel}),I.toolLimit===null&&r.jsx("span",{className:"badge always",style:{marginTop:"6px"},children:"Recommended"})]},I.id))}),D&&D.toolLimit!==null&&r.jsxs("div",{className:"info-box",style:{marginTop:"16px"},children:["Teleton has ~116 tools. With a ",D.toolLimit,"-tool limit, some tools may be truncated or unavailable."]}),D&&D.autoDetectsKey&&r.jsxs("div",{style:{marginTop:"16px"},children:[T&&r.jsxs("div",{className:"info-panel",children:[r.jsx("span",{className:"spinner sm"})," Detecting Claude Code credentials..."]}),!T&&(v==null?void 0:v.found)&&r.jsxs("div",{className:"info-panel",children:[r.jsx("div",{style:{marginBottom:"4px",color:"var(--color-success, #4caf50)"},children:r.jsx("strong",{children:"Credentials auto-detected from Claude Code"})}),r.jsx("code",{style:{fontSize:"0.85em",opacity:.8},children:v.maskedKey}),r.jsx("div",{className:"helper-text",style:{marginTop:"6px"},children:"Token will auto-refresh when it expires. No configuration needed."})]}),!T&&v&&!v.found&&!O&&r.jsxs("div",{className:"info-panel",style:{borderColor:"var(--color-warning, #ff9800)"},children:[r.jsxs("div",{style:{marginBottom:"8px"},children:["Claude Code credentials not found. Make sure Claude Code is installed and authenticated (",r.jsx("code",{children:"claude login"}),")."]}),r.jsx("button",{className:"btn btn-sm",onClick:()=>W(!0),children:"Enter API key manually instead"})]}),!T&&O&&r.jsxs("div",{className:"form-group",style:{marginTop:"8px"},children:[r.jsx("label",{children:"API Key (fallback)"}),r.jsx("input",{type:"password",value:s.apiKey,onChange:I=>ue(I.target.value),placeholder:D.keyPrefix?`${D.keyPrefix}...`:"Enter API key",className:"w-full"}),k&&r.jsxs("div",{className:"helper-text",children:[r.jsx("span",{className:"spinner sm"})," Validating..."]}),!k&&p===!0&&r.jsx("div",{className:"helper-text success",children:"Key format looks valid."}),!k&&p===!1&&d&&r.jsx("div",{className:"helper-text error",children:d}),r.jsxs("div",{className:"helper-text",children:["Get your key at:"," ",r.jsx("a",{href:"https://console.anthropic.com/",target:"_blank",rel:"noopener noreferrer",children:"https://console.anthropic.com/"})]})]})]}),D&&D.requiresApiKey&&r.jsxs("div",{className:"form-group",style:{marginTop:"16px"},children:[r.jsx("label",{children:"API Key"}),r.jsx("input",{type:"password",value:s.apiKey,onChange:I=>ue(I.target.value),placeholder:D.keyPrefix?`${D.keyPrefix}...`:"Enter API key",className:"w-full"}),k&&r.jsxs("div",{className:"helper-text",children:[r.jsx("span",{className:"spinner sm"})," Validating..."]}),!k&&p===!0&&r.jsx("div",{className:"helper-text success",children:"Key format looks valid."}),!k&&p===!1&&d&&r.jsx("div",{className:"helper-text error",children:d}),D.consoleUrl&&r.jsxs("div",{className:"helper-text",children:["Get your key at:"," ",r.jsx("a",{href:D.consoleUrl,target:"_blank",rel:"noopener noreferrer",children:D.consoleUrl})]})]}),D&&!D.requiresApiKey&&D.id==="cocoon"&&r.jsxs("div",{style:{marginTop:"16px"},children:[r.jsx("div",{className:"info-panel",children:"Cocoon Network uses a local proxy. No API key required."}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Cocoon Proxy Port"}),r.jsx("input",{type:"number",value:s.cocoonPort,onChange:I=>a({...s,cocoonPort:parseInt(I.target.value)||0}),min:1,max:65535,className:"w-full"}),r.jsx("div",{className:"helper-text",children:"Port where the Cocoon client proxy is running (1-65535)."})]})]}),D&&D.id==="local"&&r.jsxs("div",{style:{marginTop:"16px"},children:[r.jsx("div",{className:"info-panel",children:"Connect to any OpenAI-compatible server (Ollama, vLLM, LM Studio, llama.cpp). No API key required."}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Server URL"}),r.jsx("input",{type:"url",value:s.localUrl,onChange:I=>a({...s,localUrl:I.target.value}),placeholder:"http://localhost:11434/v1",className:"w-full"}),r.jsx("div",{className:"helper-text",children:"Ollama :11434 · vLLM :8000 · LM Studio :1234 · llama.cpp :8080"})]})]}),D&&D.id!=="cocoon"&&D.id!=="local"&&r.jsxs("div",{className:"form-group",style:{marginTop:"16px"},children:[r.jsx("label",{children:"Model"}),Z?r.jsxs("div",{className:"text-muted",children:[r.jsx("span",{className:"spinner sm"})," Loading models..."]}):r.jsx(kt,{value:s.model,options:$.map(I=>I.value),labels:$.map(I=>I.isCustom?"Custom...":`${I.name} - ${I.description}`),onChange:I=>a({...s,model:I}),style:{width:"100%"}}),s.model==="__custom__"&&r.jsx("input",{type:"text",value:s.customModel,onChange:I=>a({...s,customModel:I.target.value}),placeholder:"Enter custom model ID",className:"w-full",style:{marginTop:"8px"}})]})]})}const Um=()=>r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),r.jsx("circle",{cx:"12",cy:"12",r:"3"})]}),Wm=()=>r.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24"}),r.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]});function hl({value:s,onChange:a,placeholder:c,className:u,style:x}){const[y,C]=g.useState(!1);return r.jsxs("div",{className:"password-wrapper",style:x,children:[r.jsx("input",{type:y?"text":"password",value:s,onChange:a,placeholder:c,className:u,style:{flex:1,paddingRight:"32px"}}),s&&r.jsx("button",{type:"button",className:"eye-toggle",onClick:()=>C(!y),"aria-label":y?"Hide":"Show",children:y?r.jsx(Wm,{}):r.jsx(Um,{})})]})}function $m({data:s,onChange:a}){return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Telegram Credentials"}),r.jsx("p",{className:"step-description",children:"These credentials allow your agent to use your Telegram account to send and receive messages."}),r.jsxs("details",{className:"guide-dropdown",children:[r.jsx("summary",{children:"How to get these credentials"}),r.jsxs("div",{className:"guide-content",children:[r.jsxs("div",{className:"guide-section",children:[r.jsx("strong",{children:"API ID & API Hash"}),r.jsxs("ol",{children:[r.jsxs("li",{children:["Open ",r.jsx("a",{href:"https://my.telegram.org",target:"_blank",rel:"noopener noreferrer",children:"my.telegram.org"})," in your browser"]}),r.jsx("li",{children:"Log in with your phone number (the one linked to your Telegram account)"}),r.jsxs("li",{children:["Click ",r.jsx("strong",{children:"API development tools"})]}),r.jsx("li",{children:`If prompted, create a new app — the name and platform don't matter (e.g. "MyApp", Desktop)`}),r.jsxs("li",{children:["Copy ",r.jsx("strong",{children:"App api_id"})," (a number) and ",r.jsx("strong",{children:"App api_hash"})," (a hex string)"]})]})]}),s.authMode==="phone"&&r.jsxs("div",{className:"guide-section",children:[r.jsx("strong",{children:"Phone Number"}),r.jsx("p",{children:"The phone number linked to your Telegram account, with country code (e.g. +33612345678)."})]})]})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"API ID"}),r.jsx("input",{type:"number",value:s.apiId||"",onChange:c=>a({...s,apiId:parseInt(c.target.value)||0}),placeholder:"12345678",className:"w-full"})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"API Hash"}),r.jsx(hl,{value:s.apiHash,onChange:c=>a({...s,apiHash:c.target.value}),placeholder:"abcdef0123456789abcdef0123456789",className:"w-full"}),s.apiHash.length>0&&s.apiHash.length<10&&r.jsx("div",{className:"helper-text",children:"API Hash should be at least 10 characters."})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Login method"}),r.jsxs("div",{style:{display:"flex",gap:"4px",background:"var(--surface)",borderRadius:"8px",padding:"4px"},children:[r.jsx("button",{type:"button",onClick:()=>a({...s,authMode:"qr",phone:""}),style:{flex:1,padding:"8px 16px",border:"none",borderRadius:"6px",cursor:"pointer",background:s.authMode==="qr"?"var(--accent, #6c5ce7)":"transparent",color:s.authMode==="qr"?"#fff":"var(--text-muted, #999)",fontWeight:s.authMode==="qr"?600:400,transition:"all 0.2s"},children:"QR Code"}),r.jsx("button",{type:"button",onClick:()=>a({...s,authMode:"phone"}),style:{flex:1,padding:"8px 16px",border:"none",borderRadius:"6px",cursor:"pointer",background:s.authMode==="phone"?"var(--accent, #6c5ce7)":"transparent",color:s.authMode==="phone"?"#fff":"var(--text-muted, #999)",fontWeight:s.authMode==="phone"?600:400,transition:"all 0.2s"},children:"Phone Number"})]}),r.jsx("div",{className:"text-muted",style:{fontSize:"0.85em",marginTop:"6px"},children:s.authMode==="qr"?"Scan a QR code with your Telegram app to connect instantly.":"Receive a verification code via SMS or Telegram app."})]}),s.authMode==="phone"&&r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Phone Number"}),r.jsx("input",{type:"text",value:s.phone,onChange:c=>a({...s,phone:c.target.value}),placeholder:"+33612345678",className:"w-full"}),s.phone.length>0&&!s.phone.startsWith("+")&&r.jsx("div",{className:"helper-text",children:'Phone number must start with "+"'})]})]})}function Km({data:s,onChange:a}){const[c,u]=g.useState(!1),[x,y]=g.useState(null),[C,j]=g.useState(!1),[p,m]=g.useState(""),d=async()=>{if(s.botToken){u(!0),m(""),y(null),j(!1);try{const v=await Ye.validateBotToken(s.botToken);v.valid&&v.bot?(y(!0),a({...s,botUsername:v.bot.username})):v.networkError?j(!0):(y(!1),m(v.error||"Invalid bot token"))}catch(v){m(v instanceof Error?v.message:String(v))}finally{u(!1)}}},h=["admin-only","allowlist","open","disabled"],k=["Admin Only","Allowlist","Open","Disabled"],L={"admin-only":"Only admins can DM the agent.",allowlist:"Only users in the allowlist (+ admins) can DM the agent.",open:"Anyone can message the agent in DMs.",disabled:"All DMs are ignored."},b={"admin-only":"Only admins can trigger the agent in groups.",allowlist:"Agent only responds in groups explicitly allowed by admins.",open:"Agent responds in any group it's added to.",disabled:"All group messages are ignored."};return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Configuration"}),r.jsx("p",{className:"step-description",children:"Configure your agent's behavior policies. Defaults are pre-filled — adjust what you need."}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Admin User ID"}),r.jsx("input",{type:"number",value:s.userId||"",onChange:v=>a({...s,userId:parseInt(v.target.value)||0}),placeholder:"123456789",className:"w-full"}),r.jsxs("div",{className:"helper-text",children:["This account will have admin control over the agent in DMs and groups. Get your ID from ",r.jsx("a",{href:"https://t.me/userinfobot",target:"_blank",rel:"noopener noreferrer",children:"@userinfobot"})," on Telegram."]})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"DM Policy"}),r.jsx(kt,{value:s.dmPolicy,options:h,labels:k,onChange:v=>a({...s,dmPolicy:v}),style:{width:"100%"}}),r.jsx("div",{className:"helper-text",children:L[s.dmPolicy]||""})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Group Policy"}),r.jsx(kt,{value:s.groupPolicy,options:h,labels:k,onChange:v=>a({...s,groupPolicy:v}),style:{width:"100%"}}),r.jsx("div",{className:"helper-text",children:b[s.groupPolicy]||""})]}),r.jsxs("div",{className:"form-group",children:[r.jsxs("div",{className:"card-toggle",children:[r.jsx("span",{style:{fontSize:"13px",fontWeight:500},children:"Require @mention in groups"}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:s.requireMention,onChange:v=>a({...s,requireMention:v.target.checked})}),r.jsx("div",{className:"toggle-track"}),r.jsx("div",{className:"toggle-thumb"})]})]}),r.jsx("div",{className:"helper-text",children:"When enabled, the agent only responds when mentioned by name in group chats."})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Max Agentic Iterations"}),r.jsx("input",{type:"number",value:s.maxIterations,onChange:v=>a({...s,maxIterations:parseInt(v.target.value)||1}),min:1,max:50,className:"w-full"}),r.jsx("div",{className:"helper-text",children:"Maximum tool-call loops per message (1-50). Higher values allow more complex tasks."})]}),r.jsx("h3",{style:{fontSize:"14px",fontWeight:600,marginTop:"24px",marginBottom:"12px"},children:"Coding Agent"}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"System Execution"}),r.jsx(kt,{value:s.execMode,options:["off","yolo"],labels:{off:"Disabled",yolo:"YOLO Mode"},onChange:v=>a({...s,execMode:v}),style:{width:"100%"}}),r.jsx("div",{className:"helper-text",children:s.execMode==="yolo"?"⚠️ Gives the agent full system access. STRONGLY RECOMMENDED to use a dedicated VPS.":"No system execution capability."})]}),r.jsx("h3",{style:{fontSize:"14px",fontWeight:600,marginTop:"24px",marginBottom:"12px"},children:"Optional API Keys"}),r.jsxs("div",{className:"module-list",children:[r.jsxs("div",{className:"module-item",children:[r.jsxs("div",{style:{marginBottom:"8px"},children:[r.jsx("strong",{style:{fontSize:"var(--font-md)"},children:"Bot Token"}),r.jsx("span",{className:"module-desc",style:{marginLeft:"8px"},children:"(recommended)"})]}),r.jsx("p",{style:{fontSize:"var(--font-sm)",margin:"0 0 8px"},children:"Inline buttons and deals module."}),r.jsxs("div",{className:"form-row",style:{gap:"8px"},children:[r.jsx(hl,{value:s.botToken,onChange:v=>{a({...s,botToken:v.target.value,botUsername:""}),y(null),j(!1),m("")},placeholder:"123456:ABC-DEF...",style:{flex:1}}),r.jsx("button",{onClick:d,disabled:c||!s.botToken,type:"button",children:c?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Validating"]}):"Validate"})]}),x&&s.botUsername&&r.jsxs("div",{className:"alert success",children:["Bot verified: @",s.botUsername]}),C&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"info-box",children:"Could not reach Telegram API. Enter the bot username manually."}),r.jsxs("div",{className:"form-group",style:{marginTop:"8px",marginBottom:0},children:[r.jsx("label",{children:"Bot Username"}),r.jsx("input",{type:"text",value:s.botUsername,onChange:v=>a({...s,botUsername:v.target.value}),placeholder:"my_bot",className:"w-full"})]})]}),x===!1&&p&&r.jsx("div",{className:"alert error",children:p}),r.jsxs("div",{className:"helper-text",children:["Create a bot via ",r.jsx("a",{href:"https://t.me/BotFather",target:"_blank",rel:"noopener noreferrer",children:"@BotFather"})," on Telegram."]})]}),r.jsxs("div",{className:"module-item",children:[r.jsxs("div",{style:{marginBottom:"8px"},children:[r.jsx("strong",{style:{fontSize:"var(--font-md)"},children:"TonAPI Key"}),r.jsx("span",{className:"module-desc",style:{marginLeft:"8px"},children:"(recommended)"})]}),r.jsx("p",{style:{fontSize:"var(--font-sm)",margin:"0 0 8px"},children:"Blockchain data — jettons, NFTs, prices, transaction history. Free key: 5 req/s (vs 1)."}),r.jsx(hl,{value:s.tonapiKey,onChange:v=>a({...s,tonapiKey:v.target.value}),placeholder:"Your TonAPI key",className:"w-full"}),r.jsxs("div",{className:"helper-text",children:["Open ",r.jsx("a",{href:"https://t.me/tonapibot",target:"_blank",rel:"noopener noreferrer",children:"@tonapibot"})," on Telegram → mini app → generate server key."]})]}),r.jsxs("div",{className:"module-item",children:[r.jsxs("div",{style:{marginBottom:"8px"},children:[r.jsx("strong",{style:{fontSize:"var(--font-md)"},children:"TonCenter API Key"}),r.jsx("span",{className:"module-desc",style:{marginLeft:"8px"},children:"(optional)"})]}),r.jsx("p",{style:{fontSize:"var(--font-sm)",margin:"0 0 8px"},children:"Blockchain RPC — send transactions, check balances. Dedicated endpoint (vs ORBS fallback)."}),r.jsx(hl,{value:s.toncenterKey,onChange:v=>a({...s,toncenterKey:v.target.value}),placeholder:"Your TonCenter API key",className:"w-full"}),r.jsxs("div",{className:"helper-text",children:["Get a free key at ",r.jsx("a",{href:"https://toncenter.com",target:"_blank",rel:"noopener noreferrer",children:"toncenter.com"})," (instant, no signup)."]})]}),r.jsxs("div",{className:"module-item",children:[r.jsxs("div",{style:{marginBottom:"8px"},children:[r.jsx("strong",{style:{fontSize:"var(--font-md)"},children:"Web Search"}),r.jsx("span",{className:"module-desc",style:{marginLeft:"8px"},children:"(optional)"})]}),r.jsx("p",{style:{fontSize:"var(--font-sm)",margin:"0 0 8px"},children:"Web search for real-time info. Free tier: 1,000 req/month."}),r.jsx(hl,{value:s.tavilyKey,onChange:v=>a({...s,tavilyKey:v.target.value}),placeholder:"tvly-...",className:"w-full"}),r.jsxs("div",{className:"helper-text",children:["Get a free key at ",r.jsx("a",{href:"https://tavily.com",target:"_blank",rel:"noopener noreferrer",children:"tavily.com"}),"."]})]})]})]})}function td({text:s}){const[a,c]=g.useState(!1),u=g.useCallback(()=>{navigator.clipboard.writeText(s).then(()=>{c(!0),setTimeout(()=>c(!1),2e3)})},[s]);return r.jsx("button",{type:"button",className:"btn-ghost btn-sm",onClick:u,style:{marginLeft:"8px"},children:a?"Copied":"Copy"})}function Vm({data:s,onChange:a}){const[c,u]=g.useState(null),[x,y]=g.useState(!0),[C,j]=g.useState(!1),[p,m]=g.useState(""),[d,h]=g.useState([]);g.useEffect(()=>{Ye.getWalletStatus().then(v=>{u(v),v.exists&&v.address&&a({...s,walletAddress:v.address,walletAction:"keep"})}).catch(v=>m(v instanceof Error?v.message:String(v))).finally(()=>y(!1))},[]);const k=async()=>{j(!0),m("");try{if(s.walletAction==="import"){const v=s.mnemonic.trim().split(/\s+/);if(v.length!==24){m("Mnemonic must be exactly 24 words."),j(!1);return}const S=await Ye.importWallet(s.mnemonic.trim());a({...s,walletAddress:S.address}),h(v)}else{const v=await Ye.generateWallet();a({...s,walletAddress:v.address}),h(v.mnemonic)}}catch(v){m(v instanceof Error?v.message:String(v))}finally{j(!1)}};if(x)return r.jsx("div",{className:"loading",children:"Checking wallet..."});const L=d.length>0,b=s.walletAction!=="keep"&&!L;return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"TON Wallet"}),r.jsx("p",{className:"step-description",children:"Your agent needs a TON wallet to send and receive crypto. You can create a new one or import an existing wallet."}),p&&r.jsx("div",{className:"alert error",children:p}),(c==null?void 0:c.exists)&&c.address&&!L&&r.jsxs("div",{className:"card",children:[r.jsx("div",{className:"helper-text",style:{marginTop:0,marginBottom:"4px"},children:"Current wallet"}),r.jsx("div",{className:"mono",style:{fontSize:"13px",wordBreak:"break-all"},children:c.address})]}),!L&&r.jsx("div",{className:"form-group",children:(c!=null&&c.exists?["keep","generate","import"]:["generate","import"]).map(v=>r.jsxs("label",{className:"label-inline",style:{marginBottom:"8px"},children:[r.jsx("input",{type:"radio",name:"walletAction",value:v,checked:s.walletAction===v,onChange:()=>{a({...s,walletAction:v,mnemonic:"",mnemonicSaved:!1})}}),r.jsxs("span",{children:[v==="keep"&&"Keep existing wallet",v==="generate"&&"Generate new wallet",v==="import"&&"Import from mnemonic"]})]},v))}),s.walletAction==="import"&&!L&&r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Recovery Phrase (24 words)"}),r.jsx("textarea",{value:s.mnemonic,onChange:v=>a({...s,mnemonic:v.target.value}),placeholder:"word1 word2 word3 ... word24",className:"w-full mono",style:{minHeight:"80px"}})]}),b&&s.walletAction!=="keep"&&r.jsx("button",{onClick:k,disabled:C||s.walletAction==="import"&&s.mnemonic.trim().split(/\s+/).length!==24,type:"button",children:C?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Working..."]}):s.walletAction==="generate"?"Generate Wallet":"Import Wallet"}),L&&r.jsxs(r.Fragment,{children:[s.walletAddress&&r.jsxs("div",{className:"card",style:{marginBottom:"16px"},children:[r.jsx("div",{style:{fontSize:"12px",color:"var(--text-secondary)",marginBottom:"4px"},children:"Wallet Address"}),r.jsxs("div",{className:"form-row",style:{alignItems:"center"},children:[r.jsx("span",{className:"mono",style:{fontWeight:600,fontSize:"14px",wordBreak:"break-all",color:"var(--text)"},children:s.walletAddress}),r.jsx(td,{text:s.walletAddress})]})]}),r.jsxs("div",{className:"warning-card",children:[r.jsx("strong",{children:"WRITE DOWN THESE 24 WORDS"}),r.jsx("br",{}),"This is your only way to recover your wallet. Store them securely offline. Never share them."]}),r.jsx("ol",{className:"mnemonic-grid",children:d.map((v,S)=>r.jsxs("li",{className:"mnemonic-word",children:[r.jsxs("span",{className:"num",children:[S+1,"."]}),v]},S))}),r.jsx("div",{className:"form-row",style:{justifyContent:"flex-end",marginBottom:"8px"},children:r.jsx(td,{text:d.join(" ")})}),r.jsx("div",{className:"form-group",style:{marginTop:"16px"},children:r.jsxs("label",{className:"label-inline",style:{color:"var(--text)"},children:[r.jsx("input",{type:"checkbox",checked:s.mnemonicSaved,onChange:v=>a({...s,mnemonicSaved:v.target.checked})}),r.jsx("span",{style:{fontWeight:500},children:"I have saved my recovery phrase"})]})})]})]})}const Hm="modulepreload",Qm=function(s){return"/"+s},nd={},yl=function(a,c,u){let x=Promise.resolve();if(c&&c.length>0){let C=function(m){return Promise.all(m.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const j=document.querySelector("meta[property=csp-nonce]"),p=(j==null?void 0:j.nonce)||(j==null?void 0:j.getAttribute("nonce"));x=C(c.map(m=>{if(m=Qm(m),m in nd)return;nd[m]=!0;const d=m.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${h}`))return;const k=document.createElement("link");if(k.rel=d?"stylesheet":Hm,d||(k.as="script"),k.crossOrigin="",k.href=m,p&&k.setAttribute("nonce",p),document.head.appendChild(k),d)return new Promise((L,b)=>{k.addEventListener("load",L),k.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${m}`)))})}))}function y(C){const j=new Event("vite:preloadError",{cancelable:!0});if(j.payload=C,window.dispatchEvent(j),!j.defaultPrevented)throw C}return x.then(C=>{for(const j of C||[])j.status==="rejected"&&y(j.reason);return a().catch(y)})};var Ym=Object.defineProperty,zs=Object.getOwnPropertySymbols,Nd=Object.prototype.hasOwnProperty,Pd=Object.prototype.propertyIsEnumerable,rd=(s,a,c)=>a in s?Ym(s,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[a]=c,Ai=(s,a)=>{for(var c in a||(a={}))Nd.call(a,c)&&rd(s,c,a[c]);if(zs)for(var c of zs(a))Pd.call(a,c)&&rd(s,c,a[c]);return s},Mi=(s,a)=>{var c={};for(var u in s)Nd.call(s,u)&&a.indexOf(u)<0&&(c[u]=s[u]);if(s!=null&&zs)for(var u of zs(s))a.indexOf(u)<0&&Pd.call(s,u)&&(c[u]=s[u]);return c};/**
|
|
73
|
+
* @license QR Code generator library (TypeScript)
|
|
74
|
+
* Copyright (c) Project Nayuki.
|
|
75
|
+
* SPDX-License-Identifier: MIT
|
|
76
|
+
*/var Hn;(s=>{const a=class Ee{constructor(p,m,d,h){if(this.version=p,this.errorCorrectionLevel=m,this.modules=[],this.isFunction=[],p<Ee.MIN_VERSION||p>Ee.MAX_VERSION)throw new RangeError("Version value out of range");if(h<-1||h>7)throw new RangeError("Mask value out of range");this.size=p*4+17;let k=[];for(let b=0;b<this.size;b++)k.push(!1);for(let b=0;b<this.size;b++)this.modules.push(k.slice()),this.isFunction.push(k.slice());this.drawFunctionPatterns();const L=this.addEccAndInterleave(d);if(this.drawCodewords(L),h==-1){let b=1e9;for(let v=0;v<8;v++){this.applyMask(v),this.drawFormatBits(v);const S=this.getPenaltyScore();S<b&&(h=v,b=S),this.applyMask(v)}}x(0<=h&&h<=7),this.mask=h,this.applyMask(h),this.drawFormatBits(h),this.isFunction=[]}static encodeText(p,m){const d=s.QrSegment.makeSegments(p);return Ee.encodeSegments(d,m)}static encodeBinary(p,m){const d=s.QrSegment.makeBytes(p);return Ee.encodeSegments([d],m)}static encodeSegments(p,m,d=1,h=40,k=-1,L=!0){if(!(Ee.MIN_VERSION<=d&&d<=h&&h<=Ee.MAX_VERSION)||k<-1||k>7)throw new RangeError("Invalid value");let b,v;for(b=d;;b++){const O=Ee.getNumDataCodewords(b,m)*8,W=C.getTotalBits(p,b);if(W<=O){v=W;break}if(b>=h)throw new RangeError("Data too long")}for(const O of[Ee.Ecc.MEDIUM,Ee.Ecc.QUARTILE,Ee.Ecc.HIGH])L&&v<=Ee.getNumDataCodewords(b,O)*8&&(m=O);let S=[];for(const O of p){c(O.mode.modeBits,4,S),c(O.numChars,O.mode.numCharCountBits(b),S);for(const W of O.getData())S.push(W)}x(S.length==v);const T=Ee.getNumDataCodewords(b,m)*8;x(S.length<=T),c(0,Math.min(4,T-S.length),S),c(0,(8-S.length%8)%8,S),x(S.length%8==0);for(let O=236;S.length<T;O^=253)c(O,8,S);let U=[];for(;U.length*8<S.length;)U.push(0);return S.forEach((O,W)=>U[W>>>3]|=O<<7-(W&7)),new Ee(b,m,U,k)}getModule(p,m){return 0<=p&&p<this.size&&0<=m&&m<this.size&&this.modules[m][p]}getModules(){return this.modules}drawFunctionPatterns(){for(let d=0;d<this.size;d++)this.setFunctionModule(6,d,d%2==0),this.setFunctionModule(d,6,d%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const p=this.getAlignmentPatternPositions(),m=p.length;for(let d=0;d<m;d++)for(let h=0;h<m;h++)d==0&&h==0||d==0&&h==m-1||d==m-1&&h==0||this.drawAlignmentPattern(p[d],p[h]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(p){const m=this.errorCorrectionLevel.formatBits<<3|p;let d=m;for(let k=0;k<10;k++)d=d<<1^(d>>>9)*1335;const h=(m<<10|d)^21522;x(h>>>15==0);for(let k=0;k<=5;k++)this.setFunctionModule(8,k,u(h,k));this.setFunctionModule(8,7,u(h,6)),this.setFunctionModule(8,8,u(h,7)),this.setFunctionModule(7,8,u(h,8));for(let k=9;k<15;k++)this.setFunctionModule(14-k,8,u(h,k));for(let k=0;k<8;k++)this.setFunctionModule(this.size-1-k,8,u(h,k));for(let k=8;k<15;k++)this.setFunctionModule(8,this.size-15+k,u(h,k));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let p=this.version;for(let d=0;d<12;d++)p=p<<1^(p>>>11)*7973;const m=this.version<<12|p;x(m>>>18==0);for(let d=0;d<18;d++){const h=u(m,d),k=this.size-11+d%3,L=Math.floor(d/3);this.setFunctionModule(k,L,h),this.setFunctionModule(L,k,h)}}drawFinderPattern(p,m){for(let d=-4;d<=4;d++)for(let h=-4;h<=4;h++){const k=Math.max(Math.abs(h),Math.abs(d)),L=p+h,b=m+d;0<=L&&L<this.size&&0<=b&&b<this.size&&this.setFunctionModule(L,b,k!=2&&k!=4)}}drawAlignmentPattern(p,m){for(let d=-2;d<=2;d++)for(let h=-2;h<=2;h++)this.setFunctionModule(p+h,m+d,Math.max(Math.abs(h),Math.abs(d))!=1)}setFunctionModule(p,m,d){this.modules[m][p]=d,this.isFunction[m][p]=!0}addEccAndInterleave(p){const m=this.version,d=this.errorCorrectionLevel;if(p.length!=Ee.getNumDataCodewords(m,d))throw new RangeError("Invalid argument");const h=Ee.NUM_ERROR_CORRECTION_BLOCKS[d.ordinal][m],k=Ee.ECC_CODEWORDS_PER_BLOCK[d.ordinal][m],L=Math.floor(Ee.getNumRawDataModules(m)/8),b=h-L%h,v=Math.floor(L/h);let S=[];const T=Ee.reedSolomonComputeDivisor(k);for(let O=0,W=0;O<h;O++){let $=p.slice(W,W+v-k+(O<b?0:1));W+=$.length;const K=Ee.reedSolomonComputeRemainder($,T);O<b&&$.push(0),S.push($.concat(K))}let U=[];for(let O=0;O<S[0].length;O++)S.forEach((W,$)=>{(O!=v-k||$>=b)&&U.push(W[O])});return x(U.length==L),U}drawCodewords(p){if(p.length!=Math.floor(Ee.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let m=0;for(let d=this.size-1;d>=1;d-=2){d==6&&(d=5);for(let h=0;h<this.size;h++)for(let k=0;k<2;k++){const L=d-k,v=(d+1&2)==0?this.size-1-h:h;!this.isFunction[v][L]&&m<p.length*8&&(this.modules[v][L]=u(p[m>>>3],7-(m&7)),m++)}}x(m==p.length*8)}applyMask(p){if(p<0||p>7)throw new RangeError("Mask value out of range");for(let m=0;m<this.size;m++)for(let d=0;d<this.size;d++){let h;switch(p){case 0:h=(d+m)%2==0;break;case 1:h=m%2==0;break;case 2:h=d%3==0;break;case 3:h=(d+m)%3==0;break;case 4:h=(Math.floor(d/3)+Math.floor(m/2))%2==0;break;case 5:h=d*m%2+d*m%3==0;break;case 6:h=(d*m%2+d*m%3)%2==0;break;case 7:h=((d+m)%2+d*m%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[m][d]&&h&&(this.modules[m][d]=!this.modules[m][d])}}getPenaltyScore(){let p=0;for(let k=0;k<this.size;k++){let L=!1,b=0,v=[0,0,0,0,0,0,0];for(let S=0;S<this.size;S++)this.modules[k][S]==L?(b++,b==5?p+=Ee.PENALTY_N1:b>5&&p++):(this.finderPenaltyAddHistory(b,v),L||(p+=this.finderPenaltyCountPatterns(v)*Ee.PENALTY_N3),L=this.modules[k][S],b=1);p+=this.finderPenaltyTerminateAndCount(L,b,v)*Ee.PENALTY_N3}for(let k=0;k<this.size;k++){let L=!1,b=0,v=[0,0,0,0,0,0,0];for(let S=0;S<this.size;S++)this.modules[S][k]==L?(b++,b==5?p+=Ee.PENALTY_N1:b>5&&p++):(this.finderPenaltyAddHistory(b,v),L||(p+=this.finderPenaltyCountPatterns(v)*Ee.PENALTY_N3),L=this.modules[S][k],b=1);p+=this.finderPenaltyTerminateAndCount(L,b,v)*Ee.PENALTY_N3}for(let k=0;k<this.size-1;k++)for(let L=0;L<this.size-1;L++){const b=this.modules[k][L];b==this.modules[k][L+1]&&b==this.modules[k+1][L]&&b==this.modules[k+1][L+1]&&(p+=Ee.PENALTY_N2)}let m=0;for(const k of this.modules)m=k.reduce((L,b)=>L+(b?1:0),m);const d=this.size*this.size,h=Math.ceil(Math.abs(m*20-d*10)/d)-1;return x(0<=h&&h<=9),p+=h*Ee.PENALTY_N4,x(0<=p&&p<=2568888),p}getAlignmentPatternPositions(){if(this.version==1)return[];{const p=Math.floor(this.version/7)+2,m=this.version==32?26:Math.ceil((this.version*4+4)/(p*2-2))*2;let d=[6];for(let h=this.size-7;d.length<p;h-=m)d.splice(1,0,h);return d}}static getNumRawDataModules(p){if(p<Ee.MIN_VERSION||p>Ee.MAX_VERSION)throw new RangeError("Version number out of range");let m=(16*p+128)*p+64;if(p>=2){const d=Math.floor(p/7)+2;m-=(25*d-10)*d-55,p>=7&&(m-=36)}return x(208<=m&&m<=29648),m}static getNumDataCodewords(p,m){return Math.floor(Ee.getNumRawDataModules(p)/8)-Ee.ECC_CODEWORDS_PER_BLOCK[m.ordinal][p]*Ee.NUM_ERROR_CORRECTION_BLOCKS[m.ordinal][p]}static reedSolomonComputeDivisor(p){if(p<1||p>255)throw new RangeError("Degree out of range");let m=[];for(let h=0;h<p-1;h++)m.push(0);m.push(1);let d=1;for(let h=0;h<p;h++){for(let k=0;k<m.length;k++)m[k]=Ee.reedSolomonMultiply(m[k],d),k+1<m.length&&(m[k]^=m[k+1]);d=Ee.reedSolomonMultiply(d,2)}return m}static reedSolomonComputeRemainder(p,m){let d=m.map(h=>0);for(const h of p){const k=h^d.shift();d.push(0),m.forEach((L,b)=>d[b]^=Ee.reedSolomonMultiply(L,k))}return d}static reedSolomonMultiply(p,m){if(p>>>8||m>>>8)throw new RangeError("Byte out of range");let d=0;for(let h=7;h>=0;h--)d=d<<1^(d>>>7)*285,d^=(m>>>h&1)*p;return x(d>>>8==0),d}finderPenaltyCountPatterns(p){const m=p[1];x(m<=this.size*3);const d=m>0&&p[2]==m&&p[3]==m*3&&p[4]==m&&p[5]==m;return(d&&p[0]>=m*4&&p[6]>=m?1:0)+(d&&p[6]>=m*4&&p[0]>=m?1:0)}finderPenaltyTerminateAndCount(p,m,d){return p&&(this.finderPenaltyAddHistory(m,d),m=0),m+=this.size,this.finderPenaltyAddHistory(m,d),this.finderPenaltyCountPatterns(d)}finderPenaltyAddHistory(p,m){m[0]==0&&(p+=this.size),m.pop(),m.unshift(p)}};a.MIN_VERSION=1,a.MAX_VERSION=40,a.PENALTY_N1=3,a.PENALTY_N2=3,a.PENALTY_N3=40,a.PENALTY_N4=10,a.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],a.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],s.QrCode=a;function c(j,p,m){if(p<0||p>31||j>>>p)throw new RangeError("Value out of range");for(let d=p-1;d>=0;d--)m.push(j>>>d&1)}function u(j,p){return(j>>>p&1)!=0}function x(j){if(!j)throw new Error("Assertion error")}const y=class Be{constructor(p,m,d){if(this.mode=p,this.numChars=m,this.bitData=d,m<0)throw new RangeError("Invalid argument");this.bitData=d.slice()}static makeBytes(p){let m=[];for(const d of p)c(d,8,m);return new Be(Be.Mode.BYTE,p.length,m)}static makeNumeric(p){if(!Be.isNumeric(p))throw new RangeError("String contains non-numeric characters");let m=[];for(let d=0;d<p.length;){const h=Math.min(p.length-d,3);c(parseInt(p.substring(d,d+h),10),h*3+1,m),d+=h}return new Be(Be.Mode.NUMERIC,p.length,m)}static makeAlphanumeric(p){if(!Be.isAlphanumeric(p))throw new RangeError("String contains unencodable characters in alphanumeric mode");let m=[],d;for(d=0;d+2<=p.length;d+=2){let h=Be.ALPHANUMERIC_CHARSET.indexOf(p.charAt(d))*45;h+=Be.ALPHANUMERIC_CHARSET.indexOf(p.charAt(d+1)),c(h,11,m)}return d<p.length&&c(Be.ALPHANUMERIC_CHARSET.indexOf(p.charAt(d)),6,m),new Be(Be.Mode.ALPHANUMERIC,p.length,m)}static makeSegments(p){return p==""?[]:Be.isNumeric(p)?[Be.makeNumeric(p)]:Be.isAlphanumeric(p)?[Be.makeAlphanumeric(p)]:[Be.makeBytes(Be.toUtf8ByteArray(p))]}static makeEci(p){let m=[];if(p<0)throw new RangeError("ECI assignment value out of range");if(p<128)c(p,8,m);else if(p<16384)c(2,2,m),c(p,14,m);else if(p<1e6)c(6,3,m),c(p,21,m);else throw new RangeError("ECI assignment value out of range");return new Be(Be.Mode.ECI,0,m)}static isNumeric(p){return Be.NUMERIC_REGEX.test(p)}static isAlphanumeric(p){return Be.ALPHANUMERIC_REGEX.test(p)}getData(){return this.bitData.slice()}static getTotalBits(p,m){let d=0;for(const h of p){const k=h.mode.numCharCountBits(m);if(h.numChars>=1<<k)return 1/0;d+=4+k+h.bitData.length}return d}static toUtf8ByteArray(p){p=encodeURI(p);let m=[];for(let d=0;d<p.length;d++)p.charAt(d)!="%"?m.push(p.charCodeAt(d)):(m.push(parseInt(p.substring(d+1,d+3),16)),d+=2);return m}};y.NUMERIC_REGEX=/^[0-9]*$/,y.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,y.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let C=y;s.QrSegment=y})(Hn||(Hn={}));(s=>{(a=>{const c=class{constructor(x,y){this.ordinal=x,this.formatBits=y}};c.LOW=new c(0,1),c.MEDIUM=new c(1,0),c.QUARTILE=new c(2,3),c.HIGH=new c(3,2),a.Ecc=c})(s.QrCode||(s.QrCode={}))})(Hn||(Hn={}));(s=>{(a=>{const c=class{constructor(x,y){this.modeBits=x,this.numBitsCharCount=y}numCharCountBits(x){return this.numBitsCharCount[Math.floor((x+7)/17)]}};c.NUMERIC=new c(1,[10,12,14]),c.ALPHANUMERIC=new c(2,[9,11,13]),c.BYTE=new c(4,[8,16,16]),c.KANJI=new c(8,[8,10,12]),c.ECI=new c(7,[0,0,0]),a.Mode=c})(s.QrSegment||(s.QrSegment={}))})(Hn||(Hn={}));var wr=Hn;/**
|
|
77
|
+
* @license qrcode.react
|
|
78
|
+
* Copyright (c) Paul O'Shannessy
|
|
79
|
+
* SPDX-License-Identifier: ISC
|
|
80
|
+
*/var Gm={L:wr.QrCode.Ecc.LOW,M:wr.QrCode.Ecc.MEDIUM,Q:wr.QrCode.Ecc.QUARTILE,H:wr.QrCode.Ecc.HIGH},bd=128,_d="L",Td="#FFFFFF",Rd="#000000",Ld=!1,Id=1,qm=4,Jm=0,Xm=.1;function zd(s,a=0){const c=[];return s.forEach(function(u,x){let y=null;u.forEach(function(C,j){if(!C&&y!==null){c.push(`M${y+a} ${x+a}h${j-y}v1H${y+a}z`),y=null;return}if(j===u.length-1){if(!C)return;y===null?c.push(`M${j+a},${x+a} h1v1H${j+a}z`):c.push(`M${y+a},${x+a} h${j+1-y}v1H${y+a}z`);return}C&&y===null&&(y=j)})}),c.join("")}function Ad(s,a){return s.slice().map((c,u)=>u<a.y||u>=a.y+a.h?c:c.map((x,y)=>y<a.x||y>=a.x+a.w?x:!1))}function Zm(s,a,c,u){if(u==null)return null;const x=s.length+c*2,y=Math.floor(a*Xm),C=x/a,j=(u.width||y)*C,p=(u.height||y)*C,m=u.x==null?s.length/2-j/2:u.x*C,d=u.y==null?s.length/2-p/2:u.y*C,h=u.opacity==null?1:u.opacity;let k=null;if(u.excavate){let b=Math.floor(m),v=Math.floor(d),S=Math.ceil(j+m-b),T=Math.ceil(p+d-v);k={x:b,y:v,w:S,h:T}}const L=u.crossOrigin;return{x:m,y:d,h:p,w:j,excavation:k,opacity:h,crossOrigin:L}}function eg(s,a){return a!=null?Math.max(Math.floor(a),0):s?qm:Jm}function Md({value:s,level:a,minVersion:c,includeMargin:u,marginSize:x,imageSettings:y,size:C,boostLevel:j}){let p=ze.useMemo(()=>{const b=(Array.isArray(s)?s:[s]).reduce((v,S)=>(v.push(...wr.QrSegment.makeSegments(S)),v),[]);return wr.QrCode.encodeSegments(b,Gm[a],c,void 0,void 0,j)},[s,a,c,j]);const{cells:m,margin:d,numCells:h,calculatedImageSettings:k}=ze.useMemo(()=>{let L=p.getModules();const b=eg(u,x),v=L.length+b*2,S=Zm(L,C,b,y);return{cells:L,margin:b,numCells:v,calculatedImageSettings:S}},[p,C,y,u,x]);return{qrcode:p,margin:d,cells:m,numCells:h,calculatedImageSettings:k}}var tg=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),ng=ze.forwardRef(function(a,c){const u=a,{value:x,size:y=bd,level:C=_d,bgColor:j=Td,fgColor:p=Rd,includeMargin:m=Ld,minVersion:d=Id,boostLevel:h,marginSize:k,imageSettings:L}=u,v=Mi(u,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:S}=v,T=Mi(v,["style"]),U=L==null?void 0:L.src,O=ze.useRef(null),W=ze.useRef(null),$=ze.useCallback(oe=>{O.current=oe,typeof c=="function"?c(oe):c&&(c.current=oe)},[c]),[K,Z]=ze.useState(!1),{margin:ne,cells:D,numCells:A,calculatedImageSettings:H}=Md({value:x,level:C,minVersion:d,boostLevel:h,includeMargin:m,marginSize:k,imageSettings:L,size:y});ze.useEffect(()=>{if(O.current!=null){const oe=O.current,ie=oe.getContext("2d");if(!ie)return;let ve=D;const re=W.current,P=H!=null&&re!==null&&re.complete&&re.naturalHeight!==0&&re.naturalWidth!==0;P&&H.excavation!=null&&(ve=Ad(D,H.excavation));const te=window.devicePixelRatio||1;oe.height=oe.width=y*te;const B=y/A*te;ie.scale(B,B),ie.fillStyle=j,ie.fillRect(0,0,A,A),ie.fillStyle=p,tg?ie.fill(new Path2D(zd(ve,ne))):D.forEach(function(_,Q){_.forEach(function(Y,V){Y&&ie.fillRect(V+ne,Q+ne,1,1)})}),H&&(ie.globalAlpha=H.opacity),P&&ie.drawImage(re,H.x+ne,H.y+ne,H.w,H.h)}}),ze.useEffect(()=>{Z(!1)},[U]);const ue=Ai({height:y,width:y},S);let I=null;return U!=null&&(I=ze.createElement("img",{src:U,key:U,style:{display:"none"},onLoad:()=>{Z(!0)},ref:W,crossOrigin:H==null?void 0:H.crossOrigin})),ze.createElement(ze.Fragment,null,ze.createElement("canvas",Ai({style:ue,height:y,width:y,ref:$,role:"img"},T)),I)});ng.displayName="QRCodeCanvas";var Od=ze.forwardRef(function(a,c){const u=a,{value:x,size:y=bd,level:C=_d,bgColor:j=Td,fgColor:p=Rd,includeMargin:m=Ld,minVersion:d=Id,boostLevel:h,title:k,marginSize:L,imageSettings:b}=u,v=Mi(u,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:S,cells:T,numCells:U,calculatedImageSettings:O}=Md({value:x,level:C,minVersion:d,boostLevel:h,includeMargin:m,marginSize:L,imageSettings:b,size:y});let W=T,$=null;b!=null&&O!=null&&(O.excavation!=null&&(W=Ad(T,O.excavation)),$=ze.createElement("image",{href:b.src,height:O.h,width:O.w,x:O.x+S,y:O.y+S,preserveAspectRatio:"none",opacity:O.opacity,crossOrigin:O.crossOrigin}));const K=zd(W,S);return ze.createElement("svg",Ai({height:y,width:y,viewBox:`0 0 ${U} ${U}`,ref:c,role:"img"},v),!!k&&ze.createElement("title",null,k),ze.createElement("path",{fill:j,d:`M0,0 h${U}v${U}H0z`,shapeRendering:"crispEdges"}),ze.createElement("path",{fill:p,d:K,shapeRendering:"crispEdges"}),$)});Od.displayName="QRCodeSVG";const rg=g.lazy(()=>yl(()=>import("./index.es-DitvF-9H.js"),[])),ld=()=>yl(()=>import("./run-DOrDowjK.js"),[]).then(s=>s.default),lg=()=>yl(()=>import("./login-telegram-BP7CJDmx.js"),[]).then(s=>s.default);function Ti({loader:s,size:a}){const[c,u]=g.useState(null);return g.useEffect(()=>{s().then(u)},[]),c?r.jsx(g.Suspense,{fallback:r.jsx("div",{style:{width:a,height:a,margin:"0 auto 16px"}}),children:r.jsx(rg,{animationData:c,loop:!0,style:{width:a,height:a,margin:"0 auto 16px"}})}):r.jsx("div",{style:{width:a,height:a,margin:"0 auto 16px"}})}function sg({data:s,onChange:a}){const[c,u]=g.useState("idle"),[x,y]=g.useState(!1),[C,j]=g.useState(""),[p,m]=g.useState(""),[d,h]=g.useState(""),[k,L]=g.useState(""),[b,v]=g.useState("sms"),[S,T]=g.useState(""),[U,O]=g.useState(!1),[W,$]=g.useState(0),[K,Z]=g.useState(""),ne=g.useRef(null),D=g.useRef(null),A=s.authMode==="qr";g.useEffect(()=>{if(!(W<=0))return ne.current=setInterval(()=>{$(re=>re<=1?(ne.current&&clearInterval(ne.current),0):re-1)},1e3),()=>{ne.current&&clearInterval(ne.current)}},[W>0]),g.useEffect(()=>{if(c!=="code_sent")return;const re=setTimeout(()=>O(!0),3e4);return()=>clearTimeout(re)},[c]),g.useEffect(()=>{s.telegramUser&&u("done")},[]),g.useEffect(()=>()=>{D.current&&clearInterval(D.current)},[]);const H=async()=>{var re;y(!0),j("");try{const P=await Ye.startQr(s.apiId,s.apiHash);a({...s,authSessionId:P.authSessionId}),Z(P.token),u("qr_waiting"),ue(P.authSessionId)}catch(P){const te=P instanceof Error?P.message:String(P);if(te.includes("FLOOD")||te.includes("Rate limited")){const B=parseInt(((re=te.match(/(\d+)/))==null?void 0:re[1])||"60");$(B)}j(te)}finally{y(!1)}},ue=g.useCallback(re=>{D.current&&clearInterval(D.current),D.current=setInterval(async()=>{try{const P=await Ye.refreshQr(re);P.status==="authenticated"&&P.user?(D.current&&clearInterval(D.current),D.current=null,a({...s,telegramUser:{...P.user,username:P.user.username??""},skipConnect:!1}),u("done")):P.status==="2fa_required"?(D.current&&clearInterval(D.current),D.current=null,L(P.passwordHint||""),u("2fa")):P.status==="expired"?(D.current&&clearInterval(D.current),D.current=null,u("idle"),j("Session expired. Please try again.")):P.status==="waiting"&&P.token&&Z(P.token)}catch{}},5e3)},[s,a]),I=async()=>{var re;y(!0),j("");try{const P=await Ye.sendCode(s.apiId,s.apiHash,s.phone);a({...s,authSessionId:P.authSessionId}),v(P.codeDelivery),P.fragmentUrl&&T(P.fragmentUrl),u("code_sent"),O(!1)}catch(P){const te=P instanceof Error?P.message:String(P);if(te.includes("FLOOD")){const B=parseInt(((re=te.match(/(\d+)/))==null?void 0:re[1])||"60");$(B)}j(te)}finally{y(!1)}},oe=async re=>{if(m(re),!(re.length<5)){y(!0),j("");try{const P=await Ye.verifyCode(s.authSessionId,re);P.status==="authenticated"&&P.user?(a({...s,telegramUser:{...P.user,username:P.user.username??""},skipConnect:!1}),u("done")):P.status==="2fa_required"&&(L(P.passwordHint||""),u("2fa"))}catch(P){j(P instanceof Error?P.message:String(P))}finally{y(!1)}}},ie=async()=>{y(!0),j("");try{const re=await Ye.verifyPassword(s.authSessionId,d);re.status==="authenticated"&&re.user&&(a({...s,telegramUser:{...re.user,username:re.user.username??""},skipConnect:!1}),u("done"))}catch(re){j(re instanceof Error?re.message:String(re))}finally{y(!1)}},ve=async()=>{y(!0),j("");try{const re=await Ye.resendCode(s.authSessionId);v(re.codeDelivery),re.fragmentUrl&&T(re.fragmentUrl),m(""),O(!1)}catch(re){j(re instanceof Error?re.message:String(re))}finally{y(!1)}};return r.jsxs("div",{className:"step-content",children:[r.jsx("h2",{className:"step-title",children:"Connect your Agent to Telegram"}),r.jsx("p",{className:"step-description",children:A?"Scan the QR code with your Telegram app to authenticate instantly.":"Authenticate with your Telegram account. This lets the agent send and receive messages as you."}),C&&r.jsx("div",{className:"alert error",children:C}),c==="idle"&&A&&r.jsxs("div",{className:"text-center",style:{padding:"20px 0"},children:[r.jsx(Ti,{loader:ld,size:200}),r.jsx("button",{onClick:H,disabled:x||W>0,type:"button",className:"btn-lg",children:x?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Connecting..."]}):W>0?`Wait ${W}s`:"Show QR Code"})]}),c==="qr_waiting"&&r.jsxs("div",{className:"text-center",style:{padding:"20px 0"},children:[r.jsx("div",{style:{display:"inline-block",padding:"16px",background:"#fff",borderRadius:"12px",marginBottom:"16px"},children:r.jsx(Od,{value:`tg://login?token=${K}`,size:256,level:"M",marginSize:4,title:"Scan with Telegram to log in"})}),r.jsxs("div",{className:"text-muted",style:{marginBottom:"8px"},children:["Open ",r.jsx("strong",{children:"Telegram"})," on your phone"]}),r.jsx("div",{className:"text-muted",style:{marginBottom:"16px",fontSize:"0.9em"},children:"Settings → Devices → Link Desktop Device"}),r.jsxs("div",{className:"text-muted",style:{fontSize:"0.85em",opacity:.7},children:[r.jsx("span",{className:"spinner sm",style:{marginRight:"6px"}}),"Waiting for scan..."]})]}),c==="idle"&&!A&&r.jsxs("div",{className:"text-center",style:{padding:"20px 0"},children:[r.jsx(Ti,{loader:ld,size:200}),r.jsx("button",{onClick:I,disabled:x||W>0,type:"button",className:"btn-lg",children:x?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Connecting..."]}):W>0?`Wait ${W}s`:"Connect to Telegram"})]}),c==="code_sent"&&r.jsxs("div",{className:"text-center",style:{padding:"20px 0"},children:[r.jsx(Ti,{loader:lg,size:180}),b==="fragment"?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"info-panel",style:{textAlign:"left",marginBottom:"16px"},children:[r.jsx("strong",{children:"Anonymous number detected (+888)"}),r.jsx("p",{className:"text-muted",style:{margin:"8px 0"},children:'Your number is an anonymous number purchased on Fragment. To receive the login code, open Fragment.com, connect your TON wallet, and navigate to "My Assets" to find the code.'}),S&&r.jsxs("a",{href:S,target:"_blank",rel:"noopener noreferrer",className:"btn-lg btn-ghost",style:{display:"inline-flex",alignItems:"center",gap:"6px",marginTop:"4px"},children:["Open Fragment.com",r.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[r.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),r.jsx("polyline",{points:"15 3 21 3 21 9"}),r.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),r.jsx("div",{className:"text-muted",style:{marginBottom:"16px"},children:"Enter the code shown on Fragment"})]}):r.jsxs("div",{className:"text-muted",style:{marginBottom:"16px"},children:["Code sent via ",b==="app"?"Telegram app":"SMS"]}),r.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"16px"},children:r.jsx("input",{className:"code-input",type:"text",inputMode:"numeric",value:p,onChange:re=>{const P=re.target.value.replace(/\D/g,"").slice(0,5);oe(P)},placeholder:"12345",maxLength:5,autoFocus:!0,disabled:x})}),x&&r.jsxs("div",{className:"text-muted",children:[r.jsx("span",{className:"spinner sm"})," Verifying..."]}),U&&!x&&r.jsx("button",{type:"button",className:"btn-ghost",onClick:ve,children:"Resend code"})]}),c==="2fa"&&r.jsxs("div",{style:{padding:"20px 0"},children:[r.jsx("div",{className:"text-muted text-center",style:{marginBottom:"12px"},children:"Two-factor authentication required"}),k&&r.jsxs("div",{className:"info-panel text-center",children:["Hint: ",k]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Password"}),r.jsx("input",{type:"password",value:d,onChange:re=>h(re.target.value),onKeyDown:re=>re.key==="Enter"&&ie(),placeholder:"Enter your 2FA password",className:"w-full",autoFocus:!0})]}),r.jsx("button",{onClick:ie,disabled:x||!d,type:"button",children:x?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Verifying..."]}):"Submit"})]}),c==="done"&&s.telegramUser&&r.jsxs("div",{className:"alert success text-center",style:{padding:"20px"},children:["Connected as ",r.jsx("strong",{children:s.telegramUser.firstName}),s.telegramUser.username&&r.jsxs(r.Fragment,{children:[" (@",s.telegramUser.username,")"]})]})]})}const Vn=[{id:"welcome",label:"Welcome"},{id:"provider",label:"Provider"},{id:"config",label:"Config"},{id:"wallet",label:"Wallet"},{id:"telegram",label:"Telegram"},{id:"connect",label:"Connect"}],og={riskAccepted:!1,agentName:"Nova",provider:"",apiKey:"",cocoonPort:11435,localUrl:"http://localhost:11434/v1",apiId:0,apiHash:"",phone:"",userId:0,mode:"quick",model:"",customModel:"",dmPolicy:"admin-only",groupPolicy:"admin-only",requireMention:!0,maxIterations:5,botToken:"",botUsername:"",tonapiKey:"",toncenterKey:"",tavilyKey:"",customizeThresholds:!1,buyMaxFloor:95,sellMinFloor:105,walletAction:"generate",mnemonic:"",walletAddress:"",mnemonicSaved:!1,authSessionId:"",telegramUser:null,authMode:"qr",skipConnect:!1,webuiEnabled:!1,execMode:"off"};function ig(s,a){switch(s){case 0:return a.riskAccepted;case 1:if(!a.provider)return!1;if(a.provider==="cocoon")return a.cocoonPort>=1&&a.cocoonPort<=65535;if(a.provider==="local")try{return new URL(a.localUrl),!0}catch{return!1}return a.provider==="claude-code"?!0:a.apiKey.length>0;case 2:return a.provider!=="cocoon"&&a.provider!=="local"&&!(a.model==="__custom__"?a.customModel:a.model)?!1:a.userId>0&&a.maxIterations>=1&&a.maxIterations<=50;case 3:return a.walletAction==="keep"?!0:a.walletAddress?a.mnemonicSaved:!1;case 4:return a.apiId<=0||a.apiHash.length<10?!1:a.authMode==="phone"?a.phone.startsWith("+"):!0;case 5:return a.telegramUser!==null||a.skipConnect;default:return!1}}const Dd=g.createContext(null);function Vi(){const s=g.useContext(Dd);if(!s)throw new Error("useSetup must be used inside SetupProvider");return s}function ag({children:s}){const[a,c]=g.useState(0),[u,x]=g.useState(og),[y,C]=g.useState(!1),[j,p]=g.useState(""),[m,d]=g.useState(!1),[h,k]=g.useState(!1),[L,b]=g.useState(""),v=ig(a,u),S=g.useCallback(()=>{v&&c($=>Math.min($+1,Vn.length-1))},[v]),T=g.useCallback(()=>{c($=>Math.max($-1,0))},[]),U=g.useCallback(async()=>{C(!0),p("");try{const $=u.model==="__custom__"?u.customModel:u.model||void 0,K={agent:{provider:u.provider,...u.provider!=="cocoon"&&u.provider!=="local"&&u.apiKey?{api_key:u.apiKey}:{},...u.provider==="local"?{base_url:u.localUrl}:{},...$?{model:$}:{},max_agentic_iterations:u.maxIterations},telegram:{api_id:u.apiId,api_hash:u.apiHash,phone:u.phone,admin_ids:[u.userId],owner_id:u.userId,dm_policy:u.dmPolicy,group_policy:u.groupPolicy,require_mention:u.requireMention,...u.botToken?{bot_token:u.botToken}:{},...u.botUsername?{bot_username:u.botUsername}:{}},...u.provider==="cocoon"?{cocoon:{port:u.cocoonPort}}:{},deals:{enabled:!!u.botToken,...u.customizeThresholds?{buy_max_floor_percent:u.buyMaxFloor,sell_min_floor_percent:u.sellMinFloor}:{}},...u.tonapiKey?{tonapi_key:u.tonapiKey}:{},...u.toncenterKey?{toncenter_api_key:u.toncenterKey}:{},...u.tavilyKey?{tavily_api_key:u.tavilyKey}:{},webui:{enabled:!0}};await Ye.saveConfig(K),d(!0)}catch($){p($ instanceof Error?$.message:String($))}finally{C(!1)}},[u]),O=g.useCallback(async()=>{k(!0),b("");try{const{token:$}=await Ye.launch();await Ye.pollHealth(3e4),window.location.href=`/auth/exchange?token=${encodeURIComponent($)}`}catch($){b($ instanceof Error?$.message:String($))}finally{k(!1)}},[]),W=g.useRef(U);return W.current=U,g.useEffect(()=>{a===Vn.length-1&&u.telegramUser&&!m&&!y&&W.current()},[a,u.telegramUser,m,y]),r.jsx(Dd.Provider,{value:{step:a,data:u,loading:y,error:j,saved:m,launching:h,launchError:L,canAdvance:v,setData:x,next:S,prev:T,handleSave:U,handleLaunch:O},children:s})}const cg=g.lazy(()=>yl(()=>import("./index.es-DitvF-9H.js"),[])),ug=()=>yl(()=>import("./complete-fZLnb5Ot.js"),[]).then(s=>s.default);function dg(){const[s,a]=g.useState(null);g.useEffect(()=>{ug().then(a)},[]);const c=200;return s?r.jsx(g.Suspense,{fallback:r.jsx("div",{style:{width:c,height:c,margin:"0 auto 24px"}}),children:r.jsx(cg,{animationData:s,loop:!0,style:{width:c,height:c,margin:"0 auto 24px"}})}):r.jsx("div",{style:{width:c,height:c,margin:"0 auto 24px"}})}function pg(){const{launching:s,launchError:a,handleLaunch:c}=Vi();return r.jsxs("div",{className:"step-content text-center",style:{paddingTop:"40px"},children:[r.jsx(dg,{}),r.jsx("h2",{style:{fontSize:"20px",fontWeight:600,letterSpacing:"-0.3px",marginBottom:"8px"},children:"Your Agent is ready"}),r.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"14px",marginBottom:"32px"},children:"Configuration saved. Start your agent to begin."}),r.jsx("button",{onClick:c,disabled:s,className:"btn-lg",style:{minWidth:"200px"},children:s?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Starting..."]}):"Start Agent"}),s&&r.jsx("p",{className:"helper-text",style:{marginTop:"16px"},children:"Booting your agent... this may take a few seconds."}),a&&r.jsxs("div",{style:{marginTop:"20px"},children:[r.jsx("div",{className:"alert error",children:a}),r.jsx("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginTop:"8px"},children:"Start manually:"}),r.jsx("code",{className:"code-block",style:{marginTop:"8px"},children:"teleton start"})]})]})}const fg=[Bm,Fm,Km,Vm,$m,sg];function hg(){const{step:s,data:a,loading:c,error:u,saved:x,canAdvance:y,setData:C,next:j,prev:p}=Vi();if(x)return r.jsx(pg,{});const m=fg[s],d=s<Vn.length-1?Vn[s+1].label:"";return r.jsxs(r.Fragment,{children:[r.jsx(m,{data:a,onChange:C}),u&&r.jsx("div",{className:"alert error",children:u}),r.jsxs("div",{className:"setup-nav",children:[s>0&&r.jsx("button",{className:"btn-ghost",onClick:p,type:"button",children:"Back"}),r.jsx("div",{style:{flex:1}}),s<Vn.length-1&&r.jsx("button",{onClick:j,disabled:!y||c,type:"button",children:c?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Next"]}):`Next: ${d}`})]})]})}function mg(){const{step:s}=Vi();return r.jsx("div",{className:"step-indicator",children:Vn.map((a,c)=>{const u=c<s,x=c===s;return r.jsxs("div",{className:"step-cell",children:[r.jsxs("div",{className:"step-cell-top",children:[r.jsx("div",{className:`step-dot${x?" active":""}${u?" completed":""}`,children:u?r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:r.jsx("polyline",{points:"20 6 9 17 4 12"})}):r.jsx("span",{children:c+1})}),c<Vn.length-1&&r.jsx("div",{className:`step-line${u?" completed":""}`})]}),r.jsx("div",{className:`step-label${x?" active":""}${u?" completed":""}`,children:a.label})]},a.id)})})}const gg=[{label:"Dashboard",path:"/"},{label:"Tools",path:"/tools"},{label:"Plugins",path:"/plugins"},{label:"Soul",path:"/soul"},{label:"Memory",path:"/memory"},{label:"Logs",path:"/logs"},{label:"Workspace",path:"/workspace"},{label:"Tasks",path:"/tasks"},{label:"MCP",path:"/mcp"},{label:"Config",path:"/config"}];function xg(){return r.jsx("nav",{children:gg.map(s=>r.jsx("span",{className:"sidebar-link-disabled",children:s.label},s.path))})}function yg(){return r.jsxs(r.Fragment,{children:[r.jsx(mg,{}),r.jsx(gd,{})]})}function vg(){return r.jsx(ag,{children:r.jsx(vd,{sidebar:r.jsx(xg,{}),children:r.jsx(yg,{})})})}function jg(){return window.location.pathname.startsWith("/setup")?r.jsx(yd,{children:r.jsx(jd,{children:r.jsx(xd,{children:r.jsx(dt,{path:"/setup",element:r.jsx(vg,{}),children:r.jsx(dt,{index:!0,element:r.jsx(hg,{})})})})})}):r.jsx(Sg,{})}function Sg(){const[s,a]=g.useState(!1),[c,u]=g.useState(!0),[x,y]=g.useState(""),[C,j]=g.useState("");g.useEffect(()=>{const d=new URLSearchParams(window.location.search).get("token");if(window.location.pathname==="/auth/exchange"&&d){Yu(d).then(h=>{h?window.location.href="/":(u(!1),j("Token exchange failed"))});return}um().then(h=>{a(h),u(!1)})},[]),g.useEffect(()=>{s&&Kn.connect()},[s]);const p=async()=>{const m=x.trim();if(!m)return;j(""),await Yu(m)?a(!0):j("Invalid token")};return c?r.jsx("div",{className:"login-container",children:r.jsx("div",{className:"login-card",children:r.jsx("p",{children:"Loading..."})})}):s?r.jsx(yd,{children:r.jsx(jd,{children:r.jsx(xd,{children:r.jsxs(dt,{path:"/",element:r.jsx(fm,{}),children:[r.jsx(dt,{index:!0,element:r.jsx(ym,{})}),r.jsx(dt,{path:"tools",element:r.jsx(vm,{})}),r.jsx(dt,{path:"plugins",element:r.jsx(jm,{})}),r.jsx(dt,{path:"soul",element:r.jsx(Sm,{})}),r.jsx(dt,{path:"memory",element:r.jsx(wm,{})}),r.jsx(dt,{path:"workspace",element:r.jsx(bm,{})}),r.jsx(dt,{path:"tasks",element:r.jsx(Tm,{})}),r.jsx(dt,{path:"mcp",element:r.jsx(Rm,{})}),r.jsx(dt,{path:"config",element:r.jsx(Om,{})}),r.jsx(dt,{path:"hooks",element:r.jsx(Dm,{})}),r.jsx(dt,{path:"*",element:r.jsx(Bh,{to:"/",replace:!0})})]})})})}):r.jsx("div",{className:"login-container",children:r.jsxs("div",{className:"login-card",children:[r.jsx("h1",{children:"Teleton"}),r.jsx("p",{children:"Enter your authentication token to access the dashboard."}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Token"}),r.jsx("input",{type:"password",value:x,onChange:m=>y(m.target.value),onKeyDown:m=>m.key==="Enter"&&p(),placeholder:"Paste token from config...",style:{width:"100%"}})]}),C&&r.jsx("div",{className:"alert error",style:{marginBottom:"1rem"},children:C}),r.jsx("button",{onClick:p,style:{width:"100%"},children:"Sign In"})]})})}Hf.createRoot(document.getElementById("root")).render(r.jsx(g.StrictMode,{children:r.jsx(jg,{})}));export{ze as R,Of as g,g as r};
|