teleton 0.7.4 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -30
- package/dist/chunk-3RG5ZIWI.js +10 -0
- package/dist/{chunk-U7FQYCBQ.js → chunk-7TECSLJ4.js} +2 -2
- package/dist/{chunk-LAQOUFOJ.js → chunk-H36RFKRI.js} +7583 -11185
- package/dist/{chunk-RO62LO6Z.js → chunk-IJBWWQE4.js} +4 -0
- package/dist/{chunk-BGC2IUM5.js → chunk-JHYZYFZJ.js} +69 -20
- package/dist/{chunk-QOQWUUA4.js → chunk-OJCLKU5Z.js} +68 -2
- package/dist/{chunk-OCLG5GKI.js → chunk-P36I6OIV.js} +2 -2
- package/dist/chunk-PHSAHTK4.js +314 -0
- package/dist/{chunk-5PLZ3KSO.js → chunk-QVBSUYVX.js} +14 -42
- package/dist/{chunk-4DU3C27M.js → chunk-R4YSJ4EY.js} +5 -1
- package/dist/chunk-RQBAMUCV.js +10281 -0
- package/dist/{chunk-XDYDA2KV.js → chunk-SD4NLLYG.js} +293 -64
- package/dist/chunk-TVRZJIZX.js +292 -0
- package/dist/{chunk-EK7M5K26.js → chunk-U56QTM46.js} +3 -3
- package/dist/{chunk-XBKSS6DM.js → chunk-VFA7QMCZ.js} +5 -3
- package/dist/{chunk-VAUJSSD3.js → chunk-XQUHC3JZ.js} +1 -1
- package/dist/cli/index.js +96 -33
- package/dist/{client-RTNALK7W.js → client-LNZTDQSA.js} +6 -7
- package/dist/{get-my-gifts-TPVUGUWT.js → get-my-gifts-OMGKOEPM.js} +1 -1
- package/dist/index.js +15 -17
- package/dist/{memory-JQZ6MTRU.js → memory-AS7WKGTW.js} +7 -8
- package/dist/{migrate-GS5ACQDA.js → migrate-POHWYEIW.js} +7 -8
- package/dist/{multipart-parser-S3YC6NRJ.js → multipart-parser-UFQLJOV2.js} +2 -2
- package/dist/{paths-TMNTEDDD.js → paths-XA2RJH4S.js} +1 -1
- package/dist/{server-TCJOBV3D.js → server-H3QA252W.js} +39 -12
- package/dist/{setup-server-YHYJLAMA.js → setup-server-QXED3D2L.js} +24 -12
- package/dist/store-GAFULOOX.js +34 -0
- package/dist/{task-dependency-resolver-WKZWJLLM.js → task-dependency-resolver-3FIKQ7Z6.js} +3 -3
- package/dist/{task-executor-PD3H4MLO.js → task-executor-RUTFG6VG.js} +2 -2
- package/dist/{tasks-QSCWSMPS.js → tasks-BEZ4QRI2.js} +1 -1
- package/dist/{tool-adapter-Y3TCEQOC.js → tool-adapter-IH5VGBOO.js} +1 -1
- package/dist/{tool-index-6HBRVXVG.js → tool-index-H3SHOJC3.js} +6 -6
- package/dist/{transcript-UDJZP6NK.js → transcript-IMNE6KU3.js} +2 -2
- package/dist/web/assets/index-BrVqauzj.css +1 -0
- package/dist/web/assets/index-DYeEkvJ6.js +72 -0
- package/dist/web/assets/{index.es-CqZHj0tz.js → index.es-DkU1GvWU.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +2 -2
- package/dist/BigInteger-DQ33LTTE.js +0 -5
- package/dist/chunk-JQDLW7IE.js +0 -107
- package/dist/chunk-QGM4M3NI.js +0 -37
- package/dist/chunk-RMLQS3X6.js +0 -161
- package/dist/chunk-TSKJCWQQ.js +0 -1263
- package/dist/chunk-UCN6TI25.js +0 -143
- package/dist/chunk-YFG2QHLA.js +0 -3585
- package/dist/web/assets/index-B6M9knfJ.css +0 -1
- package/dist/web/assets/index-DAGeQfVZ.js +0 -72
- package/scripts/patch-gramjs.sh +0 -46
- package/scripts/postinstall.mjs +0 -16
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var ff=Object.defineProperty;var hf=(s,a,c)=>a in s?ff(s,a,{enumerable:!0,configurable:!0,writable:!0,value:c}):s[a]=c;var Ft=(s,a,c)=>hf(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 f in u)if(f!=="default"&&!(f in s)){const h=Object.getOwnPropertyDescriptor(u,f);h&&Object.defineProperty(s,f,h.get?h:{enumerable:!0,get:()=>u[f]})}}}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 f of document.querySelectorAll('link[rel="modulepreload"]'))u(f);new MutationObserver(f=>{for(const h of f)if(h.type==="childList")for(const v of h.addedNodes)v.tagName==="LINK"&&v.rel==="modulepreload"&&u(v)}).observe(document,{childList:!0,subtree:!0});function c(f){const h={};return f.integrity&&(h.integrity=f.integrity),f.referrerPolicy&&(h.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?h.credentials="include":f.crossOrigin==="anonymous"?h.credentials="omit":h.credentials="same-origin",h}function u(f){if(f.ep)return;f.ep=!0;const h=c(f);fetch(f.href,h)}})();function gf(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var mi={exports:{}},al={},gi={exports:{}},we={};/**
|
|
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 Su;function xf(){if(Su)return we;Su=1;var s=Symbol.for("react.element"),a=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),u=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),h=Symbol.for("react.provider"),v=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),E=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),k=Symbol.iterator;function P(N){return N===null||typeof N!="object"?null:(N=k&&N[k]||N["@@iterator"],typeof N=="function"?N:null)}var H={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,w={};function S(N,O,me){this.props=N,this.context=O,this.refs=w,this.updater=me||H}S.prototype.isReactComponent={},S.prototype.setState=function(N,O){if(typeof N!="object"&&typeof N!="function"&&N!=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,N,O,"setState")},S.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function z(){}z.prototype=S.prototype;function W(N,O,me){this.props=N,this.context=O,this.refs=w,this.updater=me||H}var X=W.prototype=new z;X.constructor=W,D(X,S.prototype),X.isPureReactComponent=!0;var Q=Array.isArray,G=Object.prototype.hasOwnProperty,F={current:null},te={key:!0,ref:!0,__self:!0,__source:!0};function re(N,O,me){var le,de={},ge=null,ke=null;if(O!=null)for(le in O.ref!==void 0&&(ke=O.ref),O.key!==void 0&&(ge=""+O.key),O)G.call(O,le)&&!te.hasOwnProperty(le)&&(de[le]=O[le]);var Ce=arguments.length-2;if(Ce===1)de.children=me;else if(1<Ce){for(var Ee=Array(Ce),Ge=0;Ge<Ce;Ge++)Ee[Ge]=arguments[Ge+2];de.children=Ee}if(N&&N.defaultProps)for(le in Ce=N.defaultProps,Ce)de[le]===void 0&&(de[le]=Ce[le]);return{$$typeof:s,type:N,key:ge,ref:ke,props:de,_owner:F.current}}function V(N,O){return{$$typeof:s,type:N.type,key:O,ref:N.ref,props:N.props,_owner:N._owner}}function I(N){return typeof N=="object"&&N!==null&&N.$$typeof===s}function A(N){var O={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(me){return O[me]})}var ee=/\/+/g;function b(N,O){return typeof N=="object"&&N!==null&&N.key!=null?A(""+N.key):O.toString(36)}function ne(N,O,me,le,de){var ge=typeof N;(ge==="undefined"||ge==="boolean")&&(N=null);var ke=!1;if(N===null)ke=!0;else switch(ge){case"string":case"number":ke=!0;break;case"object":switch(N.$$typeof){case s:case a:ke=!0}}if(ke)return ke=N,de=de(ke),N=le===""?"."+b(ke,0):le,Q(de)?(me="",N!=null&&(me=N.replace(ee,"$&/")+"/"),ne(de,O,me,"",function(Ge){return Ge})):de!=null&&(I(de)&&(de=V(de,me+(!de.key||ke&&ke.key===de.key?"":(""+de.key).replace(ee,"$&/")+"/")+N)),O.push(de)),1;if(ke=0,le=le===""?".":le+":",Q(N))for(var Ce=0;Ce<N.length;Ce++){ge=N[Ce];var Ee=le+b(ge,Ce);ke+=ne(ge,O,me,Ee,de)}else if(Ee=P(N),typeof Ee=="function")for(N=Ee.call(N),Ce=0;!(ge=N.next()).done;)ge=ge.value,Ee=le+b(ge,Ce++),ke+=ne(ge,O,me,Ee,de);else if(ge==="object")throw O=String(N),Error("Objects are not valid as a React child (found: "+(O==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":O)+"). If you meant to render a collection of children, use an array instead.");return ke}function ce(N,O,me){if(N==null)return N;var le=[],de=0;return ne(N,le,"","",function(ge){return O.call(me,ge,de++)}),le}function ve(N){if(N._status===-1){var O=N._result;O=O(),O.then(function(me){(N._status===0||N._status===-1)&&(N._status=1,N._result=me)},function(me){(N._status===0||N._status===-1)&&(N._status=2,N._result=me)}),N._status===-1&&(N._status=0,N._result=O)}if(N._status===1)return N._result.default;throw N._result}var ye={current:null},L={transition:null},Z={ReactCurrentDispatcher:ye,ReactCurrentBatchConfig:L,ReactCurrentOwner:F};function B(){throw Error("act(...) is not supported in production builds of React.")}return we.Children={map:ce,forEach:function(N,O,me){ce(N,function(){O.apply(this,arguments)},me)},count:function(N){var O=0;return ce(N,function(){O++}),O},toArray:function(N){return ce(N,function(O){return O})||[]},only:function(N){if(!I(N))throw Error("React.Children.only expected to receive a single React element child.");return N}},we.Component=S,we.Fragment=c,we.Profiler=f,we.PureComponent=W,we.StrictMode=u,we.Suspense=E,we.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Z,we.act=B,we.cloneElement=function(N,O,me){if(N==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+N+".");var le=D({},N.props),de=N.key,ge=N.ref,ke=N._owner;if(O!=null){if(O.ref!==void 0&&(ge=O.ref,ke=F.current),O.key!==void 0&&(de=""+O.key),N.type&&N.type.defaultProps)var Ce=N.type.defaultProps;for(Ee in O)G.call(O,Ee)&&!te.hasOwnProperty(Ee)&&(le[Ee]=O[Ee]===void 0&&Ce!==void 0?Ce[Ee]:O[Ee])}var Ee=arguments.length-2;if(Ee===1)le.children=me;else if(1<Ee){Ce=Array(Ee);for(var Ge=0;Ge<Ee;Ge++)Ce[Ge]=arguments[Ge+2];le.children=Ce}return{$$typeof:s,type:N.type,key:de,ref:ge,props:le,_owner:ke}},we.createContext=function(N){return N={$$typeof:v,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},N.Provider={$$typeof:h,_context:N},N.Consumer=N},we.createElement=re,we.createFactory=function(N){var O=re.bind(null,N);return O.type=N,O},we.createRef=function(){return{current:null}},we.forwardRef=function(N){return{$$typeof:y,render:N}},we.isValidElement=I,we.lazy=function(N){return{$$typeof:x,_payload:{_status:-1,_result:N},_init:ve}},we.memo=function(N,O){return{$$typeof:m,type:N,compare:O===void 0?null:O}},we.startTransition=function(N){var O=L.transition;L.transition={};try{N()}finally{L.transition=O}},we.unstable_act=B,we.useCallback=function(N,O){return ye.current.useCallback(N,O)},we.useContext=function(N){return ye.current.useContext(N)},we.useDebugValue=function(){},we.useDeferredValue=function(N){return ye.current.useDeferredValue(N)},we.useEffect=function(N,O){return ye.current.useEffect(N,O)},we.useId=function(){return ye.current.useId()},we.useImperativeHandle=function(N,O,me){return ye.current.useImperativeHandle(N,O,me)},we.useInsertionEffect=function(N,O){return ye.current.useInsertionEffect(N,O)},we.useLayoutEffect=function(N,O){return ye.current.useLayoutEffect(N,O)},we.useMemo=function(N,O){return ye.current.useMemo(N,O)},we.useReducer=function(N,O,me){return ye.current.useReducer(N,O,me)},we.useRef=function(N){return ye.current.useRef(N)},we.useState=function(N){return ye.current.useState(N)},we.useSyncExternalStore=function(N,O,me){return ye.current.useSyncExternalStore(N,O,me)},we.useTransition=function(){return ye.current.useTransition()},we.version="18.3.1",we}var wu;function Ti(){return wu||(wu=1,gi.exports=xf()),gi.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 ku;function yf(){if(ku)return al;ku=1;var s=Ti(),a=Symbol.for("react.element"),c=Symbol.for("react.fragment"),u=Object.prototype.hasOwnProperty,f=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,h={key:!0,ref:!0,__self:!0,__source:!0};function v(y,E,m){var x,k={},P=null,H=null;m!==void 0&&(P=""+m),E.key!==void 0&&(P=""+E.key),E.ref!==void 0&&(H=E.ref);for(x in E)u.call(E,x)&&!h.hasOwnProperty(x)&&(k[x]=E[x]);if(y&&y.defaultProps)for(x in E=y.defaultProps,E)k[x]===void 0&&(k[x]=E[x]);return{$$typeof:a,type:y,key:P,ref:H,props:k,_owner:f.current}}return al.Fragment=c,al.jsx=v,al.jsxs=v,al}var Cu;function vf(){return Cu||(Cu=1,mi.exports=yf()),mi.exports}var r=vf(),p=Ti();const xr=gf(p),jf=mf({__proto__:null,default:xr},[p]);var ks={},xi={exports:{}},dt={},yi={exports:{}},vi={};/**
|
|
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 Eu;function Sf(){return Eu||(Eu=1,(function(s){function a(L,Z){var B=L.length;L.push(Z);e:for(;0<B;){var N=B-1>>>1,O=L[N];if(0<f(O,Z))L[N]=Z,L[B]=O,B=N;else break e}}function c(L){return L.length===0?null:L[0]}function u(L){if(L.length===0)return null;var Z=L[0],B=L.pop();if(B!==Z){L[0]=B;e:for(var N=0,O=L.length,me=O>>>1;N<me;){var le=2*(N+1)-1,de=L[le],ge=le+1,ke=L[ge];if(0>f(de,B))ge<O&&0>f(ke,de)?(L[N]=ke,L[ge]=B,N=ge):(L[N]=de,L[le]=B,N=le);else if(ge<O&&0>f(ke,B))L[N]=ke,L[ge]=B,N=ge;else break e}}return Z}function f(L,Z){var B=L.sortIndex-Z.sortIndex;return B!==0?B:L.id-Z.id}if(typeof performance=="object"&&typeof performance.now=="function"){var h=performance;s.unstable_now=function(){return h.now()}}else{var v=Date,y=v.now();s.unstable_now=function(){return v.now()-y}}var E=[],m=[],x=1,k=null,P=3,H=!1,D=!1,w=!1,S=typeof setTimeout=="function"?setTimeout:null,z=typeof clearTimeout=="function"?clearTimeout:null,W=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function X(L){for(var Z=c(m);Z!==null;){if(Z.callback===null)u(m);else if(Z.startTime<=L)u(m),Z.sortIndex=Z.expirationTime,a(E,Z);else break;Z=c(m)}}function Q(L){if(w=!1,X(L),!D)if(c(E)!==null)D=!0,ve(G);else{var Z=c(m);Z!==null&&ye(Q,Z.startTime-L)}}function G(L,Z){D=!1,w&&(w=!1,z(re),re=-1),H=!0;var B=P;try{for(X(Z),k=c(E);k!==null&&(!(k.expirationTime>Z)||L&&!A());){var N=k.callback;if(typeof N=="function"){k.callback=null,P=k.priorityLevel;var O=N(k.expirationTime<=Z);Z=s.unstable_now(),typeof O=="function"?k.callback=O:k===c(E)&&u(E),X(Z)}else u(E);k=c(E)}if(k!==null)var me=!0;else{var le=c(m);le!==null&&ye(Q,le.startTime-Z),me=!1}return me}finally{k=null,P=B,H=!1}}var F=!1,te=null,re=-1,V=5,I=-1;function A(){return!(s.unstable_now()-I<V)}function ee(){if(te!==null){var L=s.unstable_now();I=L;var Z=!0;try{Z=te(!0,L)}finally{Z?b():(F=!1,te=null)}}else F=!1}var b;if(typeof W=="function")b=function(){W(ee)};else if(typeof MessageChannel<"u"){var ne=new MessageChannel,ce=ne.port2;ne.port1.onmessage=ee,b=function(){ce.postMessage(null)}}else b=function(){S(ee,0)};function ve(L){te=L,F||(F=!0,b())}function ye(L,Z){re=S(function(){L(s.unstable_now())},Z)}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(L){L.callback=null},s.unstable_continueExecution=function(){D||H||(D=!0,ve(G))},s.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):V=0<L?Math.floor(1e3/L):5},s.unstable_getCurrentPriorityLevel=function(){return P},s.unstable_getFirstCallbackNode=function(){return c(E)},s.unstable_next=function(L){switch(P){case 1:case 2:case 3:var Z=3;break;default:Z=P}var B=P;P=Z;try{return L()}finally{P=B}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(L,Z){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var B=P;P=L;try{return Z()}finally{P=B}},s.unstable_scheduleCallback=function(L,Z,B){var N=s.unstable_now();switch(typeof B=="object"&&B!==null?(B=B.delay,B=typeof B=="number"&&0<B?N+B:N):B=N,L){case 1:var O=-1;break;case 2:O=250;break;case 5:O=1073741823;break;case 4:O=1e4;break;default:O=5e3}return O=B+O,L={id:x++,callback:Z,priorityLevel:L,startTime:B,expirationTime:O,sortIndex:-1},B>N?(L.sortIndex=B,a(m,L),c(E)===null&&L===c(m)&&(w?(z(re),re=-1):w=!0,ye(Q,B-N))):(L.sortIndex=O,a(E,L),D||H||(D=!0,ve(G))),L},s.unstable_shouldYield=A,s.unstable_wrapCallback=function(L){var Z=P;return function(){var B=P;P=Z;try{return L.apply(this,arguments)}finally{P=B}}}})(vi)),vi}var Nu;function wf(){return Nu||(Nu=1,yi.exports=Sf()),yi.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 _u;function kf(){if(_u)return dt;_u=1;var s=Ti(),a=wf();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,f={};function h(e,t){v(e,t),v(e+"Capture",t)}function v(e,t){for(f[e]=t,e=0;e<t.length;e++)u.add(t[e])}var y=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),E=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]*$/,x={},k={};function P(e){return E.call(k,e)?!0:E.call(x,e)?!1:m.test(e)?k[e]=!0:(x[e]=!0,!1)}function H(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 D(e,t,n,l){if(t===null||typeof t>"u"||H(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 w(e,t,n,l,o,i,d){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=d}var S={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){S[e]=new w(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 w(t,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){S[e]=new w(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){S[e]=new w(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 w(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){S[e]=new w(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){S[e]=new w(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){S[e]=new w(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){S[e]=new w(e,5,!1,e.toLowerCase(),null,!1,!1)});var z=/[\-:]([a-z])/g;function W(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(z,W);S[t]=new w(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(z,W);S[t]=new w(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(z,W);S[t]=new w(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){S[e]=new w(e,1,!1,e.toLowerCase(),null,!1,!1)}),S.xlinkHref=new w("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){S[e]=new w(e,1,!1,e.toLowerCase(),null,!0,!0)});function X(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")&&(D(t,n,o,l)&&(n=null),l||o===null?P(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 Q=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,G=Symbol.for("react.element"),F=Symbol.for("react.portal"),te=Symbol.for("react.fragment"),re=Symbol.for("react.strict_mode"),V=Symbol.for("react.profiler"),I=Symbol.for("react.provider"),A=Symbol.for("react.context"),ee=Symbol.for("react.forward_ref"),b=Symbol.for("react.suspense"),ne=Symbol.for("react.suspense_list"),ce=Symbol.for("react.memo"),ve=Symbol.for("react.lazy"),ye=Symbol.for("react.offscreen"),L=Symbol.iterator;function Z(e){return e===null||typeof e!="object"?null:(e=L&&e[L]||e["@@iterator"],typeof e=="function"?e:null)}var B=Object.assign,N;function O(e){if(N===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);N=t&&t[1]||""}return`
|
|
34
|
+
`+N+e}var me=!1;function le(e,t){if(!e||me)return"";me=!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(R){var l=R}Reflect.construct(e,[],t)}else{try{t.call()}catch(R){l=R}e.call(t.prototype)}else{try{throw Error()}catch(R){l=R}e()}}catch(R){if(R&&l&&typeof R.stack=="string"){for(var o=R.stack.split(`
|
|
35
|
+
`),i=l.stack.split(`
|
|
36
|
+
`),d=o.length-1,g=i.length-1;1<=d&&0<=g&&o[d]!==i[g];)g--;for(;1<=d&&0<=g;d--,g--)if(o[d]!==i[g]){if(d!==1||g!==1)do if(d--,g--,0>g||o[d]!==i[g]){var j=`
|
|
37
|
+
`+o[d].replace(" at new "," at ");return e.displayName&&j.includes("<anonymous>")&&(j=j.replace("<anonymous>",e.displayName)),j}while(1<=d&&0<=g);break}}}finally{me=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?O(e):""}function de(e){switch(e.tag){case 5:return O(e.type);case 16:return O("Lazy");case 13:return O("Suspense");case 19:return O("SuspenseList");case 0:case 2:case 15:return e=le(e.type,!1),e;case 11:return e=le(e.type.render,!1),e;case 1:return e=le(e.type,!0),e;default:return""}}function ge(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 te:return"Fragment";case F:return"Portal";case V:return"Profiler";case re:return"StrictMode";case b:return"Suspense";case ne:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case A:return(e.displayName||"Context")+".Consumer";case I:return(e._context.displayName||"Context")+".Provider";case ee:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ce:return t=e.displayName||null,t!==null?t:ge(e.type)||"Memo";case ve:t=e._payload,e=e._init;try{return ge(e(t))}catch{}}return null}function ke(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 ge(t);case 8:return t===re?"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 Ce(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ee(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ge(e){var t=Ee(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(d){l=""+d,i.call(this,d)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return l},setValue:function(d){l=""+d},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function jn(e){e._valueTracker||(e._valueTracker=Ge(e))}function hl(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),l="";return e&&(l=Ee(e)?e.checked?"true":"false":e.value),e=l,e!==n?(t.setValue(e),!0):!1}function Wn(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 jr(e,t){var n=t.checked;return B({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Sr(e,t){var n=t.defaultValue==null?"":t.defaultValue,l=t.checked!=null?t.checked:t.defaultChecked;n=Ce(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 $n(e,t){t=t.checked,t!=null&&X(e,"checked",t,!1)}function zt(e,t){$n(e,t);var n=Ce(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")?kr(e,t.type,n):t.hasOwnProperty("defaultValue")&&kr(e,t.type,Ce(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function wr(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 kr(e,t,n){(t!=="number"||Wn(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Sn=Array.isArray;function K(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=""+Ce(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 M(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(c(91));return B({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function J(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(Sn(n)){if(1<n.length)throw Error(c(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Ce(n)}}function We(e,t){var n=Ce(t.value),l=Ce(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 vt(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function $e(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 Ke(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?$e(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var wn,Cr=(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(wn=wn||document.createElement("div"),wn.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=wn.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function kn(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Cn={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},ml=["Webkit","ms","Moz","O"];Object.keys(Cn).forEach(function(e){ml.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Cn[t]=Cn[e]})});function Se(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Cn.hasOwnProperty(e)&&Cn[e]?(""+t).trim():t+"px"}function En(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var l=n.indexOf("--")===0,o=Se(n,t[n],l);n==="float"&&(n="cssFloat"),l?e.setProperty(n,o):e[n]=o}}var Kn=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 Er(e,t){if(t){if(Kn[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 _s(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 Ps=null;function Ts(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var bs=null,Vn=null,Hn=null;function Oi(e){if(e=Qr(e)){if(typeof bs!="function")throw Error(c(280));var t=e.stateNode;t&&(t=Ol(t),bs(e.stateNode,e.type,t))}}function Fi(e){Vn?Hn?Hn.push(e):Hn=[e]:Vn=e}function Bi(){if(Vn){var e=Vn,t=Hn;if(Hn=Vn=null,Oi(e),t)for(e=0;e<t.length;e++)Oi(t[e])}}function Ui(e,t){return e(t)}function Wi(){}var Rs=!1;function $i(e,t,n){if(Rs)return e(t,n);Rs=!0;try{return Ui(e,t,n)}finally{Rs=!1,(Vn!==null||Hn!==null)&&(Wi(),Bi())}}function Nr(e,t){var n=e.stateNode;if(n===null)return null;var l=Ol(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 Ls=!1;if(y)try{var _r={};Object.defineProperty(_r,"passive",{get:function(){Ls=!0}}),window.addEventListener("test",_r,_r),window.removeEventListener("test",_r,_r)}catch{Ls=!1}function yd(e,t,n,l,o,i,d,g,j){var R=Array.prototype.slice.call(arguments,3);try{t.apply(n,R)}catch($){this.onError($)}}var Pr=!1,gl=null,xl=!1,zs=null,vd={onError:function(e){Pr=!0,gl=e}};function jd(e,t,n,l,o,i,d,g,j){Pr=!1,gl=null,yd.apply(vd,arguments)}function Sd(e,t,n,l,o,i,d,g,j){if(jd.apply(this,arguments),Pr){if(Pr){var R=gl;Pr=!1,gl=null}else throw Error(c(198));xl||(xl=!0,zs=R)}}function Nn(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 Ki(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 Vi(e){if(Nn(e)!==e)throw Error(c(188))}function wd(e){var t=e.alternate;if(!t){if(t=Nn(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 Vi(o),e;if(i===l)return Vi(o),t;i=i.sibling}throw Error(c(188))}if(n.return!==l.return)n=o,l=i;else{for(var d=!1,g=o.child;g;){if(g===n){d=!0,n=o,l=i;break}if(g===l){d=!0,l=o,n=i;break}g=g.sibling}if(!d){for(g=i.child;g;){if(g===n){d=!0,n=i,l=o;break}if(g===l){d=!0,l=i,n=o;break}g=g.sibling}if(!d)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 Hi(e){return e=wd(e),e!==null?Qi(e):null}function Qi(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Qi(e);if(t!==null)return t;e=e.sibling}return null}var Yi=a.unstable_scheduleCallback,Gi=a.unstable_cancelCallback,kd=a.unstable_shouldYield,Cd=a.unstable_requestPaint,De=a.unstable_now,Ed=a.unstable_getCurrentPriorityLevel,Is=a.unstable_ImmediatePriority,Ji=a.unstable_UserBlockingPriority,yl=a.unstable_NormalPriority,Nd=a.unstable_LowPriority,qi=a.unstable_IdlePriority,vl=null,It=null;function _d(e){if(It&&typeof It.onCommitFiberRoot=="function")try{It.onCommitFiberRoot(vl,e,void 0,(e.current.flags&128)===128)}catch{}}var Nt=Math.clz32?Math.clz32:bd,Pd=Math.log,Td=Math.LN2;function bd(e){return e>>>=0,e===0?32:31-(Pd(e)/Td|0)|0}var jl=64,Sl=4194304;function Tr(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 wl(e,t){var n=e.pendingLanes;if(n===0)return 0;var l=0,o=e.suspendedLanes,i=e.pingedLanes,d=n&268435455;if(d!==0){var g=d&~o;g!==0?l=Tr(g):(i&=d,i!==0&&(l=Tr(i)))}else d=n&~o,d!==0?l=Tr(d):i!==0&&(l=Tr(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-Nt(t),o=1<<n,l|=e[n],t&=~o;return l}function Rd(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 Ld(e,t){for(var n=e.suspendedLanes,l=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var d=31-Nt(i),g=1<<d,j=o[d];j===-1?((g&n)===0||(g&l)!==0)&&(o[d]=Rd(g,t)):j<=t&&(e.expiredLanes|=g),i&=~g}}function As(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function Xi(){var e=jl;return jl<<=1,(jl&4194240)===0&&(jl=64),e}function Ds(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function br(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Nt(t),e[t]=n}function zd(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-Nt(n),i=1<<o;t[o]=0,l[o]=-1,e[o]=-1,n&=~i}}function Ms(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var l=31-Nt(n),o=1<<l;o&t|e[l]&t&&(e[l]|=t),n&=~o}}var Pe=0;function Zi(e){return e&=-e,1<e?4<e?(e&268435455)!==0?16:536870912:4:1}var ea,Os,ta,na,ra,Fs=!1,kl=[],Jt=null,qt=null,Xt=null,Rr=new Map,Lr=new Map,Zt=[],Id="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 la(e,t){switch(e){case"focusin":case"focusout":Jt=null;break;case"dragenter":case"dragleave":qt=null;break;case"mouseover":case"mouseout":Xt=null;break;case"pointerover":case"pointerout":Rr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lr.delete(t.pointerId)}}function zr(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=Qr(t),t!==null&&Os(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function Ad(e,t,n,l,o){switch(t){case"focusin":return Jt=zr(Jt,e,t,n,l,o),!0;case"dragenter":return qt=zr(qt,e,t,n,l,o),!0;case"mouseover":return Xt=zr(Xt,e,t,n,l,o),!0;case"pointerover":var i=o.pointerId;return Rr.set(i,zr(Rr.get(i)||null,e,t,n,l,o)),!0;case"gotpointercapture":return i=o.pointerId,Lr.set(i,zr(Lr.get(i)||null,e,t,n,l,o)),!0}return!1}function sa(e){var t=_n(e.target);if(t!==null){var n=Nn(t);if(n!==null){if(t=n.tag,t===13){if(t=Ki(n),t!==null){e.blockedOn=t,ra(e.priority,function(){ta(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 Cl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Us(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var l=new n.constructor(n.type,n);Ps=l,n.target.dispatchEvent(l),Ps=null}else return t=Qr(n),t!==null&&Os(t),e.blockedOn=n,!1;t.shift()}return!0}function oa(e,t,n){Cl(e)&&n.delete(t)}function Dd(){Fs=!1,Jt!==null&&Cl(Jt)&&(Jt=null),qt!==null&&Cl(qt)&&(qt=null),Xt!==null&&Cl(Xt)&&(Xt=null),Rr.forEach(oa),Lr.forEach(oa)}function Ir(e,t){e.blockedOn===t&&(e.blockedOn=null,Fs||(Fs=!0,a.unstable_scheduleCallback(a.unstable_NormalPriority,Dd)))}function Ar(e){function t(o){return Ir(o,e)}if(0<kl.length){Ir(kl[0],e);for(var n=1;n<kl.length;n++){var l=kl[n];l.blockedOn===e&&(l.blockedOn=null)}}for(Jt!==null&&Ir(Jt,e),qt!==null&&Ir(qt,e),Xt!==null&&Ir(Xt,e),Rr.forEach(t),Lr.forEach(t),n=0;n<Zt.length;n++)l=Zt[n],l.blockedOn===e&&(l.blockedOn=null);for(;0<Zt.length&&(n=Zt[0],n.blockedOn===null);)sa(n),n.blockedOn===null&&Zt.shift()}var Qn=Q.ReactCurrentBatchConfig,El=!0;function Md(e,t,n,l){var o=Pe,i=Qn.transition;Qn.transition=null;try{Pe=1,Bs(e,t,n,l)}finally{Pe=o,Qn.transition=i}}function Od(e,t,n,l){var o=Pe,i=Qn.transition;Qn.transition=null;try{Pe=4,Bs(e,t,n,l)}finally{Pe=o,Qn.transition=i}}function Bs(e,t,n,l){if(El){var o=Us(e,t,n,l);if(o===null)lo(e,t,l,Nl,n),la(e,l);else if(Ad(o,e,t,n,l))l.stopPropagation();else if(la(e,l),t&4&&-1<Id.indexOf(e)){for(;o!==null;){var i=Qr(o);if(i!==null&&ea(i),i=Us(e,t,n,l),i===null&&lo(e,t,l,Nl,n),i===o)break;o=i}o!==null&&l.stopPropagation()}else lo(e,t,l,null,n)}}var Nl=null;function Us(e,t,n,l){if(Nl=null,e=Ts(l),e=_n(e),e!==null)if(t=Nn(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Ki(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 Nl=e,null}function ia(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(Ed()){case Is:return 1;case Ji:return 4;case yl:case Nd:return 16;case qi:return 536870912;default:return 16}default:return 16}}var en=null,Ws=null,_l=null;function aa(){if(_l)return _l;var e,t=Ws,n=t.length,l,o="value"in en?en.value:en.textContent,i=o.length;for(e=0;e<n&&t[e]===o[e];e++);var d=n-e;for(l=1;l<=d&&t[n-l]===o[i-l];l++);return _l=o.slice(e,1<l?1-l:void 0)}function Pl(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 Tl(){return!0}function ca(){return!1}function ht(e){function t(n,l,o,i,d){this._reactName=n,this._targetInst=o,this.type=l,this.nativeEvent=i,this.target=d,this.currentTarget=null;for(var g in e)e.hasOwnProperty(g)&&(n=e[g],this[g]=n?n(i):i[g]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Tl:ca,this.isPropagationStopped=ca,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=Tl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Tl)},persist:function(){},isPersistent:Tl}),t}var Yn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$s=ht(Yn),Dr=B({},Yn,{view:0,detail:0}),Fd=ht(Dr),Ks,Vs,Mr,bl=B({},Dr,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Qs,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!==Mr&&(Mr&&e.type==="mousemove"?(Ks=e.screenX-Mr.screenX,Vs=e.screenY-Mr.screenY):Vs=Ks=0,Mr=e),Ks)},movementY:function(e){return"movementY"in e?e.movementY:Vs}}),ua=ht(bl),Bd=B({},bl,{dataTransfer:0}),Ud=ht(Bd),Wd=B({},Dr,{relatedTarget:0}),Hs=ht(Wd),$d=B({},Yn,{animationName:0,elapsedTime:0,pseudoElement:0}),Kd=ht($d),Vd=B({},Yn,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Hd=ht(Vd),Qd=B({},Yn,{data:0}),da=ht(Qd),Yd={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Gd={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"},Jd={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qd(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Jd[e])?!!t[e]:!1}function Qs(){return qd}var Xd=B({},Dr,{key:function(e){if(e.key){var t=Yd[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Pl(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Gd[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Qs,charCode:function(e){return e.type==="keypress"?Pl(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Pl(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Zd=ht(Xd),ep=B({},bl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),pa=ht(ep),tp=B({},Dr,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Qs}),np=ht(tp),rp=B({},Yn,{propertyName:0,elapsedTime:0,pseudoElement:0}),lp=ht(rp),sp=B({},bl,{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}),op=ht(sp),ip=[9,13,27,32],Ys=y&&"CompositionEvent"in window,Or=null;y&&"documentMode"in document&&(Or=document.documentMode);var ap=y&&"TextEvent"in window&&!Or,fa=y&&(!Ys||Or&&8<Or&&11>=Or),ha=" ",ma=!1;function ga(e,t){switch(e){case"keyup":return ip.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function xa(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Gn=!1;function cp(e,t){switch(e){case"compositionend":return xa(t);case"keypress":return t.which!==32?null:(ma=!0,ha);case"textInput":return e=t.data,e===ha&&ma?null:e;default:return null}}function up(e,t){if(Gn)return e==="compositionend"||!Ys&&ga(e,t)?(e=aa(),_l=Ws=en=null,Gn=!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 fa&&t.locale!=="ko"?null:t.data;default:return null}}var dp={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 ya(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!dp[e.type]:t==="textarea"}function va(e,t,n,l){Fi(l),t=Al(t,"onChange"),0<t.length&&(n=new $s("onChange","change",null,n,l),e.push({event:n,listeners:t}))}var Fr=null,Br=null;function pp(e){Ma(e,0)}function Rl(e){var t=er(e);if(hl(t))return e}function fp(e,t){if(e==="change")return t}var ja=!1;if(y){var Gs;if(y){var Js="oninput"in document;if(!Js){var Sa=document.createElement("div");Sa.setAttribute("oninput","return;"),Js=typeof Sa.oninput=="function"}Gs=Js}else Gs=!1;ja=Gs&&(!document.documentMode||9<document.documentMode)}function wa(){Fr&&(Fr.detachEvent("onpropertychange",ka),Br=Fr=null)}function ka(e){if(e.propertyName==="value"&&Rl(Br)){var t=[];va(t,Br,e,Ts(e)),$i(pp,t)}}function hp(e,t,n){e==="focusin"?(wa(),Fr=t,Br=n,Fr.attachEvent("onpropertychange",ka)):e==="focusout"&&wa()}function mp(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rl(Br)}function gp(e,t){if(e==="click")return Rl(t)}function xp(e,t){if(e==="input"||e==="change")return Rl(t)}function yp(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var _t=typeof Object.is=="function"?Object.is:yp;function Ur(e,t){if(_t(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(!E.call(t,o)||!_t(e[o],t[o]))return!1}return!0}function Ca(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Ea(e,t){var n=Ca(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=Ca(n)}}function Na(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Na(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function _a(){for(var e=window,t=Wn();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Wn(e.document)}return t}function qs(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 vp(e){var t=_a(),n=e.focusedElem,l=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Na(n.ownerDocument.documentElement,n)){if(l!==null&&qs(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=Ea(n,i);var d=Ea(n,l);o&&d&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==d.node||e.focusOffset!==d.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>l?(e.addRange(t),e.extend(d.node,d.offset)):(t.setEnd(d.node,d.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 jp=y&&"documentMode"in document&&11>=document.documentMode,Jn=null,Xs=null,Wr=null,Zs=!1;function Pa(e,t,n){var l=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Zs||Jn==null||Jn!==Wn(l)||(l=Jn,"selectionStart"in l&&qs(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}),Wr&&Ur(Wr,l)||(Wr=l,l=Al(Xs,"onSelect"),0<l.length&&(t=new $s("onSelect","select",null,t,n),e.push({event:t,listeners:l}),t.target=Jn)))}function Ll(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var qn={animationend:Ll("Animation","AnimationEnd"),animationiteration:Ll("Animation","AnimationIteration"),animationstart:Ll("Animation","AnimationStart"),transitionend:Ll("Transition","TransitionEnd")},eo={},Ta={};y&&(Ta=document.createElement("div").style,"AnimationEvent"in window||(delete qn.animationend.animation,delete qn.animationiteration.animation,delete qn.animationstart.animation),"TransitionEvent"in window||delete qn.transitionend.transition);function zl(e){if(eo[e])return eo[e];if(!qn[e])return e;var t=qn[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Ta)return eo[e]=t[n];return e}var ba=zl("animationend"),Ra=zl("animationiteration"),La=zl("animationstart"),za=zl("transitionend"),Ia=new Map,Aa="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 tn(e,t){Ia.set(e,t),h(t,[e])}for(var to=0;to<Aa.length;to++){var no=Aa[to],Sp=no.toLowerCase(),wp=no[0].toUpperCase()+no.slice(1);tn(Sp,"on"+wp)}tn(ba,"onAnimationEnd"),tn(Ra,"onAnimationIteration"),tn(La,"onAnimationStart"),tn("dblclick","onDoubleClick"),tn("focusin","onFocus"),tn("focusout","onBlur"),tn(za,"onTransitionEnd"),v("onMouseEnter",["mouseout","mouseover"]),v("onMouseLeave",["mouseout","mouseover"]),v("onPointerEnter",["pointerout","pointerover"]),v("onPointerLeave",["pointerout","pointerover"]),h("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),h("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),h("onBeforeInput",["compositionend","keypress","textInput","paste"]),h("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),h("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),h("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $r="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($r));function Da(e,t,n){var l=e.type||"unknown-event";e.currentTarget=n,Sd(l,t,void 0,e),e.currentTarget=null}function Ma(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 d=l.length-1;0<=d;d--){var g=l[d],j=g.instance,R=g.currentTarget;if(g=g.listener,j!==i&&o.isPropagationStopped())break e;Da(o,g,R),i=j}else for(d=0;d<l.length;d++){if(g=l[d],j=g.instance,R=g.currentTarget,g=g.listener,j!==i&&o.isPropagationStopped())break e;Da(o,g,R),i=j}}}if(xl)throw e=zs,xl=!1,zs=null,e}function be(e,t){var n=t[uo];n===void 0&&(n=t[uo]=new Set);var l=e+"__bubble";n.has(l)||(Oa(t,e,2,!1),n.add(l))}function ro(e,t,n){var l=0;t&&(l|=4),Oa(n,e,l,t)}var Il="_reactListening"+Math.random().toString(36).slice(2);function Kr(e){if(!e[Il]){e[Il]=!0,u.forEach(function(n){n!=="selectionchange"&&(kp.has(n)||ro(n,!1,e),ro(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Il]||(t[Il]=!0,ro("selectionchange",!1,t))}}function Oa(e,t,n,l){switch(ia(t)){case 1:var o=Md;break;case 4:o=Od;break;default:o=Bs}n=o.bind(null,t,n,e),o=void 0,!Ls||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 lo(e,t,n,l,o){var i=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var d=l.tag;if(d===3||d===4){var g=l.stateNode.containerInfo;if(g===o||g.nodeType===8&&g.parentNode===o)break;if(d===4)for(d=l.return;d!==null;){var j=d.tag;if((j===3||j===4)&&(j=d.stateNode.containerInfo,j===o||j.nodeType===8&&j.parentNode===o))return;d=d.return}for(;g!==null;){if(d=_n(g),d===null)return;if(j=d.tag,j===5||j===6){l=i=d;continue e}g=g.parentNode}}l=l.return}$i(function(){var R=i,$=Ts(n),Y=[];e:{var U=Ia.get(e);if(U!==void 0){var se=$s,ie=e;switch(e){case"keypress":if(Pl(n)===0)break e;case"keydown":case"keyup":se=Zd;break;case"focusin":ie="focus",se=Hs;break;case"focusout":ie="blur",se=Hs;break;case"beforeblur":case"afterblur":se=Hs;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":se=ua;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=Ud;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=np;break;case ba:case Ra:case La:se=Kd;break;case za:se=lp;break;case"scroll":se=Fd;break;case"wheel":se=op;break;case"copy":case"cut":case"paste":se=Hd;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=pa}var ae=(t&4)!==0,Me=!ae&&e==="scroll",_=ae?U!==null?U+"Capture":null:U;ae=[];for(var C=R,T;C!==null;){T=C;var q=T.stateNode;if(T.tag===5&&q!==null&&(T=q,_!==null&&(q=Nr(C,_),q!=null&&ae.push(Vr(C,q,T)))),Me)break;C=C.return}0<ae.length&&(U=new se(U,ie,null,n,$),Y.push({event:U,listeners:ae}))}}if((t&7)===0){e:{if(U=e==="mouseover"||e==="pointerover",se=e==="mouseout"||e==="pointerout",U&&n!==Ps&&(ie=n.relatedTarget||n.fromElement)&&(_n(ie)||ie[Bt]))break e;if((se||U)&&(U=$.window===$?$:(U=$.ownerDocument)?U.defaultView||U.parentWindow:window,se?(ie=n.relatedTarget||n.toElement,se=R,ie=ie?_n(ie):null,ie!==null&&(Me=Nn(ie),ie!==Me||ie.tag!==5&&ie.tag!==6)&&(ie=null)):(se=null,ie=R),se!==ie)){if(ae=ua,q="onMouseLeave",_="onMouseEnter",C="mouse",(e==="pointerout"||e==="pointerover")&&(ae=pa,q="onPointerLeave",_="onPointerEnter",C="pointer"),Me=se==null?U:er(se),T=ie==null?U:er(ie),U=new ae(q,C+"leave",se,n,$),U.target=Me,U.relatedTarget=T,q=null,_n($)===R&&(ae=new ae(_,C+"enter",ie,n,$),ae.target=T,ae.relatedTarget=Me,q=ae),Me=q,se&&ie)t:{for(ae=se,_=ie,C=0,T=ae;T;T=Xn(T))C++;for(T=0,q=_;q;q=Xn(q))T++;for(;0<C-T;)ae=Xn(ae),C--;for(;0<T-C;)_=Xn(_),T--;for(;C--;){if(ae===_||_!==null&&ae===_.alternate)break t;ae=Xn(ae),_=Xn(_)}ae=null}else ae=null;se!==null&&Fa(Y,U,se,ae,!1),ie!==null&&Me!==null&&Fa(Y,Me,ie,ae,!0)}}e:{if(U=R?er(R):window,se=U.nodeName&&U.nodeName.toLowerCase(),se==="select"||se==="input"&&U.type==="file")var ue=fp;else if(ya(U))if(ja)ue=xp;else{ue=mp;var fe=hp}else(se=U.nodeName)&&se.toLowerCase()==="input"&&(U.type==="checkbox"||U.type==="radio")&&(ue=gp);if(ue&&(ue=ue(e,R))){va(Y,ue,n,$);break e}fe&&fe(e,U,R),e==="focusout"&&(fe=U._wrapperState)&&fe.controlled&&U.type==="number"&&kr(U,"number",U.value)}switch(fe=R?er(R):window,e){case"focusin":(ya(fe)||fe.contentEditable==="true")&&(Jn=fe,Xs=R,Wr=null);break;case"focusout":Wr=Xs=Jn=null;break;case"mousedown":Zs=!0;break;case"contextmenu":case"mouseup":case"dragend":Zs=!1,Pa(Y,n,$);break;case"selectionchange":if(jp)break;case"keydown":case"keyup":Pa(Y,n,$)}var he;if(Ys)e:{switch(e){case"compositionstart":var xe="onCompositionStart";break e;case"compositionend":xe="onCompositionEnd";break e;case"compositionupdate":xe="onCompositionUpdate";break e}xe=void 0}else Gn?ga(e,n)&&(xe="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(xe="onCompositionStart");xe&&(fa&&n.locale!=="ko"&&(Gn||xe!=="onCompositionStart"?xe==="onCompositionEnd"&&Gn&&(he=aa()):(en=$,Ws="value"in en?en.value:en.textContent,Gn=!0)),fe=Al(R,xe),0<fe.length&&(xe=new da(xe,e,null,n,$),Y.push({event:xe,listeners:fe}),he?xe.data=he:(he=xa(n),he!==null&&(xe.data=he)))),(he=ap?cp(e,n):up(e,n))&&(R=Al(R,"onBeforeInput"),0<R.length&&($=new da("onBeforeInput","beforeinput",null,n,$),Y.push({event:$,listeners:R}),$.data=he))}Ma(Y,t)})}function Vr(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Al(e,t){for(var n=t+"Capture",l=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Nr(e,n),i!=null&&l.unshift(Vr(e,i,o)),i=Nr(e,t),i!=null&&l.push(Vr(e,i,o))),e=e.return}return l}function Xn(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function Fa(e,t,n,l,o){for(var i=t._reactName,d=[];n!==null&&n!==l;){var g=n,j=g.alternate,R=g.stateNode;if(j!==null&&j===l)break;g.tag===5&&R!==null&&(g=R,o?(j=Nr(n,i),j!=null&&d.unshift(Vr(n,j,g))):o||(j=Nr(n,i),j!=null&&d.push(Vr(n,j,g)))),n=n.return}d.length!==0&&e.push({event:t,listeners:d})}var Cp=/\r\n?/g,Ep=/\u0000|\uFFFD/g;function Ba(e){return(typeof e=="string"?e:""+e).replace(Cp,`
|
|
38
|
+
`).replace(Ep,"")}function Dl(e,t,n){if(t=Ba(t),Ba(e)!==t&&n)throw Error(c(425))}function Ml(){}var so=null,oo=null;function io(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 ao=typeof setTimeout=="function"?setTimeout:void 0,Np=typeof clearTimeout=="function"?clearTimeout:void 0,Ua=typeof Promise=="function"?Promise:void 0,_p=typeof queueMicrotask=="function"?queueMicrotask:typeof Ua<"u"?function(e){return Ua.resolve(null).then(e).catch(Pp)}:ao;function Pp(e){setTimeout(function(){throw e})}function co(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),Ar(t);return}l--}else n!=="$"&&n!=="$?"&&n!=="$!"||l++;n=o}while(n);Ar(t)}function nn(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 Wa(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 Zn=Math.random().toString(36).slice(2),At="__reactFiber$"+Zn,Hr="__reactProps$"+Zn,Bt="__reactContainer$"+Zn,uo="__reactEvents$"+Zn,Tp="__reactListeners$"+Zn,bp="__reactHandles$"+Zn;function _n(e){var t=e[At];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Bt]||n[At]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=Wa(e);e!==null;){if(n=e[At])return n;e=Wa(e)}return t}e=n,n=e.parentNode}return null}function Qr(e){return e=e[At]||e[Bt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function er(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(c(33))}function Ol(e){return e[Hr]||null}var po=[],tr=-1;function rn(e){return{current:e}}function Re(e){0>tr||(e.current=po[tr],po[tr]=null,tr--)}function Te(e,t){tr++,po[tr]=e.current,e.current=t}var ln={},Ze=rn(ln),ot=rn(!1),Pn=ln;function nr(e,t){var n=e.type.contextTypes;if(!n)return ln;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 it(e){return e=e.childContextTypes,e!=null}function Fl(){Re(ot),Re(Ze)}function $a(e,t,n){if(Ze.current!==ln)throw Error(c(168));Te(Ze,t),Te(ot,n)}function Ka(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,ke(e)||"Unknown",o));return B({},n,l)}function Bl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||ln,Pn=Ze.current,Te(Ze,e),Te(ot,ot.current),!0}function Va(e,t,n){var l=e.stateNode;if(!l)throw Error(c(169));n?(e=Ka(e,t,Pn),l.__reactInternalMemoizedMergedChildContext=e,Re(ot),Re(Ze),Te(Ze,e)):Re(ot),Te(ot,n)}var Ut=null,Ul=!1,fo=!1;function Ha(e){Ut===null?Ut=[e]:Ut.push(e)}function Rp(e){Ul=!0,Ha(e)}function sn(){if(!fo&&Ut!==null){fo=!0;var e=0,t=Pe;try{var n=Ut;for(Pe=1;e<n.length;e++){var l=n[e];do l=l(!0);while(l!==null)}Ut=null,Ul=!1}catch(o){throw Ut!==null&&(Ut=Ut.slice(e+1)),Yi(Is,sn),o}finally{Pe=t,fo=!1}}return null}var rr=[],lr=0,Wl=null,$l=0,jt=[],St=0,Tn=null,Wt=1,$t="";function bn(e,t){rr[lr++]=$l,rr[lr++]=Wl,Wl=e,$l=t}function Qa(e,t,n){jt[St++]=Wt,jt[St++]=$t,jt[St++]=Tn,Tn=e;var l=Wt;e=$t;var o=32-Nt(l)-1;l&=~(1<<o),n+=1;var i=32-Nt(t)+o;if(30<i){var d=o-o%5;i=(l&(1<<d)-1).toString(32),l>>=d,o-=d,Wt=1<<32-Nt(t)+o|n<<o|l,$t=i+e}else Wt=1<<i|n<<o|l,$t=e}function ho(e){e.return!==null&&(bn(e,1),Qa(e,1,0))}function mo(e){for(;e===Wl;)Wl=rr[--lr],rr[lr]=null,$l=rr[--lr],rr[lr]=null;for(;e===Tn;)Tn=jt[--St],jt[St]=null,$t=jt[--St],jt[St]=null,Wt=jt[--St],jt[St]=null}var mt=null,gt=null,Le=!1,Pt=null;function Ya(e,t){var n=Et(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 Ga(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,mt=e,gt=nn(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,mt=e,gt=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Tn!==null?{id:Wt,overflow:$t}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Et(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,mt=e,gt=null,!0):!1;default:return!1}}function go(e){return(e.mode&1)!==0&&(e.flags&128)===0}function xo(e){if(Le){var t=gt;if(t){var n=t;if(!Ga(e,t)){if(go(e))throw Error(c(418));t=nn(n.nextSibling);var l=mt;t&&Ga(e,t)?Ya(l,n):(e.flags=e.flags&-4097|2,Le=!1,mt=e)}}else{if(go(e))throw Error(c(418));e.flags=e.flags&-4097|2,Le=!1,mt=e}}}function Ja(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;mt=e}function Kl(e){if(e!==mt)return!1;if(!Le)return Ja(e),Le=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!io(e.type,e.memoizedProps)),t&&(t=gt)){if(go(e))throw qa(),Error(c(418));for(;t;)Ya(e,t),t=nn(t.nextSibling)}if(Ja(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){gt=nn(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}gt=null}}else gt=mt?nn(e.stateNode.nextSibling):null;return!0}function qa(){for(var e=gt;e;)e=nn(e.nextSibling)}function sr(){gt=mt=null,Le=!1}function yo(e){Pt===null?Pt=[e]:Pt.push(e)}var Lp=Q.ReactCurrentBatchConfig;function Yr(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(d){var g=o.refs;d===null?delete g[i]:g[i]=d},t._stringRef=i,t)}if(typeof e!="string")throw Error(c(284));if(!n._owner)throw Error(c(290,e))}return e}function Vl(e,t){throw e=Object.prototype.toString.call(t),Error(c(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Xa(e){var t=e._init;return t(e._payload)}function Za(e){function t(_,C){if(e){var T=_.deletions;T===null?(_.deletions=[C],_.flags|=16):T.push(C)}}function n(_,C){if(!e)return null;for(;C!==null;)t(_,C),C=C.sibling;return null}function l(_,C){for(_=new Map;C!==null;)C.key!==null?_.set(C.key,C):_.set(C.index,C),C=C.sibling;return _}function o(_,C){return _=hn(_,C),_.index=0,_.sibling=null,_}function i(_,C,T){return _.index=T,e?(T=_.alternate,T!==null?(T=T.index,T<C?(_.flags|=2,C):T):(_.flags|=2,C)):(_.flags|=1048576,C)}function d(_){return e&&_.alternate===null&&(_.flags|=2),_}function g(_,C,T,q){return C===null||C.tag!==6?(C=ci(T,_.mode,q),C.return=_,C):(C=o(C,T),C.return=_,C)}function j(_,C,T,q){var ue=T.type;return ue===te?$(_,C,T.props.children,q,T.key):C!==null&&(C.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===ve&&Xa(ue)===C.type)?(q=o(C,T.props),q.ref=Yr(_,C,T),q.return=_,q):(q=ms(T.type,T.key,T.props,null,_.mode,q),q.ref=Yr(_,C,T),q.return=_,q)}function R(_,C,T,q){return C===null||C.tag!==4||C.stateNode.containerInfo!==T.containerInfo||C.stateNode.implementation!==T.implementation?(C=ui(T,_.mode,q),C.return=_,C):(C=o(C,T.children||[]),C.return=_,C)}function $(_,C,T,q,ue){return C===null||C.tag!==7?(C=On(T,_.mode,q,ue),C.return=_,C):(C=o(C,T),C.return=_,C)}function Y(_,C,T){if(typeof C=="string"&&C!==""||typeof C=="number")return C=ci(""+C,_.mode,T),C.return=_,C;if(typeof C=="object"&&C!==null){switch(C.$$typeof){case G:return T=ms(C.type,C.key,C.props,null,_.mode,T),T.ref=Yr(_,null,C),T.return=_,T;case F:return C=ui(C,_.mode,T),C.return=_,C;case ve:var q=C._init;return Y(_,q(C._payload),T)}if(Sn(C)||Z(C))return C=On(C,_.mode,T,null),C.return=_,C;Vl(_,C)}return null}function U(_,C,T,q){var ue=C!==null?C.key:null;if(typeof T=="string"&&T!==""||typeof T=="number")return ue!==null?null:g(_,C,""+T,q);if(typeof T=="object"&&T!==null){switch(T.$$typeof){case G:return T.key===ue?j(_,C,T,q):null;case F:return T.key===ue?R(_,C,T,q):null;case ve:return ue=T._init,U(_,C,ue(T._payload),q)}if(Sn(T)||Z(T))return ue!==null?null:$(_,C,T,q,null);Vl(_,T)}return null}function se(_,C,T,q,ue){if(typeof q=="string"&&q!==""||typeof q=="number")return _=_.get(T)||null,g(C,_,""+q,ue);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case G:return _=_.get(q.key===null?T:q.key)||null,j(C,_,q,ue);case F:return _=_.get(q.key===null?T:q.key)||null,R(C,_,q,ue);case ve:var fe=q._init;return se(_,C,T,fe(q._payload),ue)}if(Sn(q)||Z(q))return _=_.get(T)||null,$(C,_,q,ue,null);Vl(C,q)}return null}function ie(_,C,T,q){for(var ue=null,fe=null,he=C,xe=C=0,Qe=null;he!==null&&xe<T.length;xe++){he.index>xe?(Qe=he,he=null):Qe=he.sibling;var _e=U(_,he,T[xe],q);if(_e===null){he===null&&(he=Qe);break}e&&he&&_e.alternate===null&&t(_,he),C=i(_e,C,xe),fe===null?ue=_e:fe.sibling=_e,fe=_e,he=Qe}if(xe===T.length)return n(_,he),Le&&bn(_,xe),ue;if(he===null){for(;xe<T.length;xe++)he=Y(_,T[xe],q),he!==null&&(C=i(he,C,xe),fe===null?ue=he:fe.sibling=he,fe=he);return Le&&bn(_,xe),ue}for(he=l(_,he);xe<T.length;xe++)Qe=se(he,_,xe,T[xe],q),Qe!==null&&(e&&Qe.alternate!==null&&he.delete(Qe.key===null?xe:Qe.key),C=i(Qe,C,xe),fe===null?ue=Qe:fe.sibling=Qe,fe=Qe);return e&&he.forEach(function(mn){return t(_,mn)}),Le&&bn(_,xe),ue}function ae(_,C,T,q){var ue=Z(T);if(typeof ue!="function")throw Error(c(150));if(T=ue.call(T),T==null)throw Error(c(151));for(var fe=ue=null,he=C,xe=C=0,Qe=null,_e=T.next();he!==null&&!_e.done;xe++,_e=T.next()){he.index>xe?(Qe=he,he=null):Qe=he.sibling;var mn=U(_,he,_e.value,q);if(mn===null){he===null&&(he=Qe);break}e&&he&&mn.alternate===null&&t(_,he),C=i(mn,C,xe),fe===null?ue=mn:fe.sibling=mn,fe=mn,he=Qe}if(_e.done)return n(_,he),Le&&bn(_,xe),ue;if(he===null){for(;!_e.done;xe++,_e=T.next())_e=Y(_,_e.value,q),_e!==null&&(C=i(_e,C,xe),fe===null?ue=_e:fe.sibling=_e,fe=_e);return Le&&bn(_,xe),ue}for(he=l(_,he);!_e.done;xe++,_e=T.next())_e=se(he,_,xe,_e.value,q),_e!==null&&(e&&_e.alternate!==null&&he.delete(_e.key===null?xe:_e.key),C=i(_e,C,xe),fe===null?ue=_e:fe.sibling=_e,fe=_e);return e&&he.forEach(function(pf){return t(_,pf)}),Le&&bn(_,xe),ue}function Me(_,C,T,q){if(typeof T=="object"&&T!==null&&T.type===te&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case G:e:{for(var ue=T.key,fe=C;fe!==null;){if(fe.key===ue){if(ue=T.type,ue===te){if(fe.tag===7){n(_,fe.sibling),C=o(fe,T.props.children),C.return=_,_=C;break e}}else if(fe.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===ve&&Xa(ue)===fe.type){n(_,fe.sibling),C=o(fe,T.props),C.ref=Yr(_,fe,T),C.return=_,_=C;break e}n(_,fe);break}else t(_,fe);fe=fe.sibling}T.type===te?(C=On(T.props.children,_.mode,q,T.key),C.return=_,_=C):(q=ms(T.type,T.key,T.props,null,_.mode,q),q.ref=Yr(_,C,T),q.return=_,_=q)}return d(_);case F:e:{for(fe=T.key;C!==null;){if(C.key===fe)if(C.tag===4&&C.stateNode.containerInfo===T.containerInfo&&C.stateNode.implementation===T.implementation){n(_,C.sibling),C=o(C,T.children||[]),C.return=_,_=C;break e}else{n(_,C);break}else t(_,C);C=C.sibling}C=ui(T,_.mode,q),C.return=_,_=C}return d(_);case ve:return fe=T._init,Me(_,C,fe(T._payload),q)}if(Sn(T))return ie(_,C,T,q);if(Z(T))return ae(_,C,T,q);Vl(_,T)}return typeof T=="string"&&T!==""||typeof T=="number"?(T=""+T,C!==null&&C.tag===6?(n(_,C.sibling),C=o(C,T),C.return=_,_=C):(n(_,C),C=ci(T,_.mode,q),C.return=_,_=C),d(_)):n(_,C)}return Me}var or=Za(!0),ec=Za(!1),Hl=rn(null),Ql=null,ir=null,vo=null;function jo(){vo=ir=Ql=null}function So(e){var t=Hl.current;Re(Hl),e._currentValue=t}function wo(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 ar(e,t){Ql=e,vo=ir=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(at=!0),e.firstContext=null)}function wt(e){var t=e._currentValue;if(vo!==e)if(e={context:e,memoizedValue:t,next:null},ir===null){if(Ql===null)throw Error(c(308));ir=e,Ql.dependencies={lanes:0,firstContext:e}}else ir=ir.next=e;return t}var Rn=null;function ko(e){Rn===null?Rn=[e]:Rn.push(e)}function tc(e,t,n,l){var o=t.interleaved;return o===null?(n.next=n,ko(t)):(n.next=o.next,o.next=n),t.interleaved=n,Kt(e,l)}function Kt(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 on=!1;function Co(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function nc(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 Vt(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function an(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,Kt(e,n)}return o=l.interleaved,o===null?(t.next=t,ko(l)):(t.next=o.next,o.next=t),l.interleaved=t,Kt(e,n)}function Yl(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,Ms(e,n)}}function rc(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 d={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=d:i=i.next=d,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 Gl(e,t,n,l){var o=e.updateQueue;on=!1;var i=o.firstBaseUpdate,d=o.lastBaseUpdate,g=o.shared.pending;if(g!==null){o.shared.pending=null;var j=g,R=j.next;j.next=null,d===null?i=R:d.next=R,d=j;var $=e.alternate;$!==null&&($=$.updateQueue,g=$.lastBaseUpdate,g!==d&&(g===null?$.firstBaseUpdate=R:g.next=R,$.lastBaseUpdate=j))}if(i!==null){var Y=o.baseState;d=0,$=R=j=null,g=i;do{var U=g.lane,se=g.eventTime;if((l&U)===U){$!==null&&($=$.next={eventTime:se,lane:0,tag:g.tag,payload:g.payload,callback:g.callback,next:null});e:{var ie=e,ae=g;switch(U=t,se=n,ae.tag){case 1:if(ie=ae.payload,typeof ie=="function"){Y=ie.call(se,Y,U);break e}Y=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=ae.payload,U=typeof ie=="function"?ie.call(se,Y,U):ie,U==null)break e;Y=B({},Y,U);break e;case 2:on=!0}}g.callback!==null&&g.lane!==0&&(e.flags|=64,U=o.effects,U===null?o.effects=[g]:U.push(g))}else se={eventTime:se,lane:U,tag:g.tag,payload:g.payload,callback:g.callback,next:null},$===null?(R=$=se,j=Y):$=$.next=se,d|=U;if(g=g.next,g===null){if(g=o.shared.pending,g===null)break;U=g,g=U.next,U.next=null,o.lastBaseUpdate=U,o.shared.pending=null}}while(!0);if($===null&&(j=Y),o.baseState=j,o.firstBaseUpdate=R,o.lastBaseUpdate=$,t=o.shared.interleaved,t!==null){o=t;do d|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);In|=d,e.lanes=d,e.memoizedState=Y}}function lc(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 Gr={},Dt=rn(Gr),Jr=rn(Gr),qr=rn(Gr);function Ln(e){if(e===Gr)throw Error(c(174));return e}function Eo(e,t){switch(Te(qr,t),Te(Jr,e),Te(Dt,Gr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Ke(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Ke(t,e)}Re(Dt),Te(Dt,t)}function cr(){Re(Dt),Re(Jr),Re(qr)}function sc(e){Ln(qr.current);var t=Ln(Dt.current),n=Ke(t,e.type);t!==n&&(Te(Jr,e),Te(Dt,n))}function No(e){Jr.current===e&&(Re(Dt),Re(Jr))}var ze=rn(0);function Jl(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 _o=[];function Po(){for(var e=0;e<_o.length;e++)_o[e]._workInProgressVersionPrimary=null;_o.length=0}var ql=Q.ReactCurrentDispatcher,To=Q.ReactCurrentBatchConfig,zn=0,Ie=null,Be=null,Ve=null,Xl=!1,Xr=!1,Zr=0,zp=0;function et(){throw Error(c(321))}function bo(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!_t(e[n],t[n]))return!1;return!0}function Ro(e,t,n,l,o,i){if(zn=i,Ie=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,ql.current=e===null||e.memoizedState===null?Mp:Op,e=n(l,o),Xr){i=0;do{if(Xr=!1,Zr=0,25<=i)throw Error(c(301));i+=1,Ve=Be=null,t.updateQueue=null,ql.current=Fp,e=n(l,o)}while(Xr)}if(ql.current=ts,t=Be!==null&&Be.next!==null,zn=0,Ve=Be=Ie=null,Xl=!1,t)throw Error(c(300));return e}function Lo(){var e=Zr!==0;return Zr=0,e}function Mt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ve===null?Ie.memoizedState=Ve=e:Ve=Ve.next=e,Ve}function kt(){if(Be===null){var e=Ie.alternate;e=e!==null?e.memoizedState:null}else e=Be.next;var t=Ve===null?Ie.memoizedState:Ve.next;if(t!==null)Ve=t,Be=e;else{if(e===null)throw Error(c(310));Be=e,e={memoizedState:Be.memoizedState,baseState:Be.baseState,baseQueue:Be.baseQueue,queue:Be.queue,next:null},Ve===null?Ie.memoizedState=Ve=e:Ve=Ve.next=e}return Ve}function el(e,t){return typeof t=="function"?t(e):t}function zo(e){var t=kt(),n=t.queue;if(n===null)throw Error(c(311));n.lastRenderedReducer=e;var l=Be,o=l.baseQueue,i=n.pending;if(i!==null){if(o!==null){var d=o.next;o.next=i.next,i.next=d}l.baseQueue=o=i,n.pending=null}if(o!==null){i=o.next,l=l.baseState;var g=d=null,j=null,R=i;do{var $=R.lane;if((zn&$)===$)j!==null&&(j=j.next={lane:0,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null}),l=R.hasEagerState?R.eagerState:e(l,R.action);else{var Y={lane:$,action:R.action,hasEagerState:R.hasEagerState,eagerState:R.eagerState,next:null};j===null?(g=j=Y,d=l):j=j.next=Y,Ie.lanes|=$,In|=$}R=R.next}while(R!==null&&R!==i);j===null?d=l:j.next=g,_t(l,t.memoizedState)||(at=!0),t.memoizedState=l,t.baseState=d,t.baseQueue=j,n.lastRenderedState=l}if(e=n.interleaved,e!==null){o=e;do i=o.lane,Ie.lanes|=i,In|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Io(e){var t=kt(),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 d=o=o.next;do i=e(i,d.action),d=d.next;while(d!==o);_t(i,t.memoizedState)||(at=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,l]}function oc(){}function ic(e,t){var n=Ie,l=kt(),o=t(),i=!_t(l.memoizedState,o);if(i&&(l.memoizedState=o,at=!0),l=l.queue,Ao(uc.bind(null,n,l,e),[e]),l.getSnapshot!==t||i||Ve!==null&&Ve.memoizedState.tag&1){if(n.flags|=2048,tl(9,cc.bind(null,n,l,o,t),void 0,null),He===null)throw Error(c(349));(zn&30)!==0||ac(n,t,o)}return o}function ac(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ie.updateQueue,t===null?(t={lastEffect:null,stores:null},Ie.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function cc(e,t,n,l){t.value=n,t.getSnapshot=l,dc(t)&&pc(e)}function uc(e,t,n){return n(function(){dc(t)&&pc(e)})}function dc(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!_t(e,n)}catch{return!0}}function pc(e){var t=Kt(e,1);t!==null&&Lt(t,e,1,-1)}function fc(e){var t=Mt();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:el,lastRenderedState:e},t.queue=e,e=e.dispatch=Dp.bind(null,Ie,e),[t.memoizedState,e]}function tl(e,t,n,l){return e={tag:e,create:t,destroy:n,deps:l,next:null},t=Ie.updateQueue,t===null?(t={lastEffect:null,stores:null},Ie.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 hc(){return kt().memoizedState}function Zl(e,t,n,l){var o=Mt();Ie.flags|=e,o.memoizedState=tl(1|t,n,void 0,l===void 0?null:l)}function es(e,t,n,l){var o=kt();l=l===void 0?null:l;var i=void 0;if(Be!==null){var d=Be.memoizedState;if(i=d.destroy,l!==null&&bo(l,d.deps)){o.memoizedState=tl(t,n,i,l);return}}Ie.flags|=e,o.memoizedState=tl(1|t,n,i,l)}function mc(e,t){return Zl(8390656,8,e,t)}function Ao(e,t){return es(2048,8,e,t)}function gc(e,t){return es(4,2,e,t)}function xc(e,t){return es(4,4,e,t)}function yc(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 vc(e,t,n){return n=n!=null?n.concat([e]):null,es(4,4,yc.bind(null,t,e),n)}function Do(){}function jc(e,t){var n=kt();t=t===void 0?null:t;var l=n.memoizedState;return l!==null&&t!==null&&bo(t,l[1])?l[0]:(n.memoizedState=[e,t],e)}function Sc(e,t){var n=kt();t=t===void 0?null:t;var l=n.memoizedState;return l!==null&&t!==null&&bo(t,l[1])?l[0]:(e=e(),n.memoizedState=[e,t],e)}function wc(e,t,n){return(zn&21)===0?(e.baseState&&(e.baseState=!1,at=!0),e.memoizedState=n):(_t(n,t)||(n=Xi(),Ie.lanes|=n,In|=n,e.baseState=!0),t)}function Ip(e,t){var n=Pe;Pe=n!==0&&4>n?n:4,e(!0);var l=To.transition;To.transition={};try{e(!1),t()}finally{Pe=n,To.transition=l}}function kc(){return kt().memoizedState}function Ap(e,t,n){var l=pn(e);if(n={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null},Cc(e))Ec(t,n);else if(n=tc(e,t,n,l),n!==null){var o=st();Lt(n,e,l,o),Nc(n,t,l)}}function Dp(e,t,n){var l=pn(e),o={lane:l,action:n,hasEagerState:!1,eagerState:null,next:null};if(Cc(e))Ec(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var d=t.lastRenderedState,g=i(d,n);if(o.hasEagerState=!0,o.eagerState=g,_t(g,d)){var j=t.interleaved;j===null?(o.next=o,ko(t)):(o.next=j.next,j.next=o),t.interleaved=o;return}}catch{}finally{}n=tc(e,t,o,l),n!==null&&(o=st(),Lt(n,e,l,o),Nc(n,t,l))}}function Cc(e){var t=e.alternate;return e===Ie||t!==null&&t===Ie}function Ec(e,t){Xr=Xl=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Nc(e,t,n){if((n&4194240)!==0){var l=t.lanes;l&=e.pendingLanes,n|=l,t.lanes=n,Ms(e,n)}}var ts={readContext:wt,useCallback:et,useContext:et,useEffect:et,useImperativeHandle:et,useInsertionEffect:et,useLayoutEffect:et,useMemo:et,useReducer:et,useRef:et,useState:et,useDebugValue:et,useDeferredValue:et,useTransition:et,useMutableSource:et,useSyncExternalStore:et,useId:et,unstable_isNewReconciler:!1},Mp={readContext:wt,useCallback:function(e,t){return Mt().memoizedState=[e,t===void 0?null:t],e},useContext:wt,useEffect:mc,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Zl(4194308,4,yc.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Zl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Zl(4,2,e,t)},useMemo:function(e,t){var n=Mt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var l=Mt();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=Ap.bind(null,Ie,e),[l.memoizedState,e]},useRef:function(e){var t=Mt();return e={current:e},t.memoizedState=e},useState:fc,useDebugValue:Do,useDeferredValue:function(e){return Mt().memoizedState=e},useTransition:function(){var e=fc(!1),t=e[0];return e=Ip.bind(null,e[1]),Mt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var l=Ie,o=Mt();if(Le){if(n===void 0)throw Error(c(407));n=n()}else{if(n=t(),He===null)throw Error(c(349));(zn&30)!==0||ac(l,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,mc(uc.bind(null,l,i,e),[e]),l.flags|=2048,tl(9,cc.bind(null,l,i,n,t),void 0,null),n},useId:function(){var e=Mt(),t=He.identifierPrefix;if(Le){var n=$t,l=Wt;n=(l&~(1<<32-Nt(l)-1)).toString(32)+n,t=":"+t+"R"+n,n=Zr++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=zp++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Op={readContext:wt,useCallback:jc,useContext:wt,useEffect:Ao,useImperativeHandle:vc,useInsertionEffect:gc,useLayoutEffect:xc,useMemo:Sc,useReducer:zo,useRef:hc,useState:function(){return zo(el)},useDebugValue:Do,useDeferredValue:function(e){var t=kt();return wc(t,Be.memoizedState,e)},useTransition:function(){var e=zo(el)[0],t=kt().memoizedState;return[e,t]},useMutableSource:oc,useSyncExternalStore:ic,useId:kc,unstable_isNewReconciler:!1},Fp={readContext:wt,useCallback:jc,useContext:wt,useEffect:Ao,useImperativeHandle:vc,useInsertionEffect:gc,useLayoutEffect:xc,useMemo:Sc,useReducer:Io,useRef:hc,useState:function(){return Io(el)},useDebugValue:Do,useDeferredValue:function(e){var t=kt();return Be===null?t.memoizedState=e:wc(t,Be.memoizedState,e)},useTransition:function(){var e=Io(el)[0],t=kt().memoizedState;return[e,t]},useMutableSource:oc,useSyncExternalStore:ic,useId:kc,unstable_isNewReconciler:!1};function Tt(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 Mo(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 ns={isMounted:function(e){return(e=e._reactInternals)?Nn(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var l=st(),o=pn(e),i=Vt(l,o);i.payload=t,n!=null&&(i.callback=n),t=an(e,i,o),t!==null&&(Lt(t,e,o,l),Yl(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var l=st(),o=pn(e),i=Vt(l,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=an(e,i,o),t!==null&&(Lt(t,e,o,l),Yl(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=st(),l=pn(e),o=Vt(n,l);o.tag=2,t!=null&&(o.callback=t),t=an(e,o,l),t!==null&&(Lt(t,e,l,n),Yl(t,e,l))}};function _c(e,t,n,l,o,i,d){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,i,d):t.prototype&&t.prototype.isPureReactComponent?!Ur(n,l)||!Ur(o,i):!0}function Pc(e,t,n){var l=!1,o=ln,i=t.contextType;return typeof i=="object"&&i!==null?i=wt(i):(o=it(t)?Pn:Ze.current,l=t.contextTypes,i=(l=l!=null)?nr(e,o):ln),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=ns,e.stateNode=t,t._reactInternals=e,l&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function Tc(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&&ns.enqueueReplaceState(t,t.state,null)}function Oo(e,t,n,l){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs={},Co(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=wt(i):(i=it(t)?Pn:Ze.current,o.context=nr(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(Mo(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&&ns.enqueueReplaceState(o,o.state,null),Gl(e,n,o,l),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function ur(e,t){try{var n="",l=t;do n+=de(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 Fo(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Bo(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var Bp=typeof WeakMap=="function"?WeakMap:Map;function bc(e,t,n){n=Vt(-1,n),n.tag=3,n.payload={element:null};var l=t.value;return n.callback=function(){cs||(cs=!0,ti=l),Bo(e,t)},n}function Rc(e,t,n){n=Vt(-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(){Bo(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Bo(e,t),typeof l!="function"&&(un===null?un=new Set([this]):un.add(this));var d=t.stack;this.componentDidCatch(t.value,{componentStack:d!==null?d:""})}),n}function Lc(e,t,n){var l=e.pingCache;if(l===null){l=e.pingCache=new Bp;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=ef.bind(null,e,t,n),t.then(e,e))}function zc(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 Ic(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=Vt(-1,1),t.tag=2,an(n,t,1))),n.lanes|=1),e):(e.flags|=65536,e.lanes=o,e)}var Up=Q.ReactCurrentOwner,at=!1;function lt(e,t,n,l){t.child=e===null?ec(t,null,n,l):or(t,e.child,n,l)}function Ac(e,t,n,l,o){n=n.render;var i=t.ref;return ar(t,o),l=Ro(e,t,n,l,i,o),n=Lo(),e!==null&&!at?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ht(e,t,o)):(Le&&n&&ho(t),t.flags|=1,lt(e,t,l,o),t.child)}function Dc(e,t,n,l,o){if(e===null){var i=n.type;return typeof i=="function"&&!ai(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Mc(e,t,i,l,o)):(e=ms(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 d=i.memoizedProps;if(n=n.compare,n=n!==null?n:Ur,n(d,l)&&e.ref===t.ref)return Ht(e,t,o)}return t.flags|=1,e=hn(i,l),e.ref=t.ref,e.return=t,t.child=e}function Mc(e,t,n,l,o){if(e!==null){var i=e.memoizedProps;if(Ur(i,l)&&e.ref===t.ref)if(at=!1,t.pendingProps=l=i,(e.lanes&o)!==0)(e.flags&131072)!==0&&(at=!0);else return t.lanes=e.lanes,Ht(e,t,o)}return Uo(e,t,n,l,o)}function Oc(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},Te(pr,xt),xt|=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,Te(pr,xt),xt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},l=i!==null?i.baseLanes:n,Te(pr,xt),xt|=l}else i!==null?(l=i.baseLanes|n,t.memoizedState=null):l=n,Te(pr,xt),xt|=l;return lt(e,t,o,n),t.child}function Fc(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function Uo(e,t,n,l,o){var i=it(n)?Pn:Ze.current;return i=nr(t,i),ar(t,o),n=Ro(e,t,n,l,i,o),l=Lo(),e!==null&&!at?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,Ht(e,t,o)):(Le&&l&&ho(t),t.flags|=1,lt(e,t,n,o),t.child)}function Bc(e,t,n,l,o){if(it(n)){var i=!0;Bl(t)}else i=!1;if(ar(t,o),t.stateNode===null)ls(e,t),Pc(t,n,l),Oo(t,n,l,o),l=!0;else if(e===null){var d=t.stateNode,g=t.memoizedProps;d.props=g;var j=d.context,R=n.contextType;typeof R=="object"&&R!==null?R=wt(R):(R=it(n)?Pn:Ze.current,R=nr(t,R));var $=n.getDerivedStateFromProps,Y=typeof $=="function"||typeof d.getSnapshotBeforeUpdate=="function";Y||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==l||j!==R)&&Tc(t,d,l,R),on=!1;var U=t.memoizedState;d.state=U,Gl(t,l,d,o),j=t.memoizedState,g!==l||U!==j||ot.current||on?(typeof $=="function"&&(Mo(t,n,$,l),j=t.memoizedState),(g=on||_c(t,n,g,l,U,j,R))?(Y||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=j),d.props=l,d.state=j,d.context=R,l=g):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{d=t.stateNode,nc(e,t),g=t.memoizedProps,R=t.type===t.elementType?g:Tt(t.type,g),d.props=R,Y=t.pendingProps,U=d.context,j=n.contextType,typeof j=="object"&&j!==null?j=wt(j):(j=it(n)?Pn:Ze.current,j=nr(t,j));var se=n.getDerivedStateFromProps;($=typeof se=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(g!==Y||U!==j)&&Tc(t,d,l,j),on=!1,U=t.memoizedState,d.state=U,Gl(t,l,d,o);var ie=t.memoizedState;g!==Y||U!==ie||ot.current||on?(typeof se=="function"&&(Mo(t,n,se,l),ie=t.memoizedState),(R=on||_c(t,n,R,l,U,ie,j)||!1)?($||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,ie,j),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,ie,j)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=ie),d.props=l,d.state=ie,d.context=j,l=R):(typeof d.componentDidUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||g===e.memoizedProps&&U===e.memoizedState||(t.flags|=1024),l=!1)}return Wo(e,t,n,l,i,o)}function Wo(e,t,n,l,o,i){Fc(e,t);var d=(t.flags&128)!==0;if(!l&&!d)return o&&Va(t,n,!1),Ht(e,t,i);l=t.stateNode,Up.current=t;var g=d&&typeof n.getDerivedStateFromError!="function"?null:l.render();return t.flags|=1,e!==null&&d?(t.child=or(t,e.child,null,i),t.child=or(t,null,g,i)):lt(e,t,g,i),t.memoizedState=l.state,o&&Va(t,n,!0),t.child}function Uc(e){var t=e.stateNode;t.pendingContext?$a(e,t.pendingContext,t.pendingContext!==t.context):t.context&&$a(e,t.context,!1),Eo(e,t.containerInfo)}function Wc(e,t,n,l,o){return sr(),yo(o),t.flags|=256,lt(e,t,n,l),t.child}var $o={dehydrated:null,treeContext:null,retryLane:0};function Ko(e){return{baseLanes:e,cachePool:null,transitions:null}}function $c(e,t,n){var l=t.pendingProps,o=ze.current,i=!1,d=(t.flags&128)!==0,g;if((g=d)||(g=e!==null&&e.memoizedState===null?!1:(o&2)!==0),g?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),Te(ze,o&1),e===null)return xo(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):(d=l.children,e=l.fallback,i?(l=t.mode,i=t.child,d={mode:"hidden",children:d},(l&1)===0&&i!==null?(i.childLanes=0,i.pendingProps=d):i=gs(d,l,0,null),e=On(e,l,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Ko(n),t.memoizedState=$o,e):Vo(t,d));if(o=e.memoizedState,o!==null&&(g=o.dehydrated,g!==null))return Wp(e,t,d,l,g,o,n);if(i){i=l.fallback,d=t.mode,o=e.child,g=o.sibling;var j={mode:"hidden",children:l.children};return(d&1)===0&&t.child!==o?(l=t.child,l.childLanes=0,l.pendingProps=j,t.deletions=null):(l=hn(o,j),l.subtreeFlags=o.subtreeFlags&14680064),g!==null?i=hn(g,i):(i=On(i,d,n,null),i.flags|=2),i.return=t,l.return=t,l.sibling=i,t.child=l,l=i,i=t.child,d=e.child.memoizedState,d=d===null?Ko(n):{baseLanes:d.baseLanes|n,cachePool:null,transitions:d.transitions},i.memoizedState=d,i.childLanes=e.childLanes&~n,t.memoizedState=$o,l}return i=e.child,e=i.sibling,l=hn(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 Vo(e,t){return t=gs({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function rs(e,t,n,l){return l!==null&&yo(l),or(t,e.child,null,n),e=Vo(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Wp(e,t,n,l,o,i,d){if(n)return t.flags&256?(t.flags&=-257,l=Fo(Error(c(422))),rs(e,t,d,l)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=l.fallback,o=t.mode,l=gs({mode:"visible",children:l.children},o,0,null),i=On(i,o,d,null),i.flags|=2,l.return=t,i.return=t,l.sibling=i,t.child=l,(t.mode&1)!==0&&or(t,e.child,null,d),t.child.memoizedState=Ko(d),t.memoizedState=$o,i);if((t.mode&1)===0)return rs(e,t,d,null);if(o.data==="$!"){if(l=o.nextSibling&&o.nextSibling.dataset,l)var g=l.dgst;return l=g,i=Error(c(419)),l=Fo(i,l,void 0),rs(e,t,d,l)}if(g=(d&e.childLanes)!==0,at||g){if(l=He,l!==null){switch(d&-d){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|d))!==0?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Kt(e,o),Lt(l,e,o,-1))}return ii(),l=Fo(Error(c(421))),rs(e,t,d,l)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=tf.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,gt=nn(o.nextSibling),mt=t,Le=!0,Pt=null,e!==null&&(jt[St++]=Wt,jt[St++]=$t,jt[St++]=Tn,Wt=e.id,$t=e.overflow,Tn=t),t=Vo(t,l.children),t.flags|=4096,t)}function Kc(e,t,n){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),wo(e.return,t,n)}function Ho(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 Vc(e,t,n){var l=t.pendingProps,o=l.revealOrder,i=l.tail;if(lt(e,t,l.children,n),l=ze.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&&Kc(e,n,t);else if(e.tag===19)Kc(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(Te(ze,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&&Jl(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Ho(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&&Jl(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Ho(t,!0,n,null,i);break;case"together":Ho(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function ls(e,t){(t.mode&1)===0&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function Ht(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),In|=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=hn(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=hn(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function $p(e,t,n){switch(t.tag){case 3:Uc(t),sr();break;case 5:sc(t);break;case 1:it(t.type)&&Bl(t);break;case 4:Eo(t,t.stateNode.containerInfo);break;case 10:var l=t.type._context,o=t.memoizedProps.value;Te(Hl,l._currentValue),l._currentValue=o;break;case 13:if(l=t.memoizedState,l!==null)return l.dehydrated!==null?(Te(ze,ze.current&1),t.flags|=128,null):(n&t.child.childLanes)!==0?$c(e,t,n):(Te(ze,ze.current&1),e=Ht(e,t,n),e!==null?e.sibling:null);Te(ze,ze.current&1);break;case 19:if(l=(n&t.childLanes)!==0,(e.flags&128)!==0){if(l)return Vc(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Te(ze,ze.current),l)break;return null;case 22:case 23:return t.lanes=0,Oc(e,t,n)}return Ht(e,t,n)}var Hc,Qo,Qc,Yc;Hc=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}},Qo=function(){},Qc=function(e,t,n,l){var o=e.memoizedProps;if(o!==l){e=t.stateNode,Ln(Dt.current);var i=null;switch(n){case"input":o=jr(e,o),l=jr(e,l),i=[];break;case"select":o=B({},o,{value:void 0}),l=B({},l,{value:void 0}),i=[];break;case"textarea":o=M(e,o),l=M(e,l),i=[];break;default:typeof o.onClick!="function"&&typeof l.onClick=="function"&&(e.onclick=Ml)}Er(n,l);var d;n=null;for(R in o)if(!l.hasOwnProperty(R)&&o.hasOwnProperty(R)&&o[R]!=null)if(R==="style"){var g=o[R];for(d in g)g.hasOwnProperty(d)&&(n||(n={}),n[d]="")}else R!=="dangerouslySetInnerHTML"&&R!=="children"&&R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&R!=="autoFocus"&&(f.hasOwnProperty(R)?i||(i=[]):(i=i||[]).push(R,null));for(R in l){var j=l[R];if(g=o!=null?o[R]:void 0,l.hasOwnProperty(R)&&j!==g&&(j!=null||g!=null))if(R==="style")if(g){for(d in g)!g.hasOwnProperty(d)||j&&j.hasOwnProperty(d)||(n||(n={}),n[d]="");for(d in j)j.hasOwnProperty(d)&&g[d]!==j[d]&&(n||(n={}),n[d]=j[d])}else n||(i||(i=[]),i.push(R,n)),n=j;else R==="dangerouslySetInnerHTML"?(j=j?j.__html:void 0,g=g?g.__html:void 0,j!=null&&g!==j&&(i=i||[]).push(R,j)):R==="children"?typeof j!="string"&&typeof j!="number"||(i=i||[]).push(R,""+j):R!=="suppressContentEditableWarning"&&R!=="suppressHydrationWarning"&&(f.hasOwnProperty(R)?(j!=null&&R==="onScroll"&&be("scroll",e),i||g===j||(i=[])):(i=i||[]).push(R,j))}n&&(i=i||[]).push("style",n);var R=i;(t.updateQueue=R)&&(t.flags|=4)}},Yc=function(e,t,n,l){n!==l&&(t.flags|=4)};function nl(e,t){if(!Le)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 tt(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 Kp(e,t,n){var l=t.pendingProps;switch(mo(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(t),null;case 1:return it(t.type)&&Fl(),tt(t),null;case 3:return l=t.stateNode,cr(),Re(ot),Re(Ze),Po(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(e===null||e.child===null)&&(Kl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,Pt!==null&&(li(Pt),Pt=null))),Qo(e,t),tt(t),null;case 5:No(t);var o=Ln(qr.current);if(n=t.type,e!==null&&t.stateNode!=null)Qc(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 tt(t),null}if(e=Ln(Dt.current),Kl(t)){l=t.stateNode,n=t.type;var i=t.memoizedProps;switch(l[At]=t,l[Hr]=i,e=(t.mode&1)!==0,n){case"dialog":be("cancel",l),be("close",l);break;case"iframe":case"object":case"embed":be("load",l);break;case"video":case"audio":for(o=0;o<$r.length;o++)be($r[o],l);break;case"source":be("error",l);break;case"img":case"image":case"link":be("error",l),be("load",l);break;case"details":be("toggle",l);break;case"input":Sr(l,i),be("invalid",l);break;case"select":l._wrapperState={wasMultiple:!!i.multiple},be("invalid",l);break;case"textarea":J(l,i),be("invalid",l)}Er(n,i),o=null;for(var d in i)if(i.hasOwnProperty(d)){var g=i[d];d==="children"?typeof g=="string"?l.textContent!==g&&(i.suppressHydrationWarning!==!0&&Dl(l.textContent,g,e),o=["children",g]):typeof g=="number"&&l.textContent!==""+g&&(i.suppressHydrationWarning!==!0&&Dl(l.textContent,g,e),o=["children",""+g]):f.hasOwnProperty(d)&&g!=null&&d==="onScroll"&&be("scroll",l)}switch(n){case"input":jn(l),wr(l,i,!0);break;case"textarea":jn(l),vt(l);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(l.onclick=Ml)}l=o,t.updateQueue=l,l!==null&&(t.flags|=4)}else{d=o.nodeType===9?o:o.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=$e(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=d.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof l.is=="string"?e=d.createElement(n,{is:l.is}):(e=d.createElement(n),n==="select"&&(d=e,l.multiple?d.multiple=!0:l.size&&(d.size=l.size))):e=d.createElementNS(e,n),e[At]=t,e[Hr]=l,Hc(e,t,!1,!1),t.stateNode=e;e:{switch(d=_s(n,l),n){case"dialog":be("cancel",e),be("close",e),o=l;break;case"iframe":case"object":case"embed":be("load",e),o=l;break;case"video":case"audio":for(o=0;o<$r.length;o++)be($r[o],e);o=l;break;case"source":be("error",e),o=l;break;case"img":case"image":case"link":be("error",e),be("load",e),o=l;break;case"details":be("toggle",e),o=l;break;case"input":Sr(e,l),o=jr(e,l),be("invalid",e);break;case"option":o=l;break;case"select":e._wrapperState={wasMultiple:!!l.multiple},o=B({},l,{value:void 0}),be("invalid",e);break;case"textarea":J(e,l),o=M(e,l),be("invalid",e);break;default:o=l}Er(n,o),g=o;for(i in g)if(g.hasOwnProperty(i)){var j=g[i];i==="style"?En(e,j):i==="dangerouslySetInnerHTML"?(j=j?j.__html:void 0,j!=null&&Cr(e,j)):i==="children"?typeof j=="string"?(n!=="textarea"||j!=="")&&kn(e,j):typeof j=="number"&&kn(e,""+j):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(f.hasOwnProperty(i)?j!=null&&i==="onScroll"&&be("scroll",e):j!=null&&X(e,i,j,d))}switch(n){case"input":jn(e),wr(e,l,!1);break;case"textarea":jn(e),vt(e);break;case"option":l.value!=null&&e.setAttribute("value",""+Ce(l.value));break;case"select":e.multiple=!!l.multiple,i=l.value,i!=null?K(e,!!l.multiple,i,!1):l.defaultValue!=null&&K(e,!!l.multiple,l.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=Ml)}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 tt(t),null;case 6:if(e&&t.stateNode!=null)Yc(e,t,e.memoizedProps,l);else{if(typeof l!="string"&&t.stateNode===null)throw Error(c(166));if(n=Ln(qr.current),Ln(Dt.current),Kl(t)){if(l=t.stateNode,n=t.memoizedProps,l[At]=t,(i=l.nodeValue!==n)&&(e=mt,e!==null))switch(e.tag){case 3:Dl(l.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Dl(l.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else l=(n.nodeType===9?n:n.ownerDocument).createTextNode(l),l[At]=t,t.stateNode=l}return tt(t),null;case 13:if(Re(ze),l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(Le&>!==null&&(t.mode&1)!==0&&(t.flags&128)===0)qa(),sr(),t.flags|=98560,i=!1;else if(i=Kl(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[At]=t}else sr(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;tt(t),i=!1}else Pt!==null&&(li(Pt),Pt=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||(ze.current&1)!==0?Ue===0&&(Ue=3):ii())),t.updateQueue!==null&&(t.flags|=4),tt(t),null);case 4:return cr(),Qo(e,t),e===null&&Kr(t.stateNode.containerInfo),tt(t),null;case 10:return So(t.type._context),tt(t),null;case 17:return it(t.type)&&Fl(),tt(t),null;case 19:if(Re(ze),i=t.memoizedState,i===null)return tt(t),null;if(l=(t.flags&128)!==0,d=i.rendering,d===null)if(l)nl(i,!1);else{if(Ue!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Jl(e),d!==null){for(t.flags|=128,nl(i,!1),l=d.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,d=i.alternate,d===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=d.childLanes,i.lanes=d.lanes,i.child=d.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=d.memoizedProps,i.memoizedState=d.memoizedState,i.updateQueue=d.updateQueue,i.type=d.type,e=d.dependencies,i.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return Te(ze,ze.current&1|2),t.child}e=e.sibling}i.tail!==null&&De()>fr&&(t.flags|=128,l=!0,nl(i,!1),t.lanes=4194304)}else{if(!l)if(e=Jl(d),e!==null){if(t.flags|=128,l=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),nl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!d.alternate&&!Le)return tt(t),null}else 2*De()-i.renderingStartTime>fr&&n!==1073741824&&(t.flags|=128,l=!0,nl(i,!1),t.lanes=4194304);i.isBackwards?(d.sibling=t.child,t.child=d):(n=i.last,n!==null?n.sibling=d:t.child=d,i.last=d)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=De(),t.sibling=null,n=ze.current,Te(ze,l?n&1|2:n&1),t):(tt(t),null);case 22:case 23:return oi(),l=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==l&&(t.flags|=8192),l&&(t.mode&1)!==0?(xt&1073741824)!==0&&(tt(t),t.subtreeFlags&6&&(t.flags|=8192)):tt(t),null;case 24:return null;case 25:return null}throw Error(c(156,t.tag))}function Vp(e,t){switch(mo(t),t.tag){case 1:return it(t.type)&&Fl(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return cr(),Re(ot),Re(Ze),Po(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 5:return No(t),null;case 13:if(Re(ze),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(c(340));sr()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Re(ze),null;case 4:return cr(),null;case 10:return So(t.type._context),null;case 22:case 23:return oi(),null;case 24:return null;default:return null}}var ss=!1,nt=!1,Hp=typeof WeakSet=="function"?WeakSet:Set,oe=null;function dr(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(l){Ae(e,t,l)}else n.current=null}function Yo(e,t,n){try{n()}catch(l){Ae(e,t,l)}}var Gc=!1;function Qp(e,t){if(so=El,e=_a(),qs(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 d=0,g=-1,j=-1,R=0,$=0,Y=e,U=null;t:for(;;){for(var se;Y!==n||o!==0&&Y.nodeType!==3||(g=d+o),Y!==i||l!==0&&Y.nodeType!==3||(j=d+l),Y.nodeType===3&&(d+=Y.nodeValue.length),(se=Y.firstChild)!==null;)U=Y,Y=se;for(;;){if(Y===e)break t;if(U===n&&++R===o&&(g=d),U===i&&++$===l&&(j=d),(se=Y.nextSibling)!==null)break;Y=U,U=Y.parentNode}Y=se}n=g===-1||j===-1?null:{start:g,end:j}}else n=null}n=n||{start:0,end:0}}else n=null;for(oo={focusedElem:e,selectionRange:n},El=!1,oe=t;oe!==null;)if(t=oe,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,oe=e;else for(;oe!==null;){t=oe;try{var ie=t.alternate;if((t.flags&1024)!==0)switch(t.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var ae=ie.memoizedProps,Me=ie.memoizedState,_=t.stateNode,C=_.getSnapshotBeforeUpdate(t.elementType===t.type?ae:Tt(t.type,ae),Me);_.__reactInternalSnapshotBeforeUpdate=C}break;case 3:var T=t.stateNode.containerInfo;T.nodeType===1?T.textContent="":T.nodeType===9&&T.documentElement&&T.removeChild(T.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(c(163))}}catch(q){Ae(t,t.return,q)}if(e=t.sibling,e!==null){e.return=t.return,oe=e;break}oe=t.return}return ie=Gc,Gc=!1,ie}function rl(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&&Yo(t,n,i)}o=o.next}while(o!==l)}}function os(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 Go(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 Jc(e){var t=e.alternate;t!==null&&(e.alternate=null,Jc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[At],delete t[Hr],delete t[uo],delete t[Tp],delete t[bp])),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 qc(e){return e.tag===5||e.tag===3||e.tag===4}function Xc(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qc(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 Jo(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=Ml));else if(l!==4&&(e=e.child,e!==null))for(Jo(e,t,n),e=e.sibling;e!==null;)Jo(e,t,n),e=e.sibling}function qo(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(qo(e,t,n),e=e.sibling;e!==null;)qo(e,t,n),e=e.sibling}var Je=null,bt=!1;function cn(e,t,n){for(n=n.child;n!==null;)Zc(e,t,n),n=n.sibling}function Zc(e,t,n){if(It&&typeof It.onCommitFiberUnmount=="function")try{It.onCommitFiberUnmount(vl,n)}catch{}switch(n.tag){case 5:nt||dr(n,t);case 6:var l=Je,o=bt;Je=null,cn(e,t,n),Je=l,bt=o,Je!==null&&(bt?(e=Je,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Je.removeChild(n.stateNode));break;case 18:Je!==null&&(bt?(e=Je,n=n.stateNode,e.nodeType===8?co(e.parentNode,n):e.nodeType===1&&co(e,n),Ar(e)):co(Je,n.stateNode));break;case 4:l=Je,o=bt,Je=n.stateNode.containerInfo,bt=!0,cn(e,t,n),Je=l,bt=o;break;case 0:case 11:case 14:case 15:if(!nt&&(l=n.updateQueue,l!==null&&(l=l.lastEffect,l!==null))){o=l=l.next;do{var i=o,d=i.destroy;i=i.tag,d!==void 0&&((i&2)!==0||(i&4)!==0)&&Yo(n,t,d),o=o.next}while(o!==l)}cn(e,t,n);break;case 1:if(!nt&&(dr(n,t),l=n.stateNode,typeof l.componentWillUnmount=="function"))try{l.props=n.memoizedProps,l.state=n.memoizedState,l.componentWillUnmount()}catch(g){Ae(n,t,g)}cn(e,t,n);break;case 21:cn(e,t,n);break;case 22:n.mode&1?(nt=(l=nt)||n.memoizedState!==null,cn(e,t,n),nt=l):cn(e,t,n);break;default:cn(e,t,n)}}function eu(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new Hp),t.forEach(function(l){var o=nf.bind(null,e,l);n.has(l)||(n.add(l),l.then(o,o))})}}function Rt(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,d=t,g=d;e:for(;g!==null;){switch(g.tag){case 5:Je=g.stateNode,bt=!1;break e;case 3:Je=g.stateNode.containerInfo,bt=!0;break e;case 4:Je=g.stateNode.containerInfo,bt=!0;break e}g=g.return}if(Je===null)throw Error(c(160));Zc(i,d,o),Je=null,bt=!1;var j=o.alternate;j!==null&&(j.return=null),o.return=null}catch(R){Ae(o,t,R)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)tu(t,e),t=t.sibling}function tu(e,t){var n=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Rt(t,e),Ot(e),l&4){try{rl(3,e,e.return),os(3,e)}catch(ae){Ae(e,e.return,ae)}try{rl(5,e,e.return)}catch(ae){Ae(e,e.return,ae)}}break;case 1:Rt(t,e),Ot(e),l&512&&n!==null&&dr(n,n.return);break;case 5:if(Rt(t,e),Ot(e),l&512&&n!==null&&dr(n,n.return),e.flags&32){var o=e.stateNode;try{kn(o,"")}catch(ae){Ae(e,e.return,ae)}}if(l&4&&(o=e.stateNode,o!=null)){var i=e.memoizedProps,d=n!==null?n.memoizedProps:i,g=e.type,j=e.updateQueue;if(e.updateQueue=null,j!==null)try{g==="input"&&i.type==="radio"&&i.name!=null&&$n(o,i),_s(g,d);var R=_s(g,i);for(d=0;d<j.length;d+=2){var $=j[d],Y=j[d+1];$==="style"?En(o,Y):$==="dangerouslySetInnerHTML"?Cr(o,Y):$==="children"?kn(o,Y):X(o,$,Y,R)}switch(g){case"input":zt(o,i);break;case"textarea":We(o,i);break;case"select":var U=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var se=i.value;se!=null?K(o,!!i.multiple,se,!1):U!==!!i.multiple&&(i.defaultValue!=null?K(o,!!i.multiple,i.defaultValue,!0):K(o,!!i.multiple,i.multiple?[]:"",!1))}o[Hr]=i}catch(ae){Ae(e,e.return,ae)}}break;case 6:if(Rt(t,e),Ot(e),l&4){if(e.stateNode===null)throw Error(c(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(ae){Ae(e,e.return,ae)}}break;case 3:if(Rt(t,e),Ot(e),l&4&&n!==null&&n.memoizedState.isDehydrated)try{Ar(t.containerInfo)}catch(ae){Ae(e,e.return,ae)}break;case 4:Rt(t,e),Ot(e);break;case 13:Rt(t,e),Ot(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(ei=De())),l&4&&eu(e);break;case 22:if($=n!==null&&n.memoizedState!==null,e.mode&1?(nt=(R=nt)||$,Rt(t,e),nt=R):Rt(t,e),Ot(e),l&8192){if(R=e.memoizedState!==null,(e.stateNode.isHidden=R)&&!$&&(e.mode&1)!==0)for(oe=e,$=e.child;$!==null;){for(Y=oe=$;oe!==null;){switch(U=oe,se=U.child,U.tag){case 0:case 11:case 14:case 15:rl(4,U,U.return);break;case 1:dr(U,U.return);var ie=U.stateNode;if(typeof ie.componentWillUnmount=="function"){l=U,n=U.return;try{t=l,ie.props=t.memoizedProps,ie.state=t.memoizedState,ie.componentWillUnmount()}catch(ae){Ae(l,n,ae)}}break;case 5:dr(U,U.return);break;case 22:if(U.memoizedState!==null){lu(Y);continue}}se!==null?(se.return=U,oe=se):lu(Y)}$=$.sibling}e:for($=null,Y=e;;){if(Y.tag===5){if($===null){$=Y;try{o=Y.stateNode,R?(i=o.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(g=Y.stateNode,j=Y.memoizedProps.style,d=j!=null&&j.hasOwnProperty("display")?j.display:null,g.style.display=Se("display",d))}catch(ae){Ae(e,e.return,ae)}}}else if(Y.tag===6){if($===null)try{Y.stateNode.nodeValue=R?"":Y.memoizedProps}catch(ae){Ae(e,e.return,ae)}}else if((Y.tag!==22&&Y.tag!==23||Y.memoizedState===null||Y===e)&&Y.child!==null){Y.child.return=Y,Y=Y.child;continue}if(Y===e)break e;for(;Y.sibling===null;){if(Y.return===null||Y.return===e)break e;$===Y&&($=null),Y=Y.return}$===Y&&($=null),Y.sibling.return=Y.return,Y=Y.sibling}}break;case 19:Rt(t,e),Ot(e),l&4&&eu(e);break;case 21:break;default:Rt(t,e),Ot(e)}}function Ot(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(qc(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&&(kn(o,""),l.flags&=-33);var i=Xc(e);qo(e,i,o);break;case 3:case 4:var d=l.stateNode.containerInfo,g=Xc(e);Jo(e,g,d);break;default:throw Error(c(161))}}catch(j){Ae(e,e.return,j)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Yp(e,t,n){oe=e,nu(e)}function nu(e,t,n){for(var l=(e.mode&1)!==0;oe!==null;){var o=oe,i=o.child;if(o.tag===22&&l){var d=o.memoizedState!==null||ss;if(!d){var g=o.alternate,j=g!==null&&g.memoizedState!==null||nt;g=ss;var R=nt;if(ss=d,(nt=j)&&!R)for(oe=o;oe!==null;)d=oe,j=d.child,d.tag===22&&d.memoizedState!==null?su(o):j!==null?(j.return=d,oe=j):su(o);for(;i!==null;)oe=i,nu(i),i=i.sibling;oe=o,ss=g,nt=R}ru(e)}else(o.subtreeFlags&8772)!==0&&i!==null?(i.return=o,oe=i):ru(e)}}function ru(e){for(;oe!==null;){var t=oe;if((t.flags&8772)!==0){var n=t.alternate;try{if((t.flags&8772)!==0)switch(t.tag){case 0:case 11:case 15:nt||os(5,t);break;case 1:var l=t.stateNode;if(t.flags&4&&!nt)if(n===null)l.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Tt(t.type,n.memoizedProps);l.componentDidUpdate(o,n.memoizedState,l.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&lc(t,i,l);break;case 3:var d=t.updateQueue;if(d!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}lc(t,d,n)}break;case 5:var g=t.stateNode;if(n===null&&t.flags&4){n=g;var j=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":j.autoFocus&&n.focus();break;case"img":j.src&&(n.src=j.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var R=t.alternate;if(R!==null){var $=R.memoizedState;if($!==null){var Y=$.dehydrated;Y!==null&&Ar(Y)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(c(163))}nt||t.flags&512&&Go(t)}catch(U){Ae(t,t.return,U)}}if(t===e){oe=null;break}if(n=t.sibling,n!==null){n.return=t.return,oe=n;break}oe=t.return}}function lu(e){for(;oe!==null;){var t=oe;if(t===e){oe=null;break}var n=t.sibling;if(n!==null){n.return=t.return,oe=n;break}oe=t.return}}function su(e){for(;oe!==null;){var t=oe;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{os(4,t)}catch(j){Ae(t,n,j)}break;case 1:var l=t.stateNode;if(typeof l.componentDidMount=="function"){var o=t.return;try{l.componentDidMount()}catch(j){Ae(t,o,j)}}var i=t.return;try{Go(t)}catch(j){Ae(t,i,j)}break;case 5:var d=t.return;try{Go(t)}catch(j){Ae(t,d,j)}}}catch(j){Ae(t,t.return,j)}if(t===e){oe=null;break}var g=t.sibling;if(g!==null){g.return=t.return,oe=g;break}oe=t.return}}var Gp=Math.ceil,is=Q.ReactCurrentDispatcher,Xo=Q.ReactCurrentOwner,Ct=Q.ReactCurrentBatchConfig,Ne=0,He=null,Fe=null,qe=0,xt=0,pr=rn(0),Ue=0,ll=null,In=0,as=0,Zo=0,sl=null,ct=null,ei=0,fr=1/0,Qt=null,cs=!1,ti=null,un=null,us=!1,dn=null,ds=0,ol=0,ni=null,ps=-1,fs=0;function st(){return(Ne&6)!==0?De():ps!==-1?ps:ps=De()}function pn(e){return(e.mode&1)===0?1:(Ne&2)!==0&&qe!==0?qe&-qe:Lp.transition!==null?(fs===0&&(fs=Xi()),fs):(e=Pe,e!==0||(e=window.event,e=e===void 0?16:ia(e.type)),e)}function Lt(e,t,n,l){if(50<ol)throw ol=0,ni=null,Error(c(185));br(e,n,l),((Ne&2)===0||e!==He)&&(e===He&&((Ne&2)===0&&(as|=n),Ue===4&&fn(e,qe)),ut(e,l),n===1&&Ne===0&&(t.mode&1)===0&&(fr=De()+500,Ul&&sn()))}function ut(e,t){var n=e.callbackNode;Ld(e,t);var l=wl(e,e===He?qe:0);if(l===0)n!==null&&Gi(n),e.callbackNode=null,e.callbackPriority=0;else if(t=l&-l,e.callbackPriority!==t){if(n!=null&&Gi(n),t===1)e.tag===0?Rp(iu.bind(null,e)):Ha(iu.bind(null,e)),_p(function(){(Ne&6)===0&&sn()}),n=null;else{switch(Zi(l)){case 1:n=Is;break;case 4:n=Ji;break;case 16:n=yl;break;case 536870912:n=qi;break;default:n=yl}n=mu(n,ou.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function ou(e,t){if(ps=-1,fs=0,(Ne&6)!==0)throw Error(c(327));var n=e.callbackNode;if(hr()&&e.callbackNode!==n)return null;var l=wl(e,e===He?qe:0);if(l===0)return null;if((l&30)!==0||(l&e.expiredLanes)!==0||t)t=hs(e,l);else{t=l;var o=Ne;Ne|=2;var i=cu();(He!==e||qe!==t)&&(Qt=null,fr=De()+500,Dn(e,t));do try{Xp();break}catch(g){au(e,g)}while(!0);jo(),is.current=i,Ne=o,Fe!==null?t=0:(He=null,qe=0,t=Ue)}if(t!==0){if(t===2&&(o=As(e),o!==0&&(l=o,t=ri(e,o))),t===1)throw n=ll,Dn(e,0),fn(e,l),ut(e,De()),n;if(t===6)fn(e,l);else{if(o=e.current.alternate,(l&30)===0&&!Jp(o)&&(t=hs(e,l),t===2&&(i=As(e),i!==0&&(l=i,t=ri(e,i))),t===1))throw n=ll,Dn(e,0),fn(e,l),ut(e,De()),n;switch(e.finishedWork=o,e.finishedLanes=l,t){case 0:case 1:throw Error(c(345));case 2:Mn(e,ct,Qt);break;case 3:if(fn(e,l),(l&130023424)===l&&(t=ei+500-De(),10<t)){if(wl(e,0)!==0)break;if(o=e.suspendedLanes,(o&l)!==l){st(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=ao(Mn.bind(null,e,ct,Qt),t);break}Mn(e,ct,Qt);break;case 4:if(fn(e,l),(l&4194240)===l)break;for(t=e.eventTimes,o=-1;0<l;){var d=31-Nt(l);i=1<<d,d=t[d],d>o&&(o=d),l&=~i}if(l=o,l=De()-l,l=(120>l?120:480>l?480:1080>l?1080:1920>l?1920:3e3>l?3e3:4320>l?4320:1960*Gp(l/1960))-l,10<l){e.timeoutHandle=ao(Mn.bind(null,e,ct,Qt),l);break}Mn(e,ct,Qt);break;case 5:Mn(e,ct,Qt);break;default:throw Error(c(329))}}}return ut(e,De()),e.callbackNode===n?ou.bind(null,e):null}function ri(e,t){var n=sl;return e.current.memoizedState.isDehydrated&&(Dn(e,t).flags|=256),e=hs(e,t),e!==2&&(t=ct,ct=n,t!==null&&li(t)),e}function li(e){ct===null?ct=e:ct.push.apply(ct,e)}function Jp(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(!_t(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 fn(e,t){for(t&=~Zo,t&=~as,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Nt(t),l=1<<n;e[n]=-1,t&=~l}}function iu(e){if((Ne&6)!==0)throw Error(c(327));hr();var t=wl(e,0);if((t&1)===0)return ut(e,De()),null;var n=hs(e,t);if(e.tag!==0&&n===2){var l=As(e);l!==0&&(t=l,n=ri(e,l))}if(n===1)throw n=ll,Dn(e,0),fn(e,t),ut(e,De()),n;if(n===6)throw Error(c(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Mn(e,ct,Qt),ut(e,De()),null}function si(e,t){var n=Ne;Ne|=1;try{return e(t)}finally{Ne=n,Ne===0&&(fr=De()+500,Ul&&sn())}}function An(e){dn!==null&&dn.tag===0&&(Ne&6)===0&&hr();var t=Ne;Ne|=1;var n=Ct.transition,l=Pe;try{if(Ct.transition=null,Pe=1,e)return e()}finally{Pe=l,Ct.transition=n,Ne=t,(Ne&6)===0&&sn()}}function oi(){xt=pr.current,Re(pr)}function Dn(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Np(n)),Fe!==null)for(n=Fe.return;n!==null;){var l=n;switch(mo(l),l.tag){case 1:l=l.type.childContextTypes,l!=null&&Fl();break;case 3:cr(),Re(ot),Re(Ze),Po();break;case 5:No(l);break;case 4:cr();break;case 13:Re(ze);break;case 19:Re(ze);break;case 10:So(l.type._context);break;case 22:case 23:oi()}n=n.return}if(He=e,Fe=e=hn(e.current,null),qe=xt=t,Ue=0,ll=null,Zo=as=In=0,ct=sl=null,Rn!==null){for(t=0;t<Rn.length;t++)if(n=Rn[t],l=n.interleaved,l!==null){n.interleaved=null;var o=l.next,i=n.pending;if(i!==null){var d=i.next;i.next=o,l.next=d}n.pending=l}Rn=null}return e}function au(e,t){do{var n=Fe;try{if(jo(),ql.current=ts,Xl){for(var l=Ie.memoizedState;l!==null;){var o=l.queue;o!==null&&(o.pending=null),l=l.next}Xl=!1}if(zn=0,Ve=Be=Ie=null,Xr=!1,Zr=0,Xo.current=null,n===null||n.return===null){Ue=1,ll=t,Fe=null;break}e:{var i=e,d=n.return,g=n,j=t;if(t=qe,g.flags|=32768,j!==null&&typeof j=="object"&&typeof j.then=="function"){var R=j,$=g,Y=$.tag;if(($.mode&1)===0&&(Y===0||Y===11||Y===15)){var U=$.alternate;U?($.updateQueue=U.updateQueue,$.memoizedState=U.memoizedState,$.lanes=U.lanes):($.updateQueue=null,$.memoizedState=null)}var se=zc(d);if(se!==null){se.flags&=-257,Ic(se,d,g,i,t),se.mode&1&&Lc(i,R,t),t=se,j=R;var ie=t.updateQueue;if(ie===null){var ae=new Set;ae.add(j),t.updateQueue=ae}else ie.add(j);break e}else{if((t&1)===0){Lc(i,R,t),ii();break e}j=Error(c(426))}}else if(Le&&g.mode&1){var Me=zc(d);if(Me!==null){(Me.flags&65536)===0&&(Me.flags|=256),Ic(Me,d,g,i,t),yo(ur(j,g));break e}}i=j=ur(j,g),Ue!==4&&(Ue=2),sl===null?sl=[i]:sl.push(i),i=d;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var _=bc(i,j,t);rc(i,_);break e;case 1:g=j;var C=i.type,T=i.stateNode;if((i.flags&128)===0&&(typeof C.getDerivedStateFromError=="function"||T!==null&&typeof T.componentDidCatch=="function"&&(un===null||!un.has(T)))){i.flags|=65536,t&=-t,i.lanes|=t;var q=Rc(i,g,t);rc(i,q);break e}}i=i.return}while(i!==null)}du(n)}catch(ue){t=ue,Fe===n&&n!==null&&(Fe=n=n.return);continue}break}while(!0)}function cu(){var e=is.current;return is.current=ts,e===null?ts:e}function ii(){(Ue===0||Ue===3||Ue===2)&&(Ue=4),He===null||(In&268435455)===0&&(as&268435455)===0||fn(He,qe)}function hs(e,t){var n=Ne;Ne|=2;var l=cu();(He!==e||qe!==t)&&(Qt=null,Dn(e,t));do try{qp();break}catch(o){au(e,o)}while(!0);if(jo(),Ne=n,is.current=l,Fe!==null)throw Error(c(261));return He=null,qe=0,Ue}function qp(){for(;Fe!==null;)uu(Fe)}function Xp(){for(;Fe!==null&&!kd();)uu(Fe)}function uu(e){var t=hu(e.alternate,e,xt);e.memoizedProps=e.pendingProps,t===null?du(e):Fe=t,Xo.current=null}function du(e){var t=e;do{var n=t.alternate;if(e=t.return,(t.flags&32768)===0){if(n=Kp(n,t,xt),n!==null){Fe=n;return}}else{if(n=Vp(n,t),n!==null){n.flags&=32767,Fe=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{Ue=6,Fe=null;return}}if(t=t.sibling,t!==null){Fe=t;return}Fe=t=e}while(t!==null);Ue===0&&(Ue=5)}function Mn(e,t,n){var l=Pe,o=Ct.transition;try{Ct.transition=null,Pe=1,Zp(e,t,n,l)}finally{Ct.transition=o,Pe=l}return null}function Zp(e,t,n,l){do hr();while(dn!==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(zd(e,i),e===He&&(Fe=He=null,qe=0),(n.subtreeFlags&2064)===0&&(n.flags&2064)===0||us||(us=!0,mu(yl,function(){return hr(),null})),i=(n.flags&15990)!==0,(n.subtreeFlags&15990)!==0||i){i=Ct.transition,Ct.transition=null;var d=Pe;Pe=1;var g=Ne;Ne|=4,Xo.current=null,Qp(e,n),tu(n,e),vp(oo),El=!!so,oo=so=null,e.current=n,Yp(n),Cd(),Ne=g,Pe=d,Ct.transition=i}else e.current=n;if(us&&(us=!1,dn=e,ds=o),i=e.pendingLanes,i===0&&(un=null),_d(n.stateNode),ut(e,De()),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(cs)throw cs=!1,e=ti,ti=null,e;return(ds&1)!==0&&e.tag!==0&&hr(),i=e.pendingLanes,(i&1)!==0?e===ni?ol++:(ol=0,ni=e):ol=0,sn(),null}function hr(){if(dn!==null){var e=Zi(ds),t=Ct.transition,n=Pe;try{if(Ct.transition=null,Pe=16>e?16:e,dn===null)var l=!1;else{if(e=dn,dn=null,ds=0,(Ne&6)!==0)throw Error(c(331));var o=Ne;for(Ne|=4,oe=e.current;oe!==null;){var i=oe,d=i.child;if((oe.flags&16)!==0){var g=i.deletions;if(g!==null){for(var j=0;j<g.length;j++){var R=g[j];for(oe=R;oe!==null;){var $=oe;switch($.tag){case 0:case 11:case 15:rl(8,$,i)}var Y=$.child;if(Y!==null)Y.return=$,oe=Y;else for(;oe!==null;){$=oe;var U=$.sibling,se=$.return;if(Jc($),$===R){oe=null;break}if(U!==null){U.return=se,oe=U;break}oe=se}}}var ie=i.alternate;if(ie!==null){var ae=ie.child;if(ae!==null){ie.child=null;do{var Me=ae.sibling;ae.sibling=null,ae=Me}while(ae!==null)}}oe=i}}if((i.subtreeFlags&2064)!==0&&d!==null)d.return=i,oe=d;else e:for(;oe!==null;){if(i=oe,(i.flags&2048)!==0)switch(i.tag){case 0:case 11:case 15:rl(9,i,i.return)}var _=i.sibling;if(_!==null){_.return=i.return,oe=_;break e}oe=i.return}}var C=e.current;for(oe=C;oe!==null;){d=oe;var T=d.child;if((d.subtreeFlags&2064)!==0&&T!==null)T.return=d,oe=T;else e:for(d=C;oe!==null;){if(g=oe,(g.flags&2048)!==0)try{switch(g.tag){case 0:case 11:case 15:os(9,g)}}catch(ue){Ae(g,g.return,ue)}if(g===d){oe=null;break e}var q=g.sibling;if(q!==null){q.return=g.return,oe=q;break e}oe=g.return}}if(Ne=o,sn(),It&&typeof It.onPostCommitFiberRoot=="function")try{It.onPostCommitFiberRoot(vl,e)}catch{}l=!0}return l}finally{Pe=n,Ct.transition=t}}return!1}function pu(e,t,n){t=ur(n,t),t=bc(e,t,1),e=an(e,t,1),t=st(),e!==null&&(br(e,1,t),ut(e,t))}function Ae(e,t,n){if(e.tag===3)pu(e,e,n);else for(;t!==null;){if(t.tag===3){pu(t,e,n);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(un===null||!un.has(l))){e=ur(n,e),e=Rc(t,e,1),t=an(t,e,1),e=st(),t!==null&&(br(t,1,e),ut(t,e));break}}t=t.return}}function ef(e,t,n){var l=e.pingCache;l!==null&&l.delete(t),t=st(),e.pingedLanes|=e.suspendedLanes&n,He===e&&(qe&n)===n&&(Ue===4||Ue===3&&(qe&130023424)===qe&&500>De()-ei?Dn(e,0):Zo|=n),ut(e,t)}function fu(e,t){t===0&&((e.mode&1)===0?t=1:(t=Sl,Sl<<=1,(Sl&130023424)===0&&(Sl=4194304)));var n=st();e=Kt(e,t),e!==null&&(br(e,t,n),ut(e,n))}function tf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),fu(e,n)}function nf(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),fu(e,n)}var hu;hu=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||ot.current)at=!0;else{if((e.lanes&n)===0&&(t.flags&128)===0)return at=!1,$p(e,t,n);at=(e.flags&131072)!==0}else at=!1,Le&&(t.flags&1048576)!==0&&Qa(t,$l,t.index);switch(t.lanes=0,t.tag){case 2:var l=t.type;ls(e,t),e=t.pendingProps;var o=nr(t,Ze.current);ar(t,n),o=Ro(null,t,l,e,o,n);var i=Lo();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,it(l)?(i=!0,Bl(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Co(t),o.updater=ns,t.stateNode=o,o._reactInternals=t,Oo(t,l,e,n),t=Wo(null,t,l,!0,i,n)):(t.tag=0,Le&&i&&ho(t),lt(null,t,o,n),t=t.child),t;case 16:l=t.elementType;e:{switch(ls(e,t),e=t.pendingProps,o=l._init,l=o(l._payload),t.type=l,o=t.tag=lf(l),e=Tt(l,e),o){case 0:t=Uo(null,t,l,e,n);break e;case 1:t=Bc(null,t,l,e,n);break e;case 11:t=Ac(null,t,l,e,n);break e;case 14:t=Dc(null,t,l,Tt(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:Tt(l,o),Uo(e,t,l,o,n);case 1:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:Tt(l,o),Bc(e,t,l,o,n);case 3:e:{if(Uc(t),e===null)throw Error(c(387));l=t.pendingProps,i=t.memoizedState,o=i.element,nc(e,t),Gl(t,l,null,n);var d=t.memoizedState;if(l=d.element,i.isDehydrated)if(i={element:l,isDehydrated:!1,cache:d.cache,pendingSuspenseBoundaries:d.pendingSuspenseBoundaries,transitions:d.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=ur(Error(c(423)),t),t=Wc(e,t,l,n,o);break e}else if(l!==o){o=ur(Error(c(424)),t),t=Wc(e,t,l,n,o);break e}else for(gt=nn(t.stateNode.containerInfo.firstChild),mt=t,Le=!0,Pt=null,n=ec(t,null,l,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(sr(),l===o){t=Ht(e,t,n);break e}lt(e,t,l,n)}t=t.child}return t;case 5:return sc(t),e===null&&xo(t),l=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,d=o.children,io(l,o)?d=null:i!==null&&io(l,i)&&(t.flags|=32),Fc(e,t),lt(e,t,d,n),t.child;case 6:return e===null&&xo(t),null;case 13:return $c(e,t,n);case 4:return Eo(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=or(t,null,l,n):lt(e,t,l,n),t.child;case 11:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:Tt(l,o),Ac(e,t,l,o,n);case 7:return lt(e,t,t.pendingProps,n),t.child;case 8:return lt(e,t,t.pendingProps.children,n),t.child;case 12:return lt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(l=t.type._context,o=t.pendingProps,i=t.memoizedProps,d=o.value,Te(Hl,l._currentValue),l._currentValue=d,i!==null)if(_t(i.value,d)){if(i.children===o.children&&!ot.current){t=Ht(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var g=i.dependencies;if(g!==null){d=i.child;for(var j=g.firstContext;j!==null;){if(j.context===l){if(i.tag===1){j=Vt(-1,n&-n),j.tag=2;var R=i.updateQueue;if(R!==null){R=R.shared;var $=R.pending;$===null?j.next=j:(j.next=$.next,$.next=j),R.pending=j}}i.lanes|=n,j=i.alternate,j!==null&&(j.lanes|=n),wo(i.return,n,t),g.lanes|=n;break}j=j.next}}else if(i.tag===10)d=i.type===t.type?null:i.child;else if(i.tag===18){if(d=i.return,d===null)throw Error(c(341));d.lanes|=n,g=d.alternate,g!==null&&(g.lanes|=n),wo(d,n,t),d=i.sibling}else d=i.child;if(d!==null)d.return=i;else for(d=i;d!==null;){if(d===t){d=null;break}if(i=d.sibling,i!==null){i.return=d.return,d=i;break}d=d.return}i=d}lt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,l=t.pendingProps.children,ar(t,n),o=wt(o),l=l(o),t.flags|=1,lt(e,t,l,n),t.child;case 14:return l=t.type,o=Tt(l,t.pendingProps),o=Tt(l.type,o),Dc(e,t,l,o,n);case 15:return Mc(e,t,t.type,t.pendingProps,n);case 17:return l=t.type,o=t.pendingProps,o=t.elementType===l?o:Tt(l,o),ls(e,t),t.tag=1,it(l)?(e=!0,Bl(t)):e=!1,ar(t,n),Pc(t,l,o),Oo(t,l,o,n),Wo(null,t,l,!0,e,n);case 19:return Vc(e,t,n);case 22:return Oc(e,t,n)}throw Error(c(156,t.tag))};function mu(e,t){return Yi(e,t)}function rf(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 Et(e,t,n,l){return new rf(e,t,n,l)}function ai(e){return e=e.prototype,!(!e||!e.isReactComponent)}function lf(e){if(typeof e=="function")return ai(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ee)return 11;if(e===ce)return 14}return 2}function hn(e,t){var n=e.alternate;return n===null?(n=Et(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 ms(e,t,n,l,o,i){var d=2;if(l=e,typeof e=="function")ai(e)&&(d=1);else if(typeof e=="string")d=5;else e:switch(e){case te:return On(n.children,o,i,t);case re:d=8,o|=8;break;case V:return e=Et(12,n,t,o|2),e.elementType=V,e.lanes=i,e;case b:return e=Et(13,n,t,o),e.elementType=b,e.lanes=i,e;case ne:return e=Et(19,n,t,o),e.elementType=ne,e.lanes=i,e;case ye:return gs(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case I:d=10;break e;case A:d=9;break e;case ee:d=11;break e;case ce:d=14;break e;case ve:d=16,l=null;break e}throw Error(c(130,e==null?e:typeof e,""))}return t=Et(d,n,t,o),t.elementType=e,t.type=l,t.lanes=i,t}function On(e,t,n,l){return e=Et(7,e,l,t),e.lanes=n,e}function gs(e,t,n,l){return e=Et(22,e,l,t),e.elementType=ye,e.lanes=n,e.stateNode={isHidden:!1},e}function ci(e,t,n){return e=Et(6,e,null,t),e.lanes=n,e}function ui(e,t,n){return t=Et(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function sf(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=Ds(0),this.expirationTimes=Ds(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ds(0),this.identifierPrefix=l,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function di(e,t,n,l,o,i,d,g,j){return e=new sf(e,t,n,g,j),t===1?(t=1,i===!0&&(t|=8)):t=0,i=Et(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:l,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Co(i),e}function of(e,t,n){var l=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:F,key:l==null?null:""+l,children:e,containerInfo:t,implementation:n}}function gu(e){if(!e)return ln;e=e._reactInternals;e:{if(Nn(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(it(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(it(n))return Ka(e,n,t)}return t}function xu(e,t,n,l,o,i,d,g,j){return e=di(n,l,!0,e,o,i,d,g,j),e.context=gu(null),n=e.current,l=st(),o=pn(n),i=Vt(l,o),i.callback=t??null,an(n,i,o),e.current.lanes=o,br(e,o,l),ut(e,l),e}function xs(e,t,n,l){var o=t.current,i=st(),d=pn(o);return n=gu(n),t.context===null?t.context=n:t.pendingContext=n,t=Vt(i,d),t.payload={element:e},l=l===void 0?null:l,l!==null&&(t.callback=l),e=an(o,t,d),e!==null&&(Lt(e,o,d,i),Yl(e,o,d)),d}function ys(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 yu(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function pi(e,t){yu(e,t),(e=e.alternate)&&yu(e,t)}function af(){return null}var vu=typeof reportError=="function"?reportError:function(e){console.error(e)};function fi(e){this._internalRoot=e}vs.prototype.render=fi.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(c(409));xs(e,t,null,null)},vs.prototype.unmount=fi.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;An(function(){xs(null,e,null,null)}),t[Bt]=null}};function vs(e){this._internalRoot=e}vs.prototype.unstable_scheduleHydration=function(e){if(e){var t=na();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Zt.length&&t!==0&&t<Zt[n].priority;n++);Zt.splice(n,0,e),n===0&&sa(e)}};function hi(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function js(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function ju(){}function cf(e,t,n,l,o){if(o){if(typeof l=="function"){var i=l;l=function(){var R=ys(d);i.call(R)}}var d=xu(t,l,e,0,null,!1,!1,"",ju);return e._reactRootContainer=d,e[Bt]=d.current,Kr(e.nodeType===8?e.parentNode:e),An(),d}for(;o=e.lastChild;)e.removeChild(o);if(typeof l=="function"){var g=l;l=function(){var R=ys(j);g.call(R)}}var j=di(e,0,!1,null,null,!1,!1,"",ju);return e._reactRootContainer=j,e[Bt]=j.current,Kr(e.nodeType===8?e.parentNode:e),An(function(){xs(t,j,n,l)}),j}function Ss(e,t,n,l,o){var i=n._reactRootContainer;if(i){var d=i;if(typeof o=="function"){var g=o;o=function(){var j=ys(d);g.call(j)}}xs(t,d,e,o)}else d=cf(n,t,e,o,l);return ys(d)}ea=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Tr(t.pendingLanes);n!==0&&(Ms(t,n|1),ut(t,De()),(Ne&6)===0&&(fr=De()+500,sn()))}break;case 13:An(function(){var l=Kt(e,1);if(l!==null){var o=st();Lt(l,e,1,o)}}),pi(e,1)}},Os=function(e){if(e.tag===13){var t=Kt(e,134217728);if(t!==null){var n=st();Lt(t,e,134217728,n)}pi(e,134217728)}},ta=function(e){if(e.tag===13){var t=pn(e),n=Kt(e,t);if(n!==null){var l=st();Lt(n,e,t,l)}pi(e,t)}},na=function(){return Pe},ra=function(e,t){var n=Pe;try{return Pe=e,t()}finally{Pe=n}},bs=function(e,t,n){switch(t){case"input":if(zt(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=Ol(l);if(!o)throw Error(c(90));hl(l),zt(l,o)}}}break;case"textarea":We(e,n);break;case"select":t=n.value,t!=null&&K(e,!!n.multiple,t,!1)}},Ui=si,Wi=An;var uf={usingClientEntryPoint:!1,Events:[Qr,er,Ol,Fi,Bi,si]},il={findFiberByHostInstance:_n,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},df={bundleType:il.bundleType,version:il.version,rendererPackageName:il.rendererPackageName,rendererConfig:il.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Q.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=Hi(e),e===null?null:e.stateNode},findFiberByHostInstance:il.findFiberByHostInstance||af,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 ws=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ws.isDisabled&&ws.supportsFiber)try{vl=ws.inject(df),It=ws}catch{}}return dt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uf,dt.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!hi(t))throw Error(c(200));return of(e,t,null,n)},dt.createRoot=function(e,t){if(!hi(e))throw Error(c(299));var n=!1,l="",o=vu;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=di(e,1,!1,null,null,n,!1,l,o),e[Bt]=t.current,Kr(e.nodeType===8?e.parentNode:e),new fi(t)},dt.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=Hi(t),e=e===null?null:e.stateNode,e},dt.flushSync=function(e){return An(e)},dt.hydrate=function(e,t,n){if(!js(t))throw Error(c(200));return Ss(null,e,t,!0,n)},dt.hydrateRoot=function(e,t,n){if(!hi(e))throw Error(c(405));var l=n!=null&&n.hydratedSources||null,o=!1,i="",d=vu;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(d=n.onRecoverableError)),t=xu(t,null,e,1,n??null,o,!1,i,d),e[Bt]=t.current,Kr(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 vs(t)},dt.render=function(e,t,n){if(!js(t))throw Error(c(200));return Ss(null,e,t,!1,n)},dt.unmountComponentAtNode=function(e){if(!js(e))throw Error(c(40));return e._reactRootContainer?(An(function(){Ss(null,null,e,!1,function(){e._reactRootContainer=null,e[Bt]=null})}),!0):!1},dt.unstable_batchedUpdates=si,dt.unstable_renderSubtreeIntoContainer=function(e,t,n,l){if(!js(n))throw Error(c(200));if(e==null||e._reactInternals===void 0)throw Error(c(38));return Ss(e,t,n,!1,l)},dt.version="18.3.1-next-f1338f8080-20240426",dt}var Pu;function Ju(){if(Pu)return xi.exports;Pu=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(),xi.exports=kf(),xi.exports}var Tu;function Cf(){if(Tu)return ks;Tu=1;var s=Ju();return ks.createRoot=s.createRoot,ks.hydrateRoot=s.hydrateRoot,ks}var Ef=Cf(),qu=Ju();/**
|
|
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 dl(){return dl=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},dl.apply(this,arguments)}var xn;(function(s){s.Pop="POP",s.Push="PUSH",s.Replace="REPLACE"})(xn||(xn={}));const bu="popstate";function Nf(s){s===void 0&&(s={});function a(u,f){let{pathname:h,search:v,hash:y}=u.location;return Ei("",{pathname:h,search:v,hash:y},f.state&&f.state.usr||null,f.state&&f.state.key||"default")}function c(u,f){return typeof f=="string"?f:Es(f)}return Pf(a,c,null,s)}function Oe(s,a){if(s===!1||s===null||typeof s>"u")throw new Error(a)}function bi(s,a){if(!s){typeof console<"u"&&console.warn(a);try{throw new Error(a)}catch{}}}function _f(){return Math.random().toString(36).substr(2,8)}function Ru(s,a){return{usr:s.state,key:s.key,idx:a}}function Ei(s,a,c,u){return c===void 0&&(c=null),dl({pathname:typeof s=="string"?s:s.pathname,search:"",hash:""},typeof a=="string"?yr(a):a,{state:c,key:a&&a.key||u||_f()})}function Es(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 yr(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 Pf(s,a,c,u){u===void 0&&(u={});let{window:f=document.defaultView,v5Compat:h=!1}=u,v=f.history,y=xn.Pop,E=null,m=x();m==null&&(m=0,v.replaceState(dl({},v.state,{idx:m}),""));function x(){return(v.state||{idx:null}).idx}function k(){y=xn.Pop;let S=x(),z=S==null?null:S-m;m=S,E&&E({action:y,location:w.location,delta:z})}function P(S,z){y=xn.Push;let W=Ei(w.location,S,z);m=x()+1;let X=Ru(W,m),Q=w.createHref(W);try{v.pushState(X,"",Q)}catch(G){if(G instanceof DOMException&&G.name==="DataCloneError")throw G;f.location.assign(Q)}h&&E&&E({action:y,location:w.location,delta:1})}function H(S,z){y=xn.Replace;let W=Ei(w.location,S,z);m=x();let X=Ru(W,m),Q=w.createHref(W);v.replaceState(X,"",Q),h&&E&&E({action:y,location:w.location,delta:0})}function D(S){let z=f.location.origin!=="null"?f.location.origin:f.location.href,W=typeof S=="string"?S:Es(S);return W=W.replace(/ $/,"%20"),Oe(z,"No window.location.(origin|href) available to create URL for href: "+W),new URL(W,z)}let w={get action(){return y},get location(){return s(f,v)},listen(S){if(E)throw new Error("A history only accepts one active listener");return f.addEventListener(bu,k),E=S,()=>{f.removeEventListener(bu,k),E=null}},createHref(S){return a(f,S)},createURL:D,encodeLocation(S){let z=D(S);return{pathname:z.pathname,search:z.search,hash:z.hash}},push:P,replace:H,go(S){return v.go(S)}};return w}var Lu;(function(s){s.data="data",s.deferred="deferred",s.redirect="redirect",s.error="error"})(Lu||(Lu={}));function Tf(s,a,c){return c===void 0&&(c="/"),bf(s,a,c)}function bf(s,a,c,u){let f=typeof a=="string"?yr(a):a,h=Ri(f.pathname||"/",c);if(h==null)return null;let v=Xu(s);Rf(v);let y=null;for(let E=0;y==null&&E<v.length;++E){let m=$f(h);y=Bf(v[E],m)}return y}function Xu(s,a,c,u){a===void 0&&(a=[]),c===void 0&&(c=[]),u===void 0&&(u="");let f=(h,v,y)=>{let E={relativePath:y===void 0?h.path||"":y,caseSensitive:h.caseSensitive===!0,childrenIndex:v,route:h};E.relativePath.startsWith("/")&&(Oe(E.relativePath.startsWith(u),'Absolute route path "'+E.relativePath+'" nested under path '+('"'+u+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),E.relativePath=E.relativePath.slice(u.length));let m=yn([u,E.relativePath]),x=c.concat(E);h.children&&h.children.length>0&&(Oe(h.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+m+'".')),Xu(h.children,a,x,m)),!(h.path==null&&!h.index)&&a.push({path:m,score:Of(m,h.index),routesMeta:x})};return s.forEach((h,v)=>{var y;if(h.path===""||!((y=h.path)!=null&&y.includes("?")))f(h,v);else for(let E of Zu(h.path))f(h,v,E)}),a}function Zu(s){let a=s.split("/");if(a.length===0)return[];let[c,...u]=a,f=c.endsWith("?"),h=c.replace(/\?$/,"");if(u.length===0)return f?[h,""]:[h];let v=Zu(u.join("/")),y=[];return y.push(...v.map(E=>E===""?h:[h,E].join("/"))),f&&y.push(...v),y.map(E=>s.startsWith("/")&&E===""?"/":E)}function Rf(s){s.sort((a,c)=>a.score!==c.score?c.score-a.score:Ff(a.routesMeta.map(u=>u.childrenIndex),c.routesMeta.map(u=>u.childrenIndex)))}const Lf=/^:[\w-]+$/,zf=3,If=2,Af=1,Df=10,Mf=-2,zu=s=>s==="*";function Of(s,a){let c=s.split("/"),u=c.length;return c.some(zu)&&(u+=Mf),a&&(u+=If),c.filter(f=>!zu(f)).reduce((f,h)=>f+(Lf.test(h)?zf:h===""?Af:Df),u)}function Ff(s,a){return s.length===a.length&&s.slice(0,-1).every((u,f)=>u===a[f])?s[s.length-1]-a[a.length-1]:0}function Bf(s,a,c){let{routesMeta:u}=s,f={},h="/",v=[];for(let y=0;y<u.length;++y){let E=u[y],m=y===u.length-1,x=h==="/"?a:a.slice(h.length)||"/",k=Uf({path:E.relativePath,caseSensitive:E.caseSensitive,end:m},x),P=E.route;if(!k)return null;Object.assign(f,k.params),v.push({params:f,pathname:yn([h,k.pathname]),pathnameBase:Yf(yn([h,k.pathnameBase])),route:P}),k.pathnameBase!=="/"&&(h=yn([h,k.pathnameBase]))}return v}function Uf(s,a){typeof s=="string"&&(s={path:s,caseSensitive:!1,end:!0});let[c,u]=Wf(s.path,s.caseSensitive,s.end),f=a.match(c);if(!f)return null;let h=f[0],v=h.replace(/(.)\/+$/,"$1"),y=f.slice(1);return{params:u.reduce((m,x,k)=>{let{paramName:P,isOptional:H}=x;if(P==="*"){let w=y[k]||"";v=h.slice(0,h.length-w.length).replace(/(.)\/+$/,"$1")}const D=y[k];return H&&!D?m[P]=void 0:m[P]=(D||"").replace(/%2F/g,"/"),m},{}),pathname:h,pathnameBase:v,pattern:s}}function Wf(s,a,c){a===void 0&&(a=!1),c===void 0&&(c=!0),bi(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=[],f="^"+s.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(v,y,E)=>(u.push({paramName:y,isOptional:E!=null}),E?"/?([^\\/]+)?":"/([^\\/]+)"));return s.endsWith("*")?(u.push({paramName:"*"}),f+=s==="*"||s==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):c?f+="\\/*$":s!==""&&s!=="/"&&(f+="(?:(?=\\/|$))"),[new RegExp(f,a?void 0:"i"),u]}function $f(s){try{return s.split("/").map(a=>decodeURIComponent(a).replace(/\//g,"%2F")).join("/")}catch(a){return bi(!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 Ri(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 Kf=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Vf=s=>Kf.test(s);function Hf(s,a){a===void 0&&(a="/");let{pathname:c,search:u="",hash:f=""}=typeof s=="string"?yr(s):s,h;if(c)if(Vf(c))h=c;else{if(c.includes("//")){let v=c;c=c.replace(/\/\/+/g,"/"),bi(!1,"Pathnames cannot have embedded double slashes - normalizing "+(v+" -> "+c))}c.startsWith("/")?h=Iu(c.substring(1),"/"):h=Iu(c,a)}else h=a;return{pathname:h,search:Gf(u),hash:Jf(f)}}function Iu(s,a){let c=a.replace(/\/+$/,"").split("/");return s.split("/").forEach(f=>{f===".."?c.length>1&&c.pop():f!=="."&&c.push(f)}),c.length>1?c.join("/"):"/"}function ji(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 Qf(s){return s.filter((a,c)=>c===0||a.route.path&&a.route.path.length>0)}function Li(s,a){let c=Qf(s);return a?c.map((u,f)=>f===c.length-1?u.pathname:u.pathnameBase):c.map(u=>u.pathnameBase)}function zi(s,a,c,u){u===void 0&&(u=!1);let f;typeof s=="string"?f=yr(s):(f=dl({},s),Oe(!f.pathname||!f.pathname.includes("?"),ji("?","pathname","search",f)),Oe(!f.pathname||!f.pathname.includes("#"),ji("#","pathname","hash",f)),Oe(!f.search||!f.search.includes("#"),ji("#","search","hash",f)));let h=s===""||f.pathname==="",v=h?"/":f.pathname,y;if(v==null)y=c;else{let k=a.length-1;if(!u&&v.startsWith("..")){let P=v.split("/");for(;P[0]==="..";)P.shift(),k-=1;f.pathname=P.join("/")}y=k>=0?a[k]:"/"}let E=Hf(f,y),m=v&&v!=="/"&&v.endsWith("/"),x=(h||v===".")&&c.endsWith("/");return!E.pathname.endsWith("/")&&(m||x)&&(E.pathname+="/"),E}const yn=s=>s.join("/").replace(/\/\/+/g,"/"),Yf=s=>s.replace(/\/+$/,"").replace(/^\/*/,"/"),Gf=s=>!s||s==="?"?"":s.startsWith("?")?s:"?"+s,Jf=s=>!s||s==="#"?"":s.startsWith("#")?s:"#"+s;function qf(s){return s!=null&&typeof s.status=="number"&&typeof s.statusText=="string"&&typeof s.internal=="boolean"&&"data"in s}const ed=["post","put","patch","delete"];new Set(ed);const Xf=["get",...ed];new Set(Xf);/**
|
|
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 pl(){return pl=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},pl.apply(this,arguments)}const Ii=p.createContext(null),Zf=p.createContext(null),vn=p.createContext(null),Ns=p.createContext(null),Gt=p.createContext({outlet:null,matches:[],isDataRoute:!1}),td=p.createContext(null);function eh(s,a){let{relative:c}=a===void 0?{}:a;vr()||Oe(!1);let{basename:u,navigator:f}=p.useContext(vn),{hash:h,pathname:v,search:y}=rd(s,{relative:c}),E=v;return u!=="/"&&(E=v==="/"?u:yn([u,v])),f.createHref({pathname:E,search:y,hash:h})}function vr(){return p.useContext(Ns)!=null}function Un(){return vr()||Oe(!1),p.useContext(Ns).location}function nd(s){p.useContext(vn).static||p.useLayoutEffect(s)}function Ai(){let{isDataRoute:s}=p.useContext(Gt);return s?mh():th()}function th(){vr()||Oe(!1);let s=p.useContext(Ii),{basename:a,future:c,navigator:u}=p.useContext(vn),{matches:f}=p.useContext(Gt),{pathname:h}=Un(),v=JSON.stringify(Li(f,c.v7_relativeSplatPath)),y=p.useRef(!1);return nd(()=>{y.current=!0}),p.useCallback(function(m,x){if(x===void 0&&(x={}),!y.current)return;if(typeof m=="number"){u.go(m);return}let k=zi(m,JSON.parse(v),h,x.relative==="path");s==null&&a!=="/"&&(k.pathname=k.pathname==="/"?a:yn([a,k.pathname])),(x.replace?u.replace:u.push)(k,x.state,x)},[a,u,v,h,s])}const nh=p.createContext(null);function rh(s){let a=p.useContext(Gt).outlet;return a&&p.createElement(nh.Provider,{value:s},a)}function rd(s,a){let{relative:c}=a===void 0?{}:a,{future:u}=p.useContext(vn),{matches:f}=p.useContext(Gt),{pathname:h}=Un(),v=JSON.stringify(Li(f,u.v7_relativeSplatPath));return p.useMemo(()=>zi(s,JSON.parse(v),h,c==="path"),[s,v,h,c])}function lh(s,a){return sh(s,a)}function sh(s,a,c,u){vr()||Oe(!1);let{navigator:f}=p.useContext(vn),{matches:h}=p.useContext(Gt),v=h[h.length-1],y=v?v.params:{};v&&v.pathname;let E=v?v.pathnameBase:"/";v&&v.route;let m=Un(),x;if(a){var k;let S=typeof a=="string"?yr(a):a;E==="/"||(k=S.pathname)!=null&&k.startsWith(E)||Oe(!1),x=S}else x=m;let P=x.pathname||"/",H=P;if(E!=="/"){let S=E.replace(/^\//,"").split("/");H="/"+P.replace(/^\//,"").split("/").slice(S.length).join("/")}let D=Tf(s,{pathname:H}),w=uh(D&&D.map(S=>Object.assign({},S,{params:Object.assign({},y,S.params),pathname:yn([E,f.encodeLocation?f.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?E:yn([E,f.encodeLocation?f.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),h,c,u);return a&&w?p.createElement(Ns.Provider,{value:{location:pl({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:xn.Pop}},w):w}function oh(){let s=hh(),a=qf(s)?s.status+" "+s.statusText:s instanceof Error?s.message:JSON.stringify(s),c=s instanceof Error?s.stack:null,f={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},a),c?p.createElement("pre",{style:f},c):null,null)}const ih=p.createElement(oh,null);class ah extends p.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?p.createElement(Gt.Provider,{value:this.props.routeContext},p.createElement(td.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function ch(s){let{routeContext:a,match:c,children:u}=s,f=p.useContext(Ii);return f&&f.static&&f.staticContext&&(c.route.errorElement||c.route.ErrorBoundary)&&(f.staticContext._deepestRenderedBoundaryId=c.route.id),p.createElement(Gt.Provider,{value:a},u)}function uh(s,a,c,u){var f;if(a===void 0&&(a=[]),c===void 0&&(c=null),u===void 0&&(u=null),s==null){var h;if(!c)return null;if(c.errors)s=c.matches;else if((h=u)!=null&&h.v7_partialHydration&&a.length===0&&!c.initialized&&c.matches.length>0)s=c.matches;else return null}let v=s,y=(f=c)==null?void 0:f.errors;if(y!=null){let x=v.findIndex(k=>k.route.id&&(y==null?void 0:y[k.route.id])!==void 0);x>=0||Oe(!1),v=v.slice(0,Math.min(v.length,x+1))}let E=!1,m=-1;if(c&&u&&u.v7_partialHydration)for(let x=0;x<v.length;x++){let k=v[x];if((k.route.HydrateFallback||k.route.hydrateFallbackElement)&&(m=x),k.route.id){let{loaderData:P,errors:H}=c,D=k.route.loader&&P[k.route.id]===void 0&&(!H||H[k.route.id]===void 0);if(k.route.lazy||D){E=!0,m>=0?v=v.slice(0,m+1):v=[v[0]];break}}}return v.reduceRight((x,k,P)=>{let H,D=!1,w=null,S=null;c&&(H=y&&k.route.id?y[k.route.id]:void 0,w=k.route.errorElement||ih,E&&(m<0&&P===0?(gh("route-fallback"),D=!0,S=null):m===P&&(D=!0,S=k.route.hydrateFallbackElement||null)));let z=a.concat(v.slice(0,P+1)),W=()=>{let X;return H?X=w:D?X=S:k.route.Component?X=p.createElement(k.route.Component,null):k.route.element?X=k.route.element:X=x,p.createElement(ch,{match:k,routeContext:{outlet:x,matches:z,isDataRoute:c!=null},children:X})};return c&&(k.route.ErrorBoundary||k.route.errorElement||P===0)?p.createElement(ah,{location:c.location,revalidation:c.revalidation,component:w,error:H,children:W(),routeContext:{outlet:null,matches:z,isDataRoute:!0}}):W()},null)}var ld=(function(s){return s.UseBlocker="useBlocker",s.UseRevalidator="useRevalidator",s.UseNavigateStable="useNavigate",s})(ld||{}),sd=(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})(sd||{});function dh(s){let a=p.useContext(Ii);return a||Oe(!1),a}function ph(s){let a=p.useContext(Zf);return a||Oe(!1),a}function fh(s){let a=p.useContext(Gt);return a||Oe(!1),a}function od(s){let a=fh(),c=a.matches[a.matches.length-1];return c.route.id||Oe(!1),c.route.id}function hh(){var s;let a=p.useContext(td),c=ph(),u=od();return a!==void 0?a:(s=c.errors)==null?void 0:s[u]}function mh(){let{router:s}=dh(ld.UseNavigateStable),a=od(sd.UseNavigateStable),c=p.useRef(!1);return nd(()=>{c.current=!0}),p.useCallback(function(f,h){h===void 0&&(h={}),c.current&&(typeof f=="number"?s.navigate(f):s.navigate(f,pl({fromRouteId:a},h)))},[s,a])}const Au={};function gh(s,a,c){Au[s]||(Au[s]=!0)}function xh(s,a){s==null||s.v7_startTransition,s==null||s.v7_relativeSplatPath}function yh(s){let{to:a,replace:c,state:u,relative:f}=s;vr()||Oe(!1);let{future:h,static:v}=p.useContext(vn),{matches:y}=p.useContext(Gt),{pathname:E}=Un(),m=Ai(),x=zi(a,Li(y,h.v7_relativeSplatPath),E,f==="path"),k=JSON.stringify(x);return p.useEffect(()=>m(JSON.parse(k),{replace:c,state:u,relative:f}),[m,k,f,c,u]),null}function id(s){return rh(s.context)}function pt(s){Oe(!1)}function vh(s){let{basename:a="/",children:c=null,location:u,navigationType:f=xn.Pop,navigator:h,static:v=!1,future:y}=s;vr()&&Oe(!1);let E=a.replace(/^\/*/,"/"),m=p.useMemo(()=>({basename:E,navigator:h,static:v,future:pl({v7_relativeSplatPath:!1},y)}),[E,y,h,v]);typeof u=="string"&&(u=yr(u));let{pathname:x="/",search:k="",hash:P="",state:H=null,key:D="default"}=u,w=p.useMemo(()=>{let S=Ri(x,E);return S==null?null:{location:{pathname:S,search:k,hash:P,state:H,key:D},navigationType:f}},[E,x,k,P,H,D,f]);return w==null?null:p.createElement(vn.Provider,{value:m},p.createElement(Ns.Provider,{children:c,value:w}))}function ad(s){let{children:a,location:c}=s;return lh(Ni(a),c)}new Promise(()=>{});function Ni(s,a){a===void 0&&(a=[]);let c=[];return p.Children.forEach(s,(u,f)=>{if(!p.isValidElement(u))return;let h=[...a,f];if(u.type===p.Fragment){c.push.apply(c,Ni(u.props.children,h));return}u.type!==pt&&Oe(!1),!u.props.index||!u.props.children||Oe(!1);let v={id:u.props.id||h.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&&(v.children=Ni(u.props.children,h)),c.push(v)}),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 _i(){return _i=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},_i.apply(this,arguments)}function jh(s,a){if(s==null)return{};var c={},u=Object.keys(s),f,h;for(h=0;h<u.length;h++)f=u[h],!(a.indexOf(f)>=0)&&(c[f]=s[f]);return c}function Sh(s){return!!(s.metaKey||s.altKey||s.ctrlKey||s.shiftKey)}function wh(s,a){return s.button===0&&(!a||a==="_self")&&!Sh(s)}function Pi(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(f=>[c,f]):[[c,u]])},[]))}function kh(s,a){let c=Pi(s);return a&&a.forEach((u,f)=>{c.has(f)||a.getAll(f).forEach(h=>{c.append(f,h)})}),c}const Ch=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Eh="6";try{window.__reactRouterVersion=Eh}catch{}const Nh="startTransition",Du=jf[Nh];function cd(s){let{basename:a,children:c,future:u,window:f}=s,h=p.useRef();h.current==null&&(h.current=Nf({window:f,v5Compat:!0}));let v=h.current,[y,E]=p.useState({action:v.action,location:v.location}),{v7_startTransition:m}=u||{},x=p.useCallback(k=>{m&&Du?Du(()=>E(k)):E(k)},[E,m]);return p.useLayoutEffect(()=>v.listen(x),[v,x]),p.useEffect(()=>xh(u),[u]),p.createElement(vh,{basename:a,children:c,location:y.location,navigationType:y.action,navigator:v,future:u})}const _h=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ph=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Yt=p.forwardRef(function(a,c){let{onClick:u,relative:f,reloadDocument:h,replace:v,state:y,target:E,to:m,preventScrollReset:x,viewTransition:k}=a,P=jh(a,Ch),{basename:H}=p.useContext(vn),D,w=!1;if(typeof m=="string"&&Ph.test(m)&&(D=m,_h))try{let X=new URL(window.location.href),Q=m.startsWith("//")?new URL(X.protocol+m):new URL(m),G=Ri(Q.pathname,H);Q.origin===X.origin&&G!=null?m=G+Q.search+Q.hash:w=!0}catch{}let S=eh(m,{relative:f}),z=Th(m,{replace:v,state:y,target:E,preventScrollReset:x,relative:f,viewTransition:k});function W(X){u&&u(X),X.defaultPrevented||z(X)}return p.createElement("a",_i({},P,{href:D||S,onClick:w||h?u:W,ref:c,target:E}))});var Mu;(function(s){s.UseScrollRestoration="useScrollRestoration",s.UseSubmit="useSubmit",s.UseSubmitFetcher="useSubmitFetcher",s.UseFetcher="useFetcher",s.useViewTransitionState="useViewTransitionState"})(Mu||(Mu={}));var Ou;(function(s){s.UseFetcher="useFetcher",s.UseFetchers="useFetchers",s.UseScrollRestoration="useScrollRestoration"})(Ou||(Ou={}));function Th(s,a){let{target:c,replace:u,state:f,preventScrollReset:h,relative:v,viewTransition:y}=a===void 0?{}:a,E=Ai(),m=Un(),x=rd(s,{relative:v});return p.useCallback(k=>{if(wh(k,c)){k.preventDefault();let P=u!==void 0?u:Es(m)===Es(x);E(s,{replace:P,state:f,preventScrollReset:h,relative:v,viewTransition:y})}},[m,E,x,u,f,c,s,h,v,y])}function bh(s){let a=p.useRef(Pi(s)),c=p.useRef(!1),u=Un(),f=p.useMemo(()=>kh(u.search,c.current?null:a.current),[u.search]),h=Ai(),v=p.useCallback((y,E)=>{const m=Pi(typeof y=="function"?y(f):y);c.current=!0,h("?"+m,E)},[h,f]);return[f,v]}function ud({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(id,{})})]})}const Rh="/api/agent/events",Lh="/api/agent/status",zh=5,Ih=3e4,Ah=3e3;function Dh(s){const a=Math.min(1e3*2**s,Ih),c=a*.3*Math.random();return a+c}function Mh(){const[s,a]=p.useState("stopped"),[c,u]=p.useState(null),f=p.useRef(!0),h=p.useRef(null),v=p.useRef(0),y=p.useRef(null),E=p.useRef(null),m=p.useRef(!1);return p.useEffect(()=>{f.current=!0;function x(S){if(f.current)try{const z=JSON.parse(S.data);a(z.state),u(z.error??null),v.current=0}catch{}}function k(){h.current&&(h.current.removeEventListener("status",x),h.current.close(),h.current=null)}function P(){E.current&&(clearInterval(E.current),E.current=null)}function H(){if(E.current)return;const S=async()=>{if(f.current)try{const z=await fetch(Lh,{credentials:"include"});if(!z.ok)return;const W=await z.json(),X=W.data??W;f.current&&(a(X.state),u(X.error??null))}catch{}};S(),E.current=setInterval(S,Ah)}function D(){if(!f.current)return;k();const S=new EventSource(Rh,{withCredentials:!0});h.current=S,S.addEventListener("status",x),S.addEventListener("open",()=>{v.current=0,m.current=!1,P()}),S.onerror=()=>{if(k(),!!f.current)if(v.current+=1,v.current<=zh){const z=Dh(v.current-1);y.current=setTimeout(D,z)}else m.current=!0,H()}}function w(){document.hidden?(k(),P(),y.current&&(clearTimeout(y.current),y.current=null)):(v.current=0,m.current=!1,D())}return D(),document.addEventListener("visibilitychange",w),()=>{f.current=!1,k(),P(),y.current&&(clearTimeout(y.current),y.current=null),document.removeEventListener("visibilitychange",w)}},[]),{state:s,error:c}}const Fu="/api",Oh=3,Fh=[1e3,2e3,4e3];function Bh(s){return s+s*.3*Math.random()}const Uh={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 Wh(){const{state:s,error:a}=Mh(),[c,u]=p.useState(!1),[f,h]=p.useState(!1),[v,y]=p.useState(null),[E,m]=p.useState(!1),x=p.useRef(null),k=p.useRef(null),P=a&&s==="stopped"?"error":s,H=Uh[P],D=p.useCallback(()=>{x.current&&(clearTimeout(x.current),x.current=null),m(!1)},[]),w=p.useCallback(async(G=0)=>{u(!0),y(null),k.current=new AbortController;try{const F=await fetch(`${Fu}/agent/start`,{method:"POST",credentials:"include",signal:AbortSignal.timeout(1e4)}),te=await F.json();if(!F.ok&&te.error)throw new Error(te.error)}catch(F){if(!x.current&&G<Oh){m(!0);const te=Bh(Fh[G]??4e3);x.current=setTimeout(()=>{x.current=null,w(G+1)},te),y(F instanceof Error?F.message:String(F)),u(!1);return}y(F instanceof Error?F.message:String(F)),m(!1)}finally{u(!1),k.current=null}},[]),S=p.useCallback(async()=>{h(!1),u(!0),y(null),D();try{const G=await fetch(`${Fu}/agent/stop`,{method:"POST",credentials:"include",signal:AbortSignal.timeout(1e4)}),F=await G.json();if(!G.ok&&F.error)throw new Error(F.error)}catch(G){y(G instanceof Error?G.message:String(G))}finally{u(!1)}},[D]),z=()=>{D(),w(0)},W=()=>{h(!0)},X=P==="stopped"||P==="error",Q=P==="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:H.dot,animation:H.pulse?"agent-pulse 2s ease-in-out infinite":"none",flexShrink:0}}),r.jsx("span",{style:{fontSize:"12px",fontWeight:500,color:"var(--text-secondary)"},children:H.label})]}),X&&!E&&r.jsx("button",{onClick:z,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"}),Q&&r.jsx("button",{onClick:W,disabled:c,className:"btn-danger",style:{width:"100%",fontSize:"12px",padding:"6px 12px"},children:c?"Stopping...":"Stop Agent"}),E&&r.jsx("div",{style:{fontSize:"11px",color:"var(--text-tertiary)",marginTop:"4px"},children:"Retrying..."}),v&&!E&&r.jsx("div",{style:{fontSize:"11px",color:"var(--red)",marginTop:"4px",lineHeight:"1.4",wordBreak:"break-word"},children:v}),f&&qu.createPortal(r.jsx("div",{className:"modal-overlay",onClick:()=>h(!1),children:r.jsxs("div",{className:"modal",onClick:G=>G.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:()=>h(!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 Di="/api";async function rt(s,a){const c={"Content-Type":"application/json",...a==null?void 0:a.headers},u=await fetch(`${Di}${s}`,{...a,headers:c});if(!u.ok){const h=await u.json().catch(()=>({error:u.statusText}));throw new Error(h.error||`HTTP ${u.status}`)}const f=await u.json();return f.data!==void 0?f.data:f}async function je(s,a){const c={"Content-Type":"application/json",...a==null?void 0:a.headers},u=await fetch(`${Di}${s}`,{...a,headers:c,credentials:"include"});if(!u.ok){const f=await u.json().catch(()=>({error:u.statusText}));throw new Error(f.error||`HTTP ${u.status}`)}return u.json()}async function $h(){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 Bu(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 Kh(){await fetch("/auth/logout",{method:"POST",credentials:"include"}).catch(()=>{})}const pe={async getStatus(){return je("/status")},async getTools(){return je("/tools")},async getMemoryStats(){return je("/memory/stats")},async searchKnowledge(s,a=10){return je(`/memory/search?q=${encodeURIComponent(s)}&limit=${a}`)},async getMemorySources(){return je("/memory/sources")},async getSourceChunks(s){return je(`/memory/sources/${encodeURIComponent(s)}`)},async getSoulFile(s){return je(`/soul/${s}`)},async updateSoulFile(s,a){return je(`/soul/${s}`,{method:"PUT",body:JSON.stringify({content:a})})},async getPlugins(){return je("/plugins")},async getToolRag(){return je("/tools/rag")},async updateToolRag(s){return je("/tools/rag",{method:"PUT",body:JSON.stringify(s)})},async getMcpServers(){return je("/mcp")},async addMcpServer(s){return je("/mcp",{method:"POST",body:JSON.stringify(s)})},async removeMcpServer(s){return je(`/mcp/${encodeURIComponent(s)}`,{method:"DELETE"})},async updateToolConfig(s,a){return je(`/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 je(`/workspace${u?`?${u}`:""}`)},async workspaceRead(s){return je(`/workspace/read?path=${encodeURIComponent(s)}`)},async workspaceWrite(s,a){return je("/workspace/write",{method:"POST",body:JSON.stringify({path:s,content:a})})},async workspaceMkdir(s){return je("/workspace/mkdir",{method:"POST",body:JSON.stringify({path:s})})},async workspaceDelete(s,a=!1){return je("/workspace",{method:"DELETE",body:JSON.stringify({path:s,recursive:a})})},async workspaceRename(s,a){return je("/workspace/rename",{method:"POST",body:JSON.stringify({from:s,to:a})})},async workspaceInfo(){return je("/workspace/info")},workspaceRawUrl(s){return`/api/workspace/raw?path=${encodeURIComponent(s)}`},async tasksList(s){const a=s?`?status=${s}`:"";return je(`/tasks${a}`)},async tasksGet(s){return je(`/tasks/${s}`)},async tasksDelete(s){return je(`/tasks/${s}`,{method:"DELETE"})},async tasksCancel(s){return je(`/tasks/${s}/cancel`,{method:"POST"})},async tasksClean(s){return je("/tasks/clean",{method:"POST",body:JSON.stringify({status:s})})},async tasksCleanDone(){return je("/tasks/clean-done",{method:"POST"})},async getConfigKeys(){return je("/config")},async setConfigKey(s,a){return je(`/config/${s}`,{method:"PUT",body:JSON.stringify({value:a})})},async unsetConfigKey(s){return je(`/config/${s}`,{method:"DELETE"})},async getModelsForProvider(s){return je(`/config/models/${encodeURIComponent(s)}`)},async getProviderMeta(s){return je(`/config/provider-meta/${encodeURIComponent(s)}`)},async validateApiKey(s,a){return je("/config/validate-api-key",{method:"POST",body:JSON.stringify({provider:s,apiKey:a})})},async getMarketplace(s=!1){return je(`/marketplace${s?"?refresh=true":""}`)},async installPlugin(s){return je("/marketplace/install",{method:"POST",body:JSON.stringify({id:s})})},async uninstallPlugin(s){return je("/marketplace/uninstall",{method:"POST",body:JSON.stringify({id:s})})},async updatePlugin(s){return je("/marketplace/update",{method:"POST",body:JSON.stringify({id:s})})},async getPluginSecrets(s){return je(`/marketplace/secrets/${encodeURIComponent(s)}`)},async setPluginSecret(s,a,c){return je(`/marketplace/secrets/${encodeURIComponent(s)}/${encodeURIComponent(a)}`,{method:"PUT",body:JSON.stringify({value:c})})},async unsetPluginSecret(s,a){return je(`/marketplace/secrets/${encodeURIComponent(s)}/${encodeURIComponent(a)}`,{method:"DELETE"})},connectLogs(s,a){const c=`${Di}/logs/stream`,u=new EventSource(c);return u.addEventListener("log",f=>{try{const h=JSON.parse(f.data);s(h)}catch(h){console.error("Failed to parse log entry:",h)}}),u.onerror=f=>{a==null||a(f)},()=>u.close()}},Xe={getStatus:()=>rt("/setup/status"),getProviders:()=>rt("/setup/providers"),getModels:s=>rt(`/setup/models/${encodeURIComponent(s)}`),validateApiKey:(s,a)=>rt("/setup/validate/api-key",{method:"POST",body:JSON.stringify({provider:s,apiKey:a})}),detectClaudeCodeKey:()=>rt("/setup/detect-claude-code-key"),validateBotToken:s=>rt("/setup/validate/bot-token",{method:"POST",body:JSON.stringify({token:s})}),initWorkspace:s=>rt("/setup/workspace/init",{method:"POST",body:JSON.stringify({agentName:s})}),getWalletStatus:()=>rt("/setup/wallet/status"),generateWallet:()=>rt("/setup/wallet/generate",{method:"POST"}),importWallet:s=>rt("/setup/wallet/import",{method:"POST",body:JSON.stringify({mnemonic:s})}),sendCode:(s,a,c)=>rt("/setup/telegram/send-code",{method:"POST",body:JSON.stringify({apiId:s,apiHash:a,phone:c})}),verifyCode:(s,a)=>rt("/setup/telegram/verify-code",{method:"POST",body:JSON.stringify({authSessionId:s,code:a})}),verifyPassword:(s,a)=>rt("/setup/telegram/verify-password",{method:"POST",body:JSON.stringify({authSessionId:s,password:a})}),resendCode:s=>rt("/setup/telegram/resend-code",{method:"POST",body:JSON.stringify({authSessionId:s})}),saveConfig:s=>rt("/setup/config/save",{method:"POST",body:JSON.stringify(s)}),launch:()=>rt("/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 f=await u.json();if(f.success&&f.data&&!f.data.setup)return}}catch{}await new Promise(u=>setTimeout(u,c))}throw new Error("Agent did not start within the expected time")}};function Vh(){const s=Un(),a=u=>s.pathname===u,c=async()=>{await Kh(),window.location.href="/"};return r.jsxs(r.Fragment,{children:[r.jsxs("nav",{children:[r.jsx(Yt,{to:"/",className:a("/")?"active":"",children:"Dashboard"}),r.jsx(Yt,{to:"/tools",className:a("/tools")?"active":"",children:"Tools"}),r.jsx(Yt,{to:"/plugins",className:a("/plugins")?"active":"",children:"Plugins"}),r.jsx(Yt,{to:"/soul",className:a("/soul")?"active":"",children:"Soul"}),r.jsx(Yt,{to:"/memory",className:a("/memory")?"active":"",children:"Memory"}),r.jsx(Yt,{to:"/workspace",className:a("/workspace")?"active":"",children:"Workspace"}),r.jsx(Yt,{to:"/tasks",className:a("/tasks")?"active":"",children:"Tasks"}),r.jsx(Yt,{to:"/mcp",className:a("/mcp")?"active":"",children:"MCP"}),r.jsx(Yt,{to:"/config",className:a("/config")?"active":"",children:"Config"})]}),r.jsxs("div",{style:{marginTop:"auto"},children:[r.jsx(Wh,{}),r.jsx("div",{style:{padding:"0 12px 14px"},children:r.jsx("button",{onClick:c,style:{width:"100%",opacity:.7,fontSize:"13px"},children:"Logout"})})]})]})}function Hh(){return r.jsx(ud,{sidebar:r.jsx(Vh,{})})}class dd extends p.Component{constructor(){super(...arguments);Ft(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 pd(){const[s,a]=p.useState(null),[c,u]=p.useState(null),[f,h]=p.useState(null),[v,y]=p.useState(!0),[E,m]=p.useState(null),[x,k]=p.useState(null),[P,H]=p.useState([]),[D,w]=p.useState(null),[S,z]=p.useState(null),[W,X]=p.useState(""),[Q,G]=p.useState(!1),[F,te]=p.useState(null),[re,V]=p.useState({}),[I,A]=p.useState({}),ee=p.useCallback(()=>{Promise.all([pe.getStatus(),pe.getMemoryStats(),pe.getConfigKeys(),pe.getToolRag()]).then(([le,de,ge,ke])=>{a(le.data),u(de.data),h(ke.data);const Ce={};for(const Ee of ge.data)Ee.value!=null&&(Ce[Ee.key]=Ee.value);V(Ce),A(Ce),y(!1)}).catch(le=>{m(le.message),y(!1)})},[]);p.useEffect(()=>{ee()},[ee]);const b=le=>I[le]??"",ne=le=>re[le]??"",ce=le=>{A(de=>({...de,[le]:re[le]??""}))},ve=le=>{k(le),setTimeout(()=>k(null),2e3)},ye=async(le,de)=>{if(de.trim())try{m(null),await pe.setConfigKey(le,de.trim()),await ee(),ve(`Saved ${le.split(".").pop()}`)}catch(ge){m(ge instanceof Error?ge.message:String(ge))}},L=async le=>{try{const de=await pe.updateToolRag(le);h(de.data),ve("Tool RAG updated")}catch(de){m(de instanceof Error?de.message:String(de))}},Z=(le,de)=>{A(ge=>({...ge,[le]:de}))},B=b("agent.provider");return p.useEffect(()=>{B&&pe.getModelsForProvider(B).then(le=>{const de=le.data.map(ke=>({value:ke.value,name:ke.name}));H(de);const ge=I["agent.model"]??"";de.length>0&&!de.some(ke=>ke.value===ge)&&ye("agent.model",de[0].value)}).catch(()=>H([]))},[B]),{loading:v,error:E,setError:m,saveSuccess:x,status:s,stats:c,toolRag:f,localInputs:I,getLocal:b,getServer:ne,setLocal:Z,cancelLocal:ce,saveConfig:ye,saveToolRag:L,showSuccess:ve,modelOptions:P,pendingProvider:D,pendingMeta:S,pendingApiKey:W,setPendingApiKey:X,pendingValidating:Q,pendingError:F,setPendingError:te,handleProviderChange:async le=>{if(le!==B)try{const ge=(await pe.getProviderMeta(le)).data;ge.needsKey?(w(le),z(ge),X(""),te(null)):(await ye("agent.provider",le),w(null),z(null))}catch(de){m(de instanceof Error?de.message:String(de))}},handleProviderConfirm:async()=>{if(!(!D||!S)){if(S.needsKey&&!W.trim()){te("API key is required");return}G(!0),te(null);try{const le=await pe.validateApiKey(D,W);if(!le.data.valid){te(le.data.error||"Invalid API key"),G(!1);return}await pe.setConfigKey("agent.api_key",W.trim()),await ye("agent.provider",D),w(null),z(null),X(""),ve(`Switched to ${S.displayName}`)}catch(le){te(le instanceof Error?le.message:String(le))}finally{G(!1)}}},handleProviderCancel:()=>{w(null),z(null),X(""),te(null)},loadData:ee}}function yt({value:s,options:a,labels:c,onChange:u,style:f}){const[h,v]=p.useState(!1),[y,E]=p.useState(-1),[m,x]=p.useState(null),k=p.useRef(null),P=p.useRef(null),H=p.useRef(Math.random().toString(36).slice(2));p.useEffect(()=>{if(!h)return;const S=z=>{var Q,G;const W=z.target;((Q=k.current)==null?void 0:Q.contains(W))||((G=P.current)==null?void 0:G.contains(W))||v(!1)};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[h]),p.useEffect(()=>{if(h&&k.current){const S=k.current.getBoundingClientRect();x({top:S.bottom+4,left:S.left,width:S.width})}else x(null)},[h]),p.useEffect(()=>{if(h){const S=a.indexOf(s);E(S>=0?S:0)}},[h,a,s]),p.useEffect(()=>{if(!h||y<0||!P.current)return;const S=P.current.children[y];S==null||S.scrollIntoView({block:"nearest"})},[h,y]);const D=p.useCallback(S=>{if(!h){(S.key==="Enter"||S.key===" "||S.key==="ArrowDown")&&(S.preventDefault(),v(!0));return}switch(S.key){case"ArrowDown":S.preventDefault(),E(z=>(z+1)%a.length);break;case"ArrowUp":S.preventDefault(),E(z=>(z-1+a.length)%a.length);break;case"Enter":case" ":S.preventDefault(),y>=0&&y<a.length&&(u(a[y]),v(!1));break;case"Escape":S.preventDefault(),v(!1);break;case"Home":S.preventDefault(),E(0);break;case"End":S.preventDefault(),E(a.length-1);break}},[h,y,a,u]),w=`select-menu-${H.current}`;return r.jsxs("div",{ref:k,className:"custom-select",style:f,children:[r.jsxs("button",{type:"button",className:"custom-select-trigger",onClick:()=>v(!h),onKeyDown:D,"aria-haspopup":"listbox","aria-expanded":h,"aria-controls":h?w: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"})})]}),h&&m&&qu.createPortal(r.jsx("div",{ref:P,id:w,className:"custom-select-menu",role:"listbox","aria-activedescendant":y>=0?`${w}-opt-${y}`:void 0,style:{position:"fixed",top:m.top,left:m.left,width:m.width},children:a.map((S,z)=>r.jsx("div",{id:`${w}-opt-${z}`,role:"option","aria-selected":S===s,className:`custom-select-option${S===s?" active":""}${z===y?" focused":""}`,onClick:()=>{u(S),v(!1)},onMouseEnter:()=>E(z),children:c?c[z]??S:S},S))}),document.body)]})}const Uu="rgba(24, 24, 27, 0.95)",Qh=75;function Ye({text:s}){const[a,c]=p.useState(!1),u=p.useId(),f=p.useRef(null),h=p.useCallback(()=>{f.current&&clearTimeout(f.current),c(!0)},[]),v=p.useCallback(()=>{f.current=setTimeout(()=>c(!1),Qh)},[]);return p.useEffect(()=>{if(!a)return;const y=E=>{E.key==="Escape"&&c(!1)};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[a]),p.useEffect(()=>()=>{f.current&&clearTimeout(f.current)},[]),r.jsxs("span",{style:{position:"relative",display:"inline-flex",alignItems:"center",marginLeft:"6px"},onMouseEnter:h,onMouseLeave:v,onFocus:h,onBlur:v,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:h,onMouseLeave:v,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:Uu,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:Uu,borderRight:"1px solid var(--glass-border)",borderBottom:"1px solid var(--glass-border)"}})]})]})}function ft({label:s,description:a,type:c="text",value:u,serverValue:f,onChange:h,onSave:v,onCancel:y,min:E,max:m,step:x,placeholder:k,hotReload:P,badge:H,inline:D}){const[w,S]=p.useState(!1),z=p.useRef(null),W=u!==f,X=async()=>{if(!(!W||w)){S(!0);try{await v(u)}finally{S(!1)}}},Q=()=>{w||y()},G=A=>{A.key==="Enter"?(A.preventDefault(),X()):A.key==="Escape"&&(A.preventDefault(),Q())};p.useEffect(()=>{w&&z.current&&z.current.blur()},[w]);const F=H?r.jsx("span",{style:{fontSize:11,padding:"1px 6px",borderRadius:4,backgroundColor:H==="Set"?"var(--accent)":"var(--red)",color:"var(--text-on-accent)",marginLeft:6,fontWeight:500},children:H}):null,te=P==="restart"?r.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)",marginLeft:6},children:"(requires restart)"}):null,re=r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4},children:[r.jsx("span",{children:s}),a&&r.jsx(Ye,{text:a}),F,te]}),V=W?r.jsxs("div",{style:{display:"flex",gap:4,flexShrink:0},children:[r.jsx("button",{onClick:X,disabled:w,style:{padding:"4px 8px",fontSize:13,border:"1px solid var(--accent)",borderRadius:4,background:"var(--accent)",color:"var(--text-on-accent)",cursor:w?"wait":"pointer",opacity:w?.6:1,lineHeight:1},children:w?"...":"✓"}),r.jsx("button",{onClick:Q,disabled:w,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,I=r.jsx("input",{ref:z,type:c,value:u,onChange:A=>h(A.target.value),onKeyDown:G,disabled:w,placeholder:k,min:E,max:m,step:x,style:{flex:1,padding:"6px 10px",fontSize:14,border:"1px solid var(--separator)",borderRadius:4,background:"var(--surface)",color:"var(--text)",minWidth:0}});return D?r.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,minHeight:36},children:[r.jsx("div",{style:{flex:"0 0 auto",minWidth:120},children:re}),r.jsxs("div",{style:{flex:1,display:"flex",gap:6,alignItems:"center"},children:[I,V]})]}):r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:re}),r.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[I,V]})]})}function fd({getLocal:s,getServer:a=()=>"",setLocal:c,saveConfig:u,cancelLocal:f=()=>{},modelOptions:h,pendingProvider:v,pendingMeta:y,pendingApiKey:E,setPendingApiKey:m,pendingValidating:x,pendingError:k,setPendingError:P,handleProviderChange:H,handleProviderConfirm:D,handleProviderCancel:w,compact:S=!1}){return r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"section-title",children:"Agent"}),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(Ye,{text:"LLM provider"})]}),r.jsx(yt,{value:v??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:H})]}),v&&y&&r.jsxs("div",{className:"provider-switch-zone",children:[r.jsxs("div",{style:{fontSize:"13px",fontWeight:500,marginBottom:"12px"},children:["Switching to ",y.displayName]}),y.needsKey&&r.jsxs("div",{className:"form-group",style:{marginBottom:"8px"},children:[r.jsx("label",{children:"API Key"}),r.jsx("input",{type:"password",placeholder:y.keyHint,value:E,onChange:z=>{m(z.target.value),P(null)},onKeyDown:z=>z.key==="Enter"&&D(),style:{width:"100%"},autoFocus:!0}),y.consoleUrl&&r.jsxs("a",{href:y.consoleUrl,target:"_blank",rel:"noopener noreferrer",style:{fontSize:"12px",color:"var(--text-secondary)",marginTop:"4px",display:"inline-block"},children:["Get key at ",new URL(y.consoleUrl).hostname," ↗"]})]}),k&&r.jsx("div",{style:{fontSize:"12px",color:"var(--red)",marginBottom:"8px"},children:k}),r.jsxs("div",{style:{display:"flex",gap:"8px"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:w,disabled:x,children:"Cancel"}),r.jsx("button",{className:"btn-sm",onClick:D,disabled:x,children:x?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(Ye,{text:"Main LLM model ID"})]}),r.jsx(yt,{value:s("agent.model"),options:h.map(z=>z.value),labels:h.map(z=>z.name),onChange:z=>u("agent.model",z)})]}),!S&&r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsx(ft,{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:z=>c("agent.temperature",z),onSave:z=>u("agent.temperature",z),onCancel:()=>f("agent.temperature"),min:0,max:2,step:.1,inline:!0}),r.jsx(ft,{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:z=>c("agent.max_tokens",z),onSave:z=>u("agent.max_tokens",z),onCancel:()=>f("agent.max_tokens"),min:1,inline:!0}),r.jsx(ft,{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:z=>c("agent.max_agentic_iterations",z),onSave:z=>u("agent.max_agentic_iterations",z),onCancel:()=>f("agent.max_agentic_iterations"),min:1,max:20,inline:!0})]})]})]})}function ul({value:s,onChange:a,validate:c,placeholder:u,disabled:f}){const[h,v]=p.useState(s),[y,E]=p.useState(""),[m,x]=p.useState(null),[k,P]=p.useState(-1),[H,D]=p.useState(-1),w=p.useRef(null),S=p.useRef([]);p.useEffect(()=>{v(s)},[s]);const z=JSON.stringify(h)!==JSON.stringify(s),W=p.useCallback(V=>{const I=V.trim();if(I){if(c){const A=c(I);if(A){x(A);return}}if(h.includes(I)){x("Duplicate item");return}x(null),v(A=>[...A,I]),E("")}},[h,c]),X=p.useCallback(V=>{var I;if(v(A=>A.filter((ee,b)=>b!==V)),h.length<=1)(I=w.current)==null||I.focus(),P(-1);else if(V>=h.length-1){const A=V-1;P(A),setTimeout(()=>{var ee;return(ee=S.current[A])==null?void 0:ee.focus()},0)}else P(V),setTimeout(()=>{var A;return(A=S.current[V])==null?void 0:A.focus()},0)},[h.length]),Q=p.useCallback(V=>{var I;if(!V.nativeEvent.isComposing){if(V.key==="Enter")V.preventDefault(),W(y);else if(V.key==="Backspace"&&y===""&&h.length>0){const A=h.length-1;P(A),(I=S.current[A])==null||I.focus()}}},[y,W,h.length]),G=p.useCallback((V,I)=>{var A,ee,b,ne,ce,ve;switch(V.key){case"ArrowLeft":V.preventDefault(),I>0&&(P(I-1),(A=S.current[I-1])==null||A.focus());break;case"ArrowRight":V.preventDefault(),I<h.length-1?(P(I+1),(ee=S.current[I+1])==null||ee.focus()):(P(-1),(b=w.current)==null||b.focus());break;case"Delete":case"Backspace":V.preventDefault(),X(I);break;case"Escape":V.preventDefault(),P(-1),(ne=w.current)==null||ne.focus();break;case"Home":V.preventDefault(),P(0),(ce=S.current[0])==null||ce.focus();break;case"End":if(V.preventDefault(),h.length>0){const ye=h.length-1;P(ye),(ve=S.current[ye])==null||ve.focus()}break}},[h.length,X]),F=p.useCallback(V=>{const A=V.clipboardData.getData("text").split(/[,;\n\t]+/).map(b=>b.trim()).filter(Boolean);if(A.length<=1)return;V.preventDefault();const ee=[];for(const b of A)h.includes(b)||ee.includes(b)||c&&c(b)||ee.push(b);ee.length>0&&(v(b=>[...b,...ee]),x(null))},[h,c]),te=()=>{a(h)},re=()=>{v(s),x(null)};return r.jsxs("div",{style:{opacity:f?.5:1},children:[h.length>0&&r.jsx("div",{role:"listbox","aria-orientation":"horizontal",style:{display:"flex",flexWrap:"wrap",gap:"6px",marginBottom:"var(--space-sm)"},children:h.map((V,I)=>r.jsxs("div",{ref:A=>{S.current[I]=A},role:"option","aria-selected":"true",tabIndex:k===I?0:-1,onKeyDown:A=>G(A,I),onFocus:()=>P(I),onBlur:()=>{k===I&&P(-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:k===I?"2px solid var(--accent)":"none",outlineOffset:k===I?"1px":void 0,cursor:"default"},children:[r.jsx("span",{style:{fontFamily:"var(--font-mono)",letterSpacing:"-0.2px"},children:V}),r.jsx("button",{type:"button","aria-label":`Remove ${V}`,disabled:f,onClick:A=>{A.stopPropagation(),X(I)},onMouseEnter:()=>D(I),onMouseLeave:()=>D(-1),style:{background:"none",border:"none",color:H===I?"var(--red)":"var(--text-tertiary)",cursor:f?"not-allowed":"pointer",padding:"0 1px",fontSize:"13px",lineHeight:"1",transition:"color 0.15s"},children:"×"})]},`${V}-${I}`))}),r.jsxs("div",{style:{display:"flex",gap:"6px",alignItems:"center"},children:[r.jsx("input",{ref:w,type:"text",value:y,onChange:V=>{E(V.target.value),x(null)},onKeyDown:Q,onPaste:F,placeholder:u??"Add pattern…",disabled:f,"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:V=>{V.target.style.borderColor="var(--glass-border-strong)"},onBlur:V=>{V.target.style.borderColor="var(--glass-border)"}}),r.jsx("button",{type:"button",disabled:f||!y.trim(),onClick:()=>W(y),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}),z&&r.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"var(--space-sm)"},children:[r.jsx("button",{type:"button",onClick:te,disabled:f,style:{padding:"4px 12px",fontSize:"var(--font-sm)",borderRadius:"6px",minHeight:"auto"},children:"Save"}),r.jsx("button",{type:"button",className:"btn-ghost",onClick:re,disabled:f,style:{padding:"4px 12px",fontSize:"var(--font-sm)",borderRadius:"6px",minHeight:"auto"},children:"Cancel"})]})]})}function Si(s){if(!s)return[];try{return JSON.parse(s).map(String)}catch{return[]}}function hd({getLocal:s,getServer:a=()=>"",setLocal:c,saveConfig:u,cancelLocal:f=()=>{},onArraySave:h,extended:v}){const y=r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"section-title",children:"Telegram"}),r.jsxs("div",{style:{display:"grid",gap:"16px"},children:[v&&r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsx(ft,{label:"Bot Username",description:"Bot username without @",configKey:"telegram.bot_username",value:s("telegram.bot_username"),serverValue:a("telegram.bot_username"),onChange:m=>c("telegram.bot_username",m),onSave:m=>u("telegram.bot_username",m),onCancel:()=>f("telegram.bot_username")}),r.jsx(ft,{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:m=>c("telegram.owner_name",m),onSave:m=>u("telegram.owner_name",m),onCancel:()=>f("telegram.owner_name")}),r.jsx(ft,{label:"Owner Username",description:"Owner's Telegram username (without @)",configKey:"telegram.owner_username",value:s("telegram.owner_username"),serverValue:a("telegram.owner_username"),onChange:m=>c("telegram.owner_username",m),onSave:m=>u("telegram.owner_username",m),onCancel:()=>f("telegram.owner_username")}),r.jsx(ft,{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:m=>c("telegram.owner_id",m),onSave:m=>u("telegram.owner_id",m),onCancel:()=>f("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(Ye,{text:"Who can message the bot in private"})]})}),r.jsx(yt,{value:s("telegram.dm_policy"),options:["admin-only","allowlist","open","disabled"],labels:["Admin Only","Allow Users","Open","Disabled"],onChange:m=>u("telegram.dm_policy",m)})]}),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(Ye,{text:"Which groups the bot can respond in"})]})}),r.jsx(yt,{value:s("telegram.group_policy"),options:["admin-only","allowlist","open","disabled"],labels:["Admin Only","Allow Groups","Open","Disabled"],onChange:m=>u("telegram.group_policy",m)})]})]}),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(Ye,{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:m=>u("telegram.require_mention",String(m.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),v&&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(Ye,{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:m=>u("telegram.typing_simulation",String(m.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]})]})]}),E=r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"section-title",children:"Advanced Telegram"}),r.jsxs("div",{style:{display:"grid",gap:"16px"},children:[r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsx(ft,{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:m=>c("telegram.debounce_ms",m),onSave:m=>u("telegram.debounce_ms",m),onCancel:()=>f("telegram.debounce_ms"),min:0}),r.jsx(ft,{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:m=>c("telegram.max_message_length",m),onSave:m=>u("telegram.max_message_length",m),onCancel:()=>f("telegram.max_message_length"),min:1}),r.jsx(ft,{label:"Agent Channel",description:"Channel username for auto-publishing",configKey:"telegram.agent_channel",value:s("telegram.agent_channel"),serverValue:a("telegram.agent_channel"),onChange:m=>c("telegram.agent_channel",m),onSave:m=>u("telegram.agent_channel",m),onCancel:()=>f("telegram.agent_channel")})]}),h&&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(Ye,{text:"Admin user IDs with elevated access"})]})}),r.jsx(ul,{value:Si(s("telegram.admin_ids")),onChange:m=>h("telegram.admin_ids",m),validate:m=>/^\d+$/.test(m)?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(Ye,{text:"User IDs allowed for DM access"})]})}),r.jsx(ul,{value:Si(s("telegram.allow_from")),onChange:m=>h("telegram.allow_from",m),validate:m=>/^\d+$/.test(m)?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(Ye,{text:"Group IDs allowed for group access"})]})}),r.jsx(ul,{value:Si(s("telegram.group_allow_from")),onChange:m=>h("telegram.group_allow_from",m),validate:m=>/^\d+$/.test(m)?null:"Must be a number",placeholder:"Enter ID..."})]})]}),r.jsxs("div",{style:{display:"grid",gap:"12px"},children:[r.jsx(ft,{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:m=>c("telegram.rate_limit_messages_per_second",m),onSave:m=>u("telegram.rate_limit_messages_per_second",m),onCancel:()=>f("telegram.rate_limit_messages_per_second"),hotReload:"restart",min:0,step:.1}),r.jsx(ft,{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:m=>c("telegram.rate_limit_groups_per_minute",m),onSave:m=>u("telegram.rate_limit_groups_per_minute",m),onCancel:()=>f("telegram.rate_limit_groups_per_minute"),hotReload:"restart",min:1})]})]})]});return v?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"card",children:y}),r.jsx("div",{className:"card",children:E})]}):y}function Yh({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(Ye,{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(Ye,{text:"Who can trigger exec tools. Requires restart."})]}),r.jsx(yt,{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 Wu=2e3,wi=1e3,Gh=3e4;class Jh{constructor(){Ft(this,"logs",[]);Ft(this,"snapshot",[]);Ft(this,"listeners",new Set);Ft(this,"disconnect",null);Ft(this,"_connected",!1);Ft(this,"reconnectTimer",null);Ft(this,"reconnectDelay",wi);Ft(this,"shouldReconnect",!1)}connect(){this.disconnect||(this.shouldReconnect=!0,this.reconnectDelay=wi,this.doConnect())}doConnect(){this.disconnect||(this.disconnect=pe.connectLogs(a=>{this.logs.push(a),this.logs.length>Wu&&(this.logs=this.logs.slice(-Wu)),this._connected=!0,this.reconnectDelay=wi,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,Gh))}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 Fn=new Jh;function gn({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 qh(){const{loading:s,error:a,setError:c,saveSuccess:u,status:f,stats:h,getLocal:v,getServer:y,setLocal:E,cancelLocal:m,saveConfig:x,modelOptions:k,pendingProvider:P,pendingMeta:H,pendingApiKey:D,setPendingApiKey:w,pendingValidating:S,pendingError:z,setPendingError:W,handleProviderChange:X,handleProviderConfirm:Q,handleProviderCancel:G}=pd(),[F,te]=p.useState(null);p.useEffect(()=>{let ne=!0;const ve=setInterval(()=>{pe.getStatus().then(ye=>{ne&&te(ye.data)}).catch(()=>{})},1e4);return()=>{ne=!1,clearInterval(ve)}},[]);const re=F??f,V=p.useSyncExternalStore(ne=>Fn.subscribe(ne),()=>Fn.getLogs()),I=p.useSyncExternalStore(ne=>Fn.subscribe(ne),()=>Fn.isConnected()),A=p.useRef(null);if(p.useEffect(()=>{Fn.connect()},[]),p.useEffect(()=>{var ne;(ne=A.current)==null||ne.scrollIntoView({behavior:"smooth"})},[V]),s)return r.jsx("div",{className:"loading",children:"Loading..."});if(!f||!h)return r.jsx("div",{className:"alert error",children:"Failed to load dashboard data"});const ee=re??f,b=ee.uptime<3600?`${Math.floor(ee.uptime/60)}m`:`${Math.floor(ee.uptime/3600)}h ${Math.floor(ee.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(gn,{label:"Uptime",value:b}),r.jsx(gn,{label:"Sessions",value:ee.sessionCount}),r.jsx(gn,{label:"Tools",value:ee.toolCount}),r.jsx(gn,{label:"Knowledge",value:h.knowledge}),r.jsx(gn,{label:"Messages",value:h.messages.toLocaleString()}),r.jsx(gn,{label:"Chats",value:h.chats}),r.jsx(gn,{label:"Tokens",value:ee.tokenUsage?`${(ee.tokenUsage.totalTokens/1e3).toFixed(1)}K`:"0",mono:!0}),r.jsx(gn,{label:"Cost",value:ee.tokenUsage?`$${ee.tokenUsage.totalCost.toFixed(3)}`:"$0.000",mono:!0})]})}),r.jsxs("div",{className:"dashboard-settings",children:[r.jsx("div",{className:"card",children:r.jsx(fd,{compact:!0,getLocal:v,getServer:y,setLocal:E,saveConfig:x,cancelLocal:m,modelOptions:k,pendingProvider:P,pendingMeta:H,pendingApiKey:D,setPendingApiKey:w,pendingValidating:S,pendingError:z,setPendingError:W,handleProviderChange:X,handleProviderConfirm:Q,handleProviderCancel:G})}),r.jsx("div",{className:"card",children:r.jsx(hd,{getLocal:v,getServer:y,setLocal:E,saveConfig:x,cancelLocal:m})}),ee.platform==="linux"&&r.jsx("div",{className:"card",style:{gridColumn:"1 / -1"},children:r.jsx(Yh,{getLocal:v,saveConfig:x})})]}),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 ${I?"connected":"disconnected"}`}),"Live Logs"]}),r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>Fn.clear(),children:"Clear"})]}),r.jsxs("div",{className:"dashboard-logs-scroll",children:[V.length===0?r.jsx("div",{className:"empty",children:"Waiting for logs..."}):V.map((ne,ce)=>r.jsxs("div",{className:"log-entry",children:[r.jsx("span",{className:`badge ${ne.level==="warn"?"warn":ne.level==="error"?"error":"info"}`,children:ne.level.toUpperCase()})," ",r.jsx("span",{style:{color:"var(--text-tertiary)"},children:new Date(ne.timestamp).toLocaleTimeString()})," ",ne.message]},ce)),r.jsx("div",{ref:A})]})]})]})}function md({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(f=>r.jsx("button",{className:s.scope===f?"active":"",disabled:!s.enabled||a===s.name,onClick:()=>u(s.name,f),children:f==="always"?"All":f==="dm-only"?"DM":f==="group-only"?"Group":"Admin"},f))}),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 Xh(){const[s,a]=p.useState([]),[c,u]=p.useState(!0),[f,h]=p.useState(null),[v,y]=p.useState(null),[E,m]=p.useState(null),[x,k]=p.useState(""),P=()=>(u(!0),pe.getTools().then(F=>{a(F.data),u(!1)}).catch(F=>{h(F instanceof Error?F.message:String(F)),u(!1)}));p.useEffect(()=>{P()},[]);const H=async(F,te)=>{y(F);try{await pe.updateToolConfig(F,{enabled:!te}),await P()}catch(re){h(re instanceof Error?re.message:String(re))}finally{y(null)}},D=async(F,te)=>{y(F);try{await pe.updateToolConfig(F,{scope:te}),await P()}catch(re){h(re instanceof Error?re.message:String(re))}finally{y(null)}},w=async(F,te)=>{y(F.name);try{for(const re of F.tools)re.enabled!==te&&await pe.updateToolConfig(re.name,{enabled:te});await P()}catch(re){h(re instanceof Error?re.message:String(re))}finally{y(null)}},S=async(F,te)=>{y(F.name);try{for(const re of F.tools)re.scope!==te&&await pe.updateToolConfig(re.name,{scope:te});await P()}catch(re){h(re instanceof Error?re.message:String(re))}finally{y(null)}};if(c)return r.jsx("div",{className:"loading",children:"Loading..."});const z=s.filter(F=>!F.isPlugin),W=z.reduce((F,te)=>F+te.toolCount,0),X=z.reduce((F,te)=>F+te.tools.filter(re=>re.enabled).length,0),Q=x.trim().toLowerCase(),G=Q?z.filter(F=>F.name.toLowerCase().includes(Q)||F.tools.some(te=>te.name.toLowerCase().includes(Q)||te.description.toLowerCase().includes(Q))):z;return r.jsxs("div",{children:[r.jsxs("div",{className:"header",children:[r.jsx("h1",{children:"Tools"}),r.jsxs("p",{children:[W," built-in tools across ",z.length," modules"]})]}),f&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("span",{children:f}),r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>h(null),children:"Dismiss"}),r.jsx("button",{className:"btn-sm",onClick:()=>{h(null),P()},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:X})," enabled"]}),r.jsxs("span",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--text)",fontWeight:600},children:W-X})," 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:x,onChange:F=>k(F.target.value),onKeyDown:F=>{F.key==="Escape"&&k("")},style:{padding:"4px 24px 4px 12px",fontSize:"13px",border:"1px solid var(--separator)",borderRadius:"14px",backgroundColor:"transparent",color:"var(--text)",width:"180px",outline:"none"}}),x&&r.jsx("button",{onClick:()=>k(""),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:"✕"})]}),Q&&r.jsxs("span",{style:{fontSize:"11px",color:"var(--text-secondary)",whiteSpace:"nowrap"},children:[G.length," of ",z.length," modules"]}),r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px",opacity:.7},onClick:P,children:"Refresh"})]})]}),r.jsx("div",{className:"card",style:{padding:0},children:G.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:Q?"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:G.map(F=>{const te=E===F.name,re=F.tools.some(ce=>ce.enabled),V=F.tools.every(ce=>!ce.enabled),I=F.tools.filter(ce=>ce.enabled).length,A=new Set(F.tools.map(ce=>ce.scope)),ee=A.size>1,b=ee?"":A.values().next().value??"always",ne=v===F.name;return r.jsxs(r.Fragment,{children:[r.jsxs("tr",{onClick:()=>m(te?null:F.name),onKeyDown:ce=>{(ce.key==="Enter"||ce.key===" ")&&(ce.preventDefault(),m(te?null:F.name))},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.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:te?"▼":"▶"}),r.jsx("span",{style:{fontWeight:600},children:F.name}),V&&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:F.toolCount})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsxs("span",{style:{fontSize:"12px",color:I===F.toolCount?"var(--green)":I===0?"var(--text-secondary)":"var(--text)"},children:[I,"/",F.toolCount]})}),r.jsx("td",{style:{textAlign:"right",padding:"8px 14px"},onClick:ce=>ce.stopPropagation(),children:r.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"8px"},children:[r.jsx(yt,{value:b,options:["","always","dm-only","group-only","admin-only"],labels:[ee?"Mixed":"Scope","All","DM only","Group only","Admin only"],onChange:ce=>ce&&S(F,ce),style:{minWidth:"100px"}}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:re,onChange:()=>w(F,!re),disabled:ne}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]})})]},F.name),te&&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:F.tools.map(ce=>r.jsx(md,{tool:ce,updating:v,onToggle:H,onScope:D},ce.name))})})},`${F.name}-detail`)]})})})]})})]})}function Zh(){const[s,a]=p.useState("installed"),[c,u]=p.useState([]),[f,h]=p.useState([]),[v,y]=p.useState(!0),[E,m]=p.useState(null),[x,k]=p.useState(null),[P,H]=p.useState([]),[D,w]=p.useState(!1),[S,z]=p.useState(null),[W,X]=p.useState(""),[Q,G]=p.useState(""),[F,te]=p.useState(null),[re,V]=p.useState({}),[I,A]=p.useState(!1),[ee,b]=p.useState(null),[ne,ce]=p.useState(null),[ve,ye]=p.useState(null),[L,Z]=p.useState(null),[B,N]=p.useState(""),O=()=>(y(!0),Promise.all([pe.getPlugins(),pe.getTools()]).then(([K,M])=>{u(K.data),h(M.data.filter(J=>J.isPlugin)),y(!1)}).catch(K=>{m(K.message),y(!1)})),me=(K=!1)=>(w(!0),pe.getMarketplace(K).then(M=>{H(M.data),w(!1)}).catch(M=>{m(M.message),w(!1)}));p.useEffect(()=>{O(),me()},[]);const le=async(K,M)=>{k(K);try{await pe.updateToolConfig(K,{enabled:!M}),await O()}catch(J){m(J instanceof Error?J.message:String(J))}finally{k(null)}},de=async(K,M)=>{k(K);try{await pe.updateToolConfig(K,{scope:M}),await O()}catch(J){m(J instanceof Error?J.message:String(J))}finally{k(null)}},ge=async(K,M)=>{k(K.name);try{for(const J of K.tools)J.enabled!==M&&await pe.updateToolConfig(J.name,{enabled:M});await O()}catch(J){m(J instanceof Error?J.message:String(J))}finally{k(null)}},ke=async(K,M)=>{k(K.name);try{for(const J of K.tools)J.scope!==M&&await pe.updateToolConfig(J.name,{scope:M});await O()}catch(J){m(J instanceof Error?J.message:String(J))}finally{k(null)}},Ce=async K=>{const M=P.find(J=>J.id===K);z(K);try{if(await pe.installPlugin(K),await Promise.all([me(),O()]),M!=null&&M.secrets&&Object.keys(M.secrets).length>0){try{const J=await pe.getPluginSecrets(K),We=Object.entries(M.secrets).filter(([,$e])=>$e.required).map(([$e])=>$e);if(We.every($e=>J.data.configured.includes($e))&&We.length>0)return}catch{}te({pluginId:K,pluginName:M.name,secrets:M.secrets}),V({})}}catch(J){m(J instanceof Error?J.message:String(J))}finally{z(null)}},Ee=async K=>{if(confirm(`Uninstall plugin "${K}"? This will remove its files.`)){z(K);try{await pe.uninstallPlugin(K),await Promise.all([me(),O()])}catch(M){m(M instanceof Error?M.message:String(M))}finally{z(null)}}},Ge=async K=>{z(K);try{await pe.updatePlugin(K),await Promise.all([me(),O()])}catch(M){m(M instanceof Error?M.message:String(M))}finally{z(null)}},jn=async()=>{const K=P.filter(M=>M.status==="updatable");for(const M of K){z(M.id);try{await pe.updatePlugin(M.id)}catch(J){m(J instanceof Error?J.message:String(J));break}}z(null),await Promise.all([me(),O()])},hl=async K=>{if(ne===K){ce(null),Z(null);return}try{const M=await pe.getPluginSecrets(K);ye(M.data),ce(K),Z(null)}catch(M){m(M instanceof Error?M.message:String(M))}},Wn=async(K,M)=>{if(B.trim())try{await pe.setPluginSecret(K,M,B.trim()),Z(null),N("");const J=await pe.getPluginSecrets(K);ye(J.data)}catch(J){m(J instanceof Error?J.message:String(J))}},jr=async(K,M)=>{try{await pe.unsetPluginSecret(K,M);const J=await pe.getPluginSecrets(K);ye(J.data)}catch(J){m(J instanceof Error?J.message:String(J))}},Sr=P.filter(K=>{if(W){const M=W.toLowerCase();if(!K.name.toLowerCase().includes(M)&&!K.description.toLowerCase().includes(M))return!1}return!(Q&&!K.tags.includes(Q))}),$n=Array.from(new Set(P.flatMap(K=>K.tags))).sort(),zt=P.filter(K=>K.status==="updatable").length;if(v)return r.jsx("div",{className:"loading",children:"Loading..."});const wr=c.filter(K=>{if(W){const M=W.toLowerCase();if(!K.name.toLowerCase().includes(M)&&!(K.description??"").toLowerCase().includes(M))return!1}if(Q){const M=P.find(J=>J.name===K.name);if(!M||!M.tags.includes(Q))return!1}return!0}),kr=f.reduce((K,M)=>K+M.toolCount,0),Sn=f.reduce((K,M)=>K+M.tools.filter(J=>J.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"})]}),E&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[r.jsx("span",{children:E}),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),O()},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("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",zt>0&&r.jsx("span",{className:"tab-count",style:{background:"rgba(255,255,255,0.08)",color:"var(--text-secondary)"},children:zt})]})]}),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:Sn})," enabled"]}),r.jsxs("span",{style:{fontSize:"13px",color:"var(--text-secondary)"},children:[r.jsx("span",{style:{color:"var(--text)",fontWeight:600},children:kr})," 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:W,onChange:K=>X(K.target.value),onKeyDown:K=>{K.key==="Escape"&&X("")},style:{padding:"4px 24px 4px 12px",fontSize:"13px",border:"1px solid var(--separator)",borderRadius:"14px",backgroundColor:"transparent",color:"var(--text)",width:"180px",outline:"none"}}),W&&r.jsx("button",{onClick:()=>X(""),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:"✕"})]}),$n.length>0&&r.jsx(yt,{value:Q,options:["",...$n],labels:["All tags",...$n],onChange:K=>G(K),style:{minWidth:"120px"}}),s==="installed"&&zt>0&&r.jsx("button",{className:"btn-sm",onClick:jn,disabled:!!S||D,style:{whiteSpace:"nowrap"},children:S?"Updating...":`Update All (${zt})`}),s==="marketplace"&&r.jsxs(r.Fragment,{children:[zt>0?r.jsx("button",{className:"btn-sm",onClick:jn,disabled:!!S||D,style:{whiteSpace:"nowrap"},children:S?"Updating...":`Update All (${zt})`}):P.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:()=>me(!0),disabled:D,style:{whiteSpace:"nowrap"},children:D?"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"})]}):wr.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:"right",padding:"8px 14px",width:200},children:"Controls"})]})}),r.jsx("tbody",{children:wr.map(K=>{const M=f.find(Se=>Se.name===K.name),J=P.find(Se=>Se.name===K.name),We=(J==null?void 0:J.secrets)&&Object.keys(J.secrets).length>0,vt=ee===K.name,$e=M?M.tools.some(Se=>Se.enabled):!1,Ke=M?M.tools.every(Se=>!Se.enabled):!0,wn=M?new Set(M.tools.map(Se=>Se.scope)):new Set,Cr=wn.size>1,kn=Cr?"":wn.values().next().value??"always",Cn=x===K.name,ml=(J==null?void 0:J.status)==="updatable";return r.jsxs(xr.Fragment,{children:[r.jsxs("tr",{onClick:()=>b(vt?null:K.name),onKeyDown:Se=>{(Se.key==="Enter"||Se.key===" ")&&(Se.preventDefault(),b(vt?null:K.name))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:vt?"none":"1px solid var(--separator)",backgroundColor:vt?"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:vt?"▼":"▶"}),r.jsx("span",{style:{fontWeight:600},children:K.name}),Ke&&M&&M.tools.length>0&&r.jsx("span",{className:"badge warn",children:"Disabled"})]}),K.description&&r.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginTop:"2px",paddingLeft:"22px"},children:K.description})]}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:M?r.jsx("span",{className:"badge count",children:M.toolCount}):r.jsx("span",{style:{color:"var(--text-tertiary)"},children:"—"})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},onClick:Se=>Se.stopPropagation(),children:ml&&J?r.jsx("button",{className:"btn-sm",onClick:()=>Ge(J.id),disabled:!!S,style:{fontSize:"11px",padding:"3px 8px"},children:S===J.id?"...":`v${J.remoteVersion}`}):r.jsxs("span",{style:{color:"var(--text-secondary)",fontSize:"12px"},children:["v",K.version]})}),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:[M&&M.tools.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(yt,{value:kn,options:["","always","dm-only","group-only","admin-only"],labels:[Cr?"Mixed":"Scope","All","DM only","Group only","Admin only"],onChange:Se=>Se&&ke(M,Se),style:{minWidth:"100px"}}),r.jsxs("label",{className:"toggle",children:[r.jsx("input",{type:"checkbox",checked:$e,onChange:()=>ge(M,!$e),disabled:Cn}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]})]}),r.jsx("button",{onClick:()=>Ee((J==null?void 0:J.id)??K.name),title:"Uninstall",disabled:!!S,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"})]})})]})})]}),vt&&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:[M&&M.tools.length>0&&r.jsx("div",{style:{display:"grid",gap:"6px",paddingTop:"6px"},children:M.tools.map(Se=>r.jsx(md,{tool:Se,updating:x,onToggle:le,onScope:de},Se.name))}),r.jsxs("div",{style:{display:"flex",gap:"6px",marginTop:"10px",paddingTop:"10px",borderTop:"1px solid var(--separator)"},children:[We&&J&&r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>hl(J.id),children:ne===J.id?"Hide Secrets":"Manage Secrets"}),ml&&J&&r.jsx("button",{className:"btn-sm",onClick:()=>Ge(J.id),disabled:!!S,children:S===J.id?"Updating...":`Update to v${J.remoteVersion}`}),J&&r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>Ee(J.id),disabled:!!S,style:{marginLeft:"auto"},children:"Uninstall"})]}),We&&J&&ne===J.id&&ve&&r.jsx("div",{style:{marginTop:"8px",display:"grid",gap:"6px"},children:Object.entries(ve.declared).map(([Se,En])=>{const Kn=ve.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}),En.required&&r.jsx("span",{style:{color:"var(--text-secondary)",marginLeft:"4px",fontSize:"11px"},children:"required"}),r.jsx("span",{className:`badge ${Kn?"always":"warn"}`,style:{marginLeft:"8px",fontSize:"10px"},children:Kn?"Set":"Not set"}),r.jsx("p",{style:{fontSize:"12px",color:"var(--text-tertiary)",margin:"2px 0 0 0"},children:En.description}),En.env&&r.jsxs("code",{style:{fontSize:"11px",color:"var(--text-tertiary)",opacity:.7},children:["Env: ",En.env]})]}),r.jsx("div",{style:{display:"flex",gap:"4px",alignItems:"center"},children:L===Se?r.jsxs(r.Fragment,{children:[r.jsx("input",{type:"password",value:B,onChange:Er=>N(Er.target.value),placeholder:"Enter value...",style:{width:"200px"}}),r.jsx("button",{className:"btn-sm",onClick:()=>Wn(J.id,Se),children:"Save"}),r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>Z(null),children:"Cancel"})]}):r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>{Z(Se),N("")},children:Kn?"Change":"Set"}),Kn&&r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>jr(J.id,Se),children:"Remove"})]})})]},Se)})})]})})]},K.name)})})]})}),F&&r.jsx("div",{className:"modal-overlay",onClick:()=>!I&&te(null),children:r.jsxs("div",{className:"modal",onClick:K=>K.stopPropagation(),children:[r.jsxs("h2",{style:{marginBottom:"4px"},children:["Configure ",F.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(F.secrets).map(([K,M])=>r.jsxs("div",{style:{marginBottom:"12px"},children:[r.jsxs("label",{style:{display:"block",fontSize:"13px",fontWeight:600,marginBottom:"4px"},children:[K," ",M.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:M.description}),M.env&&r.jsxs("code",{style:{display:"block",fontSize:"11px",color:"var(--text-tertiary)",opacity:.7,marginBottom:"6px"},children:["Env: ",M.env]}),r.jsx("input",{type:"password",placeholder:`Enter ${K}...`,value:re[K]||"",onChange:J=>V(We=>({...We,[K]:J.target.value})),style:{width:"100%"}})]},K)),r.jsxs("div",{style:{display:"flex",gap:"8px",justifyContent:"flex-end",marginTop:"16px"},children:[r.jsx("button",{className:"btn-ghost",onClick:()=>te(null),children:"Skip"}),r.jsx("button",{className:"btn-sm",disabled:I,onClick:async()=>{A(!0);try{for(const[K,M]of Object.entries(re))M.trim()&&await pe.setPluginSecret(F.pluginId,K,M.trim());te(null)}catch(K){m(K instanceof Error?K.message:String(K))}finally{A(!1)}},children:I?"Saving...":"Save"})]})]})}),s==="marketplace"&&r.jsx("div",{className:"card",style:{padding:0},children:D&&P.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading marketplace..."}):Sr.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:W||Q?"No plugins match your search":"Marketplace is empty"}):(()=>{const K=[...Sr].sort((M,J)=>{const We={updatable:0,installed:1,available:2};return We[M.status]-We[J.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:K.map(M=>{const J=S===M.id,We=!!S,vt=M.secrets&&Object.values(M.secrets).some(Ke=>Ke.required),$e=ee===`market-${M.id}`;return r.jsxs(xr.Fragment,{children:[r.jsxs("tr",{onClick:()=>b($e?null:`market-${M.id}`),onKeyDown:Ke=>{(Ke.key==="Enter"||Ke.key===" ")&&(Ke.preventDefault(),b($e?null:`market-${M.id}`))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:$e?"none":"1px solid var(--separator)",backgroundColor:$e?"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:$e?"▼":"▶"}),r.jsx("span",{style:{fontWeight:600},children:M.name}),vt&&M.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:M.toolCount})}),r.jsxs("td",{style:{textAlign:"center",padding:"8px 10px",color:"var(--text-secondary)",fontSize:"12px"},children:["v",M.remoteVersion]}),r.jsxs("td",{style:{textAlign:"right",padding:"8px 14px",whiteSpace:"nowrap"},onClick:Ke=>Ke.stopPropagation(),children:[M.status==="available"&&r.jsx("button",{className:"btn-sm",onClick:()=>Ce(M.id),disabled:We,children:J?"Installing...":"Install"}),M.status==="installed"&&r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>Ee(M.id),disabled:We,children:J?"Removing...":"Uninstall"}),M.status==="updatable"&&r.jsxs("div",{style:{display:"flex",gap:"6px",justifyContent:"flex-end"},children:[r.jsx("button",{className:"btn-sm",onClick:()=>Ge(M.id),disabled:We,children:J?"Updating...":"Update"}),r.jsx("button",{className:"btn-danger btn-sm",onClick:()=>Ee(M.id),disabled:We,children:"Uninstall"})]})]})]}),$e&&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.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:M.author}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Description"}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:M.description}),M.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:M.tags.map(Ke=>r.jsx("span",{style:{fontSize:"10px",padding:"1px 6px",borderRadius:"4px",background:"var(--surface)",color:"var(--text-tertiary)"},children:Ke},Ke))})]}),M.tools&&M.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:M.tools.map(Ke=>Ke.name).join(", ")})]})]})})})]},M.id)})})]})})()})]})}const $u=["SOUL.md","SECURITY.md","STRATEGY.md","MEMORY.md"];function em(){const[s,a]=p.useState($u[0]),[c,u]=p.useState(""),[f,h]=p.useState(""),[v,y]=p.useState(!1),[E,m]=p.useState(!1),[x,k]=p.useState(null),P=c!==f,H=p.useCallback(async S=>{y(!0),k(null);try{const z=await pe.getSoulFile(S);u(z.data.content),h(z.data.content)}catch(z){k({type:"error",text:z instanceof Error?z.message:String(z)})}finally{y(!1)}},[]),D=async()=>{m(!0),k(null);try{const S=await pe.updateSoulFile(s,c);h(c),k({type:"success",text:S.data.message})}catch(S){k({type:"error",text:S instanceof Error?S.message:String(S)})}finally{m(!1)}};p.useEffect(()=>{const S=z=>{P&&z.preventDefault()};return window.addEventListener("beforeunload",S),()=>window.removeEventListener("beforeunload",S)},[P]);const w=S=>{S!==s&&(P&&!window.confirm("You have unsaved changes. Discard them?")||a(S))};return p.useEffect(()=>{H(s)},[s,H]),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"})]}),x&&r.jsx("div",{className:`alert ${x.type}`,style:{marginBottom:"8px"},children:x.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:$u.map(S=>r.jsxs("button",{className:`tab ${s===S?"active":""}`,onClick:()=>w(S),children:[S,s===S&&P?" *":""]},S))}),v?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:D,disabled:E||!P,children:E?"Saving...":"Save"}),P&&r.jsx("span",{style:{color:"var(--text-secondary)",fontSize:"13px"},children:"Unsaved changes"})]})]})]})]})}function Ku(s){return new Date(s*1e3).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function tm(){const[s,a]=p.useState(""),[c,u]=p.useState([]),[f,h]=p.useState(!0),[v,y]=p.useState(null),[E,m]=p.useState(null),[x,k]=p.useState([]),[P,H]=p.useState(!1),D=p.useCallback(async()=>{h(!0),y(null);try{const W=await pe.getMemorySources();u(W.data??[])}catch(W){y(W instanceof Error?W.message:String(W))}finally{h(!1)}},[]);p.useEffect(()=>{D()},[D]);const w=async W=>{if(E===W){m(null),k([]);return}m(W),H(!0);try{const X=await pe.getSourceChunks(W);k(X.data??[])}catch(X){y(X instanceof Error?X.message:String(X))}finally{H(!1)}},S=s.toLowerCase(),z=S?c.filter(W=>W.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:W=>a(W.target.value),placeholder:"Filter sources...",style:{flex:1,padding:"6px 10px",fontSize:"13px"}}),r.jsx("button",{onClick:D,disabled:f,style:{padding:"4px 12px",fontSize:"12px",opacity:.7},children:f?"Loading...":"Refresh"})]}),v&&r.jsxs("div",{className:"alert error",style:{margin:"12px 14px"},children:[v,r.jsx("button",{onClick:()=>y(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),f?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):z.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:z.map(W=>{const X=E===W.source;return r.jsxs(xr.Fragment,{children:[r.jsxs("tr",{onClick:()=>w(W.source),onKeyDown:Q=>{(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),w(W.source))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:X?"none":"1px solid var(--separator)",backgroundColor:X?"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:X?"▼":"▶"}),W.source]}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:W.entryCount}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:Ku(W.lastUpdated)})]}),X&&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:P?r.jsx("div",{style:{padding:"12px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"12px"},children:"Loading chunks..."}):x.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:x.map(Q=>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:[Q.startLine!=null&&Q.endLine!=null&&r.jsxs("span",{children:["Lines ",Q.startLine,"–",Q.endLine," · "]}),Ku(Q.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:Q.text})]},Q.id))})})})]},W.source)})})]})]})]})}function Vu(s){return s===0?"—":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/(1024*1024)).toFixed(1)} MB`}function nm(s){return new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const rm=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico"]),lm=new Set(["zip","tar","gz","bin","exe","dll","so","db","sqlite","wasm","pdf"]);function gd(s){var a,c;return((c=(a=s.split("/").pop())==null?void 0:a.split(".").pop())==null?void 0:c.toLowerCase())??""}function sm(s){return rm.has(gd(s))}function om(s){return lm.has(gd(s))}function im(){const[s,a]=p.useState(""),[c,u]=p.useState([]),[f,h]=p.useState(null),[v,y]=p.useState(!0),[E,m]=p.useState(null),[x,k]=p.useState(null),[P,H]=p.useState(""),[D,w]=p.useState(!1),[S,z]=p.useState(!1),[W,X]=p.useState("text"),[Q,G]=p.useState(null),[F,te]=p.useState(""),re=p.useCallback(async L=>{y(!0),m(null);try{const Z=await pe.workspaceList(L);u(Z.data??[]),a(L)}catch(Z){m(Z instanceof Error?Z.message:String(Z))}finally{y(!1)}},[]),V=p.useCallback(async()=>{try{const L=await pe.workspaceInfo();h(L.data??null)}catch{}},[]);p.useEffect(()=>{re(""),V()},[re,V]),p.useEffect(()=>{if(!D)return;const L=Z=>{Z.preventDefault()};return window.addEventListener("beforeunload",L),()=>window.removeEventListener("beforeunload",L)},[D]);const I=L=>{b()&&re(L)},A=s?s.split("/"):[],ee=async L=>{var Z;try{if(m(null),sm(L))k(L),X("image"),H(""),w(!1);else if(om(L))k(L),X("binary"),H(""),w(!1);else{const B=await pe.workspaceRead(L);k(L),X("text"),H(((Z=B.data)==null?void 0:Z.content)??""),w(!1)}}catch(B){m(B instanceof Error?B.message:String(B))}},b=()=>W==="text"&&D&&!confirm("You have unsaved changes. Discard?")?!1:(k(null),H(""),w(!1),X("text"),!0),ne=L=>{if(x===L)b();else{if(!b())return;ee(L)}},ce=async()=>{if(x){z(!0);try{await pe.workspaceWrite(x,P),w(!1),re(s)}catch(L){m(L instanceof Error?L.message:String(L))}finally{z(!1)}}},ve=async L=>{const Z=L.isDirectory?"directory":"file";if(confirm(`Delete ${Z} "${L.name}"?`))try{await pe.workspaceDelete(L.path,L.isDirectory),x===L.path&&(k(null),H(""),w(!1)),re(s),V()}catch(B){m(B instanceof Error?B.message:String(B))}},ye=async()=>{const L=F.trim();if(!L||!Q)return;const Z=s?`${s}/${L}`:L;try{if(Q.type==="newFile")await pe.workspaceWrite(Z,"");else if(Q.type==="newFolder")await pe.workspaceMkdir(Z);else if(Q.type==="rename"&&Q.target){const B=s?`${s}/${L}`:L;await pe.workspaceRename(Q.target,B),x===Q.target&&(k(null),H(""),w(!1))}G(null),te(""),re(s),V()}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",f&&r.jsxs("span",{style:{marginLeft:"12px",fontSize:"12px",color:"var(--text-secondary)"},children:[f.totalFiles," files · ",Vu(f.totalSize)]})]})]}),E&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[E,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:()=>I(""),style:{cursor:"pointer",fontWeight:s?"normal":"bold",color:"var(--accent)"},children:"workspace"}),A.map((L,Z)=>{const B=A.slice(0,Z+1).join("/"),N=Z===A.length-1;return r.jsxs("span",{children:[r.jsx("span",{style:{color:"var(--text-secondary)",margin:"0 2px"},children:"/"}),r.jsx("span",{onClick:()=>!N&&I(B),style:{cursor:N?"default":"pointer",fontWeight:N?"bold":"normal",color:N?"var(--text)":"var(--accent)"},children:L})]},B)}),r.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:"6px"},children:[r.jsx("button",{style:{padding:"3px 10px",fontSize:"12px"},onClick:()=>{G({type:"newFile"}),te("")},children:"+ File"}),r.jsx("button",{style:{padding:"3px 10px",fontSize:"12px"},onClick:()=>{G({type:"newFolder"}),te("")},children:"+ Folder"})]})]}),Q&&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:Q.type==="newFile"?"New file:":Q.type==="newFolder"?"New folder:":"Rename to:"}),r.jsx("input",{type:"text",value:F,onChange:L=>te(L.target.value),onKeyDown:L=>L.key==="Enter"&&ye(),placeholder:"name...",autoFocus:!0,style:{flex:1,padding:"4px 8px",fontSize:"13px"}}),r.jsx("button",{style:{padding:"4px 10px",fontSize:"12px"},onClick:ye,children:"OK"}),r.jsx("button",{style:{padding:"4px 10px",fontSize:"12px",opacity:.7},onClick:()=>G(null),children:"Cancel"})]}),r.jsx("div",{className:"card",style:{padding:0},children:v?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 L=s.split("/");L.pop(),I(L.join("/"))},onKeyDown:L=>{if(L.key==="Enter"||L.key===" "){L.preventDefault();const Z=s.split("/");Z.pop(),I(Z.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(L=>{const Z=!L.isDirectory&&x===L.path;return r.jsxs(xr.Fragment,{children:[r.jsxs("tr",{onClick:()=>L.isDirectory?I(L.path):ne(L.path),onKeyDown:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),L.isDirectory?I(L.path):ne(L.path))},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.jsxs("td",{style:{padding:"6px 14px"},children:[L.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:Z?"▼":"▶"}),L.name]}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:L.isDirectory?"":Vu(L.size)}),r.jsx("td",{style:{textAlign:"right",padding:"6px 14px",color:"var(--text-secondary)"},children:nm(L.mtime)}),r.jsxs("td",{style:{textAlign:"right",padding:"6px 14px",whiteSpace:"nowrap"},onClick:B=>B.stopPropagation(),children:[r.jsx("button",{className:"icon-button",onClick:()=>{G({type:"rename",target:L.path}),te(L.name)},title:"Rename",children:"✎"}),r.jsx("button",{className:"icon-button",onClick:()=>ve(L),title:"Delete",children:"🗑"})]})]}),Z&&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:[x,W==="text"&&D&&r.jsx("span",{style:{color:"var(--accent)",marginLeft:"6px"},children:"*"})]}),r.jsxs("div",{style:{display:"flex",gap:"6px"},children:[W==="text"&&r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px"},onClick:ce,disabled:S||!D,children:S?"Saving...":"Save"}),r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px",opacity:.7},onClick:()=>b(),children:"Close"})]})]}),W==="text"&&r.jsx("textarea",{value:P,onChange:B=>{H(B.target.value),w(!0)},onKeyDown:B=>{(B.ctrlKey||B.metaKey)&&B.key==="s"&&(B.preventDefault(),ce())},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}),W==="image"&&x&&r.jsx("div",{style:{display:"flex",justifyContent:"center",padding:"20px 0"},children:r.jsx("img",{src:pe.workspaceRawUrl(x),alt:x,style:{maxWidth:"100%",maxHeight:"60vh",objectFit:"contain",borderRadius:"8px"},onError:B=>{B.target.alt="Failed to load image"}})}),W==="binary"&&r.jsx("div",{style:{padding:"20px 0",textAlign:"center",color:"var(--text-secondary)",fontSize:"13px"},children:"Binary file — preview not available"})]})})]},L.path)})]})]})})]})}const Cs={pending:"#f0ad4e",in_progress:"#5bc0de",done:"#5cb85c",failed:"#d9534f",cancelled:"#777"},gr={pending:"Pending",in_progress:"Running",done:"Done",failed:"Failed",cancelled:"Cancelled"};function Hu({status:s}){return r.jsx("span",{style:{display:"inline-block",padding:"2px 8px",borderRadius:"10px",fontSize:"11px",fontWeight:600,color:"#fff",backgroundColor:Cs[s]},children:gr[s]})}function mr(s){return s?new Date(s).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function am({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 ki(s,a){return s?s.length>a?s.slice(0,a)+"...":s:""}function cm(){const[s,a]=p.useState([]),[c,u]=p.useState(!0),[f,h]=p.useState(null),[v,y]=p.useState(""),[E,m]=p.useState(""),[x,k]=p.useState(null),[P,H]=p.useState(!1),[D,w]=p.useState(null),S=p.useRef(null),z=p.useCallback(async()=>{u(!0),h(null);try{const A=(await pe.tasksList()).data??[];a(A),k(ee=>ee?A.find(b=>b.id===ee.id)??null:null)}catch(I){h(I instanceof Error?I.message:String(I))}finally{u(!1)}},[]);p.useEffect(()=>{z()},[z]),p.useEffect(()=>{function I(A){S.current&&!S.current.contains(A.target)&&H(!1)}if(P)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[P]);const W=async I=>{w(null),H(!1);try{await pe.tasksClean(I),h(null),z(),k(null)}catch(A){h(A instanceof Error?A.message:String(A))}},X=async I=>{if(confirm("Cancel this task?"))try{await pe.tasksCancel(I),z(),(x==null?void 0:x.id)===I&&k(null)}catch(A){h(A instanceof Error?A.message:String(A))}},Q=async I=>{if(confirm("Permanently delete this task?"))try{await pe.tasksDelete(I),z(),(x==null?void 0:x.id)===I&&k(null)}catch(A){h(A instanceof Error?A.message:String(A))}},G=s.reduce((I,A)=>(I[A.status]=(I[A.status]||0)+1,I),{}),F=(G.done||0)+(G.failed||0)+(G.cancelled||0),te=v?s.filter(I=>I.status===v):s,re=E.trim().toLowerCase(),V=re?te.filter(I=>I.description.toLowerCase().includes(re)||(I.reason??"").toLowerCase().includes(re)||I.id.toLowerCase().includes(re)):te;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"})]}),f&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[f,r.jsx("button",{onClick:()=>h(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:()=>y(""),style:{cursor:"pointer",fontWeight:v===""?"bold":"normal",color:v===""?"var(--text)":"var(--text-secondary)",fontSize:"13px"},children:["All (",s.length,")"]}),["pending","in_progress","done","failed","cancelled"].map(I=>r.jsxs("span",{onClick:()=>y(v===I?"":I),style:{cursor:"pointer",fontWeight:v===I?"bold":"normal",color:v===I?Cs[I]:"var(--text-secondary)",fontSize:"13px"},children:[gr[I]," (",G[I]||0,")"]},I)),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:E,onChange:I=>m(I.target.value),onKeyDown:I=>{I.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"}}),E&&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:"✕"})]}),re&&r.jsxs("span",{style:{fontSize:"11px",color:"var(--text-secondary)",whiteSpace:"nowrap"},children:[V.length," of ",te.length," tasks"]})]}),F>0&&r.jsxs("div",{ref:S,style:{position:"relative"},children:[r.jsx("button",{className:"btn-ghost btn-sm",onClick:()=>H(!P),children:"Clean"}),P&&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(I=>(G[I]||0)>0).map(I=>r.jsxs("div",{className:"custom-select-option",onClick:()=>{H(!1),w(I)},style:{display:"flex",alignItems:"center",gap:"8px"},children:[r.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",backgroundColor:Cs[I],flexShrink:0}}),gr[I]," (",G[I],")"]},I))})]}),r.jsx("button",{style:{padding:"4px 12px",fontSize:"12px",opacity:.7},onClick:z,children:"Refresh"})]}),D&&r.jsx("div",{className:"modal-overlay",onClick:()=>w(null),children:r.jsxs("div",{className:"modal",style:{maxWidth:"380px"},onClick:I=>I.stopPropagation(),children:[r.jsxs("h2",{style:{marginBottom:"4px"},children:["Clean ",gr[D].toLowerCase()," tasks"]}),r.jsxs("p",{style:{color:"var(--text-secondary)",fontSize:"13px",marginBottom:"16px"},children:["Permanently delete all ",G[D]||0," ",r.jsx("span",{style:{color:Cs[D],fontWeight:600},children:gr[D].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:()=>w(null),children:"Cancel"}),r.jsxs("button",{className:"btn-danger btn-sm",onClick:()=>W(D),children:["Delete ",G[D]||0," tasks"]})]})]})}),r.jsx("div",{className:"card",style:{padding:0},children:c?r.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading..."}):V.length===0?r.jsx("div",{style:{padding:"20px",textAlign:"center",color:"var(--text-secondary)"},children:re?"No tasks match your search":v?`No ${gr[v].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:V.map(I=>{const A=(x==null?void 0:x.id)===I.id;return r.jsxs(xr.Fragment,{children:[r.jsxs("tr",{onClick:()=>k(A?null:I),onKeyDown:ee=>{(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),k(A?null:I))},tabIndex:0,role:"button",style:{cursor:"pointer",borderBottom:A?"none":"1px solid var(--separator)",backgroundColor:A?"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:A?"▼":"▶"}),ki(I.description,80)]}),I.reason&&r.jsx("div",{style:{fontSize:"11px",color:"var(--text-secondary)",marginTop:"2px",paddingLeft:"14px"},children:ki(I.reason,60)})]}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsx(Hu,{status:I.status})}),r.jsx("td",{style:{textAlign:"center",padding:"8px 10px"},children:r.jsx(am,{priority:I.priority})}),r.jsx("td",{style:{textAlign:"right",padding:"8px 14px",color:"var(--text-secondary)"},children:mr(I.scheduledFor)}),r.jsx("td",{style:{textAlign:"right",padding:"8px 14px",color:"var(--text-secondary)"},children:mr(I.createdAt)}),r.jsxs("td",{style:{textAlign:"right",padding:"8px 14px",whiteSpace:"nowrap"},onClick:ee=>ee.stopPropagation(),children:[(I.status==="pending"||I.status==="in_progress")&&r.jsx("button",{className:"icon-button",onClick:()=>X(I.id),title:"Cancel",children:"✖"}),r.jsx("button",{className:"icon-button",onClick:()=>Q(I.id),title:"Delete",children:"🗑"})]})]}),A&&x&&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:x.id}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Status"}),r.jsx("span",{children:r.jsx(Hu,{status:x.status})}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Priority"}),r.jsxs("span",{children:[x.priority,"/10"]}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Description"}),r.jsx("span",{children:x.description}),x.reason&&r.jsxs(r.Fragment,{children:[r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Reason"}),r.jsx("span",{children:x.reason})]}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Created by"}),r.jsx("span",{children:x.createdBy||"—"}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Created"}),r.jsx("span",{children:mr(x.createdAt)}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Scheduled for"}),r.jsx("span",{children:mr(x.scheduledFor)}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Started"}),r.jsx("span",{children:mr(x.startedAt)}),r.jsx("span",{style:{color:"var(--text-secondary)"},children:"Completed"}),r.jsx("span",{children:mr(x.completedAt)}),x.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:[x.dependencies.length," task(s)"]})]}),x.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:[x.dependents.length," task(s)"]})]})]}),x.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(x.payload),null,2)}catch{return x.payload}})()})]}),x.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:ki(x.result,2e3)})]}),x.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:x.error})]})]})})]},I.id)})})]})})]})}function um(){const[s,a]=p.useState([]),[c,u]=p.useState(!0),[f,h]=p.useState(null),[v,y]=p.useState(new Set),[E,m]=p.useState(!1),[x,k]=p.useState(""),[P,H]=p.useState(""),[D,w]=p.useState(""),[S,z]=p.useState([]),[W,X]=p.useState(!1),[Q,G]=p.useState(null),[F,te]=p.useState(null),re=(b=!1)=>{b&&u(!0),pe.getMcpServers().then(ne=>{a(ne.data),u(!1)}).catch(ne=>{h(ne instanceof Error?ne.message:String(ne)),u(!1)})};p.useEffect(()=>{re(!0)},[]);const V=b=>{y(ne=>{const ce=new Set(ne);return ce.has(b)?ce.delete(b):ce.add(b),ce})},I=async()=>{if(x.trim()){X(!0),h(null);try{const b=P.trim()?P.trim().split(/\s+/):void 0,ne=x.startsWith("http://")||x.startsWith("https://"),ce={};for(const ye of S)ye.key.trim()&&(ce[ye.key.trim()]=ye.value);const ve=await pe.addMcpServer({...ne?{url:x.trim()}:{package:x.trim()},name:D.trim()||void 0,args:ne?void 0:b,env:Object.keys(ce).length>0?ce:void 0});te(ve.data.message),k(""),H(""),w(""),z([]),m(!1),re()}catch(b){h(b instanceof Error?b.message:String(b))}finally{X(!1)}}},A=async b=>{if(confirm(`Remove MCP server "${b}"?`)){G(b),h(null);try{const ne=await pe.removeMcpServer(b);te(ne.data.message),re()}catch(ne){h(ne instanceof Error?ne.message:String(ne))}finally{G(null)}}};if(c)return r.jsx("div",{className:"loading",children:"Loading..."});const ee=s.filter(b=>b.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(!E),style:{fontSize:"13px"},children:E?"Cancel":"+ Add Server"})]})}),f&&r.jsxs("div",{className:"alert error",style:{marginBottom:"14px"},children:[f,r.jsx("button",{onClick:()=>h(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),F&&r.jsxs("div",{className:"alert success",style:{marginBottom:"14px"},children:[F,r.jsx("button",{onClick:()=>te(null),style:{marginLeft:"10px",padding:"2px 8px",fontSize:"12px"},children:"Dismiss"})]}),E&&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:x,onChange:b=>k(b.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:P,onChange:b=>H(b.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:D,onChange:b=>w(b.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:()=>z([...S,{key:"",value:"",id:crypto.randomUUID()}]),style:{fontSize:"11px",padding:"1px 6px",opacity:.7},children:"+ Add"})]}),S.map((b,ne)=>r.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 2fr auto",gap:"6px",marginBottom:"4px"},children:[r.jsx("input",{type:"text",value:b.key,onChange:ce=>{const ve=[...S];ve[ne]={...ve[ne],key:ce.target.value},z(ve)},placeholder:"BRAVE_API_KEY",style:{fontSize:"12px",fontFamily:"monospace"}}),r.jsx("input",{type:"password",value:b.value,onChange:ce=>{const ve=[...S];ve[ne]={...ve[ne],value:ce.target.value},z(ve)},placeholder:"sk-xxx...",style:{fontSize:"12px",fontFamily:"monospace"}}),r.jsx("button",{type:"button",onClick:()=>z(S.filter((ce,ve)=>ve!==ne)),style:{fontSize:"11px",padding:"2px 6px",opacity:.6},children:"×"})]},b.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:I,disabled:W||!x.trim(),style:{fontSize:"13px"},children:W?"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&&!E&&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:[ee,"/",s.length," connected · ",s.reduce((b,ne)=>b+ne.toolCount,0)," tools total"]}),s.map(b=>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:b.name}),r.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)"},children:b.type}),b.scope!=="always"&&r.jsx("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)"},children:b.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:b.connected?"var(--green)":"var(--red)"},children:[r.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:b.connected?"var(--green)":"var(--red)"}}),b.connected?"Connected":"Disconnected"]}),!b.enabled&&r.jsx("span",{style:{fontSize:"11px",color:"var(--text-secondary)"},children:"disabled"}),r.jsx("button",{onClick:()=>A(b.name),disabled:Q===b.name,style:{fontSize:"11px",padding:"2px 8px",opacity:.6,cursor:Q===b.name?"wait":"pointer"},children:Q===b.name?"...":"Remove"})]})]}),r.jsx("div",{style:{fontSize:"12px",fontFamily:"monospace",color:"var(--text-secondary)",marginBottom:"8px"},children:b.target}),b.envKeys.length>0&&r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginBottom:"8px"},children:b.envKeys.map(ne=>r.jsxs("span",{style:{fontSize:"11px",padding:"1px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)",fontFamily:"monospace"},children:[ne,"=••••"]},ne))}),b.toolCount>0&&r.jsxs("div",{children:[r.jsxs("button",{onClick:()=>V(b.name),style:{background:"none",border:"none",padding:0,fontSize:"12px",color:"var(--accent)",cursor:"pointer"},children:[v.has(b.name)?"▾":"▸"," ",b.toolCount," tools"]}),v.has(b.name)&&r.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px",marginTop:"8px"},children:b.tools.map(ne=>r.jsx("span",{style:{fontSize:"11px",padding:"2px 6px",borderRadius:"3px",background:"var(--surface)",color:"var(--text-secondary)"},children:ne},ne))})]})]},b.name))]})]})}function dm({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 Ci({keys:s,configKeys:a,getLocal:c,getServer:u,setLocal:f,saveConfig:h,cancelLocal:v,onArraySave:y,title:E}){const m=s.map(x=>a.find(k=>k.key===x)).filter(x=>x!=null);return m.length===0?null:r.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[E&&r.jsx("div",{className:"section-title",children:E}),m.map(x=>{const k=x.hotReload==="restart";if(x.type==="boolean"){const D=c(x.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:D,onChange:w=>h(x.key,String(w.target.checked))}),r.jsx("span",{className:"toggle-track"}),r.jsx("span",{className:"toggle-thumb"})]}),r.jsx("span",{children:x.label}),x.description&&r.jsx(Ye,{text:x.description}),k&&r.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)"},children:"(requires restart)"})]})},x.key)}if(x.type==="enum"&&x.options)return r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[x.label,x.description&&r.jsx(Ye,{text:x.description}),k&&r.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)"},children:"(requires restart)"})]})}),r.jsx("select",{value:c(x.key),onChange:D=>h(x.key,D.target.value),style:{padding:"6px 10px",fontSize:14,border:"1px solid var(--separator)",borderRadius:4,background:"var(--surface)",color:"var(--text)"},children:x.options.map(D=>{var w;return r.jsx("option",{value:D,children:((w=x.optionLabels)==null?void 0:w[D])??D},D)})})]},x.key);if(x.type==="array"){const D=c(x.key);let w=[];if(D)try{w=JSON.parse(D).map(String)}catch{w=[]}return r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:4},children:[x.label,x.description&&r.jsx(Ye,{text:x.description}),k&&r.jsx("span",{style:{fontSize:11,color:"var(--text-secondary)"},children:"(requires restart)"})]})}),r.jsx(ul,{value:w,onChange:S=>{y&&y(x.key,S)},placeholder:`Add ${x.label.toLowerCase()}`})]},x.key)}const P=x.type==="number"?"number":x.sensitive?"password":"text",H=x.sensitive?x.set?"Set":"Not set":void 0;return r.jsx(ft,{label:x.label,description:x.description,configKey:x.key,type:P,value:c(x.key),serverValue:u(x.key),onChange:D=>f(x.key,D),onSave:D=>h(x.key,D),onCancel:()=>v(x.key),hotReload:x.hotReload,badge:H,placeholder:x.sensitive?"********":void 0},x.key)})]})}const pm=[{id:"llm",label:"LLM"},{id:"telegram",label:"Telegram"},{id:"api-keys",label:"API Keys"},{id:"advanced",label:"Advanced"}],fm=["agent.api_key","telegram.bot_token","tavily_api_key","tonapi_key","toncenter_api_key"],hm=["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"];function mm(){const[s,a]=bh(),c=s.get("tab")||"llm",u=pd(),[f,h]=p.useState([]),v=m=>{a({tab:m},{replace:!0})};p.useEffect(()=>{pe.getConfigKeys().then(m=>h(m.data)).catch(()=>{})},[]);const y=()=>{pe.getConfigKeys().then(m=>h(m.data)).catch(()=>{})},E=async(m,x)=>{u.setError(null);try{await pe.setConfigKey(m,x),u.showSuccess(`${m} updated successfully`),y()}catch(k){u.setError(k instanceof Error?k.message:String(k))}};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(dm,{tabs:pm,activeTab:c,onTabChange:v}),c==="llm"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"card",children:r.jsx(fd,{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("div",{className:"card",children:[r.jsx("div",{className:"section-title",children:"Cocoon"}),r.jsx(ft,{label:"Proxy Port",description:"Cocoon Network proxy port",configKey:"cocoon.port",type:"number",value:u.getLocal("cocoon.port"),serverValue:u.getServer("cocoon.port"),onChange:m=>u.setLocal("cocoon.port",m),onSave:m=>u.saveConfig("cocoon.port",m),onCancel:()=>u.cancelLocal("cocoon.port"),min:1,max:65535,placeholder:"11434",hotReload:"restart"})]})]}),c==="telegram"&&r.jsx(hd,{getLocal:u.getLocal,getServer:u.getServer,setLocal:u.setLocal,saveConfig:u.saveConfig,cancelLocal:u.cancelLocal,configKeys:f,onArraySave:E,extended:!0}),c==="api-keys"&&r.jsx("div",{className:"card",children:r.jsx(Ci,{keys:fm,configKeys:f,getLocal:u.getLocal,getServer:u.getServer,setLocal:u.setLocal,saveConfig:u.saveConfig,cancelLocal:u.cancelLocal,title:"API Keys"})}),c==="advanced"&&r.jsxs(r.Fragment,{children:[u.toolRag&&r.jsxs("div",{className:"card",children:[r.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"12px"},children:[r.jsxs("div",{children:[r.jsx("div",{className:"section-title",style:{marginBottom:"4px"},children:"Tool RAG"}),r.jsx("p",{style:{fontSize:"13px",color:"var(--text-secondary)",margin:0},children:"Semantic tool selection — sends only the most relevant tools to the LLM per message."})]}),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(Ye,{text:"Number of most relevant tools to send per message"})]}),r.jsx(yt,{value:String(u.toolRag.topK),options:["10","15","20","25","30","40","50"],onChange:m=>u.saveToolRag({topK:Number(m)}),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(Ye,{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(Ye,{text:"Tool name patterns that are always included regardless of RAG scoring"})]}),r.jsx(ul,{value:u.toolRag.alwaysInclude??[],onChange:m=>u.saveToolRag({alwaysInclude:m}),placeholder:"e.g. telegram_send_*"})]})]}),r.jsx("div",{className:"card",children:r.jsx(Ci,{keys:hm,configKeys:f,getLocal:u.getLocal,getServer:u.getServer,setLocal:u.setLocal,saveConfig:u.saveConfig,cancelLocal:u.cancelLocal,title:"Advanced"})}),r.jsx("div",{className:"card",children:r.jsx(Ci,{keys:["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"],configKeys:f,getLocal:u.getLocal,getServer:u.getServer,setLocal:u.setLocal,saveConfig:u.saveConfig,cancelLocal:u.cancelLocal,title:"Session"})})]})]})}function gm({data:s,onChange:a}){const[c,u]=p.useState(null),[f,h]=p.useState(!0),[v,y]=p.useState(""),[E,m]=p.useState(!1);p.useEffect(()=>{Xe.getStatus().then(k=>u(k)).catch(k=>y(k instanceof Error?k.message:String(k))).finally(()=>h(!1))},[]);const x=async k=>{if(a({...s,riskAccepted:k}),k&&!E)try{await Xe.initWorkspace(s.agentName||void 0),m(!0)}catch(P){y(P instanceof Error?P.message:String(P))}};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:k=>a({...s,agentName:k.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."}),v&&r.jsx("div",{className:"alert error",children:v}),r.jsx("div",{className:"form-group",children:r.jsxs("label",{className:"label-inline",children:[r.jsx("input",{type:"checkbox",checked:s.riskAccepted,onChange:k=>x(k.target.checked)}),r.jsx("span",{children:"I understand the risks and accept full responsibility"})]})}),f&&r.jsx("div",{className:"loading",children:"Checking workspace..."})]})}function xm({data:s,onChange:a}){const[c,u]=p.useState([]),[f,h]=p.useState(!0),[v,y]=p.useState(""),[E,m]=p.useState(null),[x,k]=p.useState(""),[P,H]=p.useState(!1),D=p.useRef(null),[w,S]=p.useState(null),[z,W]=p.useState(!1),[X,Q]=p.useState(!1),[G,F]=p.useState([]),[te,re]=p.useState(!1);p.useEffect(()=>{Xe.getProviders().then(b=>u(b)).catch(b=>y(b instanceof Error?b.message:String(b))).finally(()=>h(!1))},[]);const V=c.find(b=>b.id===s.provider);p.useEffect(()=>{V!=null&&V.autoDetectsKey&&(W(!0),S(null),Q(!1),Xe.detectClaudeCodeKey().then(b=>{S(b),b.found&&a({...s,apiKey:""})}).catch(()=>S({found:!1,maskedKey:null,valid:!1})).finally(()=>W(!1)))},[V==null?void 0:V.id]),p.useEffect(()=>{if(!s.provider||s.provider==="cocoon"||s.provider==="local"){F([]);return}re(!0),Xe.getModels(s.provider).then(b=>{F(b),!s.model&&b.length>0&&a({...s,model:b[0].value})}).catch(()=>F([])).finally(()=>re(!1))},[s.provider]);const I=b=>{a({...s,provider:b,apiKey:"",model:"",customModel:""}),m(null),k(""),S(null),Q(!1),D.current&&clearTimeout(D.current)},A=async(b,ne)=>{if(!(!ne||!b)){H(!0);try{const ce=await Xe.validateApiKey(b,ne);m(ce.valid),k(ce.error||"")}catch{m(null),k("")}finally{H(!1)}}},ee=b=>{a({...s,apiKey:b}),m(null),k(""),D.current&&clearTimeout(D.current),b.length>0&&s.provider&&(D.current=setTimeout(()=>A(s.provider,b),500))};return f?r.jsx("div",{className:"loading",children:"Loading providers..."}):v?r.jsx("div",{className:"alert error",children:v}):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(b=>r.jsxs("div",{className:`provider-card${s.provider===b.id?" selected":""}`,onClick:()=>I(b.id),children:[r.jsx("h3",{children:b.displayName}),r.jsx("div",{className:"provider-meta",children:b.defaultModel}),b.toolLimit===null&&r.jsx("span",{className:"badge always",style:{marginTop:"6px"},children:"Recommended"})]},b.id))}),V&&V.toolLimit!==null&&r.jsxs("div",{className:"info-box",style:{marginTop:"16px"},children:["Teleton has ~116 tools. With a ",V.toolLimit,"-tool limit, some tools may be truncated or unavailable."]}),V&&V.autoDetectsKey&&r.jsxs("div",{style:{marginTop:"16px"},children:[z&&r.jsxs("div",{className:"info-panel",children:[r.jsx("span",{className:"spinner sm"})," Detecting Claude Code credentials..."]}),!z&&(w==null?void 0:w.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:w.maskedKey}),r.jsx("div",{className:"helper-text",style:{marginTop:"6px"},children:"Token will auto-refresh when it expires. No configuration needed."})]}),!z&&w&&!w.found&&!X&&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:()=>Q(!0),children:"Enter API key manually instead"})]}),!z&&X&&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:b=>ee(b.target.value),placeholder:V.keyPrefix?`${V.keyPrefix}...`:"Enter API key",className:"w-full"}),P&&r.jsxs("div",{className:"helper-text",children:[r.jsx("span",{className:"spinner sm"})," Validating..."]}),!P&&E===!0&&r.jsx("div",{className:"helper-text success",children:"Key format looks valid."}),!P&&E===!1&&x&&r.jsx("div",{className:"helper-text error",children:x}),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/"})]})]})]}),V&&V.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:b=>ee(b.target.value),placeholder:V.keyPrefix?`${V.keyPrefix}...`:"Enter API key",className:"w-full"}),P&&r.jsxs("div",{className:"helper-text",children:[r.jsx("span",{className:"spinner sm"})," Validating..."]}),!P&&E===!0&&r.jsx("div",{className:"helper-text success",children:"Key format looks valid."}),!P&&E===!1&&x&&r.jsx("div",{className:"helper-text error",children:x}),V.consoleUrl&&r.jsxs("div",{className:"helper-text",children:["Get your key at:"," ",r.jsx("a",{href:V.consoleUrl,target:"_blank",rel:"noopener noreferrer",children:V.consoleUrl})]})]}),V&&!V.requiresApiKey&&V.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:b=>a({...s,cocoonPort:parseInt(b.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)."})]})]}),V&&V.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:b=>a({...s,localUrl:b.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"})]})]}),V&&V.id!=="cocoon"&&V.id!=="local"&&r.jsxs("div",{className:"form-group",style:{marginTop:"16px"},children:[r.jsx("label",{children:"Model"}),te?r.jsxs("div",{className:"text-muted",children:[r.jsx("span",{className:"spinner sm"})," Loading models..."]}):r.jsx(yt,{value:s.model,options:G.map(b=>b.value),labels:G.map(b=>b.isCustom?"Custom...":`${b.name} - ${b.description}`),onChange:b=>a({...s,model:b}),style:{width:"100%"}}),s.model==="__custom__"&&r.jsx("input",{type:"text",value:s.customModel,onChange:b=>a({...s,customModel:b.target.value}),placeholder:"Enter custom model ID",className:"w-full",style:{marginTop:"8px"}})]})]})}const ym=()=>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"})]}),vm=()=>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 cl({value:s,onChange:a,placeholder:c,className:u,style:f}){const[h,v]=p.useState(!1);return r.jsxs("div",{className:"password-wrapper",style:f,children:[r.jsx("input",{type:h?"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:()=>v(!h),"aria-label":h?"Hide":"Show",children:h?r.jsx(vm,{}):r.jsx(ym,{})})]})}function jm({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)"]})]})]}),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(cl,{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:"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 Sm({data:s,onChange:a}){const[c,u]=p.useState(!1),[f,h]=p.useState(null),[v,y]=p.useState(!1),[E,m]=p.useState(""),x=async()=>{if(s.botToken){u(!0),m(""),h(null),y(!1);try{const w=await Xe.validateBotToken(s.botToken);w.valid&&w.bot?(h(!0),a({...s,botUsername:w.bot.username})):w.networkError?y(!0):(h(!1),m(w.error||"Invalid bot token"))}catch(w){m(w instanceof Error?w.message:String(w))}finally{u(!1)}}},k=["admin-only","allowlist","open","disabled"],P=["Admin Only","Allowlist","Open","Disabled"],H={"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."},D={"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:w=>a({...s,userId:parseInt(w.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(yt,{value:s.dmPolicy,options:k,labels:P,onChange:w=>a({...s,dmPolicy:w}),style:{width:"100%"}}),r.jsx("div",{className:"helper-text",children:H[s.dmPolicy]||""})]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Group Policy"}),r.jsx(yt,{value:s.groupPolicy,options:k,labels:P,onChange:w=>a({...s,groupPolicy:w}),style:{width:"100%"}}),r.jsx("div",{className:"helper-text",children:D[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:w=>a({...s,requireMention:w.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:w=>a({...s,maxIterations:parseInt(w.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(yt,{value:s.execMode,options:["off","yolo"],labels:{off:"Disabled",yolo:"YOLO Mode"},onChange:w=>a({...s,execMode:w}),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(cl,{value:s.botToken,onChange:w=>{a({...s,botToken:w.target.value,botUsername:""}),h(null),y(!1),m("")},placeholder:"123456:ABC-DEF...",style:{flex:1}}),r.jsx("button",{onClick:x,disabled:c||!s.botToken,type:"button",children:c?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Validating"]}):"Validate"})]}),f&&s.botUsername&&r.jsxs("div",{className:"alert success",children:["Bot verified: @",s.botUsername]}),v&&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:w=>a({...s,botUsername:w.target.value}),placeholder:"my_bot",className:"w-full"})]})]}),f===!1&&E&&r.jsx("div",{className:"alert error",children:E}),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(cl,{value:s.tonapiKey,onChange:w=>a({...s,tonapiKey:w.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(cl,{value:s.toncenterKey,onChange:w=>a({...s,toncenterKey:w.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(cl,{value:s.tavilyKey,onChange:w=>a({...s,tavilyKey:w.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 Qu({text:s}){const[a,c]=p.useState(!1),u=p.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 wm({data:s,onChange:a}){const[c,u]=p.useState(null),[f,h]=p.useState(!0),[v,y]=p.useState(!1),[E,m]=p.useState(""),[x,k]=p.useState([]);p.useEffect(()=>{Xe.getWalletStatus().then(w=>{u(w),w.exists&&w.address&&a({...s,walletAddress:w.address,walletAction:"keep"})}).catch(w=>m(w instanceof Error?w.message:String(w))).finally(()=>h(!1))},[]);const P=async()=>{y(!0),m("");try{if(s.walletAction==="import"){const w=s.mnemonic.trim().split(/\s+/);if(w.length!==24){m("Mnemonic must be exactly 24 words."),y(!1);return}const S=await Xe.importWallet(s.mnemonic.trim());a({...s,walletAddress:S.address}),k(w)}else{const w=await Xe.generateWallet();a({...s,walletAddress:w.address}),k(w.mnemonic)}}catch(w){m(w instanceof Error?w.message:String(w))}finally{y(!1)}};if(f)return r.jsx("div",{className:"loading",children:"Checking wallet..."});const H=x.length>0,D=s.walletAction!=="keep"&&!H;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."}),E&&r.jsx("div",{className:"alert error",children:E}),(c==null?void 0:c.exists)&&c.address&&!H&&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})]}),!H&&r.jsx("div",{className:"form-group",children:(c!=null&&c.exists?["keep","generate","import"]:["generate","import"]).map(w=>r.jsxs("label",{className:"label-inline",style:{marginBottom:"8px"},children:[r.jsx("input",{type:"radio",name:"walletAction",value:w,checked:s.walletAction===w,onChange:()=>{a({...s,walletAction:w,mnemonic:"",mnemonicSaved:!1})}}),r.jsxs("span",{children:[w==="keep"&&"Keep existing wallet",w==="generate"&&"Generate new wallet",w==="import"&&"Import from mnemonic"]})]},w))}),s.walletAction==="import"&&!H&&r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Recovery Phrase (24 words)"}),r.jsx("textarea",{value:s.mnemonic,onChange:w=>a({...s,mnemonic:w.target.value}),placeholder:"word1 word2 word3 ... word24",className:"w-full mono",style:{minHeight:"80px"}})]}),D&&s.walletAction!=="keep"&&r.jsx("button",{onClick:P,disabled:v||s.walletAction==="import"&&s.mnemonic.trim().split(/\s+/).length!==24,type:"button",children:v?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Working..."]}):s.walletAction==="generate"?"Generate Wallet":"Import Wallet"}),H&&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(Qu,{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:x.map((w,S)=>r.jsxs("li",{className:"mnemonic-word",children:[r.jsxs("span",{className:"num",children:[S+1,"."]}),w]},S))}),r.jsx("div",{className:"form-row",style:{justifyContent:"flex-end",marginBottom:"8px"},children:r.jsx(Qu,{text:x.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:w=>a({...s,mnemonicSaved:w.target.checked})}),r.jsx("span",{style:{fontWeight:500},children:"I have saved my recovery phrase"})]})})]})]})}const km="modulepreload",Cm=function(s){return"/"+s},Yu={},fl=function(a,c,u){let f=Promise.resolve();if(c&&c.length>0){let v=function(m){return Promise.all(m.map(x=>Promise.resolve(x).then(k=>({status:"fulfilled",value:k}),k=>({status:"rejected",reason:k}))))};document.getElementsByTagName("link");const y=document.querySelector("meta[property=csp-nonce]"),E=(y==null?void 0:y.nonce)||(y==null?void 0:y.getAttribute("nonce"));f=v(c.map(m=>{if(m=Cm(m),m in Yu)return;Yu[m]=!0;const x=m.endsWith(".css"),k=x?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${k}`))return;const P=document.createElement("link");if(P.rel=x?"stylesheet":km,x||(P.as="script"),P.crossOrigin="",P.href=m,E&&P.setAttribute("nonce",E),document.head.appendChild(P),x)return new Promise((H,D)=>{P.addEventListener("load",H),P.addEventListener("error",()=>D(new Error(`Unable to preload CSS for ${m}`)))})}))}function h(v){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=v,window.dispatchEvent(y),!y.defaultPrevented)throw v}return f.then(v=>{for(const y of v||[])y.status==="rejected"&&h(y.reason);return a().catch(h)})},Em=p.lazy(()=>fl(()=>import("./index.es-DkU1GvWU.js"),[])),Nm=()=>fl(()=>import("./run-DOrDowjK.js"),[]).then(s=>s.default),_m=()=>fl(()=>import("./login-telegram-BP7CJDmx.js"),[]).then(s=>s.default);function Gu({loader:s,size:a}){const[c,u]=p.useState(null);return p.useEffect(()=>{s().then(u)},[]),c?r.jsx(p.Suspense,{fallback:r.jsx("div",{style:{width:a,height:a,margin:"0 auto 16px"}}),children:r.jsx(Em,{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 Pm({data:s,onChange:a}){const[c,u]=p.useState("idle"),[f,h]=p.useState(!1),[v,y]=p.useState(""),[E,m]=p.useState(""),[x,k]=p.useState(""),[P,H]=p.useState(""),[D,w]=p.useState("sms"),[S,z]=p.useState(""),[W,X]=p.useState(!1),[Q,G]=p.useState(0),F=p.useRef(null);p.useEffect(()=>{if(!(Q<=0))return F.current=setInterval(()=>{G(A=>A<=1?(F.current&&clearInterval(F.current),0):A-1)},1e3),()=>{F.current&&clearInterval(F.current)}},[Q>0]),p.useEffect(()=>{if(c!=="code_sent")return;const A=setTimeout(()=>X(!0),3e4);return()=>clearTimeout(A)},[c]),p.useEffect(()=>{s.telegramUser&&u("done")},[]);const te=async()=>{var A;h(!0),y("");try{const ee=await Xe.sendCode(s.apiId,s.apiHash,s.phone);a({...s,authSessionId:ee.authSessionId}),w(ee.codeDelivery),ee.fragmentUrl&&z(ee.fragmentUrl),u("code_sent"),X(!1)}catch(ee){const b=ee instanceof Error?ee.message:String(ee);if(b.includes("FLOOD")){const ne=parseInt(((A=b.match(/(\d+)/))==null?void 0:A[1])||"60");G(ne)}y(b)}finally{h(!1)}},re=async A=>{if(m(A),!(A.length<5)){h(!0),y("");try{const ee=await Xe.verifyCode(s.authSessionId,A);ee.status==="authenticated"&&ee.user?(a({...s,telegramUser:ee.user,skipConnect:!1}),u("done")):ee.status==="2fa_required"&&(H(ee.passwordHint||""),u("2fa"))}catch(ee){const b=ee instanceof Error?ee.message:String(ee);y(b)}finally{h(!1)}}},V=async()=>{h(!0),y("");try{const A=await Xe.verifyPassword(s.authSessionId,x);A.status==="authenticated"&&A.user&&(a({...s,telegramUser:A.user,skipConnect:!1}),u("done"))}catch(A){y(A instanceof Error?A.message:String(A))}finally{h(!1)}},I=async()=>{h(!0),y("");try{const A=await Xe.resendCode(s.authSessionId);w(A.codeDelivery),A.fragmentUrl&&z(A.fragmentUrl),m(""),X(!1)}catch(A){y(A instanceof Error?A.message:String(A))}finally{h(!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:"Authenticate with your Telegram account. This lets the agent send and receive messages as you."}),v&&r.jsx("div",{className:"alert error",children:v}),c==="idle"&&r.jsxs("div",{className:"text-center",style:{padding:"20px 0"},children:[r.jsx(Gu,{loader:Nm,size:200}),r.jsx("button",{onClick:te,disabled:f||Q>0,type:"button",className:"btn-lg",children:f?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Connecting..."]}):Q>0?`Wait ${Q}s`:"Connect to Telegram"})]}),c==="code_sent"&&r.jsxs("div",{className:"text-center",style:{padding:"20px 0"},children:[r.jsx(Gu,{loader:_m,size:180}),D==="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 ",D==="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:E,onChange:A=>{const ee=A.target.value.replace(/\D/g,"").slice(0,5);re(ee)},placeholder:"12345",maxLength:5,autoFocus:!0,disabled:f})}),f&&r.jsxs("div",{className:"text-muted",children:[r.jsx("span",{className:"spinner sm"})," Verifying..."]}),W&&!f&&r.jsx("button",{type:"button",className:"btn-ghost",onClick:I,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"}),P&&r.jsxs("div",{className:"info-panel text-center",children:["Hint: ",P]}),r.jsxs("div",{className:"form-group",children:[r.jsx("label",{children:"Password"}),r.jsx("input",{type:"password",value:x,onChange:A=>k(A.target.value),onKeyDown:A=>A.key==="Enter"&&V(),placeholder:"Enter your 2FA password",className:"w-full",autoFocus:!0})]}),r.jsx("button",{onClick:V,disabled:f||!x,type:"button",children:f?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 Bn=[{id:"welcome",label:"Welcome"},{id:"provider",label:"Provider"},{id:"config",label:"Config"},{id:"wallet",label:"Wallet"},{id:"telegram",label:"Telegram"},{id:"connect",label:"Connect"}],Tm={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,skipConnect:!1,webuiEnabled:!1,execMode:"off"};function bm(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&&a.phone.startsWith("+");case 5:return a.telegramUser!==null||a.skipConnect;default:return!1}}const xd=p.createContext(null);function Mi(){const s=p.useContext(xd);if(!s)throw new Error("useSetup must be used inside SetupProvider");return s}function Rm({children:s}){const[a,c]=p.useState(0),[u,f]=p.useState(Tm),[h,v]=p.useState(!1),[y,E]=p.useState(""),[m,x]=p.useState(!1),[k,P]=p.useState(!1),[H,D]=p.useState(""),w=bm(a,u),S=p.useCallback(()=>{w&&c(G=>Math.min(G+1,Bn.length-1))},[w]),z=p.useCallback(()=>{c(G=>Math.max(G-1,0))},[]),W=p.useCallback(async()=>{v(!0),E("");try{const G=u.model==="__custom__"?u.customModel:u.model||void 0,F={agent:{provider:u.provider,...u.provider!=="cocoon"&&u.provider!=="local"&&u.apiKey?{api_key:u.apiKey}:{},...u.provider==="local"?{base_url:u.localUrl}:{},...G?{model:G}:{},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 Xe.saveConfig(F),x(!0)}catch(G){E(G instanceof Error?G.message:String(G))}finally{v(!1)}},[u]),X=p.useCallback(async()=>{P(!0),D("");try{const{token:G}=await Xe.launch();await Xe.pollHealth(3e4),window.location.href=`/auth/exchange?token=${encodeURIComponent(G)}`}catch(G){D(G instanceof Error?G.message:String(G))}finally{P(!1)}},[]),Q=p.useRef(W);return Q.current=W,p.useEffect(()=>{a===Bn.length-1&&u.telegramUser&&!m&&!h&&Q.current()},[a,u.telegramUser,m,h]),r.jsx(xd.Provider,{value:{step:a,data:u,loading:h,error:y,saved:m,launching:k,launchError:H,canAdvance:w,setData:f,next:S,prev:z,handleSave:W,handleLaunch:X},children:s})}const Lm=p.lazy(()=>fl(()=>import("./index.es-DkU1GvWU.js"),[])),zm=()=>fl(()=>import("./complete-fZLnb5Ot.js"),[]).then(s=>s.default);function Im(){const[s,a]=p.useState(null);p.useEffect(()=>{zm().then(a)},[]);const c=200;return s?r.jsx(p.Suspense,{fallback:r.jsx("div",{style:{width:c,height:c,margin:"0 auto 24px"}}),children:r.jsx(Lm,{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 Am(){const{launching:s,launchError:a,handleLaunch:c}=Mi();return r.jsxs("div",{className:"step-content text-center",style:{paddingTop:"40px"},children:[r.jsx(Im,{}),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 Dm=[gm,xm,Sm,wm,jm,Pm];function Mm(){const{step:s,data:a,loading:c,error:u,saved:f,canAdvance:h,setData:v,next:y,prev:E}=Mi();if(f)return r.jsx(Am,{});const m=Dm[s],x=s<Bn.length-1?Bn[s+1].label:"";return r.jsxs(r.Fragment,{children:[r.jsx(m,{data:a,onChange:v}),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:E,type:"button",children:"Back"}),r.jsx("div",{style:{flex:1}}),s<Bn.length-1&&r.jsx("button",{onClick:y,disabled:!h||c,type:"button",children:c?r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"spinner sm"})," Next"]}):`Next: ${x}`})]})]})}function Om(){const{step:s}=Mi();return r.jsx("div",{className:"step-indicator",children:Bn.map((a,c)=>{const u=c<s,f=c===s;return r.jsxs("div",{className:"step-cell",children:[r.jsxs("div",{className:"step-cell-top",children:[r.jsx("div",{className:`step-dot${f?" 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<Bn.length-1&&r.jsx("div",{className:`step-line${u?" completed":""}`})]}),r.jsx("div",{className:`step-label${f?" active":""}${u?" completed":""}`,children:a.label})]},a.id)})})}const Fm=[{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 Bm(){return r.jsx("nav",{children:Fm.map(s=>r.jsx("span",{className:"sidebar-link-disabled",children:s.label},s.path))})}function Um(){return r.jsxs(r.Fragment,{children:[r.jsx(Om,{}),r.jsx(id,{})]})}function Wm(){return r.jsx(Rm,{children:r.jsx(ud,{sidebar:r.jsx(Bm,{}),children:r.jsx(Um,{})})})}function $m(){return window.location.pathname.startsWith("/setup")?r.jsx(cd,{children:r.jsx(dd,{children:r.jsx(ad,{children:r.jsx(pt,{path:"/setup",element:r.jsx(Wm,{}),children:r.jsx(pt,{index:!0,element:r.jsx(Mm,{})})})})})}):r.jsx(Km,{})}function Km(){const[s,a]=p.useState(!1),[c,u]=p.useState(!0),[f,h]=p.useState(""),[v,y]=p.useState("");p.useEffect(()=>{const x=new URLSearchParams(window.location.search).get("token");if(window.location.pathname==="/auth/exchange"&&x){Bu(x).then(k=>{k?window.location.href="/":(u(!1),y("Token exchange failed"))});return}$h().then(k=>{a(k),u(!1)})},[]),p.useEffect(()=>{s&&Fn.connect()},[s]);const E=async()=>{const m=f.trim();if(!m)return;y(""),await Bu(m)?a(!0):y("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(cd,{children:r.jsx(dd,{children:r.jsx(ad,{children:r.jsxs(pt,{path:"/",element:r.jsx(Hh,{}),children:[r.jsx(pt,{index:!0,element:r.jsx(qh,{})}),r.jsx(pt,{path:"tools",element:r.jsx(Xh,{})}),r.jsx(pt,{path:"plugins",element:r.jsx(Zh,{})}),r.jsx(pt,{path:"soul",element:r.jsx(em,{})}),r.jsx(pt,{path:"memory",element:r.jsx(tm,{})}),r.jsx(pt,{path:"workspace",element:r.jsx(im,{})}),r.jsx(pt,{path:"tasks",element:r.jsx(cm,{})}),r.jsx(pt,{path:"mcp",element:r.jsx(um,{})}),r.jsx(pt,{path:"config",element:r.jsx(mm,{})}),r.jsx(pt,{path:"*",element:r.jsx(yh,{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:f,onChange:m=>h(m.target.value),onKeyDown:m=>m.key==="Enter"&&E(),placeholder:"Paste token from config...",style:{width:"100%"}})]}),v&&r.jsx("div",{className:"alert error",style:{marginBottom:"1rem"},children:v}),r.jsx("button",{onClick:E,style:{width:"100%"},children:"Sign In"})]})})}Ef.createRoot(document.getElementById("root")).render(r.jsx(p.StrictMode,{children:r.jsx($m,{})}));export{xr as R,gf as g,p as r};
|